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

Gapless 8+8 bit receive up to 40 MS/s through the modem diagnostic bus and PARLIO, a ring with room for a block header (esp_sdr_diag16.h, CONFIG_ESP_SDR_DIAG16). More...

Data Structures

struct  esp_sdr_diag16_cfg
struct  esp_sdr_diag16_stats

Macros

#define ESP_SDR_DIAG16_PINS   16U
#define ESP_SDR_DIAG16_NODE   4096U
#define ESP_SDR_DIAG16_HOLE   16U
#define ESP_SDR_DIAG16_PAYLOAD   (ESP_SDR_DIAG16_NODE - ESP_SDR_DIAG16_HOLE)

Typedefs

typedef void(* esp_sdr_diag16_sink_t) (void *user, uint8_t *node, uint64_t index)

Functions

int esp_sdr_diag16_run (const struct esp_sdr_diag16_cfg *cfg, struct esp_sdr_diag16_stats *stats)
 Run the ring until the time is up, esp_sdr_diag16_stop() or an overrun.
void esp_sdr_diag16_stop (void)
 Ask a running esp_sdr_diag16_run() to return.
bool esp_sdr_diag16_active (void)
uint64_t esp_sdr_diag16_produced (void)
bool esp_sdr_diag16_node_valid (uint64_t index)
 Is the node a sink got at index still as it was?

Detailed Description

Gapless 8+8 bit receive up to 40 MS/s through the modem diagnostic bus and PARLIO, a ring with room for a block header (esp_sdr_diag16.h, CONFIG_ESP_SDR_DIAG16).

Guide: Gapless receive.

Macro Definition Documentation

◆ ESP_SDR_DIAG16_HOLE

#define ESP_SDR_DIAG16_HOLE   16U

The DMA leaves this many bytes at the start of every node, for a header in front of the samples: nodes side by side are then a run of blocks that needs no copying.

◆ ESP_SDR_DIAG16_NODE

#define ESP_SDR_DIAG16_NODE   4096U

A ring node. A sink gets the whole node: the samples start ESP_SDR_DIAG16_HOLE into it.

◆ ESP_SDR_DIAG16_PAYLOAD

#define ESP_SDR_DIAG16_PAYLOAD   (ESP_SDR_DIAG16_NODE - ESP_SDR_DIAG16_HOLE)

Sample bytes in a node.

◆ ESP_SDR_DIAG16_PINS

#define ESP_SDR_DIAG16_PINS   16U

Pads, and data lines of the receiver.

Typedef Documentation

◆ esp_sdr_diag16_sink_t

typedef void(* esp_sdr_diag16_sink_t) (void *user, uint8_t *node, uint64_t index)

Receives one node.

Parameters
usercfg.user.
nodeESP_SDR_DIAG16_NODE bytes in the ring. Valid until the DMA comes round again, which esp_sdr_diag16_node_valid() tells, and the DMA does not wait; the hole is the sink's.
indexSample bytes before this node since the start; a jump from the previous index plus ESP_SDR_DIAG16_PAYLOAD means the consumer fell behind and nodes were skipped.

Function Documentation

◆ esp_sdr_diag16_active()

bool esp_sdr_diag16_active ( void )
Returns
true while esp_sdr_diag16_run() is in progress.

◆ esp_sdr_diag16_node_valid()

bool esp_sdr_diag16_node_valid ( uint64_t index)

Is the node a sink got at index still as it was?

For a consumer that keeps or copies nodes: copy first, ask after.

Parameters
indexThe index the sink got.
Returns
false when the DMA may have started on that node again.

◆ esp_sdr_diag16_produced()

uint64_t esp_sdr_diag16_produced ( void )
Returns
Sample bytes the DMA has finished, counted as the sink's index: compare the two.

◆ esp_sdr_diag16_run()

int esp_sdr_diag16_run ( const struct esp_sdr_diag16_cfg * cfg,
struct esp_sdr_diag16_stats * stats )

Run the ring until the time is up, esp_sdr_diag16_stop() or an overrun.

Takes the radio for the whole run; the receiver keeps its frequency, gain and filter, but not an earlier DC calibration: cfg.dc_correct makes a new one.

A sink slower than the DMA is no error: nodes get skipped (stats->skips), and the run still ends on time or on a stop.

Returns
0, -EINVAL for a bad configuration, -EAGAIN before esp_sdr_init(), -EBUSY when already running, -ETIMEDOUT if the ring got no data or stopped getting it, -EOVERFLOW when the interrupt could not keep up (stats->overrun), -EIO for no clean sampling phase and cfg.phase_required.

◆ esp_sdr_diag16_stop()

void esp_sdr_diag16_stop ( void )

Ask a running esp_sdr_diag16_run() to return.

With no run in progress it does nothing: a run that starts just after has not seen it, so a caller with a reason to stop must look at that reason again from its sink.