esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
Loading...
Searching...
No Matches
esp_sdr_replay.h File Reference

ESP-SDR loop replay through the modem DAC engine (ESP32-C5, ESP32-S31). More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <esp_sdr/esp_sdr.h>

Go to the source code of this file.

Data Structures

struct  esp_sdr_replay_cfg

Macros

#define ESP_SDR_REPLAY_MAX   16383U

Functions

static uint32_t esp_sdr_replay_word (int32_t i, int32_t q)
uint32_t * esp_sdr_replay_buf (size_t *words)
 The sample buffer the engine plays from.
int esp_sdr_replay_start (const struct esp_sdr_replay_cfg *cfg)
 Turn the transmit chain on and start the engine.
int esp_sdr_replay_wait (uint32_t timeout_us, uint32_t *cycles)
 Wait for a finite replay to finish.
int esp_sdr_replay_restart (void)
 Start a finished replay again, with the same settings and samples.
uint32_t esp_sdr_replay_ctrl (void)
bool esp_sdr_replay_active (void)
void esp_sdr_replay_stop (void)
 Stop the engine, give the bank back and return to receive.

Detailed Description

ESP-SDR loop replay through the modem DAC engine (ESP32-C5, ESP32-S31).

The DAC engine plays words out of memory on its own clock: one pass, a number of passes, or endlessly until stopped. The CPU is free meanwhile. Only periodic content fits: the engine owns its memory while it plays, so the CPU can neither refill the buffer nor run the diagnostic-bus ring (esp_sdr_diag.h, esp_sdr_diag16.h) or a capture in that time.

Write the samples with esp_sdr_replay_word() into esp_sdr_replay_buf() before esp_sdr_replay_start(): the engine drops CPU stores to its block.

  • ESP32-C5: the dump bank, 80 or 40 MS/s, up to 16383 words. Registers after upstream ESP-SDR's first C5 transmitter (git show e605684:main/c5_main.c, emit_dma()).
  • ESP32-S31: the TCM's group at 0x2F040000 (128 KiB), which the image must end below (the linker checks), at 80, 40 or 20 MS/s, up to 32768 words. Captures and the ring give -EBUSY while it plays. Captures land in the same group (as on the C5, the bank): write the buffer after the last capture before the start. Measured, as no vendor code programs this engine: doc/samples/transmit.md.