有个疑问,用这样的方法设置了串口1后,cts1用来控制继电器,怎么都无效,如果不初始化串口1,可以控制继电器。case E_FUNC_UART0:
case E_FUNC_UART0_RX_TX:
case E_FUNC_UART0_RTS_CTS:
case E_FUNC_UART1:
case E_FUNC_UART1_RX_TX:
case E_FUNC_UART1_RTS_CTS:
{
if ((function >= E_FUNC_UART0) && (function <= E_FUNC_UART0_RTS_CTS))
u8Offset = 0;
else
u8Offset = 4;
if ((function == E_FUNC_UART0) || (function == E_FUNC_UART1))
{
outpw(&SYS->GPBMFP, inpw(&SYS->GPBMFP) | (0xF<<(0+u8Offset)));
outpw(&SYS->ALTMFP, inpw(&SYS->ALTMFP) & ~(0x1<<11));
}else
if ((function == E_FUNC_UART0_RX_TX) || (function == E_FUNC_UART1_RX_TX))
{
outpw(&SYS->GPBMFP, inpw(&SYS->GPBMFP) | (0x3<<(0+u8Offset)));
}else
if ((function == E_FUNC_UART0_RTS_CTS) || (function == E_FUNC_UART1_RTS_CTS))
{
outpw(&SYS->GPBMFP, inpw(&SYS->GPBMFP) | (0x3<<(2+u8Offset)));
outpw(&SYS->ALTMFP, inpw(&SYS->ALTMFP) & ~(0x1<<11));
}
}break; |