fix build warnings

This commit is contained in:
hathach
2023-06-16 15:29:34 +07:00
parent a7f330fa94
commit e754795d3a
13 changed files with 73 additions and 37 deletions

View File

@@ -183,9 +183,9 @@ bool tcd_init(uint8_t rhport, uint32_t port_type) {
// Read Voltage State on CC1 & CC2 fore initial state
uint32_t v_cc[2];
(void) v_cc;
v_cc[0] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC1_Pos) & 0x03;
v_cc[1] = (UCPD1->SR >> UCPD_SR_TYPEC_VSTATE_CC2_Pos) & 0x03;
TU_LOG1("Initial VState CC1 = %lu, CC2 = %lu\r\n", v_cc[0], v_cc[1]);
// Enable CC1 & CC2 Interrupt
@@ -308,8 +308,11 @@ void tcd_int_handler(uint8_t rhport) {
if (!(sr & UCPD_SR_RXERR)) {
// response with good crc
_good_crc.msg_id = ((pd_header_t const*) _rx_buf)->msg_id;
dma_tx_start(rhport, &_good_crc, 2);
// TODO move this to usbc stack
if (_rx_buf) {
_good_crc.msg_id = ((pd_header_t const *) _rx_buf)->msg_id;
dma_tx_start(rhport, &_good_crc, 2);
}
result = XFER_RESULT_SUCCESS;
}else {