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

The whole 80 MS/s through a ring in SRAM blocks 1 and 2, pruned to the windows above the noise, ESP32-C6 (esp_sdr_gapless.h, CONFIG_ESP_SDR_GAPLESS). More...

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).

Detailed Description

The whole 80 MS/s through a ring in SRAM blocks 1 and 2, pruned to the windows above the noise, ESP32-C6 (esp_sdr_gapless.h, CONFIG_ESP_SDR_GAPLESS).

Guide: Gapless receive.

Macro Definition Documentation

◆ ESP_SDR_GAPLESS_RATE_HZ

#define ESP_SDR_GAPLESS_RATE_HZ   80000000U

Sample rate (esp_sdr_gapless_cfg.half_rate: half of it).

◆ ESP_SDR_GAPLESS_RING

#define ESP_SDR_GAPLESS_RING   16384U

Samples in the ring (one lap, 205 us at 80 MS/s, 410 us at 40).

◆ ESP_SDR_GAPLESS_SEG_DROPPED

#define ESP_SDR_GAPLESS_SEG_DROPPED   0x01U

Segment flags (the same values as esdr_proto.h's ESDR_SEG_*).

◆ ESP_SDR_GAPLESS_SEG_WIDE

#define ESP_SDR_GAPLESS_SEG_WIDE   0x08U

A width record (esp_sdr_gapless_cfg.wide): the segment's ESP_SDR_GAPLESS_WIDE_PAIRS pairs hold a struct esp_sdr_gapless_wide, not samples; the samples it stands for (its span, from the segment's index on) carried a signal wider than some 10 MHz and were not sent.

◆ ESP_SDR_GAPLESS_UNIT

#define ESP_SDR_GAPLESS_UNIT   12288U

Samples per unit: the CPU switches blocks after this many (154 us, 307 at 40 MS/s).

◆ ESP_SDR_GAPLESS_WIDE_PAIRS

#define ESP_SDR_GAPLESS_WIDE_PAIRS   4U

Pairs of a width record's segment: the bytes of struct esp_sdr_gapless_wide.

◆ ESP_SDR_GAPLESS_WINDOW_US

#define ESP_SDR_GAPLESS_WINDOW_US   10U

Estimator window, the unit of the keep decision.

Enumeration Type Documentation

◆ esp_sdr_gapless_activity

What a unit's CPU cycles go to (esp_sdr_gapless_stats.cycles).

Enumerator
ESP_SDR_GAPLESS_COPY 

Kept samples from the ring's blocks to the staging ring.

ESP_SDR_GAPLESS_PACK 

From the staging ring into the sink, as int8.

ESP_SDR_GAPLESS_SERVICE 

The sink's service().

ESP_SDR_GAPLESS_WINDOWS 

Estimator readings and the keep decisions.

ESP_SDR_GAPLESS_PREP 

Markers into the next block.

ESP_SDR_GAPLESS_SWITCH 

The switch, finding the unit, the servos.

ESP_SDR_GAPLESS_SORT 

Width sorting of the staged samples (esp_sdr_gapless_cfg.wide).

◆ esp_sdr_gapless_error

Why a run ended early.

Enumerator
ESP_SDR_GAPLESS_ERR_AGE 

A block was owned by the engine too long (its ring lapped).

ESP_SDR_GAPLESS_ERR_LATE 

The switch came too late after the threshold.

ESP_SDR_GAPLESS_ERR_START 

A unit did not start where the last one ended.

ESP_SDR_GAPLESS_ERR_END 

A unit's end was not found.

ESP_SDR_GAPLESS_ERR_LENGTH 

A unit's length was out of range.

Function Documentation

◆ esp_sdr_gapless_peek()

void esp_sdr_gapless_peek ( struct esp_sdr_gapless_stats * stats)

The statistics of the run so far.

For the sink's callbacks during esp_sdr_gapless_run(), which fills its own only at the end; after a run, the last run's.

Parameters
statsFilled in.

◆ esp_sdr_gapless_run()

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.

Needs esp_sdr_init(). Takes the radio lock and holds interrupts off throughout.

Parameters
cfgWhat to keep.
sinkWhere kept samples go.
statsFilled with the run's counters; may be NULL.
Return values
0when stop() ended the run.
-EIOwhen the ring failed (stats->error says why).
-EINVALfor a bad argument; -EAGAIN without esp_sdr_init().