Skip to content

Commit 56c9bbe

Browse files
judecumtmysterywolf
authored andcommitted
[bsp/hc32] fix uart dma if gcc optimization level is not none
1 parent d141d14 commit 56c9bbe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bsp/hc32/libraries/hc32_drivers/drv_usart.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Local pre-processor symbols/macros ('#define')
3636
******************************************************************************/
3737
#define DMA_CH_REG(reg_base, ch) \
38-
(*(uint32_t *)((uint32_t)(&(reg_base)) + ((ch) * 0x40UL)))
38+
(*(volatile uint32_t *)((uint32_t)(&(reg_base)) + ((ch) * 0x40UL)))
3939

4040
#define DMA_TRANS_SET_CNT(unit, ch) \
4141
(READ_REG32(DMA_CH_REG((unit)->DTCTL0,(ch))) >> DMA_DTCTL_CNT_POS)

bsp/hc32/libraries/hc32_drivers/drv_usart_v2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
* Local pre-processor symbols/macros ('#define')
3636
******************************************************************************/
3737
#define DMA_CH_REG(reg_base, ch) \
38-
(*(uint32_t *)((uint32_t)(&(reg_base)) + ((ch) * 0x40UL)))
38+
(*(volatile uint32_t *)((uint32_t)(&(reg_base)) + ((ch) * 0x40UL)))
3939

4040
#define DMA_TRANS_SET_CNT(unit, ch) \
4141
(READ_REG32(DMA_CH_REG((unit)->DTCTL0,(ch))) >> DMA_DTCTL_CNT_POS)

0 commit comments

Comments
 (0)