summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-12 18:07:55 -0800
committerJosh Blum <josh@joshknows.com>2010-02-12 18:07:55 -0800
commit9fff25f4e5da179ea29ff44278e0415a337870cb (patch)
treecfbee4cf2921fd4bd415e3af1c1d466f79bab3d7 /firmware/microblaze
parent350f5c5decca20a54132867283448fd32226bbc2 (diff)
downloaduhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.gz
uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.tar.bz2
uhd-9fff25f4e5da179ea29ff44278e0415a337870cb.zip
Added a templated dictionary class because its more useful than map.
Made the device addrs into a string:string dict. If its all strings we dont have to change the top level caller for new product. Created shared_iovec class to manage memory for device recvs. Work on the bro/dude control protocol for usrp2.
Diffstat (limited to 'firmware/microblaze')
-rw-r--r--firmware/microblaze/apps/txrx.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index 1c43a2ca1..2cc414f02 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -159,28 +159,37 @@ void handle_udp_ctrl_packet(
struct socket_address src, struct socket_address dst,
unsigned char *payload, int payload_len
){
- printf("Got ctrl packet #words: %d\n", (int)payload_len);
+ //printf("Got ctrl packet #words: %d\n", (int)payload_len);
if (payload_len < sizeof(usrp2_ctrl_data_t)){
//TODO send err packet
return;
}
+
//setup the input and output data
usrp2_ctrl_data_t *ctrl_data_in = (usrp2_ctrl_data_t *)payload;
usrp2_ctrl_data_t ctrl_data_out = {
- .id=USRP2_CTRL_ID_NONE,
+ .id=USRP2_CTRL_ID_HUH_WHAT,
.seq=ctrl_data_in->seq
};
+
//handle the data based on the id
switch(ctrl_data_in->id){
- case USRP2_CTRL_ID_HELLO:
- ctrl_data_out.id = ctrl_data_in->id;
- //grab the addrs
+
+ case USRP2_CTRL_ID_GIVE_ME_YOUR_IP_ADDR_BRO:
+ ctrl_data_out.id = USRP2_CTRL_ID_THIS_IS_MY_IP_ADDR_DUDE;
struct ip_addr ip_addr = get_my_ip_addr();
+ memcpy(&ctrl_data_out.data.ip_addr, &ip_addr, sizeof(ip_addr));
+ break;
+
+ case USRP2_CTRL_ID_GIVE_ME_YOUR_MAC_ADDR_BRO:
+ ctrl_data_out.id = USRP2_CTRL_ID_THIS_IS_MY_MAC_ADDR_DUDE;
eth_mac_addr_t mac_addr = get_my_eth_mac_addr();
- //copy them into the out data
- memcpy(&ctrl_data_out.data.discovery_addrs.ip_addr, &ip_addr, sizeof(ip_addr));
- memcpy(&ctrl_data_out.data.discovery_addrs.mac_addr, &mac_addr, sizeof(mac_addr));
+ memcpy(&ctrl_data_out.data.mac_addr, &mac_addr, sizeof(mac_addr));
break;
+
+ default:
+ ctrl_data_out.id = USRP2_CTRL_ID_HUH_WHAT;
+
}
send_udp_pkt(USRP2_UDP_CTRL_PORT, src, &ctrl_data_out, sizeof(ctrl_data_out));
}