Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
be59a24
firmware: first stab at refactoring rf_path for runtime platform dete…
antoinevg Jan 23, 2026
638f867
firmware: apply platform_scu structure to platform_gpio
antoinevg Jan 27, 2026
30f65d7
firmware: checkpoint rf_path
antoinevg Jan 27, 2026
e17b981
firmware: use pre-defined gpio_t structs instead of GPIO() macro
antoinevg Jan 28, 2026
5c9dd4a
firmware: add max2831 support to the max283x wrapper
antoinevg Jan 29, 2026
a5c4231
firmware: move remaining gpio's from hackrf_core to platform_gpio
antoinevg Jan 30, 2026
7ad3506
firmware: move remaining scu's from hackrf_core to platform_scu
antoinevg Feb 3, 2026
5fb41e3
firmware: remove remaining scu and gpio declarations
antoinevg Feb 3, 2026
8a8ed71
firmware: refactor remaining ifdefs in firmware/common/
antoinevg Feb 4, 2026
b7215e0
firmware: refactor max283x gpio's
antoinevg Feb 5, 2026
0535018
firmware: refactor mixer for runtime platform detection
antoinevg Feb 5, 2026
a6b4db2
firmware: refactor si5351c for runtime platform detection
antoinevg Feb 5, 2026
445d2da
firmware: runtime detection for usb descriptors
antoinevg Feb 6, 2026
49a65b9
Always use void argument type for functions taking no arguments.
antoinevg Feb 9, 2026
1e9d480
Rename `struct gpio_t` to `struct gpio` to distinguish from `gpio_t`
antoinevg Feb 9, 2026
d3daad1
firmware: set usb_api_sweep throwaway buffers at runtime
antoinevg Feb 9, 2026
4edf13d
firmware: detect platform for usb_api_selftest at runtime
antoinevg Feb 9, 2026
0801708
firmware: runtime detection for usb_api_* availability
antoinevg Feb 9, 2026
de0cc90
firmware: runtime detection for hackrf_usb
antoinevg Feb 10, 2026
ce828fd
firmware: include HACKRF1_OG, HACKRF1_R9 in Praline's SUPPORTED_PLATFORM
antoinevg Feb 10, 2026
08f20af
firmware: only link in portapack code for PRALINE, HACKRF_ONE
antoinevg Feb 13, 2026
5a0a320
firmware: restore compile-time conditionals
antoinevg Feb 16, 2026
7465a55
firmware: add new board target: UNIVERSAL
antoinevg Feb 20, 2026
aafb0ce
hackrf-tools: display HackRF Pro instead of Praline when using combin…
antoinevg Feb 23, 2026
8aba74e
firmware: post-rebase fixes
antoinevg Feb 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 59 additions & 24 deletions firmware/common/cpld_jtag.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@

#include "cpld_jtag.h"
#include "hackrf_core.h"
#include "platform_detect.h"
#include "xapp058/micro.h"
#include <libopencm3/lpc43xx/scu.h>
#include <stdint.h>

