|
@@ -61,11 +61,37 @@ static const I2CConfig i2c2config = {
|
61
|
61
|
0
|
62
|
62
|
};
|
63
|
63
|
|
|
64
|
+/*
|
|
65
|
+ * Start the USB Power Delivery threads
|
|
66
|
+ */
|
|
67
|
+static void start_pd(void)
|
|
68
|
+{
|
|
69
|
+ /* Start I2C2 to make communication with the PHY possible */
|
|
70
|
+ i2cStart(&I2CD2, &i2c2config);
|
|
71
|
+
|
|
72
|
+ /* Initialize the FUSB302B */
|
|
73
|
+ fusb_setup();
|
|
74
|
+
|
|
75
|
+ /* Create the policy engine thread. */
|
|
76
|
+ pdb_pe_run();
|
|
77
|
+
|
|
78
|
+ /* Create the protocol layer threads. */
|
|
79
|
+ pdb_prlrx_run();
|
|
80
|
+ pdb_prltx_run();
|
|
81
|
+ pdb_hardrst_run();
|
|
82
|
+
|
|
83
|
+ /* Create the INT_N thread. */
|
|
84
|
+ pdb_int_n_run();
|
|
85
|
+}
|
|
86
|
+
|
64
|
87
|
/*
|
65
|
88
|
* Enter setup mode
|
66
|
89
|
*/
|
67
|
90
|
static void setup(void)
|
68
|
91
|
{
|
|
92
|
+ /* Start the USB Power Delivery threads */
|
|
93
|
+ start_pd();
|
|
94
|
+
|
69
|
95
|
/* Indicate that we're in setup mode */
|
70
|
96
|
chEvtSignal(pdb_led_thread, PDB_EVT_LED_CONFIG);
|
71
|
97
|
|
|
@@ -90,22 +116,8 @@ static void setup(void)
|
90
|
116
|
*/
|
91
|
117
|
static void sink(void)
|
92
|
118
|
{
|
93
|
|
- /* Start I2C2 to make communication with the PHY possible */
|
94
|
|
- i2cStart(&I2CD2, &i2c2config);
|
95
|
|
-
|
96
|
|
- /* Initialize the FUSB302B */
|
97
|
|
- fusb_setup();
|
98
|
|
-
|
99
|
|
- /* Create the policy engine thread. */
|
100
|
|
- pdb_pe_run();
|
101
|
|
-
|
102
|
|
- /* Create the protocol layer threads. */
|
103
|
|
- pdb_prlrx_run();
|
104
|
|
- pdb_prltx_run();
|
105
|
|
- pdb_hardrst_run();
|
106
|
|
-
|
107
|
|
- /* Create the INT_N thread. */
|
108
|
|
- pdb_int_n_run();
|
|
119
|
+ /* Start the USB Power Delivery threads */
|
|
120
|
+ start_pd();
|
109
|
121
|
|
110
|
122
|
/* Wait, letting all the other threads do their work. */
|
111
|
123
|
while (true) {
|