summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/lib
diff options
context:
space:
mode:
authorNick Foster <nick@nerdnetworks.org>2010-08-12 15:17:58 -0700
committerNick Foster <nick@nerdnetworks.org>2010-08-12 15:17:58 -0700
commite42230e7fae59d91186d21ab6ba8311421649375 (patch)
treeae04e44e64ead60a01e51149fddd5b67232da236 /firmware/microblaze/lib
parent0d7c9c86aa3b307b652378d3bb17e052cbc987e1 (diff)
downloaduhd-e42230e7fae59d91186d21ab6ba8311421649375.tar.gz
uhd-e42230e7fae59d91186d21ab6ba8311421649375.tar.bz2
uhd-e42230e7fae59d91186d21ab6ba8311421649375.zip
Added UART transactions to the DUDE/BRO protocol.
Diffstat (limited to 'firmware/microblaze/lib')
-rw-r--r--firmware/microblaze/lib/hal_io.c21
-rw-r--r--firmware/microblaze/lib/hal_io.h2
-rw-r--r--firmware/microblaze/lib/hal_uart.c2
3 files changed, 24 insertions, 1 deletions
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
@@ -206,6 +206,18 @@ fputstr(hal_uart_name_t u, const char *s)
}
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)
{
return fputstr(DEFAULT_UART, 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)
{
diff --git a/firmware/microblaze/lib/hal_io.h b/firmware/microblaze/lib/hal_io.h
index 99f8f7fc9..45e23755f 100644
--- a/firmware/microblaze/lib/hal_io.h
+++ b/firmware/microblaze/lib/hal_io.h
@@ -26,6 +26,8 @@ void hal_io_init(void);
void hal_finish();
char *gets(char * const s);
int fputstr(hal_uart_name_t u, const char *s);
+int fnputstr(hal_uart_name_t u, const char *s, int len);
+int fngets(hal_uart_name_t u, char * const s, int len);
/*
* ------------------------------------------------------------------------
diff --git a/firmware/microblaze/lib/hal_uart.c b/firmware/microblaze/lib/hal_uart.c
index 6717cd5e8..c85bcaca3 100644
--- a/firmware/microblaze/lib/hal_uart.c
+++ b/firmware/microblaze/lib/hal_uart.c
@@ -47,7 +47,7 @@ static char uart_mode[4] = {
static char uart_speeds[4] = {
[UART_DEBUG] = US_230400,
[UART_EXP] = US_230400,
- [UART_GPS] = US_230400
+ [UART_GPS] = US_115200
};
void