Wait tx complete (#3165)

* Implement radio transmission drain mechanism and update shared memory structure
* don't wait for timeout if baseband already in shut down state
This commit is contained in:
Pezsma
2026-05-12 12:45:02 +02:00
committed by GitHub
parent 4dfbf666d0
commit 66f1835232
5 changed files with 32 additions and 5 deletions
+14 -1
View File
@@ -50,7 +50,7 @@ using namespace hackrf::one;
#include "portapack.hpp"
#include "portapack_persistent_memory.hpp"
#include "baseband_api.hpp"
#include "hal.h" // For LPC_SGPIO
#include <array>
@@ -413,6 +413,19 @@ void set_rx_max283x_iq_phase_calibration(const size_t v) {
}
void disable() {
if (direction == rf::Direction::Transmit && baseband::is_image_running()) {
static constexpr uint32_t radio_tx_drain_timeout_ms = 100;
shared_memory.radio_tx_drain = 1; // Request drain of the current DMA queue.
for (uint32_t waited_ms = 0;
shared_memory.radio_tx_drain && (waited_ms < radio_tx_drain_timeout_ms);
++waited_ms) {
chThdSleepMilliseconds(1);
}
}
/* Never allow shutdown to block indefinitely waiting for a drain
* acknowledgement that may never arrive in normal operation. */
shared_memory.radio_tx_drain = 0;
set_antenna_bias(false);
baseband_codec.set_mode(max5864::Mode::Shutdown);
#ifdef PRALINE