nrf_802154: rev ff6aba3a0496b36a8ffb25b97233187e721400af

This commit updates revision of the nrf_802154 component.

Signed-off-by: Andrzej Kuros <andrzej.kuros@nordicsemi.no>
This commit is contained in:
Andrzej Kuros 2024-01-09 09:17:20 +01:00 committed by Andrzej Kuroś
parent b55cfbbf02
commit 64bd075a06
15 changed files with 21 additions and 244 deletions

View File

@ -67,7 +67,6 @@ extern void nrf_802154_cca_done(bool channel_free);
*/
extern void nrf_802154_cca_failed(nrf_802154_cca_error_t error);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Notifies that the energy detection procedure finished.
*
@ -76,22 +75,6 @@ extern void nrf_802154_cca_failed(nrf_802154_cca_error_t error);
*/
extern void nrf_802154_energy_detected(const nrf_802154_energy_detected_t * p_result);
#else
/**
* @brief Notifies that the energy detection procedure finished.
*
* @note This function passes the EnergyLevel defined in the 802.15.4-2006 specification:
* 0x00 - 0xff, where 0x00 represents -75dBm (10dBm above the worst allowed sensitivity level,
* which is -85dBm) and 0xff is the highest possible energy detection level, for which
* the measurements are guaranteed map linearly to the real energy level in dBm.
* To calculate the result in dBm, use @ref nrf_802154_dbm_from_energy_level_calculate.
*
* @param[in] result Maximum energy detected during the energy detection procedure.
*/
extern void nrf_802154_energy_detected(uint8_t result);
#endif
/**
* @brief Notifies that the energy detection procedure failed.
*

View File

@ -43,7 +43,6 @@
* @{
*/
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Converts energy level received during the energy detection procedure to IEEE Std. 802.15.4-2015 compliant value.
*
@ -53,19 +52,6 @@
*/
uint8_t nrf_802154_energy_level_from_dbm_calculate(int8_t ed_dbm);
#else
/**
* @brief Converts the energy level received during the energy detection procedure to a dBm value.
*
* @param[in] energy_level Energy level passed by @ref nrf_802154_energy_detected.
*
* @return Result of the energy detection procedure in dBm.
*/
int8_t nrf_802154_dbm_from_energy_level_calculate(uint8_t energy_level);
#endif // NRF_802154_ENERGY_DETECTED_VERSION != 0
/**
* @brief Converts a given dBm level to a CCA energy detection threshold value.
*

View File

@ -538,26 +538,6 @@ extern "C" {
#define NRF_802154_CARRIER_FUNCTIONS_ENABLED 1
#endif
/**
* @}
* @defgroup nrf_802154_config_apiversions API version configuration options
* @{
*/
/**
* @def NRF_802154_ENERGY_DETECTED_VERSION
*
* Selects API for @ref nrf_802154_energy_detected callout
* This is a temporary switch to perform API migration in external integration.
*/
#ifndef NRF_802154_ENERGY_DETECTED_VERSION
#define NRF_802154_ENERGY_DETECTED_VERSION 0
#endif
/**
*@}
**/
/**
*@}
**/

View File

@ -56,8 +56,6 @@
#define EDSAMPLE_MIN_REPORTED_VALUE (PHY_MIN_RECEIVER_SENSITIVITY - ED_RSSIOFFS + 10) ///< Minimal reported EDSAMPLE value (reported as 0)
#define EDSAMPLE_MAX_REPORTED_VALUE (ED_RESULT_MAX / ED_RSSISCALE) ///< Maximal reported EDSAMPLE value (reported as 255)
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/** Minimum value of ED in dBm for conversion to units conforming IEEE Std. 802.15.4-2015 chapter 10.2.5. */
#define ED_DBM_MIN (PHY_MIN_RECEIVER_SENSITIVITY + 10)
@ -83,22 +81,4 @@ static inline uint8_t nrf_802154_addons_energy_level_from_dbm_calculate(int8_t e
return r;
}
#else
/**
* @brief Converts the energy level received during the energy detection procedure to a dBm value.
*
* @param[in] energy_level Energy level value compliant with the 802.15.4 specification (0-255)
*
* @return Result of the energy detection procedure in dBm.
*/
static inline int8_t nrf_802154_addons_dbm_from_energy_level_calculate(uint8_t energy_level)
{
return ((int16_t)(EDSAMPLE_MAX_REPORTED_VALUE - EDSAMPLE_MIN_REPORTED_VALUE) *
((int16_t)energy_level)) /
ED_RESULT_MAX + EDSAMPLE_MIN_REPORTED_VALUE + ED_RSSIOFFS;
}
#endif // NRF_802154_ENERGY_DETECTED_VERSION != 0
#endif // NRF_802154_NRFX_ADDONS_H__

