diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 00000000..2ea73be3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,37 @@ +name: Bug Report +description: Submit a bug report +labels: ["bug report"] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to fill out this bug report! + - type: dropdown + id: issue-type + attributes: + label: What type of issue is this? + options: + - transient - occurring only once + - intermittent - occurring irregularly + - permanent - occurring repeatedly + validations: + required: true + - type: textarea + id: issue + attributes: + label: What issue are you facing? + placeholder: Please describe what you have encountered + validations: + required: true + - type: textarea + id: reproduce-issue + attributes: + label: What are the steps to reproduce this? + placeholder: Please provide the steps to reproduce this issue + validations: + required: true + - type: textarea + id: logs + attributes: + label: Can you provide any logs? (output, errors, etc.) + placeholder: Please provide any logs you might have that illustrate the issue diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000..ec4bb386 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: false \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/documentation-request.yml b/.github/ISSUE_TEMPLATE/documentation-request.yml new file mode 100644 index 00000000..e0086962 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation-request.yml @@ -0,0 +1,14 @@ +name: Documentation +description: Make a request regarding HackRF documentation +labels: ["documentation"] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to help Great Scott Gadgets improve the HackRF One documentation! + - type: textarea + id: documentation-request + attributes: + label: What would you like us to add to or change about the HackRF One documentation? + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 00000000..9e2b8aee --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,16 @@ +name: Feature Request +description: File a feature request +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to fill out this feature request form! + - type: textarea + id: feature-request + attributes: + label: What feature would you like to see and why? + description: Please be as detailed as possible with your feature request. + validations: + required: true + \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000..4471d3a2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,14 @@ +name: Question +description: Ask a question not covered by current hackrf.rtfd.io documentation +labels: ["question"] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to ask your question! If you need technical support, want to open a feature request, or need to file a bug report, please abandon this issue, open a new issue, and choose the correct template. If you do not choose the correct template, you will be asked to re-open your issue with the correct template. + - type: textarea + id: question + attributes: + label: What would you like to know? + validations: + required: true \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/technical-support.yml b/.github/ISSUE_TEMPLATE/technical-support.yml new file mode 100644 index 00000000..9b2cf66a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/technical-support.yml @@ -0,0 +1,51 @@ +name: Technical Support Request +description: File a technical support request +labels: ["technical support"] +body: + - type: markdown + attributes: + value: | + Thank you for taking the time to fill out this technical support request form! Please note that technical support requests can expect a response time of two weeks. + - type: textarea + id: expected-outcome + attributes: + label: What outcome were you hoping for? + placeholder: Please be detailed in what you expected to happen + validations: + required: true + - type: textarea + id: actual-outcome + attributes: + label: What outcome actually happened? + placeholder: Please be detailed in what did happen + validations: + required: true + - type: textarea + id: operating-systems + attributes: + label: What operating systems are you seeing the problem on? + validations: + required: true + - type: textarea + id: hackrf_info-output + attributes: + label: What is the output of ```hackrf_info```? + description: Please put the output of the command in the box below or indicate N/A. + validations: + required: true + - type: textarea + id: third-party-software + attributes: + label: Are you using any third-party software? + description: Please list the software you are using with your HackRF or indicate N/A. Please list version numbers where possible. + placeholder: GNU Radio, GQRX, etc. + validations: + required: true + - type: textarea + id: third-party-hardware + attributes: + label: Are you using any third-party hardware? + description: Please list any hardware you are using with your HackRF or indicate N/A. + placeholder: portapack, specialized antenna, etc. + validations: + required: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a29e36f7..21593d8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,118 +9,286 @@ on: - cron: 1 12 * * 1 env: - BUILD_TYPE: Release + + # Override OSX architecture detection. Required for CMake versions < 3.19.2. + CMAKE_OSX_ARCHITECTURES: arm64 jobs: host: strategy: matrix: - os: ['macos-latest', 'ubuntu-latest'] + os: ['macos', 'ubuntu', 'windows'] + cmake: ['3.10.0', '3.21.7', '4.2.6', 'latest'] + compiler: ['gcc', 'msvc'] + exclude: + # MSVC only runs on Windows. + - os: 'macos' + compiler: 'msvc' + - os: 'ubuntu' + compiler: 'msvc' + # We can't use the oldest CMake versions on Windows. + - os: 'windows' + cmake: '3.10.0' + # The in-between CMake versions aren't so intersting with GCC. + - compiler: 'gcc' + cmake: '3.21.7' + - compiler: 'gcc' + cmake: '4.2.6' + include: + # Shell selection + - os: 'macos' + shell: 'bash' + - os: 'ubuntu' + shell: 'bash' + - os: 'windows' + compiler: 'msvc' + shell: 'pwsh' + - os: 'windows' + compiler: 'gcc' + shell: 'msys2' + # MSVC version selection + - cmake: '3.21.7' + msvc: '17.14' + - cmake: '4.2.6' + msvc: 'latest' + - cmake: 'latest' + msvc: 'latest' + # CMake generator selection + - os: 'macos' + generator: 'Unix Makefiles' + - os: 'ubuntu' + generator: 'Unix Makefiles' + - compiler: 'msvc' + cmake: '3.21.7' + generator: 'Visual Studio 17 2022' + - compiler: 'msvc' + cmake: '4.2.6' + generator: 'Visual Studio 18 2026' + - compiler: 'msvc' + cmake: 'latest' + generator: 'Visual Studio 18 2026' + - os: 'windows' + compiler: 'gcc' + generator: 'MSYS Makefiles' + # Additional CMake arguments + - os: 'windows' + compiler: 'msvc' + cmake_args: >- + -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + --install-prefix=$env:GITHUB_WORKSPACE/install + - os: 'windows' + compiler: 'gcc' + cmake_args: >- + --install-prefix=/usr/local + # CMake 3.10 uses --build with --target install + - cmake: '3.10.0' + install_cmd: --build + install_args: --target install + # Later versions just use --install + - cmake: '3.21.7' + install_cmd: --install + - cmake: '4.2.6' + install_cmd: --install + - cmake: 'latest' + install_cmd: --install + # We need sudo on MacOS and Ubuntu only + - os: macos + sudo: sudo + - os: ubuntu + sudo: sudo + # Don't cancel all builds when one fails fail-fast: false - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest + + defaults: + run: + shell: '${{ matrix.shell }} {0}' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 + + - name: Setup cmake + uses: lukka/get-cmake@latest + with: + cmakeVersion: ${{ matrix.cmake }} + if: matrix.shell != 'msys2' + + - name: Install MSVC (Windows) + uses: k3DW/setup-msvc@v1 + with: + vs-version: ${{ matrix.msvc }} + if: matrix.compiler == 'msvc' && matrix.msvc != 'latest' - name: Install dependencies (macOS) run: brew install fftw - if: matrix.os == 'macos-latest' + if: matrix.os == 'macos' - name: Install dependencies (Ubuntu) run: | sudo apt update sudo apt install libfftw3-dev libusb-1.0-0-dev - if: matrix.os == 'ubuntu-latest' + if: matrix.os == 'ubuntu' - - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/host/build + - name: Install dependencies (Windows) + run: vcpkg install --triplet=x64-windows libusb fftw3 pthreads pkgconf + if: matrix.os == 'windows' && matrix.shell != 'msys2' - - name: Configure CMake - shell: bash - working-directory: ${{runner.workspace}}/host/build - run: cmake $GITHUB_WORKSPACE/host/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - name: Setup MSYS (Windows) + if: matrix.os == 'windows' && matrix.shell == 'msys2' + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + install: >- + git + make + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-toolchain + mingw-w64-ucrt-x86_64-libusb + mingw-w64-ucrt-x86_64-fftw - - name: Build - working-directory: ${{runner.workspace}}/host/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + # Build libhackrf and hackrf-tools together - - name: Create Build Environment (libhackrf) - run: cmake -E make_directory ${{runner.workspace}}/host/libhackrf/build + - name: Configure & Build + run: | + cmake -E make_directory host/build + cd host/build + cmake .. -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release ${{matrix.cmake_args}} + cmake --build . --config Release - - name: Configure CMake (libhackrf) - shell: bash - working-directory: ${{runner.workspace}}/host/libhackrf/build - run: cmake $GITHUB_WORKSPACE/host/libhackrf/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + # Build libhackrf ONLY - - name: Build (libhackrf) - working-directory: ${{runner.workspace}}/host/libhackrf/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + - name: Configure & Build (libhackrf) + run: | + cmake -E make_directory host/libhackrf/build + cd host/libhackrf/build + cmake .. -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_args }} + cmake --build . --config Release - name: Install (libhackrf) - working-directory: ${{runner.workspace}}/host/libhackrf/build - shell: bash run: | - sudo cmake --install . --config $BUILD_TYPE + ${{ matrix.sudo }} cmake ${{ matrix.install_cmd }} host/libhackrf/build ${{ matrix.install_args }} --config Release - - name: Create Build Environment (hackrf-tools) - run: cmake -E make_directory ${{runner.workspace}}/host/hackrf-tools/build + # Build hackrf-tools ONLY - - name: Configure CMake (hackrf-tools) - shell: bash - working-directory: ${{runner.workspace}}/host/hackrf-tools/build - run: cmake $GITHUB_WORKSPACE/host/hackrf-tools/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE + - name: Configure & Build (hackrf-tools) + run: | + cmake -E make_directory host/hackrf-tools/build + cd host/hackrf-tools/build + cmake .. -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release ${{ matrix.cmake_args }} + cmake --build . --config Release - - name: Build (hackrf-tools) - working-directory: ${{runner.workspace}}/host/hackrf-tools/build - shell: bash - run: cmake --build . --config $BUILD_TYPE + - name: Install (hackrf-tools) + run: | + ${{ matrix.sudo }} cmake ${{ matrix.install_cmd }} host/hackrf-tools/build ${{ matrix.install_args }} + + # Publish the contents of install/bin (which should be the combination libhackrf and host-tools) for Windows + - name: Publish Artifacts (Windows) + uses: actions/upload-artifact@v4 + with: + name: hackrf-tools-windows + path: ${{github.workspace}}/install/bin + if: matrix.os == 'windows' && matrix.cmake == 'latest' && matrix.shell == 'pwsh' firmware: strategy: matrix: - os: ['macos-latest', 'ubuntu-latest'] - board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O'] + os: ['macos', 'ubuntu', 'windows'] + board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE', 'UNIVERSAL'] + cmake: ['3.12.0', 'latest'] + exclude: + - os: 'windows' + cmake: '3.12.0' + # GitHub doesn't give us many macOS runners, so don't build for every board. + # We just need to know that building firmware works on macOS. Use PRALINE + # since that's the most complicated one due to FPGA bitstreams. + - os: 'macos' + board: 'HACKRF_ONE' + - os: 'macos' + board: 'JAWBREAKER' + - os: 'macos' + board: 'RAD1O' # Don't cancel all builds when one fails fail-fast: false - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.os }}-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 with: submodules: true + - name: Setup cmake + uses: lukka/get-cmake@latest + with: + cmakeVersion: ${{ matrix.cmake }} + if: matrix.os != 'windows' + + - name: Install Arm GNU Toolchain + uses: carlosperate/arm-none-eabi-gcc-action@v1 + if: matrix.os != 'windows' + - name: Install dependencies (macOS) run: | - brew tap armmbed/formulae - brew install arm-none-eabi-gcc dfu-util - pip install PyYAML - if: matrix.os == 'macos-latest' + brew install dfu-util + python3 -m venv environment && source environment/bin/activate + python3 -m pip install PyYAML + if: matrix.os == 'macos' - name: Install dependencies (Ubuntu) run: | - sudo apt install dfu-util gcc-arm-none-eabi - if: matrix.os == 'ubuntu-latest' + python3 -m venv environment && source environment/bin/activate + python3 -m pip install PyYAML + sudo apt install dfu-util + if: matrix.os == 'ubuntu' - name: Build libopencm3 shell: bash working-directory: ${{github.workspace}}/firmware/libopencm3/ - run: make + run: | + source ../../environment/bin/activate + make + if: matrix.os != 'windows' - name: Create Build Environment - run: cmake -E make_directory ${{runner.workspace}}/firmware/build + run: cmake -E make_directory ${{github.workspace}}/firmware/build + if: matrix.os != 'windows' - name: Configure CMake shell: bash - working-directory: ${{runner.workspace}}/firmware/build - run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DBOARD=${{ matrix.board }} + working-directory: ${{github.workspace}}/firmware/build + run: cmake $GITHUB_WORKSPACE/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} + if: matrix.os != 'windows' - name: Build - working-directory: ${{runner.workspace}}/firmware/build + working-directory: ${{github.workspace}}/firmware/build shell: bash - run: cmake --build . --config $BUILD_TYPE + run: | + source ../../environment/bin/activate + cmake --build . --config Release + if: matrix.os != 'windows' + - name: Setup MSYS (Windows) + if: matrix.os == 'windows' + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + install: >- + git + make + mingw-w64-ucrt-x86_64-arm-none-eabi-gcc + mingw-w64-ucrt-x86_64-cmake + mingw-w64-ucrt-x86_64-dfu-util + mingw-w64-ucrt-x86_64-python-yaml + + - name: Build with MSYS (Windows) + if: matrix.os == 'windows' + shell: msys2 {0} + run: | + mkdir firmware/build + cd firmware/build + cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} .. + make diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 18a53d44..d498d609 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -16,7 +16,7 @@ jobs: - check: 'firmware/hackrf_usb' exclude: '' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v6 - name: Run clang-format-action uses: jidicula/clang-format-action@v4.6.2 with: diff --git a/.github/workflows/includes-check.yml b/.github/workflows/includes-check.yml new file mode 100644 index 00000000..f16800fe --- /dev/null +++ b/.github/workflows/includes-check.yml @@ -0,0 +1,96 @@ +name: Check includes +on: [push, pull_request] + +defaults: + run: + shell: bash + +jobs: + includes-check: + runs-on: ubuntu-latest + container: + image: "debian:13" + options: --user 0 + strategy: + matrix: + board: ['HACKRF_ONE', 'JAWBREAKER', 'RAD1O', 'PRALINE', 'UNIVERSAL'] + cmake: ['3.12.0', 'latest'] + + # Don't cancel all builds when one fails + fail-fast: false + + steps: + + - name: Make it work on debian + run: | + apt update + apt install -y git python3 python3-pip python3-venv nodejs unzip + # actions/checkout insists on putting the checkout in the + # working directory rather than ${{ github.workspace }}. + # + # This may just be because the 'runner' user does not exist + # in the docker image at startup. + # + # also see: https://github.com/actions/runner/issues/878 + useradd -ms /bin/bash runner + ln -s /__w /home/runner/work + + - name: Checkout repository + uses: actions/checkout@v6 + with: + submodules: true + + - name: Setup cmake + uses: lukka/get-cmake@latest + with: + cmakeVersion: ${{ matrix.cmake }} + + - name: Install Arm GNU Toolchain + uses: carlosperate/arm-none-eabi-gcc-action@v1 + + - name: Install dependencies + run: | + python3 -m venv environment && source environment/bin/activate + python3 -m pip install PyYAML + apt install -y iwyu + iwyu --version + + - name: Build libopencm3 + working-directory: ${{github.workspace}}/firmware/libopencm3/ + run: | + source ../../environment/bin/activate + make + + - name: Create Build Environment + run: cmake -E make_directory ${{github.workspace}}/firmware/build + + - name: Configure CMake + working-directory: ${{github.workspace}}/firmware/build + run: cmake ${{github.workspace}}/firmware/ -DCMAKE_BUILD_TYPE=Release -DBOARD=${{ matrix.board }} -DCHECK_INCLUDES=1 + + - name: Build + working-directory: ${{github.workspace}}/firmware/build + run: | + source ../../environment/bin/activate + output="$(cmake --build . --config Release 2>&1)" + while IFS= read -r line + do + if [[ "${line}" == "Warning: include-what-you-use"* ]]; then + exit_code=1 + dump=1 + echo + elif [[ "${line}" == "---" ]]; then + dump=0 + echo + fi + if [[ ${dump} == "1" ]]; then + echo "${line}" + fi + done <<< ${output} + if [[ ${exit_code} == "1" ]]; then + echo "Includes check failed for board target: ${{ matrix.board }}" + else + echo "Includes check succeeded for board target: ${{ matrix.board }}" + fi + echo $(include-what-you-use --version) + exit ${exit_code} diff --git a/.gitignore b/.gitignore index 2abfd070..ca06f983 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.srec host/build/ host/**/build +install/ # Operating system spew .DS_Store diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..2dafe72c --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,24 @@ +# .readthedocs.yaml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools +build: + os: ubuntu-22.04 + tools: + python: "3.12" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + +# Build PDF for docs +formats: + - pdf + +python: + install: + - requirements: docs/requirements.txt diff --git a/Dockerfile b/Dockerfile index 53e37d19..cdd03664 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,18 @@ -# Sandbox test environment for HackRF -FROM ubuntu:20.04 -CMD ["/bin/bash"] +# Environment for HackRF HIL testing with Jenkins CI +FROM ubuntu:22.04 +USER root -# Override interactive installations and install prerequisites -ENV DEBIAN_FRONTEND=noninteractive +# Copy usb hub script from Jenkins' container +COPY --from=gsg-jenkins /startup/hubs.py /startup/hubs.py +COPY --from=gsg-jenkins /startup/.hubs /startup/.hubs +RUN ln -s /startup/hubs.py /usr/local/bin/hubs + +# Override interactive installations and install software dependencies +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ build-essential \ cmake \ + curl \ dfu-util \ gcc-arm-none-eabi \ git \ @@ -15,9 +21,19 @@ RUN apt-get update && apt-get install -y \ pkg-config \ python3 \ python3-pip \ - python-is-python3 \ + python3-yaml \ + usbutils \ && rm -rf /var/lib/apt/lists/* -RUN pip3 install git+https://github.com/CapableRobot/CapableRobot_USBHub_Driver --upgrade + +# Install USB hub PPPS dependencies +RUN pip3 install numpy python-dotenv git+https://github.com/CapableRobot/CapableRobot_USBHub_Driver --upgrade +RUN curl -L https://github.com/mvp/uhubctl/archive/refs/tags/v2.5.0.tar.gz > uhubctl-2.5.0.tar.gz \ + && mkdir uhubctl-2.5.0 \ + && tar -xvzf uhubctl-2.5.0.tar.gz -C uhubctl-2.5.0 --strip-components 1 \ + && rm uhubctl-2.5.0.tar.gz \ + && cd uhubctl-2.5.0 \ + && make \ + && make install # Inform Docker that the container is listening on port 8080 at runtime EXPOSE 8080 diff --git a/Jenkinsfile b/Jenkinsfile index 3d5ea101..dcfd9ad8 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,37 +1,130 @@ +import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException + +def docker_args = '''--group-add=20 --group-add=46 --device-cgroup-rule="c 189:* rmw" \ + --device-cgroup-rule="c 166:* rmw" -v /dev/bus/usb:/dev/bus/usb \ + -v /tmp/req_pipe:/tmp/req_pipe -v /tmp/res_pipe:/tmp/res_pipe''' + +def h1_test = '''python3 ci-scripts/hackrf_test.py --ci --log log \ + --hostdir host/build/hackrf-tools/src/ \ + --fwupdate firmware/hackrf_usb/build/ \ + --tester 0000000000000000325866e629a25623 \ + --eut RunningFromRAM --unattended --rev r4''' + +def hpro_test = '''python3 ci-scripts/hackrf_pro_test.py --ci --log log \ + --hostdir host/build/hackrf-tools/src \ + --fwupdate firmware/hackrf_usb/build \ + --tester 0000000000000000a06063c82338145f \ + --eut RunningFromRAM -p --rev r1.2''' + pipeline { - agent { - dockerfile { - args '--group-add=46 --device-cgroup-rule="c 189:* rmw" -v /dev/bus/usb:/dev/bus/usb' - } - } + agent any stages { - stage('Build (Host)') { + stage('Build Docker Image') { + options { + timeout(time: 20, unit: 'MINUTES') + } steps { - sh './ci-scripts/install-host.sh' + sh 'docker build -t hackrf https://github.com/greatscottgadgets/hackrf.git' } } - stage('Build (Firmware)') { + stage('Test HackRF One with BOARD=HACKRF_ONE') { + agent { + docker { + image 'hackrf' + reuseNode true + args docker_args + } + } + options { + timeout(time: 20, unit: 'MINUTES') + } steps { - sh './ci-scripts/install-firmware.sh' + runCommand("Install Host Tools", './ci-scripts/install_host.sh', 3, 1, 'MINUTES') + runCommand("Build HackRF One Firmware", './ci-scripts/build_firmware.sh HACKRF_ONE', 3, 1, 'MINUTES') + lock('HIL_hubs') { + script { + allOff() + runTest("Check Host", 'h1_eut', './ci-scripts/test_host.sh') + runTest("HackRF One HIL Test", 'h1_tester h1_eut', h1_test) + runTest("SGPIO Debug Test", 'h1_eut', 'python3 ci-scripts/test_sgpio_debug.py') + } + } } } - stage('Test') { + stage('Test HackRF One with BOARD=UNIVERSAL') { + agent { + docker { + image 'hackrf' + reuseNode true + args docker_args + } + } + options { + timeout(time: 20, unit: 'MINUTES') + } steps { - sh './ci-scripts/configure-hubs.sh --off' - retry(3) { - sh './ci-scripts/test-host.sh' + runCommand("Install Host Tools", './ci-scripts/install_host.sh', 3, 1, 'MINUTES') + runCommand("Build Universal Firmware", './ci-scripts/build_firmware.sh UNIVERSAL', 3, 1, 'MINUTES') + lock('HIL_hubs') { + script { + allOff() + runTest("Check Host", 'h1_eut', './ci-scripts/test_host.sh') + runTest("HackRF One HIL Test", 'h1_tester h1_eut', h1_test) + runTest("SGPIO Debug Test", 'h1_eut', 'python3 ci-scripts/test_sgpio_debug.py') + } } - retry(3) { - sh './ci-scripts/test-firmware-program.sh' + + } + } + stage('Test HackRF Pro with BOARD=PRALINE') { + agent { + docker { + image 'hackrf' + reuseNode true + args "$docker_args" + } + } + options { + timeout(time: 20, unit: 'MINUTES') + } + steps { + runCommand("Install Host Tools", './ci-scripts/install_host.sh', 3, 1, 'MINUTES') + runCommand("Build Praline Firmware", './ci-scripts/build_firmware.sh PRALINE', 3, 1, 'MINUTES') + lock('HIL_hubs') { + script { + allOff() + runTest("Check Host", 'hpro_eut', './ci-scripts/test_host.sh') + runTest("HackRF Pro HIL Test", 'hpro_tester hpro_eut', hpro_test) + } + } + } + } + stage('Test HackRF Pro with BOARD=UNIVERSAL') { + agent { + docker { + image 'hackrf' + reuseNode true + args "$docker_args" + } + } + options { + timeout(time: 20, unit: 'MINUTES') + } + steps { + runCommand("Install Host Tools", './ci-scripts/install_host.sh', 3, 1, 'MINUTES') + runCommand("Build Universal Firmware", './ci-scripts/build_firmware.sh UNIVERSAL', 3, 1, 'MINUTES') + lock('HIL_hubs') { + script { + allOff() + runTest("Check Host", 'hpro_eut', './ci-scripts/test_host.sh') + runTest("HackRF Pro HIL Test", 'hpro_tester hpro_eut', hpro_test) + } } - sh './ci-scripts/test-firmware-flash.sh' } } } post { always { - sh './ci-scripts/configure-hubs.sh --reset' - sh 'rm -rf testing-venv/' cleanWs(cleanWhenNotBuilt: false, deleteDirs: true, disableDeferredWipeout: true, @@ -39,3 +132,46 @@ pipeline { } } } + +def allOff() { + // Allow up to 3 retries, 20 seconds each, for the USB hub port power server to respond appropriately + runCommand('USB hub port power server command', "hubs all off", 3, 20, 'SECONDS') +} + +def reset(devices) { + // Allow up to 3 retries, 20 seconds each, for the USB hub port power server to respond appropriately + runCommand('USB hub port power server command', "hubs ${devices} reset", 3, 20, 'SECONDS') +} + +def runCommand(title, cmd, retries, time, unit) { + retry(retries) { + try { + timeout(time: time, unit: unit) { + sh "${cmd}" + } + } catch (FlowInterruptedException err) { + // Check if the cause was specifically an exceeded timeout + def cause = err.getCauses().get(0) + if (cause instanceof org.jenkinsci.plugins.workflow.steps.TimeoutStepExecution.ExceededTimeout) { + echo "${title} timeout reached." + throw err // Re-throw the exception to fail the build + } else { + echo "Build interrupted for another reason." + throw err // Re-throw the exception to fail the build + } + } catch (Exception err) { + echo "An unrelated error occurred: ${err.getMessage()}" + throw err + } + } +} + +def runTest(title, devices, cmd) { + retry(3) { + // reset() retains it's own internal retries + reset(devices) + sh 'sleep 1s' + // run the test with 0 internal retries and 3 external retries to ensure resets between runs + runCommand(title, cmd, 0, 5, 'MINUTES') + } +} diff --git a/Readme.md b/Readme.md index f774c0b4..747ca054 100644 --- a/Readme.md +++ b/Readme.md @@ -15,14 +15,19 @@ Information on HackRF and purchasing HackRF: https://greatscottgadgets.com/hackr # Documentation -Documentation for HackRF can be viewed on [Read the Docs](https://hackrf.readthedocs.io/en/latest/). The raw documenation files for HackRF are in the [docs folder](https://github.com/mossmann/hackrf/tree/master/docs) in this repository and can be built locally by installing [Sphinx Docs](https://www.sphinx-doc.org/en/master/usage/installation.html) and running `make html`. Documentation changes can be submitted through pull request and suggestions can be made as GitHub issues. +Documentation for HackRF can be viewed on [Read the Docs](https://hackrf.readthedocs.io/en/latest/). The raw documentation files for HackRF are in the [docs folder](https://github.com/mossmann/hackrf/tree/master/docs) in this repository and can be built locally by installing [Sphinx Docs](https://www.sphinx-doc.org/en/master/usage/installation.html) and running `make html`. Documentation changes can be submitted through pull request and suggestions can be made as GitHub issues. + +To create a PDF of the HackRF documentation from the HackRF repository while on Ubuntu: +* run `sudo apt install latexmk texlive-latex-extra` +* navigate to hackrf/docs on command line +* run the command `make latex` +* run the command `make latexpdf` -------------------- # Getting Help - -Before asking for help with HackRF, check to see if your question is listed in the [FAQ](https://hackrf.readthedocs.io/en/latest/faq.html). +Before asking for help with HackRF, check to see if your question is listed on the [troubleshooting page](https://hackrf.readthedocs.io/en/latest/troubleshooting.html). For assistance with HackRF general use or development, please look at the [issues on the GitHub project](https://github.com/greatscottgadgets/hackrf/issues). This is the preferred place to ask questions so that others may locate the answer to your question in the future. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index d8d99e9e..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,52 +0,0 @@ -os: Visual Studio 2017 -clone_depth: 1 - -configuration: - - Release - -init: - - C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM% -install: - # Dependencies for libHackRF - - appveyor DownloadFile "https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z" -FileName "C:\libusb.7z" - - 7z x -y "C:\libusb.7z" -o"C:\libusb" - - appveyor DownloadFile "http://mirrors.kernel.org/sourceware/pthreads-win32/pthreads-w32-2-9-1-release.zip" -FileName "C:\pthreads-w32-release.zip" - - 7z x -y "C:\pthreads-w32-release.zip" -o"C:\pthreads" - - appveyor DownloadFile "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip" -FileName "C:\pkg-config_win32.zip" - - 7z x -y "C:\pkg-config_win32.zip" -o"C:\pkg-config" - # FFTW for hackrf_sweep - - curl -fsS -o "C:\fftw-3.3.5.zip" "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" - - 7z x -y "C:\fftw-3.3.5.zip" -o"C:\fftw" - - cd c:\fftw - - ps: lib /machine:x64 /def:libfftw3f-3.def - # ARM GCC for firmware builds - # - appveyor DownloadFile "https://developer.arm.com/-/media/Files/downloads/gnu-rm/6-2017q2/gcc-arm-none-eabi-6-2017-q2-update-win32.zip" -FileName "C:\gcc-arm-none-eabi-win32.zip" - # - 7z x -y "C:\gcc-arm-none-eabi-win32.zip" -o"C:\gcc-arm-none-eabi" - # - set PATH=%PATH%;c:\gcc-arm-none-eabi\bin - -build_script: - # Host library and tools - - mkdir c:\projects\hackrf\host\build - - cd c:\projects\hackrf\host\build - - cmake -G "Visual Studio 14 2015 Win64" \ - -DLIBUSB_LIBRARIES="C:\libusb\MS64\dll\libusb-1.0.lib" \ - -DLIBUSB_INCLUDE_DIR="C:\libusb\include\libusb-1.0" \ - -DTHREADS_PTHREADS_INCLUDE_DIR=c:\pthreads\Pre-built.2\include \ - -DTHREADS_PTHREADS_WIN32_LIBRARY=c:\pthreads\Pre-built.2\lib\x64\pthreadVC2.lib \ - -DPKG_CONFIG_EXECUTABLE="C:\pkg-config\bin\pkg-config.exe" \ - -DFFTW_INCLUDES=C:\fftw \ - -DFFTW_LIBRARIES=C:\fftw\libfftw3f-3.lib \ - .. - - msbuild HackRF.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" - # Firmware - # - cd c:\projects\hackrf\ - # - git submodule init - # - git submodule update - # - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && firmware/appveyor.sh"' - -after_build: - - 7z a %APPVEYOR_BUILD_FOLDER%\HackRF-Windows-%APPVEYOR_REPO_COMMIT%.zip %APPVEYOR_BUILD_FOLDER%\host\build\libhackrf\src\Release\* %APPVEYOR_BUILD_FOLDER%\host\build\hackrf-tools\src\Release\* - -artifacts: - - path: HackRF-Windows-%APPVEYOR_REPO_COMMIT%.zip - name: HackRF-Windows-%APPVEYOR_REPO_COMMIT% diff --git a/ci-scripts/build_firmware.sh b/ci-scripts/build_firmware.sh new file mode 100755 index 00000000..b6fc4ec4 --- /dev/null +++ b/ci-scripts/build_firmware.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -e +git submodule init +git submodule update +cd firmware/hackrf_usb +rm -rf build +cmake -DBOARD=$1 -B build +cmake --build build +cd ../.. diff --git a/ci-scripts/configure-hubs.sh b/ci-scripts/configure-hubs.sh deleted file mode 100755 index 47dcb44b..00000000 --- a/ci-scripts/configure-hubs.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -usbhub --disable-i2c --hub D9D1 power state --port 1,2,3,4 $1 -usbhub --disable-i2c --hub 624C power state --port 1,2,3,4 $1 \ No newline at end of file diff --git a/ci-scripts/hackrf_pro_test.py b/ci-scripts/hackrf_pro_test.py new file mode 100644 index 00000000..44b6eb56 --- /dev/null +++ b/ci-scripts/hackrf_pro_test.py @@ -0,0 +1,1684 @@ +#!/usr/bin/env python3 + +import sys +import subprocess +import time +import os, shutil +import usb +from datetime import datetime +from dataclasses import dataclass +import argparse +import numpy as np +import traceback +import re + +DFU_UTIL = "/usr/bin/dfu-util" +TMP_DIR = "/tmp/" +WAVEFORM = TMP_DIR + "waveform100" +NOISE = TMP_DIR + "noise" +VENDOR_ID = 0x1d50 +PRODUCT_ID = 0x6089 +DFU_VENDOR_ID = 0x1fc9 +DFU_PRODUCT_ID = 0x000c +ONE_MHZ = 1000000 +TIMEOUT = 5 +MAX_PPM = 20 +MAX_BASELINE = -20 +SIGNAL_THRESHOLD = -25 +MAX_DC_DBC = -27 +MAX_M_DBC = -27 +MAX_MH2_DBC = -40 +MAX_H2_DBC = -39 +MAX_OTHER_DBC = -34 +LP2_CORRECTION = 10 +MAX_POWER = -10 +IF_REQUIRED_MIN = 2320 +IF_REQUIRED_MAX = 2580 +IF_TEST_RANGE = 256 +SLEEP_TIME = 0.05 # seconds to wait between start of TX and start of RX + +@dataclass +class TestCase(): + name: str + freq: int + amp: bool + direction: str + base_ecode: int + rx_lna_gain: int + rx_vga_gain: int + tx_gain: int + +# Try to keep rx_lna_gain and rx_vga_gain between 8 and 32. +bp1txamp = TestCase(name="BP1-TX-amp", freq=2500, amp=True, direction="tx", + base_ecode=320, rx_lna_gain=8, rx_vga_gain=16, tx_gain=5) +lp1txamp = TestCase(name="LP1-TX-amp", freq=915, amp=True, direction="tx", + base_ecode=420, rx_lna_gain=8, rx_vga_gain=16, tx_gain=14) +lp2txamp = TestCase(name="LP2-TX-amp", freq=12, amp=True, direction="tx", + base_ecode=2420, rx_lna_gain=8, rx_vga_gain=16, tx_gain=13) +hp1txamp = TestCase(name="HP1-TX-amp", freq=5995, amp=True, direction="tx", + base_ecode=520, rx_lna_gain=32, rx_vga_gain=16, tx_gain=18) + +bp1txnoamp = TestCase(name="BP1-TX-noamp", freq=2500, amp=False, direction="tx", + base_ecode=350, rx_lna_gain=16, rx_vga_gain=16, tx_gain=14) +lp1txnoamp = TestCase(name="LP1-TX-noamp", freq=915, amp=False, direction="tx", + base_ecode=450, rx_lna_gain=16, rx_vga_gain=12, tx_gain=27) +lp2txnoamp = TestCase(name="LP2-TX-noamp", freq=12, amp=False, direction="tx", + base_ecode=2450, rx_lna_gain=16, rx_vga_gain=18, tx_gain=20) +hp1txnoamp = TestCase(name="HP1-TX-noamp", freq=5995, amp=False, direction="tx", + base_ecode=550, rx_lna_gain=32, rx_vga_gain=24, tx_gain=19) + +# Much of the information in the RX test cases is a duplication of information +# in the TX test cases, but it's easier to keep legacy error codes this way. +bp1rxamp = TestCase(name="BP1-RX-amp", freq=2500, amp=True, direction="rx", + base_ecode=620, rx_lna_gain=8, rx_vga_gain=16, tx_gain=16) +lp1rxamp = TestCase(name="LP1-RX-amp", freq=915, amp=True, direction="rx", + base_ecode=720, rx_lna_gain=16, rx_vga_gain=16, tx_gain=18) +lp2rxamp = TestCase(name="LP2-RX-amp", freq=12, amp=True, direction="rx", + base_ecode=2720, rx_lna_gain=16, rx_vga_gain=16, tx_gain=18) +hp1rxamp = TestCase(name="HP1-RX-amp", freq=5995, amp=True, direction="rx", + base_ecode=820, rx_lna_gain=16, rx_vga_gain=28, tx_gain=38) + +bp1rxnoamp = TestCase(name="BP1-RX-noamp", freq=2500, amp=False, direction="rx", + base_ecode=650, rx_lna_gain=16, rx_vga_gain=16, tx_gain=15) +lp1rxnoamp = TestCase(name="LP1-RX-noamp", freq=915, amp=False, direction="rx", + base_ecode=750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=35) +lp2rxnoamp = TestCase(name="LP2-RX-noamp", freq=12, amp=False, direction="rx", + base_ecode=2750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=38) +hp1rxnoamp = TestCase(name="HP1-RX-noamp", freq=5995, amp=False, direction="rx", + base_ecode=850, rx_lna_gain=16, rx_vga_gain=36, tx_gain=46) + +praline_rf_test_cases = ( + bp1txamp, lp1txamp, lp2txamp, hp1txamp, + bp1txnoamp, lp1txnoamp, lp2txnoamp, hp1txnoamp, + bp1rxamp, lp1rxamp, lp2rxamp, hp1rxamp, + bp1rxnoamp, lp1rxnoamp, lp2rxnoamp, hp1rxnoamp) + +# Praline r1.1.0 requires different gain configuration +r110_bp1rxnoamp = TestCase(name="BP1-RX-noamp", freq=2500, amp=False, direction="rx", + base_ecode=650, rx_lna_gain=16, rx_vga_gain=16, tx_gain=15) +r110_lp1rxnoamp = TestCase(name="LP1-RX-noamp", freq=915, amp=False, direction="rx", + base_ecode=750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=35) +r110_lp2rxnoamp = TestCase(name="LP2-RX-noamp", freq=12, amp=False, direction="rx", + base_ecode=2750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=38) +r110_hp1rxnoamp = TestCase(name="HP1-RX-noamp", freq=5995, amp=False, direction="rx", + base_ecode=850, rx_lna_gain=16, rx_vga_gain=36, tx_gain=46) + +r110_bp1txamp = TestCase(name="BP1-TX-amp", freq=2500, amp=True, direction="tx", + base_ecode=320, rx_lna_gain=8, rx_vga_gain=16, tx_gain=5) +r110_lp1txamp = TestCase(name="LP1-TX-amp", freq=915, amp=True, direction="tx", + base_ecode=420, rx_lna_gain=8, rx_vga_gain=16, tx_gain=10) +r110_lp2txamp = TestCase(name="LP2-TX-amp", freq=12, amp=True, direction="tx", + base_ecode=2420, rx_lna_gain=8, rx_vga_gain=16, tx_gain=12) +r110_hp1txamp = TestCase(name="HP1-TX-amp", freq=5995, amp=True, direction="tx", + base_ecode=520, rx_lna_gain=32, rx_vga_gain=16, tx_gain=17) + +r110_bp1txnoamp = TestCase(name="BP1-TX-noamp", freq=2500, amp=False, direction="tx", + base_ecode=350, rx_lna_gain=16, rx_vga_gain=16, tx_gain=13) +r110_lp1txnoamp = TestCase(name="LP1-TX-noamp", freq=915, amp=False, direction="tx", + base_ecode=450, rx_lna_gain=16, rx_vga_gain=12, tx_gain=23) +r110_lp2txnoamp = TestCase(name="LP2-TX-noamp", freq=12, amp=False, direction="tx", + base_ecode=2450, rx_lna_gain=16, rx_vga_gain=18, tx_gain=18) +r110_hp1txnoamp = TestCase(name="HP1-TX-noamp", freq=5995, amp=False, direction="tx", + base_ecode=550, rx_lna_gain=32, rx_vga_gain=24, tx_gain=18) + +r110_bp1rxamp = TestCase(name="BP1-RX-amp", freq=2500, amp=True, direction="rx", + base_ecode=620, rx_lna_gain=8, rx_vga_gain=16, tx_gain=16) +r110_lp1rxamp = TestCase(name="LP1-RX-amp", freq=915, amp=True, direction="rx", + base_ecode=720, rx_lna_gain=16, rx_vga_gain=16, tx_gain=8) +r110_lp2rxamp = TestCase(name="LP2-RX-amp", freq=12, amp=True, direction="rx", + base_ecode=2720, rx_lna_gain=16, rx_vga_gain=16, tx_gain=10) +r110_hp1rxamp = TestCase(name="HP1-RX-amp", freq=5995, amp=True, direction="rx", + base_ecode=820, rx_lna_gain=16, rx_vga_gain=28, tx_gain=25) + +r110_bp1rxnoamp = TestCase(name="BP1-RX-noamp", freq=2500, amp=False, direction="rx", + base_ecode=650, rx_lna_gain=16, rx_vga_gain=16, tx_gain=15) +r110_lp1rxnoamp = TestCase(name="LP1-RX-noamp", freq=915, amp=False, direction="rx", + base_ecode=750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=24) +r110_lp2rxnoamp = TestCase(name="LP2-RX-noamp", freq=12, amp=False, direction="rx", + base_ecode=2750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=28) +r110_hp1rxnoamp = TestCase(name="HP1-RX-noamp", freq=5995, amp=False, direction="rx", + base_ecode=850, rx_lna_gain=16, rx_vga_gain=36, tx_gain=30) + +praline_r110_rf_test_cases = ( + r110_bp1txamp, r110_lp1txamp, r110_lp2txamp, r110_hp1txamp, + r110_bp1txnoamp, r110_lp1txnoamp, r110_lp2txnoamp, r110_hp1txnoamp, + r110_bp1rxamp, r110_lp1rxamp, r110_lp2rxamp, r110_hp1rxamp, + r110_bp1rxnoamp, r110_lp1rxnoamp, r110_lp2rxnoamp, r110_hp1rxnoamp) + +ifmin = TestCase(name="IF-min", freq=IF_REQUIRED_MIN, amp=None, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=12) +ifmax = TestCase(name="IF-max", freq=IF_REQUIRED_MAX, amp=None, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=18) + +ppm = TestCase(name="PPM", freq=2507, amp=False, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=18) + +noise = TestCase(name="Noise", freq=2550, amp=True, direction=None, + base_ecode=None, rx_lna_gain=40, rx_vga_gain=52, tx_gain=None) + +r9_tester_cal = [1.1, 0.4, 0.4, 1.1, 0.8, 0.2, 0.6, 1.6, -0.4, -1.2, -1.1, 1.1, -1.4, -0.9, 0.1, 1.8] +r9_eut_cal = [-1.1, -1.6, -1.4, -1.3, -1.3, -0.9, 0.1, 1.8, 0.8, 1.1, 0.9, -0.2, 0.9, 0.2, 0.6, 1.5] +og_tester_cal = [-0.4, -0.3, -0.2, -0.4, -0.8, -0.5, -0., -0.1, 1.4, 2., 1.6, -0.1, 1.5, 0.7, 0.5, -0.3] +og_eut_cal = [1.8, 1.8, 1.6, 2., 1.3, 0.7, 0.5, -0.3, 0.2, -0.3, -0.5, 1.2, -0.8, -0.5, -0., -0.1] + +emessages = { + 1: "Wrong device placed in DFU mode", + 2: "DFU device not found", + 3: "Failed to parse a serial number from hackrf_info", + 4: "No path to hackrf host tools found. Please provide a directory via --hostdir", + 5: """Specified TESTER binary directory must be different from the found EUT bin directory + If shared TESTER/EUT binary directory is intended, omit --testerdir""", + 6: "Unable to parse valid serial number from connected devices", + 7: "TESTER and EUT cannot be the same device", + 8: "Invalid TESTER unit, please use a HackRF One", + 9: "Invalid EUT unit, please use a HackRF Pro", + 10: "Clock readback failed", + 11: "SGPIO RX test failed", + 12: "Loopback test failed", + 13: "Self-test failed, see above", + 14: "FPGA configuration failed", + 15: "Multiple self-test failures, see above", + 16: "Mixer self-test failed", + 17: "Transceiver self-test failed", + 18: "32kHz oscillator test failed", + 19: "Too many devices found using unique host tool directory", + 20: "Factory TESTER device not found", + 21: "Factory EUT device not found", + 22: "SGPIO RX test timed out", + 23: "Loopback test timed out", + 24: "FPGA SPI test failed", + 60: "Unable to program firmware via DFU", + 65: "EUT not detected after DFU programming", + 70: "Unable to program SPI flash", + 75: "EUT not detected after flashing", + 76: "Unable to reset EUT", + 77: "Unable to reset TESTER", + 78: "EUT not detected after reset", + 79: "TESTER not detected after reset", + 80: "Could not find EUT", + 81: "Could not find TESTER", + 82: "Found multiple candidate EUTs", + 83: "Found multiple candidate TESTERs", + 84: "EUT running from RAM instead of flash", + 85: "TESTER running from RAM instead of flash", + 86: "Couldn't parse hackrf_info output", + 87: "hackrf_info command failed", + 88: "Incorrect EUT hardware revision", + 89: "Incorrect TESTER hardware revision", + 90: "EUT has incorrect manufacturer pin strap", + 91: "TESTER has incorrect manufacturer pin strap", + 92: "No HackRFs found", + 99: "Incorrect device name", + 100: "EUT couldn't verify clkgen register", + 101: "TESTER couldn't verify clkgen register", + 120: "EUT couldn't verify xcvr register", + 121: "TESTER couldn't verify xcvr register", + 140: "EUT couldn't verify mixer register", + 141: "TESTER couldn't verify mixer register", + 150: "Failed RX for IF verification", + 152: "Couldn't parse received power", + 154: "Received power out of bounds", + 160: "Insufficient IF range", + 170: "RX operation failed", + 172: "Couldn't parse hackrf_sweep output", + 180: "Subprocess timed out", + 190: "Failed to configure LEDs", + 200: "hackrf_clock command failed", + 210: "TESTER failed to detect EUT CLKOUT", + 211: "EUT failed to detect TESTER CLKOUT", + 212: "TESTER detected spurious CLKIN", + 213: "EUT detected spurious CLKIN", + 220: "Failed TESTER CLKIN activation RX", + 221: "Failed EUT CLKIN activation RX", + 230: "Failed TESTER PLL check", + 231: "Failed EUT PLL check", + 232: "TESTER PLL failed to lock", + 233: "EUT PLL failed to lock", + 240: "Clock synchronization failure", + 250: "Failed PPM detection sweep", + 252: "Couldn't parse PPM test sweep data", + 254: "TESTER couldn't detect PPM test transmission", + 255: "EUT couldn't detect PPM test transmission", + 260: "Frequency error exceeds limit", + 300: "Failed baseline RX", + 302: "Couldn't parse baseline RX power", + 306: "Baseline RX power too high", + 310: "Failed noise RX", + 311: "Couldn't parse noise RX power", + 312: "Noise RX power out of range", + 313: "Required noise gain out of range", + 315: "Couldn't read noise RX file", + 316: "Too little variation in ADC bit", + 317: "ADC bit correlates strongly with another bit", + 321: "Excessive TX DC offset in AMP txbp1", + 322: "insufficient signal strength in AMP txbp1", + 323: "AMP txbp1 clipping", + 325: "peak found at unexpected frequency in AMP txbp1", + 330: "harmonics detected in AMP txbp1", + 335: "neighbor magnitude exceeded in AMP txbp1", + 340: "neighbor magnitude exceeded in AMP txbp1", + 345: "spectrum mirrored or inverted in AMP txbp1", + 350: "excessive power out of channel in AMP txbp1", + 351: "Excessive TX DC offset in NOAMP txbp1", + 352: "insufficient signal strength in NOAMP txbp1", + 353: "NOAMP txbp1 clipping", + 355: "peak found at unexpected frequency in NOAMP txbp1", + 360: "harmonics detected in NOAMP txbp1", + 365: "neighbor magnitude exceeded in NOAMP txbp1", + 370: "neighbor magnitude exceeded in NOAMP txbp1", + 375: "spectrum mirrored or inverted in NOAMP txbp1", + 380: "excessive power out of channel in NOAMP txbp1", + 421: "Excessive TX DC offset in AMP txlp1", + 422: "insufficient signal strength in AMP txlp1", + 423: "AMP txlp1 clipping", + 425: "peak found at unexpected frequency in AMP txlp1", + 430: "harmonics detected in AMP txlp1", + 435: "neighbor magnitude exceeded in AMP txlp1", + 440: "neighbor magnitude exceeded in AMP txlp1", + 445: "spectrum mirrored or inverted in AMP txlp1", + 450: "excessive power out of channel in AMP txlp1", + 451: "Excessive TX DC offset in NOAMP txlp1", + 452: "insufficient signal strength in NOAMP txlp1", + 453: "NOAMP txlp1 clipping", + 455: "peak found at unexpected frequency in NOAMP txlp1", + 460: "harmonics detected in NOAMP txlp1", + 465: "neighbor magnitude exceeded in NOAMP txlp1", + 470: "neighbor magnitude exceeded in NOAMP txlp1", + 475: "spectrum mirrored or inverted in NOAMP txlp1", + 480: "excessive power out of channel in NOAMP txlp1", + 2421: "Excessive TX DC offset in AMP txlp2", + 2422: "insufficient signal strength in AMP txlp2", + 2423: "AMP txlp2 clipping", + 2425: "peak found at unexpected frequency in AMP txlp2", + 2430: "harmonics detected in AMP txlp2", + 2435: "neighbor magnitude exceeded in AMP txlp2", + 2440: "neighbor magnitude exceeded in AMP txlp2", + 2445: "spectrum mirrored or inverted in AMP txlp2", + 2450: "excessive power out of channel in AMP txlp2", + 2451: "Excessive TX DC offset in NOAMP txlp2", + 2452: "insufficient signal strength in NOAMP txlp2", + 2453: "NOAMP txlp2 clipping", + 2455: "peak found at unexpected frequency in NOAMP txlp2", + 2460: "harmonics detected in NOAMP txlp2", + 2465: "neighbor magnitude exceeded in NOAMP txlp2", + 2470: "neighbor magnitude exceeded in NOAMP txlp2", + 2475: "spectrum mirrored or inverted in NOAMP txlp2", + 2480: "excessive power out of channel in NOAMP txlp2", + 521: "Excessive TX DC offset in AMP txhp1", + 522: "insufficient signal strength in AMP txhp1", + 523: "AMP txhp1 clipping", + 525: "peak found at unexpected frequency in AMP txhp1", + 530: "harmonics detected in AMP txhp1", + 535: "neighbor magnitude exceeded in AMP txhp1", + 540: "neighbor magnitude exceeded in AMP txhp1", + 545: "spectrum mirrored or inverted in AMP txhp1", + 550: "excessive power out of channel in AMP txhp1", + 551: "Excessive TX DC offset in NOAMP txhp1", + 552: "insufficient signal strength in NOAMP txhp1", + 553: "NOAMP txhp1 clipping", + 555: "peak found at unexpected frequency in NOAMP txhp1", + 560: "harmonics detected in NOAMP txhp1", + 565: "neighbor magnitude exceeded in NOAMP txhp1", + 570: "neighbor magnitude exceeded in NOAMP txhp1", + 575: "spectrum mirrored or inverted in NOAMP txhp1", + 580: "excessive power out of channel in NOAMP txhp1", + 621: "Excessive TX DC offset in AMP rxbp1", + 622: "insufficient signal strength in AMP rxbp1", + 623: "AMP rxbp1 clipping", + 625: "peak found at unexpected frequency in AMP rxbp1", + 630: "harmonics detected in AMP rxbp1", + 635: "neighbor magnitude exceeded in AMP rxbp1", + 640: "neighbor magnitude exceeded in AMP rxbp1", + 645: "spectrum mirrored or inverted in AMP rxbp1", + 650: "excessive power out of channel in AMP rxbp1", + 651: "Excessive TX DC offset in NOAMP rxbp1", + 652: "insufficient signal strength in NOAMP rxbp1", + 653: "NOAMP rxbp1 clipping", + 655: "peak found at unexpected frequency in NOAMP rxbp1", + 660: "harmonics detected in NOAMP rxbp1", + 665: "neighbor magnitude exceeded in NOAMP rxbp1", + 670: "neighbor magnitude exceeded in NOAMP rxbp1", + 675: "spectrum mirrored or inverted in NOAMP rxbp1", + 680: "excessive power out of channel in NOAMP rxbp1", + 721: "Excessive TX DC offset in AMP rxlp1", + 722: "insufficient signal strength in AMP rxlp1", + 723: "AMP rxlp1 clipping", + 725: "peak found at unexpected frequency in AMP rxlp1", + 730: "harmonics detected in AMP rxlp1", + 735: "neighbor magnitude exceeded in AMP rxlp1", + 740: "neighbor magnitude exceeded in AMP rxlp1", + 745: "spectrum mirrored or inverted in AMP rxlp1", + 750: "excessive power out of channel in AMP rxlp1", + 751: "Excessive TX DC offset in NOAMP rxlp1", + 752: "insufficient signal strength in NOAMP rxlp1", + 753: "NOAMP rxlp1 clipping", + 755: "peak found at unexpected frequency in NOAMP rxlp1", + 760: "harmonics detected in NOAMP rxlp1", + 765: "neighbor magnitude exceeded in NOAMP rxlp1", + 770: "neighbor magnitude exceeded in NOAMP rxlp1", + 775: "spectrum mirrored or inverted in NOAMP rxlp1", + 780: "excessive power out of channel in NOAMP rxlp1", + 2721: "Excessive TX DC offset in AMP rxlp2", + 2722: "insufficient signal strength in AMP rxlp2", + 2723: "AMP rxlp2 clipping", + 2725: "peak found at unexpected frequency in AMP rxlp2", + 2730: "harmonics detected in AMP rxlp2", + 2735: "neighbor magnitude exceeded in AMP rxlp2", + 2740: "neighbor magnitude exceeded in AMP rxlp2", + 2745: "spectrum mirrored or inverted in AMP rxlp2", + 2750: "excessive power out of channel in AMP rxlp2", + 2751: "Excessive TX DC offset in NOAMP rxlp2", + 2752: "insufficient signal strength in NOAMP rxlp2", + 2753: "NOAMP rxlp2 clipping", + 2755: "peak found at unexpected frequency in NOAMP rxlp2", + 2760: "harmonics detected in NOAMP rxlp2", + 2765: "neighbor magnitude exceeded in NOAMP rxlp2", + 2770: "neighbor magnitude exceeded in NOAMP rxlp2", + 2775: "spectrum mirrored or inverted in NOAMP rxlp2", + 2780: "excessive power out of channel in NOAMP rxlp2", + 821: "Excessive TX DC offset in AMP rxhp1", + 822: "insufficient signal strength in AMP rxhp1", + 823: "AMP rxhp1 clipping", + 825: "peak found at unexpected frequency in AMP rxhp1", + 830: "harmonics detected in AMP rxhp1", + 835: "neighbor magnitude exceeded in AMP rxhp1", + 840: "neighbor magnitude exceeded in AMP rxhp1", + 845: "spectrum mirrored or inverted in AMP rxhp1", + 850: "excessive power out of channel in AMP rxhp1", + 851: "Excessive TX DC offset in NOAMP rxhp1", + 852: "insufficient signal strength in NOAMP rxhp1", + 853: "NOAMP rxhp1 clipping", + 855: "peak found at unexpected frequency in NOAMP rxhp1", + 860: "harmonics detected in NOAMP rxhp1", + 865: "neighbor magnitude exceeded in NOAMP rxhp1", + 870: "neighbor magnitude exceeded in NOAMP rxhp1", + 875: "spectrum mirrored or inverted in NOAMP rxhp1", + 880: "excessive power out of channel in NOAMP rxhp1", + 3000: "BP TX failure", + 3010: "BP RX failure", + 3020: "HP TX failure", + 3030: "HP RX failure", + 3040: "LP TX failure", + 3050: "LP RX failure", + 3060: "TX AMP failure", + 3070: "RX AMP failure", + 3080: "AMP bypass failure", + 3090: "LPF failure", + 3100: "HPF failure", + 3110: "mixer bypass failure", + 3120: "mixer failure", + 3130: "TX failure", + 3140: "RX failure", + 3150: "mixer TX failure", + 3160: "mixer RX failure", + 3170: "LP2 TX failure", + 3180: "LP2 RX failure", + 3190: "LP2 TX/RX failure", + 3200: "total RF failure", + 3210: "multiple RF failures, see list above", + 3220: "multiple clipping failures", + 3230: "TX clipping failure", + 3240: "RX clipping failure" +} + +def fail_rf(errors): + # check for combinations of RF errors + ecode = 0 + eset = set(errors) + + # error affects only bp tx + if ((322 in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3000 + errors.append(ecode) + + # error affects only bp rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3010 + errors.append(ecode) + + # error affects only hp tx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3020 + errors.append(ecode) + + # error affects only hp rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 in eset)): + ecode = 3030 + errors.append(ecode) + + # error affects only lp tx (both lp1 and lp2) + if ((322 not in eset) and (422 in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3040 + errors.append(ecode) + + # error affects only lp rx (both lp1 and lp2) + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 in eset) and (2722 in eset) and (822 not in eset)): + ecode = 3050 + errors.append(ecode) + + # error in tx amp path + if ((2422 in eset) and (352 not in eset) and (452 not in eset) and (2452 not in eset)): + ecode = 3060 + errors.append(ecode) + + # error in rx amp path + if ((2722 in eset) and (652 not in eset) and (752 not in eset) and (2752 not in eset)): + ecode = 3070 + errors.append(ecode) + + # error in amp bypass path + if ((352 in eset) and (452 in eset) and (2452 in eset) and (652 in eset) and (752 in eset) and (2752 in eset) and (322 not in eset) and (422 not in eset) and (2422 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset)): + ecode = 3080 + errors.append(ecode) + + # error in lpf path + if (((422 in eset) and (2422 in eset)) and ((722 in eset) and (2722 in eset)) and ((322 not in eset) and (622 not in eset)) and ((522 not in eset) and (822 not in eset))): + ecode = 3090 + errors.append(ecode) + + # error in hpf path + if (((522 in eset) and (822 in eset)) and ((322 not in eset) and (622 not in eset)) and ((422 not in eset) and (2422 not in eset) and (722 not in eset) and (2722 not in eset))): + ecode = 3100 + errors.append(ecode) + + # error affects both mixer bypass paths + if ((322 in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3110 + errors.append(ecode) + + # error in mixer tx/rx + if ((322 not in eset) and ((422 in eset) or (2422 in eset)) and (522 in eset) and (622 not in eset) and ((722 in eset) or (2722 in eset) or (822 in eset))): + ecode = 3120 + errors.append(ecode) + + if ((322 not in eset) and ((422 in eset) or (2422 in eset) or (522 in eset)) and (622 not in eset) and ((722 in eset) and (2722 in eset) and (822 in eset))): + ecode = 3120 + errors.append(ecode) + + # error in all tx, no rx + if ((322 in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset) and (352 in eset) and (452 in eset) and (2452 in eset) and (552 in eset)): + ecode = 3130 + errors.append(ecode) + + # error in all rx, no tx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 in eset) and (2722 in eset) and (822 in eset) and (652 in eset) and (752 in eset) and (2752 in eset) and (852 in eset)): + ecode = 3140 + errors.append(ecode) + + # error in all mixer tx + if ((322 not in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3150 + errors.append(ecode) + + # error in all mixer rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 in eset) and (2722 in eset) and (822 in eset)): + ecode = 3160 + errors.append(ecode) + + # error affecting only lp2 tx + if ((322 not in eset) and (422 not in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset) and (2752 in eset)): + ecode = 3170 + errors.append(ecode) + + # error affecting only lp2 rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 in eset) and (822 not in eset) and (2752 in eset)): + ecode = 3180 + errors.append(ecode) + + # error affecting only lp2 rx/tx + if ((322 not in eset) and (422 not in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 in eset) and (822 not in eset)): + ecode = 3190 + errors.append(ecode) + + # error in all rx/tx + if ((322 in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 in eset) and (722 in eset) and (2722 in eset) and (822 in eset)): + ecode = 3200 + errors.append(ecode) + + # If there are clipping failures, we can't trust the other RF results, so fail(). + tx_clipping_count = 0 + rx_clipping_count = 0 + for code in (323, 353, 423, 453, 2423, 2453, 523, 553): + if code in eset: + tx_clipping_count += 1 + for code in (623, 653, 723, 753, 2723, 2753, 823, 853): + if code in eset: + rx_clipping_count += 1 + if tx_clipping_count > 1 and rx_clipping_count == 0: + fail(3230) + elif tx_clipping_count == 0 and rx_clipping_count > 1: + fail(3240) + elif tx_clipping_count > 0 and rx_clipping_count > 0: + fail(3220) + + elif (not ecode) and (len(errors) > 1): + # multiple failures without a logical grouping + ecode = 3210 + errors.append(ecode) + + for error in errors[:-1]: + out(f"RF failure {error}: {emessages[error]}") + fail(errors[-1]) + +def log(message=""): + if args.log: + with open(args.log, "a") as log_file: + print(message, file=log_file) + return + +def out(message=""): + log(message) + print(message) + +def fail(error_code): + out(f"FAIL {error_code}: {emessages[error_code]}") + sys.exit(2) + +class HackRF: + def __init__(self, name, bin_dir, serial, mf_check, id=None, revision=None, unique_bin=False, factory_test=False): + self.name = name + self.bin_dir = bin_dir + self.unique_bin = unique_bin + self.id = None + self.revision = None + self.serial = None + self.clkout_connected = False + self.tester_cal = [0] * 16 + self.eut_cal = [0] * 16 + self.errors = [] + self.unit_number = 0 + self.partner = None + + if self.name == "TESTER": + self.unit_number = 1 + elif self.name == "EUT": + self.rf_test_cases = praline_rf_test_cases + else: + fail(99) + + info = subprocess.run([bin_dir + "/hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + log(info.stdout + info.stderr) + if info.returncode != 0 or "failed" in info.stderr: + fail(87) + + # parse the hackrf_info output + count = info.stdout.count("Found HackRF") + if count < 1: + fail(92) + if count > 1 and self.name == "TESTER" and self.unique_bin: + fail(83) + if mf_check and "does not appear to have been manufactured by Great Scott Gadgets" in info.stdout: + fail(90 + self.unit_number) + + try: + sn = "" + devices_list = [d.strip() for d in info.stdout.split("Found HackRF") if d.strip()] + for device in devices_list: + sn_found = re.search(r'Serial number: \w+', device) + if sn_found: + sn = sn_found.group(0).split(': ')[1] + + id_found = re.search(r'Board ID Number: .', device) + if id_found: + id = id_found.group(0).split(': ')[1] + + rev_found = re.search(r'Hardware Revision: .+', device) + if rev_found: + rev = rev_found.group(0).split(': ')[1] + + if sn == serial: + self.serial = sn + self.id = id + self.revision = rev + break + + out(f"{self.name} Serial number: {self.serial}") + out(f"{self.name} Board ID: {self.id}") + out(f"{self.name} Hardware Revision: {self.revision}") + out(f"{self.name} binary directory {self.bin_dir}") + except: + out(traceback.format_exc()) + fail(6) + + if self.serial == None: + fail(80 + self.unit_number) + + if self.name == "TESTER" and factory_test and (self.id != "2" and self.id != "4"): + fail(8) + elif self.name == "EUT" and factory_test and self.id != "5": + fail(9) + + if revision and self.revision != revision: + fail(88 + self.unit_number) + + if self.revision == "r9": + self.tester_cal = r9_tester_cal + self.eut_cal = r9_eut_cal + else: + self.tester_cal = og_tester_cal + self.eut_cal = og_eut_cal + + if self.name == "EUT" and self.id == "5" and self.revision == "r1.1": + self.rf_test_cases = praline_r110_rf_test_cases + + def clkin(self): + command = subprocess.run([self.bin_dir + "/hackrf_clock", "-i", "-d", + self.serial], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + out(f"{self.name} CLKIN request failed") + fail(200) + if "no clock signal detected" in command.stdout: + log(f"{self.name}: no clock signal detected") + return False + elif "clock signal detected" in command.stdout: + log(f"{self.name}: clock signal detected") + return True + else: + log(command.stdout + command.stderr) + out(f"Couldn't parse {self.name} CLKIN status") + fail(200) + + # Warning: Avoid clock loops by disabling your partner's CLKOUT before + # enabling your own. + def clkout(self, enable): + command = subprocess.run([self.bin_dir + "/hackrf_clock", "-o", + "1" if enable else "0", "-d", self.serial], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + out(f"{self.name} CLKOUT control failed") + fail(200) + + if self.partner and self.clkout_connected: + timeout = time.time() + 1 + while time.time() < timeout: + if self.partner.clkin() == enable: + break + if self.partner.clkin() != enable: + if enable: + fail(210 + self.unit_number) + else: + if self.name == "EUT": + out("Note: use --tcxo to use TCXO or external reference on TESTER") + fail(212 + self.unit_number) + + # transceiver operation to switch clock source + source = "CLKIN" if enable else "crystal" + log(f"switching {self.partner.name} to {source}") + receive = subprocess.run([self.partner.bin_dir + "/hackrf_transfer", "-d", + self.partner.serial, "-n1", "-r", "/dev/null", "-f", "2500000000", + "-a", "0", "-l", "0", "-g", "0"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(220 + self.unit_number) + + # confirm that PLL A locked to new source + timeout = time.time() + 1 + while time.time() < timeout: + debug = subprocess.run([self.partner.bin_dir + "/hackrf_debug", "-d", + self.partner.serial, "-srn0"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + log(debug.stdout) + if debug.returncode != 0: + log(debug.stderr) + fail(230 + self.unit_number) + output = str(debug.stdout).split() + try: + val = int(output[3], 0) + except: + log(debug.stderr) + log(traceback.format_exc()) + fail(230 + self.unit_number) + # Check LOL_A + if not (val >> 5) & 1: + break + if (val >> 5) & 1: + fail(232 + self.unit_number) + time.sleep(0.1) + else: + time.sleep(0.2) + + def test_clkout(self): + assert self.clkout_connected + self.partner.clkout(False) + self.clkout(True) + frequency_error_ppm = self.clock_error_ppm() + log(f"{self.name}->{self.partner.name} CLK: {frequency_error_ppm} ppm") + if abs(frequency_error_ppm) > 1: + out(f"{self.partner.name} CLKIN: unexpected frequency error while synchronized") + fail(240) + + def test_clkin(self): + self.partner.test_clkout() + + def clock_error_ppm(self): + # ppm.freq is in MHz, but we use it as Hz for the FFT bin width, + # resulting in bins with a width of 1 ppm of the transmission + # frequency. + bin_width = str(ppm.freq) + tx_frequency = str(ppm.freq * ONE_MHZ) + sweep_range = f"{ppm.freq-1}:{ppm.freq+19}" + expected_bin = round(ONE_MHZ/ppm.freq) + + log(f"{self.name} transmitting to {self.partner.name} for PPM measurement") + transmit = subprocess.Popen([self.bin_dir + "/hackrf_transfer", "-d", + self.serial, "-c", "127", "-a", "0", "-x", f"{ppm.tx_gain}", "-f", + tx_frequency], stdout=subprocess.PIPE, stderr=subprocess.PIPE, + encoding="utf-8") + + time.sleep(SLEEP_TIME) + sweep = subprocess.run([self.partner.bin_dir + "/hackrf_sweep", "-d", + self.partner.serial, "-N", "13", "-w", bin_width, "-f", sweep_range, "-a", + "0", "-l", f"{ppm.rx_lna_gain}", "-g", f"{ppm.rx_vga_gain}"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if sweep.returncode != 0: + log(sweep.stdout + sweep.stderr) + fail(250) + + # parse the hackrf_sweep output + try: + rows = sweep.stdout.split("\n") + # Note: skipping data from the first twelve sweeps until issue #1230 is resolved. + row = rows[48].split(", ") + bins = [float(bin) for bin in row[6:]] + peak_bin = bins.index(max(bins)) + frequency_error_ppm = peak_bin - expected_bin + except: + log(sweep.stdout + sweep.stderr) + log(traceback.format_exc()) + fail(252) + + log(f"PPM max bin {peak_bin} power: {bins[peak_bin]}") + for row in rows[0:49:4]: + bins = [float(bin) for bin in row.split(", ")[6:]] + peak_bin = bins.index(max(bins)) + log(f"peak bin {peak_bin}: {bins[peak_bin]}") + if max(bins) < SIGNAL_THRESHOLD: + fail(254 + self.unit_number) + transmit.terminate() + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + log(tx_out + tx_err) + out(f"Warning: {self.name} PPM test transmit failed") + return frequency_error_ppm + + def test_xtal(self): + self.clkout(False) + self.partner.clkout(False) + frequency_error_ppm = self.clock_error_ppm() + out(f"{self.name} crystal frequency error: {frequency_error_ppm} ppm") + if abs(frequency_error_ppm) > MAX_PPM: + fail(260) + + def verify_register(self, target, address, value): + command = subprocess.run([self.bin_dir + "/hackrf_debug", + f"--{target}", "--register", address, "--read", "--device", + self.serial], capture_output=True, encoding="UTF-8") + log(f"Checking {target} register {address}") + if value in command.stdout: + return True + else: + log("Unexpected result:") + log(command.stdout + command.stderr) + return False + + def test_clkgen(self): + if not self.verify_register("si5351", "2", "0x03"): + fail(100 + self.unit_number) + + def test_mixer(self): + if not self.verify_register("rffc5072", "2", "0x9055"): + fail(140 + self.unit_number) + + def test_xcvr(self): + if not self.verify_register("max283", "28", "0x0c0"): + fail(120 + self.unit_number) + + def test_serial(self): + log(f"Testing {self.name} serial communications") + self.test_clkgen() + self.test_mixer() + self.test_xcvr() + + # Ensure that hackrf_transfer works and that the received power is within + # the expected range with no transmission active. + def baseline_rx(self, test_case): + # Test at the TX tuning frequency of measure_rf() + center_freq = (test_case.freq * ONE_MHZ) + 1500000 + receive = subprocess.run([self.bin_dir + "/hackrf_transfer", "-d", + self.serial, "-n10000", "-r", "/dev/null", "-f", + f"{center_freq}", "-a", "0", "-l", f"{test_case.rx_lna_gain}", + "-g", f"{test_case.rx_vga_gain}", "-b", + "1750000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + log(f"Failed {self.name} {test_case.name} baseline RX") + fail(300) + + output = str(receive.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(receive.stdout + receive.stderr) + log(traceback.format_exc()) + log(f"Couldn't parse {self.name} {test_case.name} baseline RX power") + fail(302) + # The theoretical minimum power is about -48 dB. The expected power is + # about -30 dB. + log(f"{self.name} {test_case.name} baseline power: {power}") + if power > MAX_BASELINE: + fail(306) + + # Check the ADC for shorts or other unexpected behavior by sampling + # amplified noise. + def noise_rx(self, test_case): + num_samples = 1000 + log(f"Testing {self.name} {test_case.name}") + center_freq = test_case.freq * ONE_MHZ + + low_gain = 0 + high_gain = 16 + while high_gain > low_gain: + gain = (high_gain + low_gain) // 2 + receive = subprocess.run([self.bin_dir + "/hackrf_transfer", "-d", + self.serial, "-n", f"{num_samples*10}", "-r", f"{NOISE}", "-f", + f"{center_freq}", "-a", "1" if test_case.amp else "0", "-l", + f"{test_case.rx_lna_gain}", "-g", f"{gain*2 + 32}", "-b", + "28000000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(310) + output = str(receive.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(receive.stdout + receive.stderr) + log(traceback.format_exc()) + fail(311) + log(f"{self.name} {test_case.name} RX power at -g {gain*2 + 32}: {power}") + if power > -2: + high_gain = gain + elif power > -5: + break + else: + low_gain = gain + 1 + + # We want the power to be between -1 and -9 dB to ensure that all eight + # bits are flipped without much clipping. + if power < -9 or power > -1: + fail(312) + elif gain > 16 or gain < 4: + fail(313) + + bit_count = [0] * 8 + matches = [] + for bit in range(8): + matches.append([0] * 8) + + try: + file = open(f"{NOISE}", "rb") + data = file.read() + assert len(data) == num_samples * 20 + data = data[-num_samples*2:] + for byte in data: + for bit in range(8): + bit_count[bit] += (byte>>bit)&1 + for match_bit in range(bit + 1, 8): + if (byte>>bit)&1 == (byte>>match_bit)&1: + matches[bit][match_bit] += 1 + except: + fail(315) + log(f"{self.name} ADC bit counts: {bit_count}") + log(f"{self.name} ADC bit matches: {matches}") + for bit in range(7): + if bit_count[bit] < (0.2 * len(data)) or bit_count[bit] > (0.8 * len(data)): + log(f"{self.name} ADC bit {bit} set in {bit_count[bit]} out of {len(data)} bytes") + fail(316) + # Check for correlations between adjacent bits except between 6 and 7 (highest). + #for match_bit in range(bit + 1, 7): + for match_bit in range(bit + 1, 8): + if matches[bit][match_bit] > (0.999 * len(data)): + out(f"{self.name} ADC bit {bit} correlates with bit {match_bit}") + fail(317) + # DC bias can cause bit 7 to be predominantly unchanged, so only + # error if there is less than 1% variation. + if bit_count[7] < (0.001 * len(data)) or bit_count[bit] > (0.999 * len(data)): + out(f"{self.name} ADC bit 7 set in {bit_count[7]} out of {len(data)} bytes") + fail(316) + + def analyze_transfer(self, transfer, test_case): + # parse the hackrf_transfer output + output = str(transfer.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(transfer.stdout + transfer.stderr) + log(traceback.format_exc()) + fail(152) + log(f"{test_case.name} power at {test_case.freq} MHz: {power}") + + if test_case.base_ecode: + if power < SIGNAL_THRESHOLD: + log(f"{test_case.name} signal not strong enough") + self.errors.append(test_case.base_ecode + 2) + if power > -3: + log(f"{test_case.name} signal clipping") + self.errors.append(test_case.base_ecode + 3) + elif power < -48 or power > 0: + fail(154) + return power + + # Verify that signal power at a given IF in MHz is detected. + def verify_if_tuning(self, test_case): + transmit = subprocess.Popen([self.bin_dir + "/hackrf_transfer", "-d", + self.serial, "-c", "127", "-a", "0", "-x", f"{test_case.tx_gain}", + "-i", f"{test_case.freq*ONE_MHZ}", "-m", "0", "-F"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8") + + time.sleep(SLEEP_TIME) + receive = subprocess.run([self.partner.bin_dir + "/hackrf_transfer", "-d", + self.partner.serial, "-n10000", "-r", "/dev/null", "-f", + f"{(test_case.freq+1)*ONE_MHZ}", "-a", "0", "-l", + f"{test_case.rx_lna_gain}", "-g", f"{test_case.rx_vga_gain}", "-b", + "2500000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + transmit.terminate() + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(150) + + power = self.analyze_transfer(receive, test_case) + + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + log(tx_out + tx_err) + out(f"Warning: {self.name} IF transmit failed") + return power > SIGNAL_THRESHOLD + + def test_if_range(self, min_case, max_case): + low_end = IF_REQUIRED_MIN - (IF_TEST_RANGE // 2) + min_freq = IF_REQUIRED_MIN + (IF_TEST_RANGE // 2) + while min_freq > low_end: + min_case.freq = (min_freq + low_end) // 2 + if self.verify_if_tuning(min_case): + min_freq = min_case.freq + else: + low_end = min_case.freq + 1 + + high_end = IF_REQUIRED_MAX + (IF_TEST_RANGE // 2) + max_freq = IF_REQUIRED_MAX - (IF_TEST_RANGE // 2) + while max_freq < high_end: + max_case.freq = (max_freq + high_end + 1) // 2 + if self.verify_if_tuning(max_case): + max_freq = max_case.freq + else: + high_end = max_case.freq - 1 + + out(f"{self.name} IF range: {min_freq}-{max_freq} MHz") + if min_freq > IF_REQUIRED_MIN or max_freq < IF_REQUIRED_MAX: + fail(160) + + def analyze_sweep(self, sweep, test_case): + eut_cal = self.eut_cal[self.rf_test_cases.index(test_case)] + tester_cal = self.partner.tester_cal[self.rf_test_cases.index(test_case)] + correction = LP2_CORRECTION if test_case.freq < 30 else 0 + + # parse the hackrf_sweep output + try: + rows = sweep.stdout.split("\n") + # Note: skipping data from the first twelve sweeps until issue #1230 is resolved. + bins = np.zeros(225) + # average 10 sweeps + row_count = 0 + for row in rows[48:88:4]: + bins += np.array([float(x) for x in row.split(", ")[6:231]]) + row_count += 1 + assert row_count == 10 + bins /= 10 + # log the raw hackrf_sweep data before calibration + log(f"{', '.join(rows[12].split(', ')[:6])}, {np.array2string(bins, separator=', ', max_line_width=3000)[1:-1]}") + # apply calibration + bins -= eut_cal + bins -= tester_cal + peak_bin = bins.argmax() + except: + log(sweep.stdout + sweep.stderr) + log(traceback.format_exc()) + out(f"Couldn't parse {test_case.name} sweep data") + fail(172) + + # ensure acceptable performance + log(f"peak ({peak_bin}) {test_case.name}: {bins[peak_bin]:.2f}") + if bins[peak_bin] < SIGNAL_THRESHOLD: + for row in rows[0:88:4]: + bins = [float(bin) for bin in row.split(", ")[6:]] + peak_bin = bins.index(max(bins)) + log(f"peak bin {peak_bin}: {bins[peak_bin]}") + log(f"{test_case.name} signal not strong enough") + self.errors.append(test_case.base_ecode + 2) + return bins[peak_bin] + elif bins[peak_bin] > MAX_POWER: + log(f"{test_case.name} signal clipping") + self.errors.append(test_case.base_ecode + 3) + return bins[peak_bin] + tx_dc_power_dbc = bins[112] - bins[peak_bin] + if tx_dc_power_dbc > MAX_DC_DBC + correction: + log(f"{test_case.name} excessive TX DC offset {tx_dc_power_dbc:.1f} dBc") + self.errors.append(test_case.base_ecode + 1) + if peak_bin == 157: + log(f"{test_case.name} TX spectrum inverted") + self.errors.append(test_case.base_ecode + 25) + return bins[peak_bin] + elif peak_bin == 112: + log(f"{test_case.name} peak found at DC") + self.errors.append(test_case.base_ecode + 1) + return bins[peak_bin] + elif peak_bin >= 52 and peak_bin < 67: + log(f"{test_case.name} peak found at adjacent frequency") + self.errors.append(test_case.base_ecode + 15) + return bins[peak_bin] + elif peak_bin > 67 and peak_bin <= 82: + log(f"{test_case.name} peak found at adjacent frequency") + self.errors.append(test_case.base_ecode + 20) + return bins[peak_bin] + elif peak_bin != 67: + log(f"{test_case.name} peak found at unexpected frequency") + self.errors.append(test_case.base_ecode + 5) + return bins[peak_bin] + + if bins[157] - bins[67] > MAX_M_DBC + correction: + log(f"{test_case.name} TX spectrum mirrored") + self.errors.append(test_case.base_ecode + 25) + if (bins[22] - bins[67]) > MAX_H2_DBC + correction: + log(f"{test_case.name} excessive TX harmonic (bin 22): {bins[22]}") + self.errors.append(test_case.base_ecode + 10) + if (bins[202] - bins[67]) > MAX_MH2_DBC + correction: + log(f"{test_case.name} excessive TX harmonic (bin 202): {bins[202]}") + self.errors.append(test_case.base_ecode + 10) + worst_other_dbc = -999 + worst_other_bin = 999 + for i in range(225): + # Skip various frequencies where spurs are expected (most of which have their own tests above). + if (i < 52 and i != 22) or (i > 82 and i < 111) or (i > 113 and i < 156) or (i > 158 and i != 202): + other_dbc = bins[i] - bins[67] + if other_dbc > worst_other_dbc: + worst_other_dbc = other_dbc + worst_other_bin = i + if worst_other_dbc > MAX_OTHER_DBC + correction: + log(f"{test_case.name} excessive power at unexpected frequency ({worst_other_bin}: {bins[worst_other_bin]})") + self.errors.append(test_case.base_ecode + 30) + log(f"h2 (22) {test_case.name}: {(bins[22] - bins[67]):.2f}") + log(f"DC (112) {test_case.name}: {(bins[112] - bins[67]):.2f}") + log(f"m (157) {test_case.name}: {(bins[157] - bins[67]):.2f}") + log(f"mh2 (202) {test_case.name}: {(bins[202] - bins[67]):.2f}") + log(f"other ({worst_other_bin}) {test_case.name}: {worst_other_dbc:.2f}") + #FIXME look in another row for RX inversion? + return bins[peak_bin] + + def measure_rf(self, test_case, sweep=True): + log(f"Executing RF test case {test_case.name}, sweep={sweep}") + if test_case.direction == "tx": + transmitter = self + tx_amp = "1" if test_case.amp else "0" + receiver = self.partner + rx_amp = "0" + elif test_case.direction == "rx": + transmitter = self.partner + tx_amp = "0" + receiver = self + rx_amp = "1" if test_case.amp else "0" + else: + out(f"Error: Invalid direction in {test_case.name}") + sys.exit(1) + + # The nominal test frequency (as specified in test_case) is 1 MHz above + # the low end of the sweep range. The transmitted signal is 500 kHz + # above the nominal frequency, and the tuning (center) frequency of the + # transmitting device is 1 MHz above that. + tx_center_freq = (test_case.freq * ONE_MHZ) + 1500000 + sweep_range = f"{test_case.freq-1}:{test_case.freq+19}" + + transmit = subprocess.Popen([transmitter.bin_dir + "/hackrf_transfer", "-d", + transmitter.serial, "-R", "-t", WAVEFORM, "-a", tx_amp, "-x", + f"{test_case.tx_gain}", "-f", str(tx_center_freq)], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8") + + time.sleep(SLEEP_TIME) + if sweep: + receive = subprocess.run([receiver.bin_dir + "/hackrf_sweep", + "-d", receiver.serial, "-N", "22", "-w", "22222", "-f", + sweep_range, "-a", rx_amp, "-l", f"{test_case.rx_lna_gain}", + "-g", f"{test_case.rx_vga_gain}"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + else: + receive = subprocess.run([receiver.bin_dir + "/hackrf_transfer", + "-d", receiver.serial, "-n10000", "-r", "/dev/null", "-f", + f"{(test_case.freq)*ONE_MHZ}", "-a", rx_amp, "-l", + f"{test_case.rx_lna_gain}", "-g", f"{test_case.rx_vga_gain}", + "-b", "2500000"], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + transmit.terminate() + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + log(f"{receiver.name} Failed RX, sweep={sweep}") + fail(170) + + if sweep: + rssi = self.analyze_sweep(receive, test_case) + else: + rssi = self.analyze_transfer(receive, test_case) + + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + out(tx_out + tx_err) + out(f"Warning: {transmitter.name} transmit failed") + return rssi + + def test_rf_preliminary(self): + results = [] + + for test_case in (self.rf_test_cases): + if test_case.amp == False: + if test_case.direction == "rx": + self.baseline_rx(test_case) + elif self.partner: + self.partner.baseline_rx(test_case) + + self.noise_rx(noise) + # FIXME test for RX DC offset? + + if not self.partner: + out("Skipping RF tests") + return + + for test_case in (self.rf_test_cases): + results.append(int(round(self.measure_rf(test_case, sweep=False) - (SIGNAL_THRESHOLD + 11)))) + + log(f"Preliminary results: {results}") + if self.errors: + fail_rf(self.errors) + + def test_rf(self): + assert self.partner + results = [] + + for test_case in (self.rf_test_cases): + results.append(int(round(self.measure_rf(test_case, sweep=True) - (SIGNAL_THRESHOLD + 5)))) + + out(f"RF results summary: {results}") + if self.errors: + fail_rf(self.errors) + + def activate_leds(self, enable): + if enable: + out(f"Activating {self.name} LEDs") + state = 7 + else: + state = 1 + # Always illuminate MCU LED on Praline. + if self.id == "5": + state |= 8 + command = subprocess.run([self.bin_dir + "/hackrf_debug", "-d", self.serial, "--leds", + f"{state}"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + log(f"Failed to configure {self.name} LEDs ({state})") + fail(190) + + def debug_selftest(self): + errors = [] + + debug = subprocess.run([self.bin_dir + "/hackrf_debug", "-to", "-d", self.serial], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + log(debug.stdout + debug.stderr) + + fpga_test_found = re.search(r'FPGA configuration: \w+', debug.stdout) + if fpga_test_found: + if fpga_test_found.group(0).split(': ')[-1] != "PASS": + errors.append(14) + else: + out("Failure to find FPGA configuration result. Wrong firmware version? Continuing...") + + # Check for FPGA SPI result only if FPGA configuration passed. + if len(errors) == 0: + sgpio_test_found = re.search(r'FPGA SPI: \w+', debug.stdout) + if sgpio_test_found: + if sgpio_test_found.group(0).split(': ')[-1] != "PASS": + errors.append(24) + else: + out("Failure to find FPGA SPI test result. Wrong firmware version? Continuing...") + + # Check for SGPIO result only if FPGA configuration and SPI passed. + if len(errors) == 0: + sgpio_test_found = re.search(r'SGPIO RX test: \w+', debug.stdout) + if sgpio_test_found: + if sgpio_test_found.group(0).split(': ')[-1] == "TIMEOUT": + errors.append(22) + elif sgpio_test_found.group(0).split(': ')[-1] == "FAIL": + errors.append(11) + else: + out("Failure to find sgpio test result. Wrong firmware version? Continuing...") + + # Check for loopback result only if FPGA, SPI, and SGPIO passed. + if len(errors) == 0: + loopback_test_found = re.search(r'Loopback test: \w+', debug.stdout) + if loopback_test_found: + if loopback_test_found.group(0).split(': ')[-1] == "TIMEOUT": + errors.append(23) + elif loopback_test_found.group(0).split(': ')[-1] == "FAIL": + errors.append(12) + else: + out("Failure to find loopback test result. Wrong firmware version? Continuing...") + + clock_found = re.search(r'Clock: \w+, \w+: \d, readback: \w+', debug.stdout) + if clock_found: + if clock_found.group(0).split(': ')[-1] != "OK": + errors.append(10) + else: + out("Failure to find clock results. Wrong firmware version? Continuing...") + + mixer_found = re.search(r'Mixer: \w+, ID: \d+', debug.stdout) + if mixer_found: + if mixer_found.group(0).split(': ')[-1] != "4416": + errors.append(16) + else: + out("Failure to find mixer results. Wrong firmware version? Continuing...") + + # Check for transceiver result only if FPGA configuration passed. + if 14 not in errors: + xcvr_found = re.search(r'Transceiver: \w+, RSSI mux test: \w+', debug.stdout) + if xcvr_found: + if xcvr_found.group(0).split(': ')[-1] != "PASS": + errors.append(17) + else: + out("Failure to find transceiver results. Wrong firmware version? Continuing...") + + rtc_found = re.search(r'RTC test result: \w+', debug.stdout) + if rtc_found: + if rtc_found.group(0).split(': ')[-1] != "PASS": + errors.append(18) + else: + out("Failure to find 32kHz oscillator results. Wrong firmware version? Continuing...") + + # Provide entire self-test report if there is an unrecognized self-test failure + if len(errors) == 0: + selftest_found = re.search(r'Self-test result: \w+', debug.stdout) + if selftest_found: + if selftest_found.group(0).split(': ')[-1] != "PASS": + out(debug.stdout) + fail(13) + else: + out("Failure to find selftest results. Wrong firmware version? Continuing...") + + # Report multiple self-test failures + if len(errors) > 1: + for error in errors: + out(f"Self-test failure {error}: {emessages[error]}") + fail(15) + + if len(errors) > 0: + fail(errors[-1]) + + def reset(self): + out(f"Resetting {self.name}") + spiflash = subprocess.run([self.bin_dir + "/hackrf_spiflash", "-d", self.serial, "-R"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if spiflash.returncode != 0: + out(spiflash.stdout + spiflash.stderr) + fail(76 + self.unit_number) + + then = time.time() + device_found = False + while time.time() < (then + 5): + time.sleep(1) + info = subprocess.run([self.bin_dir + "/hackrf_info"], + capture_output=True, timeout=TIMEOUT) + if self.serial in info.stdout.decode('utf-8', errors='ignore'): + device_found = True + break + time.sleep(0.1) + if not device_found: + fail(78 + self.unit_number) + + +# This waveform is a full-scale complex exponential with a frequency of -1/10 the +# sample rate. When transmitted at 10 Msps, the frequency is 1 MHz below the +# center frequency. + +def write_waveform(): + tx_bytes = b'\x7f\x00\x67\xb5\x27\x87\xd9\x87\x99\xb5\x81\x00\x99\x4b\xd9\x79\x27\x79\x67\x4b' + # defective waveform with DC offset: + #tx_bytes = b'\x7f\x10\x67\xa5\x27\x97\xd9\x97\x99\xc5\x81\x10\x99\x5b\xd9\x7f\x27\x7f\x67\x5b' + # defective waveform with missing Q channel: + #tx_bytes = b'\x7f\x00\x67\x00\x27\x00\xd9\x00\x99\x00\x81\x00\x99\x00\xd9\x00\x27\x00\x67\x00' + with open(WAVEFORM, "wb") as bin_file: + for i in range(50000): # 1MB file size + bin_file.write(tx_bytes) + + +def program(bin_dir, fw_dir, serial, unattended=False): + binary = "hackrf_usb.bin" + dfu_stub = "hackrf_usb.dfu" + + # EUTs in unattended (including Jenkins CI) setups have pins jumped to always boot into DFU mode, so resetting is undesirable + if unattended: + reset_write = "-w" + else: + reset_write = "-Rw" + + if not usb.core.find(idVendor=DFU_VENDOR_ID, idProduct=DFU_PRODUCT_ID): + print("ACTION REQUIRED: Press and release EUT RESET button while holding DFU button.") + while not usb.core.find(idVendor=DFU_VENDOR_ID, idProduct=DFU_PRODUCT_ID): + time.sleep(0.1) + + out("Programming EUT in DFU mode") + dfu = subprocess.run([f"{DFU_UTIL}", "--device", + f"{DFU_VENDOR_ID}:{DFU_PRODUCT_ID}", "--alt", "0", "--download", + f"{fw_dir}/{dfu_stub}"], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + out(dfu.stdout + dfu.stderr) + + #dfu-util: unable to read DFU status after completion (LIBUSB_ERROR_IO) + # despite successful download; present as of at least dfu-util 0.11 + if "Download done." not in dfu.stdout: + fail(60) + + # Wait for device to boot from DFU. + then = time.time() + dfu_device_found = False + while time.time() < (then + 50): + dfu_info = subprocess.run([bin_dir + "/hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + + if "RunningFromRAM" in dfu_info.stdout: + if serial in dfu_info.stdout and serial != "RunningFromRAM": + fail(1) + else: + dfu_device_found = True + break + time.sleep(0.1) + if not dfu_device_found: + fail(2) + + out("Programming EUT SPI flash") + spiflash = subprocess.run([bin_dir + "/hackrf_spiflash", "-d", + "RunningFromRAM", reset_write, f"{fw_dir}/{binary}"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT+20) + if spiflash.returncode != 0: + log(spiflash.stdout + spiflash.stderr) + fail(70) + time.sleep(3) + + then = time.time() + device_found = False + while time.time() < (then + 5): + flash_info = subprocess.run([bin_dir + "/hackrf_info"], capture_output=True, + timeout=TIMEOUT) + if serial == "RunningFromRAM" and not unattended: + try: + devices_list = [d.strip() for d in flash_info.stdout.decode('utf-8', errors='ignore').split("Found HackRF") if d.strip()] + for device in devices_list: + sn_found = re.search(r'Serial number: \w+', device) + if sn_found: + serial = sn_found.group(0).split(': ')[1] + except: + log(traceback.format_exc()) + fail(6) + if serial in flash_info.stdout.decode('utf-8', errors='ignore'): + device_found = True + break + time.sleep(1) + if not device_found: + fail(75) + + +def find_sn(name, bin_dir, factory_test, claimed_sns=[]): + while True: + sn_list = [] + info = subprocess.run([bin_dir + "/hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + try: + sn = "" + devices_list = [d.strip() for d in info.stdout.split("Found HackRF") if d.strip()] + for device in devices_list: + sn_found = re.search(r'Serial number: \w+', device) + if sn_found: + new_sn = sn_found.group(0).split(': ')[1] + if new_sn not in claimed_sns: + sn_list.append(new_sn) + except: + log(traceback.format_exc()) + fail(6) + + if factory_test: + if len(sn_list) > 1: + fail(19) + elif len(sn_list) < 1: + if name == "TESTER": + fail(20) + elif name == "EUT": + fail(21) + else: + sn = sn_list[0] + break + else: + if len(sn_list) > 1: + out(f"\nPotential {name}(s) found:\n") + for i in range(len(sn_list)): + out(f"{i}: {sn_list[i]}") + choice = int(input(f"\nEnter the index of your target {name}s serial number: ")) + if 0 <= choice < len(sn_list): + sn = sn_list[choice] + break + else: + out("Incorrect choice, try again.") + elif len(sn_list) == 1: + sn = sn_list[0] + break + else: + fail(3) + return sn + + +def get_version(): + version = subprocess.run(["git", "log", "-n" "1", "--format=%h"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if version.returncode != 0: + return "2026.01.3+" + elif version.returncode == 0: + dirty = subprocess.run(["git", "status", "-s", "--untracked-files=no"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if dirty.stdout != "": + dirty_flag = "*" + else: + dirty_flag = "" + return f"git-{version.stdout.strip()}{dirty_flag}" + + +def main(): + + write_waveform() + + parser = argparse.ArgumentParser(description="Utility for testing HackRF One") + parser.add_argument("-c", "--noclk", action="store_true", help="skip CLKIN, CLKOUT, and PPM tests") + parser.add_argument("-i", "--noif", action="store_true", help="skip IF tuning range test") + parser.add_argument("-l", "--loop", action="store_true", help="repeat the test until terminated with ctrl-c") + parser.add_argument("-m", "--manufacturer", action="store_true", help="check the manufacturer of target devices") + parser.add_argument("-r", "--rev", metavar=" or \"any\"", type=str, + help="check EUT pin straps for specific hardware revision (default: \"r9\")", + default="r9") + parser.add_argument("-s", "--solo", action="store_true", help="perform limited tests on a single EUT with no TESTER") + parser.add_argument("-t", "--tcxo", action="store_true", help="skip CLKIN/CLKOUT tests and use TCXO instead") + parser.add_argument("-E", "--eut", metavar="", type=str, + help="EUT serial number") + parser.add_argument("-T", "--tester", metavar="", type=str, + help="TESTER serial number") + parser.add_argument("-f", "--fwupdate", metavar="", type=str, + help="update firmware with binaries from specified directory") + parser.add_argument("-H", "--hostdir", metavar="", type=str, + help="location of installed hackrf host tools, will attempt to find them if omitted") + parser.add_argument("-b", "--testerdir", metavar="", type=str, + help="necessary only if EUT/TESTER have separate host binaries") + parser.add_argument("-C", "--ci", action="store_true", help="For use with Jenkins CI user") + parser.add_argument("-p", "--praline", action="store_true", help="Force Praline mode") + parser.add_argument("-F", "--factory", action="store_true", help="Force factory test mode") + parser.add_argument("-u", "--unattended", action="store_true", help="For use with unattended hardware") + parser.add_argument("-L", "--log", metavar="", type=str, + help="log file location") + global args + args = parser.parse_args() + + if args.ci: + user = "jenkins" + else: + user = os.getlogin() + + if "any" in args.rev.lower(): + args.rev = None + elif args.rev.lower() == "r1" or args.rev.lower() == "r4": + args.rev = "older than r6" + + if args.hostdir: + eut_host_dir = args.hostdir + else: + try: + eut_host_dir = os.path.dirname(shutil.which('hackrf_info')) + except: + fail(4) + + if args.testerdir: + if args.testerdir == eut_host_dir: + fail(5) + else: + tester_host_dir = args.testerdir + else: + tester_host_dir = eut_host_dir + + unique_bin = (tester_host_dir != eut_host_dir) + count = 0 + + while True: + log() + log("================================") + log(datetime.now()) + log(sys.argv) + log(f"user: {user}") + log(f"version: {get_version()}") + log(f"pid: {os.getpid()}") + if args.loop: + log(f"repeat count: {count}") + log("================================") + log() + + if args.eut: + eut_sn = args.eut + else: + if args.tester: + eut_sn = find_sn("EUT", eut_host_dir, args.factory, [args.tester]) + else: + eut_sn = find_sn("EUT", eut_host_dir, args.factory) + if args.tester: + tester_sn = args.tester + else: + tester_sn = find_sn("TESTER", tester_host_dir, args.factory, [eut_sn]) + + if eut_sn == tester_sn: + fail(7) + + # TODO: check if the provided firmware directory exists + if args.fwupdate: + program(eut_host_dir, args.fwupdate, eut_sn, args.unattended) + eut_sn = find_sn("EUT", eut_host_dir, args.factory, [tester_sn]) + + if not args.rev: + out("Skipping EUT hardware revision check") + eut = HackRF("EUT", eut_host_dir, eut_sn, args.manufacturer, revision=args.rev, factory_test=args.factory) + + if args.solo: + tester = None + else: + tester = HackRF("TESTER", tester_host_dir, tester_sn, args.manufacturer, unique_bin=unique_bin, factory_test=args.factory) + tester.partner = eut + eut.partner = tester + + out("\nTest started, please wait...") + if args.solo: + eut.clkout_connected = False + elif args.noclk: + eut.clkout_connected = False + tester.clkout_connected = False + elif args.tcxo: + eut.clkout_connected = False + tester.clkout_connected = True + else: + eut.clkout_connected = True + tester.clkout_connected = True + + if count > 0 and not args.fwupdate: + eut.activate_leds(False) + + if not args.unattended: + eut.reset() + eut.debug_selftest() + # limited RF test without clock synchronization + eut.test_rf_preliminary() + + if args.noclk or args.solo: + out("Skipping CLKIN, CLKOUT, and PPM tests") + else: + eut.test_xtal() + if not args.tcxo: + eut.test_clkout() + eut.test_clkin() + + eut.clkout(False) + + if tester: + tester.clkout(True) + + if args.tcxo: + if args.solo: + out("Error: --solo is incompatible with --tcxo") + sys.exit(1) + if tester.clkin(): + out("Using TCXO on TESTER") + else: + out("Warning: No TCXO or external clock detected on TESTER") + out("Skipping CLKOUT test") + if not args.noclk and not eut.clkin(): + fail(211) + + # full RF test with clock synchronization + if tester: + eut.test_rf() + + if args.noif or args.solo: + out("Skipping IF tuning range test") + else: + eut.test_if_range(ifmin, ifmax) + + eut.activate_leds(True) + + if (args.solo or args.noif or args.noclk or args.tcxo or not args.rev): + out("Limited test complete") + else: + out("PASS if all 6 LEDs active with correct color") + + count += 1 + if not args.loop: + break + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print() + out("KeyboardInterrupt") + sys.exit(0) + except subprocess.TimeoutExpired: + log(traceback.format_exc()) + fail(180) diff --git a/ci-scripts/hackrf_test.py b/ci-scripts/hackrf_test.py new file mode 100644 index 00000000..13948ad3 --- /dev/null +++ b/ci-scripts/hackrf_test.py @@ -0,0 +1,1425 @@ +#!/usr/bin/env python3 + +import sys +import subprocess +import time +import os, shutil +import usb +from datetime import datetime +from dataclasses import dataclass +import argparse +import numpy as np +import traceback +import re + +DFU_UTIL = "/usr/bin/dfu-util" +TMP_DIR = "/tmp/" +WAVEFORM = TMP_DIR + "waveform100" +NOISE = TMP_DIR + "noise" +VENDOR_ID = 0x1d50 +PRODUCT_ID = 0x6089 +DFU_VENDOR_ID = 0x1fc9 +DFU_PRODUCT_ID = 0x000c +ONE_MHZ = 1000000 +TIMEOUT = 5 +MAX_PPM = 40 +MAX_BASELINE = -20 +SIGNAL_THRESHOLD = -25 +MAX_DC_DBC = -33 +MAX_M_DBC = -27 +MAX_MH2_DBC = -40 +MAX_H2_DBC = -39 +MAX_OTHER_DBC = -34 +LP2_CORRECTION = 10 +MAX_POWER = -10 +IF_REQUIRED_MIN = 2300 +IF_REQUIRED_MAX = 2700 +IF_TEST_RANGE = 256 +SLEEP_TIME = 0.05 # seconds to wait between start of TX and start of RX + +@dataclass +class TestCase(): + name: str + freq: int + amp: bool + direction: str + base_ecode: int + rx_lna_gain: int + rx_vga_gain: int + tx_gain: int + +# Try to keep rx_lna_gain and rx_vga_gain between 8 and 32. +bp1txamp = TestCase(name="BP1-TX-amp", freq=2665, amp=True, direction="tx", + base_ecode=320, rx_lna_gain=16, rx_vga_gain=16, tx_gain=14) +lp1txamp = TestCase(name="LP1-TX-amp", freq=915, amp=True, direction="tx", + base_ecode=420, rx_lna_gain=16, rx_vga_gain=16, tx_gain=27) +lp2txamp = TestCase(name="LP2-TX-amp", freq=2, amp=True, direction="tx", + base_ecode=2420, rx_lna_gain=8, rx_vga_gain=16, tx_gain=30) +hp1txamp = TestCase(name="HP1-TX-amp", freq=5995, amp=True, direction="tx", + base_ecode=520, rx_lna_gain=32, rx_vga_gain=28, tx_gain=37) + +bp1txnoamp = TestCase(name="BP1-TX-noamp", freq=2665, amp=False, direction="tx", + base_ecode=350, rx_lna_gain=16, rx_vga_gain=16, tx_gain=23) +lp1txnoamp = TestCase(name="LP1-TX-noamp", freq=915, amp=False, direction="tx", + base_ecode=450, rx_lna_gain=16, rx_vga_gain=16, tx_gain=39) +lp2txnoamp = TestCase(name="LP2-TX-noamp", freq=2, amp=False, direction="tx", + base_ecode=2450, rx_lna_gain=8, rx_vga_gain=16, tx_gain=47) +hp1txnoamp = TestCase(name="HP1-TX-noamp", freq=5995, amp=False, direction="tx", + base_ecode=550, rx_lna_gain=32, rx_vga_gain=32, tx_gain=44) + +# Much of the information in the RX test cases is a duplication of information +# in the TX test cases, but it's easier to keep legacy error codes this way. +bp1rxamp = TestCase(name="BP1-RX-amp", freq=2665, amp=True, direction="rx", + base_ecode=620, rx_lna_gain=16, rx_vga_gain=16, tx_gain=14) +lp1rxamp = TestCase(name="LP1-RX-amp", freq=915, amp=True, direction="rx", + base_ecode=720, rx_lna_gain=16, rx_vga_gain=16, tx_gain=29) +lp2rxamp = TestCase(name="LP2-RX-amp", freq=2, amp=True, direction="rx", + base_ecode=2720, rx_lna_gain=8, rx_vga_gain=16, tx_gain=33) +hp1rxamp = TestCase(name="HP1-RX-amp", freq=5995, amp=True, direction="rx", + base_ecode=820, rx_lna_gain=32, rx_vga_gain=28, tx_gain=39) + +bp1rxnoamp = TestCase(name="BP1-RX-noamp", freq=2665, amp=False, direction="rx", + base_ecode=650, rx_lna_gain=16, rx_vga_gain=16, tx_gain=23) +lp1rxnoamp = TestCase(name="LP1-RX-noamp", freq=915, amp=False, direction="rx", + base_ecode=750, rx_lna_gain=16, rx_vga_gain=16, tx_gain=39) +lp2rxnoamp = TestCase(name="LP2-RX-noamp", freq=2, amp=False, direction="rx", + base_ecode=2750, rx_lna_gain=8, rx_vga_gain=16, tx_gain=47) +hp1rxnoamp = TestCase(name="HP1-RX-noamp", freq=5995, amp=False, direction="rx", + base_ecode=850, rx_lna_gain=32, rx_vga_gain=32, tx_gain=44) + +ifmin = TestCase(name="IF-min", freq=IF_REQUIRED_MIN, amp=None, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=33) +ifmax = TestCase(name="IF-max", freq=IF_REQUIRED_MAX, amp=None, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=33) + +ppm = TestCase(name="PPM", freq=2707, amp=False, direction=None, + base_ecode=None, rx_lna_gain=16, rx_vga_gain=16, tx_gain=26) + +noise = TestCase(name="Noise", freq=6000, amp=True, direction=None, + base_ecode=None, rx_lna_gain=40, rx_vga_gain=52, tx_gain=None) + +all_rf_test_cases = ( + bp1txamp, lp1txamp, lp2txamp, hp1txamp, + bp1txnoamp, lp1txnoamp, lp2txnoamp, hp1txnoamp, + bp1rxamp, lp1rxamp, lp2rxamp, hp1rxamp, + bp1rxnoamp, lp1rxnoamp, lp2rxnoamp, hp1rxnoamp) + +r9_tester_cal = [1.1, 0.4, 0.4, 1.1, 0.8, 0.2, 0.6, 1.6, -0.4, -1.2, -1.1, 1.1, -1.4, -0.9, 0.1, 1.8] +r9_eut_cal = [-1.1, -1.6, -1.4, -1.3, -1.3, -0.9, 0.1, 1.8, 0.8, 1.1, 0.9, -0.2, 0.9, 0.2, 0.6, 1.5] +og_tester_cal = [-0.4, -0.3, -0.2, -0.4, -0.8, -0.5, -0., -0.1, 1.4, 2., 1.6, -0.1, 1.5, 0.7, 0.5, -0.3] +og_eut_cal = [1.8, 1.8, 1.6, 2., 1.3, 0.7, 0.5, -0.3, 0.2, -0.3, -0.5, 1.2, -0.8, -0.5, -0., -0.1] + +emessages = { + # TODO: replace the placeholder code according to each fail instance + 1: "Placeholder error code", + 60: "Unable to program firmware via DFU", + 65: "EUT not detected after DFU programming", + 70: "Unable to program SPI flash", + 75: "EUT not detected after flashing", + 80: "Could not find EUT", + 81: "Could not find TESTER", + 82: "Found multiple candidate EUTs", + 83: "Found multiple candidate TESTERs", + 84: "EUT running from RAM instead of flash", + 85: "TESTER running from RAM instead of flash", + 86: "Couldn't parse hackrf_info output", + 88: "Incorrect EUT hardware revision", + 89: "Incorrect TESTER hardware revision", + 90: "EUT has incorrect manufacturer pin strap", + 91: "TESTER has incorrect manufacturer pin strap", + 99: "Incorrect device name", + 100: "EUT couldn't verify clkgen register", + 101: "TESTER couldn't verify clkgen register", + 120: "EUT couldn't verify xcvr register", + 121: "TESTER couldn't verify xcvr register", + 140: "EUT couldn't verify mixer register", + 141: "TESTER couldn't verify mixer register", + 150: "Failed RX for IF verification", + 152: "Couldn't parse received power", + 154: "Received power out of bounds", + 160: "Insufficient IF range", + 170: "RX operation failed", + 172: "Couldn't parse hackrf_sweep output", + 180: "Subprocess timed out", + 190: "Failed to configure LEDs", + 200: "hackrf_clock command failed", + 210: "TESTER failed to detect EUT CLKOUT", + 211: "EUT failed to detect TESTER CLKOUT", + 212: "TESTER detected spurious CLKIN", + 213: "EUT detected spurious CLKIN", + 220: "Failed TESTER CLKIN activation RX", + 221: "Failed EUT CLKIN activation RX", + 230: "Failed TESTER PLL check", + 231: "Failed EUT PLL check", + 232: "TESTER PLL failed to lock", + 233: "EUT PLL failed to lock", + 240: "Clock synchronization failure", + 250: "Failed PPM detection sweep", + 252: "Couldn't parse PPM test sweep data", + 254: "TESTER couldn't detect PPM test transmission", + 255: "EUT couldn't detect PPM test transmission", + 260: "Frequency error exceeds limit", + 300: "Failed baseline RX", + 302: "Couldn't parse baseline RX power", + 306: "Baseline RX power too high", + 310: "Failed noise RX", + 311: "Couldn't parse noise RX power", + 312: "Noise RX power out of range", + 313: "Required noise gain out of range", + 315: "Couldn't read noise RX file", + 316: "Too little variation in ADC bit", + 317: "ADC bit correlates strongly with another bit", + 321: "Excessive TX DC offset in AMP txbp1", + 322: "insufficient signal strength in AMP txbp1", + 323: "AMP txbp1 clipping", + 325: "peak found at unexpected frequency in AMP txbp1", + 330: "harmonics detected in AMP txbp1", + 335: "neighbor magnitude exceeded in AMP txbp1", + 340: "neighbor magnitude exceeded in AMP txbp1", + 345: "spectrum mirrored or inverted in AMP txbp1", + 350: "excessive power out of channel in AMP txbp1", + 351: "Excessive TX DC offset in NOAMP txbp1", + 352: "insufficient signal strength in NOAMP txbp1", + 353: "NOAMP txbp1 clipping", + 355: "peak found at unexpected frequency in NOAMP txbp1", + 360: "harmonics detected in NOAMP txbp1", + 365: "neighbor magnitude exceeded in NOAMP txbp1", + 370: "neighbor magnitude exceeded in NOAMP txbp1", + 375: "spectrum mirrored or inverted in NOAMP txbp1", + 380: "excessive power out of channel in NOAMP txbp1", + 421: "Excessive TX DC offset in AMP txlp1", + 422: "insufficient signal strength in AMP txlp1", + 423: "AMP txlp1 clipping", + 425: "peak found at unexpected frequency in AMP txlp1", + 430: "harmonics detected in AMP txlp1", + 435: "neighbor magnitude exceeded in AMP txlp1", + 440: "neighbor magnitude exceeded in AMP txlp1", + 445: "spectrum mirrored or inverted in AMP txlp1", + 450: "excessive power out of channel in AMP txlp1", + 451: "Excessive TX DC offset in NOAMP txlp1", + 452: "insufficient signal strength in NOAMP txlp1", + 453: "NOAMP txlp1 clipping", + 455: "peak found at unexpected frequency in NOAMP txlp1", + 460: "harmonics detected in NOAMP txlp1", + 465: "neighbor magnitude exceeded in NOAMP txlp1", + 470: "neighbor magnitude exceeded in NOAMP txlp1", + 475: "spectrum mirrored or inverted in NOAMP txlp1", + 480: "excessive power out of channel in NOAMP txlp1", + 2421: "Excessive TX DC offset in AMP txlp2", + 2422: "insufficient signal strength in AMP txlp2", + 2423: "AMP txlp2 clipping", + 2425: "peak found at unexpected frequency in AMP txlp2", + 2430: "harmonics detected in AMP txlp2", + 2435: "neighbor magnitude exceeded in AMP txlp2", + 2440: "neighbor magnitude exceeded in AMP txlp2", + 2445: "spectrum mirrored or inverted in AMP txlp2", + 2450: "excessive power out of channel in AMP txlp2", + 2451: "Excessive TX DC offset in NOAMP txlp2", + 2452: "insufficient signal strength in NOAMP txlp2", + 2453: "NOAMP txlp2 clipping", + 2455: "peak found at unexpected frequency in NOAMP txlp2", + 2460: "harmonics detected in NOAMP txlp2", + 2465: "neighbor magnitude exceeded in NOAMP txlp2", + 2470: "neighbor magnitude exceeded in NOAMP txlp2", + 2475: "spectrum mirrored or inverted in NOAMP txlp2", + 2480: "excessive power out of channel in NOAMP txlp2", + 521: "Excessive TX DC offset in AMP txhp1", + 522: "insufficient signal strength in AMP txhp1", + 523: "AMP txhp1 clipping", + 525: "peak found at unexpected frequency in AMP txhp1", + 530: "harmonics detected in AMP txhp1", + 535: "neighbor magnitude exceeded in AMP txhp1", + 540: "neighbor magnitude exceeded in AMP txhp1", + 545: "spectrum mirrored or inverted in AMP txhp1", + 550: "excessive power out of channel in AMP txhp1", + 551: "Excessive TX DC offset in NOAMP txhp1", + 552: "insufficient signal strength in NOAMP txhp1", + 553: "NOAMP txhp1 clipping", + 555: "peak found at unexpected frequency in NOAMP txhp1", + 560: "harmonics detected in NOAMP txhp1", + 565: "neighbor magnitude exceeded in NOAMP txhp1", + 570: "neighbor magnitude exceeded in NOAMP txhp1", + 575: "spectrum mirrored or inverted in NOAMP txhp1", + 580: "excessive power out of channel in NOAMP txhp1", + 621: "Excessive TX DC offset in AMP rxbp1", + 622: "insufficient signal strength in AMP rxbp1", + 623: "AMP rxbp1 clipping", + 625: "peak found at unexpected frequency in AMP rxbp1", + 630: "harmonics detected in AMP rxbp1", + 635: "neighbor magnitude exceeded in AMP rxbp1", + 640: "neighbor magnitude exceeded in AMP rxbp1", + 645: "spectrum mirrored or inverted in AMP rxbp1", + 650: "excessive power out of channel in AMP rxbp1", + 651: "Excessive TX DC offset in NOAMP rxbp1", + 652: "insufficient signal strength in NOAMP rxbp1", + 653: "NOAMP rxbp1 clipping", + 655: "peak found at unexpected frequency in NOAMP rxbp1", + 660: "harmonics detected in NOAMP rxbp1", + 665: "neighbor magnitude exceeded in NOAMP rxbp1", + 670: "neighbor magnitude exceeded in NOAMP rxbp1", + 675: "spectrum mirrored or inverted in NOAMP rxbp1", + 680: "excessive power out of channel in NOAMP rxbp1", + 721: "Excessive TX DC offset in AMP rxlp1", + 722: "insufficient signal strength in AMP rxlp1", + 723: "AMP rxlp1 clipping", + 725: "peak found at unexpected frequency in AMP rxlp1", + 730: "harmonics detected in AMP rxlp1", + 735: "neighbor magnitude exceeded in AMP rxlp1", + 740: "neighbor magnitude exceeded in AMP rxlp1", + 745: "spectrum mirrored or inverted in AMP rxlp1", + 750: "excessive power out of channel in AMP rxlp1", + 751: "Excessive TX DC offset in NOAMP rxlp1", + 752: "insufficient signal strength in NOAMP rxlp1", + 753: "NOAMP rxlp1 clipping", + 755: "peak found at unexpected frequency in NOAMP rxlp1", + 760: "harmonics detected in NOAMP rxlp1", + 765: "neighbor magnitude exceeded in NOAMP rxlp1", + 770: "neighbor magnitude exceeded in NOAMP rxlp1", + 775: "spectrum mirrored or inverted in NOAMP rxlp1", + 780: "excessive power out of channel in NOAMP rxlp1", + 2721: "Excessive TX DC offset in AMP rxlp2", + 2722: "insufficient signal strength in AMP rxlp2", + 2723: "AMP rxlp2 clipping", + 2725: "peak found at unexpected frequency in AMP rxlp2", + 2730: "harmonics detected in AMP rxlp2", + 2735: "neighbor magnitude exceeded in AMP rxlp2", + 2740: "neighbor magnitude exceeded in AMP rxlp2", + 2745: "spectrum mirrored or inverted in AMP rxlp2", + 2750: "excessive power out of channel in AMP rxlp2", + 2751: "Excessive TX DC offset in NOAMP rxlp2", + 2752: "insufficient signal strength in NOAMP rxlp2", + 2753: "NOAMP rxlp2 clipping", + 2755: "peak found at unexpected frequency in NOAMP rxlp2", + 2760: "harmonics detected in NOAMP rxlp2", + 2765: "neighbor magnitude exceeded in NOAMP rxlp2", + 2770: "neighbor magnitude exceeded in NOAMP rxlp2", + 2775: "spectrum mirrored or inverted in NOAMP rxlp2", + 2780: "excessive power out of channel in NOAMP rxlp2", + 821: "Excessive TX DC offset in AMP rxhp1", + 822: "insufficient signal strength in AMP rxhp1", + 823: "AMP rxhp1 clipping", + 825: "peak found at unexpected frequency in AMP rxhp1", + 830: "harmonics detected in AMP rxhp1", + 835: "neighbor magnitude exceeded in AMP rxhp1", + 840: "neighbor magnitude exceeded in AMP rxhp1", + 845: "spectrum mirrored or inverted in AMP rxhp1", + 850: "excessive power out of channel in AMP rxhp1", + 851: "Excessive TX DC offset in NOAMP rxhp1", + 852: "insufficient signal strength in NOAMP rxhp1", + 853: "NOAMP rxhp1 clipping", + 855: "peak found at unexpected frequency in NOAMP rxhp1", + 860: "harmonics detected in NOAMP rxhp1", + 865: "neighbor magnitude exceeded in NOAMP rxhp1", + 870: "neighbor magnitude exceeded in NOAMP rxhp1", + 875: "spectrum mirrored or inverted in NOAMP rxhp1", + 880: "excessive power out of channel in NOAMP rxhp1", + 3000: "BP TX failure", + 3010: "BP RX failure", + 3020: "HP TX failure", + 3030: "HP RX failure", + 3040: "LP TX failure", + 3050: "LP RX failure", + 3060: "TX AMP failure", + 3070: "RX AMP failure", + 3080: "AMP bypass failure", + 3090: "LPF failure", + 3100: "HPF failure", + 3110: "mixer bypass failure", + 3120: "mixer failure", + 3130: "TX failure", + 3140: "RX failure", + 3150: "mixer TX failure", + 3160: "mixer RX failure", + 3170: "LP2 TX failure", + 3180: "LP2 RX failure", + 3190: "LP2 TX/RX failure", + 3200: "total RF failure", + 3210: "multiple RF failures, see list above", + 3220: "multiple clipping failures" +} + +def fail_rf(errors): + # check for combinations of RF errors + ecode = 0 + eset = set(errors) + + # error affects only bp tx + if ((322 in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3000 + errors.append(ecode) + + # error affects only bp rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3010 + errors.append(ecode) + + # error affects only hp tx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3020 + errors.append(ecode) + + # error affects only hp rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 in eset)): + ecode = 3030 + errors.append(ecode) + + # error affects only lp tx (both lp1 and lp2) + if ((322 not in eset) and (422 in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3040 + errors.append(ecode) + + # error affects only lp rx (both lp1 and lp2) + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 in eset) and (2722 in eset) and (822 not in eset)): + ecode = 3050 + errors.append(ecode) + + # error in tx amp path + if ((2422 in eset) and (352 not in eset) and (452 not in eset) and (2452 not in eset)): + ecode = 3060 + errors.append(ecode) + + # error in rx amp path + if ((2722 in eset) and (652 not in eset) and (752 not in eset) and (2752 not in eset)): + ecode = 3070 + errors.append(ecode) + + # error in amp bypass path + if ((352 in eset) and (452 in eset) and (2452 in eset) and (652 in eset) and (752 in eset) and (2752 in eset) and (322 not in eset) and (422 not in eset) and (2422 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset)): + ecode = 3080 + errors.append(ecode) + + # error in lpf path + if (((422 in eset) and (2422 in eset)) and ((722 in eset) and (2722 in eset)) and ((322 not in eset) and (622 not in eset)) and ((522 not in eset) and (822 not in eset))): + ecode = 3090 + errors.append(ecode) + + # error in hpf path + if (((522 in eset) and (822 in eset)) and ((322 not in eset) and (622 not in eset)) and ((422 not in eset) and (2422 not in eset) and (722 not in eset) and (2722 not in eset))): + ecode = 3100 + errors.append(ecode) + + # error affects both mixer bypass paths + if ((322 in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3110 + errors.append(ecode) + + # error in mixer tx/rx + if ((322 not in eset) and ((422 in eset) or (2422 in eset)) and (522 in eset) and (622 not in eset) and ((722 in eset) or (2722 in eset) or (822 in eset))): + ecode = 3120 + errors.append(ecode) + + if ((322 not in eset) and ((422 in eset) or (2422 in eset) or (522 in eset)) and (622 not in eset) and ((722 in eset) and (2722 in eset) and (822 in eset))): + ecode = 3120 + errors.append(ecode) + + # error in all tx, no rx + if ((322 in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset) and (352 in eset) and (452 in eset) and (2452 in eset) and (552 in eset)): + ecode = 3130 + errors.append(ecode) + + # error in all rx, no tx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 in eset) and (722 in eset) and (2722 in eset) and (822 in eset) and (652 in eset) and (752 in eset) and (2752 in eset) and (852 in eset)): + ecode = 3140 + errors.append(ecode) + + # error in all mixer tx + if ((322 not in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset)): + ecode = 3150 + errors.append(ecode) + + # error in all mixer rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 in eset) and (2722 in eset) and (822 in eset)): + ecode = 3160 + errors.append(ecode) + + # error affecting only lp2 tx + if ((322 not in eset) and (422 not in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 not in eset) and (822 not in eset) and (2752 in eset)): + ecode = 3170 + errors.append(ecode) + + # error affecting only lp2 rx + if ((322 not in eset) and (422 not in eset) and (2422 not in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 in eset) and (822 not in eset) and (2752 in eset)): + ecode = 3180 + errors.append(ecode) + + # error affecting only lp2 rx/tx + if ((322 not in eset) and (422 not in eset) and (2422 in eset) and (522 not in eset) and (622 not in eset) and (722 not in eset) and (2722 in eset) and (822 not in eset)): + ecode = 3190 + errors.append(ecode) + + # error in all rx/tx + if ((322 in eset) and (422 in eset) and (2422 in eset) and (522 in eset) and (622 in eset) and (722 in eset) and (2722 in eset) and (822 in eset)): + ecode = 3200 + errors.append(ecode) + + clipping_count = 0 + for code in (323, 423, 2423, 523, 353, 453, 2453, 553, 623, 723, 2723, 823, 653, 753, 2753, 853): + if code in eset: + clipping_count += 1 + if clipping_count > 2: + ecode = 3220 + errors.append(ecode) + elif (not ecode) and (len(errors) > 1): + # multiple failures without a logical grouping + ecode = 3210 + errors.append(ecode) + + for error in errors[:-1]: + out(f"RF failure {error}: {emessages[error]}") + fail(errors[-1]) + +def log(message=""): + if args.log: + with open(args.log, "a") as log_file: + print(message, file=log_file) + return + +def out(message=""): + log(message) + print(message) + +def fail(error_code): + out(f"FAIL {error_code}: {emessages[error_code]}") + sys.exit(2) + +class HackRF: + def __init__(self, name, bin_dir, serial, mf_check, revision=None, unique_bin=False): + self.name = name + self.bin_dir = bin_dir + self.unique_bin = unique_bin + self.revision = None + self.serial = None + self.clkout_connected = False + self.tester_cal = [0] * 16 + self.eut_cal = [0] * 16 + self.errors = [] + self.unit_number = 0 + self.partner = None + + if self.name == "TESTER": + self.unit_number = 1 + elif self.name != "EUT": + fail(99) + + info = subprocess.run([bin_dir + "hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + log(info.stdout + info.stderr) + if info.returncode != 0 or "failed" in info.stderr: + fail(80 + self.unit_number) + + # parse the hackrf_info output + count = info.stdout.count("Found HackRF") + if count < 1: + fail(80 + self.unit_number) + if count > 1 and self.name == "TESTER" and self.unique_bin: + fail(83) + if mf_check and "does not appear to have been manufactured by Great Scott Gadgets" in info.stdout: + fail(90 + self.unit_number) + try: + devices_list = re.findall(r'Found HackRF\n.+\n.+\n.+\n.+\n.+\n.+', info.stdout) + for device in devices_list: + sn = re.search(r'Serial number: \w+', device).group().split(': ')[1] + rev = re.search(r'Hardware Revision: .+', device).group().split(': ')[1] + if sn == serial: + self.serial = sn + self.revision = rev + break + out(f"{self.name} serial number: {self.serial}") + out(f"{self.name} revision: {self.revision}") + out(f"{self.name} binary directory {self.bin_dir}") + except: + log(traceback.format_exc()) + fail(1) + + if revision and self.revision != revision: + fail(88 + self.unit_number) + + if self.revision == "r9": + self.tester_cal = r9_tester_cal + self.eut_cal = r9_eut_cal + else: + self.tester_cal = og_tester_cal + self.eut_cal = og_eut_cal + + def clkin(self): + command = subprocess.run([self.bin_dir + "hackrf_clock", "-i", "-d", + self.serial], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + out(f"{self.name} CLKIN request failed") + fail(200) + if "no clock signal detected" in command.stdout: + log(f"{self.name}: no clock signal detected") + return False + elif "clock signal detected" in command.stdout: + log(f"{self.name}: clock signal detected") + return True + else: + log(command.stdout + command.stderr) + out(f"Couldn't parse {self.name} CLKIN status") + fail(200) + + # Warning: Avoid clock loops by disabling your partner's CLKOUT before + # enabling your own. + def clkout(self, enable): + command = subprocess.run([self.bin_dir + "hackrf_clock", "-o", + "1" if enable else "0", "-d", self.serial], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + out(f"{self.name} CLKOUT control failed") + fail(200) + + if self.partner and self.clkout_connected: + timeout = time.time() + 1 + while time.time() < timeout: + if self.partner.clkin() == enable: + break + if self.partner.clkin() != enable: + if enable: + fail(210 + self.unit_number) + else: + if self.name == "EUT": + out("Note: use --tcxo to use TCXO or external reference on TESTER") + fail(212 + self.unit_number) + + # transceiver operation to switch clock source + source = "CLKIN" if enable else "crystal" + log(f"switching {self.partner.name} to {source}") + receive = subprocess.run([self.partner.bin_dir + "hackrf_transfer", "-d", + self.partner.serial, "-n1", "-r", "/dev/null", "-f", "2500000000", + "-a", "0", "-l", "0", "-g", "0"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(220 + self.unit_number) + + # confirm that PLL A locked to new source + timeout = time.time() + 1 + while time.time() < timeout: + debug = subprocess.run([self.partner.bin_dir + "hackrf_debug", "-d", + self.partner.serial, "-srn0"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + log(debug.stdout) + if debug.returncode != 0: + log(debug.stderr) + fail(230 + self.unit_number) + output = str(debug.stdout).split() + try: + val = int(output[3], 0) + except: + log(debug.stderr) + log(traceback.format_exc()) + fail(230 + self.unit_number) + # Check LOL_A + if not (val >> 5) & 1: + break + if (val >> 5) & 1: + fail(232 + self.unit_number) + time.sleep(0.1) + else: + time.sleep(0.2) + + def test_clkout(self): + assert self.clkout_connected + self.partner.clkout(False) + self.clkout(True) + frequency_error_ppm = self.clock_error_ppm() + log(f"{self.name}->{self.partner.name} CLK: {frequency_error_ppm} ppm") + if abs(frequency_error_ppm) > 1: + out(f"{self.partner.name} CLKIN: unexpected frequency error while synchronized") + fail(240) + + def test_clkin(self): + self.partner.test_clkout() + + def clock_error_ppm(self): + # ppm.freq is in MHz, but we use it as Hz for the FFT bin width, + # resulting in bins with a width of 1 ppm of the transmission + # frequency. + bin_width = str(ppm.freq) + tx_frequency = str(ppm.freq * ONE_MHZ) + sweep_range = f"{ppm.freq-1}:{ppm.freq+19}" + expected_bin = round(ONE_MHZ/ppm.freq) + + log(f"{self.name} transmitting to {self.partner.name} for PPM measurement") + transmit = subprocess.Popen([self.bin_dir + "hackrf_transfer", "-d", + self.serial, "-c", "127", "-a", "0", "-x", f"{ppm.tx_gain}", "-f", + tx_frequency], stdout=subprocess.PIPE, stderr=subprocess.PIPE, + encoding="utf-8") + + time.sleep(SLEEP_TIME) + sweep = subprocess.run([self.partner.bin_dir + "hackrf_sweep", "-d", + self.partner.serial, "-N", "13", "-w", bin_width, "-f", sweep_range, "-a", + "0", "-l", f"{ppm.rx_lna_gain}", "-g", f"{ppm.rx_vga_gain}"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if sweep.returncode != 0: + log(sweep.stdout + sweep.stderr) + fail(250) + + # parse the hackrf_sweep output + try: + rows = sweep.stdout.split("\n") + # Note: skipping data from the first twelve sweeps until issue #1230 is resolved. + row = rows[48].split(", ") + bins = [float(bin) for bin in row[6:]] + peak_bin = bins.index(max(bins)) + frequency_error_ppm = peak_bin - expected_bin + except: + log(sweep.stdout + sweep.stderr) + log(traceback.format_exc()) + fail(252) + + log(f"PPM max bin {peak_bin} power: {bins[peak_bin]}") + for row in rows[0:49:4]: + bins = [float(bin) for bin in row.split(", ")[6:]] + peak_bin = bins.index(max(bins)) + log(f"peak bin {peak_bin}: {bins[peak_bin]}") + if max(bins) < SIGNAL_THRESHOLD: + fail(254 + self.unit_number) + transmit.terminate() + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + log(tx_out + tx_err) + out(f"Warning: {self.name} PPM test transmit failed") + return frequency_error_ppm + + def test_xtal(self): + self.clkout(False) + self.partner.clkout(False) + frequency_error_ppm = self.clock_error_ppm() + out(f"{self.name} crystal frequency error: {frequency_error_ppm} ppm") + if abs(frequency_error_ppm) > MAX_PPM: + fail(260) + + def verify_register(self, target, address, value): + command = subprocess.run([self.bin_dir + "hackrf_debug", + f"--{target}", "--register", address, "--read", "--device", + self.serial], capture_output=True, encoding="UTF-8") + log(f"Checking {target} register {address}") + if value in command.stdout: + return True + else: + log("Unexpected result:") + log(command.stdout + command.stderr) + return False + + def test_clkgen(self): + if not self.verify_register("si5351", "2", "0x03"): + fail(100 + self.unit_number) + + def test_mixer(self): + if not self.verify_register("rffc5072", "2", "0x9055"): + fail(140 + self.unit_number) + + def test_xcvr(self): + if not self.verify_register("max283", "28", "0x0c0"): + fail(120 + self.unit_number) + + def test_serial(self): + log(f"Testing {self.name} serial communications") + self.test_clkgen() + self.test_mixer() + self.test_xcvr() + + # Ensure that hackrf_transfer works and that the received power is within + # the expected range with no transmission active. + def baseline_rx(self, test_case): + # Test at the TX tuning frequency of measure_rf() + center_freq = (test_case.freq * ONE_MHZ) + 1500000 + receive = subprocess.run([self.bin_dir + "hackrf_transfer", "-d", + self.serial, "-n10000", "-r", "/dev/null", "-f", + f"{center_freq}", "-a", "0", "-l", f"{test_case.rx_lna_gain}", + "-g", f"{test_case.rx_vga_gain}", "-b", + "1750000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + log(f"Failed {self.name} {test_case.name} baseline RX") + fail(300) + + output = str(receive.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(receive.stdout + receive.stderr) + log(traceback.format_exc()) + log(f"Couldn't parse {self.name} {test_case.name} baseline RX power") + fail(302) + # The theoretical minimum power is about -48 dB. The expected power is + # about -30 dB. + log(f"{self.name} {test_case.name} baseline power: {power}") + if power > MAX_BASELINE: + fail(306) + + # Check the ADC for shorts or other unexpected behavior by sampling + # amplified noise. + def noise_rx(self, test_case): + num_samples = 1000 + log(f"Testing {self.name} {test_case.name}") + center_freq = test_case.freq * ONE_MHZ + + low_gain = 0 + high_gain = 16 + while high_gain > low_gain: + gain = (high_gain + low_gain) // 2 + receive = subprocess.run([self.bin_dir + "hackrf_transfer", "-d", + self.serial, "-n", f"{num_samples*10}", "-r", f"{NOISE}", "-f", + f"{center_freq}", "-a", "1" if test_case.amp else "0", "-l", + f"{test_case.rx_lna_gain}", "-g", f"{gain*2 + 32}", "-b", + "28000000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(310) + output = str(receive.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(receive.stdout + receive.stderr) + log(traceback.format_exc()) + fail(311) + log(f"{self.name} {test_case.name} RX power at -g {gain*2 + 32}: {power}") + if power > -2: + high_gain = gain + elif power > -5: + break + else: + low_gain = gain + 1 + + # We want the power to be between -1 and -6 dB to ensure that all eight + # bits are flipped without much clipping. + if power < -6 or power > -1: + fail(312) + elif gain > 14 or gain < 4: + fail(313) + + bit_count = [0] * 8 + matches = [] + for bit in range(8): + matches.append([0] * 8) + + try: + file = open(f"{NOISE}", "rb") + data = file.read() + assert len(data) == num_samples * 20 + data = data[-num_samples*2:] + for byte in data: + for bit in range(8): + bit_count[bit] += (byte>>bit)&1 + for match_bit in range(bit + 1, 8): + if (byte>>bit)&1 == (byte>>match_bit)&1: + matches[bit][match_bit] += 1 + except: + fail(315) + log(f"{self.name} ADC bit counts: {bit_count}") + log(f"{self.name} ADC bit matches: {matches}") + for bit in range(7): + if bit_count[bit] < (0.2 * len(data)) or bit_count[bit] > (0.8 * len(data)): + log(f"{self.name} ADC bit {bit} set in {bit_count[bit]} out of {len(data)} bytes") + fail(316) + # Check for correlations between adjacent bits except between 6 and 7 (highest). + #for match_bit in range(bit + 1, 7): + for match_bit in range(bit + 1, 8): + if matches[bit][match_bit] > (0.999 * len(data)): + out(f"{self.name} ADC bit {bit} correlates with bit {match_bit}") + fail(317) + # DC bias can cause bit 7 to be predominantly unchanged, so only + # error if there is less than 1% variation. + if bit_count[7] < (0.001 * len(data)) or bit_count[bit] > (0.999 * len(data)): + out(f"{self.name} ADC bit 7 set in {bit_count[7]} out of {len(data)} bytes") + fail(316) + + def analyze_transfer(self, transfer, test_case): + # parse the hackrf_transfer output + output = str(transfer.stderr).split() + try: + power = float(output[output.index("power") + 1]) + except: + log(transfer.stdout + transfer.stderr) + log(traceback.format_exc()) + fail(152) + log(f"{test_case.name} power at {test_case.freq} MHz: {power}") + + if test_case.base_ecode: + if power < SIGNAL_THRESHOLD: + log(f"{test_case.name} signal not strong enough") + self.errors.append(test_case.base_ecode + 2) + if power > -3: + log(f"{test_case.name} signal clipping") + self.errors.append(test_case.base_ecode + 3) + elif power < -48 or power > 0: + fail(154) + return power + + # Verify that signal power at a given IF in MHz is detected. + def verify_if_tuning(self, test_case): + transmit = subprocess.Popen([self.bin_dir + "hackrf_transfer", "-d", + self.serial, "-c", "127", "-a", "0", "-x", f"{test_case.tx_gain}", + "-i", f"{test_case.freq*ONE_MHZ}", "-m", "0", "-F"], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8") + + time.sleep(SLEEP_TIME) + receive = subprocess.run([self.partner.bin_dir + "hackrf_transfer", "-d", + self.partner.serial, "-n10000", "-r", "/dev/null", "-f", + f"{(test_case.freq+1)*ONE_MHZ}", "-a", "0", "-l", + f"{test_case.rx_lna_gain}", "-g", f"{test_case.rx_vga_gain}", "-b", + "2500000"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + transmit.terminate() + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + fail(150) + + power = self.analyze_transfer(receive, test_case) + + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + log(tx_out + tx_err) + out(f"Warning: {self.name} IF transmit failed") + return power > SIGNAL_THRESHOLD + + def test_if_range(self, min_case, max_case): + low_end = IF_REQUIRED_MIN - IF_TEST_RANGE + 1 + min_freq = IF_REQUIRED_MIN + 1 + while min_freq > low_end: + min_case.freq = (min_freq + low_end) // 2 + if self.verify_if_tuning(min_case): + min_freq = min_case.freq + else: + low_end = min_case.freq + 1 + + high_end = IF_REQUIRED_MAX + IF_TEST_RANGE - 1 + max_freq = IF_REQUIRED_MAX - 1 + while max_freq < high_end: + max_case.freq = (max_freq + high_end + 1) // 2 + if self.verify_if_tuning(max_case): + max_freq = max_case.freq + else: + high_end = max_case.freq - 1 + + out(f"{self.name} IF range: {min_freq}-{max_freq} MHz") + if min_freq > IF_REQUIRED_MIN or max_freq < IF_REQUIRED_MAX: + fail(160) + + def analyze_sweep(self, sweep, test_case): + eut_cal = self.eut_cal[all_rf_test_cases.index(test_case)] + tester_cal = self.partner.tester_cal[all_rf_test_cases.index(test_case)] + correction = LP2_CORRECTION if test_case.freq < 30 else 0 + + # parse the hackrf_sweep output + try: + rows = sweep.stdout.split("\n") + # Note: skipping data from the first twelve sweeps until issue #1230 is resolved. + bins = np.zeros(225) + # average 10 sweeps + row_count = 0 + for row in rows[48:88:4]: + bins += np.array([float(x) for x in row.split(", ")[6:231]]) + row_count += 1 + assert row_count == 10 + bins /= 10 + # log the raw hackrf_sweep data before calibration + log(f"{', '.join(rows[12].split(', ')[:6])}, {np.array2string(bins, separator=', ', max_line_width=3000)[1:-1]}") + # apply calibration + bins -= eut_cal + bins -= tester_cal + peak_bin = bins.argmax() + except: + log(sweep.stdout + sweep.stderr) + log(traceback.format_exc()) + out(f"Couldn't parse {test_case.name} sweep data") + fail(172) + + # ensure acceptable performance + log(f"peak ({peak_bin}) {test_case.name}: {bins[peak_bin]:.2f}") + if bins[peak_bin] < SIGNAL_THRESHOLD: + for row in rows[0:88:4]: + bins = [float(bin) for bin in row.split(", ")[6:]] + peak_bin = bins.index(max(bins)) + log(f"peak bin {peak_bin}: {bins[peak_bin]}") + log(f"{test_case.name} signal not strong enough") + self.errors.append(test_case.base_ecode + 2) + return bins[peak_bin] + elif bins[peak_bin] > MAX_POWER: + log(f"{test_case.name} signal clipping") + self.errors.append(test_case.base_ecode + 3) + return bins[peak_bin] + tx_dc_power_dbc = bins[112] - bins[peak_bin] + if tx_dc_power_dbc > MAX_DC_DBC + correction: + log(f"{test_case.name} excessive TX DC offset {tx_dc_power_dbc:.1f} dBc") + self.errors.append(test_case.base_ecode + 1) + if peak_bin == 157: + log(f"{test_case.name} TX spectrum inverted") + self.errors.append(test_case.base_ecode + 25) + return bins[peak_bin] + elif peak_bin == 112: + log(f"{test_case.name} peak found at DC") + self.errors.append(test_case.base_ecode + 1) + return bins[peak_bin] + elif peak_bin >= 52 and peak_bin < 67: + log(f"{test_case.name} peak found at adjacent frequency") + self.errors.append(test_case.base_ecode + 15) + return bins[peak_bin] + elif peak_bin > 67 and peak_bin <= 82: + log(f"{test_case.name} peak found at adjacent frequency") + self.errors.append(test_case.base_ecode + 20) + return bins[peak_bin] + elif peak_bin != 67: + log(f"{test_case.name} peak found at unexpected frequency") + self.errors.append(test_case.base_ecode + 5) + return bins[peak_bin] + + if bins[157] - bins[67] > MAX_M_DBC + correction: + log(f"{test_case.name} TX spectrum mirrored") + self.errors.append(test_case.base_ecode + 25) + if (bins[22] - bins[67]) > MAX_H2_DBC + correction: + log(f"{test_case.name} excessive TX harmonic (bin 22): {bins[22]}") + self.errors.append(test_case.base_ecode + 10) + if (bins[202] - bins[67]) > MAX_MH2_DBC + correction: + log(f"{test_case.name} excessive TX harmonic (bin 202): {bins[202]}") + self.errors.append(test_case.base_ecode + 10) + worst_other_dbc = -999 + worst_other_bin = 999 + for i in range(225): + # Skip various frequencies where spurs are expected (most of which have their own tests above). + if (i < 52 and i != 22) or (i > 82 and i < 111) or (i > 113 and i < 156) or (i > 158 and i != 202): + other_dbc = bins[i] - bins[67] + if other_dbc > worst_other_dbc: + worst_other_dbc = other_dbc + worst_other_bin = i + if worst_other_dbc > MAX_OTHER_DBC + correction: + log(f"{test_case.name} excessive power at unexpected frequency ({worst_other_bin}: {bins[worst_other_bin]})") + self.errors.append(test_case.base_ecode + 30) + log(f"h2 (22) {test_case.name}: {(bins[22] - bins[67]):.2f}") + log(f"DC (112) {test_case.name}: {(bins[112] - bins[67]):.2f}") + log(f"m (157) {test_case.name}: {(bins[157] - bins[67]):.2f}") + log(f"mh2 (202) {test_case.name}: {(bins[202] - bins[67]):.2f}") + log(f"other ({worst_other_bin}) {test_case.name}: {worst_other_dbc:.2f}") + #FIXME look in another row for RX inversion? + return bins[peak_bin] + + def measure_rf(self, test_case, sweep=True): + log(f"Executing RF test case {test_case.name}, sweep={sweep}") + if test_case.direction == "tx": + transmitter = self + tx_amp = "1" if test_case.amp else "0" + receiver = self.partner + rx_amp = "0" + elif test_case.direction == "rx": + transmitter = self.partner + tx_amp = "0" + receiver = self + rx_amp = "1" if test_case.amp else "0" + else: + out(f"Error: Invalid direction in {test_case.name}") + sys.exit(1) + + # The nominal test frequency (as specified in test_case) is 1 MHz above + # the low end of the sweep range. The transmitted signal is 500 kHz + # above the nominal frequency, and the tuning (center) frequency of the + # transmitting device is 1 MHz above that. + tx_center_freq = (test_case.freq * ONE_MHZ) + 1500000 + sweep_range = f"{test_case.freq-1}:{test_case.freq+19}" + + transmit = subprocess.Popen([transmitter.bin_dir + "hackrf_transfer", "-d", + transmitter.serial, "-R", "-t", WAVEFORM, "-a", tx_amp, "-x", + f"{test_case.tx_gain}", "-f", str(tx_center_freq)], + stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8") + + time.sleep(SLEEP_TIME) + if sweep: + receive = subprocess.run([receiver.bin_dir + "hackrf_sweep", + "-d", receiver.serial, "-N", "22", "-w", "22222", "-f", + sweep_range, "-a", rx_amp, "-l", f"{test_case.rx_lna_gain}", + "-g", f"{test_case.rx_vga_gain}"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + else: + receive = subprocess.run([receiver.bin_dir + "hackrf_transfer", + "-d", receiver.serial, "-n10000", "-r", "/dev/null", "-f", + f"{(test_case.freq)*ONE_MHZ}", "-a", rx_amp, "-l", + f"{test_case.rx_lna_gain}", "-g", f"{test_case.rx_vga_gain}", + "-b", "2500000"], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + transmit.terminate() + if receive.returncode != 0: + log(receive.stdout + receive.stderr) + log(f"{receiver.name} Failed RX, sweep={sweep}") + fail(170) + + if sweep: + rssi = self.analyze_sweep(receive, test_case) + else: + rssi = self.analyze_transfer(receive, test_case) + + tx_out, tx_err = transmit.communicate(timeout=TIMEOUT) + if transmit.returncode != 0: + out(tx_out + tx_err) + out(f"Warning: {transmitter.name} transmit failed") + return rssi + + def test_rf_preliminary(self): + results = [] + + for test_case in (all_rf_test_cases): + if test_case.amp == False: + if test_case.direction == "rx": + self.baseline_rx(test_case) + elif self.partner: + self.partner.baseline_rx(test_case) + + self.noise_rx(noise) + # FIXME test for RX DC offset? + + if not self.partner: + out("Skipping RF tests") + return + + for test_case in (all_rf_test_cases): + results.append(int(round(self.measure_rf(test_case, sweep=False) - (SIGNAL_THRESHOLD + 11)))) + + log(f"Preliminary results: {results}") + if self.errors: + fail_rf(self.errors) + + def test_rf(self): + assert self.partner + results = [] + + for test_case in (all_rf_test_cases): + results.append(int(round(self.measure_rf(test_case, sweep=True) - (SIGNAL_THRESHOLD + 5)))) + + out(f"RF results summary: {results}") + if self.errors: + fail_rf(self.errors) + + def activate_leds(self, enable): + if enable: + out(f"Activating {self.name} LEDs") + state = 7 + else: + state = 1 + command = subprocess.run([self.bin_dir + "hackrf_debug", "-d", self.serial, "--leds", + f"{state}"], capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if command.returncode != 0: + log(command.stdout + command.stderr) + log(f"Failed to configure {self.name} LEDs ({state})") + fail(190) + + +# This waveform is a full-scale complex exponential with a frequency of -1/10 the +# sample rate. When transmitted at 10 Msps, the frequency is 1 MHz below the +# center frequency. + +def write_waveform(): + tx_bytes = b'\x7f\x00\x67\xb5\x27\x87\xd9\x87\x99\xb5\x81\x00\x99\x4b\xd9\x79\x27\x79\x67\x4b' + # defective waveform with DC offset: + #tx_bytes = b'\x7f\x10\x67\xa5\x27\x97\xd9\x97\x99\xc5\x81\x10\x99\x5b\xd9\x7f\x27\x7f\x67\x5b' + # defective waveform with missing Q channel: + #tx_bytes = b'\x7f\x00\x67\x00\x27\x00\xd9\x00\x99\x00\x81\x00\x99\x00\xd9\x00\x27\x00\x67\x00' + with open(WAVEFORM, "wb") as bin_file: + for i in range(50000): # 1MB file size + bin_file.write(tx_bytes) + + +def program(bin_dir, fw_dir, serial, unattended=False): + if "build" in fw_dir: + binary = "hackrf_usb.bin" + dfu_stub = "hackrf_usb.dfu" + else: + binary = "hackrf_one_usb.bin" + dfu_stub = "hackrf_one_usb.dfu" + + # EUTs in unattended (including Jenkins CI) setups have pins jumped to always boot into DFU mode, so resetting is undesirable + if unattended: + reset_write = "-w" + else: + reset_write = "-Rw" + + if not usb.core.find(idVendor=DFU_VENDOR_ID, idProduct=DFU_PRODUCT_ID): + print("ACTION REQUIRED: Press and release EUT RESET button while holding DFU button.") + while not usb.core.find(idVendor=DFU_VENDOR_ID, idProduct=DFU_PRODUCT_ID): + time.sleep(0.1) + + out("Programming EUT in DFU mode") + dfu = subprocess.run([f"{DFU_UTIL}", "--device", + f"{DFU_VENDOR_ID}:{DFU_PRODUCT_ID}", "--alt", "0", "--download", + f"{fw_dir}{dfu_stub}"], capture_output=True, encoding="utf-8", + timeout=TIMEOUT) + + #dfu-util: unable to read DFU status after completion (LIBUSB_ERROR_IO) + # despite successful download; present as of at least dfu-util 0.11 + if "Download done." not in dfu.stdout: + fail(60) + + # Wait for device to boot from DFU. + then = time.time() + dfu_device_found = False + while time.time() < (then + 50): + dfu_info = subprocess.run([bin_dir + "hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + + if "RunningFromRAM" in dfu_info.stdout: + if serial in dfu_info.stdout and serial != "RunningFromRAM": + out("wrong device in DFU mode") + fail(1) + else: + dfu_device_found = True + break + time.sleep(0.1) + if not dfu_device_found: + out("DFU device not found") + fail(1) + + out("Programming EUT SPI flash") + spiflash = subprocess.run([bin_dir + "hackrf_spiflash", "-d", + "RunningFromRAM", reset_write, f"{fw_dir}{binary}"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if spiflash.returncode != 0: + log(spiflash.stdout + spiflash.stderr) + fail(70) + + then = time.time() + device_found = False + while time.time() < (then + 5): + flash_info = subprocess.run([bin_dir + "hackrf_info"], capture_output=True, + timeout=TIMEOUT) + + if serial in flash_info.stdout.decode('utf-8', errors='ignore'): + device_found = True + break + time.sleep(0.1) + if not device_found: + fail(75) + + +def find_sn(name, bin_dir, claimed_sns=[]): + while True: + sn_list = [] + info = subprocess.run([bin_dir + "hackrf_info"], capture_output=True, + encoding="utf-8", timeout=TIMEOUT) + devices_list = re.findall(r'Found HackRF\n.+\n.+\n.+\n.+\n.+\n.+', info.stdout) + + out(f"\nPotential {name}(s) found:\n") + for device in devices_list: + new_sn = re.search(r'Serial number: \w+', device).group().split(': ')[1] + if new_sn not in claimed_sns: + sn_list.append(new_sn) + if len(sn_list) > 1: + for i in range(len(sn_list)): + out(f"{i}: {sn_list[i]}") + choice = int(input(f"\nEnter the index of your target {name}s serial number: ")) + if 0 <= choice < len(sn_list): + sn = sn_list[choice] + break + else: + out("Incorrect choice, try again.") + elif len(sn_list) == 1: + sn = sn_list[0] + out(f"{sn}\n") + break + else: + out("Failed to parse a serial number from hackrf_info") + fail(1) + return sn + + +def get_version(): + version = subprocess.run(["git", "log", "-n" "1", "--format=%h"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if version.returncode != 0: + return "2026.01.3+" + elif version.returncode == 0: + dirty = subprocess.run(["git", "status", "-s", "--untracked-files=no"], + capture_output=True, encoding="utf-8", timeout=TIMEOUT) + if dirty.stdout != "": + dirty_flag = "*" + else: + dirty_flag = "" + return f"git-{version.stdout.strip()}{dirty_flag}" + + +def main(): + + write_waveform() + + parser = argparse.ArgumentParser(description="Utility for testing HackRF One") + parser.add_argument("-c", "--noclk", action="store_true", help="skip CLKIN, CLKOUT, and PPM tests") + parser.add_argument("-i", "--noif", action="store_true", help="skip IF tuning range test") + parser.add_argument("-l", "--loop", action="store_true", help="repeat the test until terminated with ctrl-c") + parser.add_argument("-m", "--manufacturer", action="store_true", help="check the manufacturer of target devices") + parser.add_argument("-r", "--rev", metavar=" or \"any\"", type=str, + help="check EUT pin straps for specific hardware revision (default: \"r9\")", + default="r9") + parser.add_argument("-s", "--solo", action="store_true", help="perform limited tests on a single EUT with no TESTER") + parser.add_argument("-t", "--tcxo", action="store_true", help="skip CLKIN/CLKOUT tests and use TCXO instead") + parser.add_argument("-E", "--eut", metavar="", type=str, + help="EUT serial number") + parser.add_argument("-T", "--tester", metavar="", type=str, + help="TESTER serial number") + parser.add_argument("-f", "--fwupdate", metavar="", type=str, + help="update firmware with binaries from specified directory") + parser.add_argument("-H", "--hostdir", metavar="", type=str, + help="location of installed hackrf host tools, will attempt to find them if omitted") + parser.add_argument("-b", "--testerdir", metavar="", type=str, + help="necessary only if EUT/TESTER have separate host binaries") + parser.add_argument("-C", "--ci", action="store_true", help="For use with Jenkins CI user") + parser.add_argument("-u", "--unattended", action="store_true", help="For use with unattended hardware") + parser.add_argument("-L", "--log", metavar="", type=str, + help="log file location") + global args + args = parser.parse_args() + + if args.ci: + user = "jenkins" + else: + user = os.getlogin() + + if "any" in args.rev.lower(): + args.rev = None + elif args.rev.lower() == "r1" or args.rev.lower() == "r4": + args.rev = "older than r6" + + if args.hostdir: + eut_host_dir = args.hostdir + else: + try: + eut_host_dir = os.path.dirname(shutil.which('hackrf_info')) + "/" + except: + out("No path to hackrf host tools found. Please provide a directory via --hostdir") + fail(1) + + if args.testerdir: + if args.testerdir == eut_host_dir: + out("Specified TESTER bin directory must be different from the found EUT bin directory") + out("If shared TESTER/EUT bin directory is intended, omit --testerdir") + fail(1) + else: + tester_host_dir = args.testerdir + else: + tester_host_dir = eut_host_dir + + unique_bin = (tester_host_dir != eut_host_dir) + count = 0 + + while True: + out() + out("================================") + out(datetime.now()) + out(sys.argv) + out(f"user: {user}") + out(f"version: {get_version()}") + out(f"pid: {os.getpid()}") + if args.loop: + out(f"repeat count: {count}") + out("================================") + out() + + if args.eut: + eut_sn = args.eut + else: + if args.tester: + eut_sn = find_sn("EUT", eut_host_dir, [args.tester]) + else: + eut_sn = find_sn("EUT", eut_host_dir) + if args.tester: + tester_sn = args.tester + else: + tester_sn = find_sn("TESTER", tester_host_dir, [eut_sn]) + + if eut_sn == tester_sn: + out("TESTER and EUT cannot be the same device") + fail(1) + + if args.fwupdate: + program(eut_host_dir, args.fwupdate, eut_sn, args.unattended) + + if not args.rev: + out("Skipping EUT hardware revision check") + eut = HackRF("EUT", eut_host_dir, eut_sn, args.manufacturer, revision=args.rev) + + if args.solo: + tester = None + else: + tester = HackRF("TESTER", tester_host_dir, tester_sn, args.manufacturer, unique_bin=unique_bin) + tester.test_serial() + tester.partner = eut + eut.partner = tester + + out("Testing EUT") + + if args.solo: + eut.clkout_connected = False + elif args.noclk: + eut.clkout_connected = False + tester.clkout_connected = False + elif args.tcxo: + eut.clkout_connected = False + tester.clkout_connected = True + else: + eut.clkout_connected = True + tester.clkout_connected = True + + if count > 0 and not args.fwupdate: + eut.activate_leds(False) + + eut.test_serial() + + # limited RF test without clock synchronization + eut.test_rf_preliminary() + + if args.noclk or args.solo: + out("Skipping CLKIN, CLKOUT, and PPM tests") + else: + eut.test_xtal() + if not args.tcxo: + eut.test_clkout() + eut.test_clkin() + + eut.clkout(False) + + if tester: + tester.clkout(True) + + if args.tcxo: + if args.solo: + out("Error: --solo is incompatible with --tcxo") + sys.exit(1) + if tester.clkin(): + out("Using TCXO on TESTER") + else: + out("Warning: No TCXO or external clock detected on TESTER") + out("Skipping CLKOUT test") + if not args.noclk and not eut.clkin(): + fail(211) + + # full RF test with clock synchronization + if tester: + eut.test_rf() + + if args.noif or args.solo: + out("Skipping IF tuning range test") + else: + eut.test_if_range(ifmin, ifmax) + + eut.activate_leds(True) + + out() + if (args.solo or args.noif or args.noclk or args.tcxo or not args.rev): + out("Limited test complete") + else: + out("PASS if all 6 LEDs active") + + count += 1 + if not args.loop: + break + + +if __name__ == "__main__": + try: + main() + except KeyboardInterrupt: + print() + out("KeyboardInterrupt") + sys.exit(0) + except subprocess.TimeoutExpired: + log(traceback.format_exc()) + fail(180) diff --git a/ci-scripts/install-firmware.sh b/ci-scripts/install-firmware.sh deleted file mode 100755 index 8d83486c..00000000 --- a/ci-scripts/install-firmware.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -git submodule init -git submodule update -mkdir firmware/hackrf_usb/build -cd firmware/hackrf_usb/build -cmake .. -make -cd ../../.. \ No newline at end of file diff --git a/ci-scripts/install-host.sh b/ci-scripts/install-host.sh deleted file mode 100755 index a1260367..00000000 --- a/ci-scripts/install-host.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash -mkdir host/build -cd host/build -cmake .. -make -cd ../.. \ No newline at end of file diff --git a/ci-scripts/install_host.sh b/ci-scripts/install_host.sh new file mode 100755 index 00000000..29bfb1d1 --- /dev/null +++ b/ci-scripts/install_host.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +cd host +cmake -B build +cmake --build build +cd .. diff --git a/ci-scripts/test-debug.py b/ci-scripts/test-debug.py new file mode 100644 index 00000000..26c4cd11 --- /dev/null +++ b/ci-scripts/test-debug.py @@ -0,0 +1,37 @@ +#!/usr/bin/python3 +import sys +import subprocess + +PASS, FAIL = range(2) +EUT = "RunningFromRAM" + + +def check_debug(target, register, reg_val): + hackrf_debug = subprocess.run(["host/build/hackrf-tools/src/hackrf_debug", + f"--{target}", "--register", register, + "--read", "--device", EUT], + capture_output=True, encoding="UTF-8") + + if reg_val in hackrf_debug.stdout: + print(f"hackrf_debug --{target} passed.") + return PASS + else: + print(f"hackrf_debug --{target} failed.") + return FAIL + + +def main(): + results = [ + check_debug("si5351c", "2", "0x03"), + check_debug("max2837", "3", "0x1b9"), + check_debug("rffc5072", "2", "0x9055"), + ] + + if FAIL not in results: + sys.exit(PASS) + else: + sys.exit(FAIL) + + +if __name__ == "__main__": + main() diff --git a/ci-scripts/test-firmware-flash.sh b/ci-scripts/test-firmware-flash.sh index a56d8fa3..3b6f167d 100755 --- a/ci-scripts/test-firmware-flash.sh +++ b/ci-scripts/test-firmware-flash.sh @@ -3,7 +3,7 @@ host/build/hackrf-tools/src/hackrf_spiflash -w firmware/hackrf_usb/build/hackrf_ EXIT_CODE="$?" if [ "$EXIT_CODE" == "1" ] then - echo "No GreatFET found! Disconnected? Exiting.." + echo "No HackRF found! Disconnected? Exiting.." exit $EXIT_CODE elif [ "$EXIT_CODE" == "0" ] then @@ -13,6 +13,6 @@ then echo "Host tool installation failed! Exiting.." exit $EXIT_CODE else - echo "god have mercy on your soul" + echo "Unknown error" exit $EXIT_CODE -fi \ No newline at end of file +fi diff --git a/ci-scripts/test-firmware-program.sh b/ci-scripts/test-firmware-program.sh index 487fe3bc..26be84c6 100755 --- a/ci-scripts/test-firmware-program.sh +++ b/ci-scripts/test-firmware-program.sh @@ -1,7 +1,6 @@ #!/bin/bash -usbhub --disable-i2c --hub D9D1 power state --port 2 --reset +dfu-util --device 1fc9:000c --alt 0 --download firmware/hackrf_usb/build/hackrf_usb.dfu sleep 1s -dfu-util --path 1-1.2 --alt 0 --download firmware/hackrf_usb/build/hackrf_usb.dfu EXIT_CODE="$?" if [ "$EXIT_CODE" == "0" ] then @@ -16,6 +15,6 @@ then echo "dfu-util installation failed! Exiting.." exit $EXIT_CODE else - echo "god have mercy on your soul" + echo "Unhandled exception" exit $EXIT_CODE -fi \ No newline at end of file +fi diff --git a/ci-scripts/test-transfer.py b/ci-scripts/test-transfer.py new file mode 100644 index 00000000..815c2b81 --- /dev/null +++ b/ci-scripts/test-transfer.py @@ -0,0 +1,127 @@ +#!/usr/bin/python3 +import subprocess +import time +import sys +from os import environ + +EUT = environ.get('EUT') +TESTER = environ.get('TESTER') +PASS, FAIL = range(2) + + +def write_bytes(): + tx_bytes = b'\x7f\x00\x59\x59\x00\x7f\xa7\x59\x81\x00\xa7\xa7\x00\x81\x59\xa7' + with open("/tmp/binary100", "wb") as bin_file: + for i in range(62500): # 1MB file size + bin_file.write(tx_bytes) + + +def capture_signal(sweep_range, tx_gain, rx_lna_gain, rx_vga_gain, freq=None, + if_freq=None, lo_freq=None, image_reject=0): + + test_type = sys.argv[1] + if test_type == "tx": + transmitter = EUT + receiver = TESTER + elif test_type == "rx": + transmitter = TESTER + receiver = EUT + else: + print(f"Invalid command-line argument: {test_type}. Use tx or rx") + sys.exit(1) + + if if_freq == None: + transmit = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_transfer", + "-d", transmitter, "-R", "-t", "/tmp/binary100", + "-a", "0", "-x", tx_gain, "-f", freq], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + else: + transmit = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_transfer", + "-d", transmitter, "-R", "-t", "/tmp/binary100", + "-a", "0", "-x", tx_gain, "-i", if_freq, + "-o", lo_freq, "-m", image_reject], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + + time.sleep(1) + sweep = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_sweep", + "-d", receiver, "-N", "2", "-w", "333333", + "-f", sweep_range, "-a", "0", "-l", rx_lna_gain, + "-g", rx_vga_gain], + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + sweep.wait() + transmit.terminate() + transmit.wait() + + # parse the hackrf_sweep output + data, stderr = sweep.communicate() + data = data.decode("utf-8") + data = data.split("\n") + print(data[4]) + data = data[4] # Note: using data from the 2nd sweep until issue #1230 is resolved. + data = data.split(", ") + data = data[6:21] + bins = [float(bin) for bin in data] + return bins + + +def check_signal(freq, bins): + signal = bins.pop(1) + signal_threshold = -25 + max_power = -10 + result = PASS + + if signal < signal_threshold: + print(f"Signal not strong enough at {freq} MHz") + result = FAIL + elif signal > max_power: + print(f"Received signal exceeded maximum power at {freq} MHz") + result = 1 + + for bin in bins: + if bin > max_power or bin > signal: + print(f"Non-target bin power exceeded max power threshold at {freq} MHz") + result = FAIL + break + + return result + + +def main(): + write_bytes() + tester_hub_on = subprocess.Popen(["hubs", "hackrf", "reset"]) + tester_hub_on.wait() + time.sleep(1) + eut_clkout_on = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_clock", + "-o", "1", "-d", EUT]) + tester_clkout_off = subprocess.Popen(["host/build/hackrf-tools/src/hackrf_clock", + "-o", "0", "-d", TESTER]) + eut_clkout_on.wait() + tester_clkout_off.wait() + + _9_5Mhz_data = capture_signal(sweep_range="9:29", tx_gain="38", rx_lna_gain="16", + rx_vga_gain="16", if_freq="2628250000", + lo_freq="2620000000", image_reject="1") + _915_5Mhz_data = capture_signal(sweep_range="915:935", tx_gain="38", rx_lna_gain="16", + rx_vga_gain="16", if_freq="2540750000", + lo_freq="3455000000", image_reject="1") + _2665_5Mhz_data = capture_signal(sweep_range="2665:2685", tx_gain="26", rx_lna_gain="16", + rx_vga_gain="16", freq="2664250000") + _5999_5Mhz_data = capture_signal(sweep_range="5999:6019", tx_gain="37", rx_lna_gain="32", + rx_vga_gain="40", if_freq="2540750000", + lo_freq="3460000000", image_reject="2") + + lp1_result = check_signal(9.5, _9_5Mhz_data) + lp2_result = check_signal(915.5, _915_5Mhz_data) + bp_result = check_signal(2665.5, _2665_5Mhz_data) + hp_result = check_signal(5999.5, _5999_5Mhz_data) + results = [lp1_result, lp2_result, bp_result, hp_result] + + if FAIL in results: + sys.exit(FAIL) + else: + sys.exit(PASS) + + +if __name__ == "__main__": + main() + diff --git a/ci-scripts/test-host.sh b/ci-scripts/test_host.sh similarity index 84% rename from ci-scripts/test-host.sh rename to ci-scripts/test_host.sh index 0a7ec7a3..5cc8b621 100755 --- a/ci-scripts/test-host.sh +++ b/ci-scripts/test_host.sh @@ -1,6 +1,4 @@ -#!/bin/bash -usbhub --disable-i2c --hub D9D1 power state --port 2 --reset -sleep 1s +#!/bin/bash host/build/hackrf-tools/src/hackrf_info EXIT_CODE="$?" if [ "$EXIT_CODE" == "1" ] @@ -18,4 +16,4 @@ then else echo "god have mercy on your soul" exit $EXIT_CODE -fi \ No newline at end of file +fi diff --git a/ci-scripts/test_sgpio_debug.py b/ci-scripts/test_sgpio_debug.py new file mode 100644 index 00000000..73531822 --- /dev/null +++ b/ci-scripts/test_sgpio_debug.py @@ -0,0 +1,87 @@ +#!/usr/bin/python3 +import os +import sys +import subprocess +from pathlib import Path + +FILENAME = f"/tmp/rx_100kB_{str(os.getpid())}" + + +def program_device(): + # build new firmware with SGPIO_DEBUG mode enabled + print("Programming device...") + fw_dir = os.getcwd() + "/firmware/hackrf_usb/build" + del_dir = subprocess.run(["rm", "-rf", "firmware/hackrf_usb/build"]) + mk_dir = subprocess.run(["mkdir", "firmware/hackrf_usb/build"]) + cmake = subprocess.run(["cmake", "-D", "SGPIO_DEBUG=1", ".."], + cwd=fw_dir, stdout=subprocess.DEVNULL) + make = subprocess.run(["make"], + cwd=fw_dir, stdout=subprocess.DEVNULL) + program = subprocess.run(["./ci-scripts/test-firmware-program.sh"], + stdout=subprocess.DEVNULL) + + +def capture(): + shortfall_count = -1 + capture_tries = 0 + + while shortfall_count != 0: + print("Capturing data...") + rx_100kB = subprocess.run(["host/build/hackrf-tools/src/hackrf_transfer", + "-r", FILENAME, "-d", "RunningFromRAM", + "-n", "50000", "-s", "20000000"], + capture_output=True, encoding="UTF-8") + print(rx_100kB.stdout) + print(rx_100kB.stderr) + print(f"Wrote capture data to file: {FILENAME}") + + debug_state_proc = subprocess.run(["host/build/hackrf-tools/src/hackrf_debug", "--state"], + capture_output=True, encoding="UTF-8") + print(debug_state_proc.stdout) + print(debug_state_proc.stderr) + capture_tries += 1 + debug_state = debug_state_proc.stdout.split("\n") + shortfalls_line = [s for s in debug_state if s.startswith("Number of shortfalls")] + shortfall_count = [int(c) for c in shortfalls_line[0].split() if c.isdigit()][0] + + if capture_tries == 10: + print("Unable to transmit data with 0 shortfalls. " \ + "This is not indicative of a device failure. " \ + "Likely an issue with the testing infrastructure.") + sys.exit(1) + + +def check_bytes(): + print(f"Checking length of {FILENAME}") + rx_data = Path(FILENAME).read_bytes() + if len(rx_data) != 100000: # file should be 100k bytes when using 50k samples + print(f"ERROR: Only {str(len(rx_data))} bytes found in file, expected 100k.") + sys.exit(1) + else: + print("Correct file size found.") + + # check that each byte = prev_byte + 1 except at wraparound bounds + print("Checking bytes...") + for i in range(1, len(rx_data)): + if rx_data[i-1] != rx_data[i] - 1: + if not (rx_data[i] == 0 and rx_data[i-1] == 255): + print(f"ERROR: Incorrect data value found at location {str(i)} in {FILENAME}:") + # print up to 5 values starting from at most 1 value before error occurence + j = -1 + while j < 4: + if i + j < len(rx_data) and i + j > -1: + print(f"{str(i+j)} : {str(rx_data[i+j])}") + j = j + 1 + sys.exit(1) + print("Successfully validated all bytes in file.\nSGPIO debug test passed.") + + +def main(): + program_device() + capture() + check_bytes() + + +if __name__ == "__main__": + main() + diff --git a/docs/doxygen/Doxyfile b/docs/doxygen/Doxyfile new file mode 100644 index 00000000..c3d6701f --- /dev/null +++ b/docs/doxygen/Doxyfile @@ -0,0 +1,2658 @@ +# Doxyfile 1.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "libhackrf" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "HackRF SDR platform library" + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- +# directories (in 2 levels) under the output directory of each output format and +# will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, +# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), +# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, +# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), +# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, +# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, +# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, +# Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# The OUTPUT_TEXT_DIRECTION tag is used to specify the direction in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all generated output in the proper direction. +# Possible values are: None, LTR, RTL and Context. +# The default value is: None. + +OUTPUT_TEXT_DIRECTION = None + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = NO + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:\n" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". You can put \n's in the value part of an alias to insert +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. +# When you need a literal { or } or , in the value part of an alias you have to +# escape them by means of a backslash (\), this can lead to conflicts with the +# commands \{ and \} for these it is advised to use the version @{ and @} or use +# a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, +# Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = YES + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = YES + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = YES + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# The default value is: system dependent. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= NO + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = NO + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some parameters +# in a documented function, or documenting parameters that don't exist or using +# markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong or incomplete +# parameter documentation, but not about the absence of documentation. If +# EXTRACT_ALL is set to YES then this flag will automatically be disabled. +# The default value is: NO. + +WARN_NO_PARAMDOC = YES + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = "../../host/libhackrf/src/hackrf.h" + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, +# *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# AClass::ANamespace, ANamespace::*Test +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories use the pattern */test/* + +EXCLUDE_SYMBOLS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = NO + +# In case all classes in a project start with a common prefix, all classes will +# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag +# can be used to specify a prefix (or a list of prefixes) that should be ignored +# while generating the index headers. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). For an example see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a colorwheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use grayscales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML +# page will contain the date and time when the page was generated. Setting this +# to YES can help to show when doxygen was last run and thus if the +# documentation is up to date. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_TIMESTAMP = NO + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine-tune the look of the index. As an example, the default style +# sheet generated by doxygen has an example that shows how to put an image at +# the root of the tree instead of the PROJECT_NAME. Since the tree basically has +# the same information as the tab index, you could consider setting +# DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 1 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images +# generated for formulas are transparent PNGs. Transparent PNGs are not +# supported properly for IE 6.0, but are supported on all modern browsers. +# +# Note that when changing this option you need to delete any form_*.png files in +# the HTML output directory before the changes have effect. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_TRANSPARENT = YES + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. See the MathJax site (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility), NativeMML (i.e. MathML) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = https://cdn.jsdelivr.net/npm/mathjax@2 + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /