我正在使用 I.MX6Q Sabre SD 板。我正在尝试使用我自己的启动脚本和 ld 脚本构建自定义图像。图像将通过 u-boot 加载。我正在尝试为 UART1 启用 UART 接收中断。但它不会进入中断服务程序。我可以通过轮询发送和接收数据。启用 UART 中断的基本初始化步骤是什么?我已按如下方式初始化了UART,
void UART1_init(void)
{
int tmp;
//*********** UART1 IOMUX****************//
* R32 (IOMUXC_BASE_ADDR+0x280) = 0x00000003; // ALT3 CSI0_DAT10 TxD
* R32 (IOMUXC_BASE_ADDR+0x284) = 0x00000003; // ALT3 CSI0_DAT11 RxD
* R32 (IOMUXC_BASE_ADDR+0x920) = 0x00000001; //UART1_UART_RX_DATA_SELECT_INPUT
tmp=(* R32 (CCM_BASE_ADDR+0x24)) & 0x0000003F ; //CSCDR1 uart_podf div by 1
* R32 (CCM_BASE_ADDR+0x24) = tmp; // UART refclk = 80MHz
// Enable UART1
// enable uart1, ignore RTS, wordsize 8bits, 1 stop bit, no parity
*(unsigned int*)(UART1_UCR2_1) = 0x01; // reset UART state machines
*(unsigned int*)(UART1_UCR2_1) = 0x2006; // UCR2 = CTSC,TXEN,RXEN=1,reset
*(unsigned int*)(UART1_UCR1_1) = 0x0001; // UARTEN = 1,enable the clock
*(unsigned int*)(UART1_UCR2_1) |= IGNORE_RTS<<14; // configure IRTS bit
*(unsigned int*)(UART1_UCR2_1) |= WORD8<<5;
*(unsigned int*)(UART1_UCR2_1) |= STOP1<<6;
*(unsigned int*)(UART1_UCR3_1) |= 0x00000004; // set RXD_MUX_SEL bit
*(unsigned int*)(UART1_UCR1_1) |= 0x0201; // recieve ready interput enable
// disable parity
*(unsigned int*)(UART1_UCR2_1) &= ~(0x00000100);
//SetRFDIV_to_div_by_1_UART1();
tmp = *(unsigned int*)(UART1_UFCR_1); // save UFCR to default value
*(unsigned int*)(UART1_UFCR_1) = 5<<7; // set RFDIV to div-by-1 or b101
*(unsigned int*)(UART1_UFCR_1) |= tmp; // set other UFCR bits back to default
*(unsigned int*)(UART1_UBIR_1) = 0x4;
*(unsigned int*)(UART1_UBMR_1) = 0xD8;
*(unsigned int*)(UART1_UCR3_1) |= 0x00000040;
*(unsigned int*)(UART1_UCR4_1) |= 0x00000081;
/* RxTl =1 */
tmp = *(unsigned int*)(UART1_UFCR_1);
tmp = tmp & 0xffffffc0;
tmp = tmp | 0x00000001;
*(unsigned int*)(UART1_UFCR_1) = tmp;
/* Rf div */
tmp = *(unsigned int*)(UART1_UCR1_1);
tmp = tmp & 0xfffffcff;
tmp = tmp | 0x00000200;
*(unsigned int*)(UART1_UCR1_1) = tmp;
}
我是否缺少一些 uart 接收中断的初始化步骤?