关于写C554的寄存器FCR的问题
诸如 LCR DLL DLH IER等寄存器,我都能写进去,再读出来,可FCR就是不行,
我把代码写在下面,哪位兄弟姐妹指导一下
//定义相关宏
#define UART_BASE_ADDR (0x20300000
#define C554_CH1_FCR (UART_BASE_ADDR+4)
#ifndef C554_REG_READ
#define C554_REG_READ(C554_reg, result) \
result = \
(*(volatile unsigned short *)(C554_reg)) #endif
#ifndef C554_REG_WRITE
#define C554_REG_WRITE(C554_reg, data) \
(*(volatile unsigned short *)(C554_reg)) = \
(data)
#endif
//写FCR寄存器
C554_REG_WRITE(C554_CH1_FCR, 0,0x1);// FCR0置1
C554_REG_WRITE(C554_CH1_FCR, 0,0x8f);// 向FCR寄存器写值
[解决办法]
FCR and ISR share the same address space in the UART regsiter set (0x02). The FCR is a write only register and the ISR is a read only register. When you do a write to address 0x02 you write to the FCR register, but when you do a read of address 0x02 you would read the ISR register and not the FCR register.
To overcome this problem you would have to save the FCR value to a variable before you write to the FCR register. And when you want to know what value is in the FCR register, you would read this value from the variable
关于写C554的寄存器FCR的有关问题
关于写C554的寄存器FCR的问题诸如LCRDLLDLHIER等寄存器,我都能写进去,再读出来,可FCR就是不行,我把代码写
