From 64948a431c46e57acfe7dbbb5ec8a37f30be8a6f Mon Sep 17 00:00:00 2001 From: Andrzej Kuros Date: Fri, 20 Dec 2024 14:12:05 +0200 Subject: [PATCH] nrf_802154: rev 9bac646f39a03af50cf42a4c07d9348c448857f8 This commit updates revision of the nrf_802154 component. Signed-off-by: Andrzej Kuros --- nrf_802154/common/include/nrf_802154.h | 148 +------------ .../common/include/nrf_802154_callouts.h | 107 +-------- nrf_802154/common/include/nrf_802154_config.h | 20 +- nrf_802154/common/include/nrf_802154_types.h | 3 +- nrf_802154/doc/CHANGELOG.rst | 9 + nrf_802154/doc/feature_description.rst | 3 - .../src/mac_features/nrf_802154_delayed_trx.h | 2 +- nrf_802154/driver/src/nrf_802154.c | 203 +----------------- nrf_802154/driver/src/nrf_802154_co.c | 33 --- nrf_802154/driver/src/nrf_802154_co.h | 27 --- .../src/nrf_802154_notification_direct.c | 18 -- .../driver/src/nrf_802154_notification_swi.c | 29 +-- nrf_802154/driver/src/nrf_802154_trx.c | 14 +- 13 files changed, 28 insertions(+), 588 deletions(-) diff --git a/nrf_802154/common/include/nrf_802154.h b/nrf_802154/common/include/nrf_802154.h index 8b6baa6173..fae254be3f 100644 --- a/nrf_802154/common/include/nrf_802154.h +++ b/nrf_802154/common/include/nrf_802154.h @@ -396,7 +396,7 @@ nrf_802154_sleep_error_t nrf_802154_sleep_if_idle(void); * * In the receive state, the radio receives frames and may automatically send ACK frames when * appropriate. The received frame is reported to the higher layer by a call to - * @ref nrf_802154_received. + * @ref nrf_802154_received_raw or @ref nrf_802154_received_timestamp_raw . * * @retval true The radio enters the receive state. * @retval false The driver could not enter the receive state. @@ -453,8 +453,6 @@ bool nrf_802154_receive_at(uint64_t rx_time, */ bool nrf_802154_receive_at_cancel(uint32_t id); -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - /** * @brief Changes the radio state to @ref RADIO_STATE_TX. * @@ -465,8 +463,6 @@ bool nrf_802154_receive_at_cancel(uint32_t id); * @note This function is implemented in zero-copy fashion. It passes the given buffer pointer to * the RADIO peripheral. * - * @note This function is available if @ref NRF_802154_USE_RAW_API is enabled. - * * In the transmit state, the radio transmits a given frame. If requested, it waits for * an ACK frame. Depending on @ref NRF_802154_ACK_TIMEOUT_ENABLED, the radio driver automatically * stops waiting for an ACK frame or waits indefinitely for an ACK frame. If it is configured to @@ -502,63 +498,6 @@ bool nrf_802154_receive_at_cancel(uint32_t id); bool nrf_802154_transmit_raw(uint8_t * p_data, const nrf_802154_transmit_metadata_t * p_metadata); -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) - -/** - * @brief Changes the radio state to transmit. - * - * @note If the CPU is halted or interrupted while this function is executed, - * @ref nrf_802154_transmitted or @ref nrf_802154_transmit_failed must be called before this - * function returns a result. - * - * @note This function copies the given buffer. It maintains an internal buffer, which is used to - * make a frame copy. To prevent unnecessary memory consumption and to perform zero-copy - * transmission, use @ref nrf_802154_transmit_raw instead. - * - * @note This function is available if @ref NRF_802154_USE_RAW_API is disabled. - * - * In the transmit state, the radio transmits a given frame. If requested, it waits for - * an ACK frame. Depending on @ref NRF_802154_ACK_TIMEOUT_ENABLED, the radio driver automatically - * stops waiting for an ACK frame or waits indefinitely for an ACK frame. If it is configured to - * wait, the MAC layer is responsible for calling @ref nrf_802154_receive or - * @ref nrf_802154_sleep after the ACK timeout. - * The transmission result is reported to the higher layer by calls to @ref nrf_802154_transmitted - * or @ref nrf_802154_transmit_failed. - * - * @verbatim - * p_data - * v - * +-----+-----------------------------------------------------------+------------+ - * | PHR | MAC header and payload | FCS | - * +-----+-----------------------------------------------------------+------------+ - * | | - * | <------------------ length -----------------------------> | - * @endverbatim - * - * @param[in] p_data Pointer to the array with the payload of data to transmit. The array - * should exclude PHR or FCS fields of the 802.15.4 frame. - * @param[in] length Length of the given frame. This value must exclude PHR and FCS fields - * from the given frame (exact size of buffer pointed to by @p p_data). - * @param[in] p_metadata Pointer to metadata structure. Contains detailed properties of data - * to transmit. If @c NULL following metadata are used: - * Field | Value - * ----------------|----------------------------------------------------- - * @c frame_props | @ref NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT - * @c cca | @c true - * - * @retval true The transmission procedure was scheduled. - * @retval false The driver could not schedule the transmission procedure. - */ -bool nrf_802154_transmit(const uint8_t * p_data, - uint8_t length, - const nrf_802154_transmit_metadata_t * p_metadata); - -#endif // !NRF_802154_SERIALIZATION_HOST -#endif // !NRF_802154_USE_RAW_API - /** * @brief Requests transmission at the specified time. * @@ -719,15 +658,12 @@ bool nrf_802154_modulated_carrier(const uint8_t * p_data); * @{ */ -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - /** * @brief Notifies the driver that the buffer containing the received frame is not used anymore. * * @note The buffer pointed to by @p p_data may be modified by this function. * @note This function can be safely called only from the main context. To free the buffer from * a callback or the IRQ context, use @ref nrf_802154_buffer_free_immediately_raw. - * @note This function is available if @ref NRF_802154_USE_RAW_API is enabled. * * @param[in] p_data Pointer to the buffer containing the received data that is no longer needed * by the higher layer. @@ -742,7 +678,6 @@ void nrf_802154_buffer_free_raw(uint8_t * p_data); * @note This function can be safely called from any context. If the driver is busy processing * a request called from a context with lower priority, this function returns false and * the caller should free the buffer later. - * @note This function is available if @ref NRF_802154_USE_RAW_API is enabled. * * @param[in] p_data Pointer to the buffer containing the received data that is no longer needed * by the higher layer. @@ -753,44 +688,6 @@ void nrf_802154_buffer_free_raw(uint8_t * p_data); bool nrf_802154_buffer_free_immediately_raw(uint8_t * p_data); #endif // !NRF_802154_SERIALIZATION_HOST -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) - -/** - * @brief Notifies the driver that the buffer containing the received frame is not used anymore. - * - * @note The buffer pointed to by @p p_data may be modified by this function. - * @note This function can be safely called only from the main context. To free the buffer from - * a callback or IRQ context, use @ref nrf_802154_buffer_free_immediately. - * @note This function is available if @ref NRF_802154_USE_RAW_API is disabled. - * - * @param[in] p_data Pointer to the buffer containing the received data that is no longer needed - * by the higher layer. - */ -void nrf_802154_buffer_free(uint8_t * p_data); - -/** - * @brief Notifies the driver that the buffer containing the received frame is not used anymore. - * - * @note The buffer pointed to by @p p_data may be modified by this function. - * @note This function can be safely called from any context. If the driver is busy processing - * a request called from a context with lower priority, this function returns false and - * the caller should free the buffer later. - * @note This function is available if @ref NRF_802154_USE_RAW_API is disabled. - * - * @param[in] p_data Pointer to the buffer containing the received data that is no longer needed - * by the higher layer. - * - * @retval true Buffer was freed successfully. - * @retval false Buffer cannot be freed right now due to ongoing operation. - */ -bool nrf_802154_buffer_free_immediately(uint8_t * p_data); - -#endif // !NRF_802154_SERIALIZATION_HOST -#endif // !NRF_802154_USE_RAW_API - /** * @} * @defgroup nrf_802154_rssi RSSI measurement function @@ -869,7 +766,7 @@ bool nrf_802154_promiscuous_get(void); * after the ACK frame is transmitted. * If the auto ACK is disabled, the driver does not transmit ACK frames. It notifies the next higher * layer about the received frames when a frame is received. In this mode, the next higher layer is - * responsible for sending the ACK frame. ACK frames should be sent using @ref nrf_802154_transmit. + * responsible for sending the ACK frame. ACK frames should be sent using @ref nrf_802154_transmit_raw. * * @param[in] enabled If the auto ACK should be enabled. */ @@ -1121,7 +1018,6 @@ void nrf_802154_cca_cfg_get(nrf_802154_cca_cfg_t * p_cca_cfg); * @{ */ #if NRF_802154_CSMA_CA_ENABLED || defined(DOXYGEN) -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) /** * @brief Performs the CSMA-CA procedure and transmits a frame in case of success. @@ -1136,8 +1032,7 @@ void nrf_802154_cca_cfg_get(nrf_802154_cca_cfg_t * p_cca_cfg); * to time out waiting for the ACK frame. This timer can be started * by @ref nrf_802154_tx_started. When the timer expires, the MAC layer is expected * to call @ref nrf_802154_receive or @ref nrf_802154_sleep to stop waiting for the ACK frame. - * @note This function is available if @ref NRF_802154_CSMA_CA_ENABLED is enabled and - * @ref NRF_802154_USE_RAW_API is enabled. + * @note This function is available if @ref NRF_802154_CSMA_CA_ENABLED is enabled. * * @param[in] p_data Pointer to the frame to transmit. See also @ref nrf_802154_transmit_raw. * @param[in] p_metadata Pointer to metadata structure. Contains detailed properties of data @@ -1152,43 +1047,6 @@ void nrf_802154_cca_cfg_get(nrf_802154_cca_cfg_t * p_cca_cfg); bool nrf_802154_transmit_csma_ca_raw(uint8_t * p_data, const nrf_802154_transmit_csma_ca_metadata_t * p_metadata); -#else // NRF_802154_USE_RAW_API - -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) -/** - * @brief Performs the CSMA-CA procedure and transmits a frame in case of success. - * - * The end of the CSMA-CA procedure is notified by @ref nrf_802154_transmitted or - * @ref nrf_802154_transmit_failed. - * - * @note The driver may be configured to automatically time out waiting for an ACK frame depending - * on @ref NRF_802154_ACK_TIMEOUT_ENABLED. If the automatic ACK timeout is disabled, - * the CSMA-CA procedure does not time out waiting for an ACK frame if a frame - * with the ACK request bit set was transmitted. The MAC layer is expected to manage the timer - * to time out waiting for the ACK frame. This timer can be started - * by @ref nrf_802154_tx_started. When the timer expires, the MAC layer is expected - * to call @ref nrf_802154_receive or @ref nrf_802154_sleep to stop waiting for the ACK frame. - * @note This function is available if @ref NRF_802154_CSMA_CA_ENABLED is enabled and - * @ref NRF_802154_USE_RAW_API is disabled. - * - * @param[in] p_data Pointer to the frame to transmit. See also @ref nrf_802154_transmit. - * @param[in] length Length of the given frame. See also @ref nrf_802154_transmit. - * @param[in] p_metadata Pointer to metadata structure. Contains detailed properties of data - * to transmit. If @c NULL following metadata are used: - * Field | Value - * ----------------|----------------------------------------------------- - * @c frame_props | @ref NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT - * - * @retval true The chain of CSMA-CA and transmission procedure was scheduled. - * @retval false The driver could not schedule the procedure chain. - */ -bool nrf_802154_transmit_csma_ca(const uint8_t * p_data, - uint8_t length, - const nrf_802154_transmit_csma_ca_metadata_t * p_metadata); -#endif // !NRF_802154_SERIALIZATION_HOST - -#endif // NRF_802154_USE_RAW_API - /** * @brief Sets the minimum value of the backoff exponent (BE) in the CSMA-CA algorithm. * diff --git a/nrf_802154/common/include/nrf_802154_callouts.h b/nrf_802154/common/include/nrf_802154_callouts.h index dee3743e6b..0349c7f9d3 100644 --- a/nrf_802154/common/include/nrf_802154_callouts.h +++ b/nrf_802154/common/include/nrf_802154_callouts.h @@ -98,8 +98,6 @@ extern void nrf_802154_energy_detection_failed(nrf_802154_ed_error_t error); */ extern void nrf_802154_tx_ack_started(const uint8_t * p_data); -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - #if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) /** * @brief Notifies that a frame was received. @@ -110,9 +108,8 @@ extern void nrf_802154_tx_ack_started(const uint8_t * p_data); * to receive a frame) until @ref nrf_802154_buffer_free_raw is called. * @note The buffer pointed to by @p p_data may be modified by the function handler (and other * modules) until @ref nrf_802154_buffer_free_raw is called. - * @note This callout is called by the nRF 802.15.4 Radio Driver if @ref NRF_802154_USE_RAW_API - * is enabled. Default implementation of this function provided by - * the nRF 802.15.4 Radio Driver calls @ref nrf_802154_received_timestamp_raw . + * @note Default implementation of this function provided by the nRF 802.15.4 Radio Driver + * calls @ref nrf_802154_received_timestamp_raw . * * @verbatim * p_data @@ -160,67 +157,6 @@ extern void nrf_802154_received_timestamp_raw(uint8_t * p_data, uint8_t lqi, uint64_t time); -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) -/** - * @brief Notifies that a frame was received. - * - * @note The buffer pointed to by @p p_data is not modified by the radio driver (and cannot - * be used to receive a frame) until @ref nrf_802154_buffer_free is called. - * @note The buffer pointed to by @p p_data can be modified by the function handler (and other - * modules) until @ref nrf_802154_buffer_free is called. - * @note This callout is called by the nRF 802.15.4 Radio Driver if @ref NRF_802154_USE_RAW_API - * is disabled. Default implementation of this function provided by - * the nRF 802.15.4 Radio Driver calls @ref nrf_802154_received_timestamp . - * - * @verbatim - * p_data - * v - * +-----+-----------------------------------------------------------+------------+ - * | PHR | MAC Header and payload | FCS | - * +-----+-----------------------------------------------------------+------------+ - * | | - * | <------------------ length -----------------------------> | - * @endverbatim - * - * @param[in] p_data Pointer to a buffer that contains only the payload of the received frame - * (PSDU without FCS). - * @param[in] length Length of the received payload. - * @param[in] power RSSI of the received frame. - * @param[in] lqi LQI of the received frame. - */ -extern void nrf_802154_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi); - -/** - * @brief Notifies that a frame was received at a given time. - * - * This function works like @ref nrf_802154_received and adds a timestamp to the parameter list. - * - * @note The received frame usually contains a timestamp. However, due to a race condition, - * the timestamp may be invalid. This erroneous situation is indicated by - * the @ref NRF_802154_NO_TIMESTAMP value of the @p time parameter. - * @note This callout is called by the default implementation of @ref nrf_802154_received . - * - * @param[in] p_data Pointer to a buffer that contains only the payload of the received frame - * (PSDU without FCS). - * @param[in] length Length of the received payload. - * @param[in] power RSSI of the received frame. - * @param[in] lqi LQI of the received frame. - * @param[in] time Timestamp taken when the last symbol of the frame was received, - * in microseconds (us), or @ref NRF_802154_NO_TIMESTAMP if the timestamp - * is invalid. - */ -extern void nrf_802154_received_timestamp(uint8_t * p_data, - uint8_t length, - int8_t power, - uint8_t lqi, - uint32_t time); - -#endif // !NRF_802154_SERIALIZATION_HOST -#endif // !NRF_802154_USE_RAW_API - /** * @brief Notifies that the reception of a frame failed. * @@ -233,7 +169,6 @@ extern void nrf_802154_received_timestamp(uint8_t * p_data, */ extern void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id); -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) /** * @brief Notifies that a frame was transmitted. * @@ -249,8 +184,6 @@ extern void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id); * @note @c nrf_802154_transmit_done_metadata_t::data.transmitted.time granularity depends on the * granularity of the timer driver in the * platform/timer directory. - * @note This callout is called by the nRF 802.15.4 Radio Driver if @ref NRF_802154_USE_RAW_API - * is enabled. * * @param[in] p_frame Pointer to a buffer that contains PHR and PSDU of the transmitted frame. * @param[in] p_metadata Pointer to a metadata structure describing frame passed in @p p_frame. @@ -258,38 +191,6 @@ extern void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id); extern void nrf_802154_transmitted_raw(uint8_t * p_frame, const nrf_802154_transmit_done_metadata_t * p_metadata); -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -/** - * @brief Notifies that a frame was transmitted. - * - * @note If ACK was requested for the transmitted frame, this function is called after a proper ACK - * is received. If ACK was not requested, this function is called just after transmission has - * ended. - * @note The buffer pointed to by @c nrf_802154_transmit_done_metadata_t::data.transmitted.p_ack - * is not modified by the radio driver (and cannot be used to receive a frame) until - * @ref nrf_802154_buffer_free is called. - * @note The buffer pointed to by @c nrf_802154_transmit_done_metadata_t::data.transmitted.p_ack - * may be modified by the function handler (and other modules) until - * @ref nrf_802154_buffer_free is called. - * @note The next higher layer must handle either @ref nrf_802154_transmitted or - * @ref nrf_802154_transmitted_raw. It should not handle both functions. - * @note @c nrf_802154_transmit_done_metadata_t::data.transmitted.time granularity depends on the - * granularity of the timer driver in the platform/timer directory. - * @note Including a timestamp for received frames uses resources like CPU time and memory. If the - * timestamp is not required, use @ref nrf_802154_received instead. - * @note This callout is called by the nRF 802.15.4 Radio Driver if @ref NRF_802154_USE_RAW_API - * is disabled. - * - * @param[in] p_frame Pointer to a buffer that contains PHR and PSDU of the transmitted frame. - * @param[in] p_metadata Pointer to a metadata structure describing frame passed in @p p_frame. - */ -extern void nrf_802154_transmitted(uint8_t * p_frame, - const nrf_802154_transmit_done_metadata_t * p_metadata); - -#endif // !NRF_802154_USE_RAW_API - /** * @brief Notifies that a frame was not transmitted due to a busy channel. * @@ -313,9 +214,9 @@ extern void nrf_802154_transmit_failed(uint8_t * * @note Currently this callout is only available on the CPU which is running the core of the radio driver. * If the higher layer runs on a different core it should use nrf_802154_received_timestamp_raw instead. - * @note Usually, @ref nrf_802154_transmitted is called shortly after this function. + * @note Usually, @ref nrf_802154_transmitted_raw is called shortly after this function. * However, if the transmit procedure is interrupted, it might happen that - * @ref nrf_802154_transmitted is not called. + * @ref nrf_802154_transmitted_raw is not called. * @note This function should be very short to prevent dropping frames by the driver. * * @param[in] p_frame Pointer to a buffer that contains PHR and PSDU of the frame being diff --git a/nrf_802154/common/include/nrf_802154_config.h b/nrf_802154/common/include/nrf_802154_config.h index ccb060d63d..45c37a0bca 100644 --- a/nrf_802154/common/include/nrf_802154_config.h +++ b/nrf_802154/common/include/nrf_802154_config.h @@ -154,20 +154,6 @@ extern "C" { #define NRF_802154_ECB_PRIORITY 3 #endif -/** - * @def NRF_802154_USE_RAW_API - * - * When this flag is set, the RAW API is available for the MAC layer. It is recommended to use - * the RAW API because it provides more optimized functions. - * - * @note If the RAW API is not enabled for the MAC layer, only less optimized functions performing - * copy are available. - * - */ -#ifndef NRF_802154_USE_RAW_API -#define NRF_802154_USE_RAW_API 1 -#endif - /** * @def NRF_802154_PENDING_SHORT_ADDRESSES * @@ -225,11 +211,11 @@ extern "C" { * @def NRF_802154_FRAME_TIMESTAMP_ENABLED * * If timestamps are to be added to the frames received. - * Enabling this feature enables the functions @ref nrf_802154_received_timestamp_raw, - * @ref nrf_802154_received_timestamp which add timestamps to the frames received. + * Enabling this feature enables the function @ref nrf_802154_received_timestamp_raw, + * which add timestamps to the frames received. * Enables also proper value of frame timestamp * ( @c nrf_802154_transmit_done_metadata_t::data.transmitted.time ) passed as metadata to - * @ref nrf_802154_transmitted and @ref nrf_802154_transmitted_raw, + * @ref nrf_802154_transmitted_raw . * This option also enables timestamping in stats. * */ diff --git a/nrf_802154/common/include/nrf_802154_types.h b/nrf_802154/common/include/nrf_802154_types.h index ce26fc133d..5f1216c4eb 100644 --- a/nrf_802154/common/include/nrf_802154_types.h +++ b/nrf_802154/common/include/nrf_802154_types.h @@ -477,8 +477,7 @@ typedef struct { struct { - uint8_t * p_ack; // !< If NRF_802154_USE_RAW_API is disabled, p_ack is a pointer to a buffer that contains only the received ACK payload (PSDU excluding FCS). - // If NRF_802154_USE_RAW_API is enabled, p_ack is a pointer to a buffer that contains PHR and PSDU of the received ACK. The first byte + uint8_t * p_ack; // !< A pointer to a buffer that contains PHR and PSDU of the received ACK. The first byte // in the buffer is the length of the frame (PHR). The following bytes contain the ACK frame itself (PSDU). The length byte // (PHR) includes FCS. FCS is already verified by the hardware and may be modified by the hardware. // If ACK was not requested or requested but not received, @ref p_ack is set to NULL. diff --git a/nrf_802154/doc/CHANGELOG.rst b/nrf_802154/doc/CHANGELOG.rst index 6cf1a5abb1..184794fd93 100644 --- a/nrf_802154/doc/CHANGELOG.rst +++ b/nrf_802154/doc/CHANGELOG.rst @@ -10,6 +10,15 @@ Changelog All notable changes to this project are documented in this file. See also :ref:`nrf_802154_limitations` for permanent limitations. +Main branch - nRF 802.15.4 Radio Driver +*************************************** + +Removed +======= + +* Removed deprecated non-raw API that could be enabled by setting ``NRF_802154_USE_RAW_API=0``. + Only raw API is kept. + nRF Connect SDK v2.9.0 - nRF 802.15.4 Radio Driver ************************************************** diff --git a/nrf_802154/doc/feature_description.rst b/nrf_802154/doc/feature_description.rst index 9b8dd7f730..5b3bcdf6eb 100644 --- a/nrf_802154/doc/feature_description.rst +++ b/nrf_802154/doc/feature_description.rst @@ -319,7 +319,6 @@ When the driver modifies a frame, it also informs the higher layer about the mod To do so, the following functions take an additional parameter: -* :c:func:`nrf_802154_transmitted` * :c:func:`nrf_802154_transmitted_raw` * :c:func:`nrf_802154_transmit_failed` @@ -338,9 +337,7 @@ After receiving information about the modifications performed, the higher layer To do so, the following functions take an additional parameter: -* :c:func:`nrf_802154_transmit` * :c:func:`nrf_802154_transmit_raw` -* :c:func:`nrf_802154_transmit_csma_ca` * :c:func:`nrf_802154_transmit_csma_ca_raw` * :c:func:`nrf_802154_transmit_raw_at` diff --git a/nrf_802154/driver/src/mac_features/nrf_802154_delayed_trx.h b/nrf_802154/driver/src/mac_features/nrf_802154_delayed_trx.h index 427606b551..514465c8ac 100644 --- a/nrf_802154/driver/src/mac_features/nrf_802154_delayed_trx.h +++ b/nrf_802154/driver/src/mac_features/nrf_802154_delayed_trx.h @@ -99,7 +99,7 @@ bool nrf_802154_delayed_trx_transmit_cancel(void); * @brief Requests the reception of a frame at a given time. * * If the request is accepted and a frame is received during the defined time slot, - * the @ref nrf_802154_received function is called. If the request is rejected due + * the @ref nrf_802154_received_raw function is called. If the request is rejected due * to a denied timeslot request or the reception timeout expires, * the @ref nrf_802154_receive_failed function is called. * diff --git a/nrf_802154/driver/src/nrf_802154.c b/nrf_802154/driver/src/nrf_802154.c index d960e16935..97f4fa1faf 100644 --- a/nrf_802154/driver/src/nrf_802154.c +++ b/nrf_802154/driver/src/nrf_802154.c @@ -80,34 +80,15 @@ #include "nrf_802154_sl_capabilities.h" #include "nrf_802154_sl_timer.h" -#if !NRF_802154_USE_RAW_API || NRF_802154_CARRIER_FUNCTIONS_ENABLED -/** Static transmit buffer used by @sa nrf_802154_transmit() family of functions. +#if NRF_802154_CARRIER_FUNCTIONS_ENABLED +/** Static transmit buffer used by @sa nrf_802154_modulated_carrier function. * * If none of functions using this buffer is called and link time optimization is enabled, this * buffer should be removed by linker. */ static uint8_t m_tx_buffer[RAW_PAYLOAD_OFFSET + MAX_PACKET_SIZE]; -#endif // !NRF_802154_USE_RAW_API || NRF_802154_CARRIER_FUNCTIONS_ENABLED - -#if !NRF_802154_USE_RAW_API -/** - * @brief Fill transmit buffer with given data. - * - * @param[in] p_data Pointer to array containing payload of a data to transmit. The array - * should exclude PHR or FCS fields of 802.15.4 frame. - * @param[in] length Length of given frame. This value shall exclude PHR and FCS fields from - * the given frame (exact size of buffer pointed by @p p_data). - */ -static void tx_buffer_fill(const uint8_t * p_data, uint8_t length) -{ - NRF_802154_ASSERT(length <= MAX_PACKET_SIZE - FCS_SIZE); - - m_tx_buffer[RAW_LENGTH_OFFSET] = length + FCS_SIZE; - memcpy(&m_tx_buffer[RAW_PAYLOAD_OFFSET], p_data, length); -} - -#endif // !NRF_802154_USE_RAW_API +#endif // NRF_802154_CARRIER_FUNCTIONS_ENABLED #if NRF_802154_CARRIER_FUNCTIONS_ENABLED /** @@ -455,7 +436,6 @@ bool nrf_802154_receive(void) return result; } -#if NRF_802154_USE_RAW_API bool nrf_802154_transmit_raw(uint8_t * p_data, const nrf_802154_transmit_metadata_t * p_metadata) { @@ -509,65 +489,6 @@ bool nrf_802154_transmit_raw(uint8_t * p_data, return result; } -#else // NRF_802154_USE_RAW_API - -bool nrf_802154_transmit(const uint8_t * p_data, - uint8_t length, - const nrf_802154_transmit_metadata_t * p_metadata) -{ - bool result; - uint8_t channel; - - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - - if (p_metadata == NULL) - { - static const nrf_802154_transmit_metadata_t metadata_default = - { - .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, - .cca = true, - .tx_power = {.use_metadata_value = false}, - .tx_channel = {.use_metadata_value = false} - }; - - p_metadata = &metadata_default; - } - - channel = - p_metadata->tx_channel.use_metadata_value ? p_metadata->tx_channel.channel : - nrf_802154_pib_channel_get(); - - nrf_802154_transmit_params_t params = - { - .frame_props = p_metadata->frame_props, - .tx_power = {0}, - .channel = channel, - .cca = p_metadata->cca, - .immediate = false, - .extra_cca_attempts = 0U, - }; - - (void)nrf_802154_tx_power_convert_metadata_to_tx_power_split(channel, - p_metadata->tx_power, - ¶ms.tx_power); - - result = are_frame_properties_valid(¶ms.frame_props); - if (result) - { - tx_buffer_fill(p_data, length); - result = nrf_802154_request_transmit(NRF_802154_TERM_NONE, - REQ_ORIG_HIGHER_LAYER, - m_tx_buffer, - ¶ms, - NULL); - } - - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); - return result; -} - -#endif // NRF_802154_USE_RAW_API - #if NRF_802154_DELAYED_TRX_ENABLED bool nrf_802154_transmit_raw_at(uint8_t * p_data, uint64_t tx_time, @@ -696,8 +617,6 @@ bool nrf_802154_modulated_carrier(const uint8_t * p_data) #endif // NRF_802154_CARRIER_FUNCTIONS_ENABLED -#if NRF_802154_USE_RAW_API - void nrf_802154_buffer_free_raw(uint8_t * p_data) { nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); @@ -731,43 +650,6 @@ bool nrf_802154_buffer_free_immediately_raw(uint8_t * p_data) return result; } -#else // NRF_802154_USE_RAW_API - -void nrf_802154_buffer_free(uint8_t * p_data) -{ - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - - bool result; - rx_buffer_t * p_buffer = (rx_buffer_t *)(p_data - RAW_PAYLOAD_OFFSET); - - NRF_802154_ASSERT(p_buffer->free == false); - (void)p_buffer; - - result = nrf_802154_request_buffer_free(p_data - RAW_PAYLOAD_OFFSET); - NRF_802154_ASSERT(result); - (void)result; - - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); -} - -bool nrf_802154_buffer_free_immediately(uint8_t * p_data) -{ - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - - bool result; - rx_buffer_t * p_buffer = (rx_buffer_t *)(p_data - RAW_PAYLOAD_OFFSET); - - NRF_802154_ASSERT(p_buffer->free == false); - (void)p_buffer; - - result = nrf_802154_request_buffer_free(p_data - RAW_PAYLOAD_OFFSET); - - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); - return result; -} - -#endif // NRF_802154_USE_RAW_API - bool nrf_802154_rssi_measure_begin(void) { return nrf_802154_request_rssi_measure(); @@ -883,7 +765,6 @@ void nrf_802154_cca_cfg_get(nrf_802154_cca_cfg_t * p_cca_cfg) } #if NRF_802154_CSMA_CA_ENABLED -#if NRF_802154_USE_RAW_API bool nrf_802154_transmit_csma_ca_raw(uint8_t * p_data, const nrf_802154_transmit_csma_ca_metadata_t * p_metadata) @@ -914,41 +795,6 @@ bool nrf_802154_transmit_csma_ca_raw(uint8_t return result; } -#else // NRF_802154_USE_RAW_API - -bool nrf_802154_transmit_csma_ca(const uint8_t * p_data, - uint8_t length, - const nrf_802154_transmit_csma_ca_metadata_t * p_metadata) -{ - bool result; - - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - - if (p_metadata == NULL) - { - static const nrf_802154_transmit_csma_ca_metadata_t metadata_default = - { - .frame_props = NRF_802154_TRANSMITTED_FRAME_PROPS_DEFAULT_INIT, - .tx_power = {.use_metadata_value = false}, - .tx_channel = {.use_metadata_value = false} - }; - - p_metadata = &metadata_default; - } - - result = are_frame_properties_valid(&p_metadata->frame_props); - if (result) - { - tx_buffer_fill(p_data, length); - result = nrf_802154_request_csma_ca_start(m_tx_buffer, p_metadata); - } - - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); - return result; -} - -#endif // NRF_802154_USE_RAW_API - bool nrf_802154_csma_ca_min_be_set(uint8_t min_be) { return nrf_802154_pib_csmaca_min_be_set(min_be); @@ -1131,7 +977,6 @@ __WEAK void nrf_802154_tx_ack_started(const uint8_t * p_data) (void)p_data; } -#if NRF_802154_USE_RAW_API __WEAK void nrf_802154_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi) { uint64_t timestamp; @@ -1156,29 +1001,6 @@ __WEAK void nrf_802154_received_timestamp_raw(uint8_t * p_data, nrf_802154_buffer_free_raw(p_data); } -#else // NRF_802154_USE_RAW_API - -__WEAK void nrf_802154_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi) -{ - nrf_802154_received_timestamp(p_data, length, power, lqi, last_rx_frame_timestamp_get()); -} - -__WEAK void nrf_802154_received_timestamp(uint8_t * p_data, - uint8_t length, - int8_t power, - uint8_t lqi, - uint32_t time) -{ - (void)length; - (void)power; - (void)lqi; - (void)time; - - nrf_802154_buffer_free(p_data); -} - -#endif // !NRF_802154_USE_RAW_API - __WEAK void nrf_802154_receive_failed(nrf_802154_rx_error_t error, uint32_t id) { (void)error; @@ -1190,7 +1012,6 @@ __WEAK void nrf_802154_tx_started(const uint8_t * p_frame) (void)p_frame; } -#if NRF_802154_USE_RAW_API __WEAK void nrf_802154_transmitted_raw(uint8_t * p_frame, const nrf_802154_transmit_done_metadata_t * p_metadata) { @@ -1204,24 +1025,6 @@ __WEAK void nrf_802154_transmitted_raw(uint8_t } } -#else // NRF_802154_USE_RAW_API - -__WEAK void nrf_802154_transmitted(uint8_t * p_frame, - const nrf_802154_transmit_done_metadata_t * p_metadata) - -{ - (void)p_frame; - - uint8_t * p_ack = p_metadata->data.transmitted.p_ack; - - if (p_ack != NULL) - { - nrf_802154_buffer_free(p_ack); - } -} - -#endif // NRF_802154_USE_RAW_API - __WEAK void nrf_802154_transmit_failed(uint8_t * p_frame, nrf_802154_tx_error_t error, const nrf_802154_transmit_done_metadata_t * p_metadata) diff --git a/nrf_802154/driver/src/nrf_802154_co.c b/nrf_802154/driver/src/nrf_802154_co.c index 756a6f092a..d2657993b1 100644 --- a/nrf_802154/driver/src/nrf_802154_co.c +++ b/nrf_802154/driver/src/nrf_802154_co.c @@ -79,8 +79,6 @@ void nrf_802154_co_tx_ack_started(const uint8_t * p_data) nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - #if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) void nrf_802154_co_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi) @@ -92,21 +90,6 @@ void nrf_802154_co_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi) #endif // !NRF_802154_SERIALIZATION_HOST -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) - -void nrf_802154_co_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi) -{ - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - nrf_802154_received(p_data, length, power, lqi); - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); -} - -#endif // !NRF_802154_SERIALIZATION_HOST -#endif // !NRF_802154_USE_RAW_API - void nrf_802154_co_receive_failed(nrf_802154_rx_error_t error, uint32_t id) { nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); @@ -114,8 +97,6 @@ void nrf_802154_co_receive_failed(nrf_802154_rx_error_t error, uint32_t id) nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - void nrf_802154_co_transmitted_raw(uint8_t * p_frame, const nrf_802154_transmit_done_metadata_t * p_metadata) { @@ -124,20 +105,6 @@ void nrf_802154_co_transmitted_raw(uint8_t * p nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) - -void nrf_802154_co_transmitted(uint8_t * p_frame, - const nrf_802154_transmit_done_metadata_t * p_metadata) -{ - nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); - nrf_802154_transmitted(p_frame, p_metadata); - nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); -} - -#endif // !NRF_802154_USE_RAW_API - void nrf_802154_co_transmit_failed(uint8_t * p_frame, nrf_802154_tx_error_t error, const nrf_802154_transmit_done_metadata_t * p_metadata) diff --git a/nrf_802154/driver/src/nrf_802154_co.h b/nrf_802154/driver/src/nrf_802154_co.h index 751ffbcd38..6c35be2aec 100644 --- a/nrf_802154/driver/src/nrf_802154_co.h +++ b/nrf_802154/driver/src/nrf_802154_co.h @@ -66,7 +66,6 @@ void nrf_802154_co_energy_detection_failed(nrf_802154_ed_error_t error); */ void nrf_802154_co_tx_ack_started(const uint8_t * p_data); -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) #if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) /** @brief Calls @ref nrf_802154_received_raw. @@ -75,44 +74,18 @@ void nrf_802154_co_tx_ack_started(const uint8_t * p_data); void nrf_802154_co_received_raw(uint8_t * p_data, int8_t power, uint8_t lqi); #endif // !NRF_802154_SERIALIZATION_HOST -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) -#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN) - -/** @brief Calls @ref nrf_802154_received. - * @note See @ref nrf_802154_received for documentation of parameters. - */ -void nrf_802154_co_received(uint8_t * p_data, uint8_t length, int8_t power, uint8_t lqi); - -#endif // !NRF_802154_SERIALIZATION_HOST -#endif // !NRF_802154_USE_RAW_API /** @brief Calls @ref nrf_802154_receive_failed. * @note See @ref nrf_802154_receive_failed for documentation of parameters. */ void nrf_802154_co_receive_failed(nrf_802154_rx_error_t error, uint32_t id); -#if NRF_802154_USE_RAW_API || defined(DOXYGEN) - /** @brief Calls @ref nrf_802154_transmitted_raw. * @note See @ref nrf_802154_transmitted_raw for documentation of parameters. */ void nrf_802154_co_transmitted_raw(uint8_t * p_frame, const nrf_802154_transmit_done_metadata_t * p_metadata); -#endif // NRF_802154_USE_RAW_API - -#if !NRF_802154_USE_RAW_API || defined(DOXYGEN) - -/** @brief Calls @ref nrf_802154_transmitted. - * @note See @ref nrf_802154_transmitted for documentation of parameters. - */ -void nrf_802154_co_transmitted(uint8_t * p_frame, - const nrf_802154_transmit_done_metadata_t * p_metadata); - -#endif // !NRF_802154_USE_RAW_API - /** @brief Calls @ref nrf_802154_transmit_failed. * @note See @ref nrf_802154_transmit_failed for documentation of parameters. */ diff --git a/nrf_802154/driver/src/nrf_802154_notification_direct.c b/nrf_802154/driver/src/nrf_802154_notification_direct.c index 24019e2af3..3ca646f2dc 100644 --- a/nrf_802154/driver/src/nrf_802154_notification_direct.c +++ b/nrf_802154/driver/src/nrf_802154_notification_direct.c @@ -66,11 +66,7 @@ void nrf_802154_notify_received(uint8_t * p_data, int8_t power, uint8_t lqi) { nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); -#if NRF_802154_USE_RAW_API nrf_802154_co_received_raw(p_data, power, lqi); -#else // NRF_802154_USE_RAW_API - nrf_802154_co_received(p_data + RAW_PAYLOAD_OFFSET, p_data[RAW_LENGTH_OFFSET], power, lqi); -#endif // NRF_802154_USE_RAW_API nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } @@ -97,17 +93,7 @@ void nrf_802154_notify_transmitted(uint8_t * p_frame nrf_802154_tx_work_buffer_original_frame_update(p_frame, &p_metadata->frame_props); // Notify -#if NRF_802154_USE_RAW_API nrf_802154_co_transmitted_raw(p_frame, p_metadata); -#else // NRF_802154_USE_RAW_API - if (p_metadata->data.transmitted.p_ack != NULL) - { - p_metadata->data.transmitted.length = p_metadata->data.transmitted.p_ack[RAW_LENGTH_OFFSET]; - p_metadata->data.transmitted.p_ack += RAW_PAYLOAD_OFFSET; - } - - nrf_802154_transmitted(p_frame + RAW_PAYLOAD_OFFSET, p_metadata); -#endif // NRF_802154_USE_RAW_API nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } @@ -119,11 +105,7 @@ void nrf_802154_notify_transmit_failed(uint8_t nrf_802154_log_function_enter(NRF_802154_LOG_VERBOSITY_LOW); // Notify -#if NRF_802154_USE_RAW_API nrf_802154_co_transmit_failed(p_frame, error, p_metadata); -#else // NRF_802154_USE_RAW_API - nrf_802154_co_transmit_failed(p_frame + RAW_PAYLOAD_OFFSET, error, p_metadata); -#endif // NRF_802154_USE_RAW_API nrf_802154_log_function_exit(NRF_802154_LOG_VERBOSITY_LOW); } diff --git a/nrf_802154/driver/src/nrf_802154_notification_swi.c b/nrf_802154/driver/src/nrf_802154_notification_swi.c index bbe7309049..d829eaf45d 100644 --- a/nrf_802154/driver/src/nrf_802154_notification_swi.c +++ b/nrf_802154/driver/src/nrf_802154_notification_swi.c @@ -711,16 +711,9 @@ static void irq_handler_ntf_event(void) switch (p_slot->type) { case NTF_TYPE_RECEIVED: -#if NRF_802154_USE_RAW_API nrf_802154_co_received_raw(p_slot->data.received.p_data, p_slot->data.received.power, p_slot->data.received.lqi); -#else // NRF_802154_USE_RAW_API - nrf_802154_co_received(p_slot->data.received.p_data + RAW_PAYLOAD_OFFSET, - p_slot->data.received.p_data[RAW_LENGTH_OFFSET], - p_slot->data.received.power, - p_slot->data.received.lqi); -#endif break; case NTF_TYPE_RECEIVE_FAILED: @@ -729,34 +722,14 @@ static void irq_handler_ntf_event(void) break; case NTF_TYPE_TRANSMITTED: - { -#if NRF_802154_USE_RAW_API nrf_802154_co_transmitted_raw(p_slot->data.transmitted.p_frame, &p_slot->data.transmitted.metadata); -#else // NRF_802154_USE_RAW_API - if (p_slot->data.transmitted.metadata.data.transmitted.p_ack != NULL) - { - p_slot->data.transmitted.metadata.data.transmitted.length = - p_slot->data.transmitted.metadata.data.transmitted.p_ack[RAW_LENGTH_OFFSET]; - p_slot->data.transmitted.metadata.data.transmitted.p_ack += RAW_PAYLOAD_OFFSET; - } - nrf_802154_co_transmitted(p_slot->data.transmitted.p_frame + RAW_PAYLOAD_OFFSET, - &p_slot->data.transmitted.metadata); -#endif - } - break; + break; case NTF_TYPE_TRANSMIT_FAILED: -#if NRF_802154_USE_RAW_API nrf_802154_co_transmit_failed(p_slot->data.transmit_failed.p_frame, p_slot->data.transmit_failed.error, &p_slot->data.transmit_failed.metadata); -#else // NRF_802154_USE_RAW_API - nrf_802154_co_transmit_failed( - p_slot->data.transmit_failed.p_frame + RAW_PAYLOAD_OFFSET, - p_slot->data.transmit_failed.error, - &p_slot->data.transmit_failed.metadata); -#endif break; case NTF_TYPE_ENERGY_DETECTED: diff --git a/nrf_802154/driver/src/nrf_802154_trx.c b/nrf_802154/driver/src/nrf_802154_trx.c index 3e3113286d..d8a6a35bb9 100644 --- a/nrf_802154/driver/src/nrf_802154_trx.c +++ b/nrf_802154/driver/src/nrf_802154_trx.c @@ -181,6 +181,7 @@ extern uint32_t SystemCoreClock; static volatile bool g_nrf_802154_trx_disable_repeat_was_needed; /// Increments whenever repeating disable operation forcefully happens. static uint16_t g_nrf_802154_trx_disable_repeat_counter; + #endif /// Common parameters for the FEM handling. @@ -862,23 +863,14 @@ void nrf_802154_trx_init(void) static void radio_trims_apply(void) { #if defined(NRF54H20_XXAA) && !defined(TEST) - /* HMPAN-76 */ + /* HMPAN-103 */ if ((*(volatile uint32_t *)0x5302C8A0 == 0x80000000) || (*(volatile uint32_t *)0x5302C8A0 == 0x0058120E)) { *(volatile uint32_t *)0x5302C8A0 = 0x0058090E; } - *(volatile uint32_t *)0x5302C8A4 = 0x008C0035; - *(volatile uint32_t *)0x5302C8A8 = 0x00800005; - - *(volatile uint32_t *)0x5302C8B4 = 0x01280000; - *(volatile uint32_t *)0x5302C8B8 = 0x00F8AA5F; - *(volatile uint32_t *)0x5302C8BC = 0x007C0015; - *(volatile uint32_t *)0x5302C8C4 = 0x02100002; - *(volatile uint32_t *)0x5302C8C8 = 0x00280640; - *(volatile uint32_t *)0x5302C8CC = 0x003005C0; - + *(volatile uint32_t *)0x5302C8A4 = 0x00F8AA5F; *(volatile uint32_t *)0x5302C7AC = 0x8672827A; *(volatile uint32_t *)0x5302C7B0 = 0x7E768672; *(volatile uint32_t *)0x5302C7B4 = 0x0406007E;