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_paced.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-or-later
3 */
4
25
26#ifndef ESP_SDR_ESP_SDR_PACED_H_
27#define ESP_SDR_ESP_SDR_PACED_H_
28
29#include <stdbool.h>
30#include <stdint.h>
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
37#define ESP_SDR_PACED_INPUT_HZ 80000000U
38
41 uint64_t samples;
43 uint32_t late;
45 uint32_t late_max;
47 uint32_t events;
48};
49
59int esp_sdr_rx_paced_start(uint32_t rate_hz);
60
68bool esp_sdr_rx_paced_poll(int32_t *i, int32_t *q);
69
76
79
85typedef bool (*esp_sdr_tx_paced_input_t)(void *user, int16_t *i, int16_t *q);
86
100int esp_sdr_tx_paced_start(uint32_t rate_hz, unsigned int interp, unsigned int power,
101 esp_sdr_tx_paced_input_t input, void *user);
102
108
111
114
116unsigned int esp_sdr_tx_paced_power_max(void);
117
119void esp_sdr_tx_paced_range(uint32_t *min_mhz, uint32_t *max_mhz);
120
122static inline uint32_t esp_sdr_paced_cycles(void)
123{
124 uint32_t v;
125
126#if defined(CONFIG_SOC_SERIES_ESP32C6)
127 /* The C6's machine performance counter (mpccr). */
128 __asm__ volatile("csrr %0, 0x7e2" : "=r"(v));
129#else
130 __asm__ volatile("csrr %0, cycle" : "=r"(v));
131#endif
132 return v;
133}
134
141
147
150
151#ifdef __cplusplus
152}
153#endif
154
155#endif /* ESP_SDR_ESP_SDR_PACED_H_ */
bool(* esp_sdr_tx_paced_input_t)(void *user, int16_t *i, int16_t *q)
Definition esp_sdr_paced.h:85
uint32_t esp_sdr_tx_paced_slack(void)
CPU cycles until the next DAC value is due, 0 when it is.
bool esp_sdr_rx_paced_poll(int32_t *i, int32_t *q)
Produce the next receive sample if it is due.
void esp_sdr_tx_paced_stop(void)
Turn the transmit chain off and release the radio; no-op when stopped.
uint32_t esp_sdr_paced_deadline(void)
When the running stream's next sample is due, on esp_sdr_paced_cycles().
unsigned int esp_sdr_tx_paced_power_max(void)
Highest power step: 2 dB per step of the vendor tone's backoff (none on the C5).
static uint32_t esp_sdr_paced_cycles(void)
The CPU cycle counter the paced streams run on.
Definition esp_sdr_paced.h:122
void esp_sdr_tx_paced_range(uint32_t *min_mhz, uint32_t *max_mhz)
Transmit range in MHz: what the vendor tone path tunes (C6 2.4 GHz, C5 also 5 GHz).
void esp_sdr_paced_get_stats(struct esp_sdr_paced_stats *stats)
Statistics of the running or last stream.
void esp_sdr_rx_paced_stop(void)
Stop receiving and release the radio; no-op when stopped.
int esp_sdr_rx_paced_start(uint32_t rate_hz)
Start receiving at rate_hz.
bool esp_sdr_tx_paced_poll(void)
Write the next DAC value if it is due, then compute the one after.
uint32_t esp_sdr_rx_paced_slack(void)
CPU cycles until the next receive sample is due, 0 when it is.
int esp_sdr_tx_paced_start(uint32_t rate_hz, unsigned int interp, unsigned int power, esp_sdr_tx_paced_input_t input, void *user)
Turn the transmit chain on at the current frequency and start playing input at rate_hz.
void esp_sdr_paced_sync(void)
Restart the running stream's clock: the next sample is due one period from now. Call once interrupts ...
Definition esp_sdr_paced.h:39
uint32_t events
Definition esp_sdr_paced.h:47
uint64_t samples
Definition esp_sdr_paced.h:41
uint32_t late_max
Definition esp_sdr_paced.h:45
uint32_t late
Definition esp_sdr_paced.h:43