nrf_802154: rev d062f8597079db0d964762fc7666a367ff2fca4c

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 2023-10-02 09:22:25 +02:00 committed by Andrzej Kuroś
parent d054a315eb
commit 275548e2dc
18 changed files with 165 additions and 391 deletions

View File

@ -1265,35 +1265,6 @@ void nrf_802154_ack_timeout_set(uint32_t time);
#if !NRF_802154_SERIALIZATION_HOST || defined(DOXYGEN)
/**
* @brief Enables wifi coex signaling.
*
* When @ref nrf_802154_init is called, the wifi coex signaling is initially enabled or disabled
* depending on @ref NRF_802154_COEX_INITIALLY_ENABLED. You can call this function
* (after @ref nrf_802154_init) to enable the wifi coex signaling. When wifi coex signaling
* has been already enabled, this function has no effect.
*
* When this function is called during receive or transmit operation, the effect on coex interface
* may be delayed until current frame (or ack) is received or transmitted.
* To avoid this issue please call this function when the driver is in sleep mode.
*
* @retval true Wifi coex is supported and is enabled after call to this function.
* @retval false Wifi coex is not supported.
*/
bool nrf_802154_wifi_coex_enable(void);
/**
* @brief Disables wifi coex signaling.
*
* You can call this function (after @ref nrf_802154_init) to disable the wifi coex signaling.
* When wifi coex signaling has been already disabled, this function has no effect.
*
* When this function is called during receive or transmit operation, the effect on coex interface
* may be delayed until current frame (or ack) is received or transmitted.
* To avoid this issue please call this function when the driver is in sleep mode.
*/
void nrf_802154_wifi_coex_disable(void);
/**
* @brief Checks if wifi coex signaling is enabled.
*

View File

@ -134,6 +134,18 @@ uint64_t nrf_802154_timestamp_end_to_phr_convert(uint64_t end_timestamp, uint8_t
*/
uint64_t nrf_802154_timestamp_phr_to_shr_convert(uint64_t phr_timestamp);
/**
* @brief Converts the timestamp of the frame's PHR to the timestamp of the start of its MHR.
*
* This function converts the time when the first symbol of the frame's PHR is at the local antenna
* to the timestamp of the start of the frame's MHR.
*
* @param[in] phr_timestamp Timestamp of the frame's PHR.
*
* @return Timestamp of the start of the MHR of a given frame, in microseconds.
*/
uint64_t nrf_802154_timestamp_phr_to_mhr_convert(uint64_t phr_timestamp);
/**
* @}
*/

View File

