summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2012-01-04 10:26:00 -0800
committerJosh Blum <josh@joshknows.com>2012-01-04 10:26:00 -0800
commitf2388c07ecff5a3488c6ef23852321df54292934 (patch)
tree92f6e1653765a40bdc95f18ed639ccf4f534c0fc /firmware
parent1b2108274aeec3733f84c82bee885ab9a4da4c26 (diff)
downloaduhd-f2388c07ecff5a3488c6ef23852321df54292934.tar.gz
uhd-f2388c07ecff5a3488c6ef23852321df54292934.tar.bz2
uhd-f2388c07ecff5a3488c6ef23852321df54292934.zip
usrp2: fw fix for hal_uart_getc_noblock return code
Diffstat (limited to 'firmware')
-rw-r--r--firmware/zpu/lib/hal_io.c5
-rw-r--r--firmware/zpu/lib/hal_uart.c2
-rw-r--r--firmware/zpu/lib/udp_uart.c5
3 files changed, 7 insertions, 5 deletions
diff --git a/firmware/zpu/lib/hal_io.c b/firmware/zpu/lib/hal_io.c
index 4ed694b9d..d4be324f5 100644
--- a/firmware/zpu/lib/hal_io.c
+++ b/firmware/zpu/lib/hal_io.c
@@ -257,8 +257,9 @@ fngets_noblock(hal_uart_name_t u, char * const s, int len)
{
int i;
for(i=0; i < len; i++) {
- s[i] = (char) hal_uart_getc_noblock(u);
- if((s[i] == 255) || (s[i] == '\n')) break;
+ int ret = hal_uart_getc_noblock(u);
+ s[i] = (char) ret;
+ if((ret == -1) || (s[i] == '\n')) break;
}
s[i] = 0;
diff --git a/firmware/zpu/lib/hal_uart.c b/firmware/zpu/lib/hal_uart.c
index 6a37cceb6..af60bed6a 100644
--- a/firmware/zpu/lib/hal_uart.c
+++ b/firmware/zpu/lib/hal_uart.c
@@ -108,7 +108,7 @@ hal_uart_getc_noblock(hal_uart_name_t u)
// int timeout = 0;
// while (((uart_regs[u].rxlevel) == 0) && (timeout++ < HAL_UART_TIMEOUT_MS))
// mdelay(1);
- if(uart_regs[u].rxlevel == 0) return 255;
+ if(uart_regs[u].rxlevel == 0) return -1;
return uart_regs[u].rxchar;
}
diff --git a/firmware/zpu/lib/udp_uart.c b/firmware/zpu/lib/udp_uart.c
index 6f6b9ee91..a3940c05f 100644
--- a/firmware/zpu/lib/udp_uart.c
+++ b/firmware/zpu/lib/udp_uart.c
@@ -94,8 +94,9 @@ void udp_uart_poll(void){
//read all characters we can without blocking
for (size_t j = state->len; j < sizeof(_states[0].buf); j++){
- uint8_t ch = hal_uart_getc_noblock((hal_uart_name_t)i);
- if (ch == 255) break;
+ int ret = hal_uart_getc_noblock((hal_uart_name_t)i);
+ if (ret == -1) break;
+ char ch = (char) ret;
if (ch == '\n' || ch == '\r') newline = true;
state->buf[j] = ch;
state->len++;