├── .gitattributes ├── .gitignore ├── .gitmodules ├── .travis.yml ├── COPYING ├── Readme.md ├── TRADEMARK ├── appveyor.yml ├── doc ├── HackRF-One-fd0-0009.jpeg ├── LPC4330_SGPIO_SignalGenerator_Measurements.ods ├── LPC4330_SGPIO_SignalGenerator_Measurements.pdf ├── LPCXPresso_Flash_Debug_Tutorial.odt ├── LPCXPresso_Flash_Debug_Tutorial.pdf ├── Readme.md ├── SPIFI_Quad_Tests_OLS │ ├── SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0.olp │ ├── SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0.ols │ └── SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0_Analyze.txt ├── jawbreaker-fd0-145436.jpeg ├── jawbreaker.jpeg ├── lemonAndjelly.jpeg └── wiki │ ├── hardware │ └── modifications │ │ ├── sgpio-gclk2-reroute.jpg │ │ └── sgpio-p1_12-cut-trace.jpg │ └── images │ ├── baseband-filter │ ├── max2837-1m75bw-at-2m.png │ └── max2837-1m75bw-at-8m.png │ ├── hackrf_blockdiagram-digital.png │ ├── hackrf_blockdiagram-digital.svg │ ├── hackrf_blockdiagram-frontend_baseband.png │ └── hackrf_blockdiagram-frontend_baseband.svg ├── firmware ├── .gitignore ├── CMakeLists.txt ├── README ├── appveyor.sh ├── blinky │ ├── CMakeLists.txt │ ├── README │ └── blinky.c ├── common │ ├── LPC4320_M4_memory.ld │ ├── LPC4330_M4_memory.ld │ ├── LPC43xx_M0_memory.ld │ ├── LPC43xx_M4_M0_image_from_text.ld │ ├── LPC43xx_M4_memory.ld │ ├── README │ ├── bitband.c │ ├── bitband.h │ ├── clock_conv.c │ ├── clock_conv.h │ ├── cpld_jtag.c │ ├── cpld_jtag.h │ ├── cpld_xc2c.c │ ├── cpld_xc2c.h │ ├── crc.c │ ├── crc.h │ ├── fault_handler.c │ ├── fault_handler.h │ ├── gpdma.c │ ├── gpdma.h │ ├── gpio.h │ ├── gpio_lpc.c │ ├── gpio_lpc.h │ ├── hackrf_core.c │ ├── hackrf_core.h │ ├── hackrf_ui.c │ ├── hackrf_ui.h │ ├── i2c_bus.c │ ├── i2c_bus.h │ ├── i2c_lpc.c │ ├── i2c_lpc.h │ ├── m0_bin.s.cmake │ ├── m0_sleep.c │ ├── max2837.c │ ├── max2837.h │ ├── max2837_regs.def │ ├── max2837_target.c │ ├── max2837_target.h │ ├── max2871.c │ ├── max2871.h │ ├── max2871_regs.c │ ├── max2871_regs.h │ ├── max5864.c │ ├── max5864.h │ ├── max5864_target.c │ ├── max5864_target.h │ ├── mixer.c │ ├── mixer.h │ ├── operacake.c │ ├── operacake.h │ ├── portapack.c │ ├── portapack.h │ ├── rf_path.c │ ├── rf_path.h │ ├── rffc5071.c │ ├── rffc5071.h │ ├── rffc5071_regs.def │ ├── rffc5071_spi.c │ ├── rffc5071_spi.h │ ├── rom_iap.c │ ├── rom_iap.h │ ├── sgpio.c │ ├── sgpio.h │ ├── si5351c.c │ ├── si5351c.h │ ├── spi_bus.c │ ├── spi_bus.h │ ├── spi_ssp.c │ ├── spi_ssp.h │ ├── streaming.c │ ├── streaming.h │ ├── tuning.c │ ├── tuning.h │ ├── ui_portapack.c │ ├── ui_portapack.h │ ├── ui_rad1o.c │ ├── ui_rad1o.h │ ├── usb.c │ ├── usb.h │ ├── usb_queue.c │ ├── usb_queue.h │ ├── usb_request.c │ ├── usb_request.h │ ├── usb_standard_request.c │ ├── usb_standard_request.h │ ├── usb_type.h │ ├── w25q80bv.c │ ├── w25q80bv.h │ ├── w25q80bv_target.c │ ├── w25q80bv_target.h │ └── xapp058 │ │ ├── README │ │ ├── lenval.c │ │ ├── lenval.h │ │ ├── micro.c │ │ ├── micro.h │ │ ├── ports.c │ │ └── ports.h ├── cpld │ ├── README │ ├── sgpio_debug │ │ ├── Makefile │ │ ├── README.md │ │ ├── batch_svf │ │ ├── batch_xsvf │ │ ├── default.xsvf │ │ ├── sgpio_debug.xise │ │ ├── top.jed │ │ ├── top.ucf │ │ ├── top.vhd │ │ └── top_tb.vhd │ └── sgpio_if │ │ ├── Makefile │ │ ├── README.md │ │ ├── batch_svf │ │ ├── batch_xsvf │ │ ├── default.xsvf │ │ ├── sgpio_if.xise │ │ ├── top.jed │ │ ├── top.ucf │ │ ├── top.vhd │ │ └── top_tb.vhd ├── dfu-util.cmake ├── dfu.py ├── hackrf-common.cmake ├── hackrf_usb │ ├── CMakeLists.txt │ ├── hackrf_usb.c │ ├── sgpio_m0.s │ ├── usb_api_board_info.c │ ├── usb_api_board_info.h │ ├── usb_api_clock_conv.c │ ├── usb_api_clock_conv.h │ ├── usb_api_cpld.c │ ├── usb_api_cpld.h │ ├── usb_api_operacake.c │ ├── usb_api_operacake.h │ ├── usb_api_register.c │ ├── usb_api_register.h │ ├── usb_api_spiflash.c │ ├── usb_api_spiflash.h │ ├── usb_api_sweep.c │ ├── usb_api_sweep.h │ ├── usb_api_transceiver.c │ ├── usb_api_transceiver.h │ ├── usb_api_ui.c │ ├── usb_api_ui.h │ ├── usb_bulk_buffer.c │ ├── usb_bulk_buffer.h │ ├── usb_descriptor.c │ ├── usb_descriptor.h │ ├── usb_device.c │ ├── usb_device.h │ ├── usb_endpoint.c │ └── usb_endpoint.h ├── toolchain-arm-cortex-m.cmake └── tools │ ├── check_clock.py │ ├── cpld_bitstream.py │ ├── dumb_crc32.py │ ├── dump_cgu.py │ └── xsvf.py ├── hardware ├── .gitignore ├── LNA915 │ ├── LNA915-cache.lib │ ├── LNA915.cmp │ ├── LNA915.kicad_pcb │ ├── LNA915.lib │ ├── LNA915.pro │ ├── LNA915.sch │ ├── README │ ├── fp-lib-table │ └── sym-lib-table ├── bubblegum │ ├── bubblegum-cache.lib │ ├── bubblegum.brd │ ├── bubblegum.cmp │ ├── bubblegum.net │ ├── bubblegum.pro │ └── bubblegum.sch ├── hackrf-one │ ├── LICENSE │ ├── PlasticCase_CAD │ │ ├── Case_With_HackRF.png │ │ ├── HackRF_One_Case.png │ │ ├── HackRF_One_Case_With_Button_CutOuts.dxf │ │ └── README │ ├── README │ ├── acrylic_case │ │ ├── HackRF_One_Case_v2.dxf │ │ ├── HackRF_One_Case_v2.pdf │ │ ├── HackRF_One_Case_v2.svg │ │ └── README.md │ ├── baseband.sch │ ├── fp-lib-table │ ├── frontend.sch │ ├── hackrf-one-cache.lib │ ├── hackrf-one.cmp │ ├── hackrf-one.kicad_pcb │ ├── hackrf-one.pro │ ├── hackrf-one.sch │ ├── mcu.sch │ └── sym-lib-table ├── jawbreaker │ ├── README │ ├── SoBv1_DP17298 │ │ ├── README │ │ ├── SoBv1-DP17298-jawbreaker-Bottom.skp │ │ ├── SoBv1-DP17298-jawbreaker-Bottom.svg │ │ ├── SoBv1-DP17298-jawbreaker-Bottom_laser_cutting_493.3mm_Easy.txt │ │ ├── SoBv1-DP17298-jawbreaker-Top.skp │ │ ├── SoBv1-DP17298-jawbreaker-Top.svg │ │ ├── SoBv1-DP17298-jawbreaker-Top_laser_cutting_1153.3mm_Normal.txt │ │ ├── SoBv1-DP17298-jawbreaker.jpg │ │ └── jawbreaker_and_case.png │ ├── baseband.sch │ ├── frontend.sch │ ├── jawbreaker-cache.lib │ ├── jawbreaker.brd │ ├── jawbreaker.cmp │ ├── jawbreaker.net │ ├── jawbreaker.pro │ ├── jawbreaker.sch │ └── mcu.sch ├── jellybean │ ├── JellyBean_PinMux.pmx │ ├── JellyBean_TPS62410.ods │ ├── JellyBean_pins.png │ ├── README │ ├── jellybean-cache.lib │ ├── jellybean.brd │ ├── jellybean.cmp │ ├── jellybean.net │ ├── jellybean.pro │ ├── jellybean.sch │ ├── jellybean_BOM.ods │ ├── jellybean_board_PCB_layers.pdf │ └── jellybean_schematic.pdf ├── kicad │ ├── hackrf.dcm │ ├── hackrf.lib │ └── hackrf.mod ├── lemondrop │ ├── README │ ├── lemondrop-cache.lib │ ├── lemondrop.brd │ ├── lemondrop.cmp │ ├── lemondrop.net │ ├── lemondrop.pro │ └── lemondrop.sch ├── licorice │ ├── licorice-cache.lib │ ├── licorice.brd │ ├── licorice.cmp │ ├── licorice.net │ ├── licorice.pro │ └── licorice.sch ├── lollipop │ ├── lollipop-cache.lib │ ├── lollipop.brd │ ├── lollipop.cmp │ ├── lollipop.net │ ├── lollipop.pro │ ├── lollipop.sch │ └── lollipop_logic.py ├── marzipan │ ├── README │ ├── baseband.sch │ ├── fp-lib-table │ ├── frontend.sch │ ├── marzipan-cache.lib │ ├── marzipan.cmp │ ├── marzipan.kicad_pcb │ ├── marzipan.net │ ├── marzipan.pro │ ├── marzipan.sch │ └── mcu.sch ├── neapolitan │ ├── README │ ├── baseband.sch │ ├── fp-lib-table │ ├── frontend.sch │ ├── mcu.sch │ ├── neapolitan-cache.lib │ ├── neapolitan.cmp │ ├── neapolitan.kicad_pcb │ ├── neapolitan.net │ ├── neapolitan.pro │ └── neapolitan.sch ├── operacake │ ├── README │ ├── fp-lib-table │ ├── operacake-cache.lib │ ├── operacake.kicad_pcb │ ├── operacake.net │ ├── operacake.pro │ └── operacake.sch └── test │ └── si5351-configure.py ├── host ├── CMakeLists.txt ├── README.md ├── cmake │ ├── cmake_uninstall.cmake.in │ ├── modules │ │ ├── FindFFTW.cmake │ │ ├── FindLIBHACKRF.cmake │ │ ├── FindThreads.cmake │ │ └── FindUSB1.cmake │ └── set_release.cmake ├── hackrf-tools │ ├── CMakeLists.txt │ ├── getopt │ │ ├── getopt.c │ │ └── getopt.h │ └── src │ │ ├── CMakeLists.txt │ │ ├── hackrf_clock.c │ │ ├── hackrf_cpldjtag.c │ │ ├── hackrf_debug.c │ │ ├── hackrf_fm.c │ │ ├── hackrf_info.c │ │ ├── hackrf_operacake.c │ │ ├── hackrf_spiflash.c │ │ ├── hackrf_sweep.c │ │ ├── hackrf_tcp.c │ │ └── hackrf_transfer.c └── libhackrf │ ├── 53-hackrf.rules │ ├── 53-hackrf.rules.in │ ├── CMakeLists.txt │ ├── libhackrf.pc.in │ └── src │ ├── CMakeLists.txt │ ├── hackrf.c │ └── hackrf.h ├── issue_template.md └── tools ├── deploy-nightly.sh └── sgpio_debug ├── create_tx_counter.py ├── sgpio_debug_rx.grc └── sgpio_debug_tx.sh /.gitattributes: -------------------------------------------------------------------------------- 1 | *.brd linguist-language=KiCad 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled output 2 | *.bin 3 | *.d 4 | *.elf 5 | *.hex 6 | *.srec 7 | host/build/ 8 | host/**/build 9 | 10 | # Operating system spew 11 | .DS_Store 12 | .Spotlight-V100 13 | .Trashes 14 | ehthumbs.db 15 | Thumbs.db 16 | 17 | # Editor junk 18 | *.swp 19 | *.sublime-project 20 | *.sublime-workspace 21 | .vscode* 22 | 23 | # Xilinx tools create an enormous amount of poop: 24 | firmware/cpld/**/isim/ 25 | firmware/cpld/**/_ngo/ 26 | firmware/cpld/**/_xmsgs/ 27 | firmware/cpld/**/iseconfig/ 28 | firmware/cpld/**/*_html/ 29 | firmware/cpld/**/xlnx_auto_0_xdb/ 30 | firmware/cpld/**/xst/ 31 | firmware/cpld/**/_*.cmd 32 | firmware/cpld/**/_*.log 33 | firmware/cpld/**/*.bld 34 | firmware/cpld/**/*.chk 35 | firmware/cpld/**/*.cmd 36 | firmware/cpld/**/*.cmd_log 37 | firmware/cpld/**/*.csv 38 | firmware/cpld/**/*.cxt 39 | firmware/cpld/**/*.dat 40 | firmware/cpld/**/*.err 41 | firmware/cpld/**/*.exe 42 | firmware/cpld/**/*.gise 43 | firmware/cpld/**/*.gyd 44 | firmware/cpld/**/*.html 45 | firmware/cpld/**/*.ini 46 | firmware/cpld/**/*.ipf 47 | firmware/cpld/**/*.log 48 | firmware/cpld/**/*.lso 49 | firmware/cpld/**/*.mfd 50 | firmware/cpld/**/*.ng[acdr] 51 | firmware/cpld/**/*.pad 52 | firmware/cpld/**/*.phd 53 | firmware/cpld/**/*.pnx 54 | firmware/cpld/**/*.prj 55 | firmware/cpld/**/*.rpt 56 | firmware/cpld/**/*.stx 57 | firmware/cpld/**/*.syr 58 | firmware/cpld/**/*.tim 59 | firmware/cpld/**/*.tspec 60 | firmware/cpld/**/*.vm6 61 | firmware/cpld/**/*.wcfg 62 | firmware/cpld/**/*.wdb 63 | firmware/cpld/**/*.xml 64 | firmware/cpld/**/*.xmsgs 65 | firmware/cpld/**/*.xrpt 66 | firmware/cpld/**/*.xsl 67 | firmware/cpld/**/*.xst 68 | firmware/cpld/**/*.xwbt 69 | 70 | firmware/**/build 71 | 72 | *.pyc 73 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "firmware/libopencm3"] 2 | path = firmware/libopencm3 3 | url = https://github.com/mossmann/libopencm3.git 4 | [submodule "hardware/gsg-kicad-lib"] 5 | path = hardware/gsg-kicad-lib 6 | url = https://github.com/greatscottgadgets/gsg-kicad-lib.git 7 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | Stuff worthy of note in this fork: 2 | 3 | * A version of the `hackrf_tcp` IQ sample server that works with the current libhackrf. [More details](https://www.tablix.org/~avian/blog/archives/2021/03/hackrf_tcp_a_rtl_tcp_for_hackrf/) 4 | * Firmware, libhackrf and host tools support for [hackrf-clock-conv](https://github.com/avian2/hackrf-clock-conv). 5 | 6 | Original README follows below... 7 | 8 | This repository contains hardware designs and software for HackRF, 9 | a low cost, open source Software Defined Radio platform. 10 | 11 | ![HackRF One](https://raw.github.com/mossmann/hackrf/master/doc/HackRF-One-fd0-0009.jpeg) 12 | 13 | (photo by fd0 from https://github.com/fd0/hackrf-one-pictures) 14 | 15 | principal author: Michael Ossmann 16 | 17 | http://greatscottgadgets.com/hackrf/ 18 | -------------------------------------------------------------------------------- /TRADEMARK: -------------------------------------------------------------------------------- 1 | "HackRF" is a trademark of Great Scott Gadgets. Permission to use the trademark 2 | with attribution to Great Scott Gadgets is granted to all licensees of HackRF for 3 | the sole purpose of naming or describing copies or derived works. (See COPYING.) 4 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | os: Visual Studio 2017 2 | clone_depth: 1 3 | 4 | configuration: 5 | - Release 6 | 7 | init: 8 | - C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM% 9 | install: 10 | # Dependencies for libHackRF 11 | - appveyor DownloadFile "https://github.com/libusb/libusb/releases/download/v1.0.22/libusb-1.0.22.7z" -FileName "C:\libusb.7z" 12 | - 7z x -y "C:\libusb.7z" -o"C:\libusb" 13 | - appveyor DownloadFile "http://mirrors.kernel.org/sourceware/pthreads-win32/pthreads-w32-2-9-1-release.zip" -FileName "C:\pthreads-w32-release.zip" 14 | - 7z x -y "C:\pthreads-w32-release.zip" -o"C:\pthreads" 15 | - appveyor DownloadFile "http://ftp.gnome.org/pub/gnome/binaries/win32/dependencies/pkg-config_0.26-1_win32.zip" -FileName "C:\pkg-config_win32.zip" 16 | - 7z x -y "C:\pkg-config_win32.zip" -o"C:\pkg-config" 17 | # FFTW for hackrf_sweep 18 | - curl -fsS -o "C:\fftw-3.3.5.zip" "ftp://ftp.fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" 19 | - 7z x -y "C:\fftw-3.3.5.zip" -o"C:\fftw" 20 | - cd c:\fftw 21 | - ps: lib /machine:x64 /def:libfftw3f-3.def 22 | # ARM GCC for firmware builds 23 | # - 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" 24 | # - 7z x -y "C:\gcc-arm-none-eabi-win32.zip" -o"C:\gcc-arm-none-eabi" 25 | # - set PATH=%PATH%;c:\gcc-arm-none-eabi\bin 26 | 27 | build_script: 28 | # Host library and tools 29 | - mkdir c:\projects\hackrf\host\build 30 | - cd c:\projects\hackrf\host\build 31 | - cmake -G "Visual Studio 14 2015 Win64" \ 32 | -DLIBUSB_LIBRARIES="C:\libusb\MS64\dll\libusb-1.0.lib" \ 33 | -DLIBUSB_INCLUDE_DIR="C:\libusb\include\libusb-1.0" \ 34 | -DTHREADS_PTHREADS_INCLUDE_DIR=c:\pthreads\Pre-built.2\include \ 35 | -DTHREADS_PTHREADS_WIN32_LIBRARY=c:\pthreads\Pre-built.2\lib\x64\pthreadVC2.lib \ 36 | -DPKG_CONFIG_EXECUTABLE="C:\pkg-config\bin\pkg-config.exe" \ 37 | -DFFTW_INCLUDES=C:\fftw \ 38 | -DFFTW_LIBRARIES=C:\fftw\libfftw3f-3.lib \ 39 | .. 40 | - msbuild HackRF.sln /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" 41 | # Firmware 42 | # - cd c:\projects\hackrf\ 43 | # - git submodule init 44 | # - git submodule update 45 | # - '%CYG_BASH% -lc "cd $APPVEYOR_BUILD_FOLDER && firmware/appveyor.sh"' 46 | 47 | after_build: 48 | - 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\* 49 | 50 | artifacts: 51 | - path: HackRF-Windows-%APPVEYOR_REPO_COMMIT%.zip 52 | name: HackRF-Windows-%APPVEYOR_REPO_COMMIT% 53 | -------------------------------------------------------------------------------- /doc/HackRF-One-fd0-0009.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/HackRF-One-fd0-0009.jpeg -------------------------------------------------------------------------------- /doc/LPC4330_SGPIO_SignalGenerator_Measurements.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/LPC4330_SGPIO_SignalGenerator_Measurements.ods -------------------------------------------------------------------------------- /doc/LPC4330_SGPIO_SignalGenerator_Measurements.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/LPC4330_SGPIO_SignalGenerator_Measurements.pdf -------------------------------------------------------------------------------- /doc/LPCXPresso_Flash_Debug_Tutorial.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/LPCXPresso_Flash_Debug_Tutorial.odt -------------------------------------------------------------------------------- /doc/LPCXPresso_Flash_Debug_Tutorial.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/LPCXPresso_Flash_Debug_Tutorial.pdf -------------------------------------------------------------------------------- /doc/Readme.md: -------------------------------------------------------------------------------- 1 | The primary source of documentation is the wiki on github: 2 | 3 | https://github.com/mossmann/hackrf/wiki 4 | 5 | This directory contains supplemental documentation. 6 | 7 | (photo jawbreaker-fd0-145436.jpeg by fd0 from https://github.com/fd0/jawbreaker-pictures) 8 | -------------------------------------------------------------------------------- /doc/SPIFI_Quad_Tests_OLS/SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0.olp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/SPIFI_Quad_Tests_OLS/SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0.olp -------------------------------------------------------------------------------- /doc/SPIFI_Quad_Tests_OLS/SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0_Analyze.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/SPIFI_Quad_Tests_OLS/SPIFI_QUAD_100MHZ_OLS_0_9_6b3_JellyBean_Startup_Dual4_M4_SPIFI_0_Analyze.txt -------------------------------------------------------------------------------- /doc/jawbreaker-fd0-145436.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/jawbreaker-fd0-145436.jpeg -------------------------------------------------------------------------------- /doc/jawbreaker.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/jawbreaker.jpeg -------------------------------------------------------------------------------- /doc/lemonAndjelly.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/lemonAndjelly.jpeg -------------------------------------------------------------------------------- /doc/wiki/hardware/modifications/sgpio-gclk2-reroute.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/hardware/modifications/sgpio-gclk2-reroute.jpg -------------------------------------------------------------------------------- /doc/wiki/hardware/modifications/sgpio-p1_12-cut-trace.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/hardware/modifications/sgpio-p1_12-cut-trace.jpg -------------------------------------------------------------------------------- /doc/wiki/images/baseband-filter/max2837-1m75bw-at-2m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/images/baseband-filter/max2837-1m75bw-at-2m.png -------------------------------------------------------------------------------- /doc/wiki/images/baseband-filter/max2837-1m75bw-at-8m.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/images/baseband-filter/max2837-1m75bw-at-8m.png -------------------------------------------------------------------------------- /doc/wiki/images/hackrf_blockdiagram-digital.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/images/hackrf_blockdiagram-digital.png -------------------------------------------------------------------------------- /doc/wiki/images/hackrf_blockdiagram-frontend_baseband.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/doc/wiki/images/hackrf_blockdiagram-frontend_baseband.png -------------------------------------------------------------------------------- /firmware/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin 2 | *.d 3 | *.elf 4 | *.hex 5 | *.list 6 | *.map 7 | *.o 8 | *.srec 9 | *.dfu 10 | -------------------------------------------------------------------------------- /firmware/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Jared Boone 2 | # 3 | # This file is part of HackRF. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2, or (at your option) 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | # 20 | 21 | # Top directory CMake project for HackRF firmware 22 | 23 | cmake_minimum_required(VERSION 3.1.3) 24 | set(CMAKE_TOOLCHAIN_FILE toolchain-arm-cortex-m.cmake) 25 | 26 | project (hackrf_firmware_all C) 27 | 28 | add_subdirectory(blinky) 29 | add_subdirectory(hackrf_usb) 30 | -------------------------------------------------------------------------------- /firmware/README: -------------------------------------------------------------------------------- 1 | The primary firmware source code for USB HackRF devices is hackrf_usb. Most of 2 | the other directories contain firmware source code for test and development. 3 | The common directory contains source code shared by multiple HackRF firmware 4 | projects. The cpld directory contains HDL source for the CPLD. 5 | 6 | 7 | The firmware is set up for compilation with the GCC toolchain available here: 8 | 9 | https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads 10 | 11 | Required dependency: 12 | 13 | https://github.com/mossmann/libopencm3 14 | 15 | If you are using git, the preferred way to install libopencm3 is to use the 16 | submodule: 17 | 18 | $ cd .. 19 | $ git submodule init 20 | $ git submodule update 21 | 22 | To build and install a standard firmware image for HackRF One: 23 | 24 | $ cd hackrf_usb 25 | $ mkdir build 26 | $ cd build 27 | $ cmake .. 28 | $ make 29 | $ hackrf_spiflash -w hackrf_usb.bin 30 | 31 | If you have a Jawbreaker, add -DBOARD=JAWBREAKER to the cmake command. 32 | If you have a rad1o, use -DBOARD=RAD1O instead. 33 | 34 | It is possible to use a USB Device Firmware Upgrade (DFU) method to load 35 | firmware into RAM. This is normally only required to recover a device that has 36 | had faulty firmware loaded, but it can also be useful for firmware developers. 37 | 38 | For loading firmware into RAM with DFU you will need: 39 | 40 | http://dfu-util.sourceforge.net/ 41 | 42 | To start up HackRF One in DFU mode, hold down the DFU button while powering it 43 | on or while pressing and releasing the RESET button. Release the DFU button 44 | after the 3V3 LED illuminates. 45 | 46 | A .dfu file is built by default when building firmware. Alternatively you can 47 | use a known good .dfu file from a release package. Load the firmware into RAM 48 | with: 49 | 50 | $ dfu-util --device 1fc9:000c --alt 0 --download hackrf_usb.dfu 51 | -------------------------------------------------------------------------------- /firmware/appveyor.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | /usr/bin/env python -m ensurepip 4 | /usr/bin/env python -m pip install pyyaml 5 | 6 | cd firmware/libopencm3 7 | export SRCLIBDIR='c:\projects\hackrf\firmware\libopencm3\lib\' 8 | make lib/lpc43xx/m0 9 | make lib/lpc43xx/m4 10 | cd .. 11 | mkdir build-hackrf-one 12 | cd build-hackrf-one 13 | cmake -G "Unix Makefiles" .. 14 | make VERBOSE=1 15 | -------------------------------------------------------------------------------- /firmware/blinky/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Michael Ossmann 2 | # Copyright 2012 Jared Boone 3 | # 4 | # This file is part of HackRF. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | cmake_minimum_required(VERSION 3.1.3) 23 | set(CMAKE_TOOLCHAIN_FILE ../toolchain-arm-cortex-m.cmake) 24 | 25 | project(blinky C) 26 | 27 | include(../hackrf-common.cmake) 28 | 29 | set(SRC_M4 30 | blinky.c 31 | ) 32 | 33 | DeclareTargets() 34 | -------------------------------------------------------------------------------- /firmware/blinky/README: -------------------------------------------------------------------------------- 1 | This is the simplest example firmware for HackRF. It flashes three LEDs. 2 | -------------------------------------------------------------------------------- /firmware/blinky/blinky.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2010 - 2012 Michael Ossmann 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "hackrf_core.h" 23 | 24 | int main(void) 25 | { 26 | pin_setup(); 27 | 28 | /* enable all power supplies */ 29 | enable_1v8_power(); 30 | 31 | /* Blink LED1/2/3 on the board. */ 32 | while (1) 33 | { 34 | led_on(LED1); 35 | led_on(LED2); 36 | led_on(LED3); 37 | 38 | delay(2000000); 39 | 40 | led_off(LED1); 41 | led_off(LED2); 42 | led_off(LED3); 43 | 44 | delay(2000000); 45 | } 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /firmware/common/LPC4320_M4_memory.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | /* Linker script for HackRF One (LPC4320, 1M SPI flash, 200K SRAM). */ 24 | 25 | MEMORY 26 | { 27 | /* rom is really the shadow region that points to SPI flash or elsewhere */ 28 | rom (rx) : ORIGIN = 0x00000000, LENGTH = 96K 29 | ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 96K 30 | ram_local2 (rwx) : ORIGIN = 0x10080000, LENGTH = 32K 31 | ram_sleep (rwx) : ORIGIN = 0x10088000, LENGTH = 8K 32 | } 33 | 34 | INCLUDE LPC43xx_M4_memory.ld 35 | -------------------------------------------------------------------------------- /firmware/common/LPC4330_M4_memory.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | /* Linker script for Rad1o badge - (LPC4330, 1M SPI flash, 264K SRAM). */ 24 | 25 | MEMORY 26 | { 27 | /* rom is really the shadow region that points to SPI flash or elsewhere */ 28 | rom (rx) : ORIGIN = 0x00000000, LENGTH = 128K 29 | ram_local1 (rwx) : ORIGIN = 0x10000000, LENGTH = 128K 30 | ram_local2 (rwx) : ORIGIN = 0x10080000, LENGTH = 64K 31 | ram_sleep (rwx) : ORIGIN = 0x10090000, LENGTH = 8K 32 | } 33 | 34 | INCLUDE LPC43xx_M4_memory.ld 35 | -------------------------------------------------------------------------------- /firmware/common/LPC43xx_M0_memory.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | MEMORY 24 | { 25 | ram (rwx) : ORIGIN = 0x00000000, LENGTH = 28K 26 | } 27 | -------------------------------------------------------------------------------- /firmware/common/LPC43xx_M4_M0_image_from_text.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | SECTIONS 24 | { 25 | .text : { 26 | PROVIDE(__m0_start__ = .); 27 | KEEP(*(.m0_bin*)); 28 | . = ALIGN(4); 29 | PROVIDE(__m0_end__ = .); 30 | } >rom 31 | } 32 | -------------------------------------------------------------------------------- /firmware/common/LPC43xx_M4_memory.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | MEMORY 24 | { 25 | /* Physical address in Flash used to copy Code from Flash to RAM */ 26 | rom_flash (rx) : ORIGIN = 0x80000000, LENGTH = 1M 27 | ram_m0 (rwx) : ORIGIN = 0x20000000, LENGTH = 28K 28 | ram_shared (rwx) : ORIGIN = 0x20007000, LENGTH = 4K 29 | ram_usb (rwx) : ORIGIN = 0x20008000, LENGTH = 32K 30 | /* ram_usb: USB buffer. Straddles two blocks of RAM 31 | * to get performance benefit of having two USB buffers addressable 32 | * simultaneously (on two different buses of the AHB multilayer matrix) 33 | */ 34 | } 35 | 36 | usb_bulk_buffer = ORIGIN(ram_usb); 37 | usb_bulk_buffer_offset = ORIGIN(ram_shared); 38 | usb_bulk_buffer_tx = ORIGIN(ram_shared)+4; 39 | PROVIDE(__ram_m0_start__ = ORIGIN(ram_m0)); 40 | -------------------------------------------------------------------------------- /firmware/common/README: -------------------------------------------------------------------------------- 1 | This directory contains things shared by multiple HackRF firmware 2 | implementations. 3 | -------------------------------------------------------------------------------- /firmware/common/bitband.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "bitband.h" 23 | 24 | volatile uint32_t* peripheral_bitband_address(volatile void* const address, const uint_fast8_t bit_number) { 25 | const uint32_t bit_band_base = 0x42000000; 26 | const uint32_t byte_offset = (uint32_t)address - 0x40000000; 27 | const uint32_t bit_word_offset = (byte_offset * 32) + (bit_number * 4); 28 | const uint32_t bit_word_address = bit_band_base + bit_word_offset; 29 | return (volatile uint32_t*)bit_word_address; 30 | } 31 | 32 | void peripheral_bitband_set(volatile void* const peripheral_address, const uint_fast8_t bit_number) { 33 | volatile uint32_t* const bitband_address = peripheral_bitband_address(peripheral_address, bit_number); 34 | *bitband_address = 1; 35 | } 36 | 37 | void peripheral_bitband_clear(volatile void* const peripheral_address, const uint_fast8_t bit_number) { 38 | volatile uint32_t* const bitband_address = peripheral_bitband_address(peripheral_address, bit_number); 39 | *bitband_address = 0; 40 | } 41 | 42 | uint32_t peripheral_bitband_get(volatile void* const peripheral_address, const uint_fast8_t bit_number) { 43 | volatile uint32_t* const bitband_address = peripheral_bitband_address(peripheral_address, bit_number); 44 | return *bitband_address; 45 | } 46 | -------------------------------------------------------------------------------- /firmware/common/bitband.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __BITBAND_H__ 23 | #define __BITBAND_H__ 24 | 25 | #include 26 | 27 | volatile uint32_t* peripheral_bitband_address(volatile void* const address, const uint_fast8_t bit_number); 28 | void peripheral_bitband_set(volatile void* const peripheral_address, const uint_fast8_t bit_number); 29 | void peripheral_bitband_clear(volatile void* const peripheral_address, const uint_fast8_t bit_number); 30 | uint32_t peripheral_bitband_get(volatile void* const peripheral_address, const uint_fast8_t bit_number); 31 | 32 | #endif//__BITBAND_H__ 33 | -------------------------------------------------------------------------------- /firmware/common/clock_conv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Tomaz Solc 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; see the file COPYING. If not, write to 16 | * the Free Software Foundation, Inc., 51 Franklin Street, 17 | * Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __CLOCKCONV_H__ 21 | #define __CLOCKCONV_H__ 22 | 23 | #include 24 | 25 | #include "gpio.h" 26 | 27 | typedef enum { 28 | CLOCK_CONV_FILTER_1200_MHZ = 0, 29 | CLOCK_CONV_FILTER_500_MHZ = 1, 30 | CLOCK_CONV_FILTER_160_MHZ = 2, 31 | CLOCK_CONV_FILTER_50_MHZ = 3, 32 | } clock_conv_filter_t; 33 | 34 | typedef struct clock_conv_t { 35 | gpio_t gpio_sd1; 36 | gpio_t gpio_sd2; 37 | gpio_t gpio_filta; 38 | gpio_t gpio_filtb; 39 | } clock_conv_t; 40 | 41 | void clock_conv_pin_setup(clock_conv_t* const clock_conv); 42 | 43 | void clock_conv_set_filter(clock_conv_t* const clock_conv, clock_conv_filter_t filter); 44 | void clock_conv_set_clkin(clock_conv_t* const clock_conv, const uint_fast8_t enable); 45 | void clock_conv_set_aux(clock_conv_t* const clock_conv, const uint_fast8_t enable); 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /firmware/common/cpld_jtag.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Michael Ossmann 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __CPLD_JTAG_H__ 23 | #define __CPLD_JTAG_H__ 24 | 25 | #include 26 | 27 | #include "gpio.h" 28 | 29 | typedef struct jtag_gpio_t { 30 | gpio_t gpio_tms; 31 | gpio_t gpio_tck; 32 | gpio_t gpio_tdi; 33 | gpio_t gpio_tdo; 34 | #ifdef HACKRF_ONE 35 | gpio_t gpio_pp_tms; 36 | gpio_t gpio_pp_tdo; 37 | #endif 38 | } jtag_gpio_t; 39 | 40 | typedef struct jtag_t { 41 | jtag_gpio_t* const gpio; 42 | } jtag_t; 43 | 44 | typedef void (*refill_buffer_cb)(void); 45 | 46 | void cpld_jtag_take(jtag_t* const jtag); 47 | void cpld_jtag_release(jtag_t* const jtag); 48 | 49 | /* Return 0 if success else return error code see xsvfExecute() see micro.h. 50 | * 51 | * We expect the buffer to be initially full of data. After the entire 52 | * contents of the buffer has been streamed to the CPLD the given 53 | * refill_buffer callback will be called. */ 54 | int cpld_jtag_program( 55 | jtag_t* const jtag, 56 | const uint32_t buffer_length, 57 | unsigned char* const buffer, 58 | refill_buffer_cb refill 59 | ); 60 | unsigned char cpld_jtag_get_next_byte(void); 61 | 62 | #endif//__CPLD_JTAG_H__ 63 | -------------------------------------------------------------------------------- /firmware/common/cpld_xc2c.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __CPLD_XC2C_H__ 23 | #define __CPLD_XC2C_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "cpld_jtag.h" 29 | 30 | /* Xilinx CoolRunner II XC2C64A bitstream attributes */ 31 | #define CPLD_XC2C64A_ROWS (98) 32 | #define CPLD_XC2C64A_BITS_IN_ROW (274) 33 | #define CPLD_XC2C64A_BYTES_IN_ROW ((CPLD_XC2C64A_BITS_IN_ROW + 7) / 8) 34 | 35 | typedef struct { 36 | uint8_t data[CPLD_XC2C64A_BYTES_IN_ROW]; 37 | } cpld_xc2c64a_row_data_t; 38 | 39 | typedef struct { 40 | cpld_xc2c64a_row_data_t row[CPLD_XC2C64A_ROWS]; 41 | } cpld_xc2c64a_program_t; 42 | 43 | typedef struct { 44 | uint8_t value[CPLD_XC2C64A_BYTES_IN_ROW]; 45 | } cpld_xc2c64a_row_mask_t; 46 | 47 | typedef struct { 48 | cpld_xc2c64a_row_mask_t mask[6]; 49 | uint8_t mask_index[CPLD_XC2C64A_ROWS]; 50 | } cpld_xc2c64a_verify_t; 51 | 52 | typedef struct { 53 | uint8_t address[CPLD_XC2C64A_ROWS]; 54 | } cpld_xc2c64a_row_addresses_t; 55 | 56 | bool cpld_xc2c64a_jtag_checksum( 57 | const jtag_t* const jtag, 58 | const cpld_xc2c64a_verify_t* const verify, 59 | uint32_t* const crc_value 60 | ); 61 | void cpld_xc2c64a_jtag_sram_write( 62 | const jtag_t* const jtag, 63 | const cpld_xc2c64a_program_t* const program 64 | ); 65 | bool cpld_xc2c64a_jtag_sram_verify( 66 | const jtag_t* const jtag, 67 | const cpld_xc2c64a_program_t* const program, 68 | const cpld_xc2c64a_verify_t* const verify 69 | ); 70 | 71 | extern const cpld_xc2c64a_program_t cpld_hackrf_program_sram; 72 | extern const cpld_xc2c64a_verify_t cpld_hackrf_verify; 73 | extern const cpld_xc2c64a_row_addresses_t cpld_hackrf_row_addresses; 74 | 75 | #endif/*__CPLD_XC2C_H__*/ 76 | -------------------------------------------------------------------------------- /firmware/common/crc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "crc.h" 23 | 24 | #include 25 | 26 | void crc32_init(crc32_t* const crc) { 27 | crc->remainder = 0xffffffff; 28 | crc->reversed_polynomial = 0xedb88320; 29 | crc->final_xor = 0xffffffff; 30 | } 31 | 32 | void crc32_update(crc32_t* const crc, const uint8_t* const data, const size_t byte_count) { 33 | uint32_t remainder = crc->remainder; 34 | const size_t bit_count = byte_count * 8; 35 | for(size_t bit_n=0; bit_n> 3] & (1 << (bit_n & 7)); 37 | remainder ^= (bit_in ? 1 : 0); 38 | const bool bit_out = (remainder & 1); 39 | remainder >>= 1; 40 | if( bit_out ) { 41 | remainder ^= crc->reversed_polynomial; 42 | } 43 | } 44 | crc->remainder = remainder; 45 | } 46 | 47 | uint32_t crc32_digest(const crc32_t* const crc) { 48 | return crc->remainder ^ crc->final_xor; 49 | } 50 | -------------------------------------------------------------------------------- /firmware/common/crc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __CRC_H__ 23 | #define __CRC_H__ 24 | 25 | #include 26 | #include 27 | 28 | typedef struct { 29 | uint32_t remainder; 30 | uint32_t reversed_polynomial; 31 | uint32_t final_xor; 32 | } crc32_t; 33 | 34 | void crc32_init(crc32_t* const crc); 35 | void crc32_update(crc32_t* const crc, const uint8_t* const data, const size_t byte_count); 36 | uint32_t crc32_digest(const crc32_t* const crc); 37 | 38 | #endif//__CRC_H__ 39 | -------------------------------------------------------------------------------- /firmware/common/fault_handler.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include 24 | 25 | #include "fault_handler.h" 26 | 27 | typedef struct 28 | { 29 | uint32_t r0; 30 | uint32_t r1; 31 | uint32_t r2; 32 | uint32_t r3; 33 | uint32_t r12; 34 | uint32_t lr; /* Link Register. */ 35 | uint32_t pc; /* Program Counter. */ 36 | uint32_t psr;/* Program Status Register. */ 37 | } hard_fault_stack_t; 38 | 39 | __attribute__((naked)) 40 | void hard_fault_handler(void) { 41 | __asm__("TST LR, #4"); 42 | __asm__("ITE EQ"); 43 | __asm__("MRSEQ R0, MSP"); 44 | __asm__("MRSNE R0, PSP"); 45 | __asm__("B hard_fault_handler_c"); 46 | } 47 | 48 | volatile hard_fault_stack_t* hard_fault_stack_pt; 49 | 50 | __attribute__((used)) void hard_fault_handler_c(uint32_t* args) 51 | { 52 | /* hard_fault_stack_pt contains registers saved before the hard fault */ 53 | hard_fault_stack_pt = (hard_fault_stack_t*)args; 54 | 55 | // args[0-7]: r0, r1, r2, r3, r12, lr, pc, psr 56 | // Other interesting registers to examine: 57 | // CFSR: Configurable Fault Status Register 58 | // HFSR: Hard Fault Status Register 59 | // DFSR: Debug Fault Status Register 60 | // AFSR: Auxiliary Fault Status Register 61 | // MMAR: MemManage Fault Address Register 62 | // BFAR: Bus Fault Address Register 63 | 64 | /* 65 | if( SCB->HFSR & SCB_HFSR_FORCED ) { 66 | if( SCB->CFSR & SCB_CFSR_BFSR_BFARVALID ) { 67 | SCB->BFAR; 68 | if( SCB->CFSR & CSCB_CFSR_BFSR_PRECISERR ) { 69 | } 70 | } 71 | } 72 | */ 73 | while(1); 74 | } 75 | 76 | void mem_manage_handler() { 77 | while(1); 78 | } 79 | 80 | void bus_fault_handler() { 81 | while(1); 82 | } 83 | 84 | void usage_fault_handler() { 85 | while(1); 86 | } 87 | -------------------------------------------------------------------------------- /firmware/common/fault_handler.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __FAULT_HANDLER__ 23 | #define __FAULT_HANDLER__ 24 | 25 | #include 26 | 27 | #include 28 | 29 | // TODO: Move all this to a Cortex-M(?) include file, since these 30 | // structures are supposedly the same between processors (to an 31 | // undetermined extent). 32 | typedef struct armv7m_scb_t armv7m_scb_t; 33 | struct armv7m_scb_t { 34 | volatile const uint32_t CPUID; 35 | volatile uint32_t ICSR; 36 | volatile uint32_t VTOR; 37 | volatile uint32_t AIRCR; 38 | volatile uint32_t SCR; 39 | volatile uint32_t CCR; 40 | volatile uint32_t SHPR1; 41 | volatile uint32_t SHPR2; 42 | volatile uint32_t SHPR3; 43 | volatile uint32_t SHCSR; 44 | volatile uint32_t CFSR; 45 | volatile uint32_t HFSR; 46 | volatile uint32_t DFSR; 47 | volatile uint32_t MMFAR; 48 | volatile uint32_t BFAR; 49 | volatile uint32_t AFSR; 50 | volatile const uint32_t ID_PFR0; 51 | volatile const uint32_t ID_PFR1; 52 | volatile const uint32_t ID_DFR0; 53 | volatile const uint32_t ID_AFR0; 54 | volatile const uint32_t ID_MMFR0; 55 | volatile const uint32_t ID_MMFR1; 56 | volatile const uint32_t ID_MMFR2; 57 | volatile const uint32_t ID_MMFR3; 58 | volatile const uint32_t ID_ISAR0; 59 | volatile const uint32_t ID_ISAR1; 60 | volatile const uint32_t ID_ISAR2; 61 | volatile const uint32_t ID_ISAR3; 62 | volatile const uint32_t ID_ISAR4; 63 | volatile const uint32_t __reserved_0x74_0x87[5]; 64 | volatile uint32_t CPACR; 65 | } __attribute__((packed)); 66 | 67 | static armv7m_scb_t* const SCB = (armv7m_scb_t*)SCB_BASE; 68 | 69 | #define SCB_HFSR_DEBUGEVT (1 << 31) 70 | #define SCB_HFSR_FORCED (1 << 30) 71 | #define SCB_HFSR_VECTTBL (1 << 1) 72 | 73 | #endif//__FAULT_HANDLER__ 74 | -------------------------------------------------------------------------------- /firmware/common/gpdma.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | 26 | void gpdma_controller_enable() { 27 | GPDMA_CONFIG |= GPDMA_CONFIG_E(1); 28 | while( (GPDMA_CONFIG & GPDMA_CONFIG_E_MASK) == 0 ); 29 | } 30 | 31 | void gpdma_channel_enable(const uint_fast8_t channel) { 32 | GPDMA_CCONFIG(channel) |= GPDMA_CCONFIG_E(1); 33 | } 34 | 35 | void gpdma_channel_disable(const uint_fast8_t channel) { 36 | GPDMA_CCONFIG(channel) &= ~GPDMA_CCONFIG_E_MASK; 37 | while( (GPDMA_ENBLDCHNS & GPDMA_ENBLDCHNS_ENABLEDCHANNELS(1 << channel)) ); 38 | } 39 | 40 | void gpdma_channel_interrupt_tc_clear(const uint_fast8_t channel) { 41 | GPDMA_INTTCCLEAR = GPDMA_INTTCCLEAR_INTTCCLEAR(1 << channel); 42 | } 43 | 44 | void gpdma_channel_interrupt_error_clear(const uint_fast8_t channel) { 45 | GPDMA_INTERRCLR = GPDMA_INTERRCLR_INTERRCLR(1 << channel); 46 | } 47 | 48 | void gpdma_lli_enable_interrupt(gpdma_lli_t* const lli) { 49 | lli->ccontrol |= GPDMA_CCONTROL_I(1); 50 | } 51 | 52 | void gpdma_lli_create_loop(gpdma_lli_t* const lli, const size_t lli_count) { 53 | for(size_t i=0; i> 2); 56 | } 57 | } 58 | 59 | void gpdma_lli_create_oneshot(gpdma_lli_t* const lli, const size_t lli_count) { 60 | gpdma_lli_create_loop(lli, lli_count); 61 | lli[lli_count - 1].clli &= ~GPDMA_CLLI_LLI_MASK; 62 | } 63 | -------------------------------------------------------------------------------- /firmware/common/gpdma.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __GPDMA_H__ 23 | #define __GPDMA_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | void gpdma_controller_enable(); 31 | 32 | void gpdma_channel_enable(const uint_fast8_t channel); 33 | void gpdma_channel_disable(const uint_fast8_t channel); 34 | 35 | void gpdma_channel_interrupt_tc_clear(const uint_fast8_t channel); 36 | void gpdma_channel_interrupt_error_clear(const uint_fast8_t channel); 37 | 38 | void gpdma_lli_enable_interrupt(gpdma_lli_t* const lli); 39 | 40 | void gpdma_lli_create_loop(gpdma_lli_t* const lli, const size_t lli_count); 41 | void gpdma_lli_create_oneshot(gpdma_lli_t* const lli, const size_t lli_count); 42 | 43 | #endif/*__GPDMA_H__*/ 44 | -------------------------------------------------------------------------------- /firmware/common/gpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __GPIO_H__ 23 | #define __GPIO_H__ 24 | 25 | #include 26 | 27 | typedef const struct gpio_t* gpio_t; 28 | 29 | void gpio_init(); 30 | void gpio_set(gpio_t gpio); 31 | void gpio_clear(gpio_t gpio); 32 | void gpio_toggle(gpio_t gpio); 33 | void gpio_output(gpio_t gpio); 34 | void gpio_input(gpio_t gpio); 35 | void gpio_write(gpio_t gpio, const bool value); 36 | bool gpio_read(gpio_t gpio); 37 | 38 | #endif/*__GPIO_H__*/ 39 | -------------------------------------------------------------------------------- /firmware/common/gpio_lpc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "gpio_lpc.h" 23 | 24 | #include 25 | 26 | void gpio_init() { 27 | for(size_t i=0; i<8; i++) { 28 | GPIO_LPC_PORT(i)->dir = 0; 29 | } 30 | } 31 | 32 | void gpio_set(gpio_t gpio) { 33 | gpio->port->set = gpio->mask; 34 | } 35 | 36 | void gpio_clear(gpio_t gpio) { 37 | gpio->port->clr = gpio->mask; 38 | } 39 | 40 | void gpio_toggle(gpio_t gpio) { 41 | gpio->port->not = gpio->mask; 42 | } 43 | 44 | void gpio_output(gpio_t gpio) { 45 | gpio->port->dir |= gpio->mask; 46 | } 47 | 48 | void gpio_input(gpio_t gpio) { 49 | gpio->port->dir &= ~gpio->mask; 50 | } 51 | 52 | void gpio_write(gpio_t gpio, const bool value) { 53 | *gpio->gpio_w = value; 54 | } 55 | 56 | bool gpio_read(gpio_t gpio) { 57 | return *gpio->gpio_w; 58 | } 59 | -------------------------------------------------------------------------------- /firmware/common/gpio_lpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __GPIO_LPC_H__ 23 | #define __GPIO_LPC_H__ 24 | 25 | #include 26 | 27 | #include "gpio.h" 28 | 29 | /* NOTE: libopencm3 constants and functions not used here due to naming 30 | * conflicts. I'd recommend changes to libopencm3 design to separate 31 | * register #defines and API declarations into separate header files. 32 | */ 33 | 34 | typedef struct gpio_port_t { 35 | volatile uint32_t dir; /* +0x000 */ 36 | uint32_t _reserved0[31]; 37 | volatile uint32_t mask; /* +0x080 */ 38 | uint32_t _reserved1[31]; 39 | volatile uint32_t pin; /* +0x100 */ 40 | uint32_t _reserved2[31]; 41 | volatile uint32_t mpin; /* +0x180 */ 42 | uint32_t _reserved3[31]; 43 | volatile uint32_t set; /* +0x200 */ 44 | uint32_t _reserved4[31]; 45 | volatile uint32_t clr; /* +0x280 */ 46 | uint32_t _reserved5[31]; 47 | volatile uint32_t not; /* +0x300 */ 48 | } gpio_port_t; 49 | 50 | struct gpio_t { 51 | const uint32_t mask; 52 | gpio_port_t* const port; 53 | volatile uint32_t* const gpio_w; 54 | }; 55 | 56 | #define GPIO_LPC_BASE (0x400f4000) 57 | #define GPIO_LPC_B_OFFSET (0x0) 58 | #define GPIO_LPC_W_OFFSET (0x1000) 59 | #define GPIO_LPC_PORT_OFFSET (0x2000) 60 | 61 | #define GPIO_LPC_PORT(_n) ((gpio_port_t*)((GPIO_LPC_BASE + GPIO_LPC_PORT_OFFSET) + (_n) * 4)) 62 | #define GPIO_LPC_W(_port_num, _pin_num) (volatile uint32_t*)((GPIO_LPC_BASE + GPIO_LPC_W_OFFSET) + ((_port_num) * 0x80) + ((_pin_num) * 4)) 63 | 64 | #define GPIO(_port_num, _pin_num) { \ 65 | .mask = (1UL << (_pin_num)), \ 66 | .port = GPIO_LPC_PORT(_port_num), \ 67 | .gpio_w = GPIO_LPC_W(_port_num, _pin_num), \ 68 | } 69 | 70 | #endif/*__GPIO_LPC_H__*/ 71 | -------------------------------------------------------------------------------- /firmware/common/i2c_bus.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "i2c_bus.h" 23 | 24 | void i2c_bus_start(i2c_bus_t* const bus, const void* const config) { 25 | bus->start(bus, config); 26 | } 27 | 28 | void i2c_bus_stop(i2c_bus_t* const bus) { 29 | bus->stop(bus); 30 | } 31 | 32 | void i2c_bus_transfer( 33 | i2c_bus_t* const bus, 34 | const uint_fast8_t peripheral_address, 35 | const uint8_t* const tx, const size_t tx_count, 36 | uint8_t* const rx, const size_t rx_count 37 | ) { 38 | bus->transfer(bus, peripheral_address, tx, tx_count, rx, rx_count); 39 | } 40 | -------------------------------------------------------------------------------- /firmware/common/i2c_bus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __I2C_BUS_H__ 23 | #define __I2C_BUS_H__ 24 | 25 | #include 26 | #include 27 | 28 | struct i2c_bus_t; 29 | typedef struct i2c_bus_t i2c_bus_t; 30 | 31 | struct i2c_bus_t { 32 | void* const obj; 33 | void (*start)(i2c_bus_t* const bus, const void* const config); 34 | void (*stop)(i2c_bus_t* const bus); 35 | void (*transfer)( 36 | i2c_bus_t* const bus, 37 | const uint_fast8_t peripheral_address, 38 | const uint8_t* const tx, const size_t tx_count, 39 | uint8_t* const rx, const size_t rx_count 40 | ); 41 | }; 42 | 43 | void i2c_bus_start(i2c_bus_t* const bus, const void* const config); 44 | void i2c_bus_stop(i2c_bus_t* const bus); 45 | void i2c_bus_transfer( 46 | i2c_bus_t* const bus, 47 | const uint_fast8_t peripheral_address, 48 | const uint8_t* const tx, const size_t tx_count, 49 | uint8_t* const rx, const size_t rx_count 50 | ); 51 | 52 | #endif/*__I2C_BUS_H__*/ 53 | -------------------------------------------------------------------------------- /firmware/common/i2c_lpc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2012 Jared Boone 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "i2c_lpc.h" 24 | 25 | #include 26 | 27 | /* FIXME return i2c0 status from each function */ 28 | 29 | void i2c_lpc_start(i2c_bus_t* const bus, const void* const _config) { 30 | const i2c_lpc_config_t* const config = _config; 31 | 32 | const uint32_t port = (uint32_t)bus->obj; 33 | i2c_init(port, config->duty_cycle_count); 34 | } 35 | 36 | void i2c_lpc_stop(i2c_bus_t* const bus) { 37 | const uint32_t port = (uint32_t)bus->obj; 38 | i2c_disable(port); 39 | } 40 | 41 | void i2c_lpc_transfer(i2c_bus_t* const bus, 42 | const uint_fast8_t peripheral_address, 43 | const uint8_t* const data_tx, const size_t count_tx, 44 | uint8_t* const data_rx, const size_t count_rx 45 | ) { 46 | const uint32_t port = (uint32_t)bus->obj; 47 | size_t i; 48 | bool ack = false; 49 | if (data_tx && (count_tx > 0)) { 50 | i2c_tx_start(port); 51 | i2c_tx_byte(port, (peripheral_address << 1) | I2C_WRITE); 52 | for(i=0; i 0)) { 58 | i2c_tx_start(port); 59 | i2c_tx_byte(port, (peripheral_address << 1) | I2C_READ); 60 | for(i=0; iobj; 72 | 73 | i2c_tx_start(port); 74 | i2c_tx_byte(port, (device_address << 1) | I2C_WRITE); 75 | const bool detected = (I2C_STAT(port) == 0x18); 76 | i2c_stop(port); 77 | 78 | return detected; 79 | } 80 | -------------------------------------------------------------------------------- /firmware/common/i2c_lpc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __I2C_LPC_H__ 23 | #define __I2C_LPC_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include "i2c_bus.h" 30 | 31 | typedef struct i2c_lpc_config_t { 32 | const uint16_t duty_cycle_count; 33 | } i2c_lpc_config_t; 34 | 35 | void i2c_lpc_start(i2c_bus_t* const bus, const void* const config); 36 | void i2c_lpc_stop(i2c_bus_t* const bus); 37 | void i2c_lpc_transfer(i2c_bus_t* const bus, 38 | const uint_fast8_t peripheral_address, 39 | const uint8_t* const data_tx, const size_t count_tx, 40 | uint8_t* const data_rx, const size_t count_rx 41 | ); 42 | bool i2c_probe(i2c_bus_t* const bus, const uint_fast8_t device_address); 43 | 44 | #endif/*__I2C_LPC_H__*/ 45 | -------------------------------------------------------------------------------- /firmware/common/m0_bin.s.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2013 Jared Boone 2 | # 3 | # This file is part of HackRF. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2, or (at your option) 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | 20 | .data 21 | .section .m0_bin, "ax" 22 | 23 | .incbin "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}_m0.bin" 24 | -------------------------------------------------------------------------------- /firmware/common/m0_sleep.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | int main() { 23 | while(1) { 24 | 25 | } 26 | } -------------------------------------------------------------------------------- /firmware/common/max2837_target.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Will Code? (TODO: Proper attribution) 3 | * Copyright 2014 Jared Boone 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __MAX2837_TARGET_H 24 | #define __MAX2837_TARGET_H 25 | 26 | #include "max2837.h" 27 | 28 | void max2837_target_init(max2837_driver_t* const drv); 29 | void max2837_target_set_mode(max2837_driver_t* const drv, const max2837_mode_t new_mode); 30 | 31 | #endif // __MAX2837_TARGET_H 32 | -------------------------------------------------------------------------------- /firmware/common/max2871.h: -------------------------------------------------------------------------------- 1 | #ifndef MAX2871_H 2 | #define MAX2871_H 3 | 4 | #include "gpio.h" 5 | 6 | #include 7 | 8 | typedef struct { 9 | gpio_t gpio_vco_ce; 10 | gpio_t gpio_vco_sclk; 11 | gpio_t gpio_vco_sdata; 12 | gpio_t gpio_vco_le; 13 | gpio_t gpio_synt_rfout_en; 14 | gpio_t gpio_vco_mux; 15 | } max2871_driver_t; 16 | 17 | extern void max2871_setup(max2871_driver_t* const drv); 18 | extern uint64_t max2871_set_frequency(max2871_driver_t* const drv, uint16_t mhz); 19 | extern void max2871_enable(max2871_driver_t* const drv); 20 | extern void max2871_disable(max2871_driver_t* const drv); 21 | #endif 22 | -------------------------------------------------------------------------------- /firmware/common/max2871_regs.h: -------------------------------------------------------------------------------- 1 | #ifndef MAX2871_REGS_H 2 | #define MAX2871_REGS_H 3 | #include 4 | 5 | #define MAX2871_VASA (1 << 9) 6 | 7 | void max2871_regs_init(void); 8 | uint32_t max2871_get_register(int reg); 9 | 10 | void max2871_set_INT(uint32_t v); 11 | void max2871_set_N(uint32_t v); 12 | void max2871_set_FRAC(uint32_t v); 13 | void max2871_set_CPL(uint32_t v); 14 | void max2871_set_CPT(uint32_t v); 15 | void max2871_set_P(uint32_t v); 16 | void max2871_set_M(uint32_t v); 17 | void max2871_set_LDS(uint32_t v); 18 | void max2871_set_SDN(uint32_t v); 19 | void max2871_set_MUX(uint32_t v); 20 | void max2871_set_DBR(uint32_t v); 21 | void max2871_set_RDIV2(uint32_t v); 22 | void max2871_set_R(uint32_t v); 23 | void max2871_set_REG4DB(uint32_t v); 24 | void max2871_set_CP(uint32_t v); 25 | void max2871_set_LDF(uint32_t v); 26 | void max2871_set_LDP(uint32_t v); 27 | void max2871_set_PDP(uint32_t v); 28 | void max2871_set_SHDN(uint32_t v); 29 | void max2871_set_TRI(uint32_t v); 30 | void max2871_set_RST(uint32_t v); 31 | void max2871_set_VCO(uint32_t v); 32 | void max2871_set_VAS_SHDN(uint32_t v); 33 | void max2871_set_VAS_TEMP(uint32_t v); 34 | void max2871_set_CSM(uint32_t v); 35 | void max2871_set_MUTEDEL(uint32_t v); 36 | void max2871_set_CDM(uint32_t v); 37 | void max2871_set_CDIV(uint32_t v); 38 | void max2871_set_SDLDO(uint32_t v); 39 | void max2871_set_SDDIV(uint32_t v); 40 | void max2871_set_SDREF(uint32_t v); 41 | void max2871_set_BS(uint32_t v); 42 | void max2871_set_FB(uint32_t v); 43 | void max2871_set_DIVA(uint32_t v); 44 | void max2871_set_SDVCO(uint32_t v); 45 | void max2871_set_MTLD(uint32_t v); 46 | void max2871_set_BDIV(uint32_t v); 47 | void max2871_set_RFB_EN(uint32_t v); 48 | void max2871_set_BPWR(uint32_t v); 49 | void max2871_set_RFA_EN(uint32_t v); 50 | void max2871_set_APWR(uint32_t v); 51 | void max2871_set_SDPLL(uint32_t v); 52 | void max2871_set_F01(uint32_t v); 53 | void max2871_set_LD(uint32_t v); 54 | void max2871_set_ADCS(uint32_t v); 55 | void max2871_set_ADCM(uint32_t v); 56 | #endif 57 | -------------------------------------------------------------------------------- /firmware/common/max5864.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MAX5864_H 23 | #define __MAX5864_H 24 | 25 | #include "spi_bus.h" 26 | 27 | struct max5864_driver_t; 28 | typedef struct max5864_driver_t max5864_driver_t; 29 | 30 | struct max5864_driver_t { 31 | spi_bus_t* const bus; 32 | void (*target_init)(max5864_driver_t* const drv); 33 | }; 34 | 35 | void max5864_setup(max5864_driver_t* const drv); 36 | 37 | void max5864_shutdown(max5864_driver_t* const drv); 38 | void max5864_standby(max5864_driver_t* const drv); 39 | void max5864_idle(max5864_driver_t* const drv); 40 | void max5864_rx(max5864_driver_t* const drv); 41 | void max5864_tx(max5864_driver_t* const drv); 42 | void max5864_xcvr(max5864_driver_t* const drv); 43 | 44 | #endif // __MAX5864_H 45 | -------------------------------------------------------------------------------- /firmware/common/max5864_target.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "max5864_target.h" 23 | 24 | #include 25 | #include "hackrf_core.h" 26 | 27 | void max5864_target_init(max5864_driver_t* const drv) { 28 | (void)drv; 29 | 30 | /* Configure SSP1 Peripheral (to be moved later in SSP driver) */ 31 | scu_pinmux(SCU_SSP1_CIPO, (SCU_SSP_IO | SCU_CONF_FUNCTION5)); 32 | scu_pinmux(SCU_SSP1_COPI, (SCU_SSP_IO | SCU_CONF_FUNCTION5)); 33 | scu_pinmux(SCU_SSP1_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION1)); 34 | 35 | /* 36 | * Configure CS_AD pin to keep the MAX5864 SPI disabled while we use the 37 | * SPI bus for the MAX2837. FIXME: this should probably be somewhere else. 38 | */ 39 | scu_pinmux(SCU_AD_CS, SCU_GPIO_FAST); 40 | } 41 | -------------------------------------------------------------------------------- /firmware/common/max5864_target.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __MAX5864_TARGET_H__ 23 | #define __MAX5864_TARGET_H__ 24 | 25 | #include "max5864.h" 26 | 27 | void max5864_target_init(max5864_driver_t* const drv); 28 | 29 | #endif/*__MAX5864_TARGET_H__*/ 30 | -------------------------------------------------------------------------------- /firmware/common/mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2014 Jared Boone 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __MIXER_H 24 | #define __MIXER_H 25 | 26 | #if (defined JAWBREAKER || defined HACKRF_ONE) 27 | #include "rffc5071.h" 28 | typedef rffc5071_driver_t mixer_driver_t; 29 | #endif 30 | 31 | #ifdef RAD1O 32 | #include "max2871.h" 33 | typedef max2871_driver_t mixer_driver_t; 34 | #endif 35 | 36 | #include 37 | extern void mixer_bus_setup(mixer_driver_t* const mixer); 38 | extern void mixer_setup(mixer_driver_t* const mixer); 39 | 40 | /* Set frequency (MHz). */ 41 | extern uint64_t mixer_set_frequency(mixer_driver_t* const mixer, uint16_t mhz); 42 | 43 | /* Set up rx only, tx only, or full duplex. Chip should be disabled 44 | * before _tx, _rx, or _rxtx are called. */ 45 | extern void mixer_tx(mixer_driver_t* const mixer); 46 | extern void mixer_rx(mixer_driver_t* const mixer); 47 | extern void mixer_rxtx(mixer_driver_t* const mixer); 48 | extern void mixer_enable(mixer_driver_t* const mixer); 49 | extern void mixer_disable(mixer_driver_t* const mixer); 50 | extern void mixer_set_gpo(mixer_driver_t* const drv, uint8_t gpo); 51 | 52 | #endif // __MIXER_H 53 | -------------------------------------------------------------------------------- /firmware/common/operacake.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Dominic Spill 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __OPERACAKE_H 23 | #define __OPERACAKE_H 24 | 25 | #ifdef __cplusplus 26 | extern "C" 27 | { 28 | #endif 29 | 30 | #include 31 | #include 32 | 33 | #define OPERACAKE_PA1 0 34 | #define OPERACAKE_PA2 1 35 | #define OPERACAKE_PA3 2 36 | #define OPERACAKE_PA4 3 37 | 38 | #define OPERACAKE_PB1 4 39 | #define OPERACAKE_PB2 5 40 | #define OPERACAKE_PB3 6 41 | #define OPERACAKE_PB4 7 42 | 43 | #define MAX_OPERACAKE_RANGES 8 44 | 45 | /* Up to 8 Operacake boards can be used with one HackRF */ 46 | extern uint8_t operacake_boards[8]; 47 | 48 | uint8_t operacake_init(bool allow_gpio); 49 | uint8_t operacake_set_ports(uint8_t address, uint8_t PA, uint8_t PB); 50 | uint8_t operacake_add_range(uint16_t freq_min, uint16_t freq_max, uint8_t port); 51 | uint8_t operacake_set_range(uint32_t freq_mhz); 52 | uint16_t gpio_test(uint8_t address); 53 | 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __OPERACAKE_H */ 59 | -------------------------------------------------------------------------------- /firmware/common/portapack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __PORTAPACK_H__ 23 | #define __PORTAPACK_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #define ARRAY_SIZEOF(x) (sizeof(x) / sizeof(x[0])) 30 | 31 | typedef struct ui_color_t { 32 | uint16_t v; 33 | } ui_color_t; 34 | 35 | typedef struct ui_point_t { 36 | int16_t x; 37 | int16_t y; 38 | } ui_point_t; 39 | 40 | typedef struct ui_size_t { 41 | int16_t width; 42 | int16_t height; 43 | } ui_size_t; 44 | 45 | typedef struct ui_rect_t { 46 | ui_point_t point; 47 | ui_size_t size; 48 | } ui_rect_t; 49 | 50 | typedef struct ui_bitmap_t { 51 | ui_size_t size; 52 | const uint8_t* const data; 53 | } ui_bitmap_t; 54 | 55 | typedef struct ui_font_t { 56 | const ui_size_t glyph_size; 57 | const uint8_t* const data; 58 | char c_start; 59 | size_t c_count; 60 | size_t data_stride; 61 | } ui_font_t; 62 | 63 | typedef struct portapack_t { 64 | } portapack_t; 65 | 66 | void portapack_init(void); 67 | 68 | /* If the "portapack" symbol is defined, PortaPack support is compiled in */ 69 | /* If the portapack() call returns non-NULL, a PortaPack was detected and is initialized. */ 70 | const portapack_t* portapack(void) __attribute__((weak)); 71 | 72 | void portapack_backlight(const bool on); 73 | 74 | void portapack_reference_oscillator(const bool on) __attribute__((weak)); 75 | 76 | void portapack_fill_rectangle( 77 | const ui_rect_t rect, 78 | const ui_color_t color 79 | ); 80 | 81 | void portapack_clear_display(const ui_color_t color); 82 | 83 | void portapack_draw_bitmap( 84 | const ui_point_t point, 85 | const ui_bitmap_t bitmap, 86 | const ui_color_t foreground, 87 | const ui_color_t background 88 | ); 89 | 90 | ui_bitmap_t portapack_font_glyph( 91 | const ui_font_t* const font, 92 | const char c 93 | ); 94 | 95 | #endif/*__PORTAPACK_H__*/ 96 | -------------------------------------------------------------------------------- /firmware/common/rf_path.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __RFPATH_H__ 24 | #define __RFPATH_H__ 25 | 26 | #include 27 | 28 | #include "gpio.h" 29 | 30 | typedef enum { 31 | RF_PATH_DIRECTION_OFF, 32 | RF_PATH_DIRECTION_RX, 33 | RF_PATH_DIRECTION_TX, 34 | } rf_path_direction_t; 35 | 36 | typedef enum { 37 | RF_PATH_FILTER_BYPASS = 0, 38 | RF_PATH_FILTER_LOW_PASS = 1, 39 | RF_PATH_FILTER_HIGH_PASS = 2, 40 | } rf_path_filter_t; 41 | 42 | typedef struct rf_path_t { 43 | uint8_t switchctrl; 44 | #ifdef HACKRF_ONE 45 | gpio_t gpio_hp; 46 | gpio_t gpio_lp; 47 | gpio_t gpio_tx_mix_bp; 48 | gpio_t gpio_no_mix_bypass; 49 | gpio_t gpio_rx_mix_bp; 50 | gpio_t gpio_tx_amp; 51 | gpio_t gpio_tx; 52 | gpio_t gpio_mix_bypass; 53 | gpio_t gpio_rx; 54 | gpio_t gpio_no_tx_amp_pwr; 55 | gpio_t gpio_amp_bypass; 56 | gpio_t gpio_rx_amp; 57 | gpio_t gpio_no_rx_amp_pwr; 58 | #endif 59 | #ifdef RAD1O 60 | gpio_t gpio_tx_rx_n; 61 | gpio_t gpio_tx_rx; 62 | gpio_t gpio_by_mix; 63 | gpio_t gpio_by_mix_n; 64 | gpio_t gpio_by_amp; 65 | gpio_t gpio_by_amp_n; 66 | gpio_t gpio_mixer_en; 67 | gpio_t gpio_low_high_filt; 68 | gpio_t gpio_low_high_filt_n; 69 | gpio_t gpio_tx_amp; 70 | gpio_t gpio_rx_lna; 71 | #endif 72 | } rf_path_t; 73 | 74 | void rf_path_pin_setup(rf_path_t* const rf_path); 75 | void rf_path_init(rf_path_t* const rf_path); 76 | 77 | void rf_path_set_direction(rf_path_t* const rf_path, const rf_path_direction_t direction); 78 | 79 | void rf_path_set_filter(rf_path_t* const rf_path, const rf_path_filter_t filter); 80 | 81 | void rf_path_set_lna(rf_path_t* const rf_path, const uint_fast8_t enable); 82 | void rf_path_set_antenna(rf_path_t* const rf_path, const uint_fast8_t enable); 83 | 84 | #endif/*__RFPATH_H__*/ 85 | -------------------------------------------------------------------------------- /firmware/common/rffc5071_spi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Michael Ossmann 3 | * Copyright 2014 Jared Boone 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __RFFC5071_SPI_H 24 | #define __RFFC5071_SPI_H 25 | 26 | #include "spi_bus.h" 27 | 28 | #include "gpio.h" 29 | 30 | typedef struct rffc5071_spi_config_t { 31 | gpio_t gpio_select; 32 | gpio_t gpio_clock; 33 | gpio_t gpio_data; 34 | } rffc5071_spi_config_t; 35 | 36 | void rffc5071_spi_start(spi_bus_t* const bus, const void* const config); 37 | void rffc5071_spi_stop(spi_bus_t* const bus); 38 | void rffc5071_spi_transfer(spi_bus_t* const bus, void* const data, const size_t count); 39 | void rffc5071_spi_transfer_gather(spi_bus_t* const bus, const spi_transfer_t* const transfer, const size_t count); 40 | 41 | #endif // __RFFC5071_SPI_H 42 | -------------------------------------------------------------------------------- /firmware/common/rom_iap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/firmware/common/rom_iap.h -------------------------------------------------------------------------------- /firmware/common/sgpio.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __SGPIO_H__ 23 | #define __SGPIO_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | #include "gpio.h" 31 | 32 | typedef enum { 33 | SGPIO_DIRECTION_RX, 34 | SGPIO_DIRECTION_TX, 35 | } sgpio_direction_t; 36 | 37 | typedef struct sgpio_config_t { 38 | gpio_t gpio_rx_q_invert; 39 | gpio_t gpio_hw_sync_enable; 40 | bool slice_mode_multislice; 41 | } sgpio_config_t; 42 | 43 | void sgpio_configure_pin_functions(sgpio_config_t* const config); 44 | void sgpio_test_interface(sgpio_config_t* const config); 45 | void sgpio_set_slice_mode( 46 | sgpio_config_t* const config, 47 | const bool multi_slice 48 | ); 49 | void sgpio_configure( 50 | sgpio_config_t* const config, 51 | const sgpio_direction_t direction 52 | ); 53 | void sgpio_cpld_stream_enable(sgpio_config_t* const config); 54 | void sgpio_cpld_stream_disable(sgpio_config_t* const config); 55 | bool sgpio_cpld_stream_is_enabled(sgpio_config_t* const config); 56 | 57 | bool sgpio_cpld_stream_rx_set_decimation(sgpio_config_t* const config, const uint_fast8_t n); 58 | void sgpio_cpld_stream_rx_set_q_invert(sgpio_config_t* const config, const uint_fast8_t invert); 59 | 60 | #endif//__SGPIO_H__ 61 | -------------------------------------------------------------------------------- /firmware/common/spi_bus.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "spi_bus.h" 23 | 24 | void spi_bus_start(spi_bus_t* const bus, const void* const config) { 25 | bus->start(bus, config); 26 | } 27 | 28 | void spi_bus_stop(spi_bus_t* const bus) { 29 | bus->stop(bus); 30 | } 31 | 32 | void spi_bus_transfer(spi_bus_t* const bus, void* const data, const size_t count) { 33 | bus->transfer(bus, data, count); 34 | } 35 | 36 | void spi_bus_transfer_gather(spi_bus_t* const bus, const spi_transfer_t* const transfers, const size_t count) { 37 | bus->transfer_gather(bus, transfers, count); 38 | } 39 | -------------------------------------------------------------------------------- /firmware/common/spi_bus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __SPI_BUS_H__ 23 | #define __SPI_BUS_H__ 24 | 25 | #include 26 | 27 | typedef struct { 28 | void* const data; 29 | const size_t count; 30 | } spi_transfer_t; 31 | 32 | struct spi_bus_t; 33 | typedef struct spi_bus_t spi_bus_t; 34 | 35 | struct spi_bus_t { 36 | void* const obj; 37 | const void* config; 38 | void (*start)(spi_bus_t* const bus, const void* const config); 39 | void (*stop)(spi_bus_t* const bus); 40 | void (*transfer)(spi_bus_t* const bus, void* const data, const size_t count); 41 | void (*transfer_gather)(spi_bus_t* const bus, const spi_transfer_t* const transfers, const size_t count); 42 | }; 43 | 44 | void spi_bus_start(spi_bus_t* const bus, const void* const config); 45 | void spi_bus_stop(spi_bus_t* const bus); 46 | void spi_bus_transfer(spi_bus_t* const bus, void* const data, const size_t count); 47 | void spi_bus_transfer_gather(spi_bus_t* const bus, const spi_transfer_t* const transfers, const size_t count); 48 | 49 | #endif/*__SPI_BUS_H__*/ 50 | -------------------------------------------------------------------------------- /firmware/common/spi_ssp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __SPI_SSP_H__ 23 | #define __SPI_SSP_H__ 24 | 25 | #include 26 | #include 27 | 28 | #include "spi_bus.h" 29 | 30 | #include "gpio.h" 31 | 32 | #include 33 | 34 | typedef struct ssp_config_t { 35 | ssp_datasize_t data_bits; 36 | uint8_t serial_clock_rate; 37 | uint8_t clock_prescale_rate; 38 | gpio_t gpio_select; 39 | } ssp_config_t; 40 | 41 | void spi_ssp_start(spi_bus_t* const bus, const void* const config); 42 | void spi_ssp_stop(spi_bus_t* const bus); 43 | void spi_ssp_transfer(spi_bus_t* const bus, void* const data, const size_t count); 44 | void spi_ssp_transfer_gather(spi_bus_t* const bus, const spi_transfer_t* const transfers, const size_t count); 45 | 46 | #endif/*__SPI_SSP_H__*/ 47 | -------------------------------------------------------------------------------- /firmware/common/streaming.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | 28 | void baseband_streaming_enable(sgpio_config_t* const sgpio_config) { 29 | SGPIO_SET_EN_1 = (1 << SGPIO_SLICE_A); 30 | 31 | sgpio_cpld_stream_enable(sgpio_config); 32 | } 33 | 34 | void baseband_streaming_disable(sgpio_config_t* const sgpio_config) { 35 | sgpio_cpld_stream_disable(sgpio_config); 36 | } 37 | -------------------------------------------------------------------------------- /firmware/common/streaming.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __STREAMING_H__ 24 | #define __STREAMING_H__ 25 | 26 | #include 27 | 28 | void baseband_streaming_enable(sgpio_config_t* const sgpio_config); 29 | void baseband_streaming_disable(sgpio_config_t* const sgpio_config); 30 | 31 | #endif/*__STREAMING_H__*/ 32 | -------------------------------------------------------------------------------- /firmware/common/tuning.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __TUNING_H__ 24 | #define __TUNING_H__ 25 | 26 | #include "rf_path.h" 27 | 28 | #include 29 | #include 30 | 31 | bool set_freq(const uint64_t freq); 32 | bool set_freq_explicit(const uint64_t if_freq_hz, const uint64_t lo_freq_hz, 33 | const rf_path_filter_t path); 34 | 35 | #endif/*__TUNING_H__*/ 36 | -------------------------------------------------------------------------------- /firmware/common/ui_portapack.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __UI_PORTAPACK_H__ 23 | #define __UI_PORTAPACK_H__ 24 | 25 | #include "hackrf_ui.h" 26 | 27 | const hackrf_ui_t* portapack_hackrf_ui_init() __attribute__((weak)); 28 | 29 | #endif/*__UI_PORTAPACK_H__*/ 30 | -------------------------------------------------------------------------------- /firmware/common/ui_rad1o.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2019 Dominic Spill 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __UI_RAD1O_H__ 23 | #define __UI_RAD1O_H__ 24 | 25 | #include "hackrf_ui.h" 26 | 27 | const hackrf_ui_t* rad1o_ui_setup(void) __attribute__((weak)); 28 | 29 | #endif/*__UI_RAD1O_H__*/ 30 | -------------------------------------------------------------------------------- /firmware/common/usb_request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __USB_REQUEST_H__ 23 | #define __USB_REQUEST_H__ 24 | 25 | #include "usb_type.h" 26 | 27 | typedef enum { 28 | USB_RESPONSE_NONE, 29 | USB_RESPONSE_IN, 30 | USB_RESPONSE_OUT, 31 | USB_RESPONSE_STALL, 32 | } usb_endpoint_type_t; 33 | 34 | typedef enum { 35 | USB_TRANSFER_STAGE_SETUP, 36 | USB_TRANSFER_STAGE_DATA, 37 | USB_TRANSFER_STAGE_STATUS, 38 | } usb_transfer_stage_t; 39 | 40 | typedef enum { 41 | USB_REQUEST_STATUS_OK = 0, 42 | USB_REQUEST_STATUS_STALL = 1, 43 | } usb_request_status_t; 44 | 45 | typedef usb_request_status_t (*usb_request_handler_fn)( 46 | usb_endpoint_t* const endpoint, 47 | const usb_transfer_stage_t stage 48 | ); 49 | 50 | typedef struct { 51 | usb_request_handler_fn standard; 52 | usb_request_handler_fn class; 53 | usb_request_handler_fn vendor; 54 | usb_request_handler_fn reserved; 55 | } usb_request_handlers_t; 56 | 57 | extern const usb_request_handlers_t usb_request_handlers; 58 | 59 | void usb_setup_complete( 60 | usb_endpoint_t* const endpoint 61 | ); 62 | 63 | void usb_control_in_complete( 64 | usb_endpoint_t* const endpoint 65 | ); 66 | 67 | void usb_control_out_complete( 68 | usb_endpoint_t* const endpoint 69 | ); 70 | 71 | #endif//__USB_REQUEST_H__ 72 | -------------------------------------------------------------------------------- /firmware/common/usb_standard_request.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __USB_STANDARD_REQUEST_H__ 23 | #define __USB_STANDARD_REQUEST_H__ 24 | 25 | #include "usb_type.h" 26 | #include "usb_request.h" 27 | 28 | void usb_set_configuration_changed_cb( 29 | void (*callback)(usb_device_t* const) 30 | ); 31 | 32 | usb_request_status_t usb_vendor_request_read_wcid( 33 | usb_endpoint_t* const endpoint, 34 | const usb_transfer_stage_t stage 35 | ); 36 | 37 | usb_request_status_t usb_standard_request( 38 | usb_endpoint_t* const endpoint, 39 | const usb_transfer_stage_t stage 40 | ); 41 | 42 | const uint8_t* usb_endpoint_descriptor( 43 | const usb_endpoint_t* const endpoint 44 | ); 45 | 46 | uint_fast16_t usb_endpoint_descriptor_max_packet_size( 47 | const uint8_t* const endpoint_descriptor 48 | ); 49 | 50 | usb_transfer_type_t usb_endpoint_descriptor_transfer_type( 51 | const uint8_t* const endpoint_descriptor 52 | ); 53 | 54 | bool usb_set_configuration( 55 | usb_device_t* const device, 56 | const uint_fast8_t configuration_number 57 | ); 58 | 59 | #endif//__USB_STANDARD_REQUEST_H__ 60 | -------------------------------------------------------------------------------- /firmware/common/w25q80bv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Michael Ossmann 3 | * Copyright 2013 Benjamin Vernoux 4 | * Copyright 2014 Jared Boone, ShareBrained Technology 5 | * 6 | * This file is part of HackRF. 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2, or (at your option) 11 | * any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; see the file COPYING. If not, write to 20 | * the Free Software Foundation, Inc., 51 Franklin Street, 21 | * Boston, MA 02110-1301, USA. 22 | */ 23 | 24 | #ifndef __W25Q80BV_H__ 25 | #define __W25Q80BV_H__ 26 | 27 | #include 28 | #include 29 | 30 | #define W25Q80BV_DEVICE_ID_RES 0x13 /* Expected device_id for W25Q80BV */ 31 | #define W25Q16DV_DEVICE_ID_RES 0x14 /* Expected device_id for W25Q16DV */ 32 | #include "spi_bus.h" 33 | #include "gpio.h" 34 | 35 | typedef union 36 | { 37 | uint64_t id_64b; 38 | uint32_t id_32b[2]; /* 2*32bits 64bits Unique ID */ 39 | uint8_t id_8b[8]; /* 8*8bits 64bits Unique ID */ 40 | } w25q80bv_unique_id_t; 41 | 42 | struct w25q80bv_driver_t; 43 | typedef struct w25q80bv_driver_t w25q80bv_driver_t; 44 | 45 | struct w25q80bv_driver_t { 46 | spi_bus_t* bus; 47 | gpio_t gpio_hold; 48 | gpio_t gpio_wp; 49 | void (*target_init)(w25q80bv_driver_t* const drv); 50 | size_t page_len; 51 | size_t num_pages; 52 | size_t num_bytes; 53 | }; 54 | 55 | void w25q80bv_setup(w25q80bv_driver_t* const drv); 56 | void w25q80bv_get_full_status(w25q80bv_driver_t* const drv, uint8_t* data); 57 | void w25q80bv_chip_erase(w25q80bv_driver_t* const drv); 58 | void w25q80bv_program(w25q80bv_driver_t* const drv, uint32_t addr, uint32_t len, uint8_t* data); 59 | uint8_t w25q80bv_get_device_id(w25q80bv_driver_t* const drv); 60 | void w25q80bv_get_unique_id(w25q80bv_driver_t* const drv, w25q80bv_unique_id_t* unique_id); 61 | void w25q80bv_read(w25q80bv_driver_t* const drv, uint32_t addr, uint32_t len, uint8_t* const data); 62 | void w25q80bv_clear_status(w25q80bv_driver_t* const drv); 63 | 64 | #endif//__W25Q80BV_H__ 65 | -------------------------------------------------------------------------------- /firmware/common/w25q80bv_target.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "w25q80bv_target.h" 23 | 24 | #include 25 | #include "hackrf_core.h" 26 | 27 | /* TODO: Why is CS being controlled manually when SSP0 could do it 28 | * automatically? 29 | */ 30 | 31 | void w25q80bv_target_init(w25q80bv_driver_t* const drv) { 32 | (void)drv; 33 | 34 | /* Init SPIFI GPIO to Normal GPIO */ 35 | scu_pinmux(P3_3, (SCU_SSP_IO | SCU_CONF_FUNCTION2)); // P3_3 SPIFI_SCK => SSP0_SCK 36 | scu_pinmux(P3_4, (SCU_GPIO_FAST | SCU_CONF_FUNCTION0)); // P3_4 SPIFI SPIFI_SIO3 IO3 => GPIO1[14] 37 | scu_pinmux(P3_5, (SCU_GPIO_FAST | SCU_CONF_FUNCTION0)); // P3_5 SPIFI SPIFI_SIO2 IO2 => GPIO1[15] 38 | scu_pinmux(P3_6, (SCU_GPIO_FAST | SCU_CONF_FUNCTION0)); // P3_6 SPIFI SPIFI_CIPO IO1 => GPIO0[6] 39 | scu_pinmux(P3_7, (SCU_GPIO_FAST | SCU_CONF_FUNCTION4)); // P3_7 SPIFI SPIFI_COPI IO0 => GPIO5[10] 40 | scu_pinmux(P3_8, (SCU_GPIO_FAST | SCU_CONF_FUNCTION4)); // P3_8 SPIFI SPIFI_CS => GPIO5[11] 41 | 42 | /* configure SSP pins */ 43 | scu_pinmux(SCU_SSP0_CIPO, (SCU_SSP_IO | SCU_CONF_FUNCTION5)); 44 | scu_pinmux(SCU_SSP0_COPI, (SCU_SSP_IO | SCU_CONF_FUNCTION5)); 45 | scu_pinmux(SCU_SSP0_SCK, (SCU_SSP_IO | SCU_CONF_FUNCTION2)); 46 | 47 | /* configure GPIO pins */ 48 | scu_pinmux(SCU_FLASH_HOLD, SCU_GPIO_FAST); 49 | scu_pinmux(SCU_FLASH_WP, SCU_GPIO_FAST); 50 | scu_pinmux(SCU_SSP0_CS, (SCU_GPIO_FAST | SCU_CONF_FUNCTION4)); 51 | 52 | /* drive CS, HOLD, and WP pins high */ 53 | gpio_set(drv->gpio_hold); 54 | gpio_set(drv->gpio_wp); 55 | 56 | /* Set GPIO pins as outputs. */ 57 | gpio_output(drv->gpio_hold); 58 | gpio_output(drv->gpio_wp); 59 | } 60 | -------------------------------------------------------------------------------- /firmware/common/w25q80bv_target.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Jared Boone, ShareBrained Technology, Inc. 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __W25Q80BV_TARGET_H__ 23 | #define __W25Q80BV_TARGET_H__ 24 | 25 | #include "w25q80bv.h" 26 | 27 | void w25q80bv_target_init(w25q80bv_driver_t* const drv); 28 | 29 | #endif/*__W25Q80BV_TARGET_H__*/ 30 | -------------------------------------------------------------------------------- /firmware/common/xapp058/README: -------------------------------------------------------------------------------- 1 | The code in this directory was originally is taken from: 2 | http://www.xilinx.com/support/documentation/application_notes/xapp058.zip 3 | (v.5.01) 4 | 5 | Ian Lesnet wrote: "I contacted Xilinx support and they said the license is do 6 | what you want, no warranty. (BSD I guess...)" 7 | (http://dangerousprototypes.com/forum/viewtopic.php?f=51&t=2239#p21257) 8 | 9 | Refer to XAPP058 for more information: 10 | http://www.xilinx.com/support/documentation/application_notes/xapp058.pdf 11 | 12 | This software has been modified for HackRF. 13 | -------------------------------------------------------------------------------- /firmware/common/xapp058/micro.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * File: micro.h 3 | * Description: This header file contains the function prototype to the 4 | * primary interface function for the XSVF player. 5 | * Usage: FIRST - PORTS.C 6 | * Customize the ports.c function implementations to establish 7 | * the correct protocol for communicating with your JTAG ports 8 | * (setPort() and readTDOBit()) and tune the waitTime() delay 9 | * function. Also, establish access to the XSVF data source 10 | * in the readByte() function. 11 | * FINALLY - Call xsvfExecute(). 12 | *****************************************************************************/ 13 | #ifndef XSVF_MICRO_H 14 | #define XSVF_MICRO_H 15 | 16 | #include "cpld_jtag.h" 17 | 18 | /* Legacy error codes for xsvfExecute from original XSVF player v2.0 */ 19 | #define XSVF_LEGACY_SUCCESS 1 20 | #define XSVF_LEGACY_ERROR 0 21 | 22 | /* 4.04 [NEW] Error codes for xsvfExecute. */ 23 | /* Must #define XSVF_SUPPORT_ERRORCODES in micro.c to get these codes */ 24 | #define XSVF_ERROR_NONE 0 25 | #define XSVF_ERROR_UNKNOWN 1 26 | #define XSVF_ERROR_TDOMISMATCH 2 27 | #define XSVF_ERROR_MAXRETRIES 3 /* TDO mismatch after max retries */ 28 | #define XSVF_ERROR_ILLEGALCMD 4 29 | #define XSVF_ERROR_ILLEGALSTATE 5 30 | #define XSVF_ERROR_DATAOVERFLOW 6 /* Data > lenVal MAX_LEN buffer size*/ 31 | /* Insert new errors here */ 32 | #define XSVF_ERROR_LAST 7 33 | 34 | /***************************************************************************** 35 | * Function: xsvfExecute 36 | * Description: Process, interpret, and apply the XSVF commands. 37 | * See port.c:readByte for source of XSVF data. 38 | * Parameters: none. 39 | * Returns: int - For error codes see above. 40 | *****************************************************************************/ 41 | extern int xsvfExecute(jtag_gpio_t* const gpio); 42 | 43 | #endif /* XSVF_MICRO_H */ 44 | 45 | -------------------------------------------------------------------------------- /firmware/common/xapp058/ports.h: -------------------------------------------------------------------------------- 1 | /*******************************************************/ 2 | /* file: ports.h */ 3 | /* abstract: This file contains extern declarations */ 4 | /* for providing stimulus to the JTAG ports.*/ 5 | /*******************************************************/ 6 | 7 | #ifndef ports_dot_h 8 | #define ports_dot_h 9 | 10 | #include "cpld_jtag.h" 11 | 12 | /* these constants are used to send the appropriate ports to setPort */ 13 | /* they should be enumerated types, but some of the microcontroller */ 14 | /* compilers don't like enumerated types */ 15 | #define TCK (short) 0 16 | #define TMS (short) 1 17 | #define TDI (short) 2 18 | 19 | /* set the port "p" (TCK, TMS, or TDI) to val (0 or 1) */ 20 | extern void setPort(jtag_gpio_t* const gpio, short p, short val); 21 | 22 | /* read the TDO bit and store it in val */ 23 | extern unsigned char readTDOBit(jtag_gpio_t* const gpio); 24 | 25 | /* make clock go down->up->down*/ 26 | extern void pulseClock(jtag_gpio_t* const gpio); 27 | 28 | /* read the next byte of data from the xsvf file */ 29 | extern void readByte(unsigned char *data); 30 | 31 | extern void waitTime(jtag_gpio_t* const gpio, long microsec); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /firmware/cpld/README: -------------------------------------------------------------------------------- 1 | The primary CPLD image is: sgpio_if/default.xsvf 2 | 3 | This is a binary file built from HDL source in sgpio_if. You do not need 4 | Xilinx tools unless you want to make your own modifications. 5 | 6 | CPLD images are automatically included in HackRF firmware. You do not normally 7 | need to update the bitstream stored in the CPLD's flash memory as it is 8 | superseded by the image loaded into SRAM by the firmware. 9 | 10 | If you want to update the bitstream in CPLD flash for some reason, first update 11 | the firmware, libhackrf, and hackrf-tools. 12 | Then: 13 | 14 | $ hackrf_cpldjtag -x sgpio_if/default.xsvf 15 | 16 | After a few seconds, three LEDs should start blinking. This indicates that the 17 | CPLD has been programmed successfully. Reset the HackRF device by pressing the 18 | RESET button or by unplugging it and plugging it back in. 19 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_debug/Makefile: -------------------------------------------------------------------------------- 1 | # xst -intstyle ise -ifn top.xst -ofn top.syr 2 | # ngdbuild -intstyle ise -dd _ngo -uc top.ucf -p xc2c64a-VQ100-7 top.ngc top.ngd 3 | # cpldfit -intstyle ise -p xc2c64a-7-VQ100 -ofmt vhdl -optimize density -loc on -slew slow -init low -inputs 32 -pterms 28 -unused pullup -terminate float -iostd LVCMOS33 top.ngd 4 | # tsim -intstyle ise top top.nga 5 | # taengine -intstyle ise -f top -l top.tim -e {taengine.err} 6 | # hprep6 -s IEEE1149 -i top 7 | # vhdtdtfi -prj sgpio_debug -o top.vhi -module top -template /opt/Xilinx/14.7/ISE_DS/ISE/data/vhdlinst.tft -deleteonerror -lib work top.vhd 8 | 9 | DESIGN=top 10 | 11 | DEVICE=xc2c64a 12 | DEVICE_SPEED=7 13 | DEVICE_PACKAGE=VQ100 14 | 15 | OUTFILES_XST=$(DESIGN).ngc $(DESIGN).syr $(DESIGN).ngr $(DESIGN)_xst.xrpt $(DESIGN).lso _xmsgs/xst.xmsgs 16 | OUTFILES_NGDBUILD=$(DESIGN).ngd $(DESIGN).bld $(DESIGN)_ngdbuild.xrpt _xmsgs/ngdbuild.xmsgs _ngo/netlist.lst xlnx_auto_0_xdb/cst.xbcd 17 | OUTFILES_CPLDFIT=$(DESIGN).vm6 $(DESIGN).tspec t6.phd t6.dat t55.phd t55.dat t1.phd t1.dat $(DESIGN).log $(DESIGN).chk $(DESIGN).rpt $(DESIGN).xml $(DESIGN)_build.xml $(DESIGN).pad $(DESIGN)_pad.csv $(DESIGN).pnx $(DESIGN).mfd $(DESIGN).cxt $(DESIGN).gyd _xmsgs/cpldfit.xmsgs 18 | OUTFILES_HPREP6=$(DESIGN).jed tmperr.err _xmsgs/hprep6.xmsgs 19 | OUTFILES_IMPACT_SVF=default.svf _impactbatch.log 20 | OUTFILES_IMPACT_XSVF=default.xsvf _impactbatch.log 21 | 22 | all: default.svf default.xsvf 23 | 24 | $(DESIGN).ngc: $(DESIGN).xst $(DESIGN).prj 25 | mkdir -p xst/projnav.tmp 26 | xst -intstyle ise -ifn $(DESIGN).xst -ofn $(DESIGN).syr 27 | 28 | $(DESIGN).ngd: $(DESIGN).ngc $(DESIGN).ucf 29 | ngdbuild -intstyle ise -dd _ngo -uc $(DESIGN).ucf -p $(DEVICE)-$(DEVICE_PACKAGE)-$(DEVICE_SPEED) $(DESIGN).ngc $(DESIGN).ngd 30 | 31 | $(DESIGN).vm6: $(DESIGN).ngd 32 | cpldfit -intstyle ise -p $(DEVICE)-$(DEVICE_SPEED)-$(DEVICE_PACKAGE) -ofmt vhdl -optimize speed -loc on -slew slow -init low -inputs 32 -pterms 36 -unused pullup -terminate float -iostd LVCMOS33 $(DESIGN).ngd 33 | 34 | $(DESIGN).jed: $(DESIGN).vm6 35 | hprep6 -s IEEE1149 -i $(DESIGN).vm6 36 | 37 | default.svf: $(DESIGN).jed batch_svf 38 | impact -batch batch_svf 39 | 40 | default.xsvf: $(DESIGN).jed batch_xsvf 41 | impact -batch batch_xsvf 42 | 43 | .PHONY: clean 44 | 45 | clean: 46 | rm -f $(OUTFILES_XST) $(OUTFILES_NGDBUILD) $(OUTFILES_CPLDFIT) $(OUTFILES_HPREP6) $(OUTFILES_IMPACT_SVF) $(OUTFILES_IMPACT_XSVF) 47 | rm -rf xlnx_auto_0_xdb/ _ngo/ _xmsgs/ xst/ 48 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_debug/README.md: -------------------------------------------------------------------------------- 1 | CPLD interface between LPC43xx microcontroller SGPIO peripheral and MAX5864 2 | RF codec. 3 | 4 | CPLD-based triggered capture 5 | ============================ 6 | 7 | To build this VHDL project and produce an SVF file for flashing the CPLD: 8 | 9 | * Xilinx WebPACK 13.4 for Windows or Linux. 10 | 11 | Generate an XSVF 12 | ================ 13 | 14 | After generating a programming file: 15 | 16 | * In the ISE Project Navigator, "Processes: top - Behavioral" pane, double-click "Configure Target Device". 17 | * Click "OK" to open iMPACT. 18 | * Ctrl-N to create a "New Project". 19 | * "Yes" to automatically create and save a project file. 20 | * Select "Prepare a Boundary-Scan File", choose "XSVF". 21 | * Select file name "default.xsvf". 22 | * Click "OK" to start adding devices. 23 | * Assign new configuration file: "top.jed". 24 | * Right-click the "xc2c64a top.jed" icon and select "Erase". Accept defaults. 25 | * Right-click the "xc2c64a top.jed" icon and select "Program". 26 | * Right-click the "xc2c64a top.jed" icon and select "Verify". 27 | * Choose menu "Output" -> "XSVF File" -> "Stop Writing to XSVF File". 28 | * Close iMPACT. 29 | 30 | To Program 31 | ========== 32 | 33 | $ hackrf_cpldjtag -x default.xsvf 34 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_debug/batch_svf: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -port svf -file default.svf 3 | addDevice -p 1 -file top.jed 4 | Erase -p 1 5 | Program -p 1 -e -v 6 | Verify -p 1 7 | quit 8 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_debug/batch_xsvf: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -port xsvf -file default.xsvf 3 | addDevice -p 1 -file top.jed 4 | Erase -p 1 5 | Program -p 1 -e -v 6 | Verify -p 1 7 | quit 8 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_debug/default.xsvf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/firmware/cpld/sgpio_debug/default.xsvf -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/Makefile: -------------------------------------------------------------------------------- 1 | # xst -intstyle ise -ifn top.xst -ofn top.syr 2 | # ngdbuild -intstyle ise -dd _ngo -uc top.ucf -p xc2c64a-VQ100-7 top.ngc top.ngd 3 | # cpldfit -intstyle ise -p xc2c64a-7-VQ100 -ofmt vhdl -optimize density -loc on -slew slow -init low -inputs 32 -pterms 28 -unused pullup -terminate float -iostd LVCMOS33 top.ngd 4 | # tsim -intstyle ise top top.nga 5 | # taengine -intstyle ise -f top -l top.tim -e {taengine.err} 6 | # hprep6 -s IEEE1149 -i top 7 | # vhdtdtfi -prj sgpio_if -o top.vhi -module top -template /opt/Xilinx/14.7/ISE_DS/ISE/data/vhdlinst.tft -deleteonerror -lib work top.vhd 8 | 9 | DESIGN=top 10 | 11 | DEVICE=xc2c64a 12 | DEVICE_SPEED=7 13 | DEVICE_PACKAGE=VQ100 14 | 15 | OUTFILES_XST=$(DESIGN).ngc $(DESIGN).syr $(DESIGN).ngr $(DESIGN)_xst.xrpt $(DESIGN).lso _xmsgs/xst.xmsgs 16 | OUTFILES_NGDBUILD=$(DESIGN).ngd $(DESIGN).bld $(DESIGN)_ngdbuild.xrpt _xmsgs/ngdbuild.xmsgs _ngo/netlist.lst xlnx_auto_0_xdb/cst.xbcd 17 | OUTFILES_CPLDFIT=$(DESIGN).vm6 $(DESIGN).tspec t6.phd t6.dat t55.phd t55.dat t1.phd t1.dat $(DESIGN).log $(DESIGN).chk $(DESIGN).rpt $(DESIGN).xml $(DESIGN)_build.xml $(DESIGN).pad $(DESIGN)_pad.csv $(DESIGN).pnx $(DESIGN).mfd $(DESIGN).cxt $(DESIGN).gyd _xmsgs/cpldfit.xmsgs 18 | OUTFILES_HPREP6=$(DESIGN).jed tmperr.err _xmsgs/hprep6.xmsgs 19 | OUTFILES_IMPACT_SVF=default.svf _impactbatch.log 20 | OUTFILES_IMPACT_XSVF=default.xsvf _impactbatch.log 21 | 22 | all: default.svf default.xsvf 23 | 24 | $(DESIGN).ngc: $(DESIGN).xst $(DESIGN).prj 25 | mkdir -p xst/projnav.tmp 26 | xst -intstyle ise -ifn $(DESIGN).xst -ofn $(DESIGN).syr 27 | 28 | $(DESIGN).ngd: $(DESIGN).ngc $(DESIGN).ucf 29 | ngdbuild -intstyle ise -dd _ngo -uc $(DESIGN).ucf -p $(DEVICE)-$(DEVICE_PACKAGE)-$(DEVICE_SPEED) $(DESIGN).ngc $(DESIGN).ngd 30 | 31 | $(DESIGN).vm6: $(DESIGN).ngd 32 | cpldfit -intstyle ise -p $(DEVICE)-$(DEVICE_SPEED)-$(DEVICE_PACKAGE) -ofmt vhdl -optimize speed -loc on -slew slow -init low -inputs 32 -pterms 36 -unused pullup -terminate float -iostd LVCMOS33 $(DESIGN).ngd 33 | 34 | $(DESIGN).jed: $(DESIGN).vm6 35 | hprep6 -s IEEE1149 -i $(DESIGN).vm6 36 | 37 | default.svf: $(DESIGN).jed batch_svf 38 | impact -batch batch_svf 39 | 40 | default.xsvf: $(DESIGN).jed batch_xsvf 41 | impact -batch batch_xsvf 42 | 43 | .PHONY: clean 44 | 45 | clean: 46 | rm -f $(OUTFILES_XST) $(OUTFILES_NGDBUILD) $(OUTFILES_CPLDFIT) $(OUTFILES_HPREP6) $(OUTFILES_IMPACT_SVF) $(OUTFILES_IMPACT_XSVF) 47 | rm -rf xlnx_auto_0_xdb/ _ngo/ _xmsgs/ xst/ 48 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/README.md: -------------------------------------------------------------------------------- 1 | CPLD interface between LPC43xx microcontroller SGPIO peripheral and MAX5864 2 | RF codec. 3 | 4 | CPLD-based triggered capture 5 | ============================ 6 | 7 | To build this VHDL project and produce an SVF file for flashing the CPLD: 8 | 9 | * Xilinx WebPACK 13.4 for Windows or Linux. 10 | 11 | Generate an XSVF 12 | ================ 13 | 14 | After generating a programming file: 15 | 16 | * In the ISE Project Navigator, "Processes: top - Behavioral" pane, double-click "Configure Target Device". 17 | * Click "OK" to open iMPACT. 18 | * Ctrl-N to create a "New Project". 19 | * "Yes" to automatically create and save a project file. 20 | * Select "Prepare a Boundary-Scan File", choose "XSVF". 21 | * Select file name "default.xsvf". 22 | * Click "OK" to start adding devices. 23 | * Assign new configuration file: "top.jed". 24 | * Right-click the "xc2c64a top.jed" icon and select "Erase". Accept defaults. 25 | * Right-click the "xc2c64a top.jed" icon and select "Program". 26 | * Right-click the "xc2c64a top.jed" icon and select "Verify". 27 | * Choose menu "Output" -> "XSVF File" -> "Stop Writing to XSVF File". 28 | * Close iMPACT. 29 | 30 | To Program 31 | ========== 32 | 33 | $ hackrf_cpldjtag -x default.xsvf 34 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/batch_svf: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -port svf -file default.svf 3 | addDevice -p 1 -file top.jed 4 | Erase -p 1 5 | Program -p 1 -e -v 6 | Verify -p 1 7 | quit 8 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/batch_xsvf: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -port xsvf -file default.xsvf 3 | addDevice -p 1 -file top.jed 4 | Erase -p 1 5 | Program -p 1 -e -v 6 | Verify -p 1 7 | quit 8 | -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/default.xsvf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/firmware/cpld/sgpio_if/default.xsvf -------------------------------------------------------------------------------- /firmware/cpld/sgpio_if/top.ucf: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2012 Jared Boone 3 | # 4 | # This file is part of HackRF. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | 21 | NET "CODEC_X2_CLK" TNM_NET = CODEC_X2_CLK; 22 | TIMESPEC TS_codec_x2_data = PERIOD "CODEC_X2_CLK" 25 ns; 23 | 24 | TIMEGRP "adc_data" OFFSET = IN 16 ns BEFORE "CODEC_X2_CLK"; 25 | 26 | TIMEGRP "dac_data" OFFSET = OUT 15 ns AFTER "CODEC_X2_CLK"; 27 | 28 | TIMEGRP "to_host" OFFSET = OUT 20 ns AFTER "CODEC_X2_CLK"; 29 | #PACE: Start of Constraints generated by PACE 30 | 31 | #PACE: Start of PACE I/O Pin Assignments 32 | NET "CODEC_CLK" LOC = "P23" ; 33 | NET "CODEC_X2_CLK" LOC = "P27" ; 34 | NET "DA<0>" LOC = "P43" ; 35 | NET "DA<1>" LOC = "P42" ; 36 | NET "DA<2>" LOC = "P41" ; 37 | NET "DA<3>" LOC = "P40" ; 38 | NET "DA<4>" LOC = "P39" ; 39 | NET "DA<5>" LOC = "P37" ; 40 | NET "DA<6>" LOC = "P36" ; 41 | NET "DA<7>" LOC = "P35" ; 42 | NET "DD<0>" LOC = "P34" ; 43 | NET "DD<1>" LOC = "P33" ; 44 | NET "DD<2>" LOC = "P32" ; 45 | NET "DD<3>" LOC = "P30" ; 46 | NET "DD<4>" LOC = "P29" ; 47 | NET "DD<5>" LOC = "P28" ; 48 | NET "DD<6>" LOC = "P24" ; 49 | NET "DD<7>" LOC = "P19" ; 50 | NET "DD<8>" LOC = "P18" ; 51 | NET "DD<9>" LOC = "P17" ; 52 | NET "HOST_CAPTURE" LOC = "P91" ; 53 | NET "HOST_DATA<0>" LOC = "P89" ; 54 | NET "HOST_DATA<1>" LOC = "P79" ; 55 | NET "HOST_DATA<2>" LOC = "P74" ; 56 | NET "HOST_DATA<3>" LOC = "P72" ; 57 | NET "HOST_DATA<4>" LOC = "P67" ; 58 | NET "HOST_DATA<5>" LOC = "P64" ; 59 | NET "HOST_DATA<6>" LOC = "P61" ; 60 | NET "HOST_DATA<7>" LOC = "P77" ; 61 | NET "HOST_DIRECTION" LOC = "P71" ; 62 | NET "HOST_DISABLE" LOC = "P76" ; 63 | NET "HOST_Q_INVERT" LOC = "P70" ; 64 | NET "HOST_SYNC_EN" LOC = "P90" ; 65 | NET "HOST_SYNC" LOC = "P55" | PULLUP ; 66 | NET "HOST_SYNC_CMD" LOC = "P56" ; 67 | 68 | #PACE: Start of PACE Area Constraints 69 | 70 | #PACE: Start of PACE Prohibit Constraints 71 | 72 | #PACE: End of Constraints generated by PACE 73 | -------------------------------------------------------------------------------- /firmware/dfu-util.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright 2015 Dominic Spill 3 | # 4 | # This file is part of GreatFET. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | execute_process( 23 | COMMAND dfu-suffix -V 24 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 25 | RESULT_VARIABLE DFU_NOT_FOUND 26 | ERROR_QUIET 27 | OUTPUT_VARIABLE DFU_VERSION_STRING 28 | OUTPUT_STRIP_TRAILING_WHITESPACE 29 | ) 30 | 31 | set(DFU_ALL "") 32 | if(NOT DFU_NOT_FOUND) 33 | set(DFU_ALL "ALL") 34 | else(NOT DFU_NOT_FOUND) 35 | MESSAGE(STATUS "dfu-suffix not found: not building DFU file") 36 | endif(NOT DFU_NOT_FOUND) 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /firmware/dfu.py: -------------------------------------------------------------------------------- 1 | import os.path 2 | import struct 3 | import sys 4 | 5 | with open("_header.bin", "wb") as f: 6 | x = struct.pack(' 27 | 28 | #include 29 | #include 30 | 31 | typedef struct { 32 | uint32_t part_id[2]; 33 | uint32_t serial_no[4]; 34 | } read_partid_serialno_t; 35 | 36 | usb_request_status_t usb_vendor_request_read_board_id( 37 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 38 | usb_request_status_t usb_vendor_request_read_version_string( 39 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 40 | usb_request_status_t usb_vendor_request_read_partid_serialno( 41 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 42 | usb_request_status_t usb_vendor_request_reset( 43 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 44 | 45 | #endif /* end of include guard: __USB_API_BOARD_INFO_H__ */ 46 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_clock_conv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2021 Tomaz Solc 3 | * 4 | * This program is free software; you can redistribute it and/or modify 5 | * it under the terms of the GNU General Public License as published by 6 | * the Free Software Foundation; either version 2, or (at your option) 7 | * any later version. 8 | * 9 | * This program is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * You should have received a copy of the GNU General Public License 15 | * along with this program; see the file COPYING. If not, write to 16 | * the Free Software Foundation, Inc., 51 Franklin Street, 17 | * Boston, MA 02110-1301, USA. 18 | */ 19 | 20 | #ifndef __USB_API_CLOCK_CONV_H__ 21 | #define __USB_API_CLOCK_CONV_H__ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | usb_request_status_t usb_vendor_request_set_clock_conv_filter( 28 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 29 | usb_request_status_t usb_vendor_request_set_clock_conv_clkin_enable( 30 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 31 | usb_request_status_t usb_vendor_request_set_clock_conv_aux_enable( 32 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_cpld.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_API_CPLD_H__ 24 | #define __USB_API_CPLD_H__ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | void cpld_update(void); 32 | 33 | usb_request_status_t usb_vendor_request_cpld_checksum( 34 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 35 | 36 | #endif /* end of include guard: __USB_API_CPLD_H__ */ 37 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_operacake.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Dominic Spill 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __USB_API_OPERACAKE_H__ 23 | #define __USB_API_OPERACAKE_H__ 24 | 25 | #include 26 | #include 27 | 28 | usb_request_status_t usb_vendor_request_operacake_get_boards( 29 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 30 | 31 | usb_request_status_t usb_vendor_request_operacake_set_ports( 32 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 33 | 34 | usb_request_status_t usb_vendor_request_operacake_set_ranges( 35 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 36 | 37 | usb_request_status_t usb_vendor_request_operacake_gpio_test( 38 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 39 | 40 | #endif /* end of include guard: __USB_API_OPERACAKE_H__ */ 41 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_register.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_API_REGISTER_H__ 24 | #define __USB_API_REGISTER_H__ 25 | 26 | #include 27 | #include 28 | 29 | usb_request_status_t usb_vendor_request_write_max2837( 30 | usb_endpoint_t* const endpoint, 31 | const usb_transfer_stage_t stage 32 | ); 33 | usb_request_status_t usb_vendor_request_read_max2837( 34 | usb_endpoint_t* const endpoint, 35 | const usb_transfer_stage_t stage 36 | ); 37 | usb_request_status_t usb_vendor_request_write_si5351c( 38 | usb_endpoint_t* const endpoint, 39 | const usb_transfer_stage_t stage 40 | ); 41 | usb_request_status_t usb_vendor_request_read_si5351c( 42 | usb_endpoint_t* const endpoint, 43 | const usb_transfer_stage_t stage 44 | ); 45 | usb_request_status_t usb_vendor_request_write_rffc5071( 46 | usb_endpoint_t* const endpoint, 47 | const usb_transfer_stage_t stage 48 | ); 49 | usb_request_status_t usb_vendor_request_read_rffc5071( 50 | usb_endpoint_t* const endpoint, 51 | const usb_transfer_stage_t stage 52 | ); 53 | usb_request_status_t usb_vendor_request_set_clkout_enable( 54 | usb_endpoint_t* const endpoint, 55 | const usb_transfer_stage_t stage 56 | ); 57 | 58 | #endif /* end of include guard: __USB_API_REGISTER_H__ */ 59 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_spiflash.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_API_SPIFLASH_H__ 24 | #define __USB_API_SPIFLASH_H__ 25 | 26 | #include 27 | #include 28 | 29 | usb_request_status_t usb_vendor_request_erase_spiflash( 30 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 31 | usb_request_status_t usb_vendor_request_write_spiflash( 32 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 33 | usb_request_status_t usb_vendor_request_read_spiflash( 34 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 35 | usb_request_status_t usb_vendor_request_spiflash_status( 36 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 37 | usb_request_status_t usb_vendor_request_spiflash_clear_status( 38 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 39 | 40 | #endif /* end of include guard: __USB_API_SPIFLASH_H__ */ 41 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_sweep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016 Mike Walters, Dominic Spill 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __USB_API_SWEEP_H__ 23 | #define __USB_API_SWEEP_H__ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | enum sweep_style { 30 | LINEAR = 0, 31 | INTERLEAVED = 1, 32 | }; 33 | 34 | usb_request_status_t usb_vendor_request_init_sweep( 35 | usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage); 36 | 37 | void sweep_mode(void); 38 | 39 | #endif /* __USB_API_SWEEP_H__ */ 40 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_ui.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Mike Walters 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include "usb_api_ui.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | usb_request_status_t usb_vendor_request_set_ui_enable( 32 | usb_endpoint_t* const endpoint, 33 | const usb_transfer_stage_t stage 34 | ) { 35 | if (stage == USB_TRANSFER_STAGE_SETUP) { 36 | hackrf_ui_set_enable(endpoint->setup.value); 37 | usb_transfer_schedule_ack(endpoint->in); 38 | } 39 | return USB_REQUEST_STATUS_OK; 40 | } 41 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_api_ui.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Mike Walters 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #ifndef __USB_API_UI_H__ 23 | #define __USB_API_UI_H__ 24 | 25 | #include 26 | #include 27 | 28 | usb_request_status_t usb_vendor_request_set_ui_enable( 29 | usb_endpoint_t* const endpoint, 30 | const usb_transfer_stage_t stage 31 | ); 32 | 33 | #endif /* end of include guard: __USB_API_UI_H__ */ 34 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_bulk_buffer.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "usb_bulk_buffer.h" 24 | 25 | volatile uint32_t usb_bulk_buffer_offset = 0; 26 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_bulk_buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_BULK_BUFFER_H__ 24 | #define __USB_BULK_BUFFER_H__ 25 | 26 | #include 27 | #include 28 | 29 | /* Address of usb_bulk_buffer is set in ldscripts. If you change the name of this 30 | * variable, it won't be where it needs to be in the processor's address space, 31 | * unless you also adjust the ldscripts. 32 | */ 33 | extern uint8_t usb_bulk_buffer[32768]; 34 | 35 | extern volatile uint32_t usb_bulk_buffer_offset; 36 | 37 | extern bool usb_bulk_buffer_tx; 38 | 39 | #endif/*__USB_BULK_BUFFER_H__*/ 40 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_descriptor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * 4 | * This file is part of HackRF. 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2, or (at your option) 9 | * any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; see the file COPYING. If not, write to 18 | * the Free Software Foundation, Inc., 51 Franklin Street, 19 | * Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | #include 23 | 24 | extern uint8_t usb_descriptor_device[]; 25 | extern uint8_t usb_descriptor_device_qualifier[]; 26 | extern uint8_t usb_descriptor_configuration_full_speed[]; 27 | extern uint8_t usb_descriptor_configuration_high_speed[]; 28 | extern uint8_t usb_descriptor_string_languages[]; 29 | extern uint8_t usb_descriptor_string_manufacturer[]; 30 | extern uint8_t usb_descriptor_string_product[]; 31 | 32 | #define USB_DESCRIPTOR_STRING_SERIAL_LEN 32 33 | #define USB_DESCRIPTOR_STRING_SERIAL_BUF_LEN (USB_DESCRIPTOR_STRING_SERIAL_LEN*2 + 2) /* UTF-16LE */ 34 | extern uint8_t usb_descriptor_string_serial_number[]; 35 | 36 | extern uint8_t* usb_descriptor_strings[]; 37 | 38 | #define USB_WCID_VENDOR_REQ 0x19 39 | extern uint8_t wcid_string_descriptor[]; 40 | extern uint8_t wcid_feature_descriptor[]; 41 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_device.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "usb_device.h" 24 | 25 | #include 26 | 27 | #include "usb_descriptor.h" 28 | 29 | usb_configuration_t usb_configuration_high_speed = { 30 | .number = 1, 31 | .speed = USB_SPEED_HIGH, 32 | .descriptor = usb_descriptor_configuration_high_speed, 33 | }; 34 | 35 | usb_configuration_t usb_configuration_full_speed = { 36 | .number = 1, 37 | .speed = USB_SPEED_FULL, 38 | .descriptor = usb_descriptor_configuration_full_speed, 39 | }; 40 | 41 | 42 | usb_configuration_t* usb_configurations[] = { 43 | &usb_configuration_high_speed, 44 | &usb_configuration_full_speed, 45 | 0, 46 | }; 47 | 48 | usb_device_t usb_device = { 49 | .descriptor = usb_descriptor_device, 50 | .descriptor_strings = usb_descriptor_strings, 51 | .qualifier_descriptor = usb_descriptor_device_qualifier, 52 | .configurations = &usb_configurations, 53 | .configuration = 0, 54 | .wcid_string_descriptor = wcid_string_descriptor, 55 | .wcid_feature_descriptor = wcid_feature_descriptor, 56 | }; 57 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_device.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_DEVICE_H__ 24 | #define __USB_DEVICE_H__ 25 | 26 | #include 27 | 28 | extern usb_device_t usb_device; 29 | 30 | #endif /* end of include guard: __USB_DEVICE_H__ */ 31 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_endpoint.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #include "usb_endpoint.h" 24 | 25 | #include 26 | 27 | #include "usb_device.h" 28 | 29 | usb_endpoint_t usb_endpoint_control_out = { 30 | .address = 0x00, 31 | .device = &usb_device, 32 | .in = &usb_endpoint_control_in, 33 | .out = &usb_endpoint_control_out, 34 | .setup_complete = usb_setup_complete, 35 | .transfer_complete = usb_control_out_complete, 36 | }; 37 | USB_DEFINE_QUEUE(usb_endpoint_control_out, 4); 38 | 39 | usb_endpoint_t usb_endpoint_control_in = { 40 | .address = 0x80, 41 | .device = &usb_device, 42 | .in = &usb_endpoint_control_in, 43 | .out = &usb_endpoint_control_out, 44 | .setup_complete = 0, 45 | .transfer_complete = usb_control_in_complete, 46 | }; 47 | static USB_DEFINE_QUEUE(usb_endpoint_control_in, 4); 48 | 49 | // NOTE: Endpoint number for IN and OUT are different. I wish I had some 50 | // evidence that having BULK IN and OUT on separate endpoint numbers was 51 | // actually a good idea. Seems like everybody does it that way, but why? 52 | 53 | usb_endpoint_t usb_endpoint_bulk_in = { 54 | .address = 0x81, 55 | .device = &usb_device, 56 | .in = &usb_endpoint_bulk_in, 57 | .out = 0, 58 | .setup_complete = 0, 59 | .transfer_complete = usb_queue_transfer_complete 60 | }; 61 | static USB_DEFINE_QUEUE(usb_endpoint_bulk_in, 1); 62 | 63 | usb_endpoint_t usb_endpoint_bulk_out = { 64 | .address = 0x02, 65 | .device = &usb_device, 66 | .in = 0, 67 | .out = &usb_endpoint_bulk_out, 68 | .setup_complete = 0, 69 | .transfer_complete = usb_queue_transfer_complete 70 | }; 71 | static USB_DEFINE_QUEUE(usb_endpoint_bulk_out, 1); 72 | 73 | 74 | -------------------------------------------------------------------------------- /firmware/hackrf_usb/usb_endpoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012 Jared Boone 3 | * Copyright 2013 Benjamin Vernoux 4 | * 5 | * This file is part of HackRF. 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2, or (at your option) 10 | * any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; see the file COPYING. If not, write to 19 | * the Free Software Foundation, Inc., 51 Franklin Street, 20 | * Boston, MA 02110-1301, USA. 21 | */ 22 | 23 | #ifndef __USB_ENDPOINT_H__ 24 | #define __USB_ENDPOINT_H__ 25 | 26 | #include 27 | #include 28 | 29 | extern usb_endpoint_t usb_endpoint_control_out; 30 | extern USB_DECLARE_QUEUE(usb_endpoint_control_out); 31 | 32 | extern usb_endpoint_t usb_endpoint_control_in; 33 | extern USB_DECLARE_QUEUE(usb_endpoint_control_in); 34 | 35 | extern usb_endpoint_t usb_endpoint_bulk_in; 36 | extern USB_DECLARE_QUEUE(usb_endpoint_bulk_in); 37 | 38 | extern usb_endpoint_t usb_endpoint_bulk_out; 39 | extern USB_DECLARE_QUEUE(usb_endpoint_bulk_out); 40 | 41 | #endif /* end of include guard: __USB_ENDPOINT_H__ */ 42 | -------------------------------------------------------------------------------- /firmware/toolchain-arm-cortex-m.cmake: -------------------------------------------------------------------------------- 1 | # Copyright 2014 Jared Boone 2 | # 3 | # This file is part of HackRF. 4 | # 5 | # This program is free software; you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation; either version 2, or (at your option) 8 | # any later version. 9 | # 10 | # This program is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with this program; see the file COPYING. If not, write to 17 | # the Free Software Foundation, Inc., 51 Franklin Street, 18 | # Boston, MA 02110-1301, USA. 19 | # 20 | 21 | set(CMAKE_SYSTEM_NAME Generic) 22 | set(CMAKE_SYSTEM_VERSION 1) 23 | set(CMAKE_SYSTEM_PROCESSOR arm) 24 | 25 | set(CMAKE_C_COMPILER arm-none-eabi-gcc) 26 | set(CMAKE_CXX_COMPILER arm-none-eabi-g++) 27 | set(CMAKE_EXE_LINKER_FLAGS_INIT "--specs=nosys.specs") 28 | 29 | execute_process( 30 | COMMAND ${CMAKE_C_COMPILER} -print-file-name=libc.a 31 | OUTPUT_VARIABLE CMAKE_INSTALL_PREFIX 32 | OUTPUT_STRIP_TRAILING_WHITESPACE 33 | ) 34 | get_filename_component(CMAKE_INSTALL_PREFIX 35 | "${CMAKE_INSTALL_PREFIX}" PATH 36 | ) 37 | get_filename_component(CMAKE_INSTALL_PREFIX 38 | "${CMAKE_INSTALL_PREFIX}/.." REALPATH 39 | ) 40 | set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE FILEPATH 41 | "Install path prefix, prepended onto install directories.") 42 | 43 | message(STATUS "Cross-compiling with the gcc-arm-embedded toolchain") 44 | message(STATUS "Toolchain prefix: ${CMAKE_INSTALL_PREFIX}") 45 | 46 | set(CMAKE_ASM_COMPILER ${CMAKE_C_COMPILER}) 47 | #set(CMAKE_LD ${CMAKE_INSTALL_PREFIX}/bin/ld CACHE INTERNAL "ld tool") 48 | set(CMAKE_OBJCOPY ${CMAKE_INSTALL_PREFIX}/bin/objcopy CACHE INTERNAL "objcopy tool") 49 | 50 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_INSTALL_PREFIX}) 51 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 52 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 53 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 54 | -------------------------------------------------------------------------------- /firmware/tools/check_clock.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Copyright 2013 Jared Boone 4 | # 5 | # Interpret the LPC43xx Clock Generation Unit (CGU) FREQ_MON register 6 | # and display the estimated clock frequency. 7 | # 8 | # This file is part of HackRF. 9 | # 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | # 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program; see the file COPYING. If not, write to 22 | # the Free Software Foundation, Inc., 51 Franklin Street, 23 | # Boston, MA 02110-1301, USA. 24 | 25 | """ 26 | Inside GDB: 27 | (gdb) set {int}0x40050014 = 0x09800000 28 | (gdb) x 0x40050014 29 | 0x40050014: 0x091bd000 30 | This script: 31 | ./check_clock.py 0x 0x 32 | """ 33 | 34 | import sys 35 | 36 | clock_source_names = { 37 | 0x00: '32 kHz oscillator', 38 | 0x01: 'IRC', 39 | 0x02: 'ENET_RX_CLK', 40 | 0x03: 'ENET_TX_CLK', 41 | 0x04: 'GP_CLKIN', 42 | 0x06: 'Crystal oscillator', 43 | 0x07: 'PLL0USB', 44 | 0x08: 'PLL0AUDIO', 45 | 0x09: 'PLL1', 46 | 0x0c: 'IDIVA', 47 | 0x0d: 'IDIVB', 48 | 0x0e: 'IDIVC', 49 | 0x0f: 'IDIVD', 50 | 0x10: 'IDIVE', 51 | } 52 | 53 | reg_value = int(sys.argv[1], 16) 54 | rcnt = int(sys.argv[2], 16) 55 | 56 | print('0x%08x' % reg_value) 57 | 58 | rcnt_final = reg_value & 0x1ff 59 | fcnt = (reg_value >> 9) & 0x3fff 60 | clock_source = (reg_value >> 24) & 0x1f 61 | fref = 12e6 62 | 63 | if rcnt_final != 0: 64 | raise RuntimeError('RCNT did not reach 0') 65 | 66 | print('RCNT: %d' % rcnt) 67 | print('FCNT: %d' % fcnt) 68 | print('Fref: %d' % fref) 69 | 70 | clock_hz = fcnt / float(rcnt) * fref 71 | clock_mhz = clock_hz / 1e6 72 | clock_name = clock_source_names[clock_source] if clock_source in clock_source_names else 'Reserved' 73 | print('%s: %.3f MHz' % (clock_name, clock_mhz)) 74 | -------------------------------------------------------------------------------- /firmware/tools/dumb_crc32.py: -------------------------------------------------------------------------------- 1 | 2 | class DumbCRC32(object): 3 | def __init__(self): 4 | self._remainder = 0xffffffff 5 | self._reversed_polynomial = 0xedb88320 6 | self._final_xor = 0xffffffff 7 | 8 | def update(self, data): 9 | bit_count = len(data) * 8 10 | for bit_n in range(bit_count): 11 | bit_in = data[bit_n >> 3] & (1 << (bit_n & 7)) 12 | self._remainder ^= 1 if bit_in != 0 else 0 13 | bit_out = (self._remainder & 1) 14 | self._remainder >>= 1; 15 | if bit_out != 0: 16 | self._remainder ^= self._reversed_polynomial; 17 | 18 | def digest(self): 19 | return self._remainder ^ self._final_xor 20 | 21 | def hexdigest(self): 22 | return '%08x' % self.digest() 23 | -------------------------------------------------------------------------------- /hardware/.gitignore: -------------------------------------------------------------------------------- 1 | # kicad backup files 2 | *.000 3 | *.bak 4 | *.bck 5 | $savepcb.* 6 | 7 | # gerber and drill files 8 | *.gbl 9 | *.gtl 10 | *.gbr 11 | *.gbr 12 | *.gbs 13 | *.gts 14 | *.gbr 15 | *.gbo 16 | *.gto 17 | *.gtp 18 | *.drl 19 | 20 | # other kicad generated files 21 | *.csv 22 | *.svg 23 | *.pdf 24 | -------------------------------------------------------------------------------- /hardware/LNA915/LNA915.lib: -------------------------------------------------------------------------------- 1 | EESchema-LIBRARY Version 2.4 2 | #encoding utf-8 3 | # 4 | #End Library 5 | -------------------------------------------------------------------------------- /hardware/LNA915/README: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2020 Great Scott Gadgets 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | LNA915 is a SAW filter and LNA for the 902 to 928 MHz ISM band. It is designed 22 | for in-line connection between an antenna and HackRF One and is powered by the 23 | HackRF One. 24 | 25 | hardware notes: 26 | 27 | Schematic and layout files were designed in KiCad, an open source electronic 28 | design automation package. 29 | 30 | The PCB is designed to fit the Crystek SMA-KIT-1.5MF housing. 31 | 32 | order of copper layers: 33 | Copper 1: F (front) 34 | Copper 2: In1 35 | Copper 3: In2 36 | Copper 4: B (back) 37 | 38 | PCB description: 4 layer PCB 0.8 mm 39 | Copper 1: 0.035 mm (1 oz) 40 | Dielectric 1-2: 0.2 mm prepreg 41 | Copper 2: 0.0175 mm (0.5 oz) 42 | Dielectric 2-3: 0.265 mm core 43 | Copper 3: 0.0175 mm (0.5 oz) 44 | Dielectric 3-4: 0.2 mm prepreg 45 | Copper 4: 0.035 mm (1 oz) 46 | 47 | 7628 prepreg with Er=4.6 48 | double side solder mask green 49 | double side silkscreen white 50 | 7 mil minimum trace width 51 | 5 mil minimum isolation 52 | 53 | PCBs of this specification are available from JLCPCB (JLC7628 4-layer 0.8 mm stackup). 54 | -------------------------------------------------------------------------------- /hardware/LNA915/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name gsg-modules)(type KiCad)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-modules.pretty)(options "")(descr "")) 3 | (lib (name LNA915)(type KiCad)(uri ${KIPRJMOD}/LNA915.pretty)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/LNA915/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name gsg-symbols)(type Legacy)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-symbols.lib)(options "")(descr "")) 3 | (lib (name LNA915)(type Legacy)(uri ${KIPRJMOD}/LNA915.lib)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/bubblegum/bubblegum.pro: -------------------------------------------------------------------------------- 1 | update=Wed Jul 11 13:27:06 2012 2 | version=1 3 | last_client=pcbnew 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [eeschema] 17 | version=1 18 | LibDir=../kicad 19 | NetFmt=1 20 | HPGLSpd=20 21 | HPGLDm=15 22 | HPGLNum=1 23 | offX_A4=0 24 | offY_A4=0 25 | offX_A3=0 26 | offY_A3=0 27 | offX_A2=0 28 | offY_A2=0 29 | offX_A1=0 30 | offY_A1=0 31 | offX_A0=0 32 | offY_A0=0 33 | offX_A=0 34 | offY_A=0 35 | offX_B=0 36 | offY_B=0 37 | offX_C=0 38 | offY_C=0 39 | offX_D=0 40 | offY_D=0 41 | offX_E=0 42 | offY_E=0 43 | RptD_X=0 44 | RptD_Y=100 45 | RptLab=1 46 | LabSize=60 47 | [eeschema/libraries] 48 | LibName1=power 49 | LibName2=device 50 | LibName3=transistors 51 | LibName4=conn 52 | LibName5=linear 53 | LibName6=regul 54 | LibName7=74xx 55 | LibName8=cmos4000 56 | LibName9=adc-dac 57 | LibName10=memory 58 | LibName11=xilinx 59 | LibName12=special 60 | LibName13=microcontrollers 61 | LibName14=dsp 62 | LibName15=microchip 63 | LibName16=analog_switches 64 | LibName17=motorola 65 | LibName18=texas 66 | LibName19=intel 67 | LibName20=audio 68 | LibName21=interface 69 | LibName22=digital-audio 70 | LibName23=philips 71 | LibName24=display 72 | LibName25=cypress 73 | LibName26=siliconi 74 | LibName27=opto 75 | LibName28=atmel 76 | LibName29=contrib 77 | LibName30=valves 78 | LibName31=hackrf 79 | [pcbnew] 80 | version=1 81 | PadDrlX=0 82 | PadDimH=315 83 | PadDimV=157 84 | BoardThickness=630 85 | TxtPcbV=800 86 | TxtPcbH=600 87 | TxtModV=600 88 | TxtModH=600 89 | TxtModW=120 90 | VEgarde=100 91 | DrawLar=150 92 | EdgeLar=150 93 | TxtLar=120 94 | MSegLar=80 95 | LastNetListRead=bubblegum.net 96 | [pcbnew/libraries] 97 | LibDir=../kicad 98 | LibName1=sockets 99 | LibName2=connect 100 | LibName3=discret 101 | LibName4=pin_array 102 | LibName5=divers 103 | LibName6=libcms 104 | LibName7=display 105 | LibName8=valves 106 | LibName9=led 107 | LibName10=dip_sockets 108 | LibName11=hackrf 109 | -------------------------------------------------------------------------------- /hardware/hackrf-one/PlasticCase_CAD/Case_With_HackRF.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/hackrf-one/PlasticCase_CAD/Case_With_HackRF.png -------------------------------------------------------------------------------- /hardware/hackrf-one/PlasticCase_CAD/HackRF_One_Case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/hackrf-one/PlasticCase_CAD/HackRF_One_Case.png -------------------------------------------------------------------------------- /hardware/hackrf-one/PlasticCase_CAD/README: -------------------------------------------------------------------------------- 1 | This is a case design for HackRF One following the Dangerous Prototypes Sick of 2 | Beige style: 3 | 4 | http://dangerousprototypes.com/docs/Sick_of_Beige_compatible_cases 5 | 6 | The dxf file can be opened by QCad or LibreCAD. 7 | 8 | HackRF_One_Case_With_Button_CutOuts.dxf is a version which have edge cut-outs for the buttons so that 5mm or 6mm standoffs could be used. 9 | 10 | Have fun. 11 | 12 | scateu@gmail.com 13 | -------------------------------------------------------------------------------- /hardware/hackrf-one/README: -------------------------------------------------------------------------------- 1 | Copyright 2012, 2013, 2014 Michael Ossmann 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | HackRF One is a wideband software radio transceiver with a USB interface. 22 | 23 | hardware notes: 24 | 25 | Schematic and layout files were designed in KiCad, an open source electronic 26 | design automation package. 27 | 28 | order of copper layers: 29 | Copper 1: C1F (front) 30 | Copper 2: C2 31 | Copper 3: C3 32 | Copper 4: C4B (back) 33 | 34 | PCB description: 4 layer PCB 0.062 in 35 | Copper 1 0.5 oz foil plated to approximately 0.0017 in 36 | Dielectric 1-2 0.0119 in 37 | Copper 2 1 oz foil (0.0014 in) 38 | Dielectric 2-3 0.0280 in 39 | Copper 3 1 oz foil (0.0014 in) 40 | Dielectric 3-4 0.0119 in 41 | Copper 4 0.5 oz foil plated to approximately 0.0017 in 42 | 43 | FR4 or similar substrate with Er=4.5 (+/- 0.1) 44 | required impedance: 50 ohm (+/- 5%) 20 mil microstrip impedance 45 | double side solder mask green 46 | single side silkscreen white 47 | 6 mil min trace width and 48 | 6 mil min isolation 49 | -------------------------------------------------------------------------------- /hardware/hackrf-one/acrylic_case/HackRF_One_Case_v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/hackrf-one/acrylic_case/HackRF_One_Case_v2.pdf -------------------------------------------------------------------------------- /hardware/hackrf-one/acrylic_case/README.md: -------------------------------------------------------------------------------- 1 | ## Acrylic Case 2 | 3 | This design is licensed under the GPL-2.0 license. 4 | Documentation is licensed under the GPL-2.0 license. 5 | 6 | The vector graphic file provided in this repo was created with Inkscape. 7 | 8 | ### The BOM 9 | 10 | * 4 x 4.5 mm OD Hex Standoffs (Female-Female) / M3-0.5 x 6 mm / Aluminum 11 | * 4 x 4.5 mm OD Hex Standoffs (Female-Female) / M3-0.5 x 5 mm / Aluminum 12 | * 4 x M3-0.5 x 12 mm / Phillips Pan Head Machine Screw 13 | * 4 x M3-0.5 x 5 mm / Phillips Pan Head Machine Screw 14 | 15 | Optional: 16 | * 4 (per neighbor) x 4.5 mm OD Hex Standoffs (Male-Female) / M3-0.5 x 11 mm / Aluminum 17 | 18 | These standoffs are t### The BOM 19 | 20 | * 4 x 4.5 mm OD Hex Standoffs (Female-Female) / M3-0.5 x 6 mm / Aluminum 21 | * 4 x 4.5 mm OD Hex Standoffs (Female-Female) / M3-0.5 x 5 mm / Aluminum 22 | * 4 x M3-0.5 x 12 mm / Phillips Pan Head Machine Screw 23 | * 4 x M3-0.5 x 5 mm / Phillips Pan Head Machine Screw 24 | 25 | Optional: 26 | * 4 (per neighbor) x 4.5 mm OD Hex Standoffs (Male-Female) / M3-0.5 x 11 mm / Aluminum 27 | 28 | These standoffs are to be used if a neighbor is stacked on your HackRF One and you want your case to be stacked above that neighbor. 29 | 30 | ### Assembly Instructions 31 | 32 | Assembly instructions can be found [here.](https://www.greatscottgadgets.com/hackrf/acrylic-case/) 33 | -------------------------------------------------------------------------------- /hardware/hackrf-one/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name hackrf)(type Legacy)(uri ${KIPRJMOD}/../kicad/hackrf.mod)(options "")(descr "")) 3 | (lib (name gsg-modules)(type KiCad)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-modules.pretty)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/hackrf-one/hackrf-one.pro: -------------------------------------------------------------------------------- 1 | update=Mon 06 Jul 2020 07:50:11 PM MDT 2 | version=1 3 | last_client=kicad 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=320 19 | PadDimH=600 20 | PadDimV=600 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | LastNetListRead=hackrf-one.net 33 | [pcbnew/libraries] 34 | LibDir=../kicad 35 | LibName1=sockets 36 | LibName2=connect 37 | LibName3=discret 38 | LibName4=pin_array 39 | LibName5=divers 40 | LibName6=libcms 41 | LibName7=display 42 | LibName8=valves 43 | LibName9=led 44 | LibName10=dip_sockets 45 | LibName11=hackrf 46 | [eeschema] 47 | version=1 48 | LibDir= 49 | [schematic_editor] 50 | version=1 51 | PageLayoutDescrFile= 52 | PlotDirectoryName= 53 | SubpartIdSeparator=0 54 | SubpartFirstId=65 55 | NetFmtName=Pcbnew 56 | SpiceAjustPassiveValues=0 57 | LabSize=60 58 | ERC_TestSimilarLabels=1 59 | -------------------------------------------------------------------------------- /hardware/hackrf-one/hackrf-one.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 4 2 | EELAYER 30 0 3 | EELAYER END 4 | $Descr User 17000 11000 5 | encoding utf-8 6 | Sheet 1 4 7 | Title "HackRF One" 8 | Date "2020-07-21" 9 | Rev "r6" 10 | Comp "Copyright 2012-2020 Great Scott Gadgets" 11 | Comment1 "Michael Ossmann" 12 | Comment2 "Licensed under the CERN-OHL-P v2" 13 | Comment3 "" 14 | Comment4 "" 15 | $EndDescr 16 | $Sheet 17 | S 2550 3300 1050 150 18 | U 503BB638 19 | F0 "frontend" 60 20 | F1 "frontend.sch" 60 21 | $EndSheet 22 | $Sheet 23 | S 2550 2850 1050 150 24 | U 50370666 25 | F0 "baseband" 60 26 | F1 "baseband.sch" 60 27 | $EndSheet 28 | $Sheet 29 | S 2550 2400 1050 150 30 | U 5037043E 31 | F0 "mcu/usb/power" 60 32 | F1 "mcu.sch" 60 33 | $EndSheet 34 | $EndSCHEMATC 35 | -------------------------------------------------------------------------------- /hardware/hackrf-one/sym-lib-table: -------------------------------------------------------------------------------- 1 | (sym_lib_table 2 | (lib (name hackrf)(type Legacy)(uri ${KIPRJMOD}/../kicad/hackrf.lib)(options "")(descr "")) 3 | (lib (name gsg-symbols)(type Legacy)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-symbols.lib)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/jawbreaker/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 Michael Ossmann 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Jawbreaker is the first complete HackRF platform, a wideband software radio 22 | transceiver with a USB interface. 23 | 24 | hardware notes: 25 | 26 | Schematic and layout files were designed in KiCad, an open source electronic 27 | design automation package. 28 | 29 | order of copper layers: 30 | Copper 1: Front 31 | Copper 2: Inner3 32 | Copper 3: Inner2 33 | Copper 4: Back 34 | 35 | PCB description: 4 layer PCB 0.062 in 36 | Copper 1 0.5 oz foil plated to approximately 0.0017 in 37 | Dielectric 1-2 0.0119 in 38 | Copper 2 1 oz foil (0.0014 in) 39 | Dielectric 2-3 0.0280 in 40 | Copper 3 1 oz foil (0.0014 in) 41 | Dielectric 3-4 0.0119 in 42 | Copper 4 0.5 oz foil plated to approximately 0.0017 in 43 | FR4 or similar substrate with Er=4.5 (+/- 0.1) 44 | double side solder mask black 45 | double side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/README: -------------------------------------------------------------------------------- 1 | This is a case design for Jawbreaker following the Dangerous Prototypes Sick of 2 | Beige style: 3 | 4 | http://dangerousprototypes.com/docs/Sick_of_Beige_compatible_cases 5 | -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Bottom.skp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Bottom.skp -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Bottom_laser_cutting_493.3mm_Easy.txt: -------------------------------------------------------------------------------- 1 | For file SoBv1-DP17298-jawbreaker-Bottom.svg: 2 | Laser cutting size 493.3mm => Seeed Studio Difficulty Easy (Length of Cutting line Below 60cm) 3 | -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Top.skp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Top.skp -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker-Top_laser_cutting_1153.3mm_Normal.txt: -------------------------------------------------------------------------------- 1 | For file SoBv1-DP17298-jawbreaker-Top.svg: 2 | Laser cutting size 1153.3 mm => Seeed Studio Difficulty Normal (Length of Cutting line Between 60cm and 180cm) 3 | 4 | -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jawbreaker/SoBv1_DP17298/SoBv1-DP17298-jawbreaker.jpg -------------------------------------------------------------------------------- /hardware/jawbreaker/SoBv1_DP17298/jawbreaker_and_case.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jawbreaker/SoBv1_DP17298/jawbreaker_and_case.png -------------------------------------------------------------------------------- /hardware/jawbreaker/jawbreaker.pro: -------------------------------------------------------------------------------- 1 | update=Wed Mar 27 00:13:41 2013 2 | version=1 3 | last_client=eeschema 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=320 19 | PadDimH=600 20 | PadDimV=600 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | LastNetListRead=jawbreaker.net 33 | [pcbnew/libraries] 34 | LibDir=../kicad 35 | LibName1=sockets 36 | LibName2=connect 37 | LibName3=discret 38 | LibName4=pin_array 39 | LibName5=divers 40 | LibName6=libcms 41 | LibName7=display 42 | LibName8=valves 43 | LibName9=led 44 | LibName10=dip_sockets 45 | LibName11=hackrf 46 | [eeschema] 47 | version=1 48 | LibDir=../kicad 49 | NetFmtName= 50 | RptD_X=0 51 | RptD_Y=100 52 | RptLab=1 53 | LabSize=60 54 | [eeschema/libraries] 55 | LibName1=power 56 | LibName2=device 57 | LibName3=transistors 58 | LibName4=conn 59 | LibName5=linear 60 | LibName6=regul 61 | LibName7=74xx 62 | LibName8=cmos4000 63 | LibName9=adc-dac 64 | LibName10=memory 65 | LibName11=xilinx 66 | LibName12=special 67 | LibName13=microcontrollers 68 | LibName14=dsp 69 | LibName15=microchip 70 | LibName16=analog_switches 71 | LibName17=motorola 72 | LibName18=texas 73 | LibName19=intel 74 | LibName20=audio 75 | LibName21=interface 76 | LibName22=digital-audio 77 | LibName23=philips 78 | LibName24=display 79 | LibName25=cypress 80 | LibName26=siliconi 81 | LibName27=opto 82 | LibName28=atmel 83 | LibName29=contrib 84 | LibName30=valves 85 | LibName31=hackrf 86 | -------------------------------------------------------------------------------- /hardware/jawbreaker/jawbreaker.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 date Sun Jun 9 23:35:01 2013 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:special 14 | LIBS:microcontrollers 15 | LIBS:dsp 16 | LIBS:microchip 17 | LIBS:analog_switches 18 | LIBS:motorola 19 | LIBS:texas 20 | LIBS:intel 21 | LIBS:audio 22 | LIBS:interface 23 | LIBS:digital-audio 24 | LIBS:philips 25 | LIBS:display 26 | LIBS:cypress 27 | LIBS:siliconi 28 | LIBS:opto 29 | LIBS:atmel 30 | LIBS:contrib 31 | LIBS:valves 32 | LIBS:hackrf 33 | LIBS:jawbreaker-cache 34 | EELAYER 27 0 35 | EELAYER END 36 | $Descr User 17000 11000 37 | encoding utf-8 38 | Sheet 1 4 39 | Title "jawbreaker" 40 | Date "10 jun 2013" 41 | Rev "" 42 | Comp "Copyright 2012 Michael Ossmann" 43 | Comment1 "License: GPL v2" 44 | Comment2 "" 45 | Comment3 "" 46 | Comment4 "" 47 | $EndDescr 48 | $Sheet 49 | S 2550 3300 1050 150 50 | U 503BB638 51 | F0 "frontend" 60 52 | F1 "frontend.sch" 60 53 | $EndSheet 54 | $Sheet 55 | S 2550 2850 1050 150 56 | U 50370666 57 | F0 "baseband" 60 58 | F1 "baseband.sch" 60 59 | $EndSheet 60 | $Sheet 61 | S 2550 2400 1050 150 62 | U 5037043E 63 | F0 "mcu/usb/power" 60 64 | F1 "mcu.sch" 60 65 | $EndSheet 66 | $EndSCHEMATC 67 | -------------------------------------------------------------------------------- /hardware/jellybean/JellyBean_TPS62410.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jellybean/JellyBean_TPS62410.ods -------------------------------------------------------------------------------- /hardware/jellybean/JellyBean_pins.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jellybean/JellyBean_pins.png -------------------------------------------------------------------------------- /hardware/jellybean/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 Michael Ossmann 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Jellybean is a microcontroller platform based on the LPC43xx. It is designed 22 | to control Lemondrop. 23 | 24 | hardware notes: 25 | 26 | Schematic and layout files were designed in KiCad, an open source electronic 27 | design automation package. 28 | 29 | order of copper layers: 30 | Front 31 | Inner3 32 | Inner2 33 | Back 34 | 35 | PCB description: 4 layer PCB 1.6 mm 36 | Copper 1 35 um 37 | Dielectric 1-2 0.35 mm 38 | Copper 2 18 um 39 | Dielectric 2-3 0.76 mm 40 | Copper 3 18 um 41 | Dielectric 3-4 0.35 mm 42 | Copper 4 35 um 43 | DE104iML or equivalent substrate (Er=4.42@2.4GHz TanD=0.016) 44 | double side solder mask black 45 | double side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | -------------------------------------------------------------------------------- /hardware/jellybean/jellybean.pro: -------------------------------------------------------------------------------- 1 | update=Sun Apr 15 00:13:35 2012 2 | version=1 3 | last_client=pcbnew 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [eeschema] 17 | version=1 18 | LibDir=../kicad 19 | NetFmt=1 20 | HPGLSpd=20 21 | HPGLDm=15 22 | HPGLNum=1 23 | offX_A4=0 24 | offY_A4=0 25 | offX_A3=0 26 | offY_A3=0 27 | offX_A2=0 28 | offY_A2=0 29 | offX_A1=0 30 | offY_A1=0 31 | offX_A0=0 32 | offY_A0=0 33 | offX_A=0 34 | offY_A=0 35 | offX_B=0 36 | offY_B=0 37 | offX_C=0 38 | offY_C=0 39 | offX_D=0 40 | offY_D=0 41 | offX_E=0 42 | offY_E=0 43 | RptD_X=0 44 | RptD_Y=100 45 | RptLab=1 46 | LabSize=60 47 | [eeschema/libraries] 48 | LibName1=power 49 | LibName2=device 50 | LibName3=transistors 51 | LibName4=conn 52 | LibName5=linear 53 | LibName6=regul 54 | LibName7=74xx 55 | LibName8=cmos4000 56 | LibName9=adc-dac 57 | LibName10=memory 58 | LibName11=xilinx 59 | LibName12=special 60 | LibName13=microcontrollers 61 | LibName14=dsp 62 | LibName15=microchip 63 | LibName16=analog_switches 64 | LibName17=motorola 65 | LibName18=texas 66 | LibName19=intel 67 | LibName20=audio 68 | LibName21=interface 69 | LibName22=digital-audio 70 | LibName23=philips 71 | LibName24=display 72 | LibName25=cypress 73 | LibName26=siliconi 74 | LibName27=opto 75 | LibName28=atmel 76 | LibName29=contrib 77 | LibName30=valves 78 | LibName31=hackrf 79 | [pcbnew] 80 | version=1 81 | PadDrlX=320 82 | PadDimH=600 83 | PadDimV=600 84 | BoardThickness=630 85 | TxtPcbV=800 86 | TxtPcbH=600 87 | TxtModV=600 88 | TxtModH=600 89 | TxtModW=120 90 | VEgarde=100 91 | DrawLar=150 92 | EdgeLar=150 93 | TxtLar=120 94 | MSegLar=150 95 | LastNetListRead=jellybean.net 96 | [pcbnew/libraries] 97 | LibDir=../kicad 98 | LibName1=sockets 99 | LibName2=connect 100 | LibName3=discret 101 | LibName4=pin_array 102 | LibName5=divers 103 | LibName6=libcms 104 | LibName7=display 105 | LibName8=valves 106 | LibName9=led 107 | LibName10=dip_sockets 108 | LibName11=hackrf 109 | -------------------------------------------------------------------------------- /hardware/jellybean/jellybean_BOM.ods: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jellybean/jellybean_BOM.ods -------------------------------------------------------------------------------- /hardware/jellybean/jellybean_board_PCB_layers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jellybean/jellybean_board_PCB_layers.pdf -------------------------------------------------------------------------------- /hardware/jellybean/jellybean_schematic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avian2/hackrf/80e8ed2e0d053d226b65d2786bb6ac9be644a8b4/hardware/jellybean/jellybean_schematic.pdf -------------------------------------------------------------------------------- /hardware/kicad/hackrf.dcm: -------------------------------------------------------------------------------- 1 | EESchema-DOCLIB Version 2.0 Date: Sat Feb 8 13:06:30 2014 2 | # 3 | $CMP CONN_2_SHORTED 4 | D Symbole general de connecteur 5 | K CONN 6 | $ENDCMP 7 | # 8 | $CMP GSG-DIODE-TVS-BI 9 | D Diode zener 10 | K DEV DIODE 11 | $ENDCMP 12 | # 13 | $CMP R-SHORTED 14 | D Resistor with PCB trace short 15 | K R DEV 16 | $ENDCMP 17 | # 18 | $CMP SW_PUSH_SHIELDED 19 | D Push Button with Shield 20 | K Switch 21 | $ENDCMP 22 | # 23 | #End Doc Library 24 | -------------------------------------------------------------------------------- /hardware/lemondrop/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 Michael Ossmann 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Lemondrop is a 2.3 to 2.7 GHz wireless transceiver with a 22 Msps ADC/DAC and 22 | flexible clocking for software radio applications. 23 | 24 | hardware notes: 25 | 26 | Schematic and layout files were designed in KiCad, an open source electronic 27 | design automation package. 28 | 29 | order of copper layers: 30 | Front 31 | Inner3 32 | Inner2 33 | Back 34 | 35 | PCB description: 4 layer PCB 1.6 mm 36 | Copper 1 35 um 37 | Dielectric 1-2 0.35 mm 38 | Copper 2 18 um 39 | Dielectric 2-3 0.76 mm 40 | Copper 3 18 um 41 | Dielectric 3-4 0.35 mm 42 | Copper 4 35 um 43 | DE104iML or equivalent substrate (Er=4.42@2.4GHz TanD=0.016) 44 | double side solder mask black 45 | double side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | -------------------------------------------------------------------------------- /hardware/lemondrop/lemondrop.pro: -------------------------------------------------------------------------------- 1 | update=Fri 16 Mar 2012 10:13:01 AM MDT 2 | version=1 3 | last_client=eeschema 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=150 19 | PadDimH=250 20 | PadDimV=250 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | LastNetListRead=lemondrop.net 33 | [pcbnew/libraries] 34 | LibDir=../kicad 35 | LibName1=sockets 36 | LibName2=connect 37 | LibName3=discret 38 | LibName4=pin_array 39 | LibName5=divers 40 | LibName6=libcms 41 | LibName7=display 42 | LibName8=valves 43 | LibName9=led 44 | LibName10=dip_sockets 45 | LibName11=hackrf 46 | [eeschema] 47 | version=1 48 | LibDir=../kicad 49 | NetFmt=1 50 | HPGLSpd=20 51 | HPGLDm=15 52 | HPGLNum=1 53 | offX_A4=0 54 | offY_A4=0 55 | offX_A3=0 56 | offY_A3=0 57 | offX_A2=0 58 | offY_A2=0 59 | offX_A1=0 60 | offY_A1=0 61 | offX_A0=0 62 | offY_A0=0 63 | offX_A=0 64 | offY_A=0 65 | offX_B=0 66 | offY_B=0 67 | offX_C=0 68 | offY_C=0 69 | offX_D=0 70 | offY_D=0 71 | offX_E=0 72 | offY_E=0 73 | RptD_X=0 74 | RptD_Y=100 75 | RptLab=1 76 | LabSize=40 77 | [eeschema/libraries] 78 | LibName1=power 79 | LibName2=device 80 | LibName3=transistors 81 | LibName4=conn 82 | LibName5=linear 83 | LibName6=regul 84 | LibName7=74xx 85 | LibName8=cmos4000 86 | LibName9=adc-dac 87 | LibName10=memory 88 | LibName11=xilinx 89 | LibName12=special 90 | LibName13=microcontrollers 91 | LibName14=dsp 92 | LibName15=microchip 93 | LibName16=analog_switches 94 | LibName17=motorola 95 | LibName18=texas 96 | LibName19=intel 97 | LibName20=audio 98 | LibName21=interface 99 | LibName22=digital-audio 100 | LibName23=philips 101 | LibName24=display 102 | LibName25=cypress 103 | LibName26=siliconi 104 | LibName27=opto 105 | LibName28=atmel 106 | LibName29=contrib 107 | LibName30=valves 108 | LibName31=hackrf 109 | -------------------------------------------------------------------------------- /hardware/licorice/licorice.pro: -------------------------------------------------------------------------------- 1 | update=Fri May 18 15:00:42 2012 2 | version=1 3 | last_client=pcbnew 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [eeschema] 17 | version=1 18 | LibDir=../kicad 19 | NetFmt=1 20 | HPGLSpd=20 21 | HPGLDm=15 22 | HPGLNum=1 23 | offX_A4=0 24 | offY_A4=0 25 | offX_A3=0 26 | offY_A3=0 27 | offX_A2=0 28 | offY_A2=0 29 | offX_A1=0 30 | offY_A1=0 31 | offX_A0=0 32 | offY_A0=0 33 | offX_A=0 34 | offY_A=0 35 | offX_B=0 36 | offY_B=0 37 | offX_C=0 38 | offY_C=0 39 | offX_D=0 40 | offY_D=0 41 | offX_E=0 42 | offY_E=0 43 | RptD_X=0 44 | RptD_Y=100 45 | RptLab=1 46 | LabSize=60 47 | [eeschema/libraries] 48 | LibName1=power 49 | LibName2=device 50 | LibName3=transistors 51 | LibName4=conn 52 | LibName5=linear 53 | LibName6=regul 54 | LibName7=74xx 55 | LibName8=cmos4000 56 | LibName9=adc-dac 57 | LibName10=memory 58 | LibName11=xilinx 59 | LibName12=special 60 | LibName13=microcontrollers 61 | LibName14=dsp 62 | LibName15=microchip 63 | LibName16=analog_switches 64 | LibName17=motorola 65 | LibName18=texas 66 | LibName19=intel 67 | LibName20=audio 68 | LibName21=interface 69 | LibName22=digital-audio 70 | LibName23=philips 71 | LibName24=display 72 | LibName25=cypress 73 | LibName26=siliconi 74 | LibName27=opto 75 | LibName28=atmel 76 | LibName29=contrib 77 | LibName30=valves 78 | LibName31=hackrf 79 | [pcbnew] 80 | version=1 81 | PadDrlX=320 82 | PadDimH=600 83 | PadDimV=600 84 | BoardThickness=630 85 | TxtPcbV=800 86 | TxtPcbH=600 87 | TxtModV=600 88 | TxtModH=600 89 | TxtModW=120 90 | VEgarde=100 91 | DrawLar=150 92 | EdgeLar=150 93 | TxtLar=120 94 | MSegLar=150 95 | LastNetListRead=licorice.net 96 | [pcbnew/libraries] 97 | LibDir=../kicad 98 | LibName1=sockets 99 | LibName2=connect 100 | LibName3=discret 101 | LibName4=pin_array 102 | LibName5=divers 103 | LibName6=libcms 104 | LibName7=display 105 | LibName8=valves 106 | LibName9=led 107 | LibName10=dip_sockets 108 | LibName11=hackrf 109 | -------------------------------------------------------------------------------- /hardware/lollipop/lollipop.pro: -------------------------------------------------------------------------------- 1 | update=Fri May 18 15:00:42 2012 2 | version=1 3 | last_client=pcbnew 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [eeschema] 17 | version=1 18 | LibDir=../kicad 19 | NetFmt=1 20 | HPGLSpd=20 21 | HPGLDm=15 22 | HPGLNum=1 23 | offX_A4=0 24 | offY_A4=0 25 | offX_A3=0 26 | offY_A3=0 27 | offX_A2=0 28 | offY_A2=0 29 | offX_A1=0 30 | offY_A1=0 31 | offX_A0=0 32 | offY_A0=0 33 | offX_A=0 34 | offY_A=0 35 | offX_B=0 36 | offY_B=0 37 | offX_C=0 38 | offY_C=0 39 | offX_D=0 40 | offY_D=0 41 | offX_E=0 42 | offY_E=0 43 | RptD_X=0 44 | RptD_Y=100 45 | RptLab=1 46 | LabSize=60 47 | [eeschema/libraries] 48 | LibName1=power 49 | LibName2=device 50 | LibName3=transistors 51 | LibName4=conn 52 | LibName5=linear 53 | LibName6=regul 54 | LibName7=74xx 55 | LibName8=cmos4000 56 | LibName9=adc-dac 57 | LibName10=memory 58 | LibName11=xilinx 59 | LibName12=special 60 | LibName13=microcontrollers 61 | LibName14=dsp 62 | LibName15=microchip 63 | LibName16=analog_switches 64 | LibName17=motorola 65 | LibName18=texas 66 | LibName19=intel 67 | LibName20=audio 68 | LibName21=interface 69 | LibName22=digital-audio 70 | LibName23=philips 71 | LibName24=display 72 | LibName25=cypress 73 | LibName26=siliconi 74 | LibName27=opto 75 | LibName28=atmel 76 | LibName29=contrib 77 | LibName30=valves 78 | LibName31=hackrf 79 | [pcbnew] 80 | version=1 81 | PadDrlX=320 82 | PadDimH=600 83 | PadDimV=600 84 | BoardThickness=630 85 | TxtPcbV=800 86 | TxtPcbH=600 87 | TxtModV=600 88 | TxtModH=600 89 | TxtModW=120 90 | VEgarde=100 91 | DrawLar=150 92 | EdgeLar=150 93 | TxtLar=120 94 | MSegLar=150 95 | LastNetListRead=lollipop.net 96 | [pcbnew/libraries] 97 | LibDir=../kicad 98 | LibName1=sockets 99 | LibName2=connect 100 | LibName3=discret 101 | LibName4=pin_array 102 | LibName5=divers 103 | LibName6=libcms 104 | LibName7=display 105 | LibName8=valves 106 | LibName9=led 107 | LibName10=dip_sockets 108 | LibName11=hackrf 109 | -------------------------------------------------------------------------------- /hardware/marzipan/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 - 2016 Great Scott Gadgets 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Marzipan is a wideband software radio transceiver capable of running Linux. 22 | 23 | hardware notes: 24 | 25 | Schematic and layout files were designed in KiCad, an open source electronic 26 | design automation package. 27 | 28 | order of copper layers: 29 | Copper 1: C1F (front) 30 | Copper 2: C2 31 | Copper 3: C3 32 | Copper 4: C4B (back) 33 | 34 | PCB description: 4 layer PCB 0.062 in 35 | Copper 1 0.5 oz foil plated to approximately 0.0017 in 36 | Dielectric 1-2 0.0119 in 37 | Copper 2 1 oz foil (0.0014 in) 38 | Dielectric 2-3 0.0280 in 39 | Copper 3 1 oz foil (0.0014 in) 40 | Dielectric 3-4 0.0119 in 41 | Copper 4 0.5 oz foil plated to approximately 0.0017 in 42 | 43 | FR4 or similar substrate with Er=4.5 (+/- 0.1) 44 | double side solder mask green 45 | single side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | -------------------------------------------------------------------------------- /hardware/marzipan/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name hackrf)(type Legacy)(uri ${KIPRJMOD}/../kicad/hackrf.mod)(options "")(descr "")) 3 | (lib (name gsg-modules)(type KiCad)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-modules.pretty)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/marzipan/marzipan.pro: -------------------------------------------------------------------------------- 1 | update=Wed 13 Jul 2016 05:14:22 PM MDT 2 | version=1 3 | last_client=kicad 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=320 19 | PadDimH=600 20 | PadDimV=600 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | LastNetListRead=marzipan.net 33 | [pcbnew/libraries] 34 | LibDir=../kicad 35 | LibName1=sockets 36 | LibName2=connect 37 | LibName3=discret 38 | LibName4=pin_array 39 | LibName5=divers 40 | LibName6=libcms 41 | LibName7=display 42 | LibName8=valves 43 | LibName9=led 44 | LibName10=dip_sockets 45 | LibName11=hackrf 46 | [eeschema] 47 | version=1 48 | LibDir=../kicad 49 | [eeschema/libraries] 50 | LibName1=power 51 | LibName2=device 52 | LibName3=transistors 53 | LibName4=conn 54 | LibName5=linear 55 | LibName6=regul 56 | LibName7=74xx 57 | LibName8=cmos4000 58 | LibName9=adc-dac 59 | LibName10=memory 60 | LibName11=xilinx 61 | LibName12=microcontrollers 62 | LibName13=dsp 63 | LibName14=microchip 64 | LibName15=analog_switches 65 | LibName16=motorola 66 | LibName17=texas 67 | LibName18=intel 68 | LibName19=audio 69 | LibName20=interface 70 | LibName21=digital-audio 71 | LibName22=philips 72 | LibName23=display 73 | LibName24=cypress 74 | LibName25=siliconi 75 | LibName26=opto 76 | LibName27=atmel 77 | LibName28=contrib 78 | LibName29=valves 79 | LibName30=hackrf 80 | -------------------------------------------------------------------------------- /hardware/marzipan/marzipan.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:hackrf 32 | LIBS:marzipan-cache 33 | EELAYER 25 0 34 | EELAYER END 35 | $Descr User 17000 11000 36 | encoding utf-8 37 | Sheet 1 4 38 | Title "Marzipan" 39 | Date "13 feb 2014" 40 | Rev "" 41 | Comp "Copyright 2012 - 2016 Great Scott Gadgets" 42 | Comment1 "License: GPL v2" 43 | Comment2 "" 44 | Comment3 "" 45 | Comment4 "" 46 | $EndDescr 47 | $Sheet 48 | S 2550 3300 1050 150 49 | U 503BB638 50 | F0 "frontend" 60 51 | F1 "frontend.sch" 60 52 | $EndSheet 53 | $Sheet 54 | S 2550 2850 1050 150 55 | U 50370666 56 | F0 "baseband" 60 57 | F1 "baseband.sch" 60 58 | $EndSheet 59 | $Sheet 60 | S 2550 2400 1050 150 61 | U 5037043E 62 | F0 "mcu/usb/power" 60 63 | F1 "mcu.sch" 60 64 | $EndSheet 65 | $EndSCHEMATC 66 | -------------------------------------------------------------------------------- /hardware/neapolitan/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 - 2016 Great Scott Gadgets 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Neapolitan is an add-on for HackRF One enabling full-duplex operation. 22 | 23 | hardware notes: 24 | 25 | Schematic and layout files were designed in KiCad, an open source electronic 26 | design automation package. 27 | 28 | order of copper layers: 29 | Copper 1: C1F (front) 30 | Copper 2: C2 31 | Copper 3: C3 32 | Copper 4: C4B (back) 33 | 34 | PCB description: 4 layer PCB 0.062 in 35 | Copper 1 0.5 oz foil plated to approximately 0.0017 in 36 | Dielectric 1-2 0.0119 in 37 | Copper 2 1 oz foil (0.0014 in) 38 | Dielectric 2-3 0.0280 in 39 | Copper 3 1 oz foil (0.0014 in) 40 | Dielectric 3-4 0.0119 in 41 | Copper 4 0.5 oz foil plated to approximately 0.0017 in 42 | 43 | FR4 or similar substrate with Er=4.5 (+/- 0.1) 44 | double side solder mask green 45 | single side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | -------------------------------------------------------------------------------- /hardware/neapolitan/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name hackrf)(type Legacy)(uri ${KIPRJMOD}/../kicad/hackrf.mod)(options "")(descr "")) 3 | (lib (name gsg-modules)(type KiCad)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-modules.pretty)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/neapolitan/neapolitan.pro: -------------------------------------------------------------------------------- 1 | update=Fri 02 Sep 2016 06:05:25 PM MDT 2 | version=1 3 | last_client=kicad 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=320 19 | PadDimH=600 20 | PadDimV=600 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | LastNetListRead=neapolitan.net 33 | [pcbnew/libraries] 34 | LibDir=../kicad 35 | LibName1=sockets 36 | LibName2=connect 37 | LibName3=discret 38 | LibName4=pin_array 39 | LibName5=divers 40 | LibName6=libcms 41 | LibName7=display 42 | LibName8=valves 43 | LibName9=led 44 | LibName10=dip_sockets 45 | LibName11=hackrf 46 | [eeschema] 47 | version=1 48 | LibDir=../kicad;../gsg-kicad-lib 49 | [eeschema/libraries] 50 | LibName1=power 51 | LibName2=device 52 | LibName3=transistors 53 | LibName4=conn 54 | LibName5=linear 55 | LibName6=regul 56 | LibName7=74xx 57 | LibName8=cmos4000 58 | LibName9=adc-dac 59 | LibName10=memory 60 | LibName11=xilinx 61 | LibName12=microcontrollers 62 | LibName13=dsp 63 | LibName14=microchip 64 | LibName15=analog_switches 65 | LibName16=motorola 66 | LibName17=texas 67 | LibName18=intel 68 | LibName19=audio 69 | LibName20=interface 70 | LibName21=digital-audio 71 | LibName22=philips 72 | LibName23=display 73 | LibName24=cypress 74 | LibName25=siliconi 75 | LibName26=opto 76 | LibName27=atmel 77 | LibName28=contrib 78 | LibName29=valves 79 | LibName30=hackrf 80 | LibName31=gsg-symbols 81 | -------------------------------------------------------------------------------- /hardware/neapolitan/neapolitan.sch: -------------------------------------------------------------------------------- 1 | EESchema Schematic File Version 2 2 | LIBS:power 3 | LIBS:device 4 | LIBS:transistors 5 | LIBS:conn 6 | LIBS:linear 7 | LIBS:regul 8 | LIBS:74xx 9 | LIBS:cmos4000 10 | LIBS:adc-dac 11 | LIBS:memory 12 | LIBS:xilinx 13 | LIBS:microcontrollers 14 | LIBS:dsp 15 | LIBS:microchip 16 | LIBS:analog_switches 17 | LIBS:motorola 18 | LIBS:texas 19 | LIBS:intel 20 | LIBS:audio 21 | LIBS:interface 22 | LIBS:digital-audio 23 | LIBS:philips 24 | LIBS:display 25 | LIBS:cypress 26 | LIBS:siliconi 27 | LIBS:opto 28 | LIBS:atmel 29 | LIBS:contrib 30 | LIBS:valves 31 | LIBS:hackrf 32 | LIBS:gsg-symbols 33 | LIBS:neapolitan-cache 34 | EELAYER 25 0 35 | EELAYER END 36 | $Descr User 17000 11000 37 | encoding utf-8 38 | Sheet 1 4 39 | Title "Neapolitan" 40 | Date "13 feb 2014" 41 | Rev "" 42 | Comp "Copyright 2012 - 2016 Great Scott Gadgets" 43 | Comment1 "License: GPL v2" 44 | Comment2 "" 45 | Comment3 "" 46 | Comment4 "" 47 | $EndDescr 48 | $Sheet 49 | S 2550 3300 1050 150 50 | U 503BB638 51 | F0 "frontend" 60 52 | F1 "frontend.sch" 60 53 | $EndSheet 54 | $Sheet 55 | S 2550 2850 1050 150 56 | U 50370666 57 | F0 "baseband" 60 58 | F1 "baseband.sch" 60 59 | $EndSheet 60 | $Sheet 61 | S 2550 2400 1050 150 62 | U 5037043E 63 | F0 "mcu/usb/power" 60 64 | F1 "mcu.sch" 60 65 | $EndSheet 66 | $EndSCHEMATC 67 | -------------------------------------------------------------------------------- /hardware/operacake/README: -------------------------------------------------------------------------------- 1 | Copyright 2012 - 2016 Great Scott Gadgets 2 | 3 | These files are part of HackRF. 4 | 5 | This is a free hardware design; you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation; either version 2, or (at your option) 8 | any later version. 9 | 10 | This design is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with this design; see the file COPYING. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, 18 | Boston, MA 02110-1301, USA. 19 | 20 | 21 | Opera Cake is an RF switching add-on for HackRF One. 22 | 23 | hardware notes: 24 | 25 | Schematic and layout files were designed in KiCad, an open source electronic 26 | design automation package. 27 | 28 | order of copper layers: 29 | Copper 1: C1F (front) 30 | Copper 2: C2 31 | Copper 3: C3 32 | Copper 4: C4B (back) 33 | 34 | PCB description: 4 layer PCB 0.0646 in 35 | Copper 1: 1 oz copper (1.4 mil) 36 | Dielectric 1-2: 6.7 mil prepreg 37 | Copper 2: 0.5 oz copper (0.7 mil) 38 | Dielectric 2-3: 47 mil core 39 | Copper 3: 0.5 oz copper (0.7 mil) 40 | Dielectric 3-4: 6.7 mil prepreg 41 | Copper 4: 1 oz copper (1.4 mil) 42 | 43 | FR408 or similar substrate with Er=3.66 (+/- 0.1) 44 | double side solder mask green 45 | double side silkscreen white 46 | 6 mil min trace width and 47 | 6 mil min isolation 48 | 49 | PCBs of this specification are available from OSH Park. 50 | -------------------------------------------------------------------------------- /hardware/operacake/fp-lib-table: -------------------------------------------------------------------------------- 1 | (fp_lib_table 2 | (lib (name hackrf)(type Legacy)(uri ${KIPRJMOD}/../kicad/hackrf.mod)(options "")(descr "")) 3 | (lib (name gsg-modules)(type KiCad)(uri ${KIPRJMOD}/../gsg-kicad-lib/gsg-modules.pretty)(options "")(descr "")) 4 | ) 5 | -------------------------------------------------------------------------------- /hardware/operacake/operacake.pro: -------------------------------------------------------------------------------- 1 | update=Fri 30 Sep 2016 04:09:24 PM MDT 2 | version=1 3 | last_client=kicad 4 | [cvpcb] 5 | version=1 6 | NetITyp=0 7 | NetIExt=.net 8 | PkgIExt=.pkg 9 | NetDir= 10 | LibDir= 11 | NetType=0 12 | [cvpcb/libraries] 13 | EquName1=devcms 14 | [general] 15 | version=1 16 | [pcbnew] 17 | version=1 18 | PadDrlX=320 19 | PadDimH=600 20 | PadDimV=600 21 | BoardThickness=630 22 | TxtPcbV=800 23 | TxtPcbH=600 24 | TxtModV=600 25 | TxtModH=600 26 | TxtModW=120 27 | VEgarde=100 28 | DrawLar=150 29 | EdgeLar=150 30 | TxtLar=120 31 | MSegLar=150 32 | [pcbnew/libraries] 33 | LibDir=../kicad 34 | LibName1=sockets 35 | LibName2=connect 36 | LibName3=discret 37 | LibName4=pin_array 38 | LibName5=divers 39 | LibName6=libcms 40 | LibName7=display 41 | LibName8=valves 42 | LibName9=led 43 | LibName10=dip_sockets 44 | LibName11=hackrf 45 | [eeschema] 46 | version=1 47 | LibDir=../kicad;../gsg-kicad-lib 48 | [eeschema/libraries] 49 | LibName1=gsg-symbols 50 | LibName2=hackrf 51 | LibName3=power 52 | LibName4=device 53 | LibName5=transistors 54 | LibName6=conn 55 | LibName7=linear 56 | LibName8=regul 57 | LibName9=74xx 58 | LibName10=cmos4000 59 | LibName11=adc-dac 60 | LibName12=memory 61 | LibName13=xilinx 62 | LibName14=microcontrollers 63 | LibName15=dsp 64 | LibName16=microchip 65 | LibName17=analog_switches 66 | LibName18=motorola 67 | LibName19=texas 68 | LibName20=intel 69 | LibName21=audio 70 | LibName22=interface 71 | LibName23=digital-audio 72 | LibName24=philips 73 | LibName25=display 74 | LibName26=cypress 75 | LibName27=siliconi 76 | LibName28=opto 77 | LibName29=atmel 78 | LibName30=contrib 79 | LibName31=valves 80 | -------------------------------------------------------------------------------- /host/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | #top dir cmake project for libhackrf + tools 2 | 3 | cmake_minimum_required(VERSION 2.8) 4 | project (HackRF C) 5 | 6 | set(CMAKE_C_FLAGS "$ENV{CFLAGS}" CACHE STRING "C Flags") 7 | 8 | add_subdirectory(libhackrf) 9 | add_subdirectory(hackrf-tools) 10 | 11 | ######################################################################## 12 | # Create uninstall target 13 | ######################################################################## 14 | 15 | configure_file( 16 | ${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in 17 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 18 | @ONLY) 19 | 20 | 21 | add_custom_target(uninstall 22 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 23 | ) 24 | -------------------------------------------------------------------------------- /host/cmake/cmake_uninstall.cmake.in: -------------------------------------------------------------------------------- 1 | # http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F 2 | 3 | IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 4 | MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") 5 | ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") 6 | 7 | FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) 8 | STRING(REGEX REPLACE "\n" ";" files "${files}") 9 | FOREACH(file ${files}) 10 | MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") 11 | IF(EXISTS "$ENV{DESTDIR}${file}") 12 | EXEC_PROGRAM( 13 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14 | OUTPUT_VARIABLE rm_out 15 | RETURN_VALUE rm_retval 16 | ) 17 | IF(NOT "${rm_retval}" STREQUAL 0) 18 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 19 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 20 | ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}") 21 | EXEC_PROGRAM( 22 | "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 23 | OUTPUT_VARIABLE rm_out 24 | RETURN_VALUE rm_retval 25 | ) 26 | IF(NOT "${rm_retval}" STREQUAL 0) 27 | MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") 28 | ENDIF(NOT "${rm_retval}" STREQUAL 0) 29 | ELSE(EXISTS "$ENV{DESTDIR}${file}") 30 | MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") 31 | ENDIF(EXISTS "$ENV{DESTDIR}${file}") 32 | ENDFOREACH(file) 33 | -------------------------------------------------------------------------------- /host/cmake/modules/FindFFTW.cmake: -------------------------------------------------------------------------------- 1 | # - Find FFTW 2 | # Find the native FFTW includes and library 3 | # 4 | # FFTW_INCLUDES - where to find fftw3.h 5 | # FFTW_LIBRARIES - List of libraries when using FFTW. 6 | # FFTW_FOUND - True if FFTW found. 7 | 8 | if (FFTW_INCLUDES) 9 | # Already in cache, be silent 10 | set (FFTW_FIND_QUIETLY TRUE) 11 | endif (FFTW_INCLUDES) 12 | 13 | find_path (FFTW_INCLUDES fftw3.h) 14 | 15 | IF (WIN32) 16 | include_directories(${FFTW_INCLUDES}) 17 | find_library (FFTW_LIBRARIES NAMES ${FFTW_LIBRARIES}) 18 | ELSE(WIN32) 19 | find_library (FFTW_LIBRARIES NAMES fftw3) 20 | ENDIF(WIN32) 21 | 22 | 23 | 24 | 25 | # handle the QUIETLY and REQUIRED arguments and set FFTW_FOUND to TRUE if 26 | # all listed variables are TRUE 27 | include (FindPackageHandleStandardArgs) 28 | find_package_handle_standard_args (FFTW DEFAULT_MSG FFTW_LIBRARIES FFTW_INCLUDES) 29 | 30 | mark_as_advanced (FFTW_LIBRARIES FFTW_INCLUDES) 31 | -------------------------------------------------------------------------------- /host/cmake/modules/FindLIBHACKRF.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the libhackrf library 2 | # Once done this defines 3 | # 4 | # LIBHACKRF_FOUND - system has libhackrf 5 | # LIBHACKRF_INCLUDE_DIR - the libhackrf include directory 6 | # LIBHACKRF_LIBRARIES - Link these to use libhackrf 7 | 8 | # Copyright (c) 2013 Benjamin Vernoux 9 | # 10 | 11 | 12 | if (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES) 13 | 14 | # in cache already 15 | set(LIBHACKRF_FOUND TRUE) 16 | 17 | else (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES) 18 | IF (NOT WIN32) 19 | # use pkg-config to get the directories and then use these values 20 | # in the FIND_PATH() and FIND_LIBRARY() calls 21 | find_package(PkgConfig) 22 | pkg_check_modules(PC_LIBHACKRF QUIET libhackrf) 23 | ENDIF(NOT WIN32) 24 | 25 | FIND_PATH(LIBHACKRF_INCLUDE_DIR 26 | NAMES hackrf.h 27 | HINTS $ENV{LIBHACKRF_DIR}/include ${PC_LIBHACKRF_INCLUDEDIR} 28 | PATHS /usr/local/include/libhackrf /usr/include/libhackrf /usr/local/include 29 | /usr/include ${CMAKE_SOURCE_DIR}/../libhackrf/src 30 | /opt/local/include/libhackrf 31 | ${LIBHACKRF_INCLUDE_DIR} 32 | ) 33 | 34 | set(libhackrf_library_names hackrf) 35 | 36 | FIND_LIBRARY(LIBHACKRF_LIBRARIES 37 | NAMES ${libhackrf_library_names} 38 | HINTS $ENV{LIBHACKRF_DIR}/lib ${PC_LIBHACKRF_LIBDIR} 39 | PATHS /usr/local/lib /usr/lib /opt/local/lib ${PC_LIBHACKRF_LIBDIR} ${PC_LIBHACKRF_LIBRARY_DIRS} ${CMAKE_SOURCE_DIR}/../libhackrf/src 40 | ) 41 | 42 | if(LIBHACKRF_INCLUDE_DIR) 43 | set(CMAKE_REQUIRED_INCLUDES ${LIBHACKRF_INCLUDE_DIR}) 44 | endif() 45 | 46 | if(LIBHACKRF_LIBRARIES) 47 | set(CMAKE_REQUIRED_LIBRARIES ${LIBHACKRF_LIBRARIES}) 48 | endif() 49 | 50 | include(FindPackageHandleStandardArgs) 51 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIR) 52 | 53 | MARK_AS_ADVANCED(LIBHACKRF_INCLUDE_DIR LIBHACKRF_LIBRARIES) 54 | 55 | endif (LIBHACKRF_INCLUDE_DIR AND LIBHACKRF_LIBRARIES) -------------------------------------------------------------------------------- /host/cmake/modules/FindUSB1.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find the freetype library 2 | # Once done this defines 3 | # 4 | # LIBUSB_FOUND - system has libusb 5 | # LIBUSB_INCLUDE_DIR - the libusb include directory 6 | # LIBUSB_LIBRARIES - Link these to use libusb 7 | 8 | # Copyright (c) 2006, 2008 Laurent Montel, 9 | # 10 | # Redistribution and use is allowed according to the terms of the BSD license. 11 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 12 | 13 | 14 | if (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 15 | 16 | # in cache already 17 | set(LIBUSB_FOUND TRUE) 18 | 19 | else (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) 20 | IF (NOT WIN32) 21 | # use pkg-config to get the directories and then use these values 22 | # in the FIND_PATH() and FIND_LIBRARY() calls 23 | find_package(PkgConfig) 24 | pkg_check_modules(PC_LIBUSB libusb-1.0) 25 | ENDIF(NOT WIN32) 26 | 27 | set(LIBUSB_LIBRARY_NAME usb-1.0) 28 | IF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") 29 | set(LIBUSB_LIBRARY_NAME usb) 30 | ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") 31 | 32 | FIND_PATH(LIBUSB_INCLUDE_DIR libusb.h 33 | PATHS ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDE_DIRS}) 34 | 35 | FIND_LIBRARY(LIBUSB_LIBRARIES NAMES ${LIBUSB_LIBRARY_NAME} 36 | PATHS ${PC_LIBUSB_LIBDIR} ${PC_LIBUSB_LIBRARY_DIRS}) 37 | 38 | include(FindPackageHandleStandardArgs) 39 | FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIR) 40 | 41 | MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARIES) 42 | 43 | endif (LIBUSB_INCLUDE_DIR AND LIBUSB_LIBRARIES) -------------------------------------------------------------------------------- /host/cmake/set_release.cmake: -------------------------------------------------------------------------------- 1 | #set(RELEASE "") 2 | 3 | if(NOT DEFINED RELEASE) 4 | execute_process( 5 | COMMAND git log -n 1 --format=%h 6 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 7 | RESULT_VARIABLE GIT_EXIT_VALUE 8 | ERROR_QUIET 9 | OUTPUT_VARIABLE GIT_VERSION 10 | OUTPUT_STRIP_TRAILING_WHITESPACE 11 | ) 12 | if (GIT_EXIT_VALUE) 13 | set(RELEASE "unknown") 14 | else (GIT_EXIT_VALUE) 15 | execute_process( 16 | COMMAND git status -s --untracked-files=no 17 | OUTPUT_VARIABLE DIRTY 18 | ) 19 | if ( NOT "${DIRTY}" STREQUAL "" ) 20 | set(DIRTY_FLAG "*") 21 | else() 22 | set(DIRTY_FLAG "") 23 | endif() 24 | set(RELEASE "git-${GIT_VERSION}${DIRTY_FLAG}") 25 | endif (GIT_EXIT_VALUE) 26 | endif() 27 | -------------------------------------------------------------------------------- /host/hackrf-tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Jared Boone 2 | # Copyright 2013 Benjamin Vernoux 3 | # 4 | # This file is part of HackRF. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | # Based heavily upon the libftdi cmake setup. 23 | 24 | cmake_minimum_required(VERSION 2.8) 25 | project(hackrf-tools C) 26 | set(PACKAGE hackrf-tools) 27 | include(${PROJECT_SOURCE_DIR}/../cmake/set_release.cmake) 28 | add_definitions(-DTOOL_RELEASE="${RELEASE}") 29 | set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/../cmake/modules) 30 | 31 | if(MSVC) 32 | include_directories(getopt) 33 | add_definitions(/D _CRT_SECURE_NO_WARNINGS) 34 | else() 35 | add_definitions(-Wall) 36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") 37 | endif() 38 | 39 | if(NOT libhackrf_SOURCE_DIR) 40 | find_package(LIBHACKRF REQUIRED) 41 | include_directories(${LIBHACKRF_INCLUDE_DIR}) 42 | else() 43 | include_directories(${libhackrf_SOURCE_DIR}/src) 44 | endif() 45 | 46 | if(MSVC) 47 | set(THREADS_USE_PTHREADS_WIN32 true) 48 | else() 49 | add_definitions(-Wall) 50 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu90") 51 | 52 | INCLUDE(TestBigEndian) 53 | TEST_BIG_ENDIAN(BIGENDIAN) 54 | if(${BIGENDIAN}) 55 | add_definitions(-DHACKRF_BIG_ENDIAN) 56 | endif(${BIGENDIAN}) 57 | endif() 58 | 59 | include_directories(${THREADS_PTHREADS_INCLUDE_DIR}) 60 | add_subdirectory(src) 61 | 62 | ######################################################################## 63 | # Create uninstall target 64 | ######################################################################## 65 | 66 | if(NOT HackRF_SOURCE_DIR) 67 | configure_file( 68 | ${PROJECT_SOURCE_DIR}/../cmake/cmake_uninstall.cmake.in 69 | ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 70 | @ONLY) 71 | 72 | add_custom_target(uninstall 73 | ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake 74 | ) 75 | endif() 76 | -------------------------------------------------------------------------------- /host/hackrf-tools/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright 2012 Jared Boone 2 | # Copyright 2013 Benjamin Vernoux 3 | # 4 | # This file is part of HackRF. 5 | # 6 | # This program is free software; you can redistribute it and/or modify 7 | # it under the terms of the GNU General Public License as published by 8 | # the Free Software Foundation; either version 2, or (at your option) 9 | # any later version. 10 | # 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | # GNU General Public License for more details. 15 | # 16 | # You should have received a copy of the GNU General Public License 17 | # along with this program; see the file COPYING. If not, write to 18 | # the Free Software Foundation, Inc., 51 Franklin Street, 19 | # Boston, MA 02110-1301, USA. 20 | # 21 | 22 | # Based heavily upon the libftdi cmake setup. 23 | 24 | set(INSTALL_DEFAULT_BINDIR "bin" CACHE STRING "Appended to CMAKE_INSTALL_PREFIX") 25 | 26 | find_package(FFTW REQUIRED) 27 | include_directories(${FFTW_INCLUDES}) 28 | get_filename_component(FFTW_LIBRARY_DIRS ${FFTW_LIBRARIES} DIRECTORY) 29 | link_directories(${FFTW_LIBRARY_DIRS}) 30 | 31 | SET(TOOLS 32 | hackrf_transfer 33 | hackrf_spiflash 34 | hackrf_cpldjtag 35 | hackrf_info 36 | hackrf_debug 37 | hackrf_clock 38 | hackrf_sweep 39 | hackrf_operacake 40 | hackrf_tcp 41 | hackrf_fm 42 | ) 43 | 44 | if(MSVC) 45 | add_library(libgetopt_static STATIC 46 | ../getopt/getopt.c 47 | ) 48 | LIST(APPEND TOOLS_LINK_LIBS ${FFTW_LIBRARIES}) 49 | else() 50 | LIST(APPEND TOOLS_LINK_LIBS m fftw3f) 51 | endif() 52 | 53 | if(NOT libhackrf_SOURCE_DIR) 54 | include_directories(${LIBHACKRF_INCLUDE_DIR}) 55 | LIST(APPEND TOOLS_LINK_LIBS ${LIBHACKRF_LIBRARIES}) 56 | else() 57 | LIST(APPEND TOOLS_LINK_LIBS hackrf) 58 | endif() 59 | 60 | if(MSVC) 61 | LIST(APPEND TOOLS_LINK_LIBS libgetopt_static) 62 | else() 63 | LIST(APPEND TOOLS_LINK_LIBS m) 64 | endif() 65 | 66 | foreach(tool ${TOOLS}) 67 | add_executable(${tool} ${tool}.c) 68 | target_link_libraries(${tool} ${TOOLS_LINK_LIBS}) 69 | install(TARGETS ${tool} RUNTIME DESTINATION ${INSTALL_DEFAULT_BINDIR}) 70 | endforeach(tool) 71 | -------------------------------------------------------------------------------- /host/libhackrf/53-hackrf.rules: -------------------------------------------------------------------------------- 1 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="604b", SYMLINK+="hackrf-jawbreaker-%k", MODE="660", GROUP="plugdev" 2 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="6089", SYMLINK+="hackrf-one-%k", MODE="660", GROUP="plugdev" 3 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="cc15", SYMLINK+="rad1o-%k", MODE="660", GROUP="plugdev" 4 | ATTR{idVendor}=="1fc9", ATTR{idProduct}=="000c", SYMLINK+="nxp-dfu-%k", MODE="660", GROUP="plugdev" 5 | -------------------------------------------------------------------------------- /host/libhackrf/53-hackrf.rules.in: -------------------------------------------------------------------------------- 1 | # HackRF Jawbreaker 2 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="604b", SYMLINK+="hackrf-jawbreaker-%k", MODE="660", GROUP="@HACKRF_GROUP@" 3 | # HackRF One 4 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="6089", SYMLINK+="hackrf-one-%k", MODE="660", GROUP="@HACKRF_GROUP@" 5 | # rad1o 6 | ATTR{idVendor}=="1d50", ATTR{idProduct}=="cc15", SYMLINK+="rad1o-%k", MODE="660", GROUP="@HACKRF_GROUP@" 7 | # NXP Semiconductors DFU mode (HackRF and rad1o) 8 | ATTR{idVendor}=="1fc9", ATTR{idProduct}=="000c", SYMLINK+="nxp-dfu-%k", MODE="660", GROUP="@HACKRF_GROUP@" 9 | # rad1o "full flash" mode 10 | KERNEL=="sd?", SUBSYSTEM=="block", ENV{ID_VENDOR_ID}=="1fc9", ENV{ID_MODEL_ID}=="0042", SYMLINK+="rad1o-flash-%k", MODE="660", GROUP="@HACKRF_GROUP@" 11 | # rad1o flash disk 12 | KERNEL=="sd?", SUBSYSTEM=="block", ENV{ID_VENDOR_ID}=="1fc9", ENV{ID_MODEL_ID}=="0082", SYMLINK+="rad1o-msc-%k", MODE="660", GROUP="@HACKRF_GROUP@" 13 | # 14 | -------------------------------------------------------------------------------- /host/libhackrf/libhackrf.pc.in: -------------------------------------------------------------------------------- 1 | prefix=@prefix@ 2 | exec_prefix=@exec_prefix@ 3 | libdir=@libdir@ 4 | includedir=@includedir@ 5 | 6 | Name: HackRF Library 7 | Description: C Utility Library 8 | Version: @VERSION@ 9 | Cflags: -I${includedir} -I${includedir}/libhackrf @HACKRF_PC_CFLAGS@ 10 | Libs: -L${libdir} -lhackrf 11 | Libs.private: @HACKRF_PC_LIBS@ 12 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | ### Steps to reproduce 2 | 1. 3 | 2. 4 | 3. 5 | 6 | ### Expected behaviour 7 | Tell us what you expect should happen 8 | 9 | ### Actual behaviour 10 | Tell us what happens instead 11 | 12 | ### Version information 13 | **Operating system**: 14 | 15 | **hackrf_info output:** 16 | 17 | If you are reporting a problem that involves third party software 18 | (GNU Radio, Gqrx, etc), please report the version here. 19 | 20 | ### Output 21 | ``` 22 | Insert any commandline or build output here 23 | ``` 24 | -------------------------------------------------------------------------------- /tools/deploy-nightly.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | PUBLICATION_BRANCH=master 3 | # set -x 4 | cd $HOME 5 | # Checkout the branch 6 | git clone --branch=$PUBLICATION_BRANCH https://${GITHUB_TOKEN}@github.com/${ARTEFACT_REPO}.git publish 7 | cd publish 8 | # Update pages 9 | cp $ARTEFACT_BASE/$BUILD_NAME.tar.xz . 10 | # Write index page 11 | cd $TRAVIS_BUILD_DIR 12 | COMMITS=`git log --oneline | awk '{print $1}'` 13 | cd $HOME/publish 14 | echo " 15 | 16 | 17 | 18 | HackRF Nightly Builds 19 | 20 | 21 |

