SD Over USB for the Hackrf Pro (#3291)

* enabled sd over usb compilation
* updated hackrf pro usb stack
* fixed hackrf one code path
* fixed hackrf pro code path
* improved performance
* fixed sd card clock
* refactoring
* formatted code
This commit is contained in:
Bernd Herzog
2026-08-16 20:08:19 +02:00
committed by GitHub
parent b048b8f4f1
commit 47c94dbf26
15 changed files with 1803 additions and 1289 deletions
+4 -8
View File
@@ -32,10 +32,6 @@
#include "core_control.hpp"
/* Set true to enable additional checks to ensure
* M4 and M0 are synchronized before passing messages. */
static constexpr bool enforce_core_sync = true;
/* Set true to enable check for baseband messages getting stuck.
* This implies the baseband thread is not dequeuing and has probably stalled.
* NB: This check adds a small amout of overhead to the message sending code
@@ -474,7 +470,7 @@ bool is_image_running() {
return baseband_image_running;
}
void run_image(const spi_flash::image_tag_t image_tag) {
void run_image(const spi_flash::image_tag_t image_tag, bool enforce_core_sync) {
if (baseband_image_running) {
chDbgPanic("BBRunning");
}
@@ -487,7 +483,7 @@ void run_image(const spi_flash::image_tag_t image_tag) {
creg::m4txevent::enable();
if constexpr (enforce_core_sync) {
if (enforce_core_sync) {
// Wait up to 3 seconds for baseband to start handling events.
auto count = 3'000u;
while (!shared_memory.baseband_ready && --count)
@@ -498,7 +494,7 @@ void run_image(const spi_flash::image_tag_t image_tag) {
}
}
void run_prepared_image(const uint32_t m4_code) {
void run_prepared_image(const uint32_t m4_code, bool enforce_core_sync) {
if (baseband_image_running) {
chDbgPanic("BBRunning");
}
@@ -511,7 +507,7 @@ void run_prepared_image(const uint32_t m4_code) {
creg::m4txevent::enable();
if constexpr (enforce_core_sync) {
if (enforce_core_sync) {
// Wait up to 3 seconds for baseband to start handling events.
auto count = 3'000u;
while (!shared_memory.baseband_ready && --count)
+2 -2
View File
@@ -131,8 +131,8 @@ void request_beep_stop();
void request_audio_beep(uint32_t freq, uint32_t sample_rate, uint32_t duration_ms);
bool is_image_running();
void run_image(const portapack::spi_flash::image_tag_t image_tag);
void run_prepared_image(const uint32_t m4_code);
void run_image(const portapack::spi_flash::image_tag_t image_tag, bool enforce_core_sync = true);
void run_prepared_image(const uint32_t m4_code, bool enforce_core_sync = true);
void shutdown();
void spectrum_streaming_start();
+5 -9
View File
@@ -407,6 +407,10 @@ set(EXTCPPSRC
external/aprs_tx/main.cpp
external/aprs_tx/ui_aprs_tx.cpp
#sd over usb
external/sdusb/main.cpp
external/sdusb/ui_sd_over_usb.cpp
)
set(EXTAPPLIST
@@ -505,13 +509,5 @@ set(EXTAPPLIST
ais_rx
aprs_rx
aprs_tx
sdusb
)
# sdusb has type conflicts with PRALINE (HackRF Pro) - add only for non-PRALINE builds
if(NOT BOARD STREQUAL "PRALINE")
list(APPEND EXTCPPSRC
external/sdusb/main.cpp
external/sdusb/ui_sd_over_usb.cpp
)
list(APPEND EXTAPPLIST sdusb)
endif()
+1 -1
View File
@@ -46,7 +46,7 @@ SdOverUsbView::SdOverUsbView(NavigationView& nav)
sdcStop(&SDCD1);
portapack::shutdown(true, false);
baseband::run_prepared_image(portapack::memory::map::m4_code.base());
baseband::run_prepared_image(portapack::memory::map::m4_code.base(), false);
m0_halt();
/* will not return*/
};