Trond Enger / d7a_1x

Fork of d7a_1x by WizziLab

Revision:
73:3b7353741c94
Parent:
71:f03727ff0f99
Child:
74:30180585b09e
--- a/include/d7a.h	Wed Nov 09 15:21:28 2016 +0000
+++ b/include/d7a.h	Mon Dec 05 14:32:18 2016 +0000
@@ -40,6 +40,8 @@
 #define D7A_ITF_BULK                (112)
 #define D7A_ITF_BLINK               (113)
 
+#define D7A_FID_ALP_CFG             (50)
+
 
 //======================================================================
 // Enums
@@ -156,12 +158,47 @@
 } d7a_errors_t;
 
 
+
+TYPEDEF_STRUCT_PACKED {
+    struct {
+        /// Backoff time generator for retry attempts
+        /// - if '0': No backoff
+        /// - if '1': Linear backoff, retry every slot_time seconds
+        /// - if '2': RFU
+        /// - if '3': RFU
+        uint8_t procedure    : 4;
+        /// On transmission success or at the end of the retry procedure:
+        /// - if '1': a response is generated to requester (source ITF)
+        /// - if '0': nothing notified to the source
+        uint8_t respond      : 1;
+        /// On transmission success or at the end of the retry procedure:
+        /// - if '1': Session fifo remains opened for further messaging
+        /// - if '0': Session fifo is closed/released
+        uint8_t persistant   : 1;
+        /// When a payload is send to an ITF that implements buffering,
+        /// if 'bulk' is set the ITF should not start actual transfer until
+        /// buffer is full.
+        uint8_t bulk         : 1;
+
+        uint8_t rfu          : 1;
+    } meta;
+    /// Number of "pushed" messages that will be internally buffered
+    /// until they are successfully sent. In case of overflow, the oldest
+    /// message is lost.
+    uint8_t depth;
+    /// Maximum number of retry steps
+    uint8_t retries;
+    /// Unit of time (in second) used for Backoff time calculation
+    uint8_t slot_time;
+} alp_retry_policy_t;
+
+
 /// Types of retry policies
 /// Respond: When finished the host will be notified
 /// Persist: When finished on error data is kept in the queue for next transmission
 /// Depth:   Number of commands kept in the queue
 /// Bulk:    Notifications sent only when the queue is full
-/// Retries: Number of retries after initial transmission
+/// Retries: Number of retries after initial transmission (if 0 no backoff, else linear backoff)
 /// Slot:    Time between retries (sec)
 typedef enum {
     /// Respond: true
@@ -170,47 +207,55 @@
     /// Bulk:    false
     /// Retries: 0
     /// Slot:    0
-    ALP_RPOL_ONESHOT         = 0,
+    ALP_RPOL_ONESHOT,
+    
     /// Respond: true
     /// Persist: false
     /// Depth:   1
     /// Bulk:    false
     /// Retries: 3
     /// Slot:    2
-    ALP_RPOL_SINGLE          = 1,
+    ALP_RPOL_SINGLE,
+    
     /// Respond: true
     /// Persist: false
     /// Depth:   1
     /// Bulk:    false
     /// Retries: 3
     /// Slot:    2
-    ALP_RPOL_REPORT          = 2,
+    ALP_RPOL_REPORT,
+    
     /// Respond: false
     /// Persist: true
     /// Depth:   4
     /// Bulk:    false
     /// Retries: 16
     /// Slot:    20
-    ALP_RPOL_REPORT_CHECKED  = 3,
+    ALP_RPOL_REPORT_CHECKED,
+    
     /// Respond: true
     /// Persist: false
     /// Depth:   4
     /// Bulk:    true
     /// Retries: 0
     /// Slot:    1
-    ALP_RPOL_BULK            = 4,
+    ALP_RPOL_BULK,
+    
+    ALP_RPOL_SPARE_5,
+    ALP_RPOL_SPARE_6,
+    
     /// Respond: false
     /// Persist: false
     /// Depth:   1
     /// Bulk:    false
     /// Retries: 0
     /// Slot:    1
-    ALP_RPOL_BLINK           = 5,
-    
-    //ALP_RPOL_SPARE_2         = 6,
-    //ALP_RPOL_SPARE_3         = 7,
+    ALP_RPOL_BLINK,
+
+    ALP_RPOL_QTY,
 } alp_rpol_t;
 
+
 /// Action when file notifying
 typedef enum {
     D7A_ACTION_NONE = 0,