summaryrefslogtreecommitdiffstats
path: root/firmware/microblaze/apps
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-11 20:24:01 -0800
committerJosh Blum <josh@joshknows.com>2010-02-11 20:24:01 -0800
commit350f5c5decca20a54132867283448fd32226bbc2 (patch)
tree261ec83435d3625ea307e21813ea814113278b79 /firmware/microblaze/apps
parent6c7d9f1f7573fc73522499573560bf1aef64f414 (diff)
downloaduhd-350f5c5decca20a54132867283448fd32226bbc2.tar.gz
uhd-350f5c5decca20a54132867283448fd32226bbc2.tar.bz2
uhd-350f5c5decca20a54132867283448fd32226bbc2.zip
Getting hello packets from the usrp2 with ip and mac addrs.
Cleaned up the mb build system a bit.
Diffstat (limited to 'firmware/microblaze/apps')
-rw-r--r--firmware/microblaze/apps/Makefile.am5
-rw-r--r--firmware/microblaze/apps/txrx.c24
2 files changed, 26 insertions, 3 deletions
diff --git a/firmware/microblaze/apps/Makefile.am b/firmware/microblaze/apps/Makefile.am
index 8e4551083..eb6ee6534 100644
--- a/firmware/microblaze/apps/Makefile.am
+++ b/firmware/microblaze/apps/Makefile.am
@@ -19,7 +19,9 @@
include $(top_srcdir)/Makefile.common
-LDADD = ../lib/libu2fw.a
+LDADD = $(top_srcdir)/lib/libu2fw.a
+
+AM_CFLAGS += -I$(top_srcdir)/../../lib/usrp/mboard
noinst_PROGRAMS = txrx.elf
@@ -78,4 +80,3 @@ txrx_elf_SOURCES = txrx.c
# mimo_app_common_v2.h
#
-MOSTLYCLEANFILES = *.map
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index 23a88c246..1c43a2ca1 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -160,7 +160,29 @@ void handle_udp_ctrl_packet(
unsigned char *payload, int payload_len
){
printf("Got ctrl packet #words: %d\n", (int)payload_len);
- send_udp_pkt(USRP2_UDP_CTRL_PORT, src, payload, 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,
+ .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
+ struct ip_addr ip_addr = get_my_ip_addr();
+ 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));
+ break;
+ }
+ send_udp_pkt(USRP2_UDP_CTRL_PORT, src, &ctrl_data_out, sizeof(ctrl_data_out));
}
/*