fix(usb_serial_jtag): fix regs are not handled properly for half-word instructions

This commit is contained in:
C.S.M
2024-06-19 14:55:11 +08:00
parent 5bd39b54d3
commit d53add5d84
7 changed files with 28 additions and 17 deletions

View File

@@ -13,6 +13,7 @@
#include "soc/usb_serial_jtag_reg.h"
#include "soc/usb_serial_jtag_struct.h"
#include "hal/usb_serial_jtag_types.h"
#include "hal/misc.h"
/* ----------------------------- Macros & Types ----------------------------- */
@@ -118,7 +119,7 @@ static inline uint32_t usb_serial_jtag_ll_read_rxfifo(uint8_t *buf, uint32_t rd_
uint32_t i;
for (i = 0; i < rd_len; i++) {
if (!USB_SERIAL_JTAG.ep1_conf.serial_out_ep_data_avail) break;
buf[i] = USB_SERIAL_JTAG.ep1.rdwr_byte;
buf[i] = HAL_FORCE_READ_U32_REG_FIELD(USB_SERIAL_JTAG.ep1, rdwr_byte);
}
return i;
}
@@ -137,7 +138,7 @@ static inline uint32_t usb_serial_jtag_ll_write_txfifo(const uint8_t *buf, uint3
uint32_t i;
for (i = 0; i < wr_len; i++) {
if (!USB_SERIAL_JTAG.ep1_conf.serial_in_ep_data_free) break;
USB_SERIAL_JTAG.ep1.rdwr_byte = buf[i];
HAL_FORCE_MODIFY_U32_REG_FIELD(USB_SERIAL_JTAG.ep1, rdwr_byte, buf[i]);
}
return i;
}