void UARTIntHandler(void) { // UARTCharPut(UART0_BASE, 'a'); uint32_t ui32Status; ui32Status = UARTIntStatus(UART3_BASE, true); //get interrupt status // UARTCharPut(UART0_BASE, 'a'); UARTIntClear(UART3_BASE, ui32Status); //clear the asserted interrupts // UARTCharPut(UART0_BASE, 'a'); while(UARTCharsAvail(UART3_BASE)) //loop while there are chars { // UARTCharPut(UART0_BASE, 'a'); char x = UARTCharGetNonBlocking(UART3_BASE); UARTCharPut(UART0_BASE, x); buf[it++] = x; } buf[it]='\0'; char *ptr = strstr(buf,"OK\r\n"); if(ptr != NULL) { SIM908_status = true; } // UARTCharPutNonBlocking(UART0_BASE, 'a'); // buf[it]='\0'; // // if(strncmp(buf, "OK", 2) == 0) SIM908_status = true; // else if(strncmp(buf, "ERROR", 5) == 0) { // // } // else { // // } }
void Uart::interruptHandler(void) { uint32_t status; // Read interrupt source status = UARTIntStatus(uart_.base, true); // Clear UART interrupt in the NVIC IntPendClear(uart_.interrupt); // Process TX interrupt if (status & UART_INT_TX) { UARTIntClear(uart_.base, UART_INT_TX); interruptHandlerTx(); } // Process RX interrupt if (status & UART_INT_RX || status & UART_INT_RT) { UARTIntClear(uart_.base, UART_INT_RX | UART_INT_RT); interruptHandlerRx(); } }
void UARTinterrupcion(void) { char cThisChar; int n=0; int m_nTxBuffIn1 = 16; unsigned long ulStatus; // // Obtengo el estado de la interrupcion // ulStatus = UARTIntStatus(UART1_BASE, true); // // Limpio los flags de interrupcion // UARTIntClear(UART1_BASE, ulStatus); if(RIGHT_BUTTON){;} if(ulStatus && UART_INT_RX){ } while(m_nTxBuffIn1>0 && UARTCharsAvail(UART1_BASE)) { // // Lee el proximo caracter de la FIFO de recepcion. // cThisChar = UARTCharGetNonBlocking(UART1_BASE); UARTCharPut(UART0_BASE, cThisChar); m_nTxBuffIn1--; n=n+1; } }
void stellaris_uart0_irq(void) { arm_cm_irq_entry(); // // Get the interrrupt status. // unsigned long ulStatus = UARTIntStatus(DEBUG_UART, true); // // Clear the asserted interrupts. // UARTIntClear(DEBUG_UART, ulStatus); // // Loop while there are characters in the receive FIFO. // bool resched = false; while (UARTCharsAvail(DEBUG_UART)) { // // Read the next character from the UART and write it back to the UART. // unsigned char c = UARTCharGetNonBlocking(DEBUG_UART); cbuf_write_char(&debug_rx_buf, c, false); resched = true; } arm_cm_irq_exit(resched); }
//UART Int Handler. Will handle the data recieved and put in an array. WILL NOT UNDERSTAND JUST STORE void Uart2IntHandler(void){ unsigned long ulStatus; ulStatus=UARTIntStatus(UART2_BASE, true); //This reports if the interrupt was a transmit recieve etc, only reports one's setup to be detected in initalization could possibly remove transmit detection UARTIntClear(UART2_BASE, ulStatus); //Clears the interrupt so it does not detect itself. if(ulStatus & UART_INT_TX){ //Transmit was requested I don't think anything needs to be done here I could probably get rid of this and the interrupt for it but for now im leaving it. UARTSend does this job in a cleaner way }else if(ulStatus & UART_INT_RX || ulStatus & UART_INT_RT){ //If recieved data GPIOPinWrite(GPIO_PORTF_BASE,GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3,0x08); while(UARTCharsAvail(UART2_BASE)){ //While there is still data available to read char buffer = UARTCharGetNonBlocking(UART2_BASE); //Read the data into a buffer for scanning if((buffer == 0xFA)&&(commandAddress == -2)){ //Is it the first dummy byte commandAddress=-1; //Set the command Address to -1 this way the dummy byte is the only starting byte for a packet to be accepeted }else if((buffer == 0xEB)&&(commandAddress == -1)){ //Is the second dummy byte read commandAddress=0; //Prepare to read data the dummy byte's have been validated }else if(commandAddress>=0){ //Read in because it's not a dummy byte, prep for reading recievedCommands[commandAddress]=buffer; commandAddress++; //Some efficiency could be done here. Remove this line than change the bottom to have ++commandAddress. But that's nitpicky stuff commandAddress = (commandAddress>4) ? -2 : commandAddress; //If greater than 6 set to -1 else set to self } } //UARTCount = ((UARTCount+1)%65534); //Again not sure of datatype sizes so go with what works right. } }
void UARTIntHandler(void) { uint32_t ui32Status; ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts while(UARTCharsAvail(UART0_BASE)) //loop while there are chars { char x = UARTCharGetNonBlocking(UART0_BASE); if(mode == 0 && x == 's') { mode = 1; UARTStrPut("Enter the temperature : "); newSet = 0; } else if (mode == 1) { if (x == 127 && newSet > 0) { // backspace UARTCharPut(UART0_BASE, 127); newSet /= 10; } else if (x >= 48 && x <= 57) { // digit UARTCharPut(UART0_BASE, x); newSet = newSet*10 + (x - 48); } else if (x == 13) { // new line (enter) setTemp = newSet; UARTStrPut("\r\nSet Temperature updated to "); UARTIntPut(setTemp); UARTCharPut(UART0_BASE, 176); UARTStrPut("C\r\n"); mode = 0; } } } }
void UARTIntHandler() { uint32_t ui32Status; uint32_t ui32ADC0Value[4]; // ADC FIFO volatile uint32_t ui32TempAvg; // Store average volatile uint32_t ui32TempValueC; // Temp in C volatile uint32_t ui32TempValueF; // Temp in F ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts ADCIntClear(ADC0_BASE, 2); // Clear ADC0 interrupt flag. ADCProcessorTrigger(ADC0_BASE, 2); // Trigger ADC conversion. while (!ADCIntStatus(ADC0_BASE, 2, false)) ; // wait for conversion to complete. ADCSequenceDataGet(ADC0_BASE, 2, ui32ADC0Value); // get converted data. // Average read values, and round. // Each Value in the array is the result of the mean of 64 samples. ui32TempAvg = (ui32ADC0Value[0] + ui32ADC0Value[1] + ui32ADC0Value[2] + ui32ADC0Value[3] + 2) / 4; ui32TempValueC = (1475 - ((2475 * ui32TempAvg)) / 4096) / 10; // calc temp in C ui32TempValueF = ((ui32TempValueC * 9) + 160) / 5; //while(UARTCharsAvail(UART0_BASE)) //loop while there are chars //{ // UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); //echo character GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //blink LED SysCtlDelay(SysCtlClockGet() / (1000 * 3)); //delay ~1 msec GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //turn off LED //} }
void UARTIntHandler(void) { uint32_t ui32Status; ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts if(UARTCharGetNonBlocking(UART0_BASE) == 'S'){ char m[] = "Enter The Temperature : "; char h[100] = "Set temperature Updated to "; int i; int l; l=0; for(i=0;m[i];i++){ UARTCharPut(UART0_BASE, m[i]); } int x=0; while(1){ char c; if(UARTCharsAvail(UART0_BASE)){ c= UARTCharGetNonBlocking(UART0_BASE); UARTCharPut(UART0_BASE, c); if(c=='\r') break; h[27+l]=c; x=10*x+c-'0'; l++; } } settemp = x; for(i=0;i<27+l;i++){ UARTCharPut(UART0_BASE, h[i]); } UARTCharPut(UART0_BASE, '*'); UARTCharPut(UART0_BASE, 'C'); UARTCharPut(UART0_BASE, '\r'); UARTCharPut(UART0_BASE,'\n'); } }
void UART0_Handler() { c_pos_intEnter(); uint32_t status; status = UARTIntStatus(PORTCFG_CON_USART, true); UARTIntClear(PORTCFG_CON_USART, status); if (status & UART_INT_TX) c_nos_putcharReady(); #if NOSCFG_FEATURE_CONIN == 1 if (status & (UART_INT_RX | UART_INT_RT)) { unsigned char ch; while (UARTCharsAvail(PORTCFG_CON_USART)) { ch = UARTCharGetNonBlocking(PORTCFG_CON_USART); c_nos_keyinput(ch); } } #endif c_pos_intExitQuick(); }
// UART-interrupt for bluetooth communication void uartIntHandler(void) { // Clear the interrupt UARTIntClear(UART5_BASE, UARTIntStatus(UART5_BASE, true)); // Set the corresponding flag in vector int_vec |= UART_INT; }
void UART1_Handler(void) { unsigned long ulStatus; // // Get the interrrupt status. // ulStatus = UARTIntStatus(UART1_BASE, true); if(ulStatus & UART_INT_TX) { // TX Interrupt fired // with fifos disabled this fires when there is nothing in the tx buffer } else if(ulStatus & UART_INT_RX) { // RX Interrupt fired // with fifos disabled this fires when there is something in the rx buffer UARTRX_FLAG = true; } // // Clear the asserted interrupts. // UARTIntClear(UART1_BASE, ulStatus); }
static void UART2_RxTxHandler(void) { uint32_t IntStatus, byteCnt, timeout = 1000000; uint8_t c; IntStatus = UARTIntStatus(UART2_BASE, true); UARTIntClear(UART2_BASE, IntStatus); if(IntStatus & UART_INT_TX) { byteCnt = RINGBUF_GetFill(&long_Uart2_TxRingBuf); if (byteCnt) { RINGBUF_Get(&long_Uart2_TxRingBuf, &c); UARTCharPutNonBlocking(UART2_BASE, c); if (byteCnt == 1) { UARTIntDisable(UART2_BASE, UART_INT_TX); } } else { UARTIntDisable(UART2_BASE, UART_INT_TX); } } else if (IntStatus & (UART_INT_RX | UART_INT_RT)) { while(!UARTCharsAvail(UART2_BASE) && (timeout--)); c = UARTCharGet(UART2_BASE); RINGBUF_Put(&long_Uart0_RxRingBuf,c); } else { c = UARTCharGet(UART2_BASE); } }
static void charIntHandler(char_device *dev) { portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; unsigned long ulStatus; unsigned char ucData; // // Get the interrrupt status. // ulStatus = UARTIntStatus(dev->PortBase, true); // // Clear the asserted interrupts. // UARTIntClear(dev->PortBase, ulStatus); if(ulStatus & UART_INT_RX){ ucData =UARTCharGet(dev->PortBase); xQueueSendFromISR(dev->RxQueue, &ucData, &xHigherPriorityTaskWoken); } if(ulStatus & UART_INT_TX){ if(xQueueReceiveFromISR(dev->TxQueue, &ucData, &xHigherPriorityTaskWoken)) UARTCharPut(dev->PortBase, ucData); } portEND_SWITCHING_ISR( xHigherPriorityTaskWoken ); }
//***************************************************************************** // // The UART interrupt handler. // //***************************************************************************** void UART0IntHandler(void) { unsigned long ulStatus; // // Get the interrrupt status. // ulStatus = UARTIntStatus(UART0_BASE, true); // // Clear the asserted interrupts. // UARTIntClear(UART0_BASE, ulStatus); // // Loop while there are characters in the receive FIFO. // while(UARTCharsAvail(UART0_BASE)) { // // Read the next character from the UART and write it back to the UART. // UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); } }
//***************************************************************************** // // The UART interrupt handler. // //***************************************************************************** void UART0IntHandler(void) { unsigned long ulStatus; tBoolean bRc; // // Get the interrrupt status. // ulStatus = UARTIntStatus(UART0_BASE, true); // // Clear the asserted interrupts. // UARTIntClear(UART0_BASE, ulStatus); // // Check what is the source of the interrupt // //if(ulStatus & UART_INT_OE) //{ //} //else if(ulStatus & UART_INT_BE) //{ //} //else if(ulStatus & UART_INT_PE) //{ //} if(ulStatus & UART_INT_TX) { // TX int // Push next char to transmitter bRc = true; while(m_nTxBuffIn > 0 && bRc == true) { bRc = UARTCharPutNonBlocking(UART0_BASE,m_tTxBuff[m_nTxNextNdx]); if(bRc == true) { m_nTxNextNdx++; m_nTxBuffIn--; } } } else if(ulStatus & UART_INT_RX || ulStatus & UART_INT_RT) { // RX int // Read all RX fifo data while(UARTCharsAvail(UART0_BASE)) { // Read the next character from the UART // (and write it back to the UART) ? #if defined(stabilizition) ContropMessageLoop(UART0_BASE,0); #else MessageLoop(UART0_BASE,0); #endif } } }
/* * SIOの割込みサービスルーチン */ void sio_isr(intptr_t exinf) { SIOPCB *p_siopcb; p_siopcb = get_siopcb(exinf); /* * 割込みのクリア */ UARTIntClear(p_siopcb->p_siopinib->base, UARTIntStatus(p_siopcb->p_siopinib->base, true)); if (UARTCharsAvail(p_siopcb->p_siopinib->base)) { /* * 受信通知コールバックルーチンを呼び出す. */ sio_irdy_rcv(p_siopcb->exinf); } if (UARTSpaceAvail(p_siopcb->p_siopinib->base)) { /* * 送信可能コールバックルーチンを呼び出す. */ sio_irdy_snd(p_siopcb->exinf); } }
/*---------------------------------------------------------------------------*/ void uart_isr(void) { uint16_t mis; ENERGEST_ON(ENERGEST_TYPE_IRQ); /* Store the current MIS and clear all flags early, except the RTM flag. * This will clear itself when we read out the entire FIFO contents */ mis = (uint16_t)UARTIntStatus(UART0_BASE, true); HWREG(UART0_BASE | UART_O_ICR) = 0x0000FFBF; if(mis & (UART_INT_RX | UART_INT_RT)) { if(input_handler != NULL) { input_handler((unsigned char)UARTCharGetNonBlocking(UART0_BASE)); } else { /* To prevent an Overrun Error, we need to flush the FIFO even if we * don't have an input_handler. Use mis as a data trash can */ mis = (uint16_t)UARTCharGetNonBlocking(UART0_BASE); } } else if(mis & (UART_INT_OE | UART_INT_BE | UART_INT_FE)) { /* ISR triggered due to some error condition */ reset(); } ENERGEST_OFF(ENERGEST_TYPE_IRQ); }
void uartb_intHandler(){ int tmp=0; // detect the event that triggered the interrupt unsigned long intStatus=UARTIntStatus(UART_BUFFERIZED_BASE,1); // Clear the interrupt (done early because rtfm) UARTIntClear(UART_BUFFERIZED_BASE,intStatus); // if it is on RX fifo limit or RX timeout, put these bits in circular buffer if (intStatus==UART_INT_RT || intStatus==UART_INT_RX){ UARTIntDisable(UART_BUFFERIZED_BASE,(UART_INT_RT | UART_INT_RX)); while (UARTCharsAvail(UART_BUFFERIZED_BASE)){ // RDA interrupt tmp = (rxbuf.head+1)%UART_BUFFERIZED_CBUFF_SIZE; if(tmp != rxbuf.tail){ rxbuf.cbuf[rxbuf.head] = UARTCharGetNonBlocking(UART_BUFFERIZED_BASE); rxbuf.head = tmp; } } UARTIntEnable(UART_BUFFERIZED_BASE,(UART_INT_RT | UART_INT_RX)); } // xxx if it is on TX fifo limit, what should we do ? loop until fifo is free again ? useless if blocking writes are used. // otherwise, discard whitout doing anything (done at the beginning of the function, see doc for "why ?". }
void rien(void) { unsigned long ulStatus; ulStatus = UARTIntStatus(UART5_BASE, true); UARTIntClear(UART5_BASE, ulStatus); while(UARTCharsAvail(UART5_BASE)) { char c = UARTCharGet(UART5_BASE); switch(UART5_buffer_state) { case 1: //On reçoit alpha, beta et gamma *UART5_buffer_pointer = c; UART5_buffer_pointer++; if (UART5_buffer_pointer - UART5_buffer >= 3) { UART5_buffer_state = 0; UART5_buffer_pointer = UART5_buffer; unsigned char should_move = UART5_buffer[2]; if (should_move) { go_angle = UART5_buffer[0] | (UART5_buffer[1] << 8); if (go_angle > 360) go_angle = 0; new_order = 1; } else { new_order = 0; } } break; default: //On reçoit un int de start ou une commande aimant if ((c == 0xFE) && (UART5_buffer_pointer - UART5_buffer == 3)) { //Aimant activé UART5_buffer_pointer = UART5_buffer; actuators_servo_raise(0); actuators_servo_raise(1); } else if ((c == 0xFD) && (UART5_buffer_pointer - UART5_buffer == 3)) { //Aimant désactivé actuators_servo_lower(0); actuators_servo_lower(1); UART5_buffer_pointer = UART5_buffer; } else if (c != 0xFF) { //Truc pas normal, on reset la stack UART5_buffer_pointer = UART5_buffer; } else { //Octet de start *UART5_buffer_pointer = c; UART5_buffer_pointer++; if (UART5_buffer_pointer - UART5_buffer >= 4) { //Passage en réception des angles UART5_buffer_state = 1; UART5_buffer_pointer = UART5_buffer; } } } } }
void UARTIntHandler0() { unsigned long ulStatus; static char tempPacket = 0; ulStatus = UARTIntStatus(UART0_BASE, true); UARTIntClear(UART0_BASE, ulStatus); while (UARTCharsAvail(UART0_BASE)) { tempPacket = UARTCharGetNonBlocking(UART0_BASE); } }
/**************************************************************************//** * @brief BSP UART interrupt service routine. * By default, the BSP UART driver does not allocate ISRs, * the application must provide the ISR for the UART RX/TX interrupts. * The BSP UART ISR handler must be called in the application's ISR * for the processing to be correct. * * If \c BSP_UART_ALLOCATE_ISR and \c BSP_UART_ISR are defined, * bspUartOpen() will map bspUartIsrHandler() to the correct UART * interrupt vector. * * See bsp.cfg in the bsp source directory for more info. * * @return None. ******************************************************************************/ static void appUartIsr(void) { uint32_t ulIntBm = UARTIntStatus(BSP_UART_BASE, 1); // // Serve interrupts handled by BSP UART interrupt handler // if(ulIntBm & (BSP_UART_INT_BM)) { bspUartIsrHandler(); } }
//UART0 interrupt handler void UARTIntHandler0(void) { unsigned long ulStatus; // Get the interrrupt status. ulStatus = UARTIntStatus(UART0_BASE, true); // Clear the asserted interrupts. UARTIntClear(UART0_BASE, ulStatus); }
void UARTINtHandler(void) { uint32_t ui32Status; ui32Status = UARTIntStatus(UART0_BASE, true); // Thuc hien lay trang thai ngat UARTIntClear(UART0_BASE, ui32Status); //Xoa co ngat uart while(UARTCharsAvail(UART0_BASE)) //Thuc hien cho ki tu { UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); //nhan ki tu GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //chop tat led SysCtlDelay(SysCtlClockGet()/(1000*3)); //Thuc hien delay khoang 1ms GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //Tat LED } }
void UARTIntHandler() { u32 temp; int c; temp = UARTIntStatus(uart_base[ CON_UART_ID ], true); UARTIntClear(uart_base[ CON_UART_ID ], temp); while( UARTCharsAvail( uart_base[ CON_UART_ID ] ) ) { c = UARTCharGetNonBlocking( uart_base[ CON_UART_ID ] ); buf_write( BUF_ID_UART, CON_UART_ID, ( t_buf_data* )&c ); } }
void UART1_intHandler() { unsigned long intStatus; intStatus = UARTIntStatus(CC3100_UARTBASE,0); UARTIntClear(CC3100_UARTBASE,intStatus); #ifdef SL_IF_TYPE_UART if((pIrqEventHandler != 0) && (IntIsMasked == FALSE)) { pIrqEventHandler(0); } #endif }
//UART1 interrupt handler void UARTIntHandler1 () { unsigned long ulStatus; unsigned long c; int display_offset = 0; int i; int errorFlag = 0; // Get the interrrupt status. ulStatus = UARTIntStatus(UART1_BASE, true); // Clear the asserted interrupts. UARTIntClear(UART1_BASE, ulStatus); // Loop while there are characters in the receive FIFO. while(UARTCharsAvail(UART1_BASE)) { c = UARTCharGet(UART1_BASE); display2[display_offset++] = (char)c; } display2[display_offset-1] = '\0'; for(i = 0; i < (display_offset - 1); i++) { if(display2[i] == 'p') { errorFlag = 1; } } if(errorFlag == 1) { RIT128x96x4Clear(); RIT128x96x4StringDraw("----------------------", 0, 50, 15); RIT128x96x4StringDraw("Error", 50, 75, 15); RIT128x96x4StringDraw(display, 0, 0, 15); } else { RIT128x96x4Clear(); RIT128x96x4StringDraw("----------------------", 0, 50, 15); RIT128x96x4StringDraw(display, 0, 0, 15); RIT128x96x4StringDraw(display2, 0, 60, 15); } }
void UARTIntHandler(void) { uint32_t ui32Status; ui32Status = UARTIntStatus(UART0_BASE, true); //get interrupt status UARTIntClear(UART0_BASE, ui32Status); //clear the asserted interrupts while(UARTCharsAvail(UART0_BASE)) //loop while there are chars { car = UARTCharGetNonBlocking(UART0_BASE); UARTCharPut(UART0_BASE, car); //UARTCharPutNonBlocking(UART0_BASE, UARTCharGetNonBlocking(UART0_BASE)); //echo character //GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //blink LED SysCtlDelay(SysCtlClockGet() / (1000 * 3)); //delay ~1 msec //GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, 0); //turn off LED } }
void UART_IRQ(tUART* uart){ // Get raw interrupt status volatile int flag = UARTIntStatus(uart -> base, true); // Ack Interrupt UARTIntClear(uart -> base, flag); // Handle the interrupt // TODO: This is messy. Clean it up if (flag == uart_int_flags[0]) uart -> irq[0](); else if (flag == uart_int_flags[1]) uart -> irq[1](); }
/********************************************************************************************************* ** Function name: UART1_ISR ** Descriptions: 串口1中断服务函数 ** input parameters: 无 ** Output parameters:: 无 ** Returned value: 无 ** Created by: ** Created Date: 2014.10.03 **-------------------------------------------------------------------------------------------------------- ** Modified by: ** Modified date: 2014.10.03 **-------------------------------------------------------------------------------------------------------- *********************************************************************************************************/ void UART1_ISR(void) { u8 ch = 0; unsigned long ulStatus; ulStatus = UARTIntStatus(UART1_BASE, true); /* 读取已使能的串口0中断状态 */ UARTIntClear(UART1_BASE, ulStatus); /* 清除当前的串口0中断 */ if((ulStatus & UART_INT_RT)||(ulStatus & UART_INT_RX)) { /* 接收中断 */ while(UARTCharsAvail(UART1_BASE)) { ch = UartGetChar(); UartProcessMsg(ch); } } }
void vUART_ISR( void ) { unsigned portLONG ulStatus; portCHAR cRxedChar; portBASE_TYPE xTaskWokenByPost = pdFALSE; /* What caused the interrupt. */ ulStatus = UARTIntStatus( UART0_BASE, pdTRUE ); /* Clear the interrupt. */ UARTIntClear( UART0_BASE, ulStatus ); /* Was an Rx interrpt pending? */ if( ulStatus & UART_INT_RX ) { if( ( HWREG(UART0_BASE + UART_O_FR ) & UART_FR_RXFF ) ) { /* Get the char from the buffer and post it onto the queue of Rxed chars. Posting the character should wake the task that is blocked on the queue waiting for characters. */ cRxedChar = ( portCHAR ) HWREG( UART0_BASE + UART_O_DR ); xTaskWokenByPost = xQueueSendFromISR( xCommsQueue, &cRxedChar, xTaskWokenByPost ); } } /* Was a Tx interrupt pending? */ if( ulStatus & UART_INT_TX ) { /* Send the next character in the string. We are not using the FIFO. */ if( cNextChar <= commsLAST_TX_CHAR ) { if( !( HWREG( UART0_BASE + UART_O_FR ) & UART_FR_TXFF ) ) { HWREG( UART0_BASE + UART_O_DR ) = cNextChar; } cNextChar++; } } if( xTaskWokenByPost ) { /* If a task was woken by the character being received then we force a context switch to occur in case the task is of higher priority than the currently executing task (i.e. the task that this interrupt interrupted.) */ portEND_SWITCHING_ISR( xTaskWokenByPost ); } }