View File

@ -497,7 +497,6 @@ typedef void (* nrf_802154_transmit_failed_notification_t)(
nrf_802154_tx_error_t error,
const nrf_802154_transmit_done_metadata_t * p_meta);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Structure that holds results of energy detection procedure.
*/
@ -506,8 +505,6 @@ typedef struct
int8_t ed_dbm; // !< Maximum detected ED in dBm.
} nrf_802154_energy_detected_t;
#endif
/**
*@}
**/

View File

@ -36,21 +36,11 @@
#include "nrf_802154_const.h"
#include "nrf_802154_nrfx_addons.h"
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
uint8_t nrf_802154_energy_level_from_dbm_calculate(int8_t ed_dbm)
{
return nrf_802154_addons_energy_level_from_dbm_calculate(ed_dbm);
}
#else
int8_t nrf_802154_dbm_from_energy_level_calculate(uint8_t energy_level)
{
return nrf_802154_addons_dbm_from_energy_level_calculate(energy_level);
}
#endif // NRF_802154_ENERGY_DETECTED_VERSION != 0
uint8_t nrf_802154_ccaedthres_from_dbm_calculate(int8_t dbm)
{
return dbm - ED_RSSIOFFS;

View File

@ -1216,20 +1216,11 @@ __WEAK void nrf_802154_transmit_failed(uint8_t
(void)p_metadata;
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
__WEAK void nrf_802154_energy_detected(const nrf_802154_energy_detected_t * p_result)
{
(void)p_result;
}
#else
__WEAK void nrf_802154_energy_detected(uint8_t result)
{
(void)result;
}
#endif
__WEAK void nrf_802154_energy_detection_failed(nrf_802154_ed_error_t error)
{
(void)error;

View File

@ -419,19 +419,11 @@ static void transmit_failed_notify_and_nesting_allow(
}
/** Notify MAC layer that energy detection procedure ended. */
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
static void energy_detected_notify(const nrf_802154_energy_detected_t * p_result)
#else
static void energy_detected_notify(uint8_t result)
#endif
{
nrf_802154_critical_section_nesting_allow();
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_notify_energy_detected(p_result);
#else
nrf_802154_notify_energy_detected(result);
#endif
nrf_802154_critical_section_nesting_deny();
}
@ -2467,16 +2459,11 @@ void nrf_802154_trx_energy_detection_finished(uint8_t ed_sample)
switch_to_idle();
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected_t ed_result = {};
ed_result.ed_dbm = nrf_802154_rssi_ed_sample_to_dbm_convert(m_ed_result);
energy_detected_notify(&ed_result);
#else
energy_detected_notify(nrf_802154_rssi_ed_sample_convert(m_ed_result));
#endif
}
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);

View File

@ -119,21 +119,12 @@ void nrf_802154_notify_transmit_failed(uint8_t
nrf_802154_tx_error_t error,
const nrf_802154_transmit_done_metadata_t * p_metadata);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Notifies the next higher layer that the energy detection procedure ended.
*
* @param[in] p_result Pointer to structure containing the result of the ED operation.
*/
void nrf_802154_notify_energy_detected(const nrf_802154_energy_detected_t * p_result);
#else
/**
* @brief Notifies the next higher layer that the energy detection procedure ended.
*
* @param[in] result Detected energy level.
*/
void nrf_802154_notify_energy_detected(uint8_t result);
#endif
/**
* @brief Notifies the next higher layer that the energy detection procedure failed.

View File

@ -125,19 +125,11 @@ void nrf_802154_notify_transmit_failed(uint8_t
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
void nrf_802154_notify_energy_detected(const nrf_802154_energy_detected_t * p_result)
#else
void nrf_802154_notify_energy_detected(uint8_t result)
#endif
{
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected(p_result);
#else
nrf_802154_energy_detected(result);
#endif
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
}

View File

@ -163,13 +163,7 @@ typedef struct
struct
{
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected_t result; ///< Energy detection result.
#else
int8_t result; ///< Energy detection result.
#endif
} energy_detected; ///< Energy detection details.
struct
@ -452,7 +446,6 @@ bool swi_notify_transmit_failed(uint8_t * p_fr
return true;
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Notifies the next higher layer that the energy detection procedure ended from
* the SWI priority level.
@ -463,18 +456,6 @@ bool swi_notify_transmit_failed(uint8_t * p_fr
* @retval false Notification could not be performed.
*/
bool swi_notify_energy_detected(const nrf_802154_energy_detected_t * p_result)
#else
/**
* @brief Notifies the next higher layer that the energy detection procedure ended from
* the SWI priority level.
*
* @param[in] result Detected energy level.
*
* @retval true Notification enqueued successfully.
* @retval false Notification could not be performed.
*/
bool swi_notify_energy_detected(uint8_t result)
#endif
{
uint8_t slot_id = ntf_slot_alloc(m_primary_ntf_pool, NTF_PRIMARY_POOL_SIZE);
@ -486,12 +467,8 @@ bool swi_notify_energy_detected(uint8_t result)
nrf_802154_ntf_data_t * p_slot = &m_primary_ntf_pool[slot_id];
p_slot->type = NTF_TYPE_ENERGY_DETECTED;
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
p_slot->type = NTF_TYPE_ENERGY_DETECTED;
p_slot->data.energy_detected.result = *p_result;
#else
p_slot->data.energy_detected.result = result;
#endif
ntf_push(slot_id | NTF_PRIMARY_POOL_ID_MASK);
@ -656,22 +633,12 @@ void nrf_802154_notify_transmit_failed(uint8_t
nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW);
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
void nrf_802154_notify_energy_detected(const nrf_802154_energy_detected_t * p_result)
#else
void nrf_802154_notify_energy_detected(uint8_t result)
#endif
{
nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
bool notified = swi_notify_energy_detected(p_result);
#else
bool notified = swi_notify_energy_detected(result);
#endif
// It should always be possible to notify energy detection result
NRF_802154_ASSERT(notified);
(void)notified;
@ -786,11 +753,7 @@ static void irq_handler_ntf_event(void)
break;
case NTF_TYPE_ENERGY_DETECTED:
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected(&p_slot->data.energy_detected.result);
#else
nrf_802154_energy_detected(p_slot->data.energy_detected.result);
#endif
break;
case NTF_TYPE_ENERGY_DETECTION_FAILED:

View File

@ -56,13 +56,11 @@
#define EDSAMPLE_MIN_REPORTED_VALUE (PHY_MIN_RECEIVER_SENSITIVITY - ED_RSSIOFFS + 10) ///< Minimal reported EDSAMPLE value (reported as 0)
#define EDSAMPLE_MAX_REPORTED_VALUE (ED_RESULT_MAX / ED_RSSISCALE) ///< Maximal reported EDSAMPLE value (reported as 255)
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/** Minimum value of ED in dBm for conversion to units conforming IEEE Std. 802.15.4-2015 chapter 10.2.5. */
#define ED_DBM_MIN (PHY_MIN_RECEIVER_SENSITIVITY + 10)
#define ED_DBM_MIN (PHY_MIN_RECEIVER_SENSITIVITY + 10)
/** Maximum value of ED in dBm for conversion to units conforming IEEE Std. 802.15.4-2015 chapter 10.2.5. */
#define ED_DBM_MAX (EDSAMPLE_MAX_REPORTED_VALUE + ED_RSSIOFFS)
#define ED_DBM_MAX (EDSAMPLE_MAX_REPORTED_VALUE + ED_RSSIOFFS)
static inline uint8_t nrf_802154_addons_energy_level_from_dbm_calculate(int8_t ed_dbm)
{
@ -83,22 +81,4 @@ static inline uint8_t nrf_802154_addons_energy_level_from_dbm_calculate(int8_t e
return r;
}
#else
/**
* @brief Converts the energy level received during the energy detection procedure to a dBm value.
*
* @param[in] energy_level Energy level value compliant with the 802.15.4 specification (0-255)
*
* @return Result of the energy detection procedure in dBm.
*/
static inline int8_t nrf_802154_addons_dbm_from_energy_level_calculate(uint8_t energy_level)
{
return ((int16_t)(EDSAMPLE_MAX_REPORTED_VALUE - EDSAMPLE_MIN_REPORTED_VALUE) *
((int16_t)energy_level)) /
ED_RESULT_MAX + EDSAMPLE_MIN_REPORTED_VALUE + ED_RSSIOFFS;
}
#endif // NRF_802154_ENERGY_DETECTED_VERSION != 0
#endif // NRF_802154_NRFX_ADDONS_H__

View File

@ -835,99 +835,92 @@ typedef enum
/**
* @brief Spinel data type description for nrf_802154_receive_at result.
*/
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_RET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_RET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_receive_at_cancel.
*/
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_CANCEL SPINEL_DATATYPE_UINT32_S
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_CANCEL SPINEL_DATATYPE_UINT32_S
/**
* @brief Spinel data type description for nrf_802154_receive_at_cancel result.
*/
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_CANCEL_RET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_RECEIVE_AT_CANCEL_RET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_pan_id_set.
*/
#define SPINEL_DATATYPE_NRF_802154_PAN_ID_SET SPINEL_DATATYPE_DATA_S
#define SPINEL_DATATYPE_NRF_802154_PAN_ID_SET SPINEL_DATATYPE_DATA_S
/**
* @brief Spinel data type description for nrf_802154_short_address_set.
*/
#define SPINEL_DATATYPE_NRF_802154_SHORT_ADDRESS_SET SPINEL_DATATYPE_DATA_S
#define SPINEL_DATATYPE_NRF_802154_SHORT_ADDRESS_SET SPINEL_DATATYPE_DATA_S
/**
* @brief Spinel data type description for nrf_802154_extended_address_set.
*/
#define SPINEL_DATATYPE_NRF_802154_EXTENDED_ADDRESS_SET SPINEL_DATATYPE_DATA_S
#define SPINEL_DATATYPE_NRF_802154_EXTENDED_ADDRESS_SET SPINEL_DATATYPE_DATA_S
/**
* @brief Spinel data type description for nrf_802154_pan_coord_set.
*/
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_SET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_SET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_pan_coord_get result.
*/
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_GET_RET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_GET_RET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_pan_coord_get.
*/
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_GET SPINEL_DATATYPE_NULL_S
#define SPINEL_DATATYPE_NRF_802154_PAN_COORD_GET SPINEL_DATATYPE_NULL_S
/**
* @brief Spinel data type description for nrf_802154_promiscuous_set.
*/
#define SPINEL_DATATYPE_NRF_802154_PROMISCUOUS_SET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_PROMISCUOUS_SET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_rx_on_when_idle_set.
*/
#define SPINEL_DATATYPE_NRF_802154_RX_ON_WHEN_IDLE_SET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_RX_ON_WHEN_IDLE_SET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_cca.
*/
#define SPINEL_DATATYPE_NRF_802154_CCA SPINEL_DATATYPE_NULL_S
#define SPINEL_DATATYPE_NRF_802154_CCA SPINEL_DATATYPE_NULL_S
/**
* @brief Spinel data type description for nrf_802154_cca result.
*/
#define SPINEL_DATATYPE_NRF_802154_CCA_RET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_CCA_RET SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_cca_done.
*/
#define SPINEL_DATATYPE_NRF_802154_CCA_DONE SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_CCA_DONE SPINEL_DATATYPE_BOOL_S
/**
* @brief Spinel data type description for nrf_802154_cca_failed.
*/
#define SPINEL_DATATYPE_NRF_802154_CCA_FAILED SPINEL_DATATYPE_UINT8_S
#define SPINEL_DATATYPE_NRF_802154_CCA_FAILED SPINEL_DATATYPE_UINT8_S
/**
* @brief Spinel data type description for nrf_802154_energy_detection.
*/
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTION SPINEL_DATATYPE_UINT32_S
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTION SPINEL_DATATYPE_UINT32_S
/**
* @brief Spinel data type description for nrf_802154_energy_detection result.
*/
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTION_RET SPINEL_DATATYPE_BOOL_S
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTION_RET SPINEL_DATATYPE_BOOL_S
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
/**
* @brief Spinel data type description for nrf_802154_energy_detected.
*/
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED SPINEL_DATATYPE_INT8_S
#else
/**
* @brief Spinel data type description for nrf_802154_energy_detected.
*/
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED SPINEL_DATATYPE_UINT8_S
#endif
#define SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED SPINEL_DATATYPE_INT8_S
/**
* @brief Spinel data type description for nrf_802154_energy_detection_failed.

View File

@ -116,7 +116,6 @@ static nrf_802154_ser_err_t spinel_decode_prop_nrf_802154_energy_detected(
const void * p_property_data,
size_t property_data_len)
{
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected_t result = {};
spinel_ssize_t siz = spinel_datatype_unpack(p_property_data,
@ -124,26 +123,12 @@ static nrf_802154_ser_err_t spinel_decode_prop_nrf_802154_energy_detected(
SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED,
&result.ed_dbm);
#else
uint8_t result;
spinel_ssize_t siz = spinel_datatype_unpack(p_property_data,
property_data_len,
SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED,
&result);
#endif
if (siz < 0)
{
return NRF_802154_SERIALIZATION_ERROR_DECODING_FAILURE;
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
nrf_802154_energy_detected(&result);
#else
nrf_802154_energy_detected(result);
#endif
return NRF_802154_SERIALIZATION_ERROR_OK;
}
@ -796,22 +781,12 @@ __WEAK void nrf_802154_cca_failed(nrf_802154_cca_error_t error)
// Intentionally empty
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
__WEAK void nrf_802154_energy_detected(const nrf_802154_energy_detected_t * p_result)
{
(void)p_result;
// Intentionally empty
}
#else
__WEAK void nrf_802154_energy_detected(uint8_t ed_level)
{
(void)ed_level;
// Intentionally empty
}
#endif // NRF_802154_ENERGY_DETECTED_VERSION != 0
__WEAK void nrf_802154_energy_detection_failed(nrf_802154_ed_error_t error)
{
(void)error;

View File

@ -125,11 +125,7 @@ bail:
return;
}
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
void nrf_802154_energy_detected(const nrf_802154_energy_detected_t * p_result)
#else
void nrf_802154_energy_detected(uint8_t result)
#endif
{
nrf_802154_ser_err_t res;
@ -138,17 +134,10 @@ void nrf_802154_energy_detected(uint8_t result)
NRF_802154_SPINEL_LOG_BANNER_CALLING();
NRF_802154_SPINEL_LOG_VAR("%u", result);
#if (NRF_802154_ENERGY_DETECTED_VERSION != 0)
res = nrf_802154_spinel_send_cmd_prop_value_is(
SPINEL_PROP_VENDOR_NORDIC_NRF_802154_ENERGY_DETECTED,
SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED,
p_result->ed_dbm);
#else
res = nrf_802154_spinel_send_cmd_prop_value_is(
SPINEL_PROP_VENDOR_NORDIC_NRF_802154_ENERGY_DETECTED,
SPINEL_DATATYPE_NRF_802154_ENERGY_DETECTED,
result);
#endif
SERIALIZATION_ERROR_CHECK(res, error, bail);