Use IS macros for all conditional compilation.
Some checks failed
Build / host (3.10.0, map[os:ubuntu shell:bash]) (push) Failing after 8s
Build / host (3.21.0, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / host (3.16.0, map[os:ubuntu shell:bash]) (push) Failing after 8s
Build / host (4.0.0, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / host (latest, map[os:ubuntu shell:bash]) (push) Failing after 6s
Build / firmware (HACKRF_ONE, 3.10.0, ubuntu) (push) Failing after 4s
Build / firmware (HACKRF_ONE, latest, ubuntu) (push) Failing after 5s
Build / firmware (JAWBREAKER, latest, ubuntu) (push) Failing after 7s
Build / firmware (JAWBREAKER, 3.10.0, ubuntu) (push) Failing after 7s
Build / firmware (PRALINE, 3.10.0, ubuntu) (push) Failing after 9s
Build / firmware (PRALINE, latest, ubuntu) (push) Failing after 9s
Build / firmware (RAD1O, 3.10.0, ubuntu) (push) Failing after 11s
Build / firmware (RAD1O, latest, ubuntu) (push) Failing after 9s
Build / firmware (UNIVERSAL, 3.10.0, ubuntu) (push) Failing after 10s
Build / firmware (UNIVERSAL, latest, ubuntu) (push) Failing after 9s
Check code style / clang-format (push) Failing after 13s
Check code style / clang-format-1 (push) Failing after 14s
Check code style / clang-format-2 (push) Failing after 13s
Check code style / clang-format-3 (push) Failing after 7s
Check includes / includes-check (HACKRF_ONE, 3.10.0) (push) Failing after 3s
Check includes / includes-check (HACKRF_ONE, latest) (push) Failing after 4s
Check includes / includes-check (JAWBREAKER, 3.10.0) (push) Failing after 4s
Check includes / includes-check (JAWBREAKER, latest) (push) Failing after 5s
Check includes / includes-check (PRALINE, 3.10.0) (push) Failing after 6s
Check includes / includes-check (PRALINE, latest) (push) Failing after 8s
Check includes / includes-check (RAD1O, 3.10.0) (push) Failing after 9s
Check includes / includes-check (RAD1O, latest) (push) Failing after 9s
Check includes / includes-check (UNIVERSAL, 3.10.0) (push) Failing after 7s
Check includes / includes-check (UNIVERSAL, latest) (push) Failing after 6s
Build / host (4.0.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (latest, --install-prefix=/usr/local, map[os:windows shell:msys2]) (push) Has been cancelled
Build / host (3.10.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (3.16.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (3.21.0, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (3.21.0, map[os:macos shell:bash]) (push) Has been cancelled
Build / host (4.0.0, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (latest, -DPKG_CONFIG_EXECUTABLE=C:/vcpkg/installed/x64-windows/tools/pkgconf/pkgconf.exe -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake --install-prefix=$env:GITHUB_WORKSPACE/install, map[os:windows shell:pwsh]) (push) Has been cancelled
Build / host (latest, map[os:macos shell:bash]) (push) Has been cancelled
Build / firmware (HACKRF_ONE, latest, windows) (push) Has been cancelled
Build / firmware (JAWBREAKER, latest, windows) (push) Has been cancelled
Build / firmware (PRALINE, 3.10.0, macos) (push) Has been cancelled
Build / firmware (PRALINE, latest, macos) (push) Has been cancelled
Build / firmware (PRALINE, latest, windows) (push) Has been cancelled
Build / firmware (UNIVERSAL, latest, macos) (push) Has been cancelled
Build / firmware (UNIVERSAL, latest, windows) (push) Has been cancelled
Build / firmware (RAD1O, latest, windows) (push) Has been cancelled
Build / firmware (UNIVERSAL, 3.10.0, macos) (push) Has been cancelled

This commit is contained in:
Martin Ling 2026-04-14 11:52:21 +01:00
parent 4d40c806f2
commit 2ad78ce6de
36 changed files with 419 additions and 419 deletions

View file

@ -19,17 +19,16 @@
* Boston, MA 02110-1301, USA.
*/
#if !defined(PRALINE) || defined(UNIVERSAL)
#include <stdint.h>
#endif
#include "cpld_jtag.h"
#include "platform_detect.h"
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
#include <stdint.h>
#include "xapp058/micro.h"
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
static refill_buffer_cb refill_buffer;
static uint32_t xsvf_buffer_len, xsvf_pos;
static unsigned char* xsvf_buffer;
@ -42,7 +41,7 @@ void cpld_jtag_take(jtag_t* const jtag)
/* Set initial GPIO state to the voltages of the internal or external pull-ups/downs,
* to avoid any glitches.
*/
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
gpio_set(gpio->gpio_pp_tms);
}
@ -50,14 +49,14 @@ void cpld_jtag_take(jtag_t* const jtag)
gpio_clear(gpio->gpio_tck);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_set(gpio->gpio_tms);
gpio_set(gpio->gpio_tdi);
}
#endif
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
/* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
@ -67,7 +66,7 @@ void cpld_jtag_take(jtag_t* const jtag)
gpio_output(gpio->gpio_tck);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_output(gpio->gpio_tms);
gpio_output(gpio->gpio_tdi);
@ -83,7 +82,7 @@ void cpld_jtag_release(jtag_t* const jtag)
/* Make all pins inputs when JTAG interface not active.
* Let the pull-ups/downs do the work.
*/
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
/* Do not drive PortaPack-specific pins, initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms);
@ -93,7 +92,7 @@ void cpld_jtag_release(jtag_t* const jtag)
gpio_input(gpio->gpio_tck);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_input(gpio->gpio_tms);
gpio_input(gpio->gpio_tdi);
@ -102,7 +101,7 @@ void cpld_jtag_release(jtag_t* const jtag)
#endif
}
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
/* return 0 if success else return error code see xsvfExecute() */
int cpld_jtag_program(
jtag_t* const jtag,

View file

@ -24,15 +24,16 @@
#include <stdint.h>
#include "gpio.h"
#include "platform_detect.h"
typedef struct {
gpio_t gpio_tck;
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
gpio_t gpio_tms;
gpio_t gpio_tdi;
gpio_t gpio_tdo;
#endif
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
gpio_t gpio_pp_tms;
gpio_t gpio_pp_tdo;
#endif

View file

@ -25,7 +25,10 @@
#include <libopencm3/lpc43xx/memorymap.h>
#include <libopencm3/lpc43xx/scu.h>
#include <libopencm3/lpc43xx/ssp.h>
#if !defined(RAD1O)
#include "platform_detect.h"
#if defined(IS_NOT_RAD1O)
#include <libopencm3/lpc43xx/ccu.h>
#endif
@ -36,15 +39,14 @@
#include "i2c_lpc.h"
#include "max283x.h"
#include "max5864_target.h"
#include "platform_detect.h"
#include "platform_gpio.h"
#include "platform_scu.h"
#include "spi_bus.h"
#include "w25q80bv_target.h"
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
#include "portapack.h"
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "ice40_spi.h"
#endif
@ -142,7 +144,7 @@ sgpio_config_t sgpio_config = {
.slice_mode_multislice = true,
};
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
static ssp_config_t ssp_config_ice40_fpga = {
.data_bits = SSP_DATA_8BITS,
.spi_mode = SSP_CPOL_1_CPHA_1,
@ -341,7 +343,7 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program)
sgpio_cpld_stream_disable(&sgpio_config);
}
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
/* Integer mode can be enabled if p1 is even and p2 is zero. */
if (p1 & 0x1 || p2) {
@ -350,7 +352,7 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program)
si5351c_set_int_mode(&clock_gen, 0, 1);
}
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
/*
* On HackRF One r9 all sample clocks are externally derived
@ -359,7 +361,7 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program)
si5351c_configure_multisynth(&clock_gen, 1, p1, p2, p3, 0);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
/*
* On other platforms the clock generator produces three
@ -389,7 +391,7 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program)
#endif
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
/* MS0/CLK0 is the source for the MAX5864 (AFE_CLK). */
si5351c_configure_multisynth(&clock_gen, 0, p1, p2, p3, 1);
@ -569,7 +571,7 @@ void cpu_clock_init(void)
CGU_BASE_SSP1_CLK =
CGU_BASE_SSP1_CLK_AUTOBLOCK(1) | CGU_BASE_SSP1_CLK_CLK_SEL(CGU_SRC_PLL1);
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
/* Disable unused clocks */
/* Start with PLLs */
@ -680,7 +682,7 @@ void clock_gen_init(void)
* CLK7 -> AUX_CLK2
*/
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
/* MS0/CLK0 is the reference for both RFFC5071 and MAX2839. */
si5351c_configure_multisynth(
@ -692,7 +694,7 @@ void clock_gen_init(void)
0); /* 800/20 = 40MHz */
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
/* MS4/CLK4 is the source for the RFFC5071 mixer (MAX2837 on rad1o). */
si5351c_configure_multisynth(
@ -736,7 +738,7 @@ void clock_gen_shutdown(void)
clock_source_t activate_best_clock_source(void)
{
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
/* Ensure PortaPack reference oscillator is off while checking for external clock input. */
if (portapack_reference_oscillator && portapack()) {
@ -751,7 +753,7 @@ clock_source_t activate_best_clock_source(void)
if (si5351c_clkin_signal_valid(&clock_gen)) {
source = CLOCK_SOURCE_EXTERNAL;
} else {
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
/* Enable PortaPack reference oscillator (if present), and check for valid clock. */
if (portapack_reference_oscillator && portapack()) {
@ -786,7 +788,7 @@ void ssp1_set_mode_max5864(void)
spi_bus_start(max5864.bus, &ssp_config_max5864);
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
void ssp1_set_mode_ice40(void)
{
spi_bus_start(&spi_bus_ssp1, &ssp_config_ice40_fpga);
@ -816,14 +818,14 @@ void pin_shutdown(void)
*
* LPC43xx pull-up and pull-down resistors are approximately 53K.
*/
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
scu_pinmux(scu->PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0);
scu_pinmux(scu->PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
}
#endif
scu_pinmux(scu->PINMUX_CPLD_TCK, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
scu_pinmux(scu->PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(scu->PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
@ -835,26 +837,26 @@ void pin_shutdown(void)
scu_pinmux(scu->PINMUX_LED1, SCU_GPIO_NOPULL);
scu_pinmux(scu->PINMUX_LED2, SCU_GPIO_NOPULL);
scu_pinmux(scu->PINMUX_LED3, SCU_GPIO_NOPULL);
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu_pinmux(scu->PINMUX_LED4, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION4);
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu_pinmux(scu->PINMUX_LED4, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
}
#endif
/* Configure USB indicators */
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
scu_pinmux(scu->PINMUX_USB_LED0, SCU_CONF_FUNCTION3);
scu_pinmux(scu->PINMUX_USB_LED1, SCU_CONF_FUNCTION3);
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
disable_1v2_power();
disable_3v3aux_power();
@ -865,16 +867,16 @@ void pin_shutdown(void)
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
disable_1v8_power();
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio_output(gpio->h1r9_1v8_enable);
scu_pinmux(scu->H1R9_EN1V8, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
gpio_output(gpio->gpio_1v8_enable);
scu_pinmux(scu->PINMUX_EN1V8, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
@ -883,18 +885,18 @@ void pin_shutdown(void)
}
#endif
#ifdef IS_H1_OR_PRALINE
#if defined(IS_H1_OR_PRALINE)
if (IS_H1_OR_PRALINE) {
/* Safe state: start with VAA turned off: */
disable_rf_power();
/* Configure RF power supply (VAA) switch control signal as output */
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio_output(gpio->h1r9_vaa_disable);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
gpio_output(gpio->vaa_disable);
}
@ -902,7 +904,7 @@ void pin_shutdown(void)
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
/* Safe state: start with VAA turned off: */
disable_rf_power();
@ -919,7 +921,7 @@ void pin_shutdown(void)
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu_pinmux(scu->P2_CTRL0, scu->P2_CTRL0_PINCFG);
scu_pinmux(scu->P2_CTRL1, scu->P2_CTRL1_PINCFG);
@ -973,7 +975,7 @@ void pin_setup(void)
led_off(0);
led_off(1);
led_off(2);
#ifdef IS_FOUR_LEDS
#if defined(IS_FOUR_LEDS)
if (IS_FOUR_LEDS) {
led_off(3);
}
@ -983,7 +985,7 @@ void pin_setup(void)
gpio_output(gpio->led[1]);
gpio_output(gpio->led[2]);
#ifdef IS_FOUR_LEDS
#if defined(IS_FOUR_LEDS)
if (IS_FOUR_LEDS) {
gpio_output(gpio->led[3]);
}
@ -991,12 +993,12 @@ void pin_setup(void)
/* Configure drivers and driver pins */
ssp_config_max283x.gpio_select = gpio->max283x_select;
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
ssp_config_max283x.data_bits = SSP_DATA_16BITS;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
ssp_config_max283x.data_bits = SSP_DATA_9BITS; // send 2 words
}
@ -1010,13 +1012,13 @@ void pin_setup(void)
sgpio_config.gpio_q_invert = gpio->q_invert;
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
sgpio_config.gpio_trigger_enable = gpio->trigger_enable;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
ssp_config_ice40_fpga.gpio_select = gpio->fpga_cfg_spi_cs;
ice40.gpio_select = gpio->fpga_cfg_spi_cs;
@ -1027,7 +1029,7 @@ void pin_setup(void)
jtag_gpio_cpld.gpio_tck = gpio->cpld_tck;
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
jtag_gpio_cpld.gpio_tms = gpio->cpld_tms;
jtag_gpio_cpld.gpio_tdi = gpio->cpld_tdi;
@ -1035,7 +1037,7 @@ void pin_setup(void)
}
#endif
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
jtag_gpio_cpld.gpio_pp_tms = gpio->cpld_pp_tms;
jtag_gpio_cpld.gpio_pp_tdo = gpio->cpld_pp_tdo;
@ -1046,14 +1048,14 @@ void pin_setup(void)
mixer_bus_setup(&mixer);
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
sgpio_config.gpio_trigger_enable = gpio->h1r9_trigger_enable;
}
#endif
// initialize rf_path struct and assign gpio's
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
rf_path = (rf_path_t){
.switchctrl = 0,
@ -1071,7 +1073,7 @@ void pin_setup(void)
.gpio_rx_amp = gpio->rx_amp,
.gpio_no_rx_amp_pwr = gpio->no_rx_amp_pwr,
};
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
rf_path.gpio_rx = gpio->h1r9_rx;
rf_path.gpio_h1r9_no_ant_pwr = gpio->h1r9_no_ant_pwr;
@ -1080,7 +1082,7 @@ void pin_setup(void)
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
rf_path = (rf_path_t){
.switchctrl = 0,
@ -1099,7 +1101,7 @@ void pin_setup(void)
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
rf_path = (rf_path_t){
.switchctrl = 0,
@ -1124,54 +1126,46 @@ void pin_setup(void)
sgpio_configure_pin_functions(&sgpio_config);
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
void enable_1v2_power(void)
{
#ifdef IS_PRALINE
if (IS_PRALINE) {
gpio_set(platform_gpio()->gpio_1v2_enable);
}
#endif
}
void disable_1v2_power(void)
{
#ifdef IS_PRALINE
if (IS_PRALINE) {
gpio_clear(platform_gpio()->gpio_1v2_enable);
}
#endif
}
void enable_3v3aux_power(void)
{
#ifdef IS_PRALINE
if (IS_PRALINE) {
gpio_clear(platform_gpio()->gpio_3v3aux_enable_n);
}
#endif
}
void disable_3v3aux_power(void)
{
#ifdef IS_PRALINE
if (IS_PRALINE) {
gpio_set(platform_gpio()->gpio_3v3aux_enable_n);
}
#endif
}
#endif
void enable_1v8_power(void)
{
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio_set(platform_gpio()->h1r9_1v8_enable);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
gpio_set(platform_gpio()->gpio_1v8_enable);
}
@ -1182,14 +1176,14 @@ void enable_1v8_power(void)
void disable_1v8_power(void)
{
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio_clear(platform_gpio()->h1r9_1v8_enable);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
gpio_clear(platform_gpio()->gpio_1v8_enable);
}
@ -1198,7 +1192,7 @@ void disable_1v8_power(void)
#endif
}
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
static inline void enable_rf_power_hackrf_one(void)
{
const platform_gpio_t* gpio = platform_gpio();
@ -1226,7 +1220,7 @@ static inline void disable_rf_power_hackrf_one(void)
}
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
static inline void enable_rf_power_praline(void)
{
gpio_clear(platform_gpio()->vaa_disable);
@ -1258,17 +1252,17 @@ static inline void disable_rf_power_rad1o(void)
void enable_rf_power(void)
{
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
enable_rf_power_hackrf_one();
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
enable_rf_power_praline();
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
enable_rf_power_rad1o();
}
@ -1277,17 +1271,17 @@ void enable_rf_power(void)
void disable_rf_power(void)
{
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
disable_rf_power_hackrf_one();
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
disable_rf_power_praline();
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
disable_rf_power_rad1o();
}
@ -1296,12 +1290,12 @@ void disable_rf_power(void)
void led_on(const led_t led)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio_clear(platform_gpio()->led[led]);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_set(platform_gpio()->led[led]);
}
@ -1310,12 +1304,12 @@ void led_on(const led_t led)
void led_off(const led_t led)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio_set(platform_gpio()->led[led]);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_clear(platform_gpio()->led[led]);
}
@ -1330,19 +1324,19 @@ void led_toggle(const led_t led)
void set_leds(const uint8_t state)
{
int num_leds = 3;
#ifdef IS_FOUR_LEDS
#if defined(IS_FOUR_LEDS)
if (IS_FOUR_LEDS) {
num_leds = 4;
}
#endif
for (int i = 0; i < num_leds; i++) {
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio_write(platform_gpio()->led[i], ((state >> i) & 1) == 0);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_write(platform_gpio()->led[i], ((state >> i) & 1) == 1);
}
@ -1352,12 +1346,12 @@ void set_leds(const uint8_t state)
void trigger_enable(const bool enable)
{
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio_write(sgpio_config.gpio_trigger_enable, enable);
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
fpga_set_trigger_enable(&fpga, enable);
}
@ -1379,7 +1373,7 @@ void halt_and_flash(const uint32_t duration)
}
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
void p1_ctrl_set(const p1_ctrl_signal_t signal)
{
const platform_gpio_t* gpio = platform_gpio();

View file

@ -36,13 +36,14 @@ extern "C" {
#include "max283x.h"
#include "max5864.h"
#include "mixer.h"
#include "platform_detect.h"
#include "radio.h"
#include "rf_path.h"
#include "sgpio.h"
#include "si5351c.h"
#include "spi_ssp.h"
#include "w25q80bv.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "fpga.h"
#include "ice40_spi.h"
#endif
@ -52,7 +53,7 @@ extern si5351c_driver_t clock_gen;
extern ssp_config_t ssp_config_w25q80bv;
extern max283x_driver_t max283x;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
extern ice40_spi_driver_t ice40;
extern fpga_driver_t fpga;
#endif
@ -71,14 +72,14 @@ void clock_gen_init(void);
void clock_gen_shutdown(void);
void ssp1_set_mode_max283x(void);
void ssp1_set_mode_max5864(void);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
void ssp1_set_mode_ice40(void);
#endif
void pin_shutdown(void);
void pin_setup(void);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
void enable_1v2_power(void);
void disable_1v2_power(void);
void enable_3v3aux_power(void);
@ -91,7 +92,7 @@ fp_28_36_t sample_rate_set(const fp_28_36_t sample_rate, const bool program);
clock_source_t activate_best_clock_source(void);
#if defined(RAD1O) || defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_RAD1O) || defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
void enable_rf_power(void);
void disable_rf_power(void);
#endif
@ -112,7 +113,7 @@ void trigger_enable(const bool enable);
void halt_and_flash(const uint32_t duration);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
typedef enum {
P1_SIGNAL_TRIGGER_IN = 0,
P1_SIGNAL_AUX_CLK1 = 1,

View file

@ -23,14 +23,12 @@
#include <stddef.h>
#include "hackrf_ui.h"
#include "platform_detect.h"
#include "transceiver_mode.h"
#if !defined(JAWBREAKER)
#include "platform_detect.h"
#endif
#if defined(PRALINE) || defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
#include "ui_portapack.h"
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
#include "ui_rad1o.h"
#endif
@ -85,14 +83,14 @@ const hackrf_ui_t* hackrf_ui(void)
{
/* Detect on first use. If no UI hardware is detected, use a stub function table. */
if (ui == NULL && ui_enabled) {
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
if (portapack_hackrf_ui_init) {
ui = portapack_hackrf_ui_init();
}
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
if (rad1o_ui_setup) {
ui = rad1o_ui_setup();

View file

@ -29,19 +29,19 @@
#include "platform_gpio.h"
#include "spi_bus.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "max2831_target.h"
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
#include "max2837_target.h"
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_H1_R9)
#include "max2839_target.h"
#endif
extern spi_bus_t spi_bus_ssp1;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
max2831_driver_t max2831 = {
.bus = &spi_bus_ssp1,
.target_init = max2831_target_init,
@ -49,7 +49,7 @@ max2831_driver_t max2831 = {
};
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
max2837_driver_t max2837 = {
.bus = &spi_bus_ssp1,
.target_init = max2837_target_init,
@ -57,7 +57,7 @@ max2837_driver_t max2837 = {
};
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
max2839_driver_t max2839 = {
.bus = &spi_bus_ssp1,
.target_init = max2839_target_init,
@ -71,7 +71,7 @@ void max283x_setup(max283x_driver_t* const drv)
const platform_gpio_t* gpio = platform_gpio();
/* MAX283x GPIO PinMux */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
drv->type = MAX2831_VARIANT;
max2831.gpio_enable = gpio->max283x_enable;
@ -82,9 +82,9 @@ void max283x_setup(max283x_driver_t* const drv)
max2831_setup(&drv->drv.max2831);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
drv->type = MAX2839_VARIANT;
max2839.gpio_enable = gpio->max283x_enable;
@ -93,7 +93,7 @@ void max283x_setup(max283x_driver_t* const drv)
max2839_setup(&drv->drv.max2839);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
drv->type = MAX2837_VARIANT;
max2837.gpio_enable = gpio->max283x_enable;
@ -247,7 +247,7 @@ uint32_t max283x_set_lpf_bandwidth(
const max283x_mode_t mode,
const uint32_t bandwidth_hz)
{
#if !defined(PRALINE)
#if !defined(IS_PRALINE)
(void) mode;
#endif
DISPATCH(
@ -290,7 +290,7 @@ void max283x_set_rx_hpf_frequency(
max283x_driver_t* const drv,
const max283x_rx_hpf_freq_t freq)
{
#if !defined(PRALINE) && !defined(UNIVERSAL)
#if !defined(IS_PRALINE)
(void) freq;
#endif
PRALINE_ONLY(

View file

@ -26,13 +26,15 @@
#include <stdbool.h>
#include <stdint.h>
#if defined(PRALINE) || defined(UNIVERSAL)
#include "platform_detect.h"
#if defined(IS_PRALINE)
#include "max2831.h"
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
#include "max2837.h"
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_H1_R9)
#include "max2839.h"
#endif
@ -54,13 +56,13 @@ typedef enum {
} max283x_rx_hpf_freq_t;
typedef enum {
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
MAX2831_VARIANT,
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
MAX2837_VARIANT,
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_H1_R9)
MAX2839_VARIANT,
#endif
} max283x_variant_t;
@ -69,13 +71,13 @@ typedef struct {
max283x_variant_t type;
union {
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
max2831_driver_t max2831;
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
max2837_driver_t max2837;
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_H1_R9)
max2839_driver_t max2839;
#endif
} drv;

View file

@ -24,6 +24,8 @@
#include <stdbool.h>
#include <stdint.h>
#include <libopencm3/lpc43xx/scu.h>
#include "max2871_regs.h"
#include "selftest.h"
#include "platform_scu.h"
@ -33,7 +35,6 @@
#define LOG printf
#else
#define LOG(x, ...)
#include <libopencm3/lpc43xx/scu.h>
#endif
static uint32_t max2871_spi_read(max2871_driver_t* const drv);

View file

@ -22,15 +22,16 @@
#include "mixer.h"
#include "platform_detect.h"
#include "platform_gpio.h"
#if defined(RAD1O)
#if defined(IS_RAD1O)
#include "max2871.h"
#else
#endif
#if defined(IS_NOT_RAD1O)
#include "rffc5071.h"
#include "rffc5071_spi.h"
#include "spi_bus.h"
#endif
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
static rffc5071_spi_config_t rffc5071_spi_config;
static spi_bus_t spi_bus_rffc5071 = {
@ -43,7 +44,7 @@ static spi_bus_t spi_bus_rffc5071 = {
#endif
mixer_driver_t mixer = {
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
.rffc5071.bus = &spi_bus_rffc5071,
#endif
};
@ -52,7 +53,7 @@ void mixer_bus_setup(mixer_driver_t* const mixer)
{
(void) mixer;
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
const platform_gpio_t* gpio = platform_gpio();
@ -73,20 +74,20 @@ void mixer_setup(mixer_driver_t* const mixer, mixer_variant_t type)
const platform_gpio_t* gpio = platform_gpio();
/* Mixer GPIO serial interface PinMux */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
mixer->rffc5071.gpio_ld = gpio->rffc5072_ld;
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
mixer->rffc5071.gpio_reset = gpio->rffc5072_reset;
rffc5071_setup(&mixer->rffc5071);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
mixer->max2871.gpio_vco_ce = gpio->vco_ce;
mixer->max2871.gpio_vco_sclk = gpio->vco_sclk;
@ -101,13 +102,13 @@ void mixer_setup(mixer_driver_t* const mixer, mixer_variant_t type)
uint64_t mixer_set_frequency(mixer_driver_t* const mixer, uint64_t hz)
{
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
return rffc5071_set_frequency(&mixer->rffc5071, hz);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
return max2871_set_frequency(&mixer->max2871, hz / 1000000);
}
@ -116,13 +117,13 @@ uint64_t mixer_set_frequency(mixer_driver_t* const mixer, uint64_t hz)
void mixer_enable(mixer_driver_t* const mixer)
{
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
rffc5071_enable(&mixer->rffc5071);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
max2871_enable(&mixer->max2871);
}
@ -131,13 +132,13 @@ void mixer_enable(mixer_driver_t* const mixer)
void mixer_disable(mixer_driver_t* const mixer)
{
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
rffc5071_disable(&mixer->rffc5071);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
max2871_disable(&mixer->max2871);
}
@ -146,13 +147,13 @@ void mixer_disable(mixer_driver_t* const mixer)
void mixer_set_gpo(mixer_driver_t* const mixer, uint8_t gpo)
{
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
rffc5071_set_gpo(&mixer->rffc5071, gpo);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
(void) mixer;
(void) gpo;

View file

@ -22,9 +22,14 @@
#pragma once
#if defined(RAD1O)
#include <stdint.h>
#include "platform_detect.h"
#if defined(IS_RAD1O)
#include "max2871.h"
#else
#endif
#if defined(IS_NOT_RAD1O)
#include "rffc5071.h"
#endif
@ -37,15 +42,15 @@ typedef struct {
mixer_variant_t type;
union {
#if defined(RAD1O)
#if defined(IS_RAD1O)
max2871_driver_t max2871;
#else
#endif
#if defined(IS_NOT_RAD1O)
rffc5071_driver_t rffc5071;
#endif
};
} mixer_driver_t;
#include <stdint.h>
extern void mixer_bus_setup(mixer_driver_t* const mixer);
extern void mixer_setup(mixer_driver_t* const mixer, mixer_variant_t type);

View file

@ -25,16 +25,16 @@
#include <libopencm3/lpc43xx/gima.h>
#include <libopencm3/lpc43xx/rgu.h>
#include <libopencm3/lpc43xx/scu.h>
#if !defined(PRALINE)
#include "delay.h"
#include "platform_detect.h"
#include "sct.h"
#if defined(IS_NOT_PRALINE)
#include <libopencm3/cm3/common.h>
#include <libopencm3/lpc43xx/sgpio.h>
#endif
#include <platform_detect.h>
#include "delay.h"
#include "sct.h"
#define U1CTRL_SET SCT_OUT14_SET
#define U1CTRL_CLR SCT_OUT14_CLR
#define U2CTRL0_SET SCT_OUT13_SET
@ -98,7 +98,7 @@ void operacake_sctimer_init(void)
SCU_CONF_EPUN_DIS_PULLUP | SCU_CONF_EHS_FAST | SCU_CONF_FUNCTION1);
uint8_t sct_clock_input;
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
// Configure the SGPIO to output the clock (f=2 * sample clock) on pin 12
SGPIO_OUT_MUX_CFG12 =
@ -112,7 +112,7 @@ void operacake_sctimer_init(void)
sct_clock_input = SCT_CONFIG_CKSEL_RISING_EDGES_ON_INPUT_1;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
// Configure pin P6_4 as SCT_IN_6
scu_pinmux(P6_4, SCU_CLK_IN | SCU_CONF_FUNCTION1);

View file

@ -40,32 +40,32 @@ const platform_gpio_t* platform_gpio(void)
gpio.led[0] = &GPIO2_1;
gpio.led[1] = &GPIO2_2;
gpio.led[2] = &GPIO2_8;
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
gpio.led[3] = &GPIO5_26;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.led[3] = &GPIO4_6;
}
#endif
/* Power Supply Control */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.gpio_1v2_enable = &GPIO4_7;
gpio.gpio_3v3aux_enable_n = &GPIO5_15;
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio.gpio_1v8_enable = &GPIO3_6;
}
#endif
/* MAX283x GPIO (XCVR_CTL / CS_XCVR) PinMux */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.max283x_select = &GPIO6_28;
gpio.max283x_enable = &GPIO7_1;
@ -74,7 +74,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.max2831_ld = &GPIO4_11;
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio.max283x_select = &GPIO0_15;
gpio.max283x_enable = &GPIO2_6;
@ -84,29 +84,29 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* MAX5864 SPI chip select (AD_CS / CS_AD) GPIO PinMux */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.max5864_select = &GPIO6_30;
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio.max5864_select = &GPIO2_7;
}
#endif
/* RF supply (VAA) control */
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
gpio.vaa_disable = &GPIO2_9;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.vaa_disable = &GPIO4_1;
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
gpio.vaa_enable = &GPIO2_9;
}
@ -118,7 +118,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.w25q80bv_select = &GPIO5_11;
/* RF switch control */
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
gpio.hp = &GPIO2_0;
gpio.lp = &GPIO2_10;
@ -133,7 +133,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.amp_bypass = &GPIO0_14;
gpio.rx_amp = &GPIO1_11;
gpio.no_rx_amp_pwr = &GPIO1_12;
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio.h1r9_rx = &GPIO0_7;
gpio.h1r9_no_ant_pwr = &GPIO2_4;
@ -141,7 +141,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
gpio.tx_rx_n = &GPIO1_11;
gpio.tx_rx = &GPIO0_14;
@ -156,7 +156,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.rx_lna = &GPIO5_15;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.tx_en = &GPIO3_4;
gpio.mix_en_n = &GPIO3_2;
@ -169,23 +169,23 @@ const platform_gpio_t* platform_gpio(void)
/* CPLD JTAG interface GPIO pins_FPGA config pins in Praline */
gpio.cpld_tck = &GPIO3_0;
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.fpga_cfg_creset = &GPIO2_11;
gpio.fpga_cfg_cdone = &GPIO5_14;
gpio.fpga_cfg_spi_cs = &GPIO2_10;
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio.cpld_tdo = &GPIO5_18;
#ifdef IS_H1_OR_RAD1O
#if defined(IS_H1_OR_RAD1O)
if (IS_H1_OR_RAD1O) {
gpio.cpld_tms = &GPIO3_4;
gpio.cpld_tdi = &GPIO3_1;
}
#endif
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
gpio.cpld_tms = &GPIO3_1;
gpio.cpld_tdi = &GPIO3_4;
@ -193,7 +193,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
}
#endif
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
gpio.cpld_pp_tms = &GPIO1_1;
gpio.cpld_pp_tdo = &GPIO1_8;
@ -201,7 +201,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* Other CPLD interface GPIO pins */
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
gpio.trigger_enable = &GPIO5_12;
}
@ -209,7 +209,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.q_invert = &GPIO0_13;
/* RFFC5071 GPIO serial interface PinMux */
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
gpio.rffc5072_select = &GPIO2_13;
gpio.rffc5072_clock = &GPIO5_6;
@ -217,7 +217,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.rffc5072_reset = &GPIO2_14;
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
gpio.vco_ce = &GPIO2_13;
gpio.vco_sclk = &GPIO5_6;
@ -227,7 +227,7 @@ const platform_gpio_t* platform_gpio(void)
gpio.synt_rfout_en = &GPIO3_5;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.rffc5072_select = &GPIO2_13;
gpio.rffc5072_clock = &GPIO5_18;
@ -238,7 +238,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* Praline */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
gpio.p2_ctrl0 = &GPIO7_3;
gpio.p2_ctrl1 = &GPIO7_4;
@ -254,7 +254,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* HackRF One r9 clock control */
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
gpio.h1r9_clkin_en = &GPIO5_15;
gpio.h1r9_clkout_en = &GPIO0_9;
@ -266,7 +266,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* rad1o LCD */
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
gpio.lcd_cs = &GPIO4_12; /* P9_0 */
gpio.lcd_bl_en = &GPIO0_8; /* P1_1 */
@ -275,7 +275,7 @@ const platform_gpio_t* platform_gpio(void)
#endif
/* Portapack */
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
gpio.io_stbx = &GPIO5_0; /* P2_0 */
gpio.addr = &GPIO5_1; /* P2_1 */

View file

@ -27,10 +27,11 @@ extern "C" {
#include "gpio.h"
#include "gpio_lpc.h"
#include "platform_detect.h"
typedef struct {
/* LEDs */
#if defined(PRALINE) || defined(UNIVERSAL) || defined(RAD1O)
#if defined(IS_FOUR_LEDS)
gpio_t led[4];
#else
gpio_t led[3];
@ -38,7 +39,7 @@ typedef struct {
/* Power Supply Control */
gpio_t gpio_1v8_enable;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t gpio_1v2_enable;
gpio_t gpio_3v3aux_enable_n;
#endif
@ -48,7 +49,7 @@ typedef struct {
gpio_t max283x_enable;
gpio_t max283x_rx_enable;
gpio_t max283x_tx_enable;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t max2831_rxhp;
gpio_t max2831_ld;
#endif
@ -58,7 +59,7 @@ typedef struct {
/* RF supply (VAA) control */
gpio_t vaa_disable;
#if defined(RAD1O)
#if defined(IS_RAD1O)
gpio_t vaa_enable;
#endif
@ -68,7 +69,7 @@ typedef struct {
gpio_t w25q80bv_select;
/* RF switch control */
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
gpio_t hp;
gpio_t lp;
gpio_t tx_mix_bp;
@ -85,7 +86,7 @@ typedef struct {
gpio_t h1r9_no_ant_pwr; // HACKRF_ONE r9
gpio_t h1r9_rx; // HACKRF_ONE r9
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
gpio_t tx_rx_n;
gpio_t tx_rx;
gpio_t by_mix;
@ -98,7 +99,7 @@ typedef struct {
gpio_t tx_amp;
gpio_t rx_lna;
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t tx_en;
gpio_t mix_en_n;
gpio_t mix_en_n_r1_0;
@ -110,22 +111,22 @@ typedef struct {
/* CPLD JTAG interface GPIO pins, FPGA config pins in Praline */
gpio_t cpld_tck;
gpio_t cpld_tdo;
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
gpio_t cpld_tms;
gpio_t cpld_tdi;
#endif
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
gpio_t cpld_pp_tms;
gpio_t cpld_pp_tdo;
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t fpga_cfg_creset;
gpio_t fpga_cfg_cdone;
gpio_t fpga_cfg_spi_cs;
#endif
/* Other CPLD interface GPIO pins */
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
gpio_t trigger_enable;
#endif
gpio_t q_invert;
@ -144,7 +145,7 @@ typedef struct {
gpio_t synt_rfout_en; // RAD1O
/* Praline */
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t p2_ctrl0;
gpio_t p2_ctrl1;
gpio_t p1_ctrl0;
@ -157,7 +158,7 @@ typedef struct {
gpio_t pps_out;
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
/* HackRF One r9 clock control */
gpio_t h1r9_clkin_en;
gpio_t h1r9_clkout_en;
@ -169,14 +170,14 @@ typedef struct {
#endif
/* RAD1O */
#if defined(RAD1O)
#if defined(IS_RAD1O)
gpio_t lcd_cs;
gpio_t lcd_bl_en;
gpio_t lcd_reset;
#endif
/* Portapack */
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
gpio_t io_stbx;
gpio_t addr;
gpio_t lcd_rdx;

View file

@ -42,12 +42,12 @@ const platform_scu_t* platform_scu(void)
scu.PINMUX_LED1 = SCU_PINMUX_LED1; /* GPIO2[1] on P4_1 */
scu.PINMUX_LED2 = SCU_PINMUX_LED2; /* GPIO2[2] on P4_2 */
scu.PINMUX_LED3 = SCU_PINMUX_LED3; /* GPIO2[8] on P6_12 */
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu.PINMUX_LED4 = (PB_6); /* GPIO5[26] on PB_6 */
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.PINMUX_LED4 = (P8_6); /* GPIO4[6] on P8_6 */
}
@ -56,7 +56,7 @@ const platform_scu_t* platform_scu(void)
/* Power Supply PinMux */
scu.PINMUX_EN1V8 = (P6_10); /* GPIO3[6] on P6_10 */
scu.PINMUX_EN1V2 = (P8_7); /* GPIO4[7] on P8_7 */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.PINMUX_EN3V3_AUX_N = (P6_7); /* GPIO5[15] on P6_7 */
scu.PINMUX_EN3V3_OC_N = (P6_11); /* GPIO3[7] on P6_11 */
@ -66,7 +66,7 @@ const platform_scu_t* platform_scu(void)
/* GPIO Input PinMux */
scu.PINMUX_BOOT0 = (P1_1); /* GPIO0[8] on P1_1 */
scu.PINMUX_BOOT1 = (P1_2); /* GPIO0[9] on P1_2 */
#ifdef IS_NOT_HACKRF_ONE
#if defined(IS_NOT_HACKRF_ONE)
if (IS_NOT_HACKRF_ONE) {
scu.PINMUX_BOOT2 = (P2_8); /* GPIO5[7] on P2_8 */
scu.PINMUX_BOOT3 = (P2_9); /* GPIO1[10] on P2_9 */
@ -74,7 +74,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* USB peripheral */
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
scu.PINMUX_USB_LED0 = (P6_8);
scu.PINMUX_USB_LED1 = (P6_7);
@ -88,7 +88,7 @@ const platform_scu_t* platform_scu(void)
scu.SSP1_CS = (P1_20); /* P1_20 */
/* CPLD JTAG interface */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.PINMUX_FPGA_CRESET = (P5_2); /* GPIO2[11] on P5_2 */
scu.PINMUX_FPGA_CDONE = (P4_10); /* GPIO5[14] */
@ -97,13 +97,13 @@ const platform_scu_t* platform_scu(void)
#endif
scu.PINMUX_CPLD_TDO = (P9_5); /* GPIO5[18] */
scu.PINMUX_CPLD_TCK = (P6_1); /* GPIO3[ 0] */
#ifdef IS_NOT_JAWBREAKER
#if defined(IS_NOT_JAWBREAKER)
if (IS_NOT_JAWBREAKER) {
scu.PINMUX_CPLD_TMS = (P6_5); /* GPIO3[ 4] */
scu.PINMUX_CPLD_TDI = (P6_2); /* GPIO3[ 1] */
}
#endif
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
scu.PINMUX_CPLD_TMS = (P6_2); /* GPIO3[ 1] */
scu.PINMUX_CPLD_TDI = (P6_5); /* GPIO3[ 4] */
@ -111,7 +111,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* CPLD SGPIO interface */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.PINMUX_SGPIO0 = (P0_0);
scu.PINMUX_SGPIO1 = (P0_1);
@ -146,7 +146,7 @@ const platform_scu_t* platform_scu(void)
scu.PINMUX_SGPIO15_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
scu.PINMUX_SGPIO0 = (P0_0);
scu.PINMUX_SGPIO1 = (P0_1);
@ -184,14 +184,14 @@ const platform_scu_t* platform_scu(void)
scu.TRIGGER_EN = (P4_8); /* GPIO5[12] on P4_8 */
/* MAX283x GPIO (XCVR_CTL) PinMux */
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu.XCVR_RXHP = P8_1; /* GPIO[] on P8_1 */
scu.XCVR_B6 = P8_2; /* GPIO[] on P8_2 */
scu.XCVR_B7 = P9_3; /* GPIO[] on P9_3 */
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.XCVR_ENABLE = PE_1; /* GPIO7[1] on PE_1 */
scu.XCVR_RXENABLE = PE_2; /* GPIO7[2] on PE_2 */
@ -207,7 +207,7 @@ const platform_scu_t* platform_scu(void)
SCU_CONF_EPD_EN_PULLDOWN | SCU_CONF_EPUN_DIS_PULLUP);
}
#endif
#ifdef IS_H1_OR_JAWBREAKER
#if defined(IS_H1_OR_JAWBREAKER)
if (IS_H1_OR_JAWBREAKER) {
scu.XCVR_ENABLE = P4_6; /* GPIO2[6] on P4_6 */
scu.XCVR_RXENABLE = P4_5; /* GPIO2[5] on P4_5 */
@ -222,13 +222,13 @@ const platform_scu_t* platform_scu(void)
#endif
/* MAX5864 SPI chip select (AD_CS) GPIO PinMux */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.AD_CS = (PD_16); /* GPIO6[30] on PD_16 */
scu.AD_CS_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
scu.AD_CS = (P5_7); /* GPIO2[7] on P5_7 */
scu.AD_CS_PINCFG = (SCU_GPIO_FAST);
@ -236,7 +236,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* RFFC5071 GPIO serial interface PinMux */
#ifdef IS_H1_OR_JAWBREAKER
#if defined(IS_H1_OR_JAWBREAKER)
if (IS_H1_OR_JAWBREAKER) {
scu.MIXER_ENX = (P5_4); /* GPIO2[13] on P5_4 */
scu.MIXER_SCLK = (P2_6); /* GPIO5[6] on P2_6 */
@ -247,7 +247,7 @@ const platform_scu_t* platform_scu(void)
scu.MIXER_SDATA_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.MIXER_ENX = (P5_4); /* GPIO2[13] on P5_4 */
scu.MIXER_SCLK = (P9_5); /* GPIO5[18] on P9_5 */
@ -260,7 +260,7 @@ const platform_scu_t* platform_scu(void)
scu.MIXER_LD_PINCFG = (SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu.VCO_CE = (P5_4); /* GPIO2[13] on P5_4 */
scu.VCO_SCLK = (P2_6); /* GPIO5[6] on P2_6 */
@ -273,24 +273,24 @@ const platform_scu_t* platform_scu(void)
#endif
/* RF LDO control */
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
scu.RF_LDO_ENABLE = (P5_0); /* GPIO2[9] on P5_0 */
}
#endif
/* RF supply (VAA) control */
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
scu.NO_VAA_ENABLE = P5_0; /* GPIO2[9] on P5_0 */
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.NO_VAA_ENABLE = P8_1; /* GPIO4[1] on P8_1 */
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu.VAA_ENABLE = P5_0; /* GPIO2[9] on P5_0 */
}
@ -305,7 +305,7 @@ const platform_scu_t* platform_scu(void)
scu.FLASH_WP = (P3_5); /* GPIO1[15] on P3_5 */
/* RF switch control */
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
scu.HP = P4_0; /* GPIO2[0] on P4_0 */
scu.LP = P5_1; /* GPIO2[10] on P5_1 */
@ -322,7 +322,7 @@ const platform_scu_t* platform_scu(void)
scu.NO_RX_AMP_PWR = P2_12; /* GPIO1[12] on P2_12 */
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
scu.BY_AMP = P1_7; /* GPIO1[0] on P1_7 */
scu.BY_AMP_N = P2_5; /* GPIO5[5] on P2_5 */
@ -336,7 +336,7 @@ const platform_scu_t* platform_scu(void)
scu.RX_LNA = P6_7; /* GPIO5[15] on P6_7 */
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.TX_EN = P6_5; /* GPIO3[4] on P6_5 */
scu.MIX_EN_N = P6_3; /* GPIO3[2] on P6_3 */
@ -349,7 +349,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* Praline */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
scu.P2_CTRL0 = (PE_3); /* GPIO7[3] on PE_3 */
scu.P2_CTRL1 = (PE_4); /* GPIO7[4] on PE_4 */
@ -376,7 +376,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* HackRF One r9 */
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
scu.H1R9_CLKIN_EN = P6_7; /* GPIO5[15] on P6_7 */
scu.H1R9_CLKOUT_EN = P1_2; /* GPIO0[9] on P1_2 = has boot pull-down; */
@ -390,7 +390,7 @@ const platform_scu_t* platform_scu(void)
#endif
/* Expansion headers */
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
scu.PINMUX_PP_D0 = (P7_0); /* GPIO3[8] */
scu.PINMUX_PP_D1 = (P7_1); /* GPIO3[9] */

View file

@ -29,6 +29,8 @@ extern "C" {
#include <libopencm3/lpc43xx/scu.h>
#include "platform_detect.h"
/*
* SCU PinMux
*/
@ -38,13 +40,13 @@ typedef struct {
scu_grp_pin_t PINMUX_LED1;
scu_grp_pin_t PINMUX_LED2;
scu_grp_pin_t PINMUX_LED3;
#if defined(RAD1O) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_FOUR_LEDS)
scu_grp_pin_t PINMUX_LED4;
#endif
scu_grp_pin_t PINMUX_EN1V8;
scu_grp_pin_t PINMUX_EN1V2;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t PINMUX_EN3V3_AUX_N;
scu_grp_pin_t PINMUX_EN3V3_OC_N;
#endif
@ -52,7 +54,7 @@ typedef struct {
/* GPIO Input PinMux */
scu_grp_pin_t PINMUX_BOOT0;
scu_grp_pin_t PINMUX_BOOT1;
#if !defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_NOT_HACKRF_ONE)
scu_grp_pin_t PINMUX_BOOT2;
scu_grp_pin_t PINMUX_BOOT3;
#endif
@ -63,7 +65,7 @@ typedef struct {
scu_grp_pin_t PINMUX_PP_DIR;
/* USB peripheral */
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
scu_grp_pin_t PINMUX_USB_LED0;
scu_grp_pin_t PINMUX_USB_LED1;
#endif
@ -75,7 +77,7 @@ typedef struct {
scu_grp_pin_t SSP1_CS;
/* CPLD JTAG interface */
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t PINMUX_FPGA_CRESET;
scu_grp_pin_t PINMUX_FPGA_CDONE;
scu_grp_pin_t PINMUX_FPGA_SPI_CS;
@ -127,15 +129,15 @@ typedef struct {
uint32_t XCVR_RXENABLE_PINCFG;
uint32_t XCVR_TXENABLE_PINCFG;
uint32_t XCVR_CS_PINCFG;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t XCVR_LD;
uint32_t XCVR_LD_PINCFG;
uint32_t XCVR_RXHP_PINCFG;
#endif
#if defined(RAD1O) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_RAD1O) || defined(IS_PRALINE)
scu_grp_pin_t XCVR_RXHP;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
scu_grp_pin_t XCVR_B6;
scu_grp_pin_t XCVR_B7;
#endif
@ -145,7 +147,7 @@ typedef struct {
scu_grp_pin_t AD_CS_PINCFG;
/* RFFC5071 GPIO serial interface PinMux */
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
scu_grp_pin_t MIXER_ENX;
scu_grp_pin_t MIXER_SCLK;
scu_grp_pin_t MIXER_SDATA;
@ -153,11 +155,11 @@ typedef struct {
uint32_t MIXER_SCLK_PINCFG;
uint32_t MIXER_SDATA_PINCFG;
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t MIXER_LD;
uint32_t MIXER_LD_PINCFG;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
scu_grp_pin_t VCO_CE;
scu_grp_pin_t VCO_SCLK;
scu_grp_pin_t VCO_SDATA;
@ -168,15 +170,15 @@ typedef struct {
#endif
/* RF LDO control */
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
scu_grp_pin_t RF_LDO_ENABLE;
#endif
/* RF supply (VAA) control */
#if defined(PRALINE) || defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_PRALINE) || defined(IS_HACKRF_ONE)
scu_grp_pin_t NO_VAA_ENABLE;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
scu_grp_pin_t VAA_ENABLE;
#endif
@ -189,7 +191,7 @@ typedef struct {
scu_grp_pin_t FLASH_WP;
/* RF switch control */
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t TX_EN;
scu_grp_pin_t MIX_EN_N;
scu_grp_pin_t MIX_EN_N_R1_0;
@ -198,7 +200,7 @@ typedef struct {
scu_grp_pin_t ANT_BIAS_EN_N;
scu_grp_pin_t ANT_BIAS_OC_N;
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
scu_grp_pin_t HP;
scu_grp_pin_t LP;
scu_grp_pin_t TX_MIX_BP;
@ -213,7 +215,7 @@ typedef struct {
scu_grp_pin_t RX_AMP;
scu_grp_pin_t NO_RX_AMP_PWR;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
scu_grp_pin_t BY_AMP;
scu_grp_pin_t BY_AMP_N;
scu_grp_pin_t TX_RX;
@ -227,7 +229,7 @@ typedef struct {
#endif
/* Praline */
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
scu_grp_pin_t P2_CTRL0;
scu_grp_pin_t P2_CTRL1;
scu_grp_pin_t P1_CTRL0;
@ -252,7 +254,7 @@ typedef struct {
#endif
/* HackRF One r9 */
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
scu_grp_pin_t H1R9_CLKIN_EN;
scu_grp_pin_t H1R9_CLKOUT_EN;
scu_grp_pin_t H1R9_MCU_CLK_EN;

View file

@ -33,7 +33,7 @@
#include "rf_path.h"
#include "transceiver_mode.h"
#include "tuning.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "fpga.h"
#include "tune_config.h"
#endif
@ -197,7 +197,7 @@ static bool radio_update_sample_rate(radio_t* const radio, uint64_t* bank)
case TRANSCEIVER_MODE_SS:
n = compute_resample_log(rate / SR_FP_ONE_HZ, requested_n);
if (n != radio->config[RADIO_BANK_APPLIED][RADIO_RESAMPLE_TX]) {
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
fpga_set_tx_interpolation_ratio(&fpga, n);
}
@ -208,7 +208,7 @@ static bool radio_update_sample_rate(radio_t* const radio, uint64_t* bank)
default:
n = compute_resample_log(rate / SR_FP_ONE_HZ, requested_n);
if (n != radio->config[RADIO_BANK_APPLIED][RADIO_RESAMPLE_RX]) {
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
fpga_set_rx_decimation_ratio(&fpga, n);
}
@ -248,7 +248,7 @@ static bool radio_update_sample_rate(radio_t* const radio, uint64_t* bank)
static fp_28_36_t applied_offset = RADIO_UNSET;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
static const tune_config_t* select_tune_config(uint64_t opmode)
{
switch (opmode) {
@ -305,7 +305,7 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
radio->config[RADIO_BANK_APPLIED][RADIO_FREQUENCY_RF] =
RADIO_UNSET;
}
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
const uint64_t requested_rotation = bank[RADIO_ROTATION];
if (requested_rotation != RADIO_UNSET) {
@ -333,7 +333,7 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
}
uint64_t requested_rf_hz = requested_rf / FP_ONE_HZ;
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
bool new_rf =
(radio->config[RADIO_BANK_APPLIED][RADIO_FREQUENCY_RF] !=
@ -374,7 +374,7 @@ static bool radio_update_frequency(radio_t* const radio, uint64_t* bank)
}
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
set_freq(requested_rf_hz, opmode);
}
@ -415,7 +415,7 @@ static bool radio_update_bandwidth(radio_t* const radio, uint64_t* bank)
{
bool new_bw = false;
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
/* Praline legacy mode always sets baseband bandwidth automatically. */
(void) bank;
@ -464,7 +464,7 @@ static bool radio_update_bandwidth(radio_t* const radio, uint64_t* bank)
}
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
uint64_t lpf_bandwidth;
lpf_bandwidth = bank[RADIO_XCVR_TX_LPF];
@ -638,7 +638,7 @@ static bool radio_update_trigger(radio_t* const radio, uint64_t* bank)
static bool radio_update_dc_block(radio_t* const radio, uint64_t* bank)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
const uint64_t requested = bank[RADIO_DC_BLOCK];
bool enable = requested;

View file

@ -23,10 +23,6 @@
#include "rf_path.h"
#if defined(HACKRF_ONE) || defined(RAD1O) || defined(PRALINE) || defined(UNIVERSAL)
#include <libopencm3/lpc43xx/scu.h>
#endif
#include "hackrf_core.h"
#include "hackrf_ui.h"
#include "max283x.h"
@ -35,7 +31,8 @@
#include "platform_detect.h"
#include "sgpio.h"
#include "transceiver_mode.h"
#if defined(HACKRF_ONE) || defined(RAD1O) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_JAWBREAKER)
#include <libopencm3/lpc43xx/scu.h>
#include "gpio.h"
#include "platform_scu.h"
#endif
@ -96,7 +93,7 @@
#define SWITCHCTRL_ANT_PWR (1 << 6) /* turn on antenna port power */
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
static void switchctrl_set_hackrf_one(rf_path_t* const rf_path, uint8_t ctrl)
{
board_id_t board_id = detected_platform();
@ -190,7 +187,7 @@ static void switchctrl_set_hackrf_one(rf_path_t* const rf_path, uint8_t ctrl)
}
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
static void switchctrl_set_praline(rf_path_t* const rf_path, uint8_t ctrl)
{
if (ctrl & SWITCHCTRL_TX) {
@ -298,23 +295,23 @@ static void switchctrl_set_rad1o(rf_path_t* const rf_path, uint8_t ctrl)
static void switchctrl_set(rf_path_t* const rf_path, const uint8_t gpo)
{
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
(void) rf_path;
mixer_set_gpo(&mixer, gpo);
}
#endif
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
switchctrl_set_hackrf_one(rf_path, gpo);
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
switchctrl_set_praline(rf_path, gpo);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
switchctrl_set_rad1o(rf_path, gpo);
}
@ -325,13 +322,11 @@ void rf_path_pin_setup(rf_path_t* const rf_path)
{
#if defined(JAWBREAKER)
(void) rf_path;
#endif
#if !defined(JAWBREAKER)
#else
const platform_scu_t* scu = platform_scu();
#endif
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
/* Configure RF switch control signals */
// clang-format off
@ -347,7 +342,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path)
scu_pinmux(scu->RX_AMP, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(scu->NO_RX_AMP_PWR, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
// clang-format on
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
scu_pinmux(scu->H1R9_RX, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
scu_pinmux(
@ -360,7 +355,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path)
SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
scu_pinmux(scu->TX, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
scu_pinmux(scu->RX, SCU_GPIO_FAST | SCU_CONF_FUNCTION4);
@ -390,7 +385,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path)
gpio_output(rf_path->gpio_rx);
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
/* Configure RF switch control signals */
// clang-format off
@ -431,7 +426,7 @@ void rf_path_pin_setup(rf_path_t* const rf_path)
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
/* Configure RF switch control signals */
scu_pinmux(scu->TX_EN, SCU_GPIO_FAST | SCU_CONF_FUNCTION0);
@ -477,14 +472,14 @@ void rf_path_init(rf_path_t* const rf_path)
max283x_setup(&max283x);
max283x_start(&max283x);
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
mixer_setup(&mixer, MAX2871_VARIANT);
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
#ifdef IS_NOT_HACKRF_ONE
#if defined(IS_NOT_HACKRF_ONE)
if (IS_NOT_HACKRF_ONE) {
mixer_setup(&mixer, RFFC5071_VARIANT);
}
@ -536,7 +531,7 @@ void rf_path_set_direction(rf_path_t* const rf_path, const rf_path_direction_t d
sgpio_configure(&sgpio_config, SGPIO_DIRECTION_RX);
break;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
case RF_PATH_DIRECTION_TX_CALIBRATION:
case RF_PATH_DIRECTION_RX_CALIBRATION:
rf_path->switchctrl &= ~SWITCHCTRL_TX;

View file

@ -25,8 +25,9 @@
#include <stdint.h>
#include "platform_detect.h"
#include "transceiver_mode.h"
#if defined(HACKRF_ONE) || defined(RAD1O) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE) || defined(IS_RAD1O) || defined(IS_PRALINE)
#include "gpio.h"
#endif
@ -34,7 +35,7 @@ typedef enum {
RF_PATH_DIRECTION_OFF,
RF_PATH_DIRECTION_RX,
RF_PATH_DIRECTION_TX,
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
RF_PATH_DIRECTION_TX_CALIBRATION,
RF_PATH_DIRECTION_RX_CALIBRATION,
#endif
@ -50,7 +51,7 @@ typedef struct {
uint8_t switchctrl;
struct {
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
gpio_t gpio_hp;
gpio_t gpio_lp;
gpio_t gpio_tx_mix_bp;
@ -68,7 +69,7 @@ typedef struct {
gpio_t gpio_h1r9_no_ant_pwr;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
gpio_t gpio_tx_rx_n;
gpio_t gpio_tx_rx;
gpio_t gpio_by_mix;
@ -82,7 +83,7 @@ typedef struct {
gpio_t gpio_rx_lna;
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t gpio_tx_en;
gpio_t gpio_mix_en_n;
gpio_t gpio_lpf_en;

View file

@ -34,16 +34,13 @@
#include <stdint.h>
#include <string.h>
#if defined(PRALINE) || defined(UNIVERSAL)
#include <libopencm3/lpc43xx/scu.h>
#endif
#include "delay.h"
#include "platform_detect.h"
#include "rffc5071.h"
#include "rffc5071_regs.def" // private register def macros
#include "selftest.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include <libopencm3/lpc43xx/scu.h>
#include "platform_scu.h"
#endif
@ -108,7 +105,7 @@ void rffc5071_setup(rffc5071_driver_t* const drv)
gpio_set(drv->gpio_reset);
gpio_output(drv->gpio_reset);
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
/* Configure mixer PLL lock detect pin */
const platform_scu_t* scu = platform_scu();
@ -133,7 +130,7 @@ void rffc5071_setup(rffc5071_driver_t* const drv)
set_RFFC5071_FULLD(drv, 0);
set_RFFC5071_MODE(drv, 1);
#ifdef IS_H1_OR_PRALINE
#if defined(IS_H1_OR_PRALINE)
if (IS_H1_OR_PRALINE) {
set_RFFC5071_LOCK(drv, 1);
}
@ -180,12 +177,12 @@ void rffc5071_lock_test(rffc5071_driver_t* const drv)
bool rffc5071_check_lock(rffc5071_driver_t* const drv)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
return gpio_read(drv->gpio_ld);
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
set_RFFC5071_READSEL(drv, 0b0001);
rffc5071_regs_commit(drv);
@ -354,14 +351,14 @@ void rffc5071_set_gpo(rffc5071_driver_t* const drv, uint8_t gpo)
rffc5071_regs_commit(drv);
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
bool rffc5071_poll_ld(rffc5071_driver_t* const drv, uint8_t* prelock_state)
{
// This is only supported on Praline hardware.
//
// For all other boards we'll just return true to avoid a situation where a
// a caller is waiting for a lock signal that will never be detected.
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
return true;
}

View file

@ -26,6 +26,7 @@
#include <stdint.h>
#include "gpio.h"
#include "platform_detect.h"
#include "spi_bus.h"
/* 31 registers, each containing 16 bits of data. */
@ -34,7 +35,7 @@
typedef struct {
spi_bus_t* const bus;
gpio_t gpio_reset;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
gpio_t gpio_ld;
#endif
uint16_t regs[RFFC5071_NUM_REGS];
@ -66,7 +67,7 @@ extern void rffc5071_enable(rffc5071_driver_t* const drv);
extern void rffc5071_disable(rffc5071_driver_t* const drv);
extern void rffc5071_set_gpo(rffc5071_driver_t* const drv, uint8_t);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
extern bool rffc5071_poll_ld(rffc5071_driver_t* const drv, uint8_t* prelock_state);
#endif
extern bool rffc5071_check_lock(rffc5071_driver_t* const drv);

View file

@ -24,6 +24,8 @@
#include <stdbool.h>
#include <stdint.h>
#include "platform_detect.h"
#define NUM_LOCK_ATTEMPTS 3
enum {
@ -37,10 +39,10 @@ typedef uint8_t test_result_t;
typedef struct {
uint16_t mixer_id;
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
bool mixer_locks[NUM_LOCK_ATTEMPTS];
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
uint16_t max2831_mux_rssi_1;
uint16_t max2831_mux_temp;
uint16_t max2831_mux_rssi_2;
@ -52,7 +54,7 @@ typedef struct {
uint8_t max283x_readback_total_registers;
uint8_t si5351_rev_id;
bool si5351_readback_ok;
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
test_result_t fpga_image_load;
test_result_t fpga_spi;
test_result_t sgpio_rx;

View file

@ -31,7 +31,7 @@
#include "platform_detect.h"
#include "platform_scu.h"
#include "sgpio.h"
#if !defined(PRALINE)
#ifdef IS_NOT_PRALINE
#include "hackrf_core.h"
#endif
@ -57,14 +57,14 @@ void sgpio_configure_pin_functions(sgpio_config_t* const config)
scu_pinmux(scu->PINMUX_SGPIO14, scu->PINMUX_SGPIO14_PINCFG); /* GPIO5[13] */
scu_pinmux(scu->PINMUX_SGPIO15, scu->PINMUX_SGPIO15_PINCFG); /* GPIO5[14] */
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
scu_pinmux(
scu->H1R9_TRIGGER_EN,
SCU_GPIO_FAST | SCU_CONF_FUNCTION4); /* GPIO5[5] */
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
scu_pinmux(
scu->TRIGGER_EN,
@ -75,7 +75,7 @@ void sgpio_configure_pin_functions(sgpio_config_t* const config)
sgpio_cpld_set_mixer_invert(config, 0);
gpio_output(config->gpio_q_invert);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
trigger_enable(false);
gpio_output(config->gpio_trigger_enable);

View file

@ -26,6 +26,7 @@
#include <stdint.h>
#include "gpio.h"
#include "platform_detect.h"
typedef enum {
SGPIO_DIRECTION_RX,
@ -34,7 +35,7 @@ typedef enum {
typedef struct {
gpio_t gpio_q_invert;
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
gpio_t gpio_trigger_enable;
#endif
bool slice_mode_multislice;

View file

@ -23,16 +23,13 @@
#include <stdbool.h>
#include <stddef.h>
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#include <libopencm3/lpc43xx/scu.h>
#endif
#include "clkin.h"
#include "delay.h"
#include "platform_detect.h"
#include "selftest.h"
#include "si5351c.h"
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
#include <libopencm3/lpc43xx/scu.h>
#include "gpio.h"
#include "platform_gpio.h"
#include "platform_scu.h"
@ -269,7 +266,7 @@ void si5351c_configure_clock_control(si5351c_driver_t* const drv)
SI5351C_CLK_POWERDOWN |
SI5351C_CLK_INT_MODE /* not connected, but: PLL B int mode */
};
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
data[1] = SI5351C_CLK_INT_MODE | SI5351C_CLK_PLL_SRC(SI5351C_PLL_A) |
SI5351C_CLK_SRC(SI5351C_CLK_SRC_MULTISYNTH_SELF) |
@ -283,7 +280,7 @@ void si5351c_configure_clock_control(si5351c_driver_t* const drv)
data[6] = SI5351C_CLK_POWERDOWN;
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
/* CLK0: AFE_CLK */
data[1] = SI5351C_CLK_FRAC_MODE | SI5351C_CLK_PLL_SRC(SI5351C_PLL_A) |
@ -333,7 +330,7 @@ void si5351c_enable_clock_outputs(si5351c_driver_t* const drv)
uint8_t clkout = 3;
uint8_t value = 0;
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
value = SI5351C_CLK_ENABLE(0) | SI5351C_CLK_ENABLE(1) |
SI5351C_CLK_ENABLE(4) | SI5351C_CLK_ENABLE(5) |
@ -346,7 +343,7 @@ void si5351c_enable_clock_outputs(si5351c_driver_t* const drv)
}
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
value = SI5351C_CLK_ENABLE(0) | SI5351C_CLK_ENABLE(1) |
SI5351C_CLK_ENABLE(2) | SI5351C_CLK_ENABLE(4) |
@ -354,7 +351,7 @@ void si5351c_enable_clock_outputs(si5351c_driver_t* const drv)
SI5351C_CLK_DISABLE(7);
/* HackRF One r9 has only three clock generator outputs. */
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
clkout = 2;
value = SI5351C_CLK_ENABLE(0) | SI5351C_CLK_ENABLE(1) |
@ -372,7 +369,7 @@ void si5351c_enable_clock_outputs(si5351c_driver_t* const drv)
si5351c_write(drv, data, sizeof(data));
outputs_disabled = value;
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
const platform_gpio_t* gpio = platform_gpio();
if (clkout_enabled) {
@ -411,7 +408,7 @@ void si5351c_set_clock_source(si5351c_driver_t* const drv, const enum pll_source
return;
}
si5351c_disable_all_outputs(drv);
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
/*
* HackRF One r9 always uses PLL A on the XTAL input
@ -425,7 +422,7 @@ void si5351c_set_clock_source(si5351c_driver_t* const drv, const enum pll_source
}
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
si5351c_configure_pll_sources(drv, source);
}
@ -484,7 +481,7 @@ void si5351c_init(si5351c_driver_t* const drv)
selftest.report.pass = false;
}
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
const platform_gpio_t* gpio = platform_gpio();
const platform_scu_t* scu = platform_scu();

View file

@ -21,7 +21,9 @@
#pragma once
#if defined(PRALINE) || defined(UNIVERSAL)
#include "platform_detect.h"
#if defined(IS_PRALINE)
#include "fpga.h"
typedef struct {

View file

@ -30,10 +30,10 @@
#include "platform_detect.h"
#include "sgpio.h"
#include "transceiver_mode.h"
#if defined(PRALINE) || defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
#include "operacake.h"
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "fpga.h"
#endif
@ -46,7 +46,7 @@ static uint64_t MAX_BYPASS_FREQ_MHZ;
static uint64_t ABS_MAX_BYPASS_FREQ_MHZ;
static uint64_t MIN_HP_FREQ_MHZ;
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
static uint64_t MID1_HP_FREQ_MHZ;
static uint64_t MID2_HP_FREQ_MHZ;
#endif
@ -58,7 +58,7 @@ static uint64_t MAX_LO_FREQ_HZ;
void tuning_setup(void)
{
/* clang-format off */
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
MIN_LP_FREQ_MHZ = 0;
MAX_LP_FREQ_MHZ = 2320ULL;
@ -75,7 +75,7 @@ void tuning_setup(void)
MAX_LO_FREQ_HZ = 5400000000ULL;
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
MIN_LP_FREQ_MHZ = 0;
MAX_LP_FREQ_MHZ = 2170ULL;
@ -97,7 +97,7 @@ void tuning_setup(void)
/* clang-format on */
}
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
static uint32_t max2837_freq_nominal_hz = 2560000000;
/*
@ -119,12 +119,12 @@ bool set_freq(const uint64_t freq, const transceiver_mode_t opmode)
max283x_set_mode(&max283x, MAX283x_MODE_STANDBY);
if (freq_mhz < MAX_LP_FREQ_MHZ) {
rf_path_set_filter(&rf_path, RF_PATH_FILTER_LOW_PASS, opmode);
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
max2837_freq_nominal_hz = 2300 * FREQ_ONE_MHZ;
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
/* IF is graduated from 2650 MHz to 2340 MHz */
max2837_freq_nominal_hz = (2650 * FREQ_ONE_MHZ) - (freq / 7);
@ -170,7 +170,7 @@ bool set_freq(const uint64_t freq, const transceiver_mode_t opmode)
if (opmode != TRANSCEIVER_MODE_RX_SWEEP) {
hackrf_ui()->set_frequency(freq);
}
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
operacake_set_range(freq_mhz);
}
@ -180,7 +180,7 @@ bool set_freq(const uint64_t freq, const transceiver_mode_t opmode)
}
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
bool tuning_set_frequency(
const tune_config_t* cfg,
const uint64_t freq,

View file

@ -26,9 +26,10 @@
#include <stdbool.h>
#include <stdint.h>
#include "platform_detect.h"
#include "rf_path.h"
#include "transceiver_mode.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "tune_config.h"
#endif
@ -43,7 +44,7 @@ bool set_freq_explicit(
const rf_path_filter_t path,
const transceiver_mode_t opmode);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
bool tuning_set_frequency(
const tune_config_t* cfg,
const uint64_t freq,

View file

@ -46,14 +46,14 @@
#include <usb_request.h>
#include <usb_standard_request.h>
#include <usb_type.h>
#if defined(PRALINE) || defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_EXPANSION_COMPATIBLE)
#include <portapack.h>
#endif
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
#include <mixer.h>
#include <rffc5071.h>
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include <fpga.h>
#if !(defined(DFU_MODE) || defined(RAM_MODE))
#include <lz4_buf.h>
@ -61,7 +61,7 @@
#include <w25q80bv.h>
#endif
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
#include <cpld_jtag.h>
#include <cpld_xc2c.h>
#endif
@ -79,10 +79,10 @@
#include "usb_descriptor.h"
#include "usb_device.h"
#include "usb_endpoint.h"
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include "usb_api_praline.h"
#endif
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
#include "usb_api_cpld.h"
#endif
@ -100,7 +100,7 @@ static usb_request_handler_fn vendor_request_handler[] = {
usb_vendor_request_read_si5351c,
usb_vendor_request_set_sample_rate_frac,
usb_vendor_request_set_baseband_filter_bandwidth,
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
usb_vendor_request_write_rffc5071,
usb_vendor_request_read_rffc5071,
#else
@ -120,7 +120,7 @@ static usb_request_handler_fn vendor_request_handler[] = {
usb_vendor_request_set_vga_gain,
usb_vendor_request_set_txvga_gain,
NULL, // was set_if_freq
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
usb_vendor_request_set_antenna_enable,
#else
NULL,
@ -137,7 +137,7 @@ static usb_request_handler_fn vendor_request_handler[] = {
usb_vendor_request_spiflash_status,
usb_vendor_request_spiflash_clear_status,
usb_vendor_request_operacake_gpio_test,
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
usb_vendor_request_cpld_checksum,
#else
NULL,
@ -154,7 +154,7 @@ static usb_request_handler_fn vendor_request_handler[] = {
usb_vendor_request_read_supported_platform,
usb_vendor_request_set_leds,
usb_vendor_request_user_config_set_bias_t_opts,
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
usb_vendor_request_write_fpga_reg,
usb_vendor_request_read_fpga_reg,
usb_vendor_request_p2_ctrl,
@ -250,7 +250,7 @@ void usb_set_descriptor_by_serial_number(void)
}
}
#if !defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_NOT_PRALINE)
static bool cpld_jtag_sram_load(jtag_t* const jtag)
{
cpld_jtag_take(jtag);
@ -278,7 +278,7 @@ static void m0_rom_to_ram(void)
memcpy(dest, (uint32_t*) (base + src), len);
}
#if (defined(PRALINE) || defined(UNIVERSAL)) && !(defined(DFU_MODE) || defined(RAM_MODE))
#if defined(IS_PRALINE) && !(defined(DFU_MODE) || defined(RAM_MODE))
extern uint32_t _binary_fpga_bin_start;
void fpga_loader_setup(void)
@ -319,7 +319,7 @@ int main(void)
}
delay_us_at_mhz(10000, 96);
pin_setup();
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
enable_3v3aux_power();
#if !defined(DFU_MODE) && !defined(RAM_MODE)
@ -333,10 +333,10 @@ int main(void)
#endif
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
enable_1v8_power();
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
/*
* On rad1o, the clock generator power supply comes from the RF supply
@ -349,19 +349,19 @@ int main(void)
}
#endif
tuning_setup();
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
// Set up mixer before enabling RF power, because its
// GPO is used to control the antenna bias tee.
mixer_setup(&mixer, RFFC5071_VARIANT);
}
#endif
#ifdef IS_H1_OR_RAD1O
#if defined(IS_H1_OR_RAD1O)
if (IS_H1_OR_RAD1O) {
enable_rf_power();
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
clock_gen_init();
}
@ -372,14 +372,14 @@ int main(void)
ipc_halt_m0();
ipc_start_m0((uint32_t) &__ram_m0_start__);
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
if (!cpld_jtag_sram_load(&jtag_cpld)) {
halt_and_flash(6000000);
}
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
#if defined(DFU_MODE) || defined(RAM_MODE)
selftest.fpga_image_load = SKIPPED;
@ -394,7 +394,7 @@ int main(void)
#endif
radio_init(&radio);
#ifdef IS_EXPANSION_COMPATIBLE
#if defined(IS_EXPANSION_COMPATIBLE)
if (IS_EXPANSION_COMPATIBLE) {
portapack_init();
}
@ -407,26 +407,26 @@ int main(void)
usb_set_configuration_changed_cb(usb_configuration_changed);
usb_peripheral_reset();
#ifdef IS_HACKRF_ONE
#if defined(IS_HACKRF_ONE)
if (IS_HACKRF_ONE) {
memcpy(&usb_device,
&usb_device_hackrf_one,
sizeof(usb_device_hackrf_one));
}
#endif
#ifdef IS_JAWBREAKER
#if defined(IS_JAWBREAKER)
if (IS_JAWBREAKER) {
memcpy(&usb_device,
&usb_device_jawbreaker,
sizeof(usb_device_jawbreaker));
}
#endif
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
memcpy(&usb_device, &usb_device_rad1o, sizeof(usb_device_rad1o));
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
memcpy(&usb_device, &usb_device_praline, sizeof(usb_device_praline));
}
@ -453,7 +453,7 @@ int main(void)
rffc5071_lock_test(&mixer.rffc5071);
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
fpga_if_xcvr_selftest();
}
@ -504,7 +504,7 @@ int main(void)
sweep_mode(request.seq);
break;
case TRANSCEIVER_MODE_CPLD_UPDATE:
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
cpld_update();
}

View file

@ -20,7 +20,6 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "usb_api_board_info.h"
#include <string.h>
@ -34,7 +33,7 @@
#include <usb_queue.h>
#include <usb_request.h>
#include <usb_type.h>
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
#include <gpio.h>
#include <platform_gpio.h>
#endif
@ -131,7 +130,7 @@ usb_request_status_t usb_vendor_request_reset(
if (stage == USB_TRANSFER_STAGE_SETUP) {
pin_shutdown();
clock_gen_shutdown();
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
/*
* Set boot pins as inputs so that the bootloader reads them

View file

@ -21,7 +21,6 @@
* the Free Software Foundation, Inc., 51 Franklin Street,
* Boston, MA 02110-1301, USA.
*/
#include "usb_api_register.h"
#include <stdbool.h>
@ -36,10 +35,10 @@
#include <usb_queue.h>
#include <usb_request.h>
#include <usb_type.h>
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
#include <fpga.h>
#endif
#if !defined(RAD1O)
#if defined(IS_NOT_RAD1O)
#include <mixer.h>
#include <rffc5071.h>
#endif
@ -142,7 +141,7 @@ usb_request_status_t usb_vendor_request_write_rffc5071(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage)
{
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
(void) endpoint;
(void) stage;
@ -150,7 +149,7 @@ usb_request_status_t usb_vendor_request_write_rffc5071(
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
if (stage == USB_TRANSFER_STAGE_SETUP) {
if (endpoint->setup.index < RFFC5071_NUM_REGS) {
@ -172,7 +171,7 @@ usb_request_status_t usb_vendor_request_read_rffc5071(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage)
{
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
(void) endpoint;
(void) stage;
@ -180,7 +179,7 @@ usb_request_status_t usb_vendor_request_read_rffc5071(
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
uint16_t value;
if (stage == USB_TRANSFER_STAGE_SETUP) {
@ -290,12 +289,12 @@ usb_request_status_t usb_vendor_request_user_config_set_bias_t_opts(
return USB_REQUEST_STATUS_OK;
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
usb_request_status_t usb_vendor_request_write_fpga_reg(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
if (stage == USB_TRANSFER_STAGE_SETUP) {
fpga_reg_write(
@ -315,7 +314,7 @@ usb_request_status_t usb_vendor_request_read_fpga_reg(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage)
{
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
if (stage == USB_TRANSFER_STAGE_SETUP) {
const uint8_t value = fpga_reg_read(&fpga, endpoint->setup.index);

View file

@ -23,6 +23,8 @@
#pragma once
#include "platform_detect.h"
#include <usb_request.h>
#include <usb_type.h>
@ -56,7 +58,7 @@ usb_request_status_t usb_vendor_request_set_leds(
usb_request_status_t usb_vendor_request_user_config_set_bias_t_opts(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage);
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
usb_request_status_t usb_vendor_request_write_fpga_reg(
usb_endpoint_t* const endpoint,
const usb_transfer_stage_t stage);

View file

@ -19,11 +19,10 @@
* Boston, MA 02110-1301, USA.
*/
#include "usb_api_selftest.h"
#include <stddef.h>
#include <stdint.h>
#if !defined(RAD1O)
#include <stdbool.h>
#endif
#include <libopencm3/lpc43xx/cgu.h>
#include <libopencm3/lpc43xx/creg.h>
@ -34,7 +33,9 @@
#include <usb_request.h>
#include <usb_type.h>
#include "usb_api_selftest.h"
#if defined(IS_NOT_RAD1O)
#include <stdbool.h>
#endif
static char* itoa(int val, int base)
{
@ -61,7 +62,7 @@ void append(char** dest, size_t* capacity, const char* str)
}
}
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
static const char* test_result_to_str(test_result_t result)
{
switch (result) {
@ -82,14 +83,14 @@ void generate_selftest_report(void)
{
char* s = &selftest.report.msg[0];
size_t c = sizeof(selftest.report.msg);
#ifdef IS_RAD1O
#if defined(IS_RAD1O)
if (IS_RAD1O) {
append(&s, &c, "Mixer: MAX2871, ID: ");
append(&s, &c, itoa(selftest.mixer_id, 10));
append(&s, &c, "\n");
}
#endif
#ifdef IS_NOT_RAD1O
#if defined(IS_NOT_RAD1O)
if (IS_NOT_RAD1O) {
append(&s, &c, "Mixer: RFFC5072, ID: ");
append(&s, &c, itoa(selftest.mixer_id >> 3, 10));
@ -117,22 +118,22 @@ void generate_selftest_report(void)
append(&s, &c, selftest.si5351_readback_ok ? "OK" : "FAIL");
append(&s, &c, "\n");
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
append(&s, &c, "Transceiver: MAX2831, RSSI mux test: ");
append(&s, &c, selftest.max2831_mux_test_ok ? "PASS" : "FAIL");
append(&s, &c, "\n");
}
#endif
#ifdef IS_NOT_PRALINE
#if defined(IS_NOT_PRALINE)
if (IS_NOT_PRALINE) {
append(&s, &c, "Transceiver: ");
#ifdef IS_H1_R9
#if defined(IS_H1_R9)
if (IS_H1_R9) {
append(&s, &c, "MAX2839");
}
#endif
#ifdef IS_NOT_H1_R9
#if defined(IS_NOT_H1_R9)
if (IS_NOT_H1_R9) {
append(&s, &c, "MAX2837");
}
@ -153,7 +154,7 @@ void generate_selftest_report(void)
append(&s, &c, "\n");
}
#endif
#ifdef IS_PRALINE
#if defined(IS_PRALINE)
if (IS_PRALINE) {
append(&s, &c, "FPGA configuration: ");
append(&s, &c, test_result_to_str(selftest.fpga_image_load));

View file

@ -26,17 +26,9 @@
#include <usb_type.h>
#define USB_VENDOR_ID (0x1D50)
#include "platform_detect.h"
#if (defined HACKRF_ONE || defined PRALINE)
#define USB_PRODUCT_ID (0x6089)
#elif JAWBREAKER
#define USB_PRODUCT_ID (0x604B)
#elif RAD1O
#define USB_PRODUCT_ID (0xCC15)
#else
#define USB_PRODUCT_ID (0xFFFF)
#endif
#define USB_VENDOR_ID (0x1D50)
#define USB_API_VERSION (0x0111)
@ -51,7 +43,7 @@
#define USB_STRING_LANGID (0x0409)
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
uint8_t usb_descriptor_device_hackrf[] = {
18, // bLength
USB_DESCRIPTOR_TYPE_DEVICE, // bDescriptorType
@ -69,7 +61,7 @@ uint8_t usb_descriptor_device_hackrf[] = {
0x01 // bNumConfigurations
};
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
uint8_t usb_descriptor_device_jawbreaker[] = {
18, // bLength
USB_DESCRIPTOR_TYPE_DEVICE, // bDescriptorType
@ -87,7 +79,7 @@ uint8_t usb_descriptor_device_jawbreaker[] = {
0x01 // bNumConfigurations
};
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
uint8_t usb_descriptor_device_rad1o[] = {
18, // bLength
USB_DESCRIPTOR_TYPE_DEVICE, // bDescriptorType
@ -223,7 +215,7 @@ uint8_t usb_descriptor_string_manufacturer[] = {
's', 0x00,
};
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
uint8_t usb_descriptor_string_product_hackrf_one[] = {
22, // bLength
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
@ -239,7 +231,7 @@ uint8_t usb_descriptor_string_product_hackrf_one[] = {
'e', 0x00,
};
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
uint8_t usb_descriptor_string_product_praline[] = {
22, // bLength
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
@ -255,7 +247,7 @@ uint8_t usb_descriptor_string_product_praline[] = {
'o', 0x00,
};
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
uint8_t usb_descriptor_string_product_jawbreaker[] = {
36, // bLength
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
@ -278,7 +270,7 @@ uint8_t usb_descriptor_string_product_jawbreaker[] = {
'r', 0x00,
};
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
uint8_t usb_descriptor_string_product_rad1o[] = {
12, // bLength
USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType
@ -329,7 +321,7 @@ uint8_t usb_descriptor_string_serial_number[] = {
uint8_t usb_descriptor_string_serial_number[USB_DESCRIPTOR_STRING_SERIAL_BUF_LEN];
#endif
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
uint8_t* usb_descriptor_strings_hackrf_one[] = {
usb_descriptor_string_languages,
usb_descriptor_string_manufacturer,
@ -339,7 +331,7 @@ uint8_t* usb_descriptor_strings_hackrf_one[] = {
0, // TERMINATOR
};
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
uint8_t* usb_descriptor_strings_praline[] = {
usb_descriptor_string_languages,
usb_descriptor_string_manufacturer,
@ -349,7 +341,7 @@ uint8_t* usb_descriptor_strings_praline[] = {
0, // TERMINATOR
};
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
uint8_t* usb_descriptor_strings_jawbreaker[] = {
usb_descriptor_string_languages,
usb_descriptor_string_manufacturer,
@ -359,7 +351,7 @@ uint8_t* usb_descriptor_strings_jawbreaker[] = {
0, // TERMINATOR
};
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
uint8_t* usb_descriptor_strings_rad1o[] = {
usb_descriptor_string_languages,
usb_descriptor_string_manufacturer,

View file

@ -24,13 +24,15 @@
#include <stdint.h>
#if defined(HACKRF_ONE) || defined(PRALINE) || defined(UNIVERSAL)
#include "platform_detect.h"
#if defined(IS_HACKRF_ONE) || defined(IS_PRALINE)
extern uint8_t usb_descriptor_device_hackrf[];
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
extern uint8_t usb_descriptor_device_jawbreaker[];
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
extern uint8_t usb_descriptor_device_rad1o[];
#endif
extern uint8_t usb_descriptor_device_qualifier[];
@ -38,16 +40,16 @@ extern uint8_t usb_descriptor_configuration_full_speed[];
extern uint8_t usb_descriptor_configuration_high_speed[];
extern uint8_t usb_descriptor_string_languages[];
extern uint8_t usb_descriptor_string_manufacturer[];
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
extern uint8_t usb_descriptor_string_product_hackrf_one[];
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
extern uint8_t usb_descriptor_string_product_praline[];
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
extern uint8_t usb_descriptor_string_product_jawbreaker[];
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
extern uint8_t usb_descriptor_string_product_rad1o[];
#endif

View file

@ -25,6 +25,7 @@
#include <usb_type.h>
#include "platform_detect.h"
#include "usb_descriptor.h"
usb_configuration_t usb_configuration_high_speed = {
@ -47,7 +48,7 @@ usb_configuration_t* usb_configurations[] = {
usb_device_t usb_device;
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
const usb_device_t usb_device_hackrf_one = {
.descriptor = usb_descriptor_device_hackrf,
.descriptor_strings = usb_descriptor_strings_hackrf_one,
@ -58,7 +59,7 @@ const usb_device_t usb_device_hackrf_one = {
.wcid_feature_descriptor = wcid_feature_descriptor,
};
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
const usb_device_t usb_device_praline = {
.descriptor = usb_descriptor_device_hackrf,
.descriptor_strings = usb_descriptor_strings_praline,
@ -69,7 +70,7 @@ const usb_device_t usb_device_praline = {
.wcid_feature_descriptor = wcid_feature_descriptor,
};
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
const usb_device_t usb_device_jawbreaker = {
.descriptor = usb_descriptor_device_jawbreaker,
.descriptor_strings = usb_descriptor_strings_jawbreaker,
@ -80,7 +81,7 @@ const usb_device_t usb_device_jawbreaker = {
.wcid_feature_descriptor = wcid_feature_descriptor,
};
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
const usb_device_t usb_device_rad1o = {
.descriptor = usb_descriptor_device_rad1o,
.descriptor_strings = usb_descriptor_strings_rad1o,

View file

@ -25,17 +25,19 @@
#include <usb_type.h>
#include "platform_detect.h"
extern usb_device_t usb_device;
#if defined(HACKRF_ONE) || defined(UNIVERSAL)
#if defined(IS_HACKRF_ONE)
extern const usb_device_t usb_device_hackrf_one;
#endif
#if defined(PRALINE) || defined(UNIVERSAL)
#if defined(IS_PRALINE)
extern const usb_device_t usb_device_praline;
#endif
#if defined(JAWBREAKER)
#if defined(IS_JAWBREAKER)
extern const usb_device_t usb_device_jawbreaker;
#endif
#if defined(RAD1O)
#if defined(IS_RAD1O)
extern const usb_device_t usb_device_rad1o;
#endif