X-Git-Url: http://git.droids-corp.org/?p=aversive.git;a=blobdiff_plain;f=modules%2Fcomm%2Fuart%2Fuart_host.c;h=04231c2fbaa35b8509f760cfd2e21979ddaa507e;hp=429c4dbc0e2bcaefda8a74a50cc4f484a50a0698;hb=fa8546ea39c7442ad3bf5a822a72a2b50a41045d;hpb=09fd7b53a60d7201b6d019d88d3fee3d43a14c3f diff --git a/modules/comm/uart/uart_host.c b/modules/comm/uart/uart_host.c index 429c4db..04231c2 100644 --- a/modules/comm/uart/uart_host.c +++ b/modules/comm/uart/uart_host.c @@ -24,6 +24,8 @@ #include #include +#include + /* this file os a stub for host */ void uart_init(void) @@ -34,17 +36,40 @@ 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) { + fcntl(0, F_SETFL, 0); + return getchar(); +} + +int uart_recv_nowait(uint8_t num) +{ + fcntl(0, F_SETFL, O_NONBLOCK); return getchar(); } @@ -55,6 +80,5 @@ int uart_send_nowait(uint8_t num, char c) int uart_send(uint8_t num, char c) { - return put_char(c); + return putchar(c); } -