Browse Source

Move policy_engine.h to lib/src/

To do this, a couple of the events had to have their definitions moved
to lib/include/pdb_pe.h.  This isn't a problem in and of itself, but if
more internal-use events are added to policy_engine.h there could be
trouble.  To mitigate this, I added a comment as a reminder to make sure
any new events don't overlap the public ones defined elsewhere.
Clara Hobbs 6 years ago
parent
commit
1646eb1e75
3 changed files with 19 additions and 5 deletions
  1. 11
    0
      lib/include/pdb_pe.h
  2. 7
    4
      lib/src/policy_engine.h
  3. 1
    1
      src/shell.c

+ 11
- 0
lib/include/pdb_pe.h View File

24
 
24
 
25
 #include <ch.h>
25
 #include <ch.h>
26
 
26
 
27
+/*
28
+ * Events for the Policy Engine thread, sent by user code
29
+ */
30
+/* Tell the PE to send a Get_Source_Cap message */
31
+#define PDB_EVT_PE_GET_SOURCE_CAP EVENT_MASK(6)
32
+/* Tell the PE that new power is required */
33
+#define PDB_EVT_PE_NEW_POWER EVENT_MASK(7)
34
+
27
 
35
 
36
+/*
37
+ * Structure for Policy Engine thread and variables
38
+ */
28
 struct pdb_pe {
39
 struct pdb_pe {
29
     THD_WORKING_AREA(_wa, 256);
40
     THD_WORKING_AREA(_wa, 256);
30
     thread_t *thread;
41
     thread_t *thread;

lib/include/policy_engine.h → lib/src/policy_engine.h View File

23
 
23
 
24
 #include <pdb.h>
24
 #include <pdb.h>
25
 
25
 
26
-
27
-/* Events for the Policy Engine thread */
26
+/*
27
+ * Events for the Policy Engine thread, used internally
28
+ *
29
+ * NOTE: If any more events are needed, make sure they don't overlap the ones
30
+ * in include/pdb_pe.h!
31
+ */
28
 #define PDB_EVT_PE_RESET EVENT_MASK(0)
32
 #define PDB_EVT_PE_RESET EVENT_MASK(0)
29
 #define PDB_EVT_PE_MSG_RX EVENT_MASK(1)
33
 #define PDB_EVT_PE_MSG_RX EVENT_MASK(1)
30
 #define PDB_EVT_PE_TX_DONE EVENT_MASK(2)
34
 #define PDB_EVT_PE_TX_DONE EVENT_MASK(2)
31
 #define PDB_EVT_PE_TX_ERR EVENT_MASK(3)
35
 #define PDB_EVT_PE_TX_ERR EVENT_MASK(3)
32
 #define PDB_EVT_PE_HARD_SENT EVENT_MASK(4)
36
 #define PDB_EVT_PE_HARD_SENT EVENT_MASK(4)
33
 #define PDB_EVT_PE_I_OVRTEMP EVENT_MASK(5)
37
 #define PDB_EVT_PE_I_OVRTEMP EVENT_MASK(5)
34
-#define PDB_EVT_PE_GET_SOURCE_CAP EVENT_MASK(6)
35
-#define PDB_EVT_PE_NEW_POWER EVENT_MASK(7)
38
+
36
 
39
 
37
 /*
40
 /*
38
  * Start the Policy Engine thread
41
  * Start the Policy Engine thread

+ 1
- 1
src/shell.c View File

39
 
39
 
40
 #include "chprintf.h"
40
 #include "chprintf.h"
41
 
41
 
42
+#include <pdb.h>
42
 #include "usbcfg.h"
43
 #include "usbcfg.h"
43
 #include "config.h"
44
 #include "config.h"
44
 #include "led.h"
45
 #include "led.h"
45
 #include "device_policy_manager.h"
46
 #include "device_policy_manager.h"
46
-#include "policy_engine.h"
47
 #include "pd.h"
47
 #include "pd.h"
48
 
48
 
49
 
49
 

Loading…
Cancel
Save