feat(802.15.4): introduced a feature for registering 802.15.4 ISR callbacks

This commit is contained in:
zwx
2025-01-07 15:26:13 +08:00
parent 90de6ac550
commit 2ec92c5cd8
9 changed files with 326 additions and 21 deletions
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -238,6 +238,28 @@ extern void esp_ieee802154_receive_failed(uint16_t error);
*/
extern void esp_ieee802154_ed_failed(uint16_t error);
/**
* @brief Disable all interrupts generated by the IEEE 802.15.4 subsystem to enter critical.
*
*/
void ieee802154_enter_critical(void);
/**
* @brief Enable all interrupts generated by the IEEE 802.15.4 subsystem to exit critical.
*
*/
void ieee802154_exit_critical(void);
/**
* @brief Is the IEEE 802.15.4 subsystem initialized or not.
*
* @return
* - True on the IEEE 802.15.4 subsystem initialized.
* - False on the IEEE 802.15.4 subsystem deinitialized.
*
*/
bool ieee802154_mac_is_inited(void);
#if CONFIG_IEEE802154_TEST
#define IEEE802154_STATIC
#define IEEE802154_INLINE
@@ -0,0 +1,79 @@
/*
* SPDX-FileCopyrightText: 2025 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "sdkconfig.h"
#include "esp_ieee802154_types.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Register the process callbacks for the event generated by IEEE 802.15.4 subsystem.
*
* @param[in] cb_list The event process callback list, please refer to `esp_ieee802154_event_cb_list_t`.
*
* @return
* - ESP_OK on success.
*/
esp_err_t ieee802154_event_callback_list_register(esp_ieee802154_event_cb_list_t cb_list);
/**
* @brief Unregister the process callbacks for the event generated by IEEE 802.15.4 subsystem.
*
* @return
* - ESP_OK on success.
*/
esp_err_t ieee802154_event_callback_list_unregister(void);
/**
* @brief The inner handler when reception successfully.
*
*/
void ieee802154_inner_receive_done(uint8_t *data, esp_ieee802154_frame_info_t *frame_info);
/**
* @brief The inner handler when the SFD field of the frame was received.
*
*/
void ieee802154_inner_receive_sfd_done(void);
/**
* @brief The inner handler when transmission finished successfully.
*
*/
void ieee802154_inner_transmit_done(const uint8_t *frame, const uint8_t *ack, esp_ieee802154_frame_info_t *ack_frame_info);
/**
* @brief The inner handler when transmission failed.
*
*/
void ieee802154_inner_transmit_failed(const uint8_t *frame, esp_ieee802154_tx_error_t error);
/**
* @brief The inner handler when the SFD field of the frame was transmitted.
*
*/
void ieee802154_inner_transmit_sfd_done(uint8_t *frame);
/**
* @brief The inner handler when ED processed done.
*
*/
void ieee802154_inner_energy_detect_done(int8_t power);
/**
* @brief The inner wrapper for enh-ack generation.
*
*/
esp_err_t ieee802154_inner_enh_ack_generator(uint8_t *frame, esp_ieee802154_frame_info_t *frame_info, uint8_t* enhack_frame);
#ifdef __cplusplus
}
#endif