diff options
-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 | 3 | ||||
-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/net/Makefile.am | 23 | ||||
-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/Makefile.am) | 33 | ||||
-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/usrp2.rst | 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/mboard_impl.cpp | 12 | ||||
-rw-r--r-- | host/lib/usrp/usrp2/usrp2_iface.hpp | 16 |
90 files changed, 305 insertions, 938 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 6b45f8f3b..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){ 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/net/Makefile.am b/firmware/microblaze/include/net/Makefile.am deleted file mode 100644 index 32b0bf9dc..000000000 --- a/firmware/microblaze/include/net/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -# -# Copyright 2010 Ettus Research LLC -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# - -include $(top_srcdir)/Makefile.common - -noinst_HEADERS = \ - eth_mac_addr.h \ - padded_eth_hdr.h \ - socket_address.h 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/Makefile.am b/firmware/microblaze/usrp2/Makefile.am index 6afbbcd12..8da013980 100644 --- a/firmware/microblaze/include/Makefile.am +++ b/firmware/microblaze/usrp2/Makefile.am @@ -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 @@ -19,12 +17,27 @@ include $(top_srcdir)/Makefile.common -SUBDIRS = net +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 -noinst_HEADERS = \ - usrp2_fpga_regs.h \ - usrp2_i2c_addr.h \ - usrp2_clock_bits.h \ - usrp2_types.h \ - vrt/bits.h \ - vrt/types.h +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/usrp2.rst b/host/docs/usrp2.rst index 76b27fd31..7951e00d6 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 diff --git a/host/lib/usrp/usrp2/dboard_impl.cpp b/host/lib/usrp/usrp2/dboard_impl.cpp index 8942f9d31..0aeb0ec1a 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); @@ -111,7 +111,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(); @@ -170,7 +170,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/mboard_impl.cpp b/host/lib/usrp/usrp2/mboard_impl.cpp index 3d103c940..7694a164d 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); @@ -185,14 +185,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; } @@ -275,14 +275,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. |