feat(uart): change fifo.byte to fifo.val when uart_ll_write_txfifo

This commit is contained in:
gaoxu
2024-02-29 14:20:10 +08:00
parent f9109beda2
commit 1b1e4d2f76
7 changed files with 32 additions and 11 deletions

View File

@@ -540,8 +540,11 @@ FORCE_INLINE_ATTR void uart_ll_read_rxfifo(uart_dev_t *hw, uint8_t *buf, uint32_
*/
FORCE_INLINE_ATTR void uart_ll_write_txfifo(uart_dev_t *hw, const uint8_t *buf, uint32_t wr_len)
{
// Write to the FIFO should make sure only involve write operation, any read operation would cause data lost.
// Non-32-bit access would lead to a read-modify-write operation to the register, which is undesired.
// Therefore, use 32-bit access to avoid any potential problem.
for (int i = 0; i < (int)wr_len; i++) {
hw->fifo.rxfifo_rd_byte = buf[i];
hw->fifo.val = (int)buf[i];
}
}