#ifndef PRALINE
#if !defined(PRALINE) || defined(UNIVERSAL)
static refill_buffer_cb refill_buffer;
static uint32_t xsvf_buffer_len, xsvf_pos;
static unsigned char* xsvf_buffer;
Expand All @@ -35,52 +36,86 @@ void cpld_jtag_take(jtag_t* const jtag)
{
const jtag_gpio_t* const gpio = jtag->gpio;

board_id_t board_id = detected_platform();

/* Set initial GPIO state to the voltages of the internal or external pull-ups/downs,
* to avoid any glitches.
*/
#if (defined HACKRF_ONE || defined PRALINE)
gpio_set(gpio->gpio_pp_tms);
switch (board_id) {
case BOARD_ID_HACKRF1_OG:
case BOARD_ID_HACKRF1_R9:
case BOARD_ID_PRALINE:
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
gpio_set(gpio->gpio_pp_tms);
#endif
break;
default:
break;
}
gpio_clear(gpio->gpio_tck);
#ifndef PRALINE
gpio_set(gpio->gpio_tms);
gpio_set(gpio->gpio_tdi);
if (board_id != BOARD_ID_PRALINE) {
#if !defined(PRALINE) || defined(UNIVERSAL)
gpio_set(gpio->gpio_tms);
gpio_set(gpio->gpio_tdi);
#endif
}

#if (defined HACKRF_ONE || defined PRALINE)
/* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo);
switch (board_id) {
case BOARD_ID_HACKRF1_OG:
case BOARD_ID_HACKRF1_R9:
case BOARD_ID_PRALINE:
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
/* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo);
#endif
break;
default:
break;
}
gpio_output(gpio->gpio_tck);
#ifndef PRALINE
gpio_output(gpio->gpio_tms);
gpio_output(gpio->gpio_tdi);
gpio_input(gpio->gpio_tdo);
if (board_id != BOARD_ID_PRALINE) {
#if !defined(PRALINE) || defined(UNIVERSAL)
gpio_output(gpio->gpio_tms);
gpio_output(gpio->gpio_tdi);
gpio_input(gpio->gpio_tdo);
#endif
}
}

void cpld_jtag_release(jtag_t* const jtag)
{
const jtag_gpio_t* const gpio = jtag->gpio;

board_id_t board_id = detected_platform();

/* Make all pins inputs when JTAG interface not active.
* Let the pull-ups/downs do the work.
*/
#if (defined HACKRF_ONE || defined PRALINE)
/* Do not drive PortaPack-specific pins, initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo);
switch (board_id) {
case BOARD_ID_HACKRF1_OG:
case BOARD_ID_HACKRF1_R9:
case BOARD_ID_PRALINE:
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
/* Do not drive PortaPack-specific pins, initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo);
#endif
break;
default:
break;
}
gpio_input(gpio->gpio_tck);
#ifndef PRALINE
gpio_input(gpio->gpio_tms);
gpio_input(gpio->gpio_tdi);
gpio_input(gpio->gpio_tdo);
if (board_id != BOARD_ID_PRALINE) {
#if !defined(PRALINE) || defined(UNIVERSAL)
gpio_input(gpio->gpio_tms);
gpio_input(gpio->gpio_tdi);
gpio_input(gpio->gpio_tdo);
#endif
}
}

#ifndef PRALINE
#if !defined(PRALINE) || defined(UNIVERSAL)
/* return 0 if success else return error code see xsvfExecute() */
int cpld_jtag_program(
jtag_t* const jtag,
Expand Down Expand Up @@ -111,4 +146,4 @@ unsigned char cpld_jtag_get_next_byte(void)
xsvf_pos++;
return byte;
}
#endif
#endif
4 changes: 2 additions & 2 deletions firmware/common/cpld_jtag.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

typedef struct jtag_gpio_t {
gpio_t gpio_tck;
#ifndef PRALINE
#if !defined(PRALINE) || defined(UNIVERSAL)
gpio_t gpio_tms;
gpio_t gpio_tdi;
gpio_t gpio_tdo;
#endif
#if (defined HACKRF_ONE || defined PRALINE)
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
gpio_t gpio_pp_tms;
gpio_t gpio_pp_tdo;
#endif
Expand Down
3 changes: 3 additions & 0 deletions firmware/common/firmware_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#define SUPPORTED_PLATFORM PLATFORM_RAD1O
#elif PRALINE
#define SUPPORTED_PLATFORM PLATFORM_PRALINE
#elif UNIVERSAL
#define SUPPORTED_PLATFORM \
(PLATFORM_PRALINE | PLATFORM_HACKRF1_OG | PLATFORM_HACKRF1_R9)
#else
#define SUPPORTED_PLATFORM 0
#endif
Expand Down
6 changes: 3 additions & 3 deletions firmware/common/fpga_selftest.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,9 @@ bool fpga_if_xcvr_selftest(void)
fpga_set_tx_nco_pstep(&fpga, 64); // NCO phase increment
fpga_set_tx_nco_enable(&fpga, true); // TX enable
rf_path_set_direction(&rf_path, RF_PATH_DIRECTION_RX_CALIBRATION);
max2831_set_lna_gain(&max283x, 16);
max2831_set_vga_gain(&max283x, 36);
max2831_set_frequency(&max283x, 2500000000);
max283x_set_lna_gain(&max283x, 16);
max283x_set_vga_gain(&max283x, 36);
max283x_set_frequency(&max283x, 2500000000);

// Capture 1: 4 Msps, tone at 0.5 MHz, narrowband filter OFF
sample_rate_frac_set(4000000, 1);
Expand Down
2 changes: 1 addition & 1 deletion firmware/common/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include <stdbool.h>

typedef const struct gpio_t* gpio_t;
typedef const struct gpio* gpio_t;

void gpio_init(void);
void gpio_set(gpio_t gpio);
Expand Down
4 changes: 2 additions & 2 deletions firmware/common/gpio_lpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
* register #defines and API declarations into separate header files.
*/

typedef struct gpio_port_t {
typedef struct gpio_port {
volatile uint32_t dir; /* +0x000 */
uint32_t _reserved0[31];
volatile uint32_t mask; /* +0x080 */
Expand All @@ -48,7 +48,7 @@ typedef struct gpio_port_t {
volatile uint32_t inv; /* +0x300 */
} gpio_port_t;

struct gpio_t {
struct gpio {
const uint32_t mask;
gpio_port_t* const port;
volatile uint32_t* const gpio_w;
Expand Down
Loading