/*********************************************************************//** * @brief UART1 interrupt handler sub-routine * @param[in] None * @return None **********************************************************************/ void UART1_IRQHandler(void) { // Call Standard UART 0 interrupt handler uint32_t intsrc, tmp, tmp1; /* Determine the interrupt source */ intsrc = UART_GetIntId(LPC_UART0); tmp = intsrc & UART_IIR_INTID_MASK; // Receive Line Status if (tmp == UART_IIR_INTID_RLS){ // Check line status tmp1 = UART_GetLineStatus(LPC_UART0); // Mask out the Receive Ready and Transmit Holding empty status tmp1 &= (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE \ | UART_LSR_BI | UART_LSR_RXFE); // If any error exist if (tmp1) { UART_IntErr(tmp1); } } // Receive Data Available or Character time-out if ((tmp == UART_IIR_INTID_RDA) || (tmp == UART_IIR_INTID_CTI)){ UART_IntReceive(); } }
void Uart_X_Isr(int which_port) { uint32_t intsrc, tmp, tmp1; LPC_UART_TypeDef *UARTx; UARTx=(LPC_UART_TypeDef *)uartDrvDataArray[which_port].reg_base; /* Determine the interrupt source */ intsrc = UART_GetIntId(UARTx); tmp = intsrc & UART_IIR_INTID_MASK; // Receive Line Status if (tmp == UART_IIR_INTID_RLS){ // Check line status tmp1 = UART_GetLineStatus(UARTx); // Mask out the Receive Ready and Transmit Holding empty status tmp1 &= (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE \ | UART_LSR_BI | UART_LSR_RXFE); // If any error exist if (tmp1) { UART_IntErr(tmp1); } } // Receive Data Available or Character time-out if ((tmp == UART_IIR_INTID_RDA) || (tmp == UART_IIR_INTID_CTI)){ UART_IntReceive(which_port); } // Transmit Holding Empty if (tmp == UART_IIR_INTID_THRE){ #if 0 UART_IntTransmit(); #else innerDeadNoOutput(); #endif } }
/* *@描述:串口中断 *@参数:void *@返回:无 */ void _UART_IRQHander(void) { uint32_t intsrc, tmp, tmp1; //OSIntEnter(); // Determine the interrupt source intsrc = UART_GetIntId((LPC_UART_TypeDef *)_LPC_UART); tmp = intsrc & UART_IIR_INTID_MASK; // Receive Line Status if (tmp == UART_IIR_INTID_RLS){ // Check line status tmp1 = UART_GetLineStatus((LPC_UART_TypeDef *)_LPC_UART); // Mask out the Receive Ready and Transmit Holding empty status tmp1 &= (UART_LSR_OE | UART_LSR_PE | UART_LSR_FE \ | UART_LSR_BI | UART_LSR_RXFE); // If any error exist if (tmp1) { UART_IntErr(tmp1); } } // Receive Data Available or Character time-out if ((tmp == UART_IIR_INTID_RDA) || (tmp == UART_IIR_INTID_CTI)){ UART_IntReceive(); //UART_Receive((LPC_UART_TypeDef *)_LPC_UART,&tmpchar,1,BLOCKING); } // Transmit Holding Empty if (tmp == UART_IIR_INTID_THRE){ //UART_IntTransmit(); } //OSIntExit(); }