aboutsummaryrefslogtreecommitdiffstats
path: root/firmware/microblaze
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-02-10 18:44:19 -0800
committerJosh Blum <josh@joshknows.com>2010-02-10 18:44:19 -0800
commit6c7d9f1f7573fc73522499573560bf1aef64f414 (patch)
tree5b63082d9b9c109ab2059c415f77935a9385cc81 /firmware/microblaze
parent2b6c895b4f9916a06b14c40f545c9b4e53141c9a (diff)
downloaduhd-6c7d9f1f7573fc73522499573560bf1aef64f414.tar.gz
uhd-6c7d9f1f7573fc73522499573560bf1aef64f414.tar.bz2
uhd-6c7d9f1f7573fc73522499573560bf1aef64f414.zip
removed unwanted/broken files
Diffstat (limited to 'firmware/microblaze')
-rw-r--r--firmware/microblaze/Makefile.common12
-rw-r--r--firmware/microblaze/apps/.gitignore71
-rw-r--r--firmware/microblaze/apps/Makefile.am74
-rw-r--r--firmware/microblaze/apps/app_common_v2.c724
-rw-r--r--firmware/microblaze/apps/app_common_v2.h83
-rw-r--r--firmware/microblaze/apps/txrx.c16
-rw-r--r--firmware/microblaze/configure.ac1
-rw-r--r--firmware/microblaze/include/Makefile.am7
-rw-r--r--firmware/microblaze/include/network.h85
-rw-r--r--firmware/microblaze/include/usrp2_cdefs.h34
-rw-r--r--firmware/microblaze/include/usrp2_eth_packet.h405
-rw-r--r--firmware/microblaze/include/usrp2_i2c_addr.h5
-rw-r--r--firmware/microblaze/include/usrp2_ipv4_packet.h52
-rw-r--r--firmware/microblaze/include/usrp2_types.h7
-rw-r--r--firmware/microblaze/include/usrp2_udp_packet.h37
15 files changed, 54 insertions, 1559 deletions
diff --git a/firmware/microblaze/Makefile.common b/firmware/microblaze/Makefile.common
index b67f5d02b..cb09f7f9d 100644
--- a/firmware/microblaze/Makefile.common
+++ b/firmware/microblaze/Makefile.common
@@ -48,14 +48,14 @@ AM_CFLAGS = $(STD_CFLAGS) $(MB_CFLAGS)
#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-defsym -Wl,_STACK_SIZE=1024
#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT) -Wl,-Map -Wl,$@.map
#AM_LDFLAGS = -Wl,-T,$(LINKER_SCRIPT)
-AM_LDFLAGS = -Wl,-Map -Wl,$@.map -Wl,-defsym -Wl,_STACK_SIZE=3072
+AM_LDFLAGS = -Wl,-Map -Wl,$(@:.elf=.map) -Wl,-defsym -Wl,_STACK_SIZE=3072
#AM_LDFLAGS = -Wl,-defsym -Wl,_STACK_SIZE=2048
-%.bin : %
+%.bin : %.elf
mb-objcopy -O binary $< $@
-%.dump : %
+%.dump : %.elf
mb-objdump -DSC $< > $@
%.rom : %.bin
@@ -65,9 +65,9 @@ AM_LDFLAGS = -Wl,-Map -Wl,$@.map -Wl,-defsym -Wl,_STACK_SIZE=3072
#.PRECIOUS : %.bin
-BINS = $(noinst_PROGRAMS:=.bin)
-ROMS = $(noinst_PROGRAMS:=.rom)
-DUMPS = $(noinst_PROGRAMS:=.dump)
+BINS = $(noinst_PROGRAMS:.elf=.bin)
+ROMS = $(noinst_PROGRAMS:.elf=.rom)
+DUMPS = $(noinst_PROGRAMS:.elf=.dump)
noinst_DATA = $(BINS) $(ROMS) $(DUMPS)
diff --git a/firmware/microblaze/apps/.gitignore b/firmware/microblaze/apps/.gitignore
index b8ab0dc8d..968b04cd7 100644
--- a/firmware/microblaze/apps/.gitignore
+++ b/firmware/microblaze/apps/.gitignore
@@ -1,77 +1,8 @@
-/*-stamp
-/*.a
+/*.elf
/*.bin
/*.dump
/*.log
/*.rom
/*.map
-/.deps
/Makefile
/Makefile.in
-/aclocal.m4
-/autom4te.cache
-/blink_leds
-/blink_leds2
-/build
-/compile
-/config.h
-/config.h.in
-/config.log
-/config.status
-/configure
-/depcomp
-/echo
-/eth_test
-/gen_eth_packets
-/ibs_rx_test
-/ibs_tx_test
-/install-sh
-/libtool
-/ltmain.sh
-/missing
-/py-compile
-/rcv_eth_packets
-/run_tests.sh
-/stamp-h1
-/test1
-/test_phy_comm
-/timer_test
-/buf_ram_test
-/buf_ram_zero
-/hello
-/test_printf
-/test_spi
-/test_i2c
-/gen_pause_frames
-/test_serdes
-/rx_only
-/tx_only
-/tx_standalone
-/tx_drop
-/tx_drop2
-/tx_drop_rate_limited
-/test_lsdac
-/test_lsadc
-/read_dbids
-/test_db_spi
-/ramp_lsdac
-/eth_to_serdes
-/serdes_to_dsp
-/sd_gentest
-/sd_bounce
-/can_i_sub
-/tx_only_v2
-/rx_only_v2
-/txrx
-/eth_serdes
-/serdes_txrx
-/set_hw_rev
-/test_sd
-/factory_test
-/test_ram
-/mimo_tx
-/mimo_tx_slave
-/burn_dbsrx_eeprom
-/burnrev30
-/burnrev31
-/burnrev40
diff --git a/firmware/microblaze/apps/Makefile.am b/firmware/microblaze/apps/Makefile.am
index d3c9fb1d8..8e4551083 100644
--- a/firmware/microblaze/apps/Makefile.am
+++ b/firmware/microblaze/apps/Makefile.am
@@ -21,31 +21,33 @@ include $(top_srcdir)/Makefile.common
LDADD = ../lib/libu2fw.a
-noinst_PROGRAMS = \
- blink_leds \
- blink_leds2 \
- buf_ram_test \
- burn_dbsrx_eeprom \
- can_i_sub \
- echo \
- hello \
- read_dbids \
- set_hw_rev \
- test1 \
- test_db_spi \
- test_i2c \
- test_sd \
- test_ram \
- test_phy_comm \
- test_lsadc \
- test_lsdac \
- timer_test \
- txrx \
- burnrev30 \
- burnrev31 \
- burnrev40 \
- sd_gentest \
- sd_bounce
+noinst_PROGRAMS = txrx.elf
+
+# blink_leds \
+# blink_leds2 \
+# buf_ram_test \
+# burn_dbsrx_eeprom \
+# can_i_sub \
+# echo \
+# hello \
+# read_dbids \
+# set_hw_rev \
+# test1 \
+# test_db_spi \
+# test_i2c \
+# test_sd \
+# test_ram \
+# test_phy_comm \
+# test_lsadc \
+# test_lsdac \
+# timer_test \
+# txrx \
+# burnrev30 \
+# burnrev31 \
+# burnrev40 \
+# sd_gentest \
+# sd_bounce
+#
#nononono = \
# eth_serdes \
@@ -62,18 +64,18 @@ noinst_PROGRAMS = \
# tx_drop_SOURCES = tx_drop.c app_common.c
# tx_drop_rate_limited_SOURCES = tx_drop_rate_limited.c app_common.c
# tx_drop2_SOURCES = tx_drop2.c app_common.c
-txrx_SOURCES = txrx.c
+txrx_elf_SOURCES = txrx.c
# app_common_v2.c
-factory_test_SOURCES = factory_test.c app_common_v2.c
-eth_serdes_SOURCES = eth_serdes.c app_passthru_v2.c
-serdes_txrx_SOURCES = serdes_txrx.c app_common_v2.c
-mimo_tx_SOURCES = mimo_tx.c mimo_app_common_v2.c
-mimo_tx_slave_SOURCES = mimo_tx_slave.c app_common_v2.c
-
-noinst_HEADERS = \
- app_common_v2.h \
- app_passthru_v2.h \
- mimo_app_common_v2.h
+#factory_test_SOURCES = factory_test.c app_common_v2.c
+#eth_serdes_SOURCES = eth_serdes.c app_passthru_v2.c
+#serdes_txrx_SOURCES = serdes_txrx.c app_common_v2.c
+#mimo_tx_SOURCES = mimo_tx.c mimo_app_common_v2.c
+#mimo_tx_slave_SOURCES = mimo_tx_slave.c app_common_v2.c
+#noinst_HEADERS = \
+# app_common_v2.h \
+# app_passthru_v2.h \
+# mimo_app_common_v2.h
+#
MOSTLYCLEANFILES = *.map
diff --git a/firmware/microblaze/apps/app_common_v2.c b/firmware/microblaze/apps/app_common_v2.c
deleted file mode 100644
index b51148de0..000000000
--- a/firmware/microblaze/apps/app_common_v2.c
+++ /dev/null
@@ -1,724 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "app_common_v2.h"
-#include "buffer_pool.h"
-#include "memcpy_wa.h"
-#include "ethernet.h"
-#include "nonstdio.h"
-#include "print_rmon_regs.h"
-#include "db.h"
-#include "clocks.h"
-#include "u2_init.h"
-#include <string.h>
-#include <stddef.h>
-#include "usrp2_fw_common.h"
-
-volatile bool link_is_up = false; // eth handler sets this
-int cpu_tx_buf_dest_port = PORT_ETH;
-
-// If this is non-zero, this dbsm could be writing to the ethernet
-dbsm_t *ac_could_be_sending_to_eth;
-
-static unsigned char exp_seqno __attribute__((unused)) = 0;
-
-static bool
-set_time(const op_set_time_t *p)
-{
- //printf("Setting time: secs %u, ticks %u\n", p->time_secs, p->time_ticks);
- //sr_time64->secs = p->time_secs; //set below...
- sr_time64->ticks = p->time_ticks;
- switch (p->type){
- case OP_SET_TIME_TYPE_NOW:
- sr_time64->imm = 1;
- break;
- case OP_SET_TIME_TYPE_PPS:
- sr_time64->imm = 0;
- break;
- }
- sr_time64->secs = p->time_secs; //set this last to latch the regs
- return true;
-}
-
-static inline bool
-config_clock_cmd(const op_config_clock_t *p)
-{
- //handle the 10 mhz ref source
- clocks_mimo_config(p->flags & MC_REF_CLK_MASK);
-
- //handle the pps config
- uint32_t pps_flags = 0;
- if (p->flags & MC_PPS_POLARITY_NEG) pps_flags |= 0x00 << 0;
- if (p->flags & MC_PPS_POLARITY_POS) pps_flags |= 0x01 << 0;
- if (p->flags & MC_PPS_SOURCE_SMA) pps_flags |= 0x00 << 1;
- if (p->flags & MC_PPS_SOURCE_MIMO) pps_flags |= 0x01 << 1;
- sr_time64->flags = pps_flags;
-
- return true;
-}
-
-static size_t
-op_id_cmd(const op_generic_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_id_reply_t *r = (op_id_reply_t *) reply_payload;
- if (reply_payload_space < sizeof(*r)) // no room
- return 0;
-
- // Build reply subpacket
-
- r->opcode = OP_ID_REPLY;
- r->len = sizeof(op_id_reply_t);
- r->rid = p->rid;
- r->addr = *ethernet_mac_addr();
- r->hw_rev = (u2_hw_rev_major << 8) | u2_hw_rev_minor;
- // r->fpga_md5sum = ; // FIXME
- // r->sw_md5sum = ; // FIXME
-
- return r->len;
-}
-
-
-static size_t
-config_tx_v2_cmd(const op_config_tx_v2_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_config_tx_reply_v2_t *r = (op_config_tx_reply_v2_t *) reply_payload;
- if (reply_payload_space < sizeof(*r))
- return 0; // no room
-
- struct tune_result tune_result;
- memset(&tune_result, 0, sizeof(tune_result));
-
- bool ok = true;
-
- if (p->valid & CFGV_GAIN){
- //ok &= db_set_gain(tx_dboard, p->gain);
- }
-
- if (p->valid & CFGV_FREQ){
- bool was_streaming = is_streaming();
- if (was_streaming)
- stop_rx_cmd();
-
- u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo);
- bool tune_ok = false;//db_tune(tx_dboard, f, &tune_result);
- ok &= tune_ok;
- print_tune_result("Tx", tune_ok, f, &tune_result);
-
- if (was_streaming)
- restart_streaming();
- }
-
- if (p->valid & CFGV_INTERP_DECIM){
- int interp = p->interp;
- int hb1 = 0;
- int hb2 = 0;
-
- if (!(interp & 1)){
- hb2 = 1;
- interp = interp >> 1;
- }
-
- if (!(interp & 1)){
- hb1 = 1;
- interp = interp >> 1;
- }
-
- if (interp < MIN_CIC_INTERP || interp > MAX_CIC_INTERP)
- ok = false;
- else {
- dsp_tx_regs->interp_rate = (hb1<<9) | (hb2<<8) | interp;
- // printf("Interp: %d, register %d\n", p->interp, (hb1<<9) | (hb2<<8) | interp);
- }
- }
-
- if (p->valid & CFGV_SCALE_IQ){
- dsp_tx_regs->scale_iq = p->scale_iq;
- }
-
- // Build reply subpacket
-
- r->opcode = OP_CONFIG_TX_REPLY_V2;
- r->len = sizeof(*r);
- r->rid = p->rid;
- r->ok = ok;
- r->inverted = tune_result.inverted;
- r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq);
- r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq);
- r->duc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq);
- r->duc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq);
- r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq);
- r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq);
- return r->len;
-}
-
-static size_t
-config_rx_v2_cmd(const op_config_rx_v2_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_config_rx_reply_v2_t *r = (op_config_rx_reply_v2_t *) reply_payload;
- if (reply_payload_space < sizeof(*r))
- return 0; // no room
-
- struct tune_result tune_result;
- memset(&tune_result, 0, sizeof(tune_result));
-
- bool ok = true;
-
- if (p->valid & CFGV_GAIN){
- //ok &= db_set_gain(rx_dboard, p->gain);
- }
-
- if (p->valid & CFGV_FREQ){
- bool was_streaming = is_streaming();
- if (was_streaming)
- stop_rx_cmd();
-
- u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo);
- bool tune_ok = false;//db_tune(rx_dboard, f, &tune_result);
- ok &= tune_ok;
- print_tune_result("Rx", tune_ok, f, &tune_result);
-
- if (was_streaming)
- restart_streaming();
- }
-
- if (p->valid & CFGV_INTERP_DECIM){
- int decim = p->decim;
- int hb1 = 0;
- int hb2 = 0;
-
- if(!(decim & 1)) {
- hb2 = 1;
- decim = decim >> 1;
- }
-
- if(!(decim & 1)) {
- hb1 = 1;
- decim = decim >> 1;
- }
-
- if (decim < MIN_CIC_DECIM || decim > MAX_CIC_DECIM)
- ok = false;
- else {
- dsp_rx_regs->decim_rate = (hb1<<9) | (hb2<<8) | decim;
- // printf("Decim: %d, register %d\n", p->decim, (hb1<<9) | (hb2<<8) | decim);
- }
- }
-
- if (p->valid & CFGV_SCALE_IQ){
- dsp_rx_regs->scale_iq = p->scale_iq;
- }
-
- // Build reply subpacket
-
- r->opcode = OP_CONFIG_RX_REPLY_V2;
- r->len = sizeof(*r);
- r->rid = p->rid;
- r->ok = ok;
- r->inverted = tune_result.inverted;
- r->baseband_freq_hi = u2_fxpt_freq_hi(tune_result.baseband_freq);
- r->baseband_freq_lo = u2_fxpt_freq_lo(tune_result.baseband_freq);
- r->ddc_freq_hi = u2_fxpt_freq_hi(tune_result.dxc_freq);
- r->ddc_freq_lo = u2_fxpt_freq_lo(tune_result.dxc_freq);
- r->residual_freq_hi = u2_fxpt_freq_hi(tune_result.residual_freq);
- r->residual_freq_lo = u2_fxpt_freq_lo(tune_result.residual_freq);
-
- return r->len;
-}
-
-static void
-fill_db_info(u2_db_info_t *p, const struct db_base *db)
-{
- /*p->dbid = db->dbid;
- p->freq_min_hi = u2_fxpt_freq_hi(db->freq_min);
- p->freq_min_lo = u2_fxpt_freq_lo(db->freq_min);
- p->freq_max_hi = u2_fxpt_freq_hi(db->freq_max);
- p->freq_max_lo = u2_fxpt_freq_lo(db->freq_max);
- p->gain_min = db->gain_min;
- p->gain_max = db->gain_max;
- p->gain_step_size = db->gain_step_size;*/
-}
-
-static size_t
-dboard_info_cmd(const op_generic_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_dboard_info_reply_t *r = (op_dboard_info_reply_t *) reply_payload;
- if (reply_payload_space < sizeof(*r))
- return 0; // no room
-
- r->opcode = OP_DBOARD_INFO_REPLY;
- r->len = sizeof(*r);
- r->rid = p->rid;
- r->ok = true;
-
- //fill_db_info(&r->tx_db_info, tx_dboard);
- //fill_db_info(&r->rx_db_info, rx_dboard);
-
- return r->len;
-}
-
-static size_t
-peek_cmd(const op_peek_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_generic_t *r = (op_generic_t *) reply_payload;
-
- //putstr("peek: addr="); puthex32(p->addr);
- //printf(" bytes=%u\n", p->bytes);
-
- if ((reply_payload_space < (sizeof(*r) + p->bytes)) ||
- p->bytes > MAX_SUBPKT_LEN - sizeof(op_generic_t)) {
- putstr("peek: insufficient reply packet space\n");
- return 0; // FIXME do partial read?
- }
-
- r->opcode = OP_PEEK_REPLY;
- r->len = sizeof(*r)+p->bytes;
- r->rid = p->rid;
- r->ok = true;
-
- memcpy_wa(reply_payload+sizeof(*r), (void *)p->addr, p->bytes);
-
- return r->len;
-}
-
-static bool
-poke_cmd(const op_poke_t *p)
-{
- int bytes = p->len - sizeof(*p);
- //putstr("poke: addr="); puthex32(p->addr);
- //printf(" bytes=%u\n", bytes);
-
- uint8_t *src = (uint8_t *)p + sizeof(*p);
- memcpy_wa((void *)p->addr, src, bytes);
-
- return true;
-}
-
-static bool
-set_lo_offset_cmd(const op_freq_t *p)
-{
- /*u2_fxpt_freq_t f = u2_fxpt_freq_from_hilo(p->freq_hi, p->freq_lo);
- if (p->opcode == OP_SET_TX_LO_OFFSET)
- return db_set_lo_offset(tx_dboard, f);
- else
- return db_set_lo_offset(rx_dboard, f);
- */return false;
-}
-
-static size_t
-gpio_read_cmd(const op_gpio_t *p,
- void *reply_payload, size_t reply_payload_space)
-{
- op_gpio_read_reply_t *r = (op_gpio_read_reply_t *) reply_payload;
- if (reply_payload_space < sizeof(*r)) // no room
- return 0;
-
- // Build reply subpacket
-
- r->opcode = OP_GPIO_READ_REPLY;
- r->len = sizeof(op_gpio_read_reply_t);
- r->rid = p->rid;
- r->ok = true;
- r->mbz = 0;
- r->value = hal_gpio_read(p->bank);
-
- return r->len;
-}
-
-static size_t
-generic_reply(const op_generic_t *p,
- void *reply_payload, size_t reply_payload_space,
- bool ok)
-{
- op_generic_t *r = (op_generic_t *) reply_payload;
- if (reply_payload_space < sizeof(*r))
- return 0; // no room
-
- r->opcode = p->opcode | OP_REPLY_BIT;
- r->len = sizeof(*r);
- r->rid = p->rid;
- r->ok = ok;
-
- return r->len;
-}
-
-static size_t
-add_eop(void *reply_payload, size_t reply_payload_space)
-{
- op_generic_t *r = (op_generic_t *) reply_payload;
- if (reply_payload_space < sizeof(*r))
- return 0; // no room
-
- r->opcode = OP_EOP;
- r->len = sizeof(*r);
- r->rid = 0;
- r->ok = 0;
-
- return r->len;
-}
-
-/***********************************************************************
- * Global vars to make the control replies
- **********************************************************************/
-#define REPLY_PAYLOAD_MAX_LEN (4 * sizeof(u2_subpkt_t))
-uint16_t host_dst_udp_port;
-uint16_t host_src_udp_port;
-struct in_addr host_dst_ip_addr;
-struct in_addr host_src_ip_addr;
-eth_mac_addr_t host_dst_mac_addr;
-eth_mac_addr_t host_src_mac_addr;
-
-/***********************************************************************
- * Handle input control data and produce output control data
- **********************************************************************/
-static size_t handle_control_packets(
- const void *data_in, size_t len_in, void *data_out
-){
- // point to the begining of outgoing payload (subpackets)
- uint8_t *reply_payload = data_out;
- size_t reply_payload_space = REPLY_PAYLOAD_MAX_LEN;
-
- // point to beginning of incoming payload (subpackets)
- uint8_t *payload = (uint8_t *)data_in;
- size_t payload_len = len_in;
-
- size_t subpktlen = 0;
- bool ok = false;
-
- while (payload_len >= sizeof(op_generic_t)){
- const op_generic_t *gp = (const op_generic_t *) payload;
- subpktlen = 0;
-
- // printf("\nopcode = %d\n", gp->opcode);
-
- switch(gp->opcode){
- case OP_EOP: // end of subpackets
- goto end_of_subpackets;
-
- case OP_ID:
- subpktlen = op_id_cmd(gp, reply_payload, reply_payload_space);
- break;
-
- case OP_CONFIG_TX_V2:
- subpktlen = config_tx_v2_cmd((op_config_tx_v2_t *) payload, reply_payload, reply_payload_space);
- break;
-
- case OP_CONFIG_RX_V2:
- subpktlen = config_rx_v2_cmd((op_config_rx_v2_t *) payload, reply_payload, reply_payload_space);
- break;
-
- case OP_START_RX_STREAMING:
- start_rx_streaming_cmd((op_start_rx_streaming_t *) payload);
- ok = true;
- goto generic_reply;
-
- case OP_STOP_RX:
- stop_rx_cmd();
- ok = true;
- goto generic_reply;
-
- case OP_BURN_MAC_ADDR:
- ok = ethernet_set_mac_addr(&((op_burn_mac_addr_t *)payload)->addr);
- goto generic_reply;
-
- case OP_CONFIG_CLOCK:
- ok = config_clock_cmd((op_config_clock_t *) payload);
- goto generic_reply;
-
- case OP_DBOARD_INFO:
- subpktlen = dboard_info_cmd(gp, reply_payload, reply_payload_space);
- break;
-
- case OP_SET_TIME:
- ok = set_time((op_set_time_t *) payload);
- goto generic_reply;
-
- case OP_PEEK:
- subpktlen = peek_cmd((op_peek_t *)payload, reply_payload, reply_payload_space);
- break;
-
- case OP_POKE:
- ok = poke_cmd((op_poke_t *)payload);
- goto generic_reply;
-
- case OP_SET_TX_LO_OFFSET:
- case OP_SET_RX_LO_OFFSET:
- ok = set_lo_offset_cmd((op_freq_t *)payload);
- goto generic_reply;
-
- case OP_RESET_DB:
- db_init();
- ok = true;
- goto generic_reply;
-
- case OP_GPIO_SET_DDR:
- ok = true;
- hal_gpio_set_ddr(((op_gpio_t *)payload)->bank,
- ((op_gpio_t *)payload)->value,
- ((op_gpio_t *)payload)->mask);
- goto generic_reply;
-
- case OP_GPIO_SET_SELS:
- ok = true;
- hal_gpio_set_sels(((op_gpio_set_sels_t *)payload)->bank,
- (char *)(&((op_gpio_set_sels_t *)payload)->sels));
- goto generic_reply;
-
- case OP_GPIO_READ:
- subpktlen = gpio_read_cmd((op_gpio_t *) payload, reply_payload, reply_payload_space);
- break;
-
- case OP_GPIO_WRITE:
- ok = true;
- hal_gpio_write(((op_gpio_t *)payload)->bank,
- ((op_gpio_t *)payload)->value,
- ((op_gpio_t *)payload)->mask);
- goto generic_reply;
-
- case OP_GPIO_STREAM:
- ok = true;
- dsp_rx_regs->gpio_stream_enable = (uint32_t)((op_gpio_t *)payload)->value;
- goto generic_reply;
-
- // Add new opcode handlers here
-
- generic_reply:
- subpktlen = generic_reply(gp, reply_payload, reply_payload_space, ok);
- break;
-
- default:
- printf("app_common_v2: unhandled opcode = %d\n", gp->opcode);
- break;
- }
-
- int t = (gp->len + 3) & ~3; // bump to a multiple of 4
- payload += t;
- payload_len -= t;
-
- subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4
- reply_payload += subpktlen;
- reply_payload_space -= subpktlen;
- }
-
- end_of_subpackets:
-
- // add the EOP marker
- subpktlen = add_eop(reply_payload, reply_payload_space);
- subpktlen = (subpktlen + 3) & ~3; // bump to a multiple of 4
- reply_payload += subpktlen;
- reply_payload_space -= subpktlen;
-
- // how big the payload?
- return REPLY_PAYLOAD_MAX_LEN - reply_payload_space;
-}
-
-static void handle_control_packet(
- const usrp2_ctrl_data_t *data_in, usrp2_ctrl_data_t *data_out
-){
-
-}
-
-static void
-send_reply(void *reply, size_t reply_len)
-{
- if (reply_len < 64) reply_len = 64;
-
- // wait for buffer to become idle
- hal_set_leds(0x4, 0x4);
- while((buffer_pool_status->status & BPS_IDLE(CPU_TX_BUF)) == 0)
- ;
- hal_set_leds(0x0, 0x4);
-
- // copy reply into CPU_TX_BUF
- memcpy_wa(buffer_ram(CPU_TX_BUF), reply, reply_len);
-
- // wait until nobody else is sending to the ethernet
- if (ac_could_be_sending_to_eth){
- hal_set_leds(0x8, 0x8);
- dbsm_wait_for_opening(ac_could_be_sending_to_eth);
- hal_set_leds(0x0, 0x8);
- }
-
- if (0){
- printf("sending_reply to port %d, len = %d\n", cpu_tx_buf_dest_port, (int)reply_len);
- print_buffer(buffer_ram(CPU_TX_BUF), reply_len/4);
- }
-
- // fire it off
- bp_send_from_buf(CPU_TX_BUF, cpu_tx_buf_dest_port, 1, 0, reply_len/4);
-
- // wait for it to complete (not long, it's a small pkt)
- while((buffer_pool_status->status & (BPS_DONE(CPU_TX_BUF) | BPS_ERROR(CPU_TX_BUF))) == 0)
- ;
-
- bp_clear_buf(CPU_TX_BUF);
-}
-
-static uint16_t
-chksum_buffer(void *buff_, size_t len)
-{
- uint16_t *buff = (uint16_t *) buff_;
-
- // sum the individual 16 bit words
- uint32_t sum = 0;
- for (size_t i = 0; i < len/sizeof(uint16_t); i++){
- sum += buff[i];
- }
-
- // take only 16 bits out of the 32 bit sum and add up the carries
- while (sum >> 16){
- sum = (sum & 0xffff) + (sum >> 16);
- }
-
- // one's complement the result
- return ~sum;
-}
-
-static struct in_addr
-create_ip_from_host(struct in_addr addr){
- //get an address that looks like the hosts
- uint8_t low_byte = addr.s_addr & 0xff;
- low_byte += 1;
- if (low_byte == 0xff) low_byte = 0;
- if (low_byte == 0x00) low_byte = 1;
- addr.s_addr = (addr.s_addr & ~0xff) | low_byte;
- return addr;
-}
-
-static void
-handle_control_chan_frame(u2_eth_ip_udp_t *pkt, size_t len)
-{
- // setup reply
- struct {
- uint32_t ctrl_word;
- u2_eth_ip_udp_t hdr;
- usrp2_ctrl_data_t data;
- } reply _AL4;
- memset(&reply, 0, sizeof(reply));
-
- // process the control data
- handle_control_packet(
- (usrp2_ctrl_data_t*)((uint8_t*)pkt + sizeof(u2_eth_ip_udp_t)),
- &reply.data
- );
- size_t total_len = sizeof(reply);
- reply.ctrl_word = total_len;
-
- // load the ethernet header
- reply.hdr.eth.dst = host_dst_mac_addr;
- reply.hdr.eth.src = host_src_mac_addr;
- reply.hdr.eth.ethertype = ETHERTYPE_IPV4;
-
- // load the ip header
- reply.hdr.ip.ip_hl = sizeof(u2_ipv4_hdr_t)/sizeof(uint32_t);
- reply.hdr.ip.ip_v = 4;
- reply.hdr.ip.ip_tos = 0;
- reply.hdr.ip.ip_len = sizeof(u2_ipv4_hdr_t) + sizeof(u2_udp_hdr_t) + sizeof(usrp2_ctrl_data_t);
- reply.hdr.ip.ip_id = 0;
- reply.hdr.ip.ip_off = IP_DF;
- reply.hdr.ip.ip_ttl = 255;
- reply.hdr.ip.ip_p = IP_PROTO_UDP;
- reply.hdr.ip.ip_sum = 0;
- reply.hdr.ip.ip_src = host_src_ip_addr;
- reply.hdr.ip.ip_dst = host_dst_ip_addr;
- reply.hdr.ip.ip_sum = chksum_buffer(&reply.hdr.ip, sizeof(u2_ipv4_hdr_t));
-
- // load the udp header
- reply.hdr.udp.src_port = pkt->udp.dst_port;
- reply.hdr.udp.dst_port = pkt->udp.src_port;
- reply.hdr.udp.length = sizeof(u2_udp_hdr_t) + sizeof(usrp2_ctrl_data_t);
- reply.hdr.udp.checksum = 0;
-
- //send the reply
- send_reply(&reply, total_len);
-}
-
-
-/*
- * Called when an ethernet packet is received.
- * Return true if we handled it here, otherwise
- * it'll be passed on to the DSP Tx pipe
- */
-bool
-eth_pkt_inspector(dbsm_t *sm, int bufno)
-{
- u2_eth_ip_udp_t *pkt = (u2_eth_ip_udp_t *) buffer_ram(bufno);
- size_t byte_len = (buffer_pool_status->last_line[bufno] - 3) * 4;
- printf("Got an eth packet of len %d\n", (int)byte_len);
-
- if (pkt->eth.ethertype != ETHERTYPE_IPV4)
- return true; // ignore, probably bogus PAUSE frame from MAC
-
- // inspect rcvd frame and figure out what do do.
- switch (pkt->udp.dst_port){
-
- case USRP2_UDP_CTRL_PORT:
- //record the ip and mac addrs (used when setting up data init)
- host_dst_ip_addr = pkt->ip.ip_src;
- host_src_ip_addr = create_ip_from_host(pkt->ip.ip_src);
- host_dst_mac_addr = pkt->eth.src;
- host_src_mac_addr = *ethernet_mac_addr();
- //handle_control_chan_frame(pkt, byte_len);
- return true;
-
- case USRP2_UDP_DATA_PORT:
- //record the udp data ports (used when setting up data init)
- host_dst_udp_port = pkt->udp.src_port;
- host_src_udp_port = pkt->udp.dst_port;
- return false; // pass it on to Tx DSP
-
- }
- return true; // ignore, whatever
-}
-
-/*
- * Called when eth phy state changes (w/ interrupts disabled)
- */
-void
-link_changed_callback(int speed)
-{
- link_is_up = speed != 0;
- hal_set_leds(link_is_up ? LED_RJ45 : 0x0, LED_RJ45);
- printf("\neth link changed: speed = %d\n", speed);
-}
-
-
-void
-print_tune_result(char *msg, bool tune_ok,
- u2_fxpt_freq_t target_freq, struct tune_result *r)
-{
-#if 0
- printf("db_tune %s %s\n", msg, tune_ok ? "true" : "false");
- putstr(" target_freq "); print_fxpt_freq(target_freq); newline();
- putstr(" baseband_freq "); print_fxpt_freq(r->baseband_freq); newline();
- putstr(" dxc_freq "); print_fxpt_freq(r->dxc_freq); newline();
- putstr(" residual_freq "); print_fxpt_freq(r->residual_freq); newline();
- printf(" inverted %s\n", r->inverted ? "true" : "false");
-#endif
-}
diff --git a/firmware/microblaze/apps/app_common_v2.h b/firmware/microblaze/apps/app_common_v2.h
deleted file mode 100644
index 8be547fae..000000000
--- a/firmware/microblaze/apps/app_common_v2.h
+++ /dev/null
@@ -1,83 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-/* -*- c++ -*- */
-/*
- * Copyright 2007,2008 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef INCLUDED_APP_COMMON_H
-#define INCLUDED_APP_COMMON_H
-
-#include <stdbool.h>
-#include "usrp2_eth_packet.h"
-#include "dbsm.h"
-#include "memory_map.h"
-#include "hal_io.h"
-#include <stddef.h>
-#include <db.h>
-
-#define CPU_TX_BUF 7 // cpu -> eth
-
-#define _AL4 __attribute__((aligned (4)))
-
-extern volatile bool link_is_up; // eth handler sets this
-
-// If there's a dbsm that sends to the ethernet, put it's address here
-extern dbsm_t *ac_could_be_sending_to_eth;
-
-extern int cpu_tx_buf_dest_port;
-
-/*
- * Called when an ethernet packet is received.
- * Return true if we handled it here, otherwise
- * it'll be passed on to the DSP Tx pipe
- */
-bool eth_pkt_inspector(dbsm_t *sm, int bufno);
-
-void link_changed_callback(int speed);
-
-void
-print_tune_result(char *msg, bool tune_ok,
- u2_fxpt_freq_t target_freq, struct tune_result *r);
-
-
-void start_rx_streaming_cmd(op_start_rx_streaming_t *p);
-void stop_rx_cmd(void);
-void restart_streaming(void);
-bool is_streaming(void);
-
-//#include "usrp2_ipv4_packet.h"
-//#include "usrp2_udp_packet.h"
-
-/*!
- * \brief consolidated packet: padding + ethernet header + ip header + udp header
- */
-/*typedef struct {
- uint16_t padding;
- u2_eth_hdr_t eth;
- u2_ipv4_hdr_t ip;
- u2_udp_hdr_t udp;
-} u2_eth_ip_udp_t;
-
-extern uint16_t host_dst_udp_port;
-extern uint16_t host_src_udp_port;
-extern struct in_addr host_dst_ip_addr;
-extern struct in_addr host_src_ip_addr;
-extern eth_mac_addr_t host_dst_mac_addr;
-extern eth_mac_addr_t host_src_mac_addr;
-*/
-#endif /* INCLUDED_APP_COMMON_H */
diff --git a/firmware/microblaze/apps/txrx.c b/firmware/microblaze/apps/txrx.c
index 18f34ad02..23a88c246 100644
--- a/firmware/microblaze/apps/txrx.c
+++ b/firmware/microblaze/apps/txrx.c
@@ -33,11 +33,7 @@
#include <stdbool.h>
#include "ethernet.h"
#include "nonstdio.h"
-#include "usrp2_eth_packet.h"
-//#include "usrp2_ipv4_packet.h"
-#include "usrp2_udp_packet.h"
#include "dbsm.h"
-//#include "app_common_v2.h"
#include <net/padded_eth_hdr.h>
#include <net_common.h>
#include "memcpy_wa.h"
@@ -249,7 +245,7 @@ link_changed_callback(int speed)
}
void
-start_rx_streaming_cmd(op_start_rx_streaming_t *p)
+start_rx_streaming_cmd(void *p)
{
/*
* Construct ethernet header and preload into two buffers
@@ -259,8 +255,8 @@ start_rx_streaming_cmd(op_start_rx_streaming_t *p)
} mem _AL4;
memset(&mem, 0, sizeof(mem));
- p->items_per_frame = (1500)/sizeof(uint32_t) - (DSP_TX_FIRST_LINE + VRT_HEADER_WORDS + VRT_TRAILER_WORDS); //FIXME
- mem.ctrl_word = (VRT_HEADER_WORDS+p->items_per_frame+VRT_TRAILER_WORDS)*sizeof(uint32_t) | 1 << 16;
+ //p->items_per_frame = (1500)/sizeof(uint32_t) - (DSP_TX_FIRST_LINE + VRT_HEADER_WORDS + VRT_TRAILER_WORDS); //FIXME
+ //mem.ctrl_word = (VRT_HEADER_WORDS+p->items_per_frame+VRT_TRAILER_WORDS)*sizeof(uint32_t) | 1 << 16;
memcpy_wa(buffer_ram(DSP_RX_BUF_0), &mem, sizeof(mem));
memcpy_wa(buffer_ram(DSP_RX_BUF_1), &mem, sizeof(mem));
@@ -299,9 +295,9 @@ start_rx_streaming_cmd(op_start_rx_streaming_t *p)
if (FW_SETS_SEQNO)
fw_seqno = 0;
- streaming_items_per_frame = p->items_per_frame;
- time_secs = p->time_secs;
- time_ticks = p->time_ticks;
+ //streaming_items_per_frame = p->items_per_frame;
+ //time_secs = p->time_secs;
+ //time_ticks = p->time_ticks;
restart_streaming();
}
diff --git a/firmware/microblaze/configure.ac b/firmware/microblaze/configure.ac
index 4c96d607e..cbb9e1a93 100644
--- a/firmware/microblaze/configure.ac
+++ b/firmware/microblaze/configure.ac
@@ -41,6 +41,7 @@ AC_CONFIG_FILES([ \
Makefile \
apps/Makefile \
include/Makefile \
+ include/net/Makefile \
lib/Makefile \
])
AC_OUTPUT
diff --git a/firmware/microblaze/include/Makefile.am b/firmware/microblaze/include/Makefile.am
index b7f5a8148..6afbbcd12 100644
--- a/firmware/microblaze/include/Makefile.am
+++ b/firmware/microblaze/include/Makefile.am
@@ -19,15 +19,12 @@
include $(top_srcdir)/Makefile.common
+SUBDIRS = net
+
noinst_HEADERS = \
- usrp2_cdefs.h \
- usrp2_eth_packet.h \
- usrp2_ipv4_packet.h \
- usrp2_udp_packet.h \
usrp2_fpga_regs.h \
usrp2_i2c_addr.h \
usrp2_clock_bits.h \
usrp2_types.h \
- network.h \
vrt/bits.h \
vrt/types.h
diff --git a/firmware/microblaze/include/network.h b/firmware/microblaze/include/network.h
deleted file mode 100644
index 1bc309ee6..000000000
--- a/firmware/microblaze/include/network.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2009 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*!
- * Various networking related structures and defines
- */
-
-#if 0
-#ifndef INCLUDED_NETWORK_H
-#define INCLUDED_NETWORK_H
-
-#include <stdint.h>
-#include <stdbool.h>
-
-// Ethernet MAC address
-
-typedef struct {
- uint8_t addr[6];
-} eth_mac_addr_t;
-
-
-// IPv4 address
-
-#ifndef __cplusplus
-
-struct in_addr {
- uint32_t s_addr;
-};
-
-static inline struct in_addr
-make_in_addr(uint32_t addr)
-{
- struct in_addr r;
- r.s_addr = addr;
- return r;
-}
-
-static inline bool
-in_addr_eq(const struct in_addr a, const struct in_addr b)
-{
- return a.s_addr == b.s_addr;
-}
-
-#define MK_IP_ADDR(a, b, c, d) \
- (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
-
-
-// IPv4 AF_INET sockets:
-
-struct sockaddr_in {
- short sin_family; // e.g. AF_INET, AF_INET6
- unsigned short sin_port; // e.g. htons(3490)
- struct in_addr sin_addr;
-};
-
-static inline struct sockaddr_in
-make_sockaddr_in(struct in_addr addr, int port)
-{
- struct sockaddr_in r;
- r.sin_family = 0; // not used
- r.sin_port = port;
- r.sin_addr = addr;
- return r;
-}
-
-#endif
-
-#endif /* INCLUDED_NETWORK_H */
-
-#endif
diff --git a/firmware/microblaze/include/usrp2_cdefs.h b/firmware/microblaze/include/usrp2_cdefs.h
deleted file mode 100644
index 71395cda8..000000000
--- a/firmware/microblaze/include/usrp2_cdefs.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- c++ -*- */
-/*
- * Copyright 2007 Free Software Foundation, Inc.
- *
- * This file is part of GNU Radio
- *
- * GNU Radio is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3, or (at your option)
- * any later version.
- *
- * GNU Radio is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef INCLUDED_USRP2_CDEFS_H
-#define INCLUDED_USRP2_CDEFS_H
-
-/* C++ needs to know that types and declarations are C, not C++. */
-#ifdef __cplusplus
-# define __U2_BEGIN_DECLS extern "C" {
-# define __U2_END_DECLS }
-#else
-# define __U2_BEGIN_DECLS
-# define __U2_END_DECLS
-#endif
-
-#endif /* INCLUDED_USRP2_CDEFS_H */
diff --git a/firmware/microblaze/include/usrp2_eth_packet.h b/firmware/microblaze/include/usrp2_eth_packet.h
deleted file mode 100644
index 7d5b84f00..000000000
--- a/firmware/microblaze/include/usrp2_eth_packet.h
+++ /dev/null
@@ -1,405 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-/*
- * Copyright 2007,2008,2009 Free Software Foundation, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef INCLUDED_USRP2_ETH_PACKET_H
-#define INCLUDED_USRP2_ETH_PACKET_H
-
-#include "usrp2_cdefs.h"
-#include "network.h"
-
-__U2_BEGIN_DECLS
-
-#define U2_DATA_ETHERTYPE 0xBEEF // used in our data frames
-#define U2_CTRL_ETHERTYPE 0xBEF0 // used in our control frames
-#define MAC_CTRL_ETHERTYPE 0x8808 // used in PAUSE frames
-#define ETHERTYPE_IPV4 0x0800 // used in ip packets
-
-/*
- * All these data structures are BIG-ENDIAN on the wire
- */
-
-// FIXME gcc specific. Really ought to come from compiler.h
-#define _AL4 __attribute__((aligned (4)))
-
-/*!
- * \brief The classic 14-byte ethernet header
- */
-typedef struct {
- eth_mac_addr_t dst;
- eth_mac_addr_t src;
- uint16_t ethertype;
-} __attribute__((packed)) u2_eth_hdr_t;
-
-/*!
- * \brief consolidated packet: ethernet header
- */
-typedef struct {
- u2_eth_hdr_t ehdr;
-} u2_eth_packet_t;
-
-/*!
- * \brief consolidated packet: padding + ethernet header
- */
-typedef struct {
- uint16_t padding;
- u2_eth_hdr_t ehdr;
-} u2_eth_packet_pad_before_t;
-
-/*
- * Opcodes for control channel
- *
- * Reply opcodes are the same as the request opcode with the OP_REPLY_BIT set (0x80).
- */
-#define OP_REPLY_BIT 0x80
-
-#define OP_EOP 0 // marks last subpacket in packet
-
-#define OP_ID 1
-#define OP_ID_REPLY (OP_ID | OP_REPLY_BIT)
-#define OP_BURN_MAC_ADDR 2
-#define OP_BURN_MAC_ADDR_REPLY (OP_BURN_MAC_ADDR | OP_REPLY_BIT)
-#define OP_CONFIG_RX_V2 4
-#define OP_CONFIG_RX_REPLY_V2 (OP_CONFIG_RX_V2 | OP_REPLY_BIT)
-#define OP_CONFIG_TX_V2 5
-#define OP_CONFIG_TX_REPLY_V2 (OP_CONFIG_TX_V2 | OP_REPLY_BIT)
-#define OP_START_RX_STREAMING 6
-#define OP_START_RX_STREAMING_REPLY (OP_START_RX_STREAMING | OP_REPLY_BIT)
-#define OP_STOP_RX 7
-#define OP_STOP_RX_REPLY (OP_STOP_RX | OP_REPLY_BIT)
-#define OP_CONFIG_CLOCK 8
-#define OP_CONFIG_CLOCK_REPLY (OP_CONFIG_CLOCK | OP_REPLY_BIT)
-#define OP_DBOARD_INFO 9
-#define OP_DBOARD_INFO_REPLY (OP_DBOARD_INFO | OP_REPLY_BIT)
-#define OP_PEEK 11
-#define OP_PEEK_REPLY (OP_PEEK | OP_REPLY_BIT)
-#define OP_POKE 12
-#define OP_POKE_REPLY (OP_POKE | OP_REPLY_BIT)
-#define OP_SET_TX_LO_OFFSET 13
-#define OP_SET_TX_LO_OFFSET_REPLY (OP_SET_TX_LO_OFFSET | OP_REPLY_BIT)
-#define OP_SET_RX_LO_OFFSET 14
-#define OP_SET_RX_LO_OFFSET_REPLY (OP_SET_RX_LO_OFFSET | OP_REPLY_BIT)
-#define OP_RESET_DB 15
-#define OP_RESET_DB_REPLY (OP_RESET_DB | OP_REPLY_BIT)
-#define OP_GPIO_SET_DDR 17
-#define OP_GPIO_SET_DDR_REPLY (OP_GPIO_SET_DDR | OP_REPLY_BIT)
-#define OP_GPIO_SET_SELS 18
-#define OP_GPIO_SET_SELS_REPLY (OP_GPIO_SET_SELS | OP_REPLY_BIT)
-#define OP_GPIO_READ 19
-#define OP_GPIO_READ_REPLY (OP_GPIO_READ | OP_REPLY_BIT)
-#define OP_GPIO_WRITE 20
-#define OP_GPIO_WRITE_REPLY (OP_GPIO_WRITE | OP_REPLY_BIT)
-#define OP_GPIO_STREAM 21
-#define OP_GPIO_STREAM_REPLY (OP_GPIO_STREAM | OP_REPLY_BIT)
-#define OP_SET_TIME 22
-#define OP_SET_TIME_REPLY (OP_SET_TIME | OP_REPLY_BIT)
-
-/*
- * All subpackets are a multiple of 4 bytes long.
- * All subpackets start with an 8-bit opcode, an 8-bit len and an 8-bit rid.
- */
-#define MAX_SUBPKT_LEN 252
-
-/*!
- * \brief Generic request and reply packet
- *
- * Used by:
- * OP_EOP, OP_BURN_MAC_ADDR_REPLY, OP_START_RX_STREAMING_REPLY,
- * OP_STOP_RX_REPLY, OP_DBOARD_INFO, OP_SYNC_TO_PPS
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t ok; // bool
-} _AL4 op_generic_t;
-
-/*!
- * \brief Set the ticks and secs on a usrp2
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t type;
- uint32_t time_secs;
- uint32_t time_ticks;
-} _AL4 op_set_time_t;
-
-typedef enum {
- OP_SET_TIME_TYPE_NOW,
- OP_SET_TIME_TYPE_PPS
-} op_set_time_type_t;
-
-/*!
- * \brief Reply info from a USRP2
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- eth_mac_addr_t addr;
- uint16_t hw_rev;
- uint8_t fpga_md5sum[16];
- uint8_t sw_md5sum[16];
-} _AL4 op_id_reply_t;
-
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- uint32_t items_per_frame; // # of 32-bit data items; MTU=1500: [9,371]
- uint32_t time_secs;
- uint32_t time_ticks;
-} _AL4 op_start_rx_streaming_t;
-
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- eth_mac_addr_t addr;
-} _AL4 op_burn_mac_addr_t;
-
-/*!
- * \brief Configure receiver
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- // bitmask indicating which of the following fields are valid
- uint16_t valid;
- uint16_t gain; // fxpt_db (Q9.7)
- uint32_t freq_hi; // high 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t decim; // desired decimation factor (NOT -1)
- uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
-} _AL4 op_config_rx_v2_t;
-
-// bitmask for "valid" field. If the bit is set, there's
-// meaningful data in the corresonding field.
-
-#define CFGV_GAIN 0x0001 // gain field is valid
-#define CFGV_FREQ 0x0002 // target_freq field is valid
-#define CFGV_INTERP_DECIM 0x0004 // interp or decim is valid
-#define CFGV_SCALE_IQ 0x0008 // scale_iq is valid
-
-/*!
- * \brief Reply to receiver configuration
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
-
- uint16_t ok; // config was successful (bool)
- uint16_t inverted; // spectrum is inverted (bool)
-
- // RF frequency that corresponds to DC in the IF (fxpt_freq)
- uint32_t baseband_freq_hi;
- uint32_t baseband_freq_lo;
- // DDC frequency (fxpt_freq)
- uint32_t ddc_freq_hi;
- uint32_t ddc_freq_lo;
- // residual frequency (fxpt_freq)
- uint32_t residual_freq_hi;
- uint32_t residual_freq_lo;
-
-} _AL4 op_config_rx_reply_v2_t;
-
-/*!
- * \brief Configure transmitter
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
-
- // bitmask indicating which of the following fields are valid
- uint16_t valid;
- uint16_t gain; // fxpt_db (Q9.7)
- uint32_t freq_hi; // high 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_lo; // low 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t interp; // desired interpolation factor (NOT -1)
- uint32_t scale_iq; // (scale_i << 16) | scale_q [16.0 format]
-} _AL4 op_config_tx_v2_t;
-
-/*!
- * \brief Reply to configure transmitter
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
-
- uint16_t ok; // config was successful (bool)
- uint16_t inverted; // spectrum is inverted (bool)
-
- // RF frequency that corresponds to DC in the IF (fxpt_freq)
- uint32_t baseband_freq_hi;
- uint32_t baseband_freq_lo;
- // DUC frequency (fxpt_freq)
- uint32_t duc_freq_hi;
- uint32_t duc_freq_lo;
- // residual frequency (fxpt_freq)
- uint32_t residual_freq_hi;
- uint32_t residual_freq_lo;
-
-} _AL4 op_config_tx_reply_v2_t;
-
-/*!
- * \brief Configure clocking, etc (uses generic reply)
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t flags;
-} op_config_clock_t;
-
-/*!
- * \brief High-level information about daughterboards
- */
-typedef struct {
- int32_t dbid; //< d'board ID (-1 none, -2 invalid eeprom)
- uint32_t freq_min_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_min_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_max_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_max_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
- uint16_t gain_min; //< min gain that can be set. fxpt_db (Q9.7)
- uint16_t gain_max; //< max gain that can be set. fxpt_db (Q9.7)
- uint16_t gain_step_size; //< fxpt_db (Q9.7)
-} u2_db_info_t;
-
-
-/*!
- * \brief Reply to d'board info request
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t ok; // request was successful (bool)
-
- u2_db_info_t tx_db_info;
- u2_db_info_t rx_db_info;
-} _AL4 op_dboard_info_reply_t;
-
-/*!
- * \brief Read from Wishbone memory
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- uint32_t addr;
- uint32_t bytes;
-} _AL4 op_peek_t;
-
-/*!
- * \brief Write to Wishbone memory
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- uint32_t addr;
- // Words follow here
-} _AL4 op_poke_t;
-
-/*
- * Common structure for commands with a single frequency param
- * (e.g., set_*_lo_offset, set_*_bw)
- */
-typedef struct {
- uint8_t opcode;
- uint8_t len;
- uint8_t rid;
- uint8_t mbz;
- uint32_t freq_hi; //< high 32-bits of 64-bit fxpt_freq (Q44.20)
- uint32_t freq_lo; //< low 32-bits of 64-bit fxpt_freq (Q44.20)
-} _AL4 op_freq_t;
-
-/*
- * Structures for commands in GPIO system
- */
-typedef struct {
- uint8_t opcode; // OP_GPIO_SET_DDR, OP_GPIO_WRITE, OP_GPIO_STREAM
- uint8_t len;
- uint8_t rid;
- uint8_t bank;
- uint16_t value;
- uint16_t mask;
-} _AL4 op_gpio_t;
-
-typedef struct {
- uint8_t opcode; // OP_GPIO_SET_SELS
- uint8_t len;
- uint8_t rid;
- uint8_t bank;
- uint8_t sels[16];
-} _AL4 op_gpio_set_sels_t;
-
-typedef struct {
- uint8_t opcode; // OP_GPIO_READ_REPLY
- uint8_t len;
- uint8_t rid;
- uint8_t ok;
- uint16_t mbz;
- uint16_t value;
-} _AL4 op_gpio_read_reply_t;
-
-/*
- * ================================================================
- * union of all of subpacket types
- * ================================================================
- */
-typedef union {
-
- op_generic_t op_generic;
- op_id_reply_t op_id_reply;
- op_start_rx_streaming_t op_start_rx_streaming;
- op_burn_mac_addr_t op_burn_mac_addr;
- op_config_rx_v2_t op_config_rx_v2;
- op_config_rx_reply_v2_t op_config_rx_reply_v2;
- op_config_tx_v2_t op_config_tx_v2;
- op_config_tx_reply_v2_t op_config_tx_reply_v2;
- op_config_clock_t op_config_clock;
- op_peek_t op_peek;
- op_poke_t op_poke;
- op_freq_t op_freq;
- op_gpio_t op_gpio;
- op_gpio_set_sels_t op_gpio_set_sels;
- op_gpio_read_reply_t op_gpio_read_reply;
- op_set_time_t op_set_time;
-
-} u2_subpkt_t;
-
-
-__U2_END_DECLS
-
-#endif /* INCLUDED_USRP2_ETH_PACKET_H */
diff --git a/firmware/microblaze/include/usrp2_i2c_addr.h b/firmware/microblaze/include/usrp2_i2c_addr.h
index f25996903..4111cdd55 100644
--- a/firmware/microblaze/include/usrp2_i2c_addr.h
+++ b/firmware/microblaze/include/usrp2_i2c_addr.h
@@ -19,10 +19,6 @@
#ifndef INCLUDED_USRP2_I2C_ADDR_H
#define INCLUDED_USRP2_I2C_ADDR_H
-#include "usrp2_cdefs.h"
-
-__U2_BEGIN_DECLS
-
// I2C addresses
#define I2C_DEV_EEPROM 0x50 // 24LC02[45]: 7-bits 1010xxx
@@ -76,7 +72,6 @@ __U2_BEGIN_DECLS
#define DB_EEPROM_CUSTOM_BASE DB_EEPROM_CLEN // first avail offset for
// daughterboard specific use
-__U2_END_DECLS
#endif /* INCLUDED_USRP2_I2C_ADDR_H */
diff --git a/firmware/microblaze/include/usrp2_ipv4_packet.h b/firmware/microblaze/include/usrp2_ipv4_packet.h
deleted file mode 100644
index 2822dee89..000000000
--- a/firmware/microblaze/include/usrp2_ipv4_packet.h
+++ /dev/null
@@ -1,52 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_USRP2_IPV4_PACKET_H
-#define INCLUDED_USRP2_IPV4_PACKET_H
-
-#include "usrp2_cdefs.h"
-#include "network.h"
-
-__U2_BEGIN_DECLS
-
-/*!
- * \brief The classic ipv4 header
- */
-typedef struct {
- unsigned int ip_v:4; /* both fields are 4 bits */
- unsigned int ip_hl:4;
- uint8_t ip_tos;
- uint16_t ip_len;
- uint16_t ip_id;
- uint16_t ip_off;
- uint8_t ip_ttl;
- uint8_t ip_p;
- uint16_t ip_sum;
- struct in_addr ip_src;
- struct in_addr ip_dst;
-} __attribute__((packed)) u2_ipv4_hdr_t;
-
-#define IP_RF 0x8000 /* reserved fragment flag */
-#define IP_DF 0x4000 /* dont fragment flag */
-#define IP_MF 0x2000 /* more fragments flag */
-#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */
-
-#define IP_PROTO_UDP 17
-
-__U2_END_DECLS
-
-#endif /* INCLUDED_USRP2_IPV4_PACKET_H */
diff --git a/firmware/microblaze/include/usrp2_types.h b/firmware/microblaze/include/usrp2_types.h
index dd2bcf1ed..fe45936f0 100644
--- a/firmware/microblaze/include/usrp2_types.h
+++ b/firmware/microblaze/include/usrp2_types.h
@@ -18,11 +18,8 @@
#ifndef INCLUDED_USRP2_TYPES_H
#define INCLUDED_USRP2_TYPES_H
-#include <usrp2_cdefs.h>
#include <stdint.h>
-__U2_BEGIN_DECLS
-
/*!
* \brief Fixed point representation of a frequency in Hertz (VITA-49 compatible)
*
@@ -105,8 +102,4 @@ u2_fxpt_gain_round_to_int(u2_fxpt_gain_t fx)
return (int)((fx+(1<<(U2_FPG_RP-1)))>>U2_FPG_RP);
}
-
-__U2_END_DECLS
-
-
#endif /* INCLUDED_USRP2_TYPES_H */
diff --git a/firmware/microblaze/include/usrp2_udp_packet.h b/firmware/microblaze/include/usrp2_udp_packet.h
deleted file mode 100644
index 4739d4c49..000000000
--- a/firmware/microblaze/include/usrp2_udp_packet.h
+++ /dev/null
@@ -1,37 +0,0 @@
-//
-// Copyright 2010 Ettus Research LLC
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <http://www.gnu.org/licenses/>.
-//
-
-#ifndef INCLUDED_USRP2_UDP_PACKET_H
-#define INCLUDED_USRP2_UDP_PACKET_H
-
-#include "usrp2_cdefs.h"
-
-__U2_BEGIN_DECLS
-
-/*!
- * \brief The classic udp header
- */
-typedef struct {
- uint16_t src_port;
- uint16_t dst_port;
- uint16_t length;
- uint16_t checksum;
-} __attribute__((packed)) u2_udp_hdr_t;
-
-__U2_END_DECLS
-
-#endif /* INCLUDED_USRP2_UDP_PACKET_H */