diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/fx2/b100/CMakeLists.txt | 6 | ||||
-rw-r--r-- | firmware/fx2/usrp1/CMakeLists.txt | 6 | ||||
-rw-r--r-- | firmware/fx3/b200/b200_main.c | 10 | ||||
-rw-r--r-- | firmware/fx3/b200/b200_main.h | 2 | ||||
-rw-r--r-- | firmware/usrp3/lib/CMakeLists.txt | 1 | ||||
-rw-r--r-- | firmware/usrp3/n230/CMakeLists.txt | 7 | ||||
-rw-r--r-- | firmware/usrp3/n230/n230_eth_handlers.c | 2 | ||||
-rw-r--r-- | firmware/usrp3/n230/n230_fw_comm_protocol.c (renamed from firmware/usrp3/lib/fw_comm_protocol.c) | 2 | ||||
-rwxr-xr-x | firmware/usrp3/x300/x300_aurora_bist.py | 40 |
9 files changed, 42 insertions, 34 deletions
diff --git a/firmware/fx2/b100/CMakeLists.txt b/firmware/fx2/b100/CMakeLists.txt index 438aa9207..18bc2080a 100644 --- a/firmware/fx2/b100/CMakeLists.txt +++ b/firmware/fx2/b100/CMakeLists.txt @@ -84,5 +84,11 @@ add_custom_target(b100_eeprom ALL COMMAND ${PYTHON_EXECUTABLE} ${BUILD_EEPROM} -r2 b100_boot.bin b100_eeprom.bin ) +add_custom_target(b100_eeprom_header ALL + DEPENDS b100_eeprom + COMMAND xxd -i b100_eeprom.bin ${CMAKE_SOURCE_DIR}/../../host/utils/b100_eeprom.h + COMMAND sed -i 's/char/const char/' ${CMAKE_SOURCE_DIR}/../../host/utils/b100_eeprom.h +) + add_executable(b100_boot ${eeprom1p_sources}) target_link_libraries(b100_boot libb100) diff --git a/firmware/fx2/usrp1/CMakeLists.txt b/firmware/fx2/usrp1/CMakeLists.txt index 6607bc7f2..8b5389535 100644 --- a/firmware/fx2/usrp1/CMakeLists.txt +++ b/firmware/fx2/usrp1/CMakeLists.txt @@ -80,5 +80,11 @@ add_custom_target(usrp1_eeprom ALL COMMAND ${PYTHON_EXECUTABLE} ${BUILD_EEPROM} -r1 usrp1_boot.bin usrp1_eeprom.bin ) +add_custom_target(usrp1_eeprom_header ALL + DEPENDS usrp1_eeprom + COMMAND xxd -i usrp1_eeprom.bin ${CMAKE_SOURCE_DIR}/../../host/utils/usrp1_eeprom.h + COMMAND sed -i 's/char/const char/' ${CMAKE_SOURCE_DIR}/../../host/utils/usrp1_eeprom.h +) + add_executable(usrp1_boot ${eeprom1_sources}) target_link_libraries(usrp1_boot libusrp1) diff --git a/firmware/fx3/b200/b200_main.c b/firmware/fx3/b200/b200_main.c index e552d3177..e5c55d6a7 100644 --- a/firmware/fx3/b200/b200_main.c +++ b/firmware/fx3/b200/b200_main.c @@ -228,7 +228,7 @@ typedef struct Config { int enable_as_superspeed; // 1 int pport_drive_strength; // CY_U3P_DS_THREE_QUARTER_STRENGTH int dma_buffer_size; // [USB3] (max) - int dma_buffer_count; // [USB3] 1 + int dma_buffer_count; // [USB3] 2 int manual_dma; // 0 int sb_baud_div; // 434*2 } CONFIG, *PCONFIG; @@ -244,8 +244,8 @@ static CONFIG g_config = { 0, // disable_usb2 1, // enable_as_superspeed CY_U3P_DS_THREE_QUARTER_STRENGTH, // pport_drive_strength - 64512, // dma_buffer_size 2**16-1, then aligned to next page boundary - 1, // dma_buffer_count + 16*1024, // dma_buffer_size - optimized value from Cypress AN86947 + 2, // dma_buffer_count - optimized value from Cypress AN86947 0, // manual_dma 434*2 // sb_baud_div }; @@ -1175,7 +1175,7 @@ void b200_fw_start(void) { data_buffer_size_from_host = data_buffer_size; g_vendor_req_buff_size = USB3_VREQ_BUF_SIZE; // Max 512 - num_packets_per_burst = USB3_PACKETS_PER_BURST*1+4*0; // 16 + num_packets_per_burst = USB3_PACKETS_PER_BURST; // 8 break; case CY_U3P_NOT_CONNECTED: @@ -1529,7 +1529,7 @@ void event_usb_callback (CyU3PUsbEventType_t event_type, uint16_t event_data) { * of this function is to register that the event happened at all, so that the * application thread knows it can proceed. * - * This function is also responsible for receiving vendor requests, and trigging + * This function is also responsible for receiving vendor requests, and triggering * the appropriate RTOS event to wake up the vendor request handler thread. */ CyBool_t usb_setup_callback(uint32_t data0, uint32_t data1) { diff --git a/firmware/fx3/b200/b200_main.h b/firmware/fx3/b200/b200_main.h index 9fe8b9511..453e7034a 100644 --- a/firmware/fx3/b200/b200_main.h +++ b/firmware/fx3/b200/b200_main.h @@ -41,7 +41,7 @@ #define MASK_GPIO_FPGA_SB_SCL (uint32_t)(1 << (GPIO_FPGA_SB_SCL - 0)) #define MASK_GPIO_FPGA_SB_SDA (uint32_t)(1 << (GPIO_FPGA_SB_SDA - 0)) -#define USB3_PACKETS_PER_BURST (16) +#define USB3_PACKETS_PER_BURST (8) // Optimized value from Cypress AN86947 #define USB2_PACKETS_PER_BURST (1) #define DMA_SIZE_INFINITE (0) diff --git a/firmware/usrp3/lib/CMakeLists.txt b/firmware/usrp3/lib/CMakeLists.txt index 9d9ee3c6c..cd1a82c3f 100644 --- a/firmware/usrp3/lib/CMakeLists.txt +++ b/firmware/usrp3/lib/CMakeLists.txt @@ -30,7 +30,6 @@ add_library(usrp3fw STATIC print_addrs.c link_state_route_proto.c cron.c - fw_comm_protocol.c flash/spi_flash.c flash/spif_spsn_s25flxx.c ) diff --git a/firmware/usrp3/n230/CMakeLists.txt b/firmware/usrp3/n230/CMakeLists.txt index 6247477f0..5787fbb7d 100644 --- a/firmware/usrp3/n230/CMakeLists.txt +++ b/firmware/usrp3/n230/CMakeLists.txt @@ -19,7 +19,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) include_directories(${CMAKE_SOURCE_DIR}/../../host/lib/usrp/n230) -list(APPEND n230_sources n230_eeprom.c n230_eth_handlers.c n230_init.c n230_main.c) +list(APPEND n230_sources + n230_eeprom.c + n230_fw_comm_protocol.c + n230_eth_handlers.c + n230_init.c + n230_main.c) ######################################################################## set(GEN_OUTPUTS_BIN_SIZE 0x7fff) diff --git a/firmware/usrp3/n230/n230_eth_handlers.c b/firmware/usrp3/n230/n230_eth_handlers.c index b291bb39f..f5c319681 100644 --- a/firmware/usrp3/n230/n230_eth_handlers.c +++ b/firmware/usrp3/n230/n230_eth_handlers.c @@ -22,7 +22,7 @@ #include <u3_net_stack.h> #include <print_addrs.h> #include <trace.h> -#include "../../../host/lib/usrp/common/fw_comm_protocol.h" +#include "../../../host/lib/usrp/n230/n230_fw_comm_protocol.h" #include "../../../host/lib/usrp/n230/n230_fw_defs.h" #include "../n230/n230_fw_host_iface.h" #include "../../../host/lib/usrp/n230/n230_eeprom.h" diff --git a/firmware/usrp3/lib/fw_comm_protocol.c b/firmware/usrp3/n230/n230_fw_comm_protocol.c index 0cc931a76..d6f6dff5a 100644 --- a/firmware/usrp3/lib/fw_comm_protocol.c +++ b/firmware/usrp3/n230/n230_fw_comm_protocol.c @@ -15,7 +15,7 @@ // along with this program. If not, see <http://www.gnu.org/licenses/>. // -#include "../../../host/lib/usrp/common/fw_comm_protocol.h" +#include "../../../host/lib/usrp/n230/n230_fw_comm_protocol.h" #include <trace.h> #include <string.h> //memcmp diff --git a/firmware/usrp3/x300/x300_aurora_bist.py b/firmware/usrp3/x300/x300_aurora_bist.py index f5e119b66..5f7a22a3b 100755 --- a/firmware/usrp3/x300/x300_aurora_bist.py +++ b/firmware/usrp3/x300/x300_aurora_bist.py @@ -43,8 +43,9 @@ SFP_TYPE_AURORA = 2 MAC_REG_CTRL = 0 MAC_REG_STATUS = 0 MAC_REG_OVERRUNS = 4 -MAC_REG_BIST_SAMPS = 8 -MAC_REG_BIST_ERRORS = 12 +MAC_REG_CHECKSUM_ERRS = 8 +MAC_REG_BIST_SAMPS = 12 +MAC_REG_BIST_ERRORS = 16 MAC_STATUS_LINK_UP_MSK = 0x00000001 MAC_STATUS_HARD_ERR_MSK = 0x00000002 @@ -52,19 +53,16 @@ MAC_STATUS_SOFT_ERR_MSK = 0x00000004 MAC_STATUS_BIST_LOCKED_MSK = 0x00000008 MAC_STATUS_BIST_LATENCY_MSK = 0x000FFFF0 MAC_STATUS_BIST_LATENCY_OFFSET = 4 -MAC_STATUS_CHECKSUM_ERRS_MSK = 0xFFF00000 -MAC_STATUS_CHECKSUM_ERRS_OFFSET = 20 MAC_CTRL_BIST_CHECKER_EN = 0x00000001 MAC_CTRL_BIST_GEN_EN = 0x00000002 MAC_CTRL_BIST_LOOPBACK_EN = 0x00000004 -MAC_CTRL_PHY_RESET = 0x00000100 -MAC_CTRL_BIST_RATE_MSK = 0x000000F8 +MAC_CTRL_PHY_RESET = 0x00000200 +MAC_CTRL_BIST_RATE_MSK = 0x000001F8 MAC_CTRL_BIST_RATE_OFFSET = 3 -AURORA_CLK_RATE = 156.25e6 BUS_CLK_RATE = 166.66e6 -BIST_MAX_TIME_LIMIT = math.floor(pow(2,48)/AURORA_CLK_RATE)-1 +BIST_MAX_TIME_LIMIT = math.floor(pow(2,48)/BUS_CLK_RATE)-1 ######################################################################## # utils @@ -83,10 +81,11 @@ def get_aurora_info(ctrl): return (aur_port, link_up) def get_rate_setting(rate): - for div in range(2,32): - if (rate < 8e-6 * BUS_CLK_RATE * (1.0 - 1.0/div)): - return (div-1, 8e-6 * BUS_CLK_RATE * (1.0 - 1.0/(div-1))) - return (0, 8e-6 * BUS_CLK_RATE) + RATE_RES_BITS = 6 + rate_sett = int((1.0*rate/(8e-6*BUS_CLK_RATE))*pow(2, RATE_RES_BITS))-1 # Round rate down + rate_sett = numpy.clip(rate_sett, 0, pow(2, RATE_RES_BITS)-1) + coerced_rate = ((1.0+rate_sett)/pow(2, RATE_RES_BITS))*(8e-6*BUS_CLK_RATE) + return (rate_sett, coerced_rate) def run_ber_loopback_bist(ctrls, duration, rate_tuple): (rate_sett, rate) = rate_tuple @@ -107,10 +106,7 @@ def run_ber_loopback_bist(ctrls, duration, rate_tuple): # Put the slave in loopback mode and the master in BIST mode if 'slave' in ctrls: ctrls['slave'].poke(SLA_MAC_REG_BASE + MAC_REG_CTRL, MAC_CTRL_BIST_LOOPBACK_EN) - if rate_sett == 0: - master_ctrl = MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN - else: - master_ctrl = ((rate_sett - 1) << MAC_CTRL_BIST_RATE_OFFSET)|MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN + master_ctrl = (rate_sett<<MAC_CTRL_BIST_RATE_OFFSET)|MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN ctrls['master'].poke(MST_MAC_REG_BASE + MAC_REG_CTRL, master_ctrl) start_time = datetime.datetime.now() # Wait and check if BIST locked @@ -153,7 +149,7 @@ def run_ber_loopback_bist(ctrls, duration, rate_tuple): print('[INFO] BIST Complete!') print('- Elapsed Time = ' + str(time_diff)) print('- Max BER (Bit Error Ratio) = %.4g (%d errors out of %d)'%((mst_errors+1)/mst_samps,mst_errors,mst_samps)) - print('- Max Roundtrip Latency = %.1fus'%(1e6*mst_latency_cyc/AURORA_CLK_RATE)) + print('- Max Roundtrip Latency = %.1fus'%(1e6*mst_latency_cyc/BUS_CLK_RATE)) print('- Approx Throughput = %.0fMB/s'%((8e-6*mst_samps)/time_diff.total_seconds())) else: print('[ERROR] BIST Failed!') @@ -187,10 +183,7 @@ def run_latency_loopback_bist(ctrls, duration, rate_tuple): # Put the slave in loopback mode and the master in BIST mode if 'slave' in ctrls: ctrls['slave'].poke(SLA_MAC_REG_BASE + MAC_REG_CTRL, MAC_CTRL_BIST_LOOPBACK_EN) - if rate_sett == 0: - master_ctrl = MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN - else: - master_ctrl = ((rate_sett - 1) << MAC_CTRL_BIST_RATE_OFFSET)|MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN + master_ctrl = (rate_sett<<MAC_CTRL_BIST_RATE_OFFSET)|MAC_CTRL_BIST_GEN_EN|MAC_CTRL_BIST_CHECKER_EN start_time = datetime.datetime.now() latencies = [] @@ -216,7 +209,7 @@ def run_latency_loopback_bist(ctrls, duration, rate_tuple): ctrls['master'].poke(MST_MAC_REG_BASE + MAC_REG_CTRL, 0) # Compure latency mst_latency_cyc = 16.0*((mst_status & MAC_STATUS_BIST_LATENCY_MSK) >> MAC_STATUS_BIST_LATENCY_OFFSET) - mst_latency_us = 1e6*mst_latency_cyc/AURORA_CLK_RATE + mst_latency_us = 1e6*mst_latency_cyc/BUS_CLK_RATE latencies.append(mst_latency_us) except KeyboardInterrupt: print('[WARNING] Operation cancelled by user.') @@ -233,7 +226,7 @@ def run_latency_loopback_bist(ctrls, duration, rate_tuple): print('- Elapsed Time = ' + str(stop_time - start_time)) print('- Roundtrip Latency Mean = %.2fus'%(numpy.mean(latencies))) print('- Roundtrip Latency Stdev = %.2fus'%(numpy.std(latencies))) - # Turn off BIST loopback + # Turn off BIST loopback time.sleep(0.5) if 'slave' in ctrls: ctrls['slave'].poke(SLA_MAC_REG_BASE + MAC_REG_CTRL, 0) @@ -304,4 +297,3 @@ if __name__=='__main__': run_ber_loopback_bist(ctrls, options.duration, get_rate_setting(options.rate)) else: run_latency_loopback_bist(ctrls, options.duration, get_rate_setting(options.rate)) - |