Browse Source

Use all working areas in struct pdb_config

Clara Hobbs 6 years ago
parent
commit
452e22c0ee
7 changed files with 27 additions and 24 deletions
  1. 5
    6
      lib/src/hard_reset.c
  2. 3
    1
      lib/src/hard_reset.h
  3. 3
    3
      lib/src/pdb.c
  4. 5
    6
      lib/src/protocol_rx.c
  5. 3
    1
      lib/src/protocol_rx.h
  6. 5
    6
      lib/src/protocol_tx.c
  7. 3
    1
      lib/src/protocol_tx.h

+ 5
- 6
lib/src/hard_reset.c View File

@@ -123,9 +123,8 @@ static enum hardrst_state hardrst_complete(void)
123 123
 /*
124 124
  * Hard Reset state machine thread
125 125
  */
126
-static THD_WORKING_AREA(waHardReset, 128);
127
-static THD_FUNCTION(HardReset, arg) {
128
-    (void) arg;
126
+static THD_FUNCTION(HardReset, cfg) {
127
+    (void) cfg;
129 128
     enum hardrst_state state = PRLHRResetLayer;
130 129
 
131 130
     while (true) {
@@ -159,8 +158,8 @@ static THD_FUNCTION(HardReset, arg) {
159 158
     }
160 159
 }
161 160
 
162
-void pdb_hardrst_run(void)
161
+void pdb_hardrst_run(struct pdb_config *cfg)
163 162
 {
164
-    pdb_hardrst_thread = chThdCreateStatic(waHardReset, sizeof(waHardReset),
165
-            PDB_PRIO_PRL, HardReset, NULL);
163
+    pdb_hardrst_thread = chThdCreateStatic(cfg->prl._hardrst_wa,
164
+            sizeof(cfg->prl._hardrst_wa), PDB_PRIO_PRL, HardReset, cfg);
166 165
 }

+ 3
- 1
lib/src/hard_reset.h View File

@@ -21,6 +21,8 @@
21 21
 
22 22
 #include <ch.h>
23 23
 
24
+#include <pdb.h>
25
+
24 26
 
25 27
 /* Events for the Hard Reset thread */
26 28
 #define PDB_EVT_HARDRST_RESET EVENT_MASK(0)
@@ -34,7 +36,7 @@ extern thread_t *pdb_hardrst_thread;
34 36
 /*
35 37
  * Start the Hard Reset thread
36 38
  */
37
-void pdb_hardrst_run(void);
39
+void pdb_hardrst_run(struct pdb_config *cfg);
38 40
 
39 41
 
40 42
 #endif /* PDB_HARD_RESET_H */

+ 3
- 3
lib/src/pdb.c View File

@@ -34,9 +34,9 @@ void pdb_init(struct pdb_config *cfg)
34 34
     pdb_pe_run(cfg);
35 35
 
36 36
     /* Create the protocol layer threads. */
37
-    pdb_prlrx_run(/*cfg*/);
38
-    pdb_prltx_run(/*cfg*/);
39
-    pdb_hardrst_run(/*cfg*/);
37
+    pdb_prlrx_run(cfg);
38
+    pdb_prltx_run(cfg);
39
+    pdb_hardrst_run(cfg);
40 40
 
41 41
     /* Create the INT_N thread. */
42 42
     pdb_int_n_run(cfg);

+ 5
- 6
lib/src/protocol_rx.c View File

@@ -156,9 +156,8 @@ static enum protocol_rx_state protocol_rx_store_messageid(void)
156 156
 /*
157 157
  * Protocol layer RX state machine thread
158 158
  */
159
-static THD_WORKING_AREA(waProtocolRX, 128);
160
-static THD_FUNCTION(ProtocolRX, arg) {
161
-    (void) arg;
159
+static THD_FUNCTION(ProtocolRX, cfg) {
160
+    (void) cfg;
162 161
     enum protocol_rx_state state = PRLRxWaitPHY;
163 162
 
164 163
     while (true) {
@@ -183,8 +182,8 @@ static THD_FUNCTION(ProtocolRX, arg) {
183 182
     }
184 183
 }
185 184
 
186
-void pdb_prlrx_run(void)
185
+void pdb_prlrx_run(struct pdb_config *cfg)
187 186
 {
188
-    pdb_prlrx_thread = chThdCreateStatic(waProtocolRX, sizeof(waProtocolRX),
189
-            PDB_PRIO_PRL, ProtocolRX, NULL);
187
+    pdb_prlrx_thread = chThdCreateStatic(cfg->prl._rx_wa,
188
+            sizeof(cfg->prl._rx_wa), PDB_PRIO_PRL, ProtocolRX, cfg);
190 189
 }

+ 3
- 1
lib/src/protocol_rx.h View File

@@ -23,6 +23,8 @@
23 23
 
24 24
 #include <ch.h>
25 25
 
26
+#include <pdb.h>
27
+
26 28
 
27 29
 /* Events for the Protocol RX thread */
28 30
 #define PDB_EVT_PRLRX_RESET EVENT_MASK(0)
@@ -37,7 +39,7 @@ extern int8_t pdb_prlrx_messageid;
37 39
 /*
38 40
  * Start the Protocol RX thread
39 41
  */
40
-void pdb_prlrx_run(void);
42
+void pdb_prlrx_run(struct pdb_config *cfg);
41 43
 
42 44
 
43 45
 #endif /* PDB_PROTOCOL_RX_H */

+ 5
- 6
lib/src/protocol_tx.c View File

@@ -236,9 +236,8 @@ static enum protocol_tx_state protocol_tx_discard_message(void)
236 236
 /*
237 237
  * Protocol layer TX state machine thread
238 238
  */
239
-static THD_WORKING_AREA(waProtocolTX, 128);
240
-static THD_FUNCTION(ProtocolTX, arg) {
241
-    (void) arg;
239
+static THD_FUNCTION(ProtocolTX, cfg) {
240
+    (void) cfg;
242 241
 
243 242
     enum protocol_tx_state state = PRLTxPHYReset;
244 243
 
@@ -282,8 +281,8 @@ static THD_FUNCTION(ProtocolTX, arg) {
282 281
     }
283 282
 }
284 283
 
285
-void pdb_prltx_run(void)
284
+void pdb_prltx_run(struct pdb_config *cfg)
286 285
 {
287
-    pdb_prltx_thread = chThdCreateStatic(waProtocolTX, sizeof(waProtocolTX),
288
-            PDB_PRIO_PRL, ProtocolTX, NULL);
286
+    pdb_prltx_thread = chThdCreateStatic(cfg->prl._tx_wa,
287
+            sizeof(cfg->prl._tx_wa), PDB_PRIO_PRL, ProtocolTX, cfg);
289 288
 }

+ 3
- 1
lib/src/protocol_tx.h View File

@@ -23,6 +23,8 @@
23 23
 
24 24
 #include <ch.h>
25 25
 
26
+#include <pdb.h>
27
+
26 28
 
27 29
 /* Events for the Protocol TX thread */
28 30
 #define PDB_EVT_PRLTX_RESET EVENT_MASK(0)
@@ -43,7 +45,7 @@ extern int8_t pdb_prltx_messageidcounter;
43 45
 /*
44 46
  * Start the Protocol TX thread
45 47
  */
46
-void pdb_prltx_run(void);
48
+void pdb_prltx_run(struct pdb_config *cfg);
47 49
 
48 50
 
49 51
 #endif /* PDB_PROTOCOL_TX_H */

Loading…
Cancel
Save