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 _kuart_int_err_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; uint_16 stat; #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; stat = sci_ptr->S1; if(stat & UART_S1_OR_MASK) { ++sci_info_ptr->RX_OVERRUNS; } if(stat & UART_S1_PF_MASK) { ++sci_info_ptr->RX_PARITY_ERRORS; } if(stat & UART_S1_NF_MASK) { ++sci_info_ptr->RX_NOISE_ERRORS; } if(stat & UART_S1_FE_MASK) { ++sci_info_ptr->RX_FRAMING_ERRORS; } } /* Endbody */
static void timer_wakeup_isr ( void *parameter ) { /* Stop the timer */ hwtimer_stop(&lpttimer); /* Do not return to sleep after isr again */ _lpm_wakeup_core (); /* Signal the timer event */ _lwevent_set (&app_event, TIMER_EVENT_MASK); }
static void my_rtc_isr ( pointer rtc_registers_ptr ) { uint_32 state = _rtc_get_status (); if (state & RTC_RTCISR_ALM) { /* Do not return to sleep after isr again */ _lpm_wakeup_core (); _lwevent_set(&app_event, RTC_EVENT_MASK); } _rtc_clear_requests (state); }
static void timer_wakeup_isr(pointer parameter) { uint_32 timer = (uint_32)parameter; /* Stop the timer */ #if MQX_VERSION == (402) _lpt_run (timer, FALSE); _lpt_clear_int (timer); #else hwtimer_stop(&hwtimer2); hwtimer_deinit(&hwtimer2); #endif /* Do not return to sleep after isr again */ _lpm_wakeup_core (); }