From e42230e7fae59d91186d21ab6ba8311421649375 Mon Sep 17 00:00:00 2001 From: Nick Foster Date: Thu, 12 Aug 2010 15:17:58 -0700 Subject: Added UART transactions to the DUDE/BRO protocol. --- firmware/microblaze/lib/hal_io.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'firmware/microblaze/lib/hal_io.c') diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c index 8bb5e2af8..549990311 100644 --- a/firmware/microblaze/lib/hal_io.c +++ b/firmware/microblaze/lib/hal_io.c @@ -205,6 +205,18 @@ fputstr(hal_uart_name_t u, const char *s) return 0; } +int +fnputstr(hal_uart_name_t u, const char *s, int len) +{ + int x; + while (*s && (len > x)) { + fputchar(u, *s++); + x++; + } + + return x; +} + int putstr(const char *s) { @@ -233,6 +245,15 @@ fgets(hal_uart_name_t u, char * const s) return s; } +int +fngets(hal_uart_name_t u, char * const s, int len) +{ + char *x = s; + while(((*x=(char)hal_uart_getc(u)) != '\n') && ((x-s) < len)) x++; + *x = 0; + return (x-s)-1; +} + char * gets(char * const s) { -- cgit v1.2.3