@ -407,11 +407,12 @@ extern "C" {
* @def NRF_802154_IFS_ENABLED
*
* Indicates whether the Short/Long Interframe spacing feature is to be enabled in the driver.
* This is an experimental feature.
*
*/
#if !defined(CONFIG_NRF_802154_SL_OPENSOURCE)
#ifndef NRF_802154_IFS_ENABLED
#define NRF_802154_IFS_ENABLED 1
#define NRF_802154_IFS_ENABLED 0
#endif
#endif
@ -421,21 +422,6 @@ extern "C" {
* @{
*/
/**
* @}
* @defgroup nrf_802154_config_coex WiFi coexistence feature configuration
* @{
*/
/**
* @def NRF_802154_COEX_INITIALLY_ENABLED
*
* Configures if WiFi coex is initially enabled or disabled.
*/
#ifndef NRF_802154_COEX_INITIALLY_ENABLED
#define NRF_802154_COEX_INITIALLY_ENABLED 1
#endif
/**
* @}
* @defgroup nrf_802154_config_stats Statistics configuration

View File

@ -81,3 +81,8 @@ uint64_t nrf_802154_timestamp_phr_to_shr_convert(uint64_t phr_timestamp)
{
return phr_timestamp - (PHY_SHR_SYMBOLS * PHY_US_PER_SYMBOL);
}
uint64_t nrf_802154_timestamp_phr_to_mhr_convert(uint64_t phr_timestamp)
{
return phr_timestamp + (PHR_SIZE * PHY_SYMBOLS_PER_OCTET * PHY_US_PER_SYMBOL);
}

View File

@ -642,6 +642,16 @@ uint8_t * nrf_802154_enh_ack_generator_create(
switch (ack_state_get())
{
case ACK_STATE_RESET:
#if NRF_802154_IE_WRITER_ENABLED
// The IE writer module can be in the IE_WRITER_PREPARE state if
// the previous transmission failed at an early stage.
// Reset it, to avoid data corruption in case this ACK
// does not contain information elements. Otherwise, the
// IE writer would commit data in nrf_802154_ie_writer_tx_ack_started_hook
// regardless if writing of IE elements is needed or not.
nrf_802154_ie_writer_reset();
#endif
ack_state_set(ACK_STATE_PROCESSING);
// Fallthrough

View File

@ -45,6 +45,9 @@
#include "nrf_802154_ack_data.h"
#include "nrf_802154_const.h"
#if NRF_802154_IE_WRITER_ENABLED
#include "mac_features/nrf_802154_ie_writer.h"
#endif
#define IMM_ACK_INITIALIZER {IMM_ACK_LENGTH, ACK_HEADER_WITH_PENDING, 0x00, 0x00, 0x00, 0x00}
@ -65,6 +68,15 @@ void nrf_802154_imm_ack_generator_reset(void)
uint8_t * nrf_802154_imm_ack_generator_create(
const nrf_802154_frame_parser_data_t * p_frame_data)
{
#if NRF_802154_IE_WRITER_ENABLED
// The IE writer module can be in the IE_WRITER_PREPARE state if
// the previous transmission failed at an early stage.
// Reset it, to avoid data corruption in when this ACK is transmitted.
// Otherwise, the IE writer would commit data in nrf_802154_ie_writer_tx_ack_started_hook
// regardless if writing of IE elements is needed or not.
nrf_802154_ie_writer_reset();
#endif
if (nrf_802154_frame_parser_parse_level_get(p_frame_data) < PARSE_LEVEL_FULL)
{
// The entire frame being acknowledged is necessary to correctly generate Ack

View File

@ -409,17 +409,6 @@ static void link_metrics_ie_write_reset(void)
mp_lm_lqi_addr = NULL;
}
/**
* @brief Resets IE writer to pristine state.
*/
static void ie_writer_reset(void)
{
m_writer_state = IE_WRITER_RESET;
csl_ie_write_reset();
link_metrics_ie_write_reset();
}
/**
* @brief Performs IE write preparations.
*
@ -468,7 +457,7 @@ static void ie_writer_prepare(uint8_t * p_ie_header, const uint8_t * p_end_addr)
if (result == false)
{
ie_writer_reset();
nrf_802154_ie_writer_reset();
return;
}
@ -491,12 +480,19 @@ static void ie_writer_commit(bool * p_written)
link_metrics_ie_write_commit(p_written);
}
void nrf_802154_ie_writer_reset(void)
{
m_writer_state = IE_WRITER_RESET;
csl_ie_write_reset();
link_metrics_ie_write_reset();
}
void nrf_802154_ie_writer_prepare(uint8_t * p_ie_header, const uint8_t * p_end_addr)
{
assert(p_ie_header != NULL);
assert(p_ie_header < p_end_addr);
ie_writer_reset();
ie_writer_prepare(p_ie_header, p_end_addr);
}
@ -505,7 +501,13 @@ bool nrf_802154_ie_writer_tx_setup(
nrf_802154_transmit_params_t * p_params,
nrf_802154_transmit_failed_notification_t notify_function)
{
(void)notify_function;
// The IE writer module can be in the IE_WRITER_PREPARE state if
// the previous transmission failed at an early stage.
// Reset it, to avoid data corruption in case this frame
// does not contain information elements. Otherwise, the
// IE writer would commit data in nrf_802154_ie_writer_tx_started_hook
// regardless if writing of IE elements is needed or not.
nrf_802154_ie_writer_reset();
if (p_params->frame_props.dynamic_data_is_set)
{
@ -559,7 +561,7 @@ bool nrf_802154_ie_writer_tx_started_hook(uint8_t * p_frame)
#endif
ie_writer_commit(&written);
ie_writer_reset();
nrf_802154_ie_writer_reset();
if (written)
{
@ -589,7 +591,7 @@ void nrf_802154_ie_writer_tx_ack_started_hook(uint8_t * p_ack)
#endif
ie_writer_commit(&written);
ie_writer_reset();
nrf_802154_ie_writer_reset();
if (written)
{

View File

@ -47,6 +47,12 @@
* @brief Information element writer module.
*/
/**
* @brief Resets the IE writer module to pristine state.
*/
void nrf_802154_ie_writer_reset(void);
/**
* @brief Prepares to write Information Element data to all elements recognized by the module.
*

View File

@ -2614,6 +2614,12 @@ bool nrf_802154_core_transmit(nrf_802154_term_t term_lvl,
{
nrf_802154_tx_work_buffer_reset(&p_params->frame_props);
result = nrf_802154_core_hooks_tx_setup(p_data, p_params, &transmit_failed_notify);
if (!result)
{
state_set(RADIO_STATE_RX);
rx_init(TRX_RAMP_UP_SW_TRIGGER, NULL);
}
}
if (result)

View File

@ -58,6 +58,7 @@
#include "nrf_802154_procedures_duration.h"
#include "nrf_802154_critical_section.h"
#include "mpsl_fem_config_common.h"
#include "mpsl_tx_power.h"
#include "platform/nrf_802154_irq.h"
#include "protocol/mpsl_fem_protocol_api.h"
@ -137,7 +138,9 @@
#define TXRU_TIME 40 ///< Transmitter ramp up time [us]
#define EVENT_LAT 23 ///< END event latency [us]
#ifndef MAX_RXRAMPDOWN_CYCLES
#define MAX_RXRAMPDOWN_CYCLES 32 ///< Maximum number of cycles that RX ramp-down might take
#endif
#define RSSI_SETTLE_TIME_US 15 ///< Time required for RSSI measurements to become valid after signal level change.
@ -256,20 +259,21 @@ static void rx_flags_clear(void)
static void * volatile mp_receive_buffer;
static void txpower_set(nrf_radio_txpower_t txpower)
static void txpower_set(int8_t txpower)
{
#ifdef NRF53_SERIES
bool radio_high_voltage_enable = false;
if ((int8_t)txpower > 0)
if (txpower > 0)
{
/* To get higher than 0dBm raise operating voltage of the radio, giving 3dBm power boost */
radio_high_voltage_enable = true;
txpower -= 3;
}
nrf_vreqctrl_radio_high_voltage_set(NRF_VREQCTRL_NS, radio_high_voltage_enable);
#endif
nrf_radio_txpower_set(NRF_RADIO, txpower);
uint32_t reg = mpsl_tx_power_dbm_to_radio_register_convert(txpower);
nrf_radio_txpower_set(NRF_RADIO, reg);
}
/** Initialize TIMER peripheral used by the driver. */

View File

@ -63,7 +63,6 @@
#include "nrf_802154.h"
#include "nrf_802154_config.h"
#include "nrf_802154_types.h"
#include "nrf_802154_nrfx_addons.h"
/**
* @brief Wait with timeout for SPINEL_STATUS_OK to be received.

View File

@ -1,172 +0,0 @@
/*
* Copyright (c) 2020 - 2023, Nordic Semiconductor ASA
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef NRF_802154_SL_COEX_H__
#define NRF_802154_SL_COEX_H__
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup nrf_802154_sl_coex Wifi Coexistence Service
* @{
* @ingroup nrf_802154_sl_coex
* @brief The Wifi Coexistence Service for the 802.15.4 Service Layer
*/
/** @brief Coex return codes.
*
* Possible values:
* @ref NRF_802154_WIFI_COEX_RET_SUCCESS
* @ref NRF_802154_WIFI_COEX_RET_INVALID_PIN
* @ref NRF_802154_WIFI_COEX_RET_DEFAULT_ERR
*/
typedef uint32_t nrf_802154_wifi_coex_ret_t;
#define NRF_802154_WIFI_COEX_RET_SUCCESS 0x00 /** Operation finished succesfully. */
#define NRF_802154_WIFI_COEX_RET_INVALID_PIN 0x01 /** Operation failed because coex pins have not been initialized. */
#define NRF_802154_WIFI_COEX_RET_DEFAULT_ERR 0xFF /** Default error code. */
/** @brief Coex interface types.
*
* Possible values:
* @ref NRF_802154_WIFI_COEX_IF_NONE
* @ref NRF_802154_WIFI_COEX_IF_3WIRE
*/
typedef uint32_t nrf_802154_wifi_coex_interface_type_id_t;
#define NRF_802154_WIFI_COEX_IF_NONE 0x00 /** No coex interface is selected */
#define NRF_802154_WIFI_COEX_IF_3WIRE 0x01 /** 3-wire coex interface is selected */
/**@brief Pin configuration for wifi coex */
typedef struct
{
uint8_t gpio_pin; /**< The GPIO pin number. */
uint8_t active_high; /**< Active pin level: 1 - high level, 0 - low level. */
uint8_t drive; /**< Pin drive configuration. */
uint8_t pull; /**< Pull-up/down configuration. */
} nrf_802154_wifi_coex_pin_out_config_t;
typedef struct
{
uint8_t gpio_pin; /**< The GPIO pin number. */
uint8_t active_high; /**< Active pin level: 1 - high level, 0 - low level. */
uint8_t gpiote_ch_id; /**< GPIOTE channel number. */
} nrf_802154_wifi_coex_pin_in_config_t;
/**@brief 3-wire interface configuration for wifi coex */
typedef struct
{
nrf_802154_wifi_coex_pin_out_config_t request_cfg; /**< Request line configuration. */
nrf_802154_wifi_coex_pin_out_config_t priority_cfg; /**< Priority and Status (sometiems also called CONFIG or REQUEST_TYPE) line configuration. */
nrf_802154_wifi_coex_pin_in_config_t grant_cfg; /**< Grant line configuration. */
} nrf_802154_wifi_coex_3wire_if_config_t;
#define COEX_GPIO_PIN_INVALID 0xFF /**< Value indicating that the pin has not yet been configured. */
/** Macro with the default configuration of 3-wire coex interface */
#define NRF_802154_COEX_3WIRE_DEFAULT_CONFIG \
((nrf_802154_wifi_coex_3wire_if_config_t) { \
.request_cfg = { \
.gpio_pin = COEX_GPIO_PIN_INVALID, \
.active_high = true, \
.drive = GPIO_PIN_CNF_DRIVE_S0S1, \
.pull = GPIO_PIN_CNF_PULL_Disabled \
}, \
.priority_cfg = { \
.gpio_pin = COEX_GPIO_PIN_INVALID, \
.active_high = false, \
.drive = GPIO_PIN_CNF_DRIVE_S0S1, \
.pull = GPIO_PIN_CNF_PULL_Disabled \
}, \
.grant_cfg = { \
.gpio_pin = COEX_GPIO_PIN_INVALID, \
.active_high = false, \
.gpiote_ch_id = 4 \
} \
})
/**
* @brief Gets current coex interface type.
*
* @return Current coex interface type.
*/
nrf_802154_wifi_coex_interface_type_id_t nrf_802154_wifi_coex_interface_type_id_get(void);
/**
* @brief Gets current wifi coex 3wire configuration.
*
* @param[out] p_cfg Pointer to the configuration structure where current configuration will be stored.
*/
void nrf_802154_wifi_coex_cfg_3wire_get(nrf_802154_wifi_coex_3wire_if_config_t * p_cfg);
/**
* @brief Sets wifi coex 3wire configuration.
*
* For the configuration to be applied, @ref nrf_802154_wifi_coex_init must be called.
* Should be called once, before @ref nrf_802154_wifi_coex_init.
*
* @param[in] p_cfg Pointer to the configuration structure with coex configuration to be set.
* Structure will be copied and can be freed by the caller afterwards.
*
* @sa nrf_802154_wifi_coex_cfg_3wire_get
*/
void nrf_802154_wifi_coex_cfg_3wire_set(const nrf_802154_wifi_coex_3wire_if_config_t * p_cfg);
/**
* @brief Initializes the Wi-Fi Coexistence module.
*
* For this function to be called, driver needs to be already initialized through @ref nrf_802154_init, and interface type with valid pins
* must be configured.
*
* @retval ::NRF_802154_WIFI_COEX_RET_SUCCESS Coexistence interface was configured successfully
* @retval ::NRF_802154_WIFI_COEX_RET_INVALID_PIN Not all gpio pin numbers have been set and coexistence interface could not be configured.
*/
nrf_802154_wifi_coex_ret_t nrf_802154_wifi_coex_init(void);
/**
*@}
**/
#ifdef __cplusplus
}
#endif
#endif // NRF_802154_SL_COEX_H__

