Преглед на файлове

Reference the hard reset thread by the new struct

Clara Hobbs преди 7 години
родител
ревизия
e7a7d30691
променени са 4 файла, в които са добавени 7 реда и са изтрити 11 реда
  1. 1
    3
      lib/src/hard_reset.c
  2. 0
    3
      lib/src/hard_reset.h
  3. 4
    3
      lib/src/int_n.c
  4. 2
    2
      lib/src/policy_engine.c

+ 1
- 3
lib/src/hard_reset.c Целия файл

@@ -26,8 +26,6 @@
26 26
 #include "pd.h"
27 27
 
28 28
 
29
-thread_t *pdb_hardrst_thread;
30
-
31 29
 /*
32 30
  * Hard Reset machine states
33 31
  */
@@ -160,6 +158,6 @@ static THD_FUNCTION(HardReset, cfg) {
160 158
 
161 159
 void pdb_hardrst_run(struct pdb_config *cfg)
162 160
 {
163
-    pdb_hardrst_thread = chThdCreateStatic(cfg->prl._hardrst_wa,
161
+    cfg->prl.hardrst_thread = chThdCreateStatic(cfg->prl._hardrst_wa,
164 162
             sizeof(cfg->prl._hardrst_wa), PDB_PRIO_PRL, HardReset, cfg);
165 163
 }

+ 0
- 3
lib/src/hard_reset.h Целия файл

@@ -30,9 +30,6 @@
30 30
 #define PDB_EVT_HARDRST_I_HARDSENT EVENT_MASK(2)
31 31
 #define PDB_EVT_HARDRST_DONE EVENT_MASK(3)
32 32
 
33
-/* The Hard Reset thread object */
34
-extern thread_t *pdb_hardrst_thread;
35
-
36 33
 /*
37 34
  * Start the Hard Reset thread
38 35
  */

+ 4
- 3
lib/src/int_n.c Целия файл

@@ -21,6 +21,7 @@
21 21
 #include <ch.h>
22 22
 #include <hal.h>
23 23
 
24
+#include <pdb.h>
24 25
 #include "priorities.h"
25 26
 #include "fusb302b.h"
26 27
 #include "protocol_rx.h"
@@ -32,8 +33,8 @@
32 33
 /*
33 34
  * INT_N polling thread
34 35
  */
35
-static THD_FUNCTION(IntNPoll, cfg) {
36
-    (void) cfg;
36
+static THD_FUNCTION(IntNPoll, vcfg) {
37
+    struct pdb_config *cfg = vcfg;
37 38
 
38 39
     union fusb_status status;
39 40
     eventmask_t events;
@@ -69,7 +70,7 @@ static THD_FUNCTION(IntNPoll, cfg) {
69 70
             if (status.interrupta & FUSB_INTERRUPTA_I_HARDSENT) {
70 71
                 events |= PDB_EVT_HARDRST_I_HARDSENT;
71 72
             }
72
-            chEvtSignal(pdb_hardrst_thread, events);
73
+            chEvtSignal(cfg->prl.hardrst_thread, events);
73 74
 
74 75
             /* If the I_OCP_TEMP and OVRTEMP flags are set, tell the Policy
75 76
              * Engine thread */

+ 2
- 2
lib/src/policy_engine.c Целия файл

@@ -484,7 +484,7 @@ static enum policy_engine_state pe_sink_hard_reset(struct pdb_config *cfg)
484 484
     }
485 485
 
486 486
     /* Generate a hard reset signal */
487
-    chEvtSignal(pdb_hardrst_thread, PDB_EVT_HARDRST_RESET);
487
+    chEvtSignal(cfg->prl.hardrst_thread, PDB_EVT_HARDRST_RESET);
488 488
     chEvtWaitAny(PDB_EVT_PE_HARD_SENT);
489 489
 
490 490
     /* Increment HardResetCounter */
@@ -505,7 +505,7 @@ static enum policy_engine_state pe_sink_transition_default(struct pdb_config *cf
505 505
      * it here. */
506 506
 
507 507
     /* Tell the protocol layer we're done with the reset */
508
-    chEvtSignal(pdb_hardrst_thread, PDB_EVT_HARDRST_DONE);
508
+    chEvtSignal(cfg->prl.hardrst_thread, PDB_EVT_HARDRST_DONE);
509 509
 
510 510
     return PESinkStartup;
511 511
 }

Loading…
Отказ
Запис