mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 11:10:54 +03:00
feat(ieee802154): make the receive done handler feature mandatory
This commit is contained in:
@@ -47,7 +47,6 @@ IEEE802154_STATIC volatile ieee802154_state_t s_ieee802154_state;
|
||||
static uint8_t *s_tx_frame = NULL;
|
||||
#define IEEE802154_RX_FRAME_SIZE (127 + 1 + 1) // +1: len, +1: for dma test
|
||||
|
||||
#if CONFIG_IEEE802154_RECEIVE_DONE_HANDLER
|
||||
// +1: for the stub buffer when the valid buffers are full.
|
||||
//
|
||||
// |--------------------VB[0]--------------------|
|
||||
@@ -62,10 +61,6 @@ static uint8_t *s_tx_frame = NULL;
|
||||
// STUB : Stub buffer, used when all valid buffers are under processing, the received frame will be dropped.
|
||||
static uint8_t s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1][IEEE802154_RX_FRAME_SIZE];
|
||||
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE + 1];
|
||||
#else
|
||||
static uint8_t s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE][IEEE802154_RX_FRAME_SIZE];
|
||||
static esp_ieee802154_frame_info_t s_rx_frame_info[CONFIG_IEEE802154_RX_BUFFER_SIZE];
|
||||
#endif
|
||||
|
||||
static uint8_t s_rx_index = 0;
|
||||
static uint8_t s_enh_ack_frame[128];
|
||||
@@ -85,7 +80,6 @@ typedef struct {
|
||||
static pending_tx_t s_pending_tx = { 0 };
|
||||
#endif
|
||||
|
||||
#if CONFIG_IEEE802154_RECEIVE_DONE_HANDLER
|
||||
static void ieee802154_receive_done(uint8_t *data, esp_ieee802154_frame_info_t *frame_info)
|
||||
{
|
||||
// If the RX done packet is written in the stub buffer, drop it silently.
|
||||
@@ -113,7 +107,7 @@ static void ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, e
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t ieee802154_receive_handle_done(uint8_t *data)
|
||||
esp_err_t ieee802154_receive_handle_done(const uint8_t *data)
|
||||
{
|
||||
uint16_t size = data - &s_rx_frame[0][0];
|
||||
if ((size % IEEE802154_RX_FRAME_SIZE) != 0
|
||||
@@ -123,18 +117,6 @@ esp_err_t ieee802154_receive_handle_done(uint8_t *data)
|
||||
s_rx_frame_info[size / IEEE802154_RX_FRAME_SIZE].process = false;
|
||||
return ESP_OK;
|
||||
}
|
||||
#else
|
||||
static void ieee802154_receive_done(uint8_t *data, esp_ieee802154_frame_info_t *frame_info)
|
||||
{
|
||||
esp_ieee802154_receive_done(data, frame_info);
|
||||
}
|
||||
|
||||
static void ieee802154_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info)
|
||||
{
|
||||
esp_ieee802154_transmit_done(frame, ack, ack_frame_info);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static IRAM_ATTR void event_end_process(void)
|
||||
{
|
||||
@@ -179,8 +161,8 @@ uint8_t ieee802154_get_recent_lqi(void)
|
||||
IEEE802154_STATIC void set_next_rx_buffer(void)
|
||||
{
|
||||
uint8_t* next_rx_buffer = NULL;
|
||||
#if CONFIG_IEEE802154_RECEIVE_DONE_HANDLER
|
||||
uint8_t index = 0;
|
||||
|
||||
if (s_rx_index != CONFIG_IEEE802154_RX_BUFFER_SIZE && s_rx_frame_info[s_rx_index].process == false) {
|
||||
// If buffer is not full, and current index is empty, set it to hardware.
|
||||
next_rx_buffer = s_rx_frame[s_rx_index];
|
||||
@@ -204,16 +186,7 @@ IEEE802154_STATIC void set_next_rx_buffer(void)
|
||||
s_rx_index = CONFIG_IEEE802154_RX_BUFFER_SIZE;
|
||||
next_rx_buffer = s_rx_frame[CONFIG_IEEE802154_RX_BUFFER_SIZE];
|
||||
}
|
||||
#else
|
||||
if (s_rx_frame[s_rx_index][0] != 0) {
|
||||
s_rx_index++;
|
||||
if (s_rx_index == CONFIG_IEEE802154_RX_BUFFER_SIZE) {
|
||||
s_rx_index = 0;
|
||||
memset(s_rx_frame[s_rx_index], 0, sizeof(s_rx_frame[s_rx_index]));
|
||||
}
|
||||
}
|
||||
next_rx_buffer = (uint8_t *)&s_rx_frame[s_rx_index];
|
||||
#endif
|
||||
|
||||
ieee802154_ll_set_rx_addr(next_rx_buffer);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user