IntcConfig->CpuBaseAddress); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XScuGic_InterruptHandler,//connect to the hardware GicInstancePtr); Xil_ExceptionEnable(); XScuGic_Connect(GicInstancePtr, UartIntrId, (Xil_InterruptHandler)UartIntrHandler,//set up the timer interrup...
1、在uart.c代码中,复制教程代码uart0_rx_intr_handler函数如下图,下图同时是UART0的中断处理过程(教程代码中有两个uart0_rx_intr_handler函数是因为用了”#if 0”、”#else”、”#endif”重新写一个uart0_rx_intr_handler函数) 2、修改完源码,我们就可以尝试往esp8266的UART0_rx写数据,看下UART0_tx会不...
程序首先对中断控制器进行初始化,随后设置并打开中断异常处理的功能。接下来为串口中断设置中断处理函数,通过XScuGic_Connect函数进行设置,这里设置的串口中断处理函数为uart_intr_handler。XUartPs_SetInterruptMask函数用于设置UART的中断触发方式,函数输入的参数为XUARTPS_IXR_RXOVR,表示达到RxFIFO的触发等级时,开始触发中...
LOCALvoiduart0_rx_intr_handler(void*para){/* uart0 and uart1 intr combine togther, when interrupt occur, see reg 0x3ff20020, bit2, bit0 represents * uart1 and uart0 respectively */uint8 RcvChar;uint8 uart_no=UART0;//UartDev.buff_uart_no;uint8 fifo_len=0;uint8 buf_idx=0;uint8...
接下来为串口中断设置中断处理函数,通过XScuGic_Connect函数进行设置,这里设置的串口中断处理函数为uart_intr_handler。XUartPs_SetInterruptMask函数用于设置UART的中断触发方式,函数输入的参数为XUARTPS_IXR_RXOVR,表示达到RxFIFO的触发等级时,开始触发中断,当然也可以设置成RxFIFO为满时触发中断或者为空时触发中断等。
}voidinit_intr_uart(XScuGic *scugic,XUartPs *UartPs){ XScuGic_Config*intc_cfg; intc_cfg=XScuGic_LookupConfig(gic_id); XScuGic_CfgInitialize(scugic,intc_cfg,intc_cfg->CpuBaseAddress); Xil_ExceptionInit(); Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_IRQ_INT, ...
以上部分*/UART_SetPrintPort(UART1);UART_intr_handler_register(uart0_rx_isr,NULL);ETS_UART_INTR_ENABLE();}else{//printf("port= 0 \n ");UART_ConfigTypeDef uart_config;/*注意修改以下部分*/uart_config.baud_rate=BIT_RATE_9600;// uart_config.baud_rate = BIT_RATE_921600;/*注意修改以上...
= XST_SUCCESS) {return XST_FAILURE;}/* init UART interrupt */Status = UartIntrInit(&IntcInstPtr, &Uart0_Ps, UART0_IRPT_INTR, Uart0Handler);if (Status != XST_SUCCESS) {return XST_FAILURE;}/* clear trigger interrupt */XUartPs_WriteReg(_Uart0_Ps->Config.BaseAddress, XUARTPS_ISR_...
(intr, UART_INT_IRQ_ID);}//中断处理函数void UartIntr_Handler(void *call_back_ref){XUartPs *uartinst =(XUartPs *)call_back_ref;u32 read_data = 0;u32 intr_status;//读取中断ID寄存器intr_status = XUartPs_ReadReg(uartinst->Config.BaseAddress,XUARTPS_IMR_OFFSET);//读取掩码intr_...
3、XUartPs_SetHandler(UartInstPtr, (XUartPs_Handler)UartPs_Intr_Handler, UartInstPtr) 函数负责设置中断产生后的回调函数为UartPs_Intr_Handler。 4、XUartPs_SetInterruptMask(UartInstPtr, IntrMask) 函数负责配置中断类型 5、XUartPs_SetRecvTimeout(UartInstPtr, 8) ...