summaryrefslogtreecommitdiffstats
path: root/firmware/zpu
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2011-02-17 13:58:27 -0800
committerJosh Blum <josh@joshknows.com>2011-02-17 13:58:27 -0800
commitc73165bb1d6ec6c714426584e3b1ef15e2e87cb4 (patch)
tree09c7cc4b5684b2d8dca789c10346c39de9c3f2f4 /firmware/zpu
parentc88166d65651bb98fc182ae600a6649120c601b5 (diff)
downloaduhd-c73165bb1d6ec6c714426584e3b1ef15e2e87cb4.tar.gz
uhd-c73165bb1d6ec6c714426584e3b1ef15e2e87cb4.tar.bz2
uhd-c73165bb1d6ec6c714426584e3b1ef15e2e87cb4.zip
usrp2: added 2nd dsp support to firmware for 2 and N series
Diffstat (limited to 'firmware/zpu')
-rw-r--r--firmware/zpu/apps/txrx_uhd.c26
-rw-r--r--firmware/zpu/lib/net_common.c29
-rw-r--r--firmware/zpu/usrp2p/memory_map.h9
3 files changed, 46 insertions, 18 deletions
diff --git a/firmware/zpu/apps/txrx_uhd.c b/firmware/zpu/apps/txrx_uhd.c
index 4ccb585e2..0c93d2352 100644
--- a/firmware/zpu/apps/txrx_uhd.c
+++ b/firmware/zpu/apps/txrx_uhd.c
@@ -53,20 +53,34 @@ static void setup_network(void);
// the fast-path setup global variables
// ----------------------------------------------------------------
static eth_mac_addr_t fp_mac_addr_src, fp_mac_addr_dst;
-extern struct socket_address fp_socket_src, fp_socket_dst;
+struct socket_address fp_socket_src, fp_socket_dst;
+extern uint16_t dsp0_dst_port, err0_dst_port, dsp1_dst_port;
static void handle_udp_err0_packet(
struct socket_address src, struct socket_address dst,
unsigned char *payload, int payload_len
){
sr_udp_sm->err0_port = (((uint32_t)dst.port) << 16) | src.port;
+ err0_dst_port = src.port;
printf("Storing for async error path:\n");
printf(" source udp port: %d\n", dst.port);
printf(" destination udp port: %d\n", src.port);
newline();
}
-static void handle_udp_data_packet(
+static void handle_udp_dsp1_packet(
+ struct socket_address src, struct socket_address dst,
+ unsigned char *payload, int payload_len
+){
+ sr_udp_sm->dsp1_port = (((uint32_t)dst.port) << 16) | src.port;
+ dsp1_dst_port = src.port;
+ printf("Storing for dsp1 path:\n");
+ printf(" source udp port: %d\n", dst.port);
+ printf(" destination udp port: %d\n", src.port);
+ newline();
+}
+
+static void handle_udp_dsp0_packet(
struct socket_address src, struct socket_address dst,
unsigned char *payload, int payload_len
){
@@ -75,7 +89,8 @@ static void handle_udp_data_packet(
fp_socket_src = dst;
fp_socket_dst = src;
sr_udp_sm->dsp0_port = (((uint32_t)dst.port) << 16) | src.port;
- printf("Storing for fast path:\n");
+ dsp0_dst_port = src.port;
+ printf("Storing for dsp0 path:\n");
printf(" source mac addr: ");
print_mac_addr(&fp_mac_addr_src); newline();
printf(" source ip addr: ");
@@ -341,13 +356,14 @@ main(void)
//1) register the addresses into the network stack
register_addrs(ethernet_mac_addr(), get_ip_addr());
- pkt_ctrl_program_inspector(get_ip_addr(), USRP2_UDP_DATA_PORT);
+ pkt_ctrl_program_inspector(get_ip_addr(), USRP2_UDP_DSP0_PORT);
//2) register callbacks for udp ports we service
init_udp_listeners();
register_udp_listener(USRP2_UDP_CTRL_PORT, handle_udp_ctrl_packet);
- register_udp_listener(USRP2_UDP_DATA_PORT, handle_udp_data_packet);
+ register_udp_listener(USRP2_UDP_DSP0_PORT, handle_udp_dsp0_packet);
register_udp_listener(USRP2_UDP_ERR0_PORT, handle_udp_err0_packet);
+ register_udp_listener(USRP2_UDP_DSP1_PORT, handle_udp_dsp1_packet);
#ifdef USRP2P
register_udp_listener(USRP2_UDP_UPDATE_PORT, handle_udp_fw_update_packet);
#endif
diff --git a/firmware/zpu/lib/net_common.c b/firmware/zpu/lib/net_common.c
index abf26deb6..6a0fd254b 100644
--- a/firmware/zpu/lib/net_common.c
+++ b/firmware/zpu/lib/net_common.c
@@ -41,7 +41,7 @@ static const bool debug = false;
static const eth_mac_addr_t BCAST_MAC_ADDR = {{0xff, 0xff, 0xff, 0xff, 0xff, 0xff}};
//used in the top level application...
-struct socket_address fp_socket_src, fp_socket_dst;
+uint16_t dsp0_dst_port, err0_dst_port, dsp1_dst_port;
// ------------------------------------------------------------------------
@@ -276,15 +276,24 @@ handle_icmp_packet(struct ip_addr src, struct ip_addr dst,
//filter out non udp data response
struct ip_hdr *ip = (struct ip_hdr *)(((uint8_t*)icmp) + sizeof(struct icmp_echo_hdr));
struct udp_hdr *udp = (struct udp_hdr *)(((char *)ip) + IP_HLEN);
- if (IPH_PROTO(ip) != IP_PROTO_UDP || udp->dest != fp_socket_dst.port) return;
-
- //end async update packets per second
- sr_tx_ctrl->cyc_per_up = 0;
-
- //the end continuous streaming command
- sr_rx_ctrl0->cmd = 1 << 31; //no samples now
- sr_rx_ctrl0->time_secs = 0;
- sr_rx_ctrl0->time_ticks = 0; //latch the command
+ if (IPH_PROTO(ip) != IP_PROTO_UDP) break;
+
+ if (udp->dest == dsp0_dst_port){
+ //the end continuous streaming command
+ sr_rx_ctrl0->cmd = 1 << 31; //no samples now
+ sr_rx_ctrl0->time_secs = 0;
+ sr_rx_ctrl0->time_ticks = 0; //latch the command
+ }
+ else if (udp->dest == dsp1_dst_port){
+ //the end continuous streaming command
+ sr_rx_ctrl1->cmd = 1 << 31; //no samples now
+ sr_rx_ctrl1->time_secs = 0;
+ sr_rx_ctrl1->time_ticks = 0; //latch the command
+ }
+ else if (udp->dest == err0_dst_port){
+ //end async update packets per second
+ sr_tx_ctrl->cyc_per_up = 0;
+ }
//struct udp_hdr *udp = (struct udp_hdr *)((char *)icmp + 28);
//printf("icmp port unr %d\n", udp->dest);
diff --git a/firmware/zpu/usrp2p/memory_map.h b/firmware/zpu/usrp2p/memory_map.h
index 2101989ff..2567a4588 100644
--- a/firmware/zpu/usrp2p/memory_map.h
+++ b/firmware/zpu/usrp2p/memory_map.h
@@ -218,8 +218,10 @@ hwconfig_wishbone_divisor(void)
#define SR_UDP_SM 96
#define SR_TX_DSP 208
#define SR_TX_CTRL 224
-#define SR_RX_DSP 160
-#define SR_RX_CTRL 176
+#define SR_RX_DSP0 160
+#define SR_RX_DSP1 240
+#define SR_RX_CTRL0 176
+#define SR_RX_CTRL1 32
#define SR_TIME64 192
#define SR_SIMTIMER 198
#define SR_LAST 255
@@ -365,7 +367,8 @@ typedef struct {
volatile uint32_t time_ticks;
} sr_rx_ctrl_t;
-#define sr_rx_ctrl0 ((sr_rx_ctrl_t *) _SR_ADDR(SR_RX_CTRL))
+#define sr_rx_ctrl0 ((sr_rx_ctrl_t *) _SR_ADDR(SR_RX_CTRL0))
+#define sr_rx_ctrl1 ((sr_rx_ctrl_t *) _SR_ADDR(SR_RX_CTRL1))
// ----------------------------------------------------------------
// VITA49 64 bit time (write only)