X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=modules%2Fcomm%2Fuart%2Fuart_host.c;h=bd6aeed993e2b37d071587591ab72e8fa06f513f;hp=8c58c44db0e280c5e47e69cc740efa7a77a85b5d;hb=0e9f190378d69540389fad5e231529ba153761b2;hpb=ccc6954bb046671b9e28c5806db5121c1eef49c0 diff --git a/modules/comm/uart/uart_host.c b/modules/comm/uart/uart_host.c index 8c58c44..bd6aeed 100644 --- a/modules/comm/uart/uart_host.c +++ b/modules/comm/uart/uart_host.c @@ -24,7 +24,6 @@ #include #include - /* this file os a stub for host */ void uart_init(void) @@ -35,13 +34,29 @@ void uart_init(void) event *rx_event[UART_HW_NUM]; event *tx_event[UART_HW_NUM]; +void uart_host_rx_event(char c) +{ + /* only one uart */ + if (rx_event[0]) + rx_event[0](c); +} + +void uart_host_tx_event(char c) +{ + /* only one uart */ + if (tx_event[0]) + tx_event[0](c); +} + int8_t uart_setconf(uint8_t num, struct uart_config *u) { + /* XXX todo */ return 0; } void uart_getconf(uint8_t num, struct uart_config *u) { + return; } int uart_recv(uint8_t num) @@ -49,22 +64,18 @@ int uart_recv(uint8_t num) return getchar(); } -int uart_send_nowait(uint8_t num, char c) +/* XXX should not wait */ +int uart_recv_nowait(uint8_t num) { - return putchar(c); + return getchar(); } -int uart_send(uint8_t num, char c) +int uart_send_nowait(uint8_t num, char c) { - return put_char(c); -} - -void uart_register_tx_event(uint8_t num, void (*f)(char)) -{ - tx_event = f; + return putchar(c); } -void uart_register_rx_event(uint8_t num, void (*f)(char)) +int uart_send(uint8_t num, char c) { - rx_event = f; + return putchar(c); }