aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/microblaze')
-rw-r--r--firmware/microblaze/apps/txrx_uhd.c4
-rw-r--r--firmware/microblaze/lib/hal_io.c6
-rw-r--r--firmware/microblaze/lib/hal_uart.c2
3 files changed, 5 insertions, 7 deletions
diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c
index 42a3f4b89..2065830ff 100644
--- a/firmware/microblaze/apps/txrx_uhd.c
+++ b/firmware/microblaze/apps/txrx_uhd.c
@@ -315,7 +315,7 @@ void handle_udp_ctrl_packet(
//executes a readline()-style read, up to num_bytes long, up to and including newline
int num_bytes = ctrl_data_in->data.uart_args.bytes;
if(num_bytes > 20) num_bytes = 20;
- num_bytes = fngets(ctrl_data_in->data.uart_args.dev, (char *) ctrl_data_in->data.uart_args.data, num_bytes);
+ num_bytes = fngets(ctrl_data_in->data.uart_args.dev, (char *) ctrl_data_out.data.uart_args.data, num_bytes);
ctrl_data_out.id = USRP2_CTRL_ID_I_HELLA_READ_THAT_UART_DUDE;
ctrl_data_out.data.uart_args.bytes = num_bytes;
break;
@@ -326,7 +326,7 @@ void handle_udp_ctrl_packet(
if(num_bytes > 20) num_bytes = 20;
fnputstr(ctrl_data_in->data.uart_args.dev, (char *) ctrl_data_in->data.uart_args.data, num_bytes);
ctrl_data_out.id = USRP2_CTRL_ID_MAN_I_TOTALLY_WROTE_THAT_UART_DUDE;
- ctrl_data_out.data.i2c_args.bytes = num_bytes;
+ ctrl_data_out.data.uart_args.bytes = num_bytes;
break;
}
diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c
index 549990311..18cc34aaf 100644
--- a/firmware/microblaze/lib/hal_io.c
+++ b/firmware/microblaze/lib/hal_io.c
@@ -208,11 +208,9 @@ 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)) {
+ int x = 0;
+ while (*s && (len > x++))
fputchar(u, *s++);
- x++;
- }
return x;
}
diff --git a/firmware/microblaze/lib/hal_uart.c b/firmware/microblaze/lib/hal_uart.c
index c85bcaca3..a8344daf5 100644
--- a/firmware/microblaze/lib/hal_uart.c
+++ b/firmware/microblaze/lib/hal_uart.c
@@ -64,7 +64,7 @@ void hal_uart_set_speed(hal_uart_name_t uart, hal_uart_speed_t speed)
void
hal_uart_init(void)
{
- for(int i = 0; i < 2; i++) { //uart 3 is unused
+ for(int i = 0; i < 3; i++) {
hal_uart_set_mode(i, uart_mode[i]);
hal_uart_set_speed(i, uart_speeds[i]);
}