View File

@ -46,15 +46,6 @@
#include "nrf_802154_sl_config_internal.h"
#endif
/**
* @def NRF_802154_SL_COEX_INITIALLY_ENABLED
*
* Configures if WiFi Coex is initially enabled or disabled.
*/
#ifndef NRF_802154_SL_COEX_INITIALLY_ENABLED
#define NRF_802154_SL_COEX_INITIALLY_ENABLED 0
#endif
/**
* @def NRF_802154_SL_RTC_IRQ_PRIORITY
*

View File

@ -1,98 +0,0 @@
/*
* Copyright (c) 2020 - 2023, Nordic Semiconductor ASA
* All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
/**
* @brief Module that defines API of GPIOTE for the 802.15.4 driver.
*
*/
#ifndef NRF_802154_GPIOTE_H_
#define NRF_802154_GPIOTE_H_
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup nrf_802154_gpiote GPIOTE for the 802.15.4 driver
* @{
* @ingroup nrf_802154_gpiote
* @brief GPIOTE for the 802.15.4 driver.
*
* The GPIOTE is used to react on the Coex Grant line.
*
*/
/**
* @brief Initializes the GPIOTE.
*/
void nrf_802154_gpiote_init(void);
/**
* @brief Deinitializes the GPIOTE.
*/
void nrf_802154_gpiote_deinit(void);
/**
* @brief Function to be called when handling the pin triggering.
*/
extern void nrf_802154_wifi_coex_gpiote_irqhandler(void);
/**
* @brief Enter the critical section of GPIOTE subsystem.
*
* @note The critical section can be nested.
*
*/
void nrf_802154_gpiote_critical_section_enter(void);
/**
* @brief Exit the critical section of GPIOTE subsystem.
*
* @note The critical section can be nested.
*
*/
void nrf_802154_gpiote_critical_section_exit(void);
/**
*@}
**/
#ifdef __cplusplus
}
#endif
#endif /* NRF_802154_GPIOTE_H_ */

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/**
* @file mpsl_tx_power.h
*
* @defgroup mpsl_tx_power MPSL TX Power interface
* @ingroup mpsl
*
* The MPSL TX Power interface provides APIs to set the maximum TX power per channel.
*
* @{
*/
#ifndef MPSL_TX_POWER_H__
#define MPSL_TX_POWER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
/** TX power, dBm. */
typedef int8_t mpsl_tx_power_t;
/** @brief Converts radio power in dBm to RADIO.TXPOWER register code.
*
* @param[in] req_radio_power Requested TX power desired for RADIO peripheral.
* The power value in dBm must be supported by the RADIO peripheral.
*
* @return RADIO.TXPOWER register code corrensponding to a radio power in dBm.
*/
uint32_t mpsl_tx_power_dbm_to_radio_register_convert(mpsl_tx_power_t req_radio_power);
#ifdef __cplusplus
}
#endif
#endif // MPSL_TX_POWER_H__
/**@} */

