|
@@ -70,8 +70,19 @@ static void fusb_write_buf(uint8_t addr, uint8_t size, const uint8_t *buf)
|
70
|
70
|
void fusb_send_message(const union pd_msg *msg)
|
71
|
71
|
{
|
72
|
72
|
/* Token sequences for the FUSB302B */
|
73
|
|
- static uint8_t sop_seq[5] = {0x12, 0x12, 0x12, 0x13, 0x80};
|
74
|
|
- static uint8_t eop_seq[4] = {0xFF, 0x14, 0xFE, 0xA1};
|
|
73
|
+ static uint8_t sop_seq[5] = {
|
|
74
|
+ FUSB_FIFO_TX_SOP1,
|
|
75
|
+ FUSB_FIFO_TX_SOP1,
|
|
76
|
+ FUSB_FIFO_TX_SOP1,
|
|
77
|
+ FUSB_FIFO_TX_SOP2,
|
|
78
|
+ FUSB_FIFO_TX_PACKSYM
|
|
79
|
+ };
|
|
80
|
+ static uint8_t eop_seq[4] = {
|
|
81
|
+ FUSB_FIFO_TX_JAM_CRC,
|
|
82
|
+ FUSB_FIFO_TX_EOP,
|
|
83
|
+ FUSB_FIFO_TX_TXOFF,
|
|
84
|
+ FUSB_FIFO_TX_TXON
|
|
85
|
+ };
|
75
|
86
|
|
76
|
87
|
/* Take the I2C2 mutex now so there can't be a race condition on sop_seq */
|
77
|
88
|
i2cAcquireBus(&I2CD2);
|
|
@@ -81,7 +92,7 @@ void fusb_send_message(const union pd_msg *msg)
|
81
|
92
|
uint8_t msg_len = 2 + 4 * PD_NUMOBJ_GET(msg);
|
82
|
93
|
|
83
|
94
|
/* Set the number of bytes to be transmitted in the packet */
|
84
|
|
- sop_seq[4] = 0x80 | msg_len;
|
|
95
|
+ sop_seq[4] = FUSB_FIFO_TX_PACKSYM | msg_len;
|
85
|
96
|
|
86
|
97
|
/* Write all three parts of the message to the TX FIFO */
|
87
|
98
|
fusb_write_buf(FUSB_FIFOS, 5, sop_seq);
|