1
我正在使用I.MX6Q Sabre SD板。我試圖用我自己的啓動腳本和ld腳本來構建自定義圖像。圖像將被加載到u-boot。我正在嘗試啓用UART1的UART接收中斷。但它不會進入中斷服務程序。我可以通過輪詢發送和接收數據。啓用uart中斷的基本初始化步驟是什麼?我已經初始化了uart,如下所示,如何在imx6q中啓用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接收中斷的初始化步驟?