|
esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
|
ESP-SDR gapless receive (ESP32-C6): the whole 80 MS/s, pruned to what a link carries. More...
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <esp_attr.h>Go to the source code of this file.
Data Structures | |
| struct | esp_sdr_gapless_wide |
| struct | esp_sdr_gapless_seg |
| struct | esp_sdr_gapless_sink |
| struct | esp_sdr_gapless_cfg |
| struct | esp_sdr_gapless_stats |
Macros | |
| #define | ESP_SDR_GAPLESS_RING 16384U |
| #define | ESP_SDR_GAPLESS_UNIT 12288U |
| #define | ESP_SDR_GAPLESS_RATE_HZ 80000000U |
| #define | ESP_SDR_GAPLESS_WINDOW_US 10U |
| #define | ESP_SDR_GAPLESS_SEG_DROPPED 0x01U |
| #define | ESP_SDR_GAPLESS_SEG_WIDE 0x08U |
| #define | ESP_SDR_GAPLESS_WIDE_PAIRS 4U |
Enumerations | |
| enum | esp_sdr_gapless_error { } |
| enum | esp_sdr_gapless_activity { ESP_SDR_GAPLESS_COPY , ESP_SDR_GAPLESS_PACK , ESP_SDR_GAPLESS_SERVICE , ESP_SDR_GAPLESS_WINDOWS , ESP_SDR_GAPLESS_PREP , ESP_SDR_GAPLESS_SWITCH , ESP_SDR_GAPLESS_SORT , ESP_SDR_GAPLESS_ACTIVITIES } |
Functions | |
| int | esp_sdr_gapless_run (const struct esp_sdr_gapless_cfg *cfg, const struct esp_sdr_gapless_sink *sink, struct esp_sdr_gapless_stats *stats) |
Run the gapless receiver until sink's stop() says so or the ring fails. | |
| void | esp_sdr_gapless_peek (struct esp_sdr_gapless_stats *stats) |
| The statistics of the run so far. | |
| void | esp_sdr_gapless_reset (void) |
| Forget the learnt baseline (after a retune or a gain change). | |
ESP-SDR gapless receive (ESP32-C6): the whole 80 MS/s, pruned to what a link carries.
The dump engine runs as a circular ring of ESP_SDR_GAPLESS_RING samples and never stops, while the CPU switches it between SRAM blocks 1 and 2 every ESP_SDR_GAPLESS_UNIT samples (upstream ESPARGOS ring_capture.c, after h0m3us3r/eSpDR). Before each switch the CPU writes marker words into the idle block where the next unit will start and end; after it, it finds the exact first and last sample there, and every unit must start where the last one ended: the boundaries are proven gapless. The CPUs cannot reach a block while the engine writes it, so a unit is read from its block during the next unit, until the block is prepared for the one after.
Meanwhile the IQ estimator sums the same input: one reading every ESP_SDR_GAPLESS_WINDOW_US gives each window's power about its mean, on the ring's own index axis. Windows past a threshold over the quiet baseline are kept, with windows before and after them: copied raw into a staging ring while their block can still be read, then packed to int8 I/Q (a right shift chosen from the window's power and DC, the DC left in and reported) into the caller's sink, which sends them on. Each segment keeps its index on the run's axis (80 MS/s, 40 with esp_sdr_gapless_cfg.half_rate).
Two servos keep headroom: the threshold rises and falls so that what is kept fills the link's budget short of its headroom, and the receive gain steps so that the loudest windows' estimated peaks stay short of full scale by theirs, without lifting the noise floor further than it needs.
With width sorting (esp_sdr_gapless_cfg.wide) the kept samples are judged by how fast they decorrelate before they are packed: a chunk of a window's length whose correlations 4, 6 and 10 samples (50 to 125 ns) apart all stay below half its power over the noise carries a signal wider than some 10 MHz (Wi-Fi), and goes to the sink as a short record (ESP_SDR_GAPLESS_SEG_WIDE) instead of its samples, so the link's budget goes to the narrow ones and the threshold servo can hold a lower threshold.
A run holds interrupts off on the CPU from start to end: the sink's service() callback is where the caller moves data and polls its link.