HackRF Nightly Builds

22 | " > index.html 23 | 24 | for commit in $COMMITS; do 25 | FILENAME=`find . -maxdepth 1 -name "*-$commit.tar.xz"` 26 | if [ "$FILENAME" != "" ]; then 27 | FN=${FILENAME:2} 28 | echo "$FN
" >> index.html 29 | fi 30 | 31 | done 32 | 33 | echo " 34 | 35 | " >> index.html 36 | 37 | # Commit and push latest version 38 | git add $BUILD_NAME.tar.xz index.html 39 | git config user.name "Travis" 40 | git config user.email "travis@travis-ci.org" 41 | git commit -m "Build products for $SHORT_COMMIT_HASH, built on $TRAVIS_OS_NAME, log: $TRAVIS_BUILD_WEB_URL" 42 | if [ "$?" != "0" ]; then 43 | echo "Looks like the commit failed" 44 | fi 45 | git push -fq origin $PUBLICATION_BRANCH -------------------------------------------------------------------------------- /tools/sgpio_debug/create_tx_counter.py: -------------------------------------------------------------------------------- 1 | with open('tx_counter.bin', 'wb') as f: 2 | f.write(bytes(range(256))*1000) 3 | -------------------------------------------------------------------------------- /tools/sgpio_debug/sgpio_debug_tx.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | python3 create_tx_counter.py 3 | hackrf_transfer -R -t tx_counter.bin 4 | --------------------------------------------------------------------------------