View File

@ -32,36 +32,12 @@
*
*/
#include "nrf_802154_sl_coex.h"
#include "nrf_802154.h"
#ifdef __cplusplus
extern "C" {
#endif
nrf_802154_wifi_coex_interface_type_id_t nrf_802154_wifi_coex_interface_type_id_get(void)
{
return NRF_802154_WIFI_COEX_IF_NONE;
}
void nrf_802154_wifi_coex_cfg_3wire_get(nrf_802154_wifi_coex_3wire_if_config_t * p_cfg)
{
(void)p_cfg;
return;
}
void nrf_802154_wifi_coex_cfg_3wire_set(const nrf_802154_wifi_coex_3wire_if_config_t * p_cfg)
{
(void)p_cfg;
return;
}
nrf_802154_wifi_coex_ret_t nrf_802154_wifi_coex_init(void)
{
return NRF_802154_WIFI_COEX_RET_DEFAULT_ERR;
}
bool nrf_802154_wifi_coex_is_enabled(void)
{
return false;

View File

@ -40,6 +40,7 @@
#include "nrf_802154_fal.h"
#include "nrf_802154_types.h"
#include "mpsl_tx_power.h"
#include "protocol/mpsl_fem_protocol_api.h"
#ifdef __cplusplus
@ -52,6 +53,12 @@ extern "C" {
*/
#define NUMELTS(X) (sizeof((X)) / sizeof(X[0]))
typedef struct
{
nrf_radio_txpower_t reg;
int8_t dbm;
} radio_tx_power_t;
/**
* Converts TX power integer values to RADIO TX power allowed values.
*
@ -59,45 +66,50 @@ extern "C" {
*
* @retval RADIO TX power allowed value.
*/
static nrf_radio_txpower_t to_radio_tx_power_convert(int8_t integer_tx_power)
static radio_tx_power_t to_radio_tx_power_convert(int8_t integer_tx_power)
{
static const nrf_radio_txpower_t allowed_values[] =
static const radio_tx_power_t allowed_values[] =
{
#if defined(RADIO_TXPOWER_TXPOWER_Neg40dBm)
NRF_RADIO_TXPOWER_NEG40DBM, /**< -40 dBm. */
{ NRF_RADIO_TXPOWER_NEG40DBM, -40 }, /**< -40 dBm. */
#endif
{ NRF_RADIO_TXPOWER_NEG20DBM, -20 }, /**< -20 dBm. */
{ NRF_RADIO_TXPOWER_NEG16DBM, -16 }, /**< -16 dBm. */
{ NRF_RADIO_TXPOWER_NEG12DBM, -12 }, /**< -12 dBm. */
{ NRF_RADIO_TXPOWER_NEG8DBM, -8 }, /**< -8 dBm. */
{ NRF_RADIO_TXPOWER_NEG4DBM, -4 }, /**< -4 dBm. */
{ NRF_RADIO_TXPOWER_0DBM, 0 }, /**< 0 dBm. */
#if defined(NRF53_SERIES)
{ NRF_RADIO_TXPOWER_NEG2DBM, 1 }, /**< 1 dBm. */
{ NRF_RADIO_TXPOWER_NEG1DBM, 2 }, /**< 2 dBm. */
{ NRF_RADIO_TXPOWER_0DBM, 3 }, /**< 3 dBm. */
#endif
NRF_RADIO_TXPOWER_NEG20DBM, /**< -20 dBm. */
NRF_RADIO_TXPOWER_NEG16DBM, /**< -16 dBm. */
NRF_RADIO_TXPOWER_NEG12DBM, /**< -12 dBm. */
NRF_RADIO_TXPOWER_NEG8DBM, /**< -8 dBm. */
NRF_RADIO_TXPOWER_NEG4DBM, /**< -4 dBm. */
NRF_RADIO_TXPOWER_0DBM, /**< 0 dBm. */
#if defined(RADIO_TXPOWER_TXPOWER_Pos2dBm)
NRF_RADIO_TXPOWER_POS2DBM, /**< 2 dBm. */
{ NRF_RADIO_TXPOWER_POS2DBM, 2 }, /**< 2 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos3dBm)
NRF_RADIO_TXPOWER_POS3DBM, /**< 3 dBm. */
{ NRF_RADIO_TXPOWER_POS3DBM, 3 }, /**< 3 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos4dBm)
NRF_RADIO_TXPOWER_POS4DBM, /**< 4 dBm. */
{ NRF_RADIO_TXPOWER_POS4DBM, 4 }, /**< 4 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos5dBm)
NRF_RADIO_TXPOWER_POS5DBM, /**< 5 dBm. */
{ NRF_RADIO_TXPOWER_POS5DBM, 5 }, /**< 5 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos6dBm)
NRF_RADIO_TXPOWER_POS6DBM, /**< 6 dBm. */
{ NRF_RADIO_TXPOWER_POS6DBM, 6 }, /**< 6 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos7dBm)
NRF_RADIO_TXPOWER_POS7DBM, /**< 7 dBm. */
{ NRF_RADIO_TXPOWER_POS7DBM, 7 }, /**< 7 dBm. */
#endif
#if defined(RADIO_TXPOWER_TXPOWER_Pos8dBm)
NRF_RADIO_TXPOWER_POS8DBM, /**< 8 dBm. */
{ NRF_RADIO_TXPOWER_POS8DBM, 8 }, /**< 8 dBm. */
#endif
};
for (uint32_t i = NUMELTS(allowed_values) - 1; i > 0; i--)
{
if (integer_tx_power >= (int8_t)allowed_values[i])
if (integer_tx_power >= allowed_values[i].dbm)
{
return allowed_values[i];
}
@ -176,7 +188,7 @@ void mpsl_fem_cleanup(void)
void mpsl_fem_tx_power_split(const mpsl_tx_power_t power,
mpsl_tx_power_split_t * const p_tx_power_split)
{
p_tx_power_split->radio_tx_power = to_radio_tx_power_convert(power);
p_tx_power_split->radio_tx_power = to_radio_tx_power_convert(power).dbm;
p_tx_power_split->fem.gain_db = 0;
p_tx_power_split->fem.private_setting = 0;
}
@ -216,13 +228,18 @@ int8_t nrf_802154_fal_tx_power_split(const uint8_t cha
{
(void)channel;
p_tx_power_split->radio_tx_power = to_radio_tx_power_convert(power);
p_tx_power_split->radio_tx_power = to_radio_tx_power_convert(power).dbm;
p_tx_power_split->fem.gain_db = 0;
p_tx_power_split->fem.private_setting = 0;
return p_tx_power_split->radio_tx_power;
}
uint32_t mpsl_tx_power_dbm_to_radio_register_convert(mpsl_tx_power_t req_radio_power)
{
return to_radio_tx_power_convert(req_radio_power).reg;
}
#ifdef __cplusplus
}
#endif

View File

@ -68,7 +68,7 @@ void nrf_802154_timer_coord_stop(void)
void nrf_802154_sl_timer_module_init(void)
{
BUILD_ASSERT(CONFIG_SYS_CLOCK_TICKS_PER_SEC == NRF_802154_SL_RTC_FREQUENCY);
// Intentionally empty
}
void nrf_802154_sl_timer_module_uninit(void)
@ -78,7 +78,9 @@ void nrf_802154_sl_timer_module_uninit(void)
uint64_t nrf_802154_sl_timer_current_time_get(void)
{
return NRF_802154_SL_RTC_TICKS_TO_US(k_uptime_ticks());
int64_t ticks = k_uptime_ticks();
return k_ticks_to_us_ceil64(ticks);
}
void nrf_802154_sl_timer_init(nrf_802154_sl_timer_t * p_timer)