diff --git a/fx3_firmware/CMakeLists.txt b/fx3_firmware/CMakeLists.txt index 2dbfe518..278592d2 100644 --- a/fx3_firmware/CMakeLists.txt +++ b/fx3_firmware/CMakeLists.txt @@ -43,6 +43,13 @@ include(Version) set(VERSION "${VERSION_INFO}") +# Generate firmware version header file +configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in + ${CMAKE_CURRENT_BINARY_DIR}/include/version.h + @ONLY +) + ################################################################################ # Configuration options ################################################################################ @@ -52,51 +59,6 @@ option(ENABLE_BLADERF_FIRMWARE ON ) -option(LOW_LATENCY_GPIF_BUFFERS - "Use smaller GPIF buffer sizes for lower latency (original pre-2.5.0 behavior)" - OFF -) - -# GPIF DMA buffer configuration -# Low-latency mode: 2x multiplier, 22 buffers (original pre-2.5.0) -# High-throughput mode: 8x multiplier, 11 buffers (2.5.0+) -if(LOW_LATENCY_GPIF_BUFFERS) - set(GPIF_DMA_SIZE_MULTIPLIER 2) - set(GPIF_DMA_BUFFER_COUNT 22) - # Report firmware version 2.4.0 for libbladeRF legacy buffer detection - # (libbladeRF checks FW_LARGER_BUFFER_VERSION: major=2, minor=5, patch=0) - set(VERSION_INFO_MINOR 4) - message(STATUS "GPIF buffers: LOW LATENCY mode (size*2, count=22)") - message(STATUS "Firmware version set to ${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH} for legacy detection") -else() - set(GPIF_DMA_SIZE_MULTIPLIER 8) - set(GPIF_DMA_BUFFER_COUNT 11) - message(STATUS "GPIF buffers: HIGH THROUGHPUT mode (size*8, count=11)") -endif() - -# Regenerate VERSION string for low-latency mode -# Manually construct VERSION string with correct 2.4.0 version number -if(LOW_LATENCY_GPIF_BUFFERS) - # Extract git info from the original VERSION string - string(REGEX MATCH "git-[^-]+" GIT_COMMIT_HASH "${VERSION}") - # Check if working directory is dirty - if(VERSION MATCHES "dirty") - set(VERSION "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}-${GIT_COMMIT_HASH}-dirty") - else() - set(VERSION "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}-${GIT_COMMIT_HASH}") - endif() - message(STATUS "Firmware VERSION string: ${VERSION}") - # Update VERSION_INFO_BASE for output filename - set(VERSION_INFO_BASE "${VERSION_INFO_MAJOR}.${VERSION_INFO_MINOR}.${VERSION_INFO_PATCH}") -endif() - -# Generate firmware version header file (must be after GPIF buffer config) -configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/src/version.h.in - ${CMAKE_CURRENT_BINARY_DIR}/include/version.h - @ONLY -) - ################################################################################ # Build Configuration ################################################################################ diff --git a/fx3_firmware/src/rf.c b/fx3_firmware/src/rf.c index 1848cf8b..a50a9f56 100644 --- a/fx3_firmware/src/rf.c +++ b/fx3_firmware/src/rf.c @@ -25,7 +25,6 @@ #include #include "gpif.h" #include "rf.h" -#include "version.h" #define THIS_FILE LOGGER_ID_RF_C @@ -291,8 +290,8 @@ static void NuandRFLinkStart(void) } CyU3PMemSet((uint8_t *)&dmaCfg, 0, sizeof(dmaCfg)); - dmaCfg.size = size * GPIF_DMA_SIZE_MULTIPLIER; - dmaCfg.count = GPIF_DMA_BUFFER_COUNT; + dmaCfg.size = size * 8; + dmaCfg.count = 11; dmaCfg.prodSckId = BLADE_RF_SAMPLE_EP_PRODUCER_USB_SOCKET; dmaCfg.consSckId = CY_U3P_PIB_SOCKET_3; dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE; diff --git a/fx3_firmware/src/version.h.in b/fx3_firmware/src/version.h.in index 658b3f00..c091abde 100644 --- a/fx3_firmware/src/version.h.in +++ b/fx3_firmware/src/version.h.in @@ -6,12 +6,5 @@ #define FIRMWARE_VERSION_MINOR @VERSION_INFO_MINOR@ #define FIRMWARE_VERSION_PATCH @VERSION_INFO_PATCH@ -/* GPIF DMA buffer configuration - * Low-latency mode: multiplier=2, count=22 (pre-2.5.0 behavior) - * High-throughput mode: multiplier=8, count=11 (2.5.0+ behavior) - */ -#define GPIF_DMA_SIZE_MULTIPLIER @GPIF_DMA_SIZE_MULTIPLIER@ -#define GPIF_DMA_BUFFER_COUNT @GPIF_DMA_BUFFER_COUNT@ - #endif diff --git a/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p_lowlatency.vhd b/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p_lowlatency.vhd deleted file mode 100644 index 7fb14afe..00000000 --- a/hdl/fpga/platforms/common/bladerf/vhdl/fx3_gpif_p_lowlatency.vhd +++ /dev/null @@ -1,33 +0,0 @@ --- Copyright (c) 2025 Nuand LLC --- --- Permission is hereby granted, free of charge, to any person obtaining a copy --- of this software and associated documentation files (the "Software"), to deal --- in the Software without restriction, including without limitation the rights --- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --- copies of the Software, and to permit persons to whom the Software is --- furnished to do so, subject to the following conditions: --- --- The above copyright notice and this permission notice shall be included in --- all copies or substantial portions of the Software. --- --- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN --- THE SOFTWARE. - --- Low-latency GPIF buffer configuration (pre-0.16.0/2.5.0 behavior) --- Use this for latency-sensitive applications where minimum delay --- is more important than maximum throughput. - -library ieee; -use ieee.std_logic_1164.all; - -package fx3_gpif_p is - -- GPIF buffer sizes for USB high-speed and super-speed - -- Low-latency mode: smaller buffers for reduced latency - constant GPIF_BUF_SIZE_HS : natural := 256; - constant GPIF_BUF_SIZE_SS : natural := 512; -end package fx3_gpif_p; diff --git a/hdl/quartus/build.tcl b/hdl/quartus/build.tcl index 0d15e429..9b2912c5 100644 --- a/hdl/quartus/build.tcl +++ b/hdl/quartus/build.tcl @@ -10,7 +10,6 @@ set options { \ { "stp.arg" "" "SignalTap II file to use" } \ { "force.arg" "" "Force enable TalkBack to use SignalTapII" } \ { "seed.arg" "" "Specify fitter seed" } \ - { "lowlatency" "" "Use smaller GPIF buffers for lower latency (pre-2.5.0 behavior)" } \ } # Parse the command arguments, store them into 'opts' @@ -70,16 +69,6 @@ if { $opts(flow) != "gen" && # Open the project with the specific revision project_open -revision $opts(rev) $opts(projname) -# Configure GPIF buffer sizes via package file selection -# Low-latency mode: HS=256, SS=512 (pre-0.16.0/2.5.0 behavior) -# High-throughput mode: HS=1024, SS=2048 (default, 0.16.0/2.5.0+ behavior) -# Note: build_bladerf.sh swaps the package files before running Quartus -if { $opts(lowlatency) } { - puts "Configuring LOW LATENCY GPIF buffers (HS=256, SS=512)" -} else { - puts "Configuring HIGH THROUGHPUT GPIF buffers (HS=1024, SS=2048)" -} - # Add signaltap file set forced_talkback 0 set enable_stp 0 diff --git a/hdl/quartus/build_bladerf.sh b/hdl/quartus/build_bladerf.sh index 87e7a57b..09d52ff4 100755 --- a/hdl/quartus/build_bladerf.sh +++ b/hdl/quartus/build_bladerf.sh @@ -81,7 +81,6 @@ function usage() echo " full (default) Fit the design and create programming files" echo " -S Fitter seed setting (default: 1)" echo " -D Output directory name won't contain the date" - echo " -L Build with low-latency GPIF buffer sizes (pre-0.16.0 behavior)" echo " -h Show this text" echo "" @@ -165,7 +164,7 @@ flow="full" seed="1" omit_date=false -while getopts ":cb:r:s:a:fn:l:S:DLhH" opt; do +while getopts ":cb:r:s:a:fn:l:S:DhH" opt; do case $opt in c) clear_work_dir=1 @@ -213,10 +212,6 @@ while getopts ":cb:r:s:a:fn:l:S:DLhH" opt; do omit_date=true ;; - L) - lowlatency=1 - ;; - h) usage exit 0 @@ -447,18 +442,6 @@ echo " Building BSP and ${board} application..." echo "##########################################################################" echo "" -# Configure FPGA version for low-latency mode -# When -L is set, report version 0.15.3 so libbladeRF uses legacy buffer sizes -# Version 0.15.3 includes important HDL bug fixes for metadata and timestamp handling -if [ "$lowlatency" == "1" ]; then - echo "Low-latency mode: Setting FPGA version to 0.15.3 for legacy buffer detection" - fpga_version_file="${build_dir}/../software/bladeRF_nios/src/fpga_version.h" - if [ -f "$fpga_version_file" ]; then - sed -i 's/#define FPGA_VERSION_MINOR.*16/#define FPGA_VERSION_MINOR 15/' "$fpga_version_file" - sed -i 's/#define FPGA_VERSION_PATCH.*0/#define FPGA_VERSION_PATCH 3/' "$fpga_version_file" - fi -fi - mkdir -p bladeRF_nios_bsp if [ -f settings.bsp ]; then echo "Skipping creating Nios BSP, settings.bsp already exists" @@ -525,19 +508,7 @@ quartus_sh --64bit \ -part "${DEVICE}" \ -platdir "${build_dir}/.." -# Swap GPIF package file for low-latency mode -if [ "$lowlatency" == "1" ]; then - echo "Low-latency mode: Swapping GPIF package file" - gpif_pkg_dir="${PROJECT_ROOT}/hdl/fpga/platforms/common/bladerf/vhdl" - cp "${gpif_pkg_dir}/fx3_gpif_p_lowlatency.vhd" "${gpif_pkg_dir}/fx3_gpif_p.vhd" -fi - # Run Quartus flow -lowlatency_flag="" -if [ "$lowlatency" == "1" ]; then - lowlatency_flag="-lowlatency" -fi - quartus_sh --64bit \ -t "../../build.tcl" \ -projname "${PROJECT_NAME}" \ @@ -545,8 +516,7 @@ quartus_sh --64bit \ -flow "${flow}" \ -stp "${stp}" \ -force "${force}" \ - -seed "${seed}" \ - ${lowlatency_flag} + -seed "${seed}" popd