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
 /*
123
 /*
124
  * Hard Reset state machine thread
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
     enum hardrst_state state = PRLHRResetLayer;
128
     enum hardrst_state state = PRLHRResetLayer;
130
 
129
 
131
     while (true) {
130
     while (true) {
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
 
21
 
22
 #include <ch.h>
22
 #include <ch.h>
23
 
23
 
24
+#include <pdb.h>
25
+
24
 
26
 
25
 /* Events for the Hard Reset thread */
27
 /* Events for the Hard Reset thread */
26
 #define PDB_EVT_HARDRST_RESET EVENT_MASK(0)
28
 #define PDB_EVT_HARDRST_RESET EVENT_MASK(0)
34
 /*
36
 /*
35
  * Start the Hard Reset thread
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
 #endif /* PDB_HARD_RESET_H */
42
 #endif /* PDB_HARD_RESET_H */

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

34
     pdb_pe_run(cfg);
34
     pdb_pe_run(cfg);
35
 
35
 
36
     /* Create the protocol layer threads. */
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
     /* Create the INT_N thread. */
41
     /* Create the INT_N thread. */
42
     pdb_int_n_run(cfg);
42
     pdb_int_n_run(cfg);

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

156
 /*
156
 /*
157
  * Protocol layer RX state machine thread
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
     enum protocol_rx_state state = PRLRxWaitPHY;
161
     enum protocol_rx_state state = PRLRxWaitPHY;
163
 
162
 
164
     while (true) {
163
     while (true) {
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
 
23
 
24
 #include <ch.h>
24
 #include <ch.h>
25
 
25
 
26
+#include <pdb.h>
27
+
26
 
28
 
27
 /* Events for the Protocol RX thread */
29
 /* Events for the Protocol RX thread */
28
 #define PDB_EVT_PRLRX_RESET EVENT_MASK(0)
30
 #define PDB_EVT_PRLRX_RESET EVENT_MASK(0)
37
 /*
39
 /*
38
  * Start the Protocol RX thread
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
 #endif /* PDB_PROTOCOL_RX_H */
45
 #endif /* PDB_PROTOCOL_RX_H */

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

236
 /*
236
 /*
237
  * Protocol layer TX state machine thread
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
     enum protocol_tx_state state = PRLTxPHYReset;
242
     enum protocol_tx_state state = PRLTxPHYReset;
244
 
243
 
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
 
23
 
24
 #include <ch.h>
24
 #include <ch.h>
25
 
25
 
26
+#include <pdb.h>
27
+
26
 
28
 
27
 /* Events for the Protocol TX thread */
29
 /* Events for the Protocol TX thread */
28
 #define PDB_EVT_PRLTX_RESET EVENT_MASK(0)
30
 #define PDB_EVT_PRLTX_RESET EVENT_MASK(0)
43
 /*
45
 /*
44
  * Start the Protocol TX thread
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
 #endif /* PDB_PROTOCOL_TX_H */
51
 #endif /* PDB_PROTOCOL_TX_H */

Loading…
Cancel
Save