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.h
Go to the documentation of this file.
1/*
2 * SPDX-License-Identifier: GPL-3.0-or-later
3 */
4
14
15#ifndef ESP_SDR_ESP_SDR_H_
16#define ESP_SDR_ESP_SDR_H_
17
18#include <stdbool.h>
19#include <stddef.h>
20#include <stdint.h>
21
22#ifdef __cplusplus
23extern "C" {
24#endif
25
30
39#define ESP_SDR_FREQ_MIN_MHZ 100U
40#define ESP_SDR_FREQ_MAX_MHZ 6000U
41
43#define ESP_SDR_SAMPLES_MIN 256U
44#define ESP_SDR_SAMPLES_MAX 16380U
45
50#define ESP_SDR_CPU_HZ (CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ * 1000000U)
51
53#if defined(CONFIG_ESP_SDR_BANK1)
54#define ESP_SDR_BANKS 2
55#else
56#define ESP_SDR_BANKS 1
57#endif
58
64#ifndef ESP_SDR_HIGH_RAM
65#define ESP_SDR_HIGH_RAM __attribute__((section(".esp_sdr_high")))
66#endif
67
73#ifndef ESP_SDR_HIGH_BUF_DEFINE
74#define ESP_SDR_HIGH_BUF_DEFINE(type, name, dims, align) \
75 static type name dims __aligned(align) ESP_SDR_HIGH_RAM
76#endif
77
82#ifndef ESP_SDR_PSRAM_BUF_DEFINE
83#define ESP_SDR_PSRAM_BUF_DEFINE(type, name, dims, align) \
84 static type name dims __aligned(align) EXT_RAM_BSS_ATTR
85#endif
86
88#ifndef ESP_SDR_HIGH_STACK_DEFINE
89#define ESP_SDR_HIGH_STACK_DEFINE(name, size) \
90 static Z_KERNEL_STACK_DEFINE_IN(name, size, ESP_SDR_HIGH_RAM)
91#endif
92
100 ESP_SDR_RATE_80MSPS = 0,
101 ESP_SDR_RATE_40MSPS = 1,
102 ESP_SDR_RATE_20MSPS = 2,
103 ESP_SDR_RATE_10MSPS = 3,
104 ESP_SDR_RATE_8MSPS = 4,
105 ESP_SDR_RATE_4MSPS = 5,
106 ESP_SDR_RATE_16MSPS = 6,
107};
108
111 int16_t i;
112 int16_t q;
113};
114
125int esp_sdr_init(void);
126
142int esp_sdr_set_freq(uint32_t mhz);
143
150
152uint32_t esp_sdr_get_freq(void);
153
159
172int esp_sdr_set_freq_offset(int32_t khz);
173
175#define ESP_SDR_FREQ_CORR_MAX_PPB 50000
176
194
197
210
222int esp_sdr_get_temp_dc(int16_t *dc);
223
234int esp_sdr_set_channel_bw(unsigned int cbw);
235
249
257 uint32_t dac_sessions, gain_refreshed, gain_apply_us;
258};
259
262
269int esp_sdr_bbtop_read(unsigned int reg);
270void esp_sdr_bbtop_write(unsigned int reg, unsigned int val);
271
284int esp_sdr_set_turnaround(uint32_t settle_us, bool retune);
285
287
288#ifdef __cplusplus
289}
290#endif
291
292#include <esp_sdr/esp_sdr_rx.h>
293#include <esp_sdr/esp_sdr_tx.h>
294
295#endif /* ESP_SDR_ESP_SDR_H_ */
ESP-SDR receive: gain, analog low-pass, burst and decimated capture.
ESP-SDR transmit: power steps, one-shot DAC playback and sweeps, and the streaming interface.
int32_t esp_sdr_get_freq_corr_ppb(void)
int esp_sdr_set_freq_offset(int32_t khz)
Set an offset in kHz from the whole MHz (esp_sdr_set_freq()) and retune.
int esp_sdr_init(void)
Bring the radio up and tune it to the default frequency.
void esp_sdr_get_stats(struct esp_sdr_stats *stats)
int esp_sdr_get_temp_dc(int16_t *dc)
Read the chip's die temperature (devicetree alias die-temp0).
int esp_sdr_set_freq_corr_ppb(int32_t ppb)
Correct every tuning for the crystal's error and retune.
bool esp_sdr_freq_window_checked(void)
int esp_sdr_bbtop_read(unsigned int reg)
Read or write a register of the analog baseband (I2C block 0x67), for characterization.
int esp_sdr_set_channel_bw(unsigned int cbw)
Set the channel bandwidth flag of the vendor tuning call (experimental).
uint32_t esp_sdr_get_freq(void)
int32_t esp_sdr_get_lo_residual_hz(void)
How far from the frequency asked for the correction leaves the LO.
int esp_sdr_set_turnaround(uint32_t settle_us, bool retune)
Set the front end turnaround between transmit and receive.
int32_t esp_sdr_get_freq_offset(void)
esp_sdr_rate
Definition esp_sdr.h:99
int esp_sdr_set_freq(uint32_t mhz)
Tune the LO, shared by receive and transmit.
int esp_sdr_reset_settings(void)
Return the radio's settings to those esp_sdr_init() left.
Definition esp_sdr.h:110
Definition esp_sdr.h:251
uint32_t dac_sessions
Definition esp_sdr.h:257