aboutsummaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-12-17 13:45:57 -0800
committerJosh Blum <josh@joshknows.com>2010-12-17 13:45:57 -0800
commit0e66165d43d896bbc263dcf3481b94450d7de89f (patch)
treec6ab3365d456a9c359003f87846a55938ca8d800 /firmware
parent72c7a0c9f0e41afe9713465eaa6ff2f189122753 (diff)
downloaduhd-0e66165d43d896bbc263dcf3481b94450d7de89f.tar.gz
uhd-0e66165d43d896bbc263dcf3481b94450d7de89f.tar.bz2
uhd-0e66165d43d896bbc263dcf3481b94450d7de89f.zip
udp_ports: set the source and destination ports
Diffstat (limited to 'firmware')
-rw-r--r--firmware/microblaze/apps/txrx_uhd.c18
-rw-r--r--firmware/microblaze/usrp2/memory_map.h7
-rw-r--r--firmware/microblaze/usrp2p/memory_map.h7
3 files changed, 21 insertions, 11 deletions
diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c
index 06f94e108..4f331718f 100644
--- a/firmware/microblaze/apps/txrx_uhd.c
+++ b/firmware/microblaze/apps/txrx_uhd.c
@@ -141,14 +141,18 @@ static void print_ip_addr(const void *t){
printf("%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
}
-void handle_udp_err0_packet(
+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 = src.port;
+ sr_udp_sm->err0_port = (((uint32_t)dst.port) << 16) | 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();
}
-void handle_udp_data_packet(
+static void handle_udp_data_packet(
struct socket_address src, struct socket_address dst,
unsigned char *payload, int payload_len
){
@@ -156,7 +160,7 @@ void handle_udp_data_packet(
arp_cache_lookup_mac(&src.addr, &fp_mac_addr_dst);
fp_socket_src = dst;
fp_socket_dst = src;
- sr_udp_sm->dsp0_port = src.port;
+ sr_udp_sm->dsp0_port = (((uint32_t)dst.port) << 16) | src.port;
printf("Storing for fast path:\n");
printf(" source mac addr: ");
print_mac_addr(fp_mac_addr_src.addr); newline();
@@ -208,7 +212,7 @@ void get_spi_readback_data(void) {
spi_register_callback(0);
}
-void handle_udp_ctrl_packet(
+static void handle_udp_ctrl_packet(
struct socket_address src, struct socket_address dst,
unsigned char *payload, int payload_len
){
@@ -484,8 +488,8 @@ static void setup_network(void){
sr_udp_sm->ip_hdr.checksum = UDP_SM_INS_IP_HDR_CHKSUM | (chksum & 0xffff);
//setup the udp header machine
- sr_udp_sm->udp_hdr.src_port = fp_socket_src.port;
- sr_udp_sm->udp_hdr.dst_port = UDP_SM_INS_UDP_PORT;
+ sr_udp_sm->udp_hdr.src_port = UDP_SM_INS_UDP_SRC_PORT;
+ sr_udp_sm->udp_hdr.dst_port = UDP_SM_INS_UDP_DST_PORT;
sr_udp_sm->udp_hdr.length = UDP_SM_INS_UDP_LEN;
sr_udp_sm->udp_hdr.checksum = UDP_SM_LAST_WORD; // zero UDP checksum
}
diff --git a/firmware/microblaze/usrp2/memory_map.h b/firmware/microblaze/usrp2/memory_map.h
index 2b91063b2..b4e4077c2 100644
--- a/firmware/microblaze/usrp2/memory_map.h
+++ b/firmware/microblaze/usrp2/memory_map.h
@@ -435,7 +435,7 @@ typedef struct {
uint32_t length;
uint32_t checksum; //word 22
} udp_hdr;
- volatile uint32_t _pad[2];
+ volatile uint32_t _pad[1];
volatile uint32_t dsp0_port;
volatile uint32_t err0_port;
volatile uint32_t dsp1_port;
@@ -444,8 +444,11 @@ typedef struct {
// control bits (all expect UDP_SM_LAST_WORD are mutually exclusive)
+// Insert a UDP source port from the table
+#define UDP_SM_INS_UDP_SRC_PORT (1 << 21)
+
// Insert a UDP dest port from the table
-#define UDP_SM_INS_UDP_PORT (1 << 20)
+#define UDP_SM_INS_UDP_DST_PORT (1 << 20)
// This is the last word of the header
#define UDP_SM_LAST_WORD (1 << 19)
diff --git a/firmware/microblaze/usrp2p/memory_map.h b/firmware/microblaze/usrp2p/memory_map.h
index 140ab0675..db47d0b5f 100644
--- a/firmware/microblaze/usrp2p/memory_map.h
+++ b/firmware/microblaze/usrp2p/memory_map.h
@@ -462,7 +462,7 @@ typedef struct {
uint32_t length;
uint32_t checksum; //word 22
} udp_hdr;
- volatile uint32_t _pad[2];
+ volatile uint32_t _pad[1];
volatile uint32_t dsp0_port;
volatile uint32_t err0_port;
volatile uint32_t dsp1_port;
@@ -471,8 +471,11 @@ typedef struct {
// control bits (all expect UDP_SM_LAST_WORD are mutually exclusive)
+// Insert a UDP source port from the table
+#define UDP_SM_INS_UDP_SRC_PORT (1 << 21)
+
// Insert a UDP dest port from the table
-#define UDP_SM_INS_UDP_PORT (1 << 20)
+#define UDP_SM_INS_UDP_DST_PORT (1 << 20)
// This is the last word of the header
#define UDP_SM_LAST_WORD (1 << 19)