#include #include #include #include "encoding.h" #include "platform.h" #include "prci_driver.h" #include "eos.h" #include "interrupt.h" #include "event.h" #include "i2s.h" #include "uart.h" static eos_evt_simple_handler_t uart_handler[EOS_UART_MAX_ETYPE]; static void uart_handle_evt(unsigned char type, EOSMessage *msg, uint16_t len) { unsigned char idx = type & ~EOS_EVT_MASK; if (idx && (idx <= EOS_UART_MAX_ETYPE) && uart_handler[idx - 1]) { uart_handler[idx - 1](type & ~EOS_EVT_MASK); } else { eos_evtq_bad_handler(type, msg, len); } } static void uart_handle_intr(void) { if (UART0_REG(UART_REG_IP) & UART_IP_TXWM) { UART0_REG(UART_REG_IE) &= ~UART_IP_TXWM; eos_evtq_push_isr(EOS_EVT_UART | EOS_UART_ETYPE_TX, NULL, 0); } if (UART0_REG(UART_REG_IP) & UART_IP_RXWM) { UART0_REG(UART_REG_IE) &= ~UART_IP_RXWM; eos_evtq_push_isr(EOS_EVT_UART | EOS_UART_ETYPE_RX, NULL, 0); } } void eos_uart_preinit(void) { eos_uart_speed(EOS_UART_SPEED); eos_uart_enable(); } int eos_uart_init(void) { int i; for (i=0; i