|
esp-sdr-zephyr
Raw I/Q receive and transmit on the ESP32-S3/C6 Wi-Fi radio, for Zephyr
|
Modulator and receiver, portable C (ieee154_phy.h). More...
Macros | |
| #define | IEEE154_PHY_PSDU_MAX 127 |
| #define | IEEE154_PHY_MOD_SAMPLES(len) |
Typedefs | |
| typedef void(* | ieee154_phy_frame_cb_t) (const uint8_t *psdu, uint8_t len, int lqi, void *user) |
| typedef bool(* | ieee154_phy_hdr_cb_t) (const uint8_t *psdu, uint8_t have, uint8_t len, uint32_t end_pos, void *user) |
Functions | |
| void | ieee154_phy_init (void) |
| void | ieee154_phy_set_rx_cb (ieee154_phy_frame_cb_t cb, void *user) |
| void | ieee154_phy_set_hdr_cb (ieee154_phy_hdr_cb_t cb, void *user) |
| void | ieee154_phy_rx_block (const int16_t *iq, size_t n) |
| void | ieee154_phy_rx_reset (void) |
| uint32_t | ieee154_phy_rx_position (void) |
| uint32_t | ieee154_phy_chips (int sym) |
| size_t | ieee154_phy_modulate (const uint8_t *psdu, uint8_t len, int16_t amp, int16_t *out, size_t max_samples) |
| size_t | ieee154_phy_append_fcs (uint8_t *buf, size_t n) |
Modulator and receiver, portable C (ieee154_phy.h).
| #define IEEE154_PHY_MOD_SAMPLES | ( | len | ) |
Complex samples ieee154_phy_modulate() needs for a PSDU of len bytes.
| #define IEEE154_PHY_PSDU_MAX 127 |
Longest PSDU, FCS included.
| typedef void(* ieee154_phy_frame_cb_t) (const uint8_t *psdu, uint8_t len, int lqi, void *user) |
Called for each CRC-valid frame: psdu includes the 2-byte FCS, lqi is 0 to 255 from the mean chip-error count, user is the pointer given to ieee154_phy_set_rx_cb().
| typedef bool(* ieee154_phy_hdr_cb_t) (const uint8_t *psdu, uint8_t have, uint8_t len, uint32_t end_pos, void *user) |
Called while a frame comes in, from the PHR on: len is the PSDU length (FCS included), have the PSDU bytes received so far (0 at the PHR, at most len - 1), end_pos the ieee154_phy_rx_position() at which the frame's last symbol will be decided. Called again with each further byte while it returns true. Both phase trackers may report the same frame.
| size_t ieee154_phy_append_fcs | ( | uint8_t * | buf, |
| size_t | n ) |
Append the little-endian CRC-16 FCS to buf[0..n-1]; returns n + 2.
| uint32_t ieee154_phy_chips | ( | int | sym | ) |
The 32 chips of symbol sym (0..15), chip c0 in the MSB.
| void ieee154_phy_init | ( | void | ) |
Build the chip tables. Call once before anything else.
| size_t ieee154_phy_modulate | ( | const uint8_t * | psdu, |
| uint8_t | len, | ||
| int16_t | amp, | ||
| int16_t * | out, | ||
| size_t | max_samples ) |
Modulate SHR + PHR + psdu (FCS already appended) into out. Returns the complex samples written, 0 if max_samples is too small.
| void ieee154_phy_rx_block | ( | const int16_t * | iq, |
| size_t | n ) |
Feed the next n complex samples; blocks must be consecutive.
| uint32_t ieee154_phy_rx_position | ( | void | ) |
Samples fed so far, counted over all blocks (wraps). In the frame callback: up to and including the frame's last sample, which completed its last symbol.
| void ieee154_phy_rx_reset | ( | void | ) |
Drop any frame in progress, before a block that does not follow the last one.
| void ieee154_phy_set_hdr_cb | ( | ieee154_phy_hdr_cb_t | cb, |
| void * | user ) |
Set the header callback (NULL: none).
| void ieee154_phy_set_rx_cb | ( | ieee154_phy_frame_cb_t | cb, |
| void * | user ) |
Set the receiver's frame callback (NULL: frames are dropped).