diff options
author | Josh Blum <josh@joshknows.com> | 2012-01-04 10:26:00 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2012-01-04 10:26:00 -0800 |
commit | f2388c07ecff5a3488c6ef23852321df54292934 (patch) | |
tree | 92f6e1653765a40bdc95f18ed639ccf4f534c0fc | |
parent | 1b2108274aeec3733f84c82bee885ab9a4da4c26 (diff) | |
download | uhd-f2388c07ecff5a3488c6ef23852321df54292934.tar.gz uhd-f2388c07ecff5a3488c6ef23852321df54292934.tar.bz2 uhd-f2388c07ecff5a3488c6ef23852321df54292934.zip |
usrp2: fw fix for hal_uart_getc_noblock return code
-rw-r--r-- | firmware/zpu/lib/hal_io.c | 5 | ||||
-rw-r--r-- | firmware/zpu/lib/hal_uart.c | 2 | ||||
-rw-r--r-- | firmware/zpu/lib/udp_uart.c | 5 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/fw_common.h | 2 |
4 files changed, 8 insertions, 6 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++; diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h index ed485023e..1af1db860 100644 --- a/host/lib/usrp/usrp2/fw_common.h +++ b/host/lib/usrp/usrp2/fw_common.h @@ -32,7 +32,7 @@ extern "C" { //fpga and firmware compatibility numbers #define USRP2_FPGA_COMPAT_NUM 8 #define USRP2_FW_COMPAT_NUM 11 -#define USRP2_FW_VER_MINOR 0 +#define USRP2_FW_VER_MINOR 1 //used to differentiate control packets over data port #define USRP2_INVALID_VRT_HEADER 0 |