PortaPack: Remove conditional PortaPack code.

TODO: DFU mode returns. I fear HackRF mode in PortaPack/HAVOC will not work.
This commit is contained in:
Jared Boone
2019-02-01 21:37:54 +00:00
parent c32d57158a
commit 8bc8bc13f0
8 changed files with 4 additions and 45 deletions

View File

@ -31,11 +31,6 @@ $ hackrf_spiflash -w hackrf_usb.bin
If you have a Jawbreaker, add -DBOARD=JAWBREAKER to the cmake command. If you have a Jawbreaker, add -DBOARD=JAWBREAKER to the cmake command.
If you have a rad1o, use -DBOARD=RAD1O instead. If you have a rad1o, use -DBOARD=RAD1O instead.
If you have a HackRF One and want to build optional PortaPack display support,
also specify -DUSER_INTERFACE=PORTAPACK. If PortaPack hardware is not detected
by hardware probing at start-up, the HackRF firmware will run without UI
support.
It is possible to use a USB Device Firmware Upgrade (DFU) method to load It is possible to use a USB Device Firmware Upgrade (DFU) method to load
firmware into RAM. This is normally only required to recover a device that has firmware into RAM. This is normally only required to recover a device that has
had faulty firmware loaded, but it can also be useful for firmware developers. had faulty firmware loaded, but it can also be useful for firmware developers.

View File

@ -35,18 +35,14 @@ void cpld_jtag_take(jtag_t* const jtag) {
/* Set initial GPIO state to the voltages of the internal or external pull-ups/downs, /* Set initial GPIO state to the voltages of the internal or external pull-ups/downs,
* to avoid any glitches. * to avoid any glitches.
*/ */
#ifdef USER_INTERFACE_PORTAPACK
gpio_set(gpio->gpio_pp_tms); gpio_set(gpio->gpio_pp_tms);
#endif
gpio_set(gpio->gpio_tms); gpio_set(gpio->gpio_tms);
gpio_set(gpio->gpio_tdi); gpio_set(gpio->gpio_tdi);
gpio_clear(gpio->gpio_tck); gpio_clear(gpio->gpio_tck);
#ifdef USER_INTERFACE_PORTAPACK
/* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */ /* Do not drive PortaPack-specific TMS pin initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms); gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo); gpio_input(gpio->gpio_pp_tdo);
#endif
gpio_output(gpio->gpio_tms); gpio_output(gpio->gpio_tms);
gpio_output(gpio->gpio_tdi); gpio_output(gpio->gpio_tdi);
gpio_output(gpio->gpio_tck); gpio_output(gpio->gpio_tck);
@ -59,11 +55,9 @@ void cpld_jtag_release(jtag_t* const jtag) {
/* Make all pins inputs when JTAG interface not active. /* Make all pins inputs when JTAG interface not active.
* Let the pull-ups/downs do the work. * Let the pull-ups/downs do the work.
*/ */
#ifdef USER_INTERFACE_PORTAPACK
/* Do not drive PortaPack-specific pins, initially, just to be cautious. */ /* Do not drive PortaPack-specific pins, initially, just to be cautious. */
gpio_input(gpio->gpio_pp_tms); gpio_input(gpio->gpio_pp_tms);
gpio_input(gpio->gpio_pp_tdo); gpio_input(gpio->gpio_pp_tdo);
#endif
gpio_input(gpio->gpio_tms); gpio_input(gpio->gpio_tms);
gpio_input(gpio->gpio_tdi); gpio_input(gpio->gpio_tdi);
gpio_input(gpio->gpio_tck); gpio_input(gpio->gpio_tck);

View File

@ -31,10 +31,8 @@ typedef struct jtag_gpio_t {
gpio_t gpio_tck; gpio_t gpio_tck;
gpio_t gpio_tdi; gpio_t gpio_tdi;
gpio_t gpio_tdo; gpio_t gpio_tdo;
#ifdef USER_INTERFACE_PORTAPACK
gpio_t gpio_pp_tms; gpio_t gpio_pp_tms;
gpio_t gpio_pp_tdo; gpio_t gpio_pp_tdo;
#endif
} jtag_gpio_t; } jtag_gpio_t;
typedef struct jtag_t { typedef struct jtag_t {

View File

@ -124,10 +124,8 @@ static struct gpio_t gpio_cpld_tms = GPIO(3, 1);
static struct gpio_t gpio_cpld_tdi = GPIO(3, 4); static struct gpio_t gpio_cpld_tdi = GPIO(3, 4);
#endif #endif
#ifdef USER_INTERFACE_PORTAPACK
static struct gpio_t gpio_cpld_pp_tms = GPIO(1, 1); static struct gpio_t gpio_cpld_pp_tms = GPIO(1, 1);
static struct gpio_t gpio_cpld_pp_tdo = GPIO(1, 8); static struct gpio_t gpio_cpld_pp_tdo = GPIO(1, 8);
#endif
static struct gpio_t gpio_hw_sync_enable = GPIO(5,12); static struct gpio_t gpio_hw_sync_enable = GPIO(5,12);
static struct gpio_t gpio_rx_q_invert = GPIO(0, 13); static struct gpio_t gpio_rx_q_invert = GPIO(0, 13);
@ -276,10 +274,8 @@ jtag_gpio_t jtag_gpio_cpld = {
.gpio_tck = &gpio_cpld_tck, .gpio_tck = &gpio_cpld_tck,
.gpio_tdi = &gpio_cpld_tdi, .gpio_tdi = &gpio_cpld_tdi,
.gpio_tdo = &gpio_cpld_tdo, .gpio_tdo = &gpio_cpld_tdo,
#ifdef USER_INTERFACE_PORTAPACK
.gpio_pp_tms = &gpio_cpld_pp_tms, .gpio_pp_tms = &gpio_cpld_pp_tms,
.gpio_pp_tdo = &gpio_cpld_pp_tdo, .gpio_pp_tdo = &gpio_cpld_pp_tdo,
#endif
}; };
jtag_t jtag_cpld = { jtag_t jtag_cpld = {
@ -777,10 +773,8 @@ void pin_setup(void) {
* *
* LPC43xx pull-up and pull-down resistors are approximately 53K. * LPC43xx pull-up and pull-down resistors are approximately 53K.
*/ */
#ifdef USER_INTERFACE_PORTAPACK
scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_PP_TMS, SCU_GPIO_PUP | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_PP_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
#endif
scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TMS, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_CPLD_TDI, SCU_GPIO_NOPULL | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION4); scu_pinmux(SCU_PINMUX_CPLD_TDO, SCU_GPIO_PDN | SCU_CONF_FUNCTION4);
@ -818,12 +812,10 @@ void pin_setup(void) {
/* Configure RF power supply (VAA) switch control signal as output */ /* Configure RF power supply (VAA) switch control signal as output */
gpio_output(&gpio_vaa_disable); gpio_output(&gpio_vaa_disable);
#ifndef USER_INTERFACE_PORTAPACK
/* Not sure why this is necessary for stock HackRF. Just "rhyming" with the RAD1O code? */ /* Not sure why this is necessary for stock HackRF. Just "rhyming" with the RAD1O code? */
scu_pinmux(SCU_PINMUX_GPIO3_10, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_GPIO3_10, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
scu_pinmux(SCU_PINMUX_GPIO3_11, SCU_GPIO_PDN | SCU_CONF_FUNCTION0); scu_pinmux(SCU_PINMUX_GPIO3_11, SCU_GPIO_PDN | SCU_CONF_FUNCTION0);
#endif #endif
#endif
#ifdef RAD1O #ifdef RAD1O
/* Safe state: start with VAA turned off: */ /* Safe state: start with VAA turned off: */

View File

@ -77,16 +77,13 @@ extern "C"
/* GPIO Input PinMux */ /* GPIO Input PinMux */
#define SCU_PINMUX_BOOT0 (P1_1) /* GPIO0[8] on P1_1 */ #define SCU_PINMUX_BOOT0 (P1_1) /* GPIO0[8] on P1_1 */
#define SCU_PINMUX_BOOT1 (P1_2) /* GPIO0[9] on P1_2 */ #define SCU_PINMUX_BOOT1 (P1_2) /* GPIO0[9] on P1_2 */
#ifdef USER_INTERFACE_PORTAPACK #define SCU_PINMUX_BOOT2 (P2_8) /* GPIO5[7] on P2_8 */
#define SCU_PINMUX_BOOT3 (P2_9) /* GPIO1[10] on P2_9 */
#define SCU_PINMUX_PP_LCD_TE (P2_3) /* GPIO5[3] on P2_3 */ #define SCU_PINMUX_PP_LCD_TE (P2_3) /* GPIO5[3] on P2_3 */
#define SCU_PINMUX_PP_LCD_RDX (P2_4) /* GPIO5[4] on P2_4 */ #define SCU_PINMUX_PP_LCD_RDX (P2_4) /* GPIO5[4] on P2_4 */
#define SCU_PINMUX_PP_UNUSED (P2_8) /* GPIO5[7] on P2_8 */ #define SCU_PINMUX_PP_UNUSED (P2_8) /* GPIO5[7] on P2_8 */
#define SCU_PINMUX_PP_LCD_WRX (P2_9) /* GPIO1[10] on P2_9 */ #define SCU_PINMUX_PP_LCD_WRX (P2_9) /* GPIO1[10] on P2_9 */
#define SCU_PINMUX_PP_DIR (P2_13) /* GPIO1[13] on P2_13 */ #define SCU_PINMUX_PP_DIR (P2_13) /* GPIO1[13] on P2_13 */
#else
#define SCU_PINMUX_BOOT2 (P2_8) /* GPIO5[7] on P2_8 */
#define SCU_PINMUX_BOOT3 (P2_9) /* GPIO1[10] on P2_9 */
#endif
/* USB peripheral */ /* USB peripheral */
#ifdef JAWBREAKER #ifdef JAWBREAKER

View File

@ -116,9 +116,7 @@ bool set_freq(const uint64_t freq)
if( success ) { if( success ) {
freq_cache = freq; freq_cache = freq;
hackrf_ui()->set_frequency(freq); hackrf_ui()->set_frequency(freq);
#ifndef USER_INTERFACE_PORTAPACK
operacake_set_range(freq_mhz); operacake_set_range(freq_mhz);
#endif
} }
return success; return success;
} }

View File

@ -30,8 +30,6 @@
#include <stddef.h> #include <stddef.h>
#ifdef USER_INTERFACE_PORTAPACK
/* Pixel data within a font or bitmap byte is "reversed": LSB is left-most pixel. */ /* Pixel data within a font or bitmap byte is "reversed": LSB is left-most pixel. */
static const uint8_t font_fixed_8x16_glyph_data[] = { static const uint8_t font_fixed_8x16_glyph_data[] = {
@ -1043,5 +1041,3 @@ const hackrf_ui_t* portapack_detect(void) {
return NULL; return NULL;
} }
} }
#endif

View File

@ -71,19 +71,11 @@ else()
set(MCU_PARTNO LPC4330) set(MCU_PARTNO LPC4330)
endif() endif()
if(BOARD STREQUAL "RAD1O")
set(USER_INTERFACE RAD1O)
endif()
if(NOT DEFINED USER_INTERFACE)
set(USER_INTERFACE NONE)
endif()
if(NOT DEFINED SRC_M0) if(NOT DEFINED SRC_M0)
set(SRC_M0 "${PATH_HACKRF_FIRMWARE_COMMON}/m0_sleep.c") set(SRC_M0 "${PATH_HACKRF_FIRMWARE_COMMON}/m0_sleep.c")
endif() endif()
SET(HACKRF_OPTS "-D${BOARD} -DUSER_INTERFACE_${USER_INTERFACE} -DLPC43XX -D${MCU_PARTNO} -DTX_ENABLE -D'VERSION_STRING=\"${VERSION}\"'") SET(HACKRF_OPTS "-D${BOARD} -DLPC43XX -D${MCU_PARTNO} -DTX_ENABLE -D'VERSION_STRING=\"${VERSION}\"'")
SET(LDSCRIPT_M4 "-T${PATH_HACKRF_FIRMWARE_COMMON}/${MCU_PARTNO}_M4_memory.ld -Tlibopencm3_lpc43xx_rom_to_ram.ld -T${PATH_HACKRF_FIRMWARE_COMMON}/LPC43xx_M4_M0_image_from_text.ld") SET(LDSCRIPT_M4 "-T${PATH_HACKRF_FIRMWARE_COMMON}/${MCU_PARTNO}_M4_memory.ld -Tlibopencm3_lpc43xx_rom_to_ram.ld -T${PATH_HACKRF_FIRMWARE_COMMON}/LPC43xx_M4_M0_image_from_text.ld")
@ -108,10 +100,7 @@ SET(CFLAGS_M4 "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4")
SET(CXXFLAGS_M4 "-std=gnu++0x ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") SET(CXXFLAGS_M4 "-std=gnu++0x ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4")
SET(LDFLAGS_M4 "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4} -Xlinker -Map=m4.map") SET(LDFLAGS_M4 "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4} -Xlinker -Map=m4.map")
SET(CFLAGS_M4_DFU "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4") SET(CFLAGS_M4_DFU "-std=gnu99 ${CFLAGS_COMMON} ${CPUFLAGS_M4} -DLPC43XX_M4 -DDFU_MODE")
if(NOT USER_INTERFACE STREQUAL "PORTAPACK")
SET(CFLAGS_M4_DFU "${CFLAGS_M4_DFU} -DDFU_MODE")
endif()
SET(LDFLAGS_M4_DFU "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4_DFU} -Xlinker -Map=m4.map") SET(LDFLAGS_M4_DFU "${LDFLAGS_COMMON} ${CPUFLAGS_M4} ${LDSCRIPT_M4_DFU} -Xlinker -Map=m4.map")
set(BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF)