summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorNick Foster <nick@ettus.com>2011-09-08 16:42:21 -0700
committerJosh Blum <josh@joshknows.com>2011-09-28 10:32:05 -0700
commit18a3f03c06c65d79e5c4b7ac1076077c4b9fd8ff (patch)
treea8ff89d12c47a658d1f66055d70395beb84bc819 /firmware
parentc2122833e25ffe6e8e6918874afe7a3c9a92bc87 (diff)
downloaduhd-18a3f03c06c65d79e5c4b7ac1076077c4b9fd8ff.tar.gz
uhd-18a3f03c06c65d79e5c4b7ac1076077c4b9fd8ff.tar.bz2
uhd-18a3f03c06c65d79e5c4b7ac1076077c4b9fd8ff.zip
ZPU/USRP2: first stab at UDP UART firmware
Diffstat (limited to 'firmware')
-rw-r--r--firmware/zpu/apps/txrx_uhd.c19
-rw-r--r--firmware/zpu/lib/CMakeLists.txt1
-rw-r--r--firmware/zpu/lib/net_common.c2
3 files changed, 20 insertions, 2 deletions
diff --git a/firmware/zpu/apps/txrx_uhd.c b/firmware/zpu/apps/txrx_uhd.c
index dfb484bc5..9d0a28b58 100644
--- a/firmware/zpu/apps/txrx_uhd.c
+++ b/firmware/zpu/apps/txrx_uhd.c
@@ -32,6 +32,7 @@
#include "usrp2/fw_common.h"
#include "udp_fw_update.h"
#include "pkt_ctrl.h"
+#include "udp_uart.h"
//standard headers
#include <stddef.h>
@@ -71,6 +72,12 @@ static void handle_udp_data_packet(
sr_tx_ctrl->cyc_per_up = 0;
break;
+ case USRP2_UDP_UART_BASE_PORT+0:
+ case USRP2_UDP_UART_BASE_PORT+1:
+ case USRP2_UDP_UART_BASE_PORT+2:
+ turn_off_uart(src.port-USRP2_UDP_UART_BASE_PORT);
+ break;
+
default: return;
}
@@ -223,6 +230,7 @@ static void handle_udp_ctrl_packet(
/*******************************************************************
* UART Control
******************************************************************/
+/*
case USRP2_CTRL_ID_SO_LIKE_CAN_YOU_READ_THIS_UART_BRO:{
//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;
@@ -244,7 +252,7 @@ static void handle_udp_ctrl_packet(
ctrl_data_out.data.uart_args.bytes = num_bytes;
break;
}
-
+*/
/*******************************************************************
* Echo test
******************************************************************/
@@ -336,8 +344,12 @@ main(void)
register_udp_listener(USRP2_UDP_RX_DSP0_PORT, handle_udp_data_packet);
register_udp_listener(USRP2_UDP_RX_DSP1_PORT, handle_udp_data_packet);
register_udp_listener(USRP2_UDP_TX_DSP0_PORT, handle_udp_data_packet);
+
#ifdef USRP2P
register_udp_listener(USRP2_UDP_UPDATE_PORT, handle_udp_fw_update_packet);
+ int i;
+ for(i=0; i<NUM_UARTS; i++)
+ register_udp_listener(USRP2_UDP_UART_BASE_PORT+i, handle_uart_data_packet);
#endif
//3) set the routing mode to slave to set defaults
@@ -356,6 +368,11 @@ main(void)
pkt_ctrl_release_incoming_buffer();
}
+#ifdef USRP2P
+ //look for incoming data on the four UARTs and handle it
+ poll_uarts();
+#endif
+
pic_interrupt_handler();
/*
int pending = pic_regs->pending; // poll for under or overrun
diff --git a/firmware/zpu/lib/CMakeLists.txt b/firmware/zpu/lib/CMakeLists.txt
index 193d63cfa..ce6b7fa44 100644
--- a/firmware/zpu/lib/CMakeLists.txt
+++ b/firmware/zpu/lib/CMakeLists.txt
@@ -44,4 +44,5 @@ SET(COMMON_SRCS
${CMAKE_SOURCE_DIR}/lib/net_common.c
${CMAKE_SOURCE_DIR}/lib/arp_cache.c
${CMAKE_SOURCE_DIR}/lib/banal.c
+ ${CMAKE_SOURCE_DIR}/lib/udp_uart.c
)
diff --git a/firmware/zpu/lib/net_common.c b/firmware/zpu/lib/net_common.c
index 9a3f8c5a5..698ed97f4 100644
--- a/firmware/zpu/lib/net_common.c
+++ b/firmware/zpu/lib/net_common.c
@@ -42,7 +42,7 @@
static const bool debug = false;
static const size_t out_buff_size = 2048;
static const eth_mac_addr_t BCAST_MAC_ADDR = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
-#define MAX_UDP_LISTENERS 6
+#define MAX_UDP_LISTENERS 10
/***********************************************************************
* 16-bit one's complement sum