void GPS_UART_HANDLE() { uint8_t u8InChar = 0xFF; uint32_t u32IntSts = UART1->INTSTS; if(u32IntSts & UART_INTSTS_RDAINT_Msk) { /* Get all the input characters */ while(UART_IS_RX_READY(UART1)) { /* Get the character from UART Buffer */ u8InChar = UART_READ(UART1); /* Check if buffer full */ if(g_u32comRbytes < RXBUFSIZE) { /* Enqueue the character */ g_u8RecData[g_u32comRtail] = u8InChar; g_u32comRtail = (g_u32comRtail == (RXBUFSIZE - 1)) ? 0 : (g_u32comRtail + 1); g_u32comRbytes++; //printf(">%d",g_u32comRbytes); } } } }
/*---------------------------------------------------------------------------------------------------------*/ void UART_TEST_HANDLE() { uint8_t u8InChar = 0xFF; uint32_t u32IntSts = UART0->ISR; if(u32IntSts & UART_ISR_RDA_INT_Msk) { printf("\nInput:"); /* Get all the input characters */ while(UART_IS_RX_READY(UART0)) { /* Get the character from UART Buffer */ u8InChar = UART_READ(UART0); printf("%c ", u8InChar); if(u8InChar == '0') { g_bWait = FALSE; } /* Check if buffer full */ if(g_u32comRbytes < RXBUFSIZE) { /* Enqueue the character */ g_u8RecData[g_u32comRtail] = u8InChar; g_u32comRtail = (g_u32comRtail == (RXBUFSIZE - 1)) ? 0 : (g_u32comRtail + 1); g_u32comRbytes++; } } printf("\nTransmission Test:"); } if(u32IntSts & UART_ISR_THRE_INT_Msk) { uint16_t tmp; tmp = g_u32comRtail; if(g_u32comRhead != tmp) { u8InChar = g_u8RecData[g_u32comRhead]; UART_WRITE(UART0, u8InChar); g_u32comRhead = (g_u32comRhead == (RXBUFSIZE - 1)) ? 0 : (g_u32comRhead + 1); g_u32comRbytes--; } } }
/*---------------------------------------------------------------------------------------------------------*/ void UART_HANDLE() { uint8_t u8InChar=0xFF; uint32_t u32IntSts= UART->ISR; if(u32IntSts & UART_ISR_RDA_INT_Msk) { /* Get all the input characters */ while(UART_IS_RX_READY(UART)) { /* Get the character from UART Buffer */ u8InChar = UART_READ(UART); /* Rx trigger level is 1 byte*/ //printf("%c", u8InChar); /* Check if buffer full */ if(g_u32comLength < RXBUFSIZE) { /* Enqueue the character */ g_u8RecData[g_u32comLength] = u8InChar; g_u32comLength++; //g_u32comRtail = (g_u32comRtail == (RXBUFSIZE-1)) ? 0 : (g_u32comRtail+1); //g_u32comRbytes++; } if(u8InChar == '\n') { getUartData = TRUE; g_u32comLength = 0; } } } // if(u32IntSts & UART_ISR_THRE_INT_Msk) { // uint16_t tmp; // tmp = g_u32comRtail; // if(g_u32comRhead != tmp) { // u8InChar = g_u8RecData[g_u32comRhead]; // UART_WRITE(UART,u8InChar); // g_u32comRhead = (g_u32comRhead == (RXBUFSIZE-1)) ? 0 : (g_u32comRhead+1); // g_u32comRbytes--; // } // } }