summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/soc/uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/soc/uart.c')
-rw-r--r--fw/fe310/eos/soc/uart.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/fw/fe310/eos/soc/uart.c b/fw/fe310/eos/soc/uart.c
index 44c9a52..a5ba35f 100644
--- a/fw/fe310/eos/soc/uart.c
+++ b/fw/fe310/eos/soc/uart.c
@@ -13,15 +13,15 @@
#include "uart.h"
-static eos_uart_handler_t uart_handler[EOS_UART_MAX_ETYPE];
+static eos_evt_simple_handler_t uart_handler[EOS_UART_MAX_ETYPE];
-static void uart_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
- unsigned char idx = (type & ~EOS_EVT_MASK) - 1;
+static void uart_handle_evt(unsigned char type, EOSMessage *msg, uint16_t len) {
+ unsigned char idx = type & ~EOS_EVT_MASK;
- if ((idx < EOS_UART_MAX_ETYPE) && uart_handler[idx]) {
- uart_handler[idx](type);
+ 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, buffer, len);
+ eos_evtq_bad_handler(type, msg, len);
}
}
@@ -76,7 +76,7 @@ void eos_uart_speed(uint32_t baud_rate) {
UART0_REG(UART_REG_DIV) = PRCI_get_cpu_freq() / baud_rate - 1;
}
-void eos_uart_set_handler(unsigned char type, eos_uart_handler_t handler) {
+void eos_uart_set_handler(unsigned char type, eos_evt_simple_handler_t handler) {
if (type && (type <= EOS_UART_MAX_ETYPE)) uart_handler[type - 1] = handler;
}