git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vt100: include pgmspace.h as we use PROGMEM macro
[aversive.git]
/
modules
/
comm
/
uart
/
uart_host.c
diff --git
a/modules/comm/uart/uart_host.c
b/modules/comm/uart/uart_host.c
index
8c58c44
..
04231c2
100644
(file)
--- a/
modules/comm/uart/uart_host.c
+++ b/
modules/comm/uart/uart_host.c
@@
-24,6
+24,7
@@
#include <uart.h>
#include <uart_private.h>
#include <uart.h>
#include <uart_private.h>
+#include <fcntl.h>
/* this file os a stub for host */
/* this file os a stub for host */
@@
-35,36
+36,49
@@
void uart_init(void)
event *rx_event[UART_HW_NUM];
event *tx_event[UART_HW_NUM];
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)
{
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 0;
}
void uart_getconf(uint8_t num, struct uart_config *u)
{
+ return;
}
int uart_recv(uint8_t num)
{
}
int uart_recv(uint8_t num)
{
+ fcntl(0, F_SETFL, 0);
return getchar();
}
return getchar();
}
-int uart_
send_nowait(uint8_t num, char c
)
+int uart_
recv_nowait(uint8_t num
)
{
{
- return putchar(c);
+ fcntl(0, F_SETFL, O_NONBLOCK);
+ 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
)
{
{
- r
x_event = f
;
+ r
eturn putchar(c)
;
}
}