例程是原始UART例程,我只修改了中断响应函数中的代码,如下:
interrupt void KeyStone_UART_Rx_ISR()
{
Uint32 rx_cnt = 0;
/* Disable the CIC out for interrupt processing */
CIC_Regs->HINT_ENABLE_CLR_INDEX_REG = uiCIC_out_num+1;
// Interrupt from UART0
if(CIC_Regs->RAW_STATUS_REG[CSL_INTC0_URXEVT>>5] & (1<<(CSL_INTC0_URXEVT%32)))
{
rx_cnt= KeyStone_UART_read(UART_Rx_Buf, RX_BUF_BYTE_SIZE, 0);
CIC_Regs->STATUS_CLR_INDEX_REG = CSL_INTC0_URXEVT;
printf("rx_cnt= %d\r\n", rx_cnt);
KeyStone_UART_write(UART_Rx_Buf, rx_cnt, 0);
//echo back the received characters
// if(bUartEchoBack)
// UART_Echo_back(rx_cnt, 0);
}
