diff options
| author | Josh Blum <josh@joshknows.com> | 2010-08-04 16:33:49 -0700 | 
|---|---|---|
| committer | Josh Blum <josh@joshknows.com> | 2010-08-04 16:33:49 -0700 | 
| commit | 8e1d51d628afb18dc9a36f268dda1e9f48a1c2ad (patch) | |
| tree | 9aea9b125848fa7fc3ea45c96bff27dde2c1e8fb | |
| parent | 702d5af8ca0bab8ef295c817017df5952f6aea51 (diff) | |
| parent | 70abdef8f6c6d24a99caf8d3668f32094b159903 (diff) | |
| download | uhd-8e1d51d628afb18dc9a36f268dda1e9f48a1c2ad.tar.gz uhd-8e1d51d628afb18dc9a36f268dda1e9f48a1c2ad.tar.bz2 uhd-8e1d51d628afb18dc9a36f268dda1e9f48a1c2ad.zip | |
Merge branch 'master' into codec_gains
Conflicts:
	host/lib/CMakeLists.txt
	host/lib/utils/gain_handler.cpp
| -rw-r--r-- | firmware/microblaze/.gitignore | 2 | ||||
| -rw-r--r-- | firmware/microblaze/Makefile.am | 5 | ||||
| -rw-r--r-- | firmware/microblaze/Makefile.common | 37 | ||||
| -rw-r--r-- | firmware/microblaze/apps/burnrev40.c | 162 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/Makefile.am (renamed from firmware/microblaze/apps/Makefile.am) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/app_passthru_v2.c (renamed from firmware/microblaze/apps/app_passthru_v2.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/app_passthru_v2.h (renamed from firmware/microblaze/apps/app_passthru_v2.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/blink_leds.c (renamed from firmware/microblaze/apps/blink_leds.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/blink_leds2.c (renamed from firmware/microblaze/apps/blink_leds2.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/buf_ram_test.c (renamed from firmware/microblaze/apps/buf_ram_test.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/burn_dbsrx_eeprom.c (renamed from firmware/microblaze/apps/burn_dbsrx_eeprom.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/burnrev30.c (renamed from firmware/microblaze/apps/burnrev30.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/burnrev31.c (renamed from firmware/microblaze/apps/burnrev31.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/can_i_sub.c (renamed from firmware/microblaze/apps/can_i_sub.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/double_buffer_fragment.c (renamed from firmware/microblaze/apps/double_buffer_fragment.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/echo.c (renamed from firmware/microblaze/apps/echo.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/eth_serdes.c (renamed from firmware/microblaze/apps/eth_serdes.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/factory_test.c (renamed from firmware/microblaze/apps/factory_test.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/gen_eth_packets.c (renamed from firmware/microblaze/apps/gen_eth_packets.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/gen_pause_frames.c (renamed from firmware/microblaze/apps/gen_pause_frames.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/hello.c (renamed from firmware/microblaze/apps/hello.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/ibs_rx_test.c (renamed from firmware/microblaze/apps/ibs_rx_test.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/ibs_tx_test.c (renamed from firmware/microblaze/apps/ibs_tx_test.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/mimo_app_common_v2.c (renamed from firmware/microblaze/apps/mimo_app_common_v2.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/mimo_app_common_v2.h (renamed from firmware/microblaze/apps/mimo_app_common_v2.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/mimo_tx.c (renamed from firmware/microblaze/apps/mimo_tx.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/mimo_tx_slave.c (renamed from firmware/microblaze/apps/mimo_tx_slave.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/rcv_eth_packets.c (renamed from firmware/microblaze/apps/rcv_eth_packets.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/read_dbids.c (renamed from firmware/microblaze/apps/read_dbids.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/sd_bounce.c (renamed from firmware/microblaze/apps/sd_bounce.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/sd_gentest.c (renamed from firmware/microblaze/apps/sd_gentest.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/serdes_to_dsp.c (renamed from firmware/microblaze/apps/serdes_to_dsp.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/serdes_txrx.c (renamed from firmware/microblaze/apps/serdes_txrx.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/set_hw_rev.c (renamed from firmware/microblaze/apps/set_hw_rev.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test1.c (renamed from firmware/microblaze/apps/test1.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_db_spi.c (renamed from firmware/microblaze/apps/test_db_spi.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_i2c.c (renamed from firmware/microblaze/apps/test_i2c.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_lsadc.c (renamed from firmware/microblaze/apps/test_lsadc.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_lsdac.c (renamed from firmware/microblaze/apps/test_lsdac.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_phy_comm.c (renamed from firmware/microblaze/apps/test_phy_comm.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_ram.c (renamed from firmware/microblaze/apps/test_ram.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/test_sd.c (renamed from firmware/microblaze/apps/test_sd.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/timer_test.c (renamed from firmware/microblaze/apps/timer_test.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/cruft/tx_standalone.c (renamed from firmware/microblaze/apps/tx_standalone.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/apps/txrx_uhd.c | 5 | ||||
| -rwxr-xr-x | firmware/microblaze/bootstrap | 1 | ||||
| l--------- | firmware/microblaze/config.guess | 1 | ||||
| l--------- | firmware/microblaze/config.sub | 1 | ||||
| -rw-r--r-- | firmware/microblaze/configure.ac | 6 | ||||
| -rw-r--r-- | firmware/microblaze/include/.gitignore | 2 | ||||
| -rw-r--r-- | firmware/microblaze/include/usrp2_fpga_regs.h | 80 | ||||
| -rw-r--r-- | firmware/microblaze/include/usrp2_i2c_addr.h | 78 | ||||
| -rw-r--r-- | firmware/microblaze/include/usrp2_types.h | 105 | ||||
| -rw-r--r-- | firmware/microblaze/include/vrt/bits.h | 92 | ||||
| -rw-r--r-- | firmware/microblaze/include/vrt/types.h | 138 | ||||
| -rw-r--r-- | firmware/microblaze/lib/.gitignore | 40 | ||||
| -rw-r--r-- | firmware/microblaze/lib/Makefile.am | 87 | ||||
| -rw-r--r-- | firmware/microblaze/lib/Makefile.inc | 47 | ||||
| -rw-r--r-- | firmware/microblaze/lib/clock_bits.h (renamed from firmware/microblaze/include/usrp2_clock_bits.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/clocks.c | 81 | ||||
| -rw-r--r-- | firmware/microblaze/lib/clocks.h | 8 | ||||
| -rw-r--r-- | firmware/microblaze/lib/compiler.h (renamed from firmware/microblaze/include/compiler.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/eth_mac.c | 10 | ||||
| -rw-r--r-- | firmware/microblaze/lib/hal_io.c | 10 | ||||
| -rw-r--r-- | firmware/microblaze/lib/hal_io.h | 1 | ||||
| -rw-r--r-- | firmware/microblaze/lib/hal_uart.c | 13 | ||||
| -rw-r--r-- | firmware/microblaze/lib/hal_uart.h | 10 | ||||
| -rw-r--r-- | firmware/microblaze/lib/net/.gitignore (renamed from firmware/microblaze/include/net/.gitignore) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/net/eth_mac_addr.h (renamed from firmware/microblaze/include/net/eth_mac_addr.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/net/padded_eth_hdr.h (renamed from firmware/microblaze/include/net/padded_eth_hdr.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/net/socket_address.h (renamed from firmware/microblaze/include/net/socket_address.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/lib/nonstdio.c | 43 | ||||
| -rw-r--r-- | firmware/microblaze/lib/nonstdio.h | 10 | ||||
| -rw-r--r-- | firmware/microblaze/lib/pic.c | 2 | ||||
| -rw-r--r-- | firmware/microblaze/lib/spi.c | 2 | ||||
| -rw-r--r-- | firmware/microblaze/lib/spi.h | 18 | ||||
| -rw-r--r-- | firmware/microblaze/lib/u2_init.c | 11 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/.gitignore (renamed from firmware/microblaze/apps/.gitignore) | 9 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/Makefile.am (renamed from firmware/microblaze/include/net/Makefile.am) | 28 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/eth_phy.h (renamed from firmware/microblaze/lib/eth_phy.h) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/ethernet.c (renamed from firmware/microblaze/lib/ethernet.c) | 13 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/memory_map.h (renamed from firmware/microblaze/lib/memory_map.h) | 5 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/sd.c (renamed from firmware/microblaze/lib/sd.c) | 0 | ||||
| -rw-r--r-- | firmware/microblaze/usrp2/sd.h (renamed from firmware/microblaze/lib/sd.h) | 0 | ||||
| -rw-r--r-- | host/docs/dboards.rst | 2 | ||||
| -rw-r--r-- | host/docs/usrp2.rst | 4 | ||||
| -rw-r--r-- | host/examples/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | host/examples/tx_continuous_samples.cpp | 110 | ||||
| -rw-r--r-- | host/include/uhd/transport/alignment_buffer.ipp | 13 | ||||
| -rw-r--r-- | host/include/uhd/usrp/dboard_iface.hpp | 7 | ||||
| -rw-r--r-- | host/lib/CMakeLists.txt | 7 | ||||
| -rw-r--r-- | host/lib/usrp/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | host/lib/usrp/dboard/db_rfx.cpp | 33 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/dboard_iface.cpp | 2 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/dboard_impl.cpp | 8 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/fw_common.h | 16 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/io_impl.cpp | 10 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/mboard_impl.cpp | 18 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 16 | ||||
| -rw-r--r-- | host/lib/usrp/usrp2/usrp2_regs.hpp | 5 | ||||
| -rw-r--r-- | host/lib/utils/CMakeLists.txt (renamed from firmware/microblaze/include/Makefile.am) | 20 | ||||
| -rw-r--r-- | host/lib/utils/assert.cpp | 24 | ||||
| -rw-r--r-- | host/lib/utils/gain_group.cpp (renamed from host/lib/gain_group.cpp) | 0 | ||||
| -rw-r--r-- | host/lib/utils/load_modules.cpp (renamed from host/lib/load_modules.cpp) | 0 | ||||
| -rw-r--r-- | host/lib/utils/props.cpp (renamed from host/lib/utils.cpp) | 24 | ||||
| -rw-r--r-- | host/lib/utils/thread_priority.cpp (renamed from host/lib/thread_priority.cpp) | 0 | 
106 files changed, 527 insertions, 963 deletions
| diff --git a/firmware/microblaze/.gitignore b/firmware/microblaze/.gitignore index 068f01838..e867fe87c 100644 --- a/firmware/microblaze/.gitignore +++ b/firmware/microblaze/.gitignore @@ -5,6 +5,8 @@  /*.log  /*.rom  /.deps +/*.guess +/*.sub  /Makefile  /Makefile.in  /aclocal.m4 diff --git a/firmware/microblaze/Makefile.am b/firmware/microblaze/Makefile.am index 676c4fe42..6316b31a2 100644 --- a/firmware/microblaze/Makefile.am +++ b/firmware/microblaze/Makefile.am @@ -22,6 +22,5 @@ include $(top_srcdir)/Makefile.common  EXTRA_DIST = \  	u2_flash_tool -SUBDIRS = include lib apps - - +SUBDIRS = \ +	usrp2 diff --git a/firmware/microblaze/Makefile.common b/firmware/microblaze/Makefile.common index 3d0f540d8..ceb6a553a 100644 --- a/firmware/microblaze/Makefile.common +++ b/firmware/microblaze/Makefile.common @@ -17,6 +17,8 @@  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  # +include $(top_srcdir)/lib/Makefile.inc +  ########################################################################  # lwIP header include dirs  ######################################################################## @@ -29,21 +31,12 @@ LWIP_INCLUDES = \  	-I$(LWIPDIR)/src/include/ipv4  ######################################################################## -# local include dirs -######################################################################## -LOCAL_INCLUDES = \ -	-I$(top_srcdir)/include \ -	-I$(top_srcdir)/lib - -########################################################################  # misc flags for the mb-gcc compiler  ########################################################################  MBGCC_CFLAGS = \  	--std=gnu99 -Wall -Werror-implicit-function-declaration \  	-mxl-soft-div -msoft-float -mxl-soft-mul -mxl-barrel-shift -MBGCC_LFLAGS = -Wl,-defsym -Wl,_STACK_SIZE=3072 -  ########################################################################  # define for the hal io (FIXME move?)  ######################################################################## @@ -51,31 +44,39 @@ MBGCC_LFLAGS = -Wl,-defsym -Wl,_STACK_SIZE=3072  HAL_IO = -DHAL_IO_USES_UART   ######################################################################## -# set the cflags and ldflags +# common cflags and ldflags  ######################################################################## -AM_CFLAGS = $(MBGCC_CFLAGS) $(LOCAL_INCLUDES) $(LWIP_INCLUDES) $(HAL_IO) +COMMON_CFLAGS = \ +	-I$(top_srcdir)/../../host/lib/usrp \ +	-I$(top_srcdir)/lib \ +	$(MBGCC_CFLAGS) \ +	$(LWIP_INCLUDES) \ +	$(HAL_IO) -AM_LDFLAGS = $(MBGCC_LFLAGS) +COMMON_LFLAGS = \ +	-Wl,-Map -Wl,$(@:.elf=.map)  ########################################################################  # Common stuff for building top level microblaze images  ######################################################################## -AM_LDFLAGS += -Wl,-Map -Wl,$(@:.elf=.map) - -%.bin : %.elf +.elf.bin:  	$(MB_OBJCOPY) -O binary $< $@ -%.dump : %.elf +.elf.dump:  	$(MB_OBJDUMP) -DSC $< > $@ -%.rom : %.bin +.bin.rom:  	$(HEXDUMP) -v -e'1/1 "%.2X\n"' $< > $@ +.elf.ihx: +	$(MB_OBJCOPY) -O ihex $(COMMON_IHX_ARGS) $< $@ +  _generated_from_elf = \  	$(noinst_PROGRAMS:.elf=.map) \  	$(noinst_PROGRAMS:.elf=.bin) \  	$(noinst_PROGRAMS:.elf=.dump) \ -	$(noinst_PROGRAMS:.elf=.rom) +	$(noinst_PROGRAMS:.elf=.rom) \ +	$(noinst_PROGRAMS:.elf=.ihx)  noinst_DATA = $(_generated_from_elf) diff --git a/firmware/microblaze/apps/burnrev40.c b/firmware/microblaze/apps/burnrev40.c deleted file mode 100644 index 362270961..000000000 --- a/firmware/microblaze/apps/burnrev40.c +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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/>. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "u2_init.h" -#include "memory_map.h" -#include "spi.h" -#include "hal_io.h" -#include "buffer_pool.h" -#include "pic.h" -#include <stdbool.h> -#include "ethernet.h" -#include "nonstdio.h" -#include "usrp2_eth_packet.h" -#include "dbsm.h" -#include "app_common_v2.h" -#include "memcpy_wa.h" -#include <stddef.h> -#include <stdlib.h> -#include <string.h> -#include <i2c.h> -#include <usrp2_i2c_addr.h> -#include <clocks.h> -#include "sd.h" -#include "mdelay.h" - -#define HW_REV_MAJOR 4 -#define HW_REV_MINOR 0 - -int test_ram() -{ -  int i,j,k; -  output_regs->ram_page = 1<<10; -   -  extram[0] = 0xDEADBEEF; -  extram[1] = 0xF00D1234; -  extram[7] = 0x76543210; -   -  output_regs->ram_page = 2<<10; -  extram[7] = 0x55555555; -  extram[1] = 0xaaaaaaaa; -  extram[0] = 0xeeeeeeee; -   -  output_regs->ram_page = 1<<10; -   -  i = extram[0]; -  k = extram[1]; -  j = extram[7]; -   -  if((i != 0xDEADBEEF)||(j!=0x76543210)||(k!=0xF00D1234)) { -    puts("RAM FAIL1!\n"); -    puthex32_nl(i); -    puthex32_nl(j); -    puthex32_nl(k); -    return 0; -  } -   -  output_regs->ram_page = 2<<10; - -  j = extram[7]; -  k = extram[1]; -  i = extram[0]; - -  if((i != 0xeeeeeeee)||(j!=0x55555555)||(k!=0xaaaaaaaa)) { -    puts("RAM FAIL2!\n"); -    puthex32_nl(i); -    puthex32_nl(j); -    puthex32_nl(k); -    return 0; -  } -  return 1; -} - -int test_sd() -{ -  int i = sd_init(); -  if(i==0) { -    puts("FAILED INIT of Card\n"); -    return 0; -  } -   -  unsigned char buf[512]; -  i = sd_read_block(2048,buf); -  if(i == 0) { -    puts("READ Command Rejected\n"); -    return 0; -  } -  if((buf[0]==0xb8)&&(buf[1]==0x08)&&(buf[2]==0x00)&&(buf[3]==0x50)) -    ; -  else { -    puts("Read bad data from SD Card\n"); -    return 0; -  } -  return 1; -} - -int -main(void) -{ -  u2_init(); - -  putstr("\nFactory Test, Board Rev 4.0\n"); - -  bool ok = true; -  unsigned char maj = HW_REV_MAJOR; -  unsigned char min = HW_REV_MINOR; -  ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &maj, 1); -  ok &= eeprom_write(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &min, 1); - -  putstr("\nset_hw_rev\n"); -  if (ok) -    printf("OK: set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); -  else { -    printf("FAILED to set h/w rev to %d.%d\n", HW_REV_MAJOR, HW_REV_MINOR); -    hal_finish(); -    return 0; -  } - -  if(test_sd()) -    puts("SD OK\n"); -  else { -    puts("SD FAIL\n"); -    //hal_finish(); -    //return 0; -  } -  if(test_ram()) -    puts("RAM OK\n"); -  else { -    puts("RAM FAIL\n"); -    hal_finish(); -    return 0; -  } - -  print_mac_addr(ethernet_mac_addr()->addr); -  newline(); - -  clocks_mimo_config(MC_WE_LOCK_TO_SMA); - -  while (!clocks_lock_detect()) { -    puts("No Lock"); -    mdelay(1000); -  } -  puts("Clock Locked\n"); - -} diff --git a/firmware/microblaze/apps/Makefile.am b/firmware/microblaze/apps/cruft/Makefile.am index a4f79935b..a4f79935b 100644 --- a/firmware/microblaze/apps/Makefile.am +++ b/firmware/microblaze/apps/cruft/Makefile.am diff --git a/firmware/microblaze/apps/app_passthru_v2.c b/firmware/microblaze/apps/cruft/app_passthru_v2.c index 406c56b3b..406c56b3b 100644 --- a/firmware/microblaze/apps/app_passthru_v2.c +++ b/firmware/microblaze/apps/cruft/app_passthru_v2.c diff --git a/firmware/microblaze/apps/app_passthru_v2.h b/firmware/microblaze/apps/cruft/app_passthru_v2.h index 3904c670f..3904c670f 100644 --- a/firmware/microblaze/apps/app_passthru_v2.h +++ b/firmware/microblaze/apps/cruft/app_passthru_v2.h diff --git a/firmware/microblaze/apps/blink_leds.c b/firmware/microblaze/apps/cruft/blink_leds.c index 682ca8db2..682ca8db2 100644 --- a/firmware/microblaze/apps/blink_leds.c +++ b/firmware/microblaze/apps/cruft/blink_leds.c diff --git a/firmware/microblaze/apps/blink_leds2.c b/firmware/microblaze/apps/cruft/blink_leds2.c index 13e78afb3..13e78afb3 100644 --- a/firmware/microblaze/apps/blink_leds2.c +++ b/firmware/microblaze/apps/cruft/blink_leds2.c diff --git a/firmware/microblaze/apps/buf_ram_test.c b/firmware/microblaze/apps/cruft/buf_ram_test.c index 1aca2aec5..1aca2aec5 100644 --- a/firmware/microblaze/apps/buf_ram_test.c +++ b/firmware/microblaze/apps/cruft/buf_ram_test.c diff --git a/firmware/microblaze/apps/burn_dbsrx_eeprom.c b/firmware/microblaze/apps/cruft/burn_dbsrx_eeprom.c index 116d4d8d0..116d4d8d0 100644 --- a/firmware/microblaze/apps/burn_dbsrx_eeprom.c +++ b/firmware/microblaze/apps/cruft/burn_dbsrx_eeprom.c diff --git a/firmware/microblaze/apps/burnrev30.c b/firmware/microblaze/apps/cruft/burnrev30.c index 40fa53e34..40fa53e34 100644 --- a/firmware/microblaze/apps/burnrev30.c +++ b/firmware/microblaze/apps/cruft/burnrev30.c diff --git a/firmware/microblaze/apps/burnrev31.c b/firmware/microblaze/apps/cruft/burnrev31.c index f6b08d187..f6b08d187 100644 --- a/firmware/microblaze/apps/burnrev31.c +++ b/firmware/microblaze/apps/cruft/burnrev31.c diff --git a/firmware/microblaze/apps/can_i_sub.c b/firmware/microblaze/apps/cruft/can_i_sub.c index ed49791f0..ed49791f0 100644 --- a/firmware/microblaze/apps/can_i_sub.c +++ b/firmware/microblaze/apps/cruft/can_i_sub.c diff --git a/firmware/microblaze/apps/double_buffer_fragment.c b/firmware/microblaze/apps/cruft/double_buffer_fragment.c index cfc061247..cfc061247 100644 --- a/firmware/microblaze/apps/double_buffer_fragment.c +++ b/firmware/microblaze/apps/cruft/double_buffer_fragment.c diff --git a/firmware/microblaze/apps/echo.c b/firmware/microblaze/apps/cruft/echo.c index 89108ee80..89108ee80 100644 --- a/firmware/microblaze/apps/echo.c +++ b/firmware/microblaze/apps/cruft/echo.c diff --git a/firmware/microblaze/apps/eth_serdes.c b/firmware/microblaze/apps/cruft/eth_serdes.c index 2d2ddc1ca..2d2ddc1ca 100644 --- a/firmware/microblaze/apps/eth_serdes.c +++ b/firmware/microblaze/apps/cruft/eth_serdes.c diff --git a/firmware/microblaze/apps/factory_test.c b/firmware/microblaze/apps/cruft/factory_test.c index e1fbb0e40..e1fbb0e40 100644 --- a/firmware/microblaze/apps/factory_test.c +++ b/firmware/microblaze/apps/cruft/factory_test.c diff --git a/firmware/microblaze/apps/gen_eth_packets.c b/firmware/microblaze/apps/cruft/gen_eth_packets.c index 4d521f6bf..4d521f6bf 100644 --- a/firmware/microblaze/apps/gen_eth_packets.c +++ b/firmware/microblaze/apps/cruft/gen_eth_packets.c diff --git a/firmware/microblaze/apps/gen_pause_frames.c b/firmware/microblaze/apps/cruft/gen_pause_frames.c index 0f81dafff..0f81dafff 100644 --- a/firmware/microblaze/apps/gen_pause_frames.c +++ b/firmware/microblaze/apps/cruft/gen_pause_frames.c diff --git a/firmware/microblaze/apps/hello.c b/firmware/microblaze/apps/cruft/hello.c index bce843093..bce843093 100644 --- a/firmware/microblaze/apps/hello.c +++ b/firmware/microblaze/apps/cruft/hello.c diff --git a/firmware/microblaze/apps/ibs_rx_test.c b/firmware/microblaze/apps/cruft/ibs_rx_test.c index bdc04747e..bdc04747e 100644 --- a/firmware/microblaze/apps/ibs_rx_test.c +++ b/firmware/microblaze/apps/cruft/ibs_rx_test.c diff --git a/firmware/microblaze/apps/ibs_tx_test.c b/firmware/microblaze/apps/cruft/ibs_tx_test.c index ff9446d92..ff9446d92 100644 --- a/firmware/microblaze/apps/ibs_tx_test.c +++ b/firmware/microblaze/apps/cruft/ibs_tx_test.c diff --git a/firmware/microblaze/apps/mimo_app_common_v2.c b/firmware/microblaze/apps/cruft/mimo_app_common_v2.c index 5dbecb0d0..5dbecb0d0 100644 --- a/firmware/microblaze/apps/mimo_app_common_v2.c +++ b/firmware/microblaze/apps/cruft/mimo_app_common_v2.c diff --git a/firmware/microblaze/apps/mimo_app_common_v2.h b/firmware/microblaze/apps/cruft/mimo_app_common_v2.h index 1e62ced37..1e62ced37 100644 --- a/firmware/microblaze/apps/mimo_app_common_v2.h +++ b/firmware/microblaze/apps/cruft/mimo_app_common_v2.h diff --git a/firmware/microblaze/apps/mimo_tx.c b/firmware/microblaze/apps/cruft/mimo_tx.c index e0f8aa6fa..e0f8aa6fa 100644 --- a/firmware/microblaze/apps/mimo_tx.c +++ b/firmware/microblaze/apps/cruft/mimo_tx.c diff --git a/firmware/microblaze/apps/mimo_tx_slave.c b/firmware/microblaze/apps/cruft/mimo_tx_slave.c index cdf9c03c2..cdf9c03c2 100644 --- a/firmware/microblaze/apps/mimo_tx_slave.c +++ b/firmware/microblaze/apps/cruft/mimo_tx_slave.c diff --git a/firmware/microblaze/apps/rcv_eth_packets.c b/firmware/microblaze/apps/cruft/rcv_eth_packets.c index 03fc94354..03fc94354 100644 --- a/firmware/microblaze/apps/rcv_eth_packets.c +++ b/firmware/microblaze/apps/cruft/rcv_eth_packets.c diff --git a/firmware/microblaze/apps/read_dbids.c b/firmware/microblaze/apps/cruft/read_dbids.c index 24c6d9ab4..24c6d9ab4 100644 --- a/firmware/microblaze/apps/read_dbids.c +++ b/firmware/microblaze/apps/cruft/read_dbids.c diff --git a/firmware/microblaze/apps/sd_bounce.c b/firmware/microblaze/apps/cruft/sd_bounce.c index c1b48f170..c1b48f170 100644 --- a/firmware/microblaze/apps/sd_bounce.c +++ b/firmware/microblaze/apps/cruft/sd_bounce.c diff --git a/firmware/microblaze/apps/sd_gentest.c b/firmware/microblaze/apps/cruft/sd_gentest.c index 35e912615..35e912615 100644 --- a/firmware/microblaze/apps/sd_gentest.c +++ b/firmware/microblaze/apps/cruft/sd_gentest.c diff --git a/firmware/microblaze/apps/serdes_to_dsp.c b/firmware/microblaze/apps/cruft/serdes_to_dsp.c index 4994e0a69..4994e0a69 100644 --- a/firmware/microblaze/apps/serdes_to_dsp.c +++ b/firmware/microblaze/apps/cruft/serdes_to_dsp.c diff --git a/firmware/microblaze/apps/serdes_txrx.c b/firmware/microblaze/apps/cruft/serdes_txrx.c index 2c47c9628..2c47c9628 100644 --- a/firmware/microblaze/apps/serdes_txrx.c +++ b/firmware/microblaze/apps/cruft/serdes_txrx.c diff --git a/firmware/microblaze/apps/set_hw_rev.c b/firmware/microblaze/apps/cruft/set_hw_rev.c index d4ac8ff81..d4ac8ff81 100644 --- a/firmware/microblaze/apps/set_hw_rev.c +++ b/firmware/microblaze/apps/cruft/set_hw_rev.c diff --git a/firmware/microblaze/apps/test1.c b/firmware/microblaze/apps/cruft/test1.c index c3cc3be56..c3cc3be56 100644 --- a/firmware/microblaze/apps/test1.c +++ b/firmware/microblaze/apps/cruft/test1.c diff --git a/firmware/microblaze/apps/test_db_spi.c b/firmware/microblaze/apps/cruft/test_db_spi.c index f4fa98ef1..f4fa98ef1 100644 --- a/firmware/microblaze/apps/test_db_spi.c +++ b/firmware/microblaze/apps/cruft/test_db_spi.c diff --git a/firmware/microblaze/apps/test_i2c.c b/firmware/microblaze/apps/cruft/test_i2c.c index f349ead88..f349ead88 100644 --- a/firmware/microblaze/apps/test_i2c.c +++ b/firmware/microblaze/apps/cruft/test_i2c.c diff --git a/firmware/microblaze/apps/test_lsadc.c b/firmware/microblaze/apps/cruft/test_lsadc.c index 5fda29cd7..5fda29cd7 100644 --- a/firmware/microblaze/apps/test_lsadc.c +++ b/firmware/microblaze/apps/cruft/test_lsadc.c diff --git a/firmware/microblaze/apps/test_lsdac.c b/firmware/microblaze/apps/cruft/test_lsdac.c index 8c1bf333b..8c1bf333b 100644 --- a/firmware/microblaze/apps/test_lsdac.c +++ b/firmware/microblaze/apps/cruft/test_lsdac.c diff --git a/firmware/microblaze/apps/test_phy_comm.c b/firmware/microblaze/apps/cruft/test_phy_comm.c index d312ca4cc..d312ca4cc 100644 --- a/firmware/microblaze/apps/test_phy_comm.c +++ b/firmware/microblaze/apps/cruft/test_phy_comm.c diff --git a/firmware/microblaze/apps/test_ram.c b/firmware/microblaze/apps/cruft/test_ram.c index 77ee693f6..77ee693f6 100644 --- a/firmware/microblaze/apps/test_ram.c +++ b/firmware/microblaze/apps/cruft/test_ram.c diff --git a/firmware/microblaze/apps/test_sd.c b/firmware/microblaze/apps/cruft/test_sd.c index 494432d7f..494432d7f 100644 --- a/firmware/microblaze/apps/test_sd.c +++ b/firmware/microblaze/apps/cruft/test_sd.c diff --git a/firmware/microblaze/apps/timer_test.c b/firmware/microblaze/apps/cruft/timer_test.c index 44e80b5f1..44e80b5f1 100644 --- a/firmware/microblaze/apps/timer_test.c +++ b/firmware/microblaze/apps/cruft/timer_test.c diff --git a/firmware/microblaze/apps/tx_standalone.c b/firmware/microblaze/apps/cruft/tx_standalone.c index 1645fa8ba..1645fa8ba 100644 --- a/firmware/microblaze/apps/tx_standalone.c +++ b/firmware/microblaze/apps/cruft/tx_standalone.c diff --git a/firmware/microblaze/apps/txrx_uhd.c b/firmware/microblaze/apps/txrx_uhd.c index f7f140121..092d216aa 100644 --- a/firmware/microblaze/apps/txrx_uhd.c +++ b/firmware/microblaze/apps/txrx_uhd.c @@ -41,7 +41,6 @@  #include <stdlib.h>  #include <string.h>  #include "clocks.h" -#include <vrt/bits.h>  #include "usrp2/fw_common.h"  #include <i2c.h>  #include <ethertype.h> @@ -266,7 +265,7 @@ void handle_udp_ctrl_packet(       * Peek and Poke Register       ******************************************************************/      case USRP2_CTRL_ID_POKE_THIS_REGISTER_FOR_ME_BRO: -        if (ctrl_data_in->data.poke_args.addr < 0xC000){ +        if (0){//ctrl_data_in->data.poke_args.addr < 0xC000){              printf("error! tried to poke into 0x%x\n", ctrl_data_in->data.poke_args.addr);          }          else switch(ctrl_data_in->data.poke_args.num_bytes){ @@ -484,7 +483,7 @@ main(void)      int pending = pic_regs->pending;		// poll for under or overrun      if (pending & PIC_UNDERRUN_INT){ -      dbsm_handle_tx_underrun(&dsp_tx_sm); +      //dbsm_handle_tx_underrun(&dsp_tx_sm);        pic_regs->pending = PIC_UNDERRUN_INT;	// clear interrupt        putchar('U');      } diff --git a/firmware/microblaze/bootstrap b/firmware/microblaze/bootstrap index 2343025cc..5786c1624 100755 --- a/firmware/microblaze/bootstrap +++ b/firmware/microblaze/bootstrap @@ -17,6 +17,7 @@  #  rm -rf *.cache +rm -rf libusrp2/.deps  aclocal  autoconf diff --git a/firmware/microblaze/config.guess b/firmware/microblaze/config.guess deleted file mode 120000 index 405bc3235..000000000 --- a/firmware/microblaze/config.guess +++ /dev/null @@ -1 +0,0 @@ -/usr/share/automake-1.11/config.guess
\ No newline at end of file diff --git a/firmware/microblaze/config.sub b/firmware/microblaze/config.sub deleted file mode 120000 index 4d47fbcbc..000000000 --- a/firmware/microblaze/config.sub +++ /dev/null @@ -1 +0,0 @@ -/usr/share/automake-1.11/config.sub
\ No newline at end of file diff --git a/firmware/microblaze/configure.ac b/firmware/microblaze/configure.ac index 46968b7fb..e27bcb557 100644 --- a/firmware/microblaze/configure.ac +++ b/firmware/microblaze/configure.ac @@ -32,6 +32,7 @@ m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.64],       [m4_define([_AC_LANG_IO_PROGRAM(]_GCC_LANG[)], m4_defn([AC_LANG_PROGRAM(]_GCC_LANG[)]))])])   AC_PROG_CC([mb-gcc]) +AM_PROG_CC_C_O  LT_INIT  ################################################## @@ -46,9 +47,6 @@ AC_PATH_PROG([HEXDUMP],    [hexdump])  ##################################################  AC_CONFIG_FILES([ \      Makefile \ -    apps/Makefile \ -    include/Makefile \ -    include/net/Makefile \ -    lib/Makefile \ +    usrp2/Makefile \  ])  AC_OUTPUT diff --git a/firmware/microblaze/include/.gitignore b/firmware/microblaze/include/.gitignore deleted file mode 100644 index b336cc7ce..000000000 --- a/firmware/microblaze/include/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/Makefile -/Makefile.in diff --git a/firmware/microblaze/include/usrp2_fpga_regs.h b/firmware/microblaze/include/usrp2_fpga_regs.h deleted file mode 100644 index b0f83df60..000000000 --- a/firmware/microblaze/include/usrp2_fpga_regs.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2007 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_FPGA_REGS_H -#define INCLUDED_USSRP2_FPGA_REGS_H - -#include "usrp2_cdefs.h" - -__U2_BEGIN_DECLS - -// ---------------------------------------------------------------- - -#define	DSP_CORE_TX_BASE	128 - -// DUC center frequency tuning word (phase increment) -#define FR_TX_FREQ_0		(0 + DSP_CORE_TX_BASE) - -// I & Q output scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE) -#define FR_TX_SCALE_0		(1 + DSP_CORE_TX_BASE) - -// Tx interpolation rate (set to 1 less than desired rate) -#define FR_TX_INTERP_RATE_0	(2 + DSP_CORE_TX_BASE) - -// Write 1 (actually anything) to clear tx state -#define FR_TX_CLEAR_STATE_0	(3 + DSP_CORE_TX_BASE) - -// ---------------------------------------------------------------- - -#define	DSP_CORE_RX_BASE	160 - -// DDC center frequency tuning word (phase increment) -#define FR_RX_FREQ_0		(0 + DSP_CORE_RX_BASE) - -// I & Q input scaling, 16.0 format ((I_SCALE << 16) | Q_SCALE) -#define FR_RX_SCALE_0		(1 + DSP_CORE_RX_BASE) - -// Rx decimation rate (set to 1 less than desired rate) -#define FR_RX_DECIM_RATE_0	(2 + DSP_CORE_RX_BASE) - -// The next two registers concatenated are the Rx command register. -// -// Writing FR_RX_TIME_TO_RX_0 writes the concatenated value into the -// cmd queue.  Thus, if you're writing both, be sure to write -// FR_RX_QTY_0 first. -// -//   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -//   |                          Timestamp                            | -//   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -#define FR_RX_TIME_TO_RX	(3 + DSP_CORE_RX_BASE) - -//                          23-bits                       9-bits -//   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -//   |                number_of_lines              | lines_per_frame | -//   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - -#define FR_RX_QTY_0		(4 + DSP_CORE_RX_BASE) - -// write a 1 (anything actually) to clear the overrun  -#define FR_RX_CLR_OVERRUN_0	(5 + DSP_CORE_RX_BASE) - - -__U2_END_DECLS - -#endif /* INCLUDED_USRP2_FPGA_REGS_H */ diff --git a/firmware/microblaze/include/usrp2_i2c_addr.h b/firmware/microblaze/include/usrp2_i2c_addr.h deleted file mode 100644 index 46f5a7556..000000000 --- a/firmware/microblaze/include/usrp2_i2c_addr.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 2004,2007 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_I2C_ADDR_H -#define INCLUDED_USRP2_I2C_ADDR_H - -// I2C addresses - -#define I2C_DEV_EEPROM	0x50		// 24LC02[45]:  7-bits 1010xxx - -#define	I2C_ADDR_MBOARD	(I2C_DEV_EEPROM	| 0x0) -#define	I2C_ADDR_TX_A	(I2C_DEV_EEPROM | 0x4) -#define	I2C_ADDR_RX_A	(I2C_DEV_EEPROM | 0x5) - - -// format of USRP2 motherboard rom -//	00: 0x00	h/w rev (LSB) -//	01: 0x00	h/w rev (MSB) -//	02: 0x00	MAC addr 0 -//	03: 0x50	MAC addr 1 -//	04: 0xC2	MAC addr 2 -//	05: 0x85	MAC addr 3 -//	06: 0x3.	MAC addr 4 -//	07: 0x..	MAC addr 5 - -#define MBOARD_REV_LSB	0x00 -#define	MBOARD_REV_MSB  0x01 -#define	MBOARD_MAC_ADDR 0x02 -#define MBOARD_IP_ADDR  0x0C - - -// format of daughterboard EEPROM -//	00: 0xDB	code for ``I'm a daughterboard'' -//	01:   ..	Daughterboard ID (LSB) -//	02:   ..	Daughterboard ID (MSB) -//	03:   ..	io bits  7-0 direction (bit set if it's an output from m'board) -//	04:   ..	io bits 15-8 direction (bit set if it's an output from m'board) -//	05:   ..	ADC0 DC offset correction (LSB) -//	06:   ..	ADC0 DC offset correction (MSB) -//	07:   ..	ADC1 DC offset correction (LSB) -//	08:   ..	ADC1 DC offset correction (MSB) -// 	... -//	1f:   ..	negative of the sum of bytes [0x00, 0x1e] - -#define	DB_EEPROM_MAGIC		0x00 -#define	  DB_EEPROM_MAGIC_VALUE			0xDB -#define	DB_EEPROM_ID_LSB		0x01 -#define	DB_EEPROM_ID_MSB		0x02 -#define	DB_EEPROM_OE_LSB		0x03 -#define	DB_EEPROM_OE_MSB		0x04 -#define	DB_EEPROM_OFFSET_0_LSB		0x05	// offset correction for ADC or DAC 0 -#define	DB_EEPROM_OFFSET_0_MSB		0x06 -#define	DB_EEPROM_OFFSET_1_LSB		0x07	// offset correction for ADC or DAC 1 -#define	DB_EEPROM_OFFSET_1_MSB		0x08 -#define	DB_EEPROM_CHKSUM		0x1f - -#define	DB_EEPROM_CLEN			0x20	// length of common portion of eeprom - -#define	DB_EEPROM_CUSTOM_BASE		DB_EEPROM_CLEN	// first avail offset for -							//   daughterboard specific use - -#endif /* INCLUDED_USRP2_I2C_ADDR_H */ - diff --git a/firmware/microblaze/include/usrp2_types.h b/firmware/microblaze/include/usrp2_types.h deleted file mode 100644 index fe45936f0..000000000 --- a/firmware/microblaze/include/usrp2_types.h +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- c++ -*- */ -/* - * Copyright 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_USRP2_TYPES_H -#define INCLUDED_USRP2_TYPES_H - -#include <stdint.h> - -/*! - * \brief Fixed point representation of a frequency in Hertz (VITA-49 compatible) - * - * 64-bit two's complement, with the radix point 20 bits up from the bottom.  - * Q44.20 format (20 bits to the right of the radix point) - * - * Values range from +/- 8.79 terahertz with a resolution of 0.95 microhertz. - */ -typedef int64_t	u2_fxpt_freq_t; - -#define U2_FPF_RP	20	// location of radix point in u2_fxpt_freq_t - -// macro so we can init structs at compile time -#define U2_DOUBLE_TO_FXPT_FREQ(f) (int64_t)((f) * (1LL << U2_FPF_RP)) - -static inline u2_fxpt_freq_t -u2_double_to_fxpt_freq(double f) -{ -  return U2_DOUBLE_TO_FXPT_FREQ(f); -} - -static inline int -u2_fxpt_freq_round_to_int(u2_fxpt_freq_t fx) -{ -  return (int)((fx+(1<<(U2_FPF_RP-1)))>>U2_FPF_RP); -} - -static inline double -u2_fxpt_freq_to_double(u2_fxpt_freq_t fx) -{ -  return ((double) fx) * 1.0/(1 << U2_FPF_RP); -} - -static inline uint32_t -u2_fxpt_freq_hi(u2_fxpt_freq_t f) -{ -  return ((f >> 32) & 0xffffffff); -} - -static inline uint32_t -u2_fxpt_freq_lo(u2_fxpt_freq_t f) -{ -  return (f & 0xffffffff); -} - -static inline u2_fxpt_freq_t -u2_fxpt_freq_from_hilo(uint32_t hi, uint32_t lo) -{ -  return (((u2_fxpt_freq_t) hi) << 32) | lo; -} - -/*! - * \brief Fixed point representation of a gain in dB (VITA-49 compatible) - * - * 16-bit two's complement, with the radix point 7 bits up from the bottom.  - * Q9.7 format (7 bits to the right of the radix point) - */ -typedef int16_t u2_fxpt_gain_t; - -#define U2_FPG_RP	7	// location of radix point in u2_fxpt_gain_t - -// macro so we can init structs at compile time -#define U2_DOUBLE_TO_FXPT_GAIN(g) (int16_t)((g) * (1 << U2_FPG_RP)) - -static inline u2_fxpt_gain_t -u2_double_to_fxpt_gain(double g) -{ -  return U2_DOUBLE_TO_FXPT_GAIN(g); -} - -static inline float -u2_fxpt_gain_to_double(u2_fxpt_gain_t fx) -{ -  return ((double) fx) * 1.0/(1 << U2_FPG_RP); -} - -static inline int -u2_fxpt_gain_round_to_int(u2_fxpt_gain_t fx) -{  -  return (int)((fx+(1<<(U2_FPG_RP-1)))>>U2_FPG_RP); -} - -#endif /* INCLUDED_USRP2_TYPES_H */ diff --git a/firmware/microblaze/include/vrt/bits.h b/firmware/microblaze/include/vrt/bits.h deleted file mode 100644 index 54eeec7b4..000000000 --- a/firmware/microblaze/include/vrt/bits.h +++ /dev/null @@ -1,92 +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/>. - */ -#ifndef INCLUDED_VRT_BITS_H -#define INCLUDED_VRT_BITS_H - -#include <stdint.h> - - -/* VRT Header bits */ - -#define	VRTH_PT_MASK		  (0xf << 28) -#define	VRTH_PT_IF_DATA_NO_SID	  (0x0 << 28)	// IF-Data, no stream id -#define	VRTH_PT_IF_DATA_WITH_SID  (0x1 << 28)	// IF-Data, w/ stream id -#define VRTH_PT_EXT_DATA_NO_SID	  (0x2 << 28) -#define	VRTH_PT_EXT_DATA_WITH_SID (0x3 << 28) -#define	VRTH_PT_IF_CONTEXT	  (0x4 << 28) -#define	VRTH_PT_EXT_CONTEXT	  (0x5 << 28) - -#define	VRTH_HAS_CLASSID	  (1 << 27) -#define	VRTH_HAS_TRAILER	  (1 << 26)	// Data pkts only -#define	VRTH_START_OF_BURST	  (1 << 25)	// Data (Tx) pkts only -#define	VRTH_END_OF_BURST	  (1 << 24)	// Data (Tx) pkts only -#define	VRTH_TSM		  (1 << 24)	// Context pkts only - -#define	VRTH_TSI_MASK		  (0x3 << 22) -#define	VRTH_TSI_NONE		  (0x0 << 22) -#define	VRTH_TSI_UTC		  (0x1 << 22) -#define	VRTH_TSI_GPS		  (0x2 << 22) -#define VRTH_TSI_OTHER		  (0x3 << 22) - -#define	VRTH_TSF_MASK		  (0x3 << 20) -#define	VRTH_TSF_NONE		  (0x0 << 20) -#define	VRTH_TSF_SAMPLE_CNT	  (0x1 << 20) -#define	VRTH_TSF_REAL_TIME_PS	  (0x2 << 20) -#define	VRTH_TSF_FREE_RUNNING	  (0x3 << 20) - -#define	VRTH_PKT_CNT_SHIFT	  16 -#define	VRTH_PKT_CNT_MASK	  (0xf << 16) - -#define	VRTH_PKT_SIZE_MASK	  0xffff		     - - -static inline int -vrth_pkt_cnt(uint32_t h) -{ -  return (h & VRTH_PKT_CNT_MASK) >> 16; -} - -static inline int -vrth_pkt_size(uint32_t h) -{ -  return h & VRTH_PKT_SIZE_MASK; -} - -/* - * Trailer bits - */ -#define	TR_E		      (1 << 8) - -#define TR_ENABLE(x) ((x) << 20) -#define	TR_STATE(x)  ((x) <<  8) - -// Use these with TR_ENABLE and TR_STATE -#define	TR_CAL_TIME	      (1 << 11) -#define	TR_VALID_DATA	      (1 << 10) -#define TR_REF_LOCK	      (1 <<  9) -#define	TR_AGC		      (1 <<  8) -#define TR_DETECTED_SIG	      (1 <<  7) -#define	TR_SPECTRAL_INVERSION (1 <<  6) -#define	TR_OVER_RANGE	      (1 <<  5) -#define	TR_SAMPLE_LOSS	      (1 <<  4) -#define TR_USER_3	      (1 <<  3) -#define TR_USER_2	      (1 <<  2) -#define TR_USER_1	      (1 <<  1) -#define TR_USER_0	      (1 <<  0) - -#endif /* INCLUDED_VRT_BITS_H */ diff --git a/firmware/microblaze/include/vrt/types.h b/firmware/microblaze/include/vrt/types.h deleted file mode 100644 index edfa4ec37..000000000 --- a/firmware/microblaze/include/vrt/types.h +++ /dev/null @@ -1,138 +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/>. - */ -#ifndef INCLUDED_VRT_TYPES_H -#define INCLUDED_VRT_TYPES_H - -#include <stdint.h> - -/* macros for dealing with fixed point numbers */ -#define _FXPT_C(_type, _x, _rp) ((_type)((_x)*(1ll << _rp))) -#define _FXPT_TO_INT(_x, _one) (((_x) + ((_one)/2))/(_one)) -#define _FXPT_TO_DOUBLE(_x, _one) ((double)(_x) * (1.0/(_one))) - -/*********************************************************************** - * The VRT Altitude Type (meters) - **********************************************************************/ -typedef int32_t vrt_altitude_t; -#define VRT_ALTITUDE_RP 5 -#define VRT_ALTITUDE_C(_x) _FXPT_C(vrt_altitude_t, _x, VRT_ALTITUDE_RP) - -static inline vrt_altitude_t -double_to_vrt_altitude(double num){ -  return VRT_ALTITUDE_C(num); -} - -static inline int32_t -vrt_altitude_round_to_int(vrt_altitude_t fx){ -  return _FXPT_TO_INT(fx, VRT_ALTITUDE_C(1)); -} - -static inline double -vrt_altitude_to_double(vrt_altitude_t fx){ -  return _FXPT_TO_DOUBLE(fx, VRT_ALTITUDE_C(1)); -} - -/*********************************************************************** - * The VRT Geolocation Angle Type (degrees) - **********************************************************************/ -typedef int32_t vrt_geo_angle_t; -#define VRT_GEO_ANGLE_RP 22 -#define VRT_GEO_ANGLE_C(_x) _FXPT_C(vrt_geo_angle_t, _x, VRT_GEO_ANGLE_RP) - -static inline vrt_geo_angle_t -double_to_vrt_geo_angle(double num){ -  return VRT_GEO_ANGLE_C(num); -} - -static inline int16_t -vrt_geo_angle_round_to_int(vrt_geo_angle_t fx){ -  return _FXPT_TO_INT(fx, VRT_GEO_ANGLE_C(1)); -} - -static inline double -vrt_geo_angle_to_double(vrt_geo_angle_t fx){ -  return _FXPT_TO_DOUBLE(fx, VRT_GEO_ANGLE_C(1)); -} - -/*********************************************************************** - * The VRT Frequency Type (Hz) - **********************************************************************/ -typedef int64_t vrt_freq_t; -#define VRT_FREQ_RP 20 -#define VRT_FREQ_C(_x) _FXPT_C(vrt_freq_t, _x, VRT_FREQ_RP) - -static inline vrt_freq_t -double_to_vrt_freq(double num){ -  return VRT_FREQ_C(num); -} - -static inline int64_t -vrt_freq_round_to_int(vrt_freq_t fx){ -  return _FXPT_TO_INT(fx, VRT_FREQ_C(1)); -} - -static inline double -vrt_freq_to_double(vrt_freq_t fx){ -  return _FXPT_TO_DOUBLE(fx, VRT_FREQ_C(1)); -} - -/*********************************************************************** - * The VRT Gain Type (dB) - **********************************************************************/ -typedef int16_t vrt_gain_t; -#define VRT_GAIN_RP 7 -#define VRT_GAIN_C(_x) _FXPT_C(vrt_gain_t, _x, VRT_GAIN_RP) - -static inline vrt_gain_t -double_to_vrt_gain(double num){ -  return VRT_GAIN_C(num); -} - -static inline int16_t -vrt_gain_round_to_int(vrt_gain_t fx){ -  return _FXPT_TO_INT(fx, VRT_GAIN_C(1)); -} - -static inline double -vrt_gain_to_double(vrt_gain_t fx){ -  return _FXPT_TO_DOUBLE(fx, VRT_GAIN_C(1)); -} - -/*********************************************************************** - * The VRT Temperature Type (Celcius) - **********************************************************************/ -typedef int16_t vrt_temp_t; -#define VRT_TEMP_RP 6 -#define VRT_TEMP_C(_x) _FXPT_C(vrt_temp_t, _x, VRT_TEMP_RP) - -static inline vrt_temp_t -double_to_vrt_temp(double num){ -  return VRT_TEMP_C(num); -} - -static inline int16_t -vrt_temp_round_to_int(vrt_temp_t fx){ -  return _FXPT_TO_INT(fx, VRT_TEMP_C(1)); -} - -static inline double -vrt_temp_to_double(vrt_temp_t fx){ -  return _FXPT_TO_DOUBLE(fx, VRT_TEMP_C(1)); -} - -#endif /* INCLUDED_VRT_TYPES_H */ diff --git a/firmware/microblaze/lib/.gitignore b/firmware/microblaze/lib/.gitignore deleted file mode 100644 index 5d838bf6c..000000000 --- a/firmware/microblaze/lib/.gitignore +++ /dev/null @@ -1,40 +0,0 @@ -*~ -/*-stamp -/*.a -/*.bin -/*.dump -/*.log -/*.rom -/.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 -/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 diff --git a/firmware/microblaze/lib/Makefile.am b/firmware/microblaze/lib/Makefile.am deleted file mode 100644 index b51d74463..000000000 --- a/firmware/microblaze/lib/Makefile.am +++ /dev/null @@ -1,87 +0,0 @@ -# -# Copyright 2010 Ettus Research LLC -# -# Copyright 2007 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/>. -# - -include $(top_srcdir)/Makefile.common - -noinst_LIBRARIES = \ -	libu2fw.a - -libu2fw_a_SOURCES = \ -	abort.c \ -	ad9510.c \ -	bsm12.c \ -	buffer_pool.c \ -	clocks.c \ -	dbsm.c \ -	eeprom.c \ -	ethernet.c \ -	eth_mac.c \ -	_exit.c \ -	exit.c \ -	hal_io.c \ -	hal_uart.c \ -	i2c.c \ -	mdelay.c \ -	memcpy_wa.c \ -	memset_wa.c \ -	nonstdio.c \ -	pic.c \ -	print_mac_addr.c \ -	print_rmon_regs.c \ -	print_buffer.c \ -	printf.c \ -	sd.c \ -	spi.c \ -	u2_init.c \ -	net_common.c \ -	arp_cache.c \ -	banal.c - -noinst_HEADERS = \ -	ad9510.h \ -	bsm12.h \ -	buffer_pool.h \ -	clocks.h \ -	dbsm.h \ -	eth_mac.h \ -	eth_mac_regs.h \ -	eth_phy.h \ -	ethernet.h \ -	hal_io.h \ -	hal_uart.h \ -	i2c.h \ -	mdelay.h \ -	memcpy_wa.h \ -	memory_map.h \ -	memset_wa.h \ -	nonstdio.h \ -	pic.h \ -	print_rmon_regs.h \ -	sd.h \ -	spi.h \ -	stdint.h \ -	stdio.h \ -	u2_init.h \ -	usrp2_bytesex.h \ -	wb16550.h \ -	net_common.h \ -	if_arp.h \ -	arp_cache.h \ -	banal.h \ -	ethertype.h diff --git a/firmware/microblaze/lib/Makefile.inc b/firmware/microblaze/lib/Makefile.inc new file mode 100644 index 000000000..a576d1ccb --- /dev/null +++ b/firmware/microblaze/lib/Makefile.inc @@ -0,0 +1,47 @@ +# +# Copyright 2010 Ettus Research LLC +# +# Copyright 2007 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/>. +# + +COMMON_SRCS = \ +	$(top_srcdir)/lib/u2_init.c \ +	$(top_srcdir)/lib/abort.c \ +	$(top_srcdir)/lib/ad9510.c \ +	$(top_srcdir)/lib/bsm12.c \ +	$(top_srcdir)/lib/buffer_pool.c \ +	$(top_srcdir)/lib/clocks.c \ +	$(top_srcdir)/lib/dbsm.c \ +	$(top_srcdir)/lib/eeprom.c \ +	$(top_srcdir)/lib/eth_mac.c \ +	$(top_srcdir)/lib/_exit.c \ +	$(top_srcdir)/lib/exit.c \ +	$(top_srcdir)/lib/hal_io.c \ +	$(top_srcdir)/lib/hal_uart.c \ +	$(top_srcdir)/lib/i2c.c \ +	$(top_srcdir)/lib/mdelay.c \ +	$(top_srcdir)/lib/memcpy_wa.c \ +	$(top_srcdir)/lib/memset_wa.c \ +	$(top_srcdir)/lib/nonstdio.c \ +	$(top_srcdir)/lib/pic.c \ +	$(top_srcdir)/lib/print_mac_addr.c \ +	$(top_srcdir)/lib/print_rmon_regs.c \ +	$(top_srcdir)/lib/print_buffer.c \ +	$(top_srcdir)/lib/printf.c \ +	$(top_srcdir)/lib/spi.c \ +	$(top_srcdir)/lib/net_common.c \ +	$(top_srcdir)/lib/arp_cache.c \ +	$(top_srcdir)/lib/banal.c diff --git a/firmware/microblaze/include/usrp2_clock_bits.h b/firmware/microblaze/lib/clock_bits.h index d2052e941..d2052e941 100644 --- a/firmware/microblaze/include/usrp2_clock_bits.h +++ b/firmware/microblaze/lib/clock_bits.h diff --git a/firmware/microblaze/lib/clocks.c b/firmware/microblaze/lib/clocks.c index ccc4a7cc7..2b352a385 100644 --- a/firmware/microblaze/lib/clocks.c +++ b/firmware/microblaze/lib/clocks.c @@ -25,40 +25,60 @@  #include "ad9510.h"  #include "spi.h"  #include "u2_init.h" -#include "nonstdio.h" + +//USRP2PLUS clocks: +//Clock 0: testclk +//Clock 1: FPGA clk +//Clock 2: ADC clk +//Clock 3: DAC clk +//Clock 4: SER clk +//Clock 5: TX dboard clk +//Clock 6: EXP clk +//Clock 7: RX dboard clk + +//TODO: should have enough brains to init the FPGA clock for USRP2+. all others are suspect. +//note that without EEPROM support u2_hw_rev_major is going to be incorrect.  void   clocks_init(void)  {    // Set up basic clocking functions in AD9510 -  ad9510_write_reg(0x45, 0x00); // CLK2 drives distribution +  ad9510_write_reg(0x45, 0x01); // CLK2 drives distribution +  //enable the 100MHz clock output to the FPGA for 50MHz CPU clock    clocks_enable_fpga_clk(true, 1);    spi_wait();    // Set up PLL for 10 MHz reference    // Reg 4, A counter, Don't Care -  ad9510_write_reg(0x05, 0x00);  // Reg 5, B counter MSBs, 0 -  ad9510_write_reg(0x06, 0x05);  // Reg 6, B counter LSBs, 5 +//  ad9510_write_reg(0x05, 0x00);  // Reg 5, B counter MSBs, 0 +//  ad9510_write_reg(0x06, 0x05);  // Reg 6, B counter LSBs, 5    // Reg 7, Loss of reference detect, doesn't work yet, 0 -  ad9510_write_reg(0x5A, 0x01); // Update Regs +//  ad9510_write_reg(0x5A, 0x01); // Update Regs    // Primary clock configuration -  clocks_mimo_config(MC_WE_DONT_LOCK); +//  clocks_mimo_config(MC_WE_DONT_LOCK); + + +  //wait for the clock to stabilize +  while(!clocks_lock_detect()); + +  //issue a reset to the DCM so it locks up to the new freq +  output_regs->clk_ctrl |= CLK_RESET;    // Set up other clocks    //clocks_enable_test_clk(false, 0);    //clocks_enable_tx_dboard(false, 0);    //clocks_enable_rx_dboard(false, 0); -  clocks_enable_eth_phyclk(false, 0); +//  clocks_enable_eth_phyclk(false, 0); //PHY clk is separate now (u2r4, u2p)    // Enable clock to ADCs and DACs    //clocks_enable_dac_clk(true, 1);    //clocks_enable_adc_clk(true, 1);  } - +/*  void  clocks_mimo_config(int flags)  { @@ -86,7 +106,7 @@ clocks_mimo_config(int flags)    spi_wait();    // Allow for clock switchover -   +  // The below masks include 0x10, which issues a reset to the DCM.      if (flags & _MC_WE_LOCK){		// WE LOCK      if (flags & _MC_MIMO_CLK_INPUT) {        // Turn on ref output and choose the MIMO connector @@ -103,18 +123,17 @@ clocks_mimo_config(int flags)    }    // Do we drive a clock onto the MIMO connector? -  if (flags & MC_PROVIDE_CLK_TO_MIMO) -    clocks_enable_clkexp_out(true,10); -  else -    clocks_enable_clkexp_out(false,0);  +//  if (flags & MC_PROVIDE_CLK_TO_MIMO) +//    clocks_enable_clkexp_out(true,10); +//  else +//    clocks_enable_clkexp_out(false,0);   } +*/  bool   clocks_lock_detect()  { -  if(pic_regs->pending & PIC_CLKSTATUS) -    return true; -  return false; +    return (pic_regs->pending & PIC_CLKSTATUS);  }  int inline @@ -136,21 +155,23 @@ clocks_gen_div(int divisor)  #define CLOCK_MODE_LVDS 2  #define CLOCK_MODE_CMOS 3 +//CHANGED: set to PECL for default behavior  void   clocks_enable_XXX_clk(bool enable, int divisor, int reg_en, int reg_div, int mode)  {    int enable_word, div_word, div_en_word;    switch(mode) { -  case CLOCK_MODE_PECL : -    enable_word = enable ? 0x08 : 0x0A; -    break;    case CLOCK_MODE_LVDS :      enable_word = enable ? 0x02 : 0x03;      break;    case CLOCK_MODE_CMOS :      enable_word = enable ? 0x08 : 0x09;      break; +  case CLOCK_MODE_PECL : +	default: +    enable_word = enable ? 0x08 : 0x0A; +    break;    }    if(enable && (divisor>1)) {      div_word = clocks_gen_div(divisor); @@ -180,8 +201,8 @@ clocks_enable_fpga_clk(bool enable, int divisor)  {    clocks_enable_XXX_clk(enable,divisor,0x3D,0x4A,CLOCK_MODE_PECL);  } - -// Clock 2 on Rev 3, Clock 5 on Rev 4 +/* +// Clock 2 on Rev 3, Clock 5 on Rev 4, Clock 6 on USRP2+  void  clocks_enable_clkexp_out(bool enable, int divisor)  { @@ -192,13 +213,19 @@ clocks_enable_clkexp_out(bool enable, int divisor)      ad9510_write_reg(0x35,0x00);  // Set Full Scale to nearly 10ns      ad9510_write_reg(0x36,0x1c);  // Set fine delay.  0x20 is midscale      clocks_enable_XXX_clk(enable,divisor,0x41,0x52,CLOCK_MODE_LVDS); -        } +	else if(u2_hw_rev_major == 10) { +		ad9510_write_reg(0x34, 0x00); +		ad9510_write_reg(0x35, 0x00); +		ad9510_write_reg(0x36, 0x1C); +		clocks_enable_XXX_clk(enable, divisor, 0x42, 0x52, CLOCK_MODE_LVDS); +	}    else -    putstr("ERR: Invalid Rev\n"); +    putstr("ERR (clocks_enable_clkexp_out): Invalid hw rev, don't know what to do!\n");  } - -// Clock 5 on Rev 3, none (was 2) on Rev 4 +*/ +/* +// Clock 5 on Rev 3, none (was 2) on Rev 4, none on USRP2+  void  clocks_enable_eth_phyclk(bool enable, int divisor)  { @@ -207,9 +234,9 @@ clocks_enable_eth_phyclk(bool enable, int divisor)    else if(u2_hw_rev_major == 4)      clocks_enable_XXX_clk(enable,divisor,0x3E,0x4C,CLOCK_MODE_PECL);    else -    putstr("ERR: Invalid Rev\n"); +    putstr("(clocks_enable_eth_phyclk): no eth PHY clock or invalid hw rev\n"); //not really an error  } - +*/  // Clock 3  /*void  clocks_enable_dac_clk(bool enable, int divisor) diff --git a/firmware/microblaze/lib/clocks.h b/firmware/microblaze/lib/clocks.h index 43d5a05c2..28d1d542f 100644 --- a/firmware/microblaze/lib/clocks.h +++ b/firmware/microblaze/lib/clocks.h @@ -26,7 +26,7 @@   */  #include <stdbool.h> -#include <usrp2_clock_bits.h> +#include "clock_bits.h"  /*! @@ -43,7 +43,7 @@ void clocks_init(void);   * Configure our master clock source, and whether or not we drive a   * clock onto the mimo connector.  See MC_flags in usrp2_mimo_config.h.   */ -void clocks_mimo_config(int flags); +//void clocks_mimo_config(int flags);  /*!   * \brief Lock Detect -- Return True if our PLL is locked @@ -63,12 +63,12 @@ void clocks_enable_fpga_clk(bool enable, int divisor);  /*!   * \brief Enable or disable clock output sent to MIMO connector   */ -void clocks_enable_clkexp_out(bool enable, int divisor); +//void clocks_enable_clkexp_out(bool enable, int divisor);  /*!   * \brief Enable or disable ethernet phyclk, should always be disabled   */ -void clocks_enable_eth_phyclk(bool enable, int divisor); +//void clocks_enable_eth_phyclk(bool enable, int divisor);  /*!   * \brief Enable or disable clock to DAC diff --git a/firmware/microblaze/include/compiler.h b/firmware/microblaze/lib/compiler.h index 4fa9b49f8..4fa9b49f8 100644 --- a/firmware/microblaze/include/compiler.h +++ b/firmware/microblaze/lib/compiler.h diff --git a/firmware/microblaze/lib/eth_mac.c b/firmware/microblaze/lib/eth_mac.c index 375d3f4d4..034a4d494 100644 --- a/firmware/microblaze/lib/eth_mac.c +++ b/firmware/microblaze/lib/eth_mac.c @@ -83,14 +83,6 @@ eth_mac_read_rmon(int addr)  int  eth_mac_miim_read(int addr)  { -  if (hwconfig_simulation_p()){ -    switch(addr){ -    case PHY_LINK_AN: -      return LANSR_MASTER | LANSR_LINK_GOOD | LANSR_SPEED_1000; -    default: -      return 0; -    } -  }    int phy_addr = PHY_ADDR;    eth_mac->miiaddress = ((addr & 0x1f) << 8) | phy_addr; @@ -112,7 +104,7 @@ eth_mac_miim_write(int addr, int value)    eth_mac->miitx_data = value;    eth_mac->miicommand = MIIC_WCTRLDATA; -  //printf("MIIM-WRITE ADDR 0x%x VAL 0x%x\n",addr,value); +//  printf("MIIM-WRITE ADDR 0x%x VAL 0x%x\n",addr,value);    while((eth_mac->miistatus & MIIS_BUSY) != 0)      ;  } diff --git a/firmware/microblaze/lib/hal_io.c b/firmware/microblaze/lib/hal_io.c index 0afd6a2cc..58b1e681e 100644 --- a/firmware/microblaze/lib/hal_io.c +++ b/firmware/microblaze/lib/hal_io.c @@ -193,3 +193,13 @@ puts(const char *s)    putchar('\n');    return 0;  } + +char * +gets(char * const s) +{ +	char *x = s; +	while((*x=(char)hal_uart_getc()) != '\n') x++; +	*x = 0; +	return s; +} + diff --git a/firmware/microblaze/lib/hal_io.h b/firmware/microblaze/lib/hal_io.h index d8967f063..c67d96c62 100644 --- a/firmware/microblaze/lib/hal_io.h +++ b/firmware/microblaze/lib/hal_io.h @@ -23,6 +23,7 @@  void hal_io_init(void);  void hal_finish(); +char *gets(char * const s);  /*   * ------------------------------------------------------------------------ diff --git a/firmware/microblaze/lib/hal_uart.c b/firmware/microblaze/lib/hal_uart.c index 75b12b432..fe3b7515a 100644 --- a/firmware/microblaze/lib/hal_uart.c +++ b/firmware/microblaze/lib/hal_uart.c @@ -39,16 +39,25 @@ divisor_table[MAX_WB_DIV+1][NSPEEDS] = {  #define u uart_regs +static char uart_mode = UART_MODE_ONLCR; + +void +hal_uart_set_mode(int mode) +{ +  uart_mode = mode; +} +  void  hal_uart_init(void)  { +	hal_uart_set_mode(UART_MODE_ONLCR);    u->clkdiv = 217;  // 230400 bps  }  void  hal_uart_putc(int ch)  { -  if (ch == '\n')		// FIXME for now map \n -> \r\n +  if (ch == '\n')// && (uart_mode == UART_MODE_ONLCR))		//map \n->\r\n if necessary      hal_uart_putc('\r');    while (u->txlevel == 0)	 // wait for fifo to have space @@ -60,7 +69,7 @@ hal_uart_putc(int ch)  void  hal_uart_putc_nowait(int ch)  { -  if (ch == '\n')		// FIXME for now map \n -> \r\n +  if (ch == '\n')// && (uart_mode == UART_MODE_ONLCR))		//map \n->\r\n if necessary      hal_uart_putc('\r');    if(u->txlevel)   // If fifo has space diff --git a/firmware/microblaze/lib/hal_uart.h b/firmware/microblaze/lib/hal_uart.h index 2ddfa6259..dfd73c323 100644 --- a/firmware/microblaze/lib/hal_uart.h +++ b/firmware/microblaze/lib/hal_uart.h @@ -19,6 +19,16 @@  #ifndef INCLUDED_HAL_UART_H  #define INCLUDED_HAL_UART_H +/*! + * \brief uart mode flags + */ +#define	UART_MODE_RAW		0x0000	// no mapping on input or output +#define	UART_MODE_ONLCR	0x0001	// map \n to \r\n on output (default) + +/* + * \brief Set uart mode + */ +void hal_uart_set_mode(int flags);  /*!   * \brief one-time call to init diff --git a/firmware/microblaze/include/net/.gitignore b/firmware/microblaze/lib/net/.gitignore index 282522db0..282522db0 100644 --- a/firmware/microblaze/include/net/.gitignore +++ b/firmware/microblaze/lib/net/.gitignore diff --git a/firmware/microblaze/include/net/eth_mac_addr.h b/firmware/microblaze/lib/net/eth_mac_addr.h index b44fb68f7..b44fb68f7 100644 --- a/firmware/microblaze/include/net/eth_mac_addr.h +++ b/firmware/microblaze/lib/net/eth_mac_addr.h diff --git a/firmware/microblaze/include/net/padded_eth_hdr.h b/firmware/microblaze/lib/net/padded_eth_hdr.h index df816734f..df816734f 100644 --- a/firmware/microblaze/include/net/padded_eth_hdr.h +++ b/firmware/microblaze/lib/net/padded_eth_hdr.h diff --git a/firmware/microblaze/include/net/socket_address.h b/firmware/microblaze/lib/net/socket_address.h index 336f30a0c..336f30a0c 100644 --- a/firmware/microblaze/include/net/socket_address.h +++ b/firmware/microblaze/lib/net/socket_address.h diff --git a/firmware/microblaze/lib/nonstdio.c b/firmware/microblaze/lib/nonstdio.c index 1c991afee..4b5fa4123 100644 --- a/firmware/microblaze/lib/nonstdio.c +++ b/firmware/microblaze/lib/nonstdio.c @@ -78,3 +78,46 @@ puthex32_nl(unsigned long x)    puthex32(x);    newline();  } +/* +void reverse(char s[]) +{ +    int c, i, j; + +    for (i = 0, j = strlen(s)-1; i<j; i++, j--) { +        c = s[i]; +        s[i] = s[j]; +        s[j] = c; +    } +} + +int abs(signed long value) { +	return (value >= 0) ? value : 0-value; +} + +//we'll keep the puthex functions above because they're way more lightweight. but sometimes you just want to print in decimal, you know? +char *itoa(signed long value, char *result, int base) +{ +	// check that the base if valid +	if (base < 2 || base > 16) { *result = 0; return result; } + +	char* out = result; +	signed long quotient = value; + +	do { +		*out = hex[ abs(quotient % base) ]; +		++out; +		quotient /= base; +	} while ( quotient ); + +	// Only apply negative sign for base 10 +	if ( value < 0 && base == 10) *out++ = '-'; + +	*out = 0; +	reverse( result ); + +	return result; + +} +*/ + + diff --git a/firmware/microblaze/lib/nonstdio.h b/firmware/microblaze/lib/nonstdio.h index 3fd9e39bb..62ebfa46d 100644 --- a/firmware/microblaze/lib/nonstdio.h +++ b/firmware/microblaze/lib/nonstdio.h @@ -1,4 +1,6 @@ -/* -*- c -*- */ +// +// Copyright 2010 Ettus Research LLC +//  /*   * Copyright 2007 Free Software Foundation, Inc.   * @@ -20,7 +22,7 @@  #define INCLUDED_NONSTDIO_H  #include <stdio.h> -#include <usrp2_types.h> +#include <stdint.h>  #include <stddef.h>  void putstr(const char *s);		// cf puts, no added newline @@ -37,10 +39,10 @@ void puthex32_nl(unsigned long x);  void newline();				// putchar('\n')  void print_mac_addr(const unsigned char addr[6]); -void print_fxpt_freq(u2_fxpt_freq_t v); -void print_fxpt_gain(u2_fxpt_gain_t v);  void print_uint64(uint64_t v);  void print_buffer(uint32_t *buf, size_t n); +//char *itoa(signed long value, char *result, int base); +//void reverse(char s[]);  #endif /* INCLUDED_NONSTDIO_H */ diff --git a/firmware/microblaze/lib/pic.c b/firmware/microblaze/lib/pic.c index 4575bd775..e89d2b755 100644 --- a/firmware/microblaze/lib/pic.c +++ b/firmware/microblaze/lib/pic.c @@ -44,7 +44,7 @@ pic_init(void)    // uP is level triggered    pic_regs->mask = ~0;				       // mask all interrupts -  pic_regs->edge_enable = PIC_ONETIME_INT | PIC_PHY_INT; +  pic_regs->edge_enable = PIC_ONETIME_INT;    pic_regs->polarity = ~0 & ~PIC_PHY_INT;	       // rising edge    pic_regs->pending = ~0;			       // clear all pending ints  } diff --git a/firmware/microblaze/lib/spi.c b/firmware/microblaze/lib/spi.c index 937397df6..bef808e57 100644 --- a/firmware/microblaze/lib/spi.c +++ b/firmware/microblaze/lib/spi.c @@ -43,7 +43,7 @@ spi_transact(bool readback, int slave, uint32_t data, int length, uint32_t flags    spi_wait();    // Tell it which SPI slave device to access -  spi_regs->ss = slave & 0xff; +  spi_regs->ss = slave & 0xffff;    // Data we will send    spi_regs->txrx0 = data; diff --git a/firmware/microblaze/lib/spi.h b/firmware/microblaze/lib/spi.h index f5b69b270..01e4d26fd 100644 --- a/firmware/microblaze/lib/spi.h +++ b/firmware/microblaze/lib/spi.h @@ -48,5 +48,23 @@ void spi_wait(void);  uint32_t  spi_transact(bool readback, int slave, uint32_t data, int length, uint32_t flags); +// ---------------------------------------------------------------- +// Routines that manipulate the FLASH SPI BUS +// ---------------------------------------------------------------- + +/*! + * \brief One time call to initialize SPI + */ +void spif_init(void); + +/*!  + * \brief Wait for last SPI transaction to complete. + * Unless you need to know it completed, it's not necessary to call this. + */ +void spif_wait(void); + +uint32_t +spif_transact(bool readback_, int slave, uint32_t data, int length, uint32_t flags); +  #endif /* INCLUDED_SPI_H */ diff --git a/firmware/microblaze/lib/u2_init.c b/firmware/microblaze/lib/u2_init.c index 6809101c0..75bc40859 100644 --- a/firmware/microblaze/lib/u2_init.c +++ b/firmware/microblaze/lib/u2_init.c @@ -25,9 +25,8 @@  #include "i2c.h"  #include "mdelay.h"  #include "clocks.h" -#include "usrp2_i2c_addr.h" - -//#include "nonstdio.h" +#include "usrp2/fw_common.h" +#include "nonstdio.h"  unsigned char u2_hw_rev_major;  unsigned char u2_hw_rev_minor; @@ -35,8 +34,8 @@ unsigned char u2_hw_rev_minor;  static inline void  get_hw_rev(void)  { -  bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_LSB, &u2_hw_rev_minor, 1); -  ok &= eeprom_read(I2C_ADDR_MBOARD, MBOARD_REV_MSB, &u2_hw_rev_major, 1); +  bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_LSB, &u2_hw_rev_minor, 1); +  ok &= eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, &u2_hw_rev_major, 1);  }  /* @@ -68,7 +67,7 @@ u2_init(void)    mdelay(100);    hal_set_leds(0x1f, 0x1f);    mdelay(100); -  hal_set_leds(0x1, 0x1f);  // Leave the first one on +  hal_set_leds(LED_D, 0x1f);  // Leave one on  #if 0    // test register readback diff --git a/firmware/microblaze/apps/.gitignore b/firmware/microblaze/usrp2/.gitignore index 968b04cd7..18f715618 100644 --- a/firmware/microblaze/apps/.gitignore +++ b/firmware/microblaze/usrp2/.gitignore @@ -1,8 +1,9 @@ -/*.elf +/Makefile +/Makefile.in +/*.a  /*.bin  /*.dump -/*.log +/*.ihx +/*.elf  /*.rom  /*.map -/Makefile -/Makefile.in diff --git a/firmware/microblaze/include/net/Makefile.am b/firmware/microblaze/usrp2/Makefile.am index 32b0bf9dc..8da013980 100644 --- a/firmware/microblaze/include/net/Makefile.am +++ b/firmware/microblaze/usrp2/Makefile.am @@ -17,7 +17,27 @@  include $(top_srcdir)/Makefile.common -noinst_HEADERS = \ -	eth_mac_addr.h \ -	padded_eth_hdr.h \ -	socket_address.h +AM_CFLAGS = \ +	$(COMMON_CFLAGS) + +AM_LDFLAGS = \ +	$(COMMON_LFLAGS) \ +	libusrp2.a \ +	-Wl,-defsym -Wl,_TEXT_START_ADDR=0x0050 \ +	-Wl,-defsym -Wl,_STACK_SIZE=3072 + +######################################################################## +# USRP2 specific library and programs +######################################################################## +noinst_LIBRARIES = libusrp2.a + +libusrp2_a_SOURCES = \ +	$(COMMON_SRCS) \ +	sd.c \ +	ethernet.c + +noinst_PROGRAMS = \ +	usrp2_txrx_uhd.elf + +usrp2_txrx_uhd_elf_SOURCES = \ +	$(top_srcdir)/apps/txrx_uhd.c diff --git a/firmware/microblaze/lib/eth_phy.h b/firmware/microblaze/usrp2/eth_phy.h index 6c16f97b7..6c16f97b7 100644 --- a/firmware/microblaze/lib/eth_phy.h +++ b/firmware/microblaze/usrp2/eth_phy.h diff --git a/firmware/microblaze/lib/ethernet.c b/firmware/microblaze/usrp2/ethernet.c index 34a3ad7c1..d60d7dc4c 100644 --- a/firmware/microblaze/lib/ethernet.c +++ b/firmware/microblaze/usrp2/ethernet.c @@ -25,10 +25,9 @@  #include "nonstdio.h"  #include <stdbool.h>  #include "i2c.h" -#include "usrp2_i2c_addr.h" +#include "usrp2/fw_common.h" - -#define VERBOSE 0 +#define VERBOSE 1  static ethernet_t ed_state;  static ethernet_link_changed_callback_t ed_callback = 0; @@ -302,7 +301,7 @@ ethernet_mac_addr(void)        return &src_mac_addr;      eth_mac_addr_t tmp; -    bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_MAC_ADDR, &tmp, sizeof(tmp)); +    bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, &tmp, sizeof(tmp));      if (!ok || unprogrammed(&tmp, sizeof(tmp))){        // use the default      } @@ -316,7 +315,7 @@ ethernet_mac_addr(void)  bool  ethernet_set_mac_addr(const eth_mac_addr_t *t)  { -  bool ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_MAC_ADDR, t, sizeof(eth_mac_addr_t)); +  bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, t, sizeof(eth_mac_addr_t));    if (ok){      src_mac_addr = *t;      src_mac_addr_initialized = true; @@ -344,7 +343,7 @@ const struct ip_addr *get_ip_addr(void)        return &src_ip_addr;      struct ip_addr tmp; -    bool ok = eeprom_read(I2C_ADDR_MBOARD, MBOARD_IP_ADDR, &tmp, sizeof(tmp)); +    bool ok = eeprom_read(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, &tmp, sizeof(tmp));      if (!ok || unprogrammed(&tmp, sizeof(tmp))){        // use the default      } @@ -356,7 +355,7 @@ const struct ip_addr *get_ip_addr(void)  }  bool set_ip_addr(const struct ip_addr *t){ -  bool ok = eeprom_write(I2C_ADDR_MBOARD, MBOARD_IP_ADDR, t, sizeof(struct ip_addr)); +  bool ok = eeprom_write(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, t, sizeof(struct ip_addr));    if (ok){      src_ip_addr = *t;      src_ip_addr_initialized = true; diff --git a/firmware/microblaze/lib/memory_map.h b/firmware/microblaze/usrp2/memory_map.h index cdf3dd338..41a2820bc 100644 --- a/firmware/microblaze/lib/memory_map.h +++ b/firmware/microblaze/usrp2/memory_map.h @@ -89,6 +89,7 @@ typedef struct {  #define SPI_SS_TX_DAC   32  #define SPI_SS_TX_ADC   64  #define SPI_SS_TX_DB   128 +#define SPI_SS_ADS64P44 256  // Masks for different parts of CTRL reg  #define SPI_CTRL_ASS      (1<<13) @@ -374,6 +375,10 @@ typedef struct {    volatile uint32_t     led_src;        // HW or SW control for LEDs  } output_regs_t; +#define CLK_RESET  (1<<4) +#define CLK_ENABLE (1<<3) | (1<<2) +#define CLK_SEL    (1<<1) | (1<<0) +  #define SERDES_ENABLE 8  #define SERDES_PRBSEN 4  #define SERDES_LOOPEN 2 diff --git a/firmware/microblaze/lib/sd.c b/firmware/microblaze/usrp2/sd.c index d000b28ae..d000b28ae 100644 --- a/firmware/microblaze/lib/sd.c +++ b/firmware/microblaze/usrp2/sd.c diff --git a/firmware/microblaze/lib/sd.h b/firmware/microblaze/usrp2/sd.h index e2d0ae38e..e2d0ae38e 100644 --- a/firmware/microblaze/lib/sd.h +++ b/firmware/microblaze/usrp2/sd.h diff --git a/host/docs/dboards.rst b/host/docs/dboards.rst index 9c496ebee..b85164d04 100644 --- a/host/docs/dboards.rst +++ b/host/docs/dboards.rst @@ -45,7 +45,7 @@ The user may set the receive antenna to be TX/RX or RX2.  However, when using an RFX board in full-duplex mode,  the receive antenna will always be set to RX2, regardless of the settings. -Recieve Gains: **PGA0**, Range: 0-45dB +Recieve Gains: **PGA0**, Range: 0-70dB (except RFX400 range is 0-45dB)  ^^^^^^^^^^^^^^^^^^^^^^^^^^^  XCVR 2450 diff --git a/host/docs/usrp2.rst b/host/docs/usrp2.rst index 76b27fd31..bc4ea0e44 100644 --- a/host/docs/usrp2.rst +++ b/host/docs/usrp2.rst @@ -38,7 +38,7 @@ Run the following commands:      ./configure --host=mb      make -*The image file will be ./apps/txrx_uhd.bin* +*The image file will be ./usrp2/usrp2_txrx_uhd.bin*  ------------------------------------------------------------------------  Load the images onto the SD card @@ -161,7 +161,7 @@ The USRP2 will reply to icmp echo requests.  **Monitor the USRP2:**  You can read the serial port on the rear of the USRP2  to get debug verbose from the embedded microcontroller. -Use a standard USB to tty-level serial converter at 230400 baud. +Use a standard USB to 3.3v-level serial converter at 230400 baud.  The microcontroller prints useful information about IP addresses,  MAC addresses, control packets, and fast-path settings. diff --git a/host/examples/CMakeLists.txt b/host/examples/CMakeLists.txt index 5071b114f..10a9a833a 100644 --- a/host/examples/CMakeLists.txt +++ b/host/examples/CMakeLists.txt @@ -15,6 +15,10 @@  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  # + +ADD_EXECUTABLE(tx_continuous_samples tx_continuous_samples.cpp) +TARGET_LINK_LIBRARIES(tx_continuous_samples uhd) +  ADD_EXECUTABLE(benchmark_rx_rate benchmark_rx_rate.cpp)  TARGET_LINK_LIBRARIES(benchmark_rx_rate uhd) @@ -25,6 +29,7 @@ ADD_EXECUTABLE(tx_timed_samples tx_timed_samples.cpp)  TARGET_LINK_LIBRARIES(tx_timed_samples uhd)  INSTALL(TARGETS +    tx_continuous_samples      benchmark_rx_rate      rx_timed_samples      tx_timed_samples diff --git a/host/examples/tx_continuous_samples.cpp b/host/examples/tx_continuous_samples.cpp new file mode 100644 index 000000000..cf70b07fb --- /dev/null +++ b/host/examples/tx_continuous_samples.cpp @@ -0,0 +1,110 @@ +// +// 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/>. +// + +#include <uhd/utils/thread_priority.hpp> +#include <uhd/utils/safe_main.hpp> +#include <uhd/usrp/simple_usrp.hpp> +#include <boost/program_options.hpp> +#include <boost/thread/thread_time.hpp> //system time +#include <boost/format.hpp> +#include <iostream> +#include <complex> + +namespace po = boost::program_options; + +int UHD_SAFE_MAIN(int argc, char *argv[]){ +    uhd::set_thread_priority_safe(); + +    //variables to be set by po +    std::string args; +    size_t total_duration; +    size_t samps_per_packet; +    double tx_rate, freq; +    float ampl; + +    //setup the program options +    po::options_description desc("Allowed options"); +    desc.add_options() +        ("help", "help message") +        ("args", po::value<std::string>(&args)->default_value(""), "simple uhd device address args") +        ("duration", po::value<size_t>(&total_duration)->default_value(3), "number of seconds to transmit") +        ("spp", po::value<size_t>(&samps_per_packet)->default_value(1000), "number of samples per packet") +        ("txrate", po::value<double>(&tx_rate)->default_value(100e6/16), "rate of outgoing samples") +        ("freq", po::value<double>(&freq)->default_value(0), "rf center frequency in Hz") +        ("ampl", po::value<float>(&l)->default_value(float(0.3)), "amplitude of each sample") +        ("dilv", "specify to disable inner-loop verbose") +    ; +    po::variables_map vm; +    po::store(po::parse_command_line(argc, argv, desc), vm); +    po::notify(vm); + +    //print the help message +    if (vm.count("help")){ +        std::cout << boost::format("UHD TX Continuous Samples %s") % desc << std::endl; +        return ~0; +    } + +    bool verbose = vm.count("dilv") == 0; + +    //create a usrp device +    std::cout << std::endl; +    std::cout << boost::format("Creating the usrp device with: %s...") % args << std::endl; +    uhd::usrp::simple_usrp::sptr sdev = uhd::usrp::simple_usrp::make(args); +    uhd::device::sptr dev = sdev->get_device(); +    std::cout << boost::format("Using Device: %s") % sdev->get_pp_string() << std::endl; + +    //set properties on the device +    std::cout << boost::format("Setting TX Rate: %f Msps...") % (tx_rate/1e6) << std::endl; +    sdev->set_tx_rate(tx_rate); +    std::cout << boost::format("Actual TX Rate: %f Msps...") % (sdev->get_tx_rate()/1e6) << std::endl; +    sdev->set_tx_freq(freq); + +    //allocate data to send +    std::vector<std::complex<float> > buff(samps_per_packet, std::complex<float>(ampl, ampl)); + +    //setup the metadata flags +    uhd::tx_metadata_t md; +    md.start_of_burst = true; //always SOB (good for continuous streaming) +    md.end_of_burst   = false; + +    //send the data in multiple packets +    boost::system_time end_time(boost::get_system_time() + boost::posix_time::seconds(total_duration)); +    while(end_time > boost::get_system_time()){ +        //send samples per packet (driver fragments internally) +        size_t num_tx_samps = dev->send( +            &buff.front(), samps_per_packet, md, +            uhd::io_type_t::COMPLEX_FLOAT32, +            uhd::device::SEND_MODE_FULL_BUFF +        ); +        if(verbose) std::cout << std::endl << boost::format("Sent %d samples") % num_tx_samps << std::endl; +    } + +    //send a mini EOB packet +    if(verbose) std::cout << std::endl << boost::format("Sending packet with end-of-burst") << std::endl; +    md.start_of_burst = false; +    md.end_of_burst   = true; +    dev->send( +        NULL, 0, md, +        uhd::io_type_t::COMPLEX_FLOAT32, +        uhd::device::SEND_MODE_FULL_BUFF +    ); + +    //finished +    std::cout << std::endl << "Done!" << std::endl << std::endl; + +    return 0; +} diff --git a/host/include/uhd/transport/alignment_buffer.ipp b/host/include/uhd/transport/alignment_buffer.ipp index ed7cfd26c..61b3b60f5 100644 --- a/host/include/uhd/transport/alignment_buffer.ipp +++ b/host/include/uhd/transport/alignment_buffer.ipp @@ -57,12 +57,15 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/              std::vector<elem_type> &elems,              const time_duration_t &time          ){ +            boost::system_time exit_time = boost::get_system_time() + time;              buff_contents_type buff_contents_tmp;              std::list<size_t> indexes_to_do(_all_indexes);              //do an initial pop to load an initial sequence id              size_t index = indexes_to_do.front(); -            if (not _buffs[index]->pop_with_timed_wait(buff_contents_tmp, time)) return false; +            if (not _buffs[index]->pop_with_timed_wait( +                buff_contents_tmp, exit_time - boost::get_system_time() +            )) return false;              elems[index] = buff_contents_tmp.first;              seq_type expected_seq_id = buff_contents_tmp.second;              indexes_to_do.pop_front(); @@ -75,7 +78,9 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/                      _there_was_a_clear = false;                      indexes_to_do = _all_indexes;                      index = indexes_to_do.front(); -                    if (not _buffs[index]->pop_with_timed_wait(buff_contents_tmp, time)) return false; +                    if (not _buffs[index]->pop_with_timed_wait( +                        buff_contents_tmp, exit_time - boost::get_system_time() +                    )) return false;                      elems[index] = buff_contents_tmp.first;                      expected_seq_id = buff_contents_tmp.second;                      indexes_to_do.pop_front(); @@ -83,7 +88,9 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/                  //pop an element off for this index                  index = indexes_to_do.front(); -                if (not _buffs[index]->pop_with_timed_wait(buff_contents_tmp, time)) return false; +                if (not _buffs[index]->pop_with_timed_wait( +                    buff_contents_tmp, exit_time - boost::get_system_time() +                )) return false;                  //if the sequence id matches:                  //  store the popped element into the output, diff --git a/host/include/uhd/usrp/dboard_iface.hpp b/host/include/uhd/usrp/dboard_iface.hpp index caf1e6ee6..fc7ea3052 100644 --- a/host/include/uhd/usrp/dboard_iface.hpp +++ b/host/include/uhd/usrp/dboard_iface.hpp @@ -22,6 +22,7 @@  #include <uhd/types/serial.hpp>  #include <boost/shared_ptr.hpp>  #include <boost/cstdint.hpp> +#include <string>  #include <vector>  namespace uhd{ namespace usrp{ @@ -65,6 +66,12 @@ public:      };      /*! +     * Get the motherboard name of the form: usrp1, usrp2... +     * \return string representing the motherboard name +     */ +    virtual std::string get_mboard_name(void) = 0; + +    /*!       * Write to an aux dac.       *       * \param unit which unit rx or tx diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 4899d3dbc..c93884d67 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -44,8 +44,7 @@ ENDMACRO(LIBUHD_PYTHON_GEN_SOURCE)  INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/ic_reg_maps/CMakeLists.txt)  INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/transport/CMakeLists.txt)  INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/CMakeLists.txt) -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/dboard/CMakeLists.txt) -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/usrp/usrp2/CMakeLists.txt) +INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/utils/CMakeLists.txt)  ########################################################################  # Setup defines for process scheduling @@ -112,11 +111,7 @@ CONFIGURE_FILE(  LIBUHD_APPEND_SOURCES(      ${CMAKE_CURRENT_SOURCE_DIR}/device.cpp -    ${CMAKE_CURRENT_SOURCE_DIR}/gain_group.cpp -    ${CMAKE_CURRENT_SOURCE_DIR}/load_modules.cpp -    ${CMAKE_CURRENT_SOURCE_DIR}/thread_priority.cpp      ${CMAKE_CURRENT_SOURCE_DIR}/types.cpp -    ${CMAKE_CURRENT_SOURCE_DIR}/utils.cpp      ${CMAKE_CURRENT_BINARY_DIR}/version.cpp      ${CMAKE_CURRENT_SOURCE_DIR}/wax.cpp  ) diff --git a/host/lib/usrp/CMakeLists.txt b/host/lib/usrp/CMakeLists.txt index 4f0710b20..da3e87a68 100644 --- a/host/lib/usrp/CMakeLists.txt +++ b/host/lib/usrp/CMakeLists.txt @@ -29,3 +29,6 @@ LIBUHD_APPEND_SOURCES(      ${CMAKE_SOURCE_DIR}/lib/usrp/simple_usrp.cpp      ${CMAKE_SOURCE_DIR}/lib/usrp/tune_helper.cpp  ) + +INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/dboard/CMakeLists.txt) +INCLUDE(${CMAKE_SOURCE_DIR}/lib/usrp/usrp2/CMakeLists.txt) diff --git a/host/lib/usrp/dboard/db_rfx.cpp b/host/lib/usrp/dboard/db_rfx.cpp index 914ca5e19..b6b44199a 100644 --- a/host/lib/usrp/dboard/db_rfx.cpp +++ b/host/lib/usrp/dboard/db_rfx.cpp @@ -43,6 +43,7 @@  #include <uhd/utils/assert.hpp>  #include <uhd/utils/static.hpp>  #include <uhd/utils/algorithm.hpp> +#include <uhd/usrp/dboard_id.hpp>  #include <uhd/usrp/dboard_base.hpp>  #include <uhd/usrp/dboard_manager.hpp>  #include <boost/assign/list_of.hpp> @@ -65,6 +66,10 @@ static const prop_names_t rfx_rx_antennas = list_of("TX/RX")("RX2");  static const uhd::dict<std::string, gain_range_t> rfx_tx_gain_ranges; //empty  static const uhd::dict<std::string, gain_range_t> rfx_rx_gain_ranges = map_list_of +    ("PGA0", gain_range_t(0, 70, float(0.022))) +; + +static const uhd::dict<std::string, gain_range_t> rfx400_rx_gain_ranges = map_list_of      ("PGA0", gain_range_t(0, 45, float(0.022)))  ; @@ -88,6 +93,7 @@ public:  private:      freq_range_t _freq_range; +    uhd::dict<std::string, gain_range_t> _rx_gain_ranges;      uhd::dict<dboard_iface::unit_t, bool> _div2;      double       _rx_lo_freq, _tx_lo_freq;      std::string  _rx_ant; @@ -166,6 +172,14 @@ rfx_xcvr::rfx_xcvr(      _div2[dboard_iface::UNIT_RX] = rx_div2;      _div2[dboard_iface::UNIT_TX] = tx_div2; +    if(this->get_rx_id() == 0x0024) { //RFX400 +        _rx_gain_ranges = rfx400_rx_gain_ranges; +    } +    else { +        _rx_gain_ranges = rfx_rx_gain_ranges; +    } + +      //enable the clocks that we need      this->get_iface()->set_clock_enabled(dboard_iface::UNIT_TX, true);      this->get_iface()->set_clock_enabled(dboard_iface::UNIT_RX, true); @@ -193,8 +207,8 @@ rfx_xcvr::rfx_xcvr(      set_tx_lo_freq((_freq_range.min + _freq_range.max)/2.0);      set_rx_ant("RX2"); -    BOOST_FOREACH(const std::string &name, rfx_rx_gain_ranges.keys()){ -        set_rx_gain(rfx_rx_gain_ranges[name].min, name); +    BOOST_FOREACH(const std::string &name, _rx_gain_ranges.keys()){ +        set_rx_gain(_rx_gain_ranges[name].min, name);      }  } @@ -227,10 +241,10 @@ void rfx_xcvr::set_tx_ant(const std::string &ant){  /***********************************************************************   * Gain Handling   **********************************************************************/ -static float rx_pga0_gain_to_dac_volts(float &gain){ +static float rx_pga0_gain_to_dac_volts(float &gain, float range){      //voltage level constants (negative slope)      static const float max_volts = float(.2), min_volts = float(1.2); -    static const float slope = (max_volts-min_volts)/45; +    static const float slope = (max_volts-min_volts)/(range);      //calculate the voltage for the aux dac      float dac_volts = std::clip<float>(gain*slope + min_volts, max_volts, min_volts); @@ -247,9 +261,10 @@ void rfx_xcvr::set_tx_gain(float, const std::string &name){  }  void rfx_xcvr::set_rx_gain(float gain, const std::string &name){ -    assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name"); +    assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name");      if(name == "PGA0"){ -        float dac_volts = rx_pga0_gain_to_dac_volts(gain); +        float dac_volts = rx_pga0_gain_to_dac_volts(gain,  +                              (_rx_gain_ranges["PGA0"].max - _rx_gain_ranges["PGA0"].min));          _rx_gains[name] = gain;          //write the new voltage to the aux dac @@ -402,12 +417,12 @@ void rfx_xcvr::rx_get(const wax::obj &key_, wax::obj &val){          return;      case SUBDEV_PROP_GAIN_RANGE: -        assert_has(rfx_rx_gain_ranges.keys(), name, "rfx rx gain name"); -        val = rfx_rx_gain_ranges[name]; +        assert_has(_rx_gain_ranges.keys(), name, "rfx rx gain name"); +        val = _rx_gain_ranges[name];          return;      case SUBDEV_PROP_GAIN_NAMES: -        val = prop_names_t(rfx_rx_gain_ranges.keys()); +        val = prop_names_t(_rx_gain_ranges.keys());          return;      case SUBDEV_PROP_FREQ: diff --git a/host/lib/usrp/usrp2/dboard_iface.cpp b/host/lib/usrp/usrp2/dboard_iface.cpp index 6f2fb9396..1b9a4bb97 100644 --- a/host/lib/usrp/usrp2/dboard_iface.cpp +++ b/host/lib/usrp/usrp2/dboard_iface.cpp @@ -37,6 +37,8 @@ public:      usrp2_dboard_iface(usrp2_iface::sptr iface, usrp2_clock_ctrl::sptr clock_ctrl);      ~usrp2_dboard_iface(void); +    std::string get_mboard_name(void){return "usrp2";} +      void write_aux_dac(unit_t, aux_dac_t, float);      float read_aux_adc(unit_t, aux_adc_t); diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index e0d6beafc..4309f43aa 100644 --- a/host/lib/usrp/usrp2/dboard_impl.cpp +++ b/host/lib/usrp/usrp2/dboard_impl.cpp @@ -35,8 +35,8 @@ using namespace uhd::usrp;   **********************************************************************/  void usrp2_mboard_impl::dboard_init(void){      //read the dboard eeprom to extract the dboard ids -    _rx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(I2C_ADDR_RX_DB, 0, dboard_eeprom_t::num_bytes())); -    _tx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(I2C_ADDR_TX_DB, 0, dboard_eeprom_t::num_bytes())); +    _rx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(USRP2_I2C_ADDR_RX_DB, 0, dboard_eeprom_t::num_bytes())); +    _tx_db_eeprom = dboard_eeprom_t(_iface->read_eeprom(USRP2_I2C_ADDR_TX_DB, 0, dboard_eeprom_t::num_bytes()));      //create a new dboard interface and manager      _dboard_iface = make_usrp2_dboard_iface(_iface, _clock_ctrl); @@ -121,7 +121,7 @@ void usrp2_mboard_impl::rx_dboard_set(const wax::obj &key, const wax::obj &val){      case DBOARD_PROP_DBOARD_ID:          _rx_db_eeprom.id = val.as<dboard_id_t>(); -        _iface->write_eeprom(I2C_ADDR_RX_DB, 0, _rx_db_eeprom.get_eeprom_bytes()); +        _iface->write_eeprom(USRP2_I2C_ADDR_RX_DB, 0, _rx_db_eeprom.get_eeprom_bytes());          return;      default: UHD_THROW_PROP_SET_ERROR(); @@ -190,7 +190,7 @@ void usrp2_mboard_impl::tx_dboard_set(const wax::obj &key, const wax::obj &val){      case DBOARD_PROP_DBOARD_ID:          _tx_db_eeprom.id = val.as<dboard_id_t>(); -        _iface->write_eeprom(I2C_ADDR_TX_DB, 0, _tx_db_eeprom.get_eeprom_bytes()); +        _iface->write_eeprom(USRP2_I2C_ADDR_TX_DB, 0, _tx_db_eeprom.get_eeprom_bytes());          return;      default: UHD_THROW_PROP_SET_ERROR(); diff --git a/host/lib/usrp/usrp2/fw_common.h b/host/lib/usrp/usrp2/fw_common.h index fd728e393..c4dabf5bc 100644 --- a/host/lib/usrp/usrp2/fw_common.h +++ b/host/lib/usrp/usrp2/fw_common.h @@ -44,6 +44,22 @@ extern "C" {  #define USRP2_UDP_CTRL_PORT 49152  #define USRP2_UDP_DATA_PORT 49153 +//////////////////////////////////////////////////////////////////////// +// I2C addresses +//////////////////////////////////////////////////////////////////////// +#define USRP2_I2C_DEV_EEPROM  0x50 // 24LC02[45]:  7-bits 1010xxx +#define	USRP2_I2C_ADDR_MBOARD (USRP2_I2C_DEV_EEPROM | 0x0) +#define	USRP2_I2C_ADDR_TX_DB  (USRP2_I2C_DEV_EEPROM | 0x4) +#define	USRP2_I2C_ADDR_RX_DB  (USRP2_I2C_DEV_EEPROM | 0x5) + +//////////////////////////////////////////////////////////////////////// +// EEPROM Layout +//////////////////////////////////////////////////////////////////////// +#define USRP2_EE_MBOARD_REV_LSB  0x00 //1 byte +#define USRP2_EE_MBOARD_REV_MSB  0x01 //1 byte +#define USRP2_EE_MBOARD_MAC_ADDR 0x02 //6 bytes +#define USRP2_EE_MBOARD_IP_ADDR  0x0C //uint32, big-endian +  typedef enum{      USRP2_CTRL_ID_HUH_WHAT = ' ',      //USRP2_CTRL_ID_FOR_SURE, //TODO error condition enums diff --git a/host/lib/usrp/usrp2/io_impl.cpp b/host/lib/usrp/usrp2/io_impl.cpp index aa6d15783..9e29edd82 100644 --- a/host/lib/usrp/usrp2/io_impl.cpp +++ b/host/lib/usrp/usrp2/io_impl.cpp @@ -144,11 +144,13 @@ void usrp2_impl::io_impl::recv_pirate_loop(   **********************************************************************/  void usrp2_impl::io_init(void){      //send a small data packet so the usrp2 knows the udp source port -    for(size_t i = 0; i < _data_transports.size(); i++){ -        managed_send_buffer::sptr send_buff = _data_transports[i]->get_send_buff(); -        boost::uint32_t data = htonl(USRP2_INVALID_VRT_HEADER); -        memcpy(send_buff->cast<void*>(), &data, sizeof(data)); +    BOOST_FOREACH(zero_copy_if::sptr data_transport, _data_transports){ +        managed_send_buffer::sptr send_buff = data_transport->get_send_buff(); +        static const boost::uint32_t data = htonl(USRP2_INVALID_VRT_HEADER); +        std::memcpy(send_buff->cast<void*>(), &data, sizeof(data));          send_buff->commit(sizeof(data)); +        //drain the recv buffers (may have junk) +        while (data_transport->get_recv_buff().get());      }      //the number of recv frames is the number for the first transport diff --git a/host/lib/usrp/usrp2/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 7ec1b9cbd..4dab00ce2 100644 --- a/host/lib/usrp/usrp2/mboard_impl.cpp +++ b/host/lib/usrp/usrp2/mboard_impl.cpp @@ -45,8 +45,8 @@ usrp2_mboard_impl::usrp2_mboard_impl(      _iface = usrp2_iface::make(ctrl_transport);      //extract the mboard rev numbers -    _rev_lo = _iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_REV_LSB, 1).at(0); -    _rev_hi = _iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_REV_MSB, 1).at(0); +    _rev_lo = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_LSB, 1).at(0); +    _rev_hi = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_REV_MSB, 1).at(0);      //contruct the interfaces to mboard perifs      _clock_ctrl = usrp2_clock_ctrl::make(_iface); @@ -85,6 +85,7 @@ usrp2_mboard_impl::usrp2_mboard_impl(      _iface->poke32(U2_REG_TX_CTRL_NUM_CHAN, 0);    //1 channel      _iface->poke32(U2_REG_TX_CTRL_CLEAR_STATE, 1); //reset      _iface->poke32(U2_REG_TX_CTRL_REPORT_SID, 1);  //sid 1 (different from rx) +    _iface->poke32(U2_REG_TX_CTRL_POLICY, U2_FLAG_TX_CTRL_POLICY_NEXT_PACKET);      //init the ddc      init_ddc_config(); @@ -100,6 +101,11 @@ usrp2_mboard_impl::usrp2_mboard_impl(      //init the tx and rx dboards (do last)      dboard_init(); + +    //Issue a stop streaming command (in case it was left running). +    //Since this command is issued before the networking is setup, +    //most if not all junk packets will never make it to the socket. +    this->issue_ddc_stream_cmd(stream_cmd_t::STREAM_MODE_STOP_CONTINUOUS);  }  usrp2_mboard_impl::~usrp2_mboard_impl(void){ @@ -182,14 +188,14 @@ void usrp2_mboard_impl::get(const wax::obj &key_, wax::obj &val){      //handle the other props      if (key.type() == typeid(std::string)){          if (key.as<std::string>() == "mac-addr"){ -            byte_vector_t bytes = _iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_MAC_ADDR, 6); +            byte_vector_t bytes = _iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, 6);              val = mac_addr_t::from_bytes(bytes).to_string();              return;          }          if (key.as<std::string>() == "ip-addr"){              boost::asio::ip::address_v4::bytes_type bytes; -            std::copy(_iface->read_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_IP_ADDR, 4), bytes); +            std::copy(_iface->read_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, 4), bytes);              val = boost::asio::ip::address_v4(bytes).to_string();              return;          } @@ -272,14 +278,14 @@ void usrp2_mboard_impl::set(const wax::obj &key, const wax::obj &val){      if (key.type() == typeid(std::string)){          if (key.as<std::string>() == "mac-addr"){              byte_vector_t bytes = mac_addr_t::from_string(val.as<std::string>()).to_bytes(); -            _iface->write_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_MAC_ADDR, bytes); +            _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_MAC_ADDR, bytes);              return;          }          if (key.as<std::string>() == "ip-addr"){              byte_vector_t bytes(4);              std::copy(boost::asio::ip::address_v4::from_string(val.as<std::string>()).to_bytes(), bytes); -            _iface->write_eeprom(I2C_ADDR_MBOARD, EE_MBOARD_IP_ADDR, bytes); +            _iface->write_eeprom(USRP2_I2C_ADDR_MBOARD, USRP2_EE_MBOARD_IP_ADDR, bytes);              return;          }      } diff --git a/host/lib/usrp/usrp2/usrp2_iface.hpp b/host/lib/usrp/usrp2/usrp2_iface.hpp index 9cc32104e..12fd4730a 100644 --- a/host/lib/usrp/usrp2/usrp2_iface.hpp +++ b/host/lib/usrp/usrp2/usrp2_iface.hpp @@ -26,22 +26,6 @@  #include <utility>  #include "fw_common.h" -//////////////////////////////////////////////////////////////////////// -// I2C addresses -//////////////////////////////////////////////////////////////////////// -#define I2C_DEV_EEPROM  0x50 // 24LC02[45]:  7-bits 1010xxx -#define	I2C_ADDR_MBOARD (I2C_DEV_EEPROM | 0x0) -#define	I2C_ADDR_TX_DB  (I2C_DEV_EEPROM | 0x4) -#define	I2C_ADDR_RX_DB  (I2C_DEV_EEPROM | 0x5) - -//////////////////////////////////////////////////////////////////////// -// EEPROM Layout -//////////////////////////////////////////////////////////////////////// -#define EE_MBOARD_REV_LSB  0x00 //1 byte -#define EE_MBOARD_REV_MSB  0x01 //1 byte -#define EE_MBOARD_MAC_ADDR 0x02 //6 bytes -#define EE_MBOARD_IP_ADDR  0x0C //uint32, big-endian -  /*!   * The usrp2 interface class:   * Provides a set of functions to implementation layer. diff --git a/host/lib/usrp/usrp2/usrp2_regs.hpp b/host/lib/usrp/usrp2/usrp2_regs.hpp index aa8bd860f..cc9094ae7 100644 --- a/host/lib/usrp/usrp2/usrp2_regs.hpp +++ b/host/lib/usrp/usrp2/usrp2_regs.hpp @@ -247,5 +247,10 @@  #define U2_REG_TX_CTRL_NUM_CHAN          _SR_ADDR(SR_TX_CTRL + 0)  #define U2_REG_TX_CTRL_CLEAR_STATE       _SR_ADDR(SR_TX_CTRL + 1)  #define U2_REG_TX_CTRL_REPORT_SID        _SR_ADDR(SR_TX_CTRL + 2) +#define U2_REG_TX_CTRL_POLICY            _SR_ADDR(SR_TX_CTRL + 3) + +#define U2_FLAG_TX_CTRL_POLICY_WAIT          (0x1 << 0) +#define U2_FLAG_TX_CTRL_POLICY_NEXT_PACKET   (0x1 << 1) +#define U2_FLAG_TX_CTRL_POLICY_NEXT_BURST    (0x1 << 2)  #endif /* INCLUDED_USRP2_REGS_HPP */ diff --git a/firmware/microblaze/include/Makefile.am b/host/lib/utils/CMakeLists.txt index 6afbbcd12..ee2cb0d76 100644 --- a/firmware/microblaze/include/Makefile.am +++ b/host/lib/utils/CMakeLists.txt @@ -1,8 +1,6 @@  #  # Copyright 2010 Ettus Research LLC  # -# Copyright 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 @@ -17,14 +15,12 @@  # along with this program.  If not, see <http://www.gnu.org/licenses/>.  # -include $(top_srcdir)/Makefile.common - -SUBDIRS = net +#This file will be included by cmake, use absolute paths! -noinst_HEADERS = \ -    usrp2_fpga_regs.h \ -    usrp2_i2c_addr.h \ -    usrp2_clock_bits.h \ -    usrp2_types.h \ -    vrt/bits.h \ -    vrt/types.h +LIBUHD_APPEND_SOURCES( +    ${CMAKE_SOURCE_DIR}/lib/utils/assert.cpp +    ${CMAKE_SOURCE_DIR}/lib/utils/gain_group.cpp +    ${CMAKE_SOURCE_DIR}/lib/utils/load_modules.cpp +    ${CMAKE_SOURCE_DIR}/lib/utils/props.cpp +    ${CMAKE_SOURCE_DIR}/lib/utils/thread_priority.cpp +) diff --git a/host/lib/utils/assert.cpp b/host/lib/utils/assert.cpp new file mode 100644 index 000000000..7ace9024c --- /dev/null +++ b/host/lib/utils/assert.cpp @@ -0,0 +1,24 @@ +// +// 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/>. +// + +#include <uhd/utils/assert.hpp> + +using namespace uhd; + +assert_error::assert_error(const std::string &what) : std::runtime_error(what){ +    /* NOP */ +} diff --git a/host/lib/gain_group.cpp b/host/lib/utils/gain_group.cpp index 5a14fa96f..5a14fa96f 100644 --- a/host/lib/gain_group.cpp +++ b/host/lib/utils/gain_group.cpp diff --git a/host/lib/load_modules.cpp b/host/lib/utils/load_modules.cpp index dbb8d0695..dbb8d0695 100644 --- a/host/lib/load_modules.cpp +++ b/host/lib/utils/load_modules.cpp diff --git a/host/lib/utils.cpp b/host/lib/utils/props.cpp index d2f4dfc6e..fac5fe24f 100644 --- a/host/lib/utils.cpp +++ b/host/lib/utils/props.cpp @@ -15,28 +15,18 @@  // along with this program.  If not, see <http://www.gnu.org/licenses/>.  // -#include <uhd/utils/assert.hpp>  #include <uhd/utils/props.hpp> -#include <stdexcept>  using namespace uhd; -/*********************************************************************** - * Assert - **********************************************************************/ -assert_error::assert_error(const std::string &what) : std::runtime_error(what){ -    /* NOP */ -} - -/*********************************************************************** - * Props - **********************************************************************/  named_prop_t::named_prop_t( -    const wax::obj &key_, -    const std::string &name_ -){ -    key = key_; -    name = name_; +    const wax::obj &key, +    const std::string &name +): +    key(key), +    name(name) +{ +    /* NOP */  }  typedef boost::tuple<wax::obj, std::string> named_prop_tuple; diff --git a/host/lib/thread_priority.cpp b/host/lib/utils/thread_priority.cpp index c35e5fcb1..c35e5fcb1 100644 --- a/host/lib/thread_priority.cpp +++ b/host/lib/utils/thread_priority.cpp | 
