void _kuart_int_rx_tx_isr ( /* [IN] the address of the device specific information */ pointer parameter ) { /* Body */ IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr = parameter; KUART_INFO_STRUCT_PTR sci_info_ptr = int_io_dev_ptr->DEV_INFO_PTR; UART_MemMapPtr sci_ptr = sci_info_ptr->SCI_PTR; volatile int_32 c; #if MQX_ENABLE_LOW_POWER if (int_io_dev_ptr->LPM_INFO.FLAGS & IO_PERIPHERAL_WAKEUP_ENABLE) { /* Disable wakeup settings */ int_io_dev_ptr->LPM_INFO.FLAGS &= (~ IO_PERIPHERAL_WAKEUP_ENABLE); sci_ptr->C2 &= (~ (UART_C2_RWU_MASK)); sci_ptr->C1 &= (~ (UART_C1_WAKE_MASK | UART_C1_ILT_MASK)); sci_ptr->C4 &= (~ (UART_C4_MAEN1_MASK | UART_C4_MAEN2_MASK)); sci_ptr->MA1 = 0; sci_ptr->MA2 = 0; /* Do not return to CPU sleep anymore */ if (int_io_dev_ptr->LPM_INFO.FLAGS & IO_PERIPHERAL_WAKEUP_SLEEPONEXIT_DISABLE) { int_io_dev_ptr->LPM_INFO.FLAGS &= (~ IO_PERIPHERAL_WAKEUP_SLEEPONEXIT_DISABLE); _lpm_wakeup_core (); } } #endif ++sci_info_ptr->INTERRUPTS; /* try if RX buffer has some characters */ if (sci_ptr->S1 & UART_S1_RDRF_MASK) { c = sci_ptr->D; if (!_io_serial_int_addc(int_io_dev_ptr, c)) { sci_info_ptr->RX_DROPPED_INPUT++; } sci_info_ptr->RX_CHARS++; } /* try if TX buffer is still not full */ if (sci_ptr->S1 & UART_S1_TDRE_MASK) { c = _io_serial_int_nextc(int_io_dev_ptr); if (c >= 0) { sci_ptr->D = c; } else { /* All data sent, disable transmit interrupt */ sci_ptr->C2 &= ~UART_C2_TIE_MASK; } sci_info_ptr->TX_CHARS++; } } /* Endbody */
void _mcf54xx_uart_serial_int_isr ( /* [IN] the address of the device specific information */ pointer parameter ) { /* Body */ IO_SERIAL_INT_DEVICE_STRUCT_PTR int_io_dev_ptr = parameter; MCF54XX_UART_SERIAL_INFO_STRUCT_PTR uart_info_ptr; volatile MCF54XX_UART_STRUCT _PTR_ uart_ptr; int_32 c; uint_16 stat; boolean work; uart_info_ptr = int_io_dev_ptr->DEV_INFO_PTR; uart_ptr = uart_info_ptr->UART_PTR; ++uart_info_ptr->INTERRUPTS; /* Receive loop */ work = TRUE; while (work) { work = FALSE; stat = uart_ptr->READ.USR; while (stat & MCF54XX_UART_USR_RXRDY) { c = uart_ptr->READ.URB; /* this clears the status bit */ if (stat & (MCF54XX_UART_USR_RB | MCF54XX_UART_USR_FE | MCF54XX_UART_USR_PE | MCF54XX_UART_USR_OE)) { if (stat & MCF54XX_UART_USR_RB) { ++uart_info_ptr->RX_BREAKS; c = uart_ptr->READ.URB; /* read break character */ uart_ptr->WRITE.UCR = MCF54XX_UART_UCR_RESET_BREAK; } /* Endif */ if (stat & MCF54XX_UART_USR_FE) { ++uart_info_ptr->RX_FRAMING_ERRORS; } /* Endif */ if (stat & MCF54XX_UART_USR_PE) { ++uart_info_ptr->RX_PARITY_ERRORS; } /* Endif */ if (stat & MCF54XX_UART_USR_OE) { ++uart_info_ptr->RX_OVERRUNS; } /* Endif */ uart_ptr->WRITE.UCR = MCF54XX_UART_UCR_RESET_ERROR; } /* Endif */ uart_info_ptr->RX_CHARS++; work = TRUE; if (!_io_serial_int_addc(int_io_dev_ptr, c)) { uart_info_ptr->RX_DROPPED_INPUT++; } /* Endif */ stat = uart_ptr->READ.USR; } /* Endwhile */ while (stat & MCF54XX_UART_USR_TXRDY) { c = _io_serial_int_nextc(int_io_dev_ptr); if (c >= 0) { work = TRUE; uart_ptr->WRITE.UTB = c; uart_info_ptr->INT_ENABLE_BITS |= MCF54XX_UART_UIMR_TXRDY; uart_ptr->WRITE.UIMR = uart_info_ptr->INT_ENABLE_BITS; } else { /* No output. Turn off transmit interrupt */ uart_info_ptr->INT_ENABLE_BITS &= ~MCF54XX_UART_UIMR_TXRDY; uart_ptr->WRITE.UIMR = uart_info_ptr->INT_ENABLE_BITS; break; } /* Endif */ stat = uart_ptr->READ.USR; uart_info_ptr->TX_CHARS++; } /* Endwhile */ } /* Endwhile */ } /* Endbody */