Imported more library files
Not compiling currently
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
/*******************************************************************************
|
||||
* @file
|
||||
* @brief This file includes the Radio Coex initializers
|
||||
*******************************************************************************
|
||||
* # License
|
||||
* <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* SPDX-License-Identifier: Zlib
|
||||
*
|
||||
* The licensor of this software is Silicon Laboratories Inc.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef RADIO_COEX_H_
|
||||
#define RADIO_COEX_H_
|
||||
|
||||
#include <assert.h>
|
||||
#include <openthread-core-config.h>
|
||||
#include <openthread-system.h>
|
||||
#include <openthread/link.h>
|
||||
#include <openthread/platform/alarm-micro.h>
|
||||
#include <openthread/platform/alarm-milli.h>
|
||||
#include <openthread/platform/diag.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
#include <openthread/platform/time.h>
|
||||
|
||||
#ifdef SL_COMPONENT_CATALOG_PRESENT
|
||||
#include "sl_component_catalog.h"
|
||||
#endif // SL_COMPONENT_CATALOG_PRESENT
|
||||
|
||||
#ifndef SL_CATALOG_OT_SIMULATION_PRESENT
|
||||
|
||||
#ifdef SL_CATALOG_RAIL_UTIL_COEX_PRESENT
|
||||
#include "coexistence-802154.h"
|
||||
#include "coexistence-ot.h"
|
||||
#include "coexistence.h"
|
||||
#endif // SL_CATALOG_RAIL_UTIL_COEX_PRESENT
|
||||
|
||||
#ifdef SL_CATALOG_RAIL_UTIL_ANT_DIV_PRESENT
|
||||
#include "sl_rail_util_ant_div.h"
|
||||
#endif // SL_CATALOG_RAIL_UTIL_ANT_DIV_PRESENT
|
||||
|
||||
#ifdef SL_CATALOG_RAIL_UTIL_IEEE802154_PHY_SELECT_PRESENT
|
||||
#include "sl_rail_util_ieee802154_phy_select.h"
|
||||
#endif // SL_CATALOG_RAIL_UTIL_IEEE802154_PHY_SELECT
|
||||
|
||||
#else // SL_CATALOG_OT_SIMULATION_PRESENT
|
||||
|
||||
#include "rail_util_simulation.h"
|
||||
|
||||
#endif // SL_CATALOG_OT_SIMULATION_PRESENT
|
||||
|
||||
#include "common/code_utils.hpp"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SL_OT_COEX_EVENT_REQUEST_COUNT = 0,
|
||||
SL_OT_COEX_EVENT_GRANT_IMMEDIATE_COUNT,
|
||||
SL_OT_COEX_EVENT_GRANT_WAIT_COUNT,
|
||||
SL_OT_COEX_EVENT_GRANT_WAIT_ACTIVATED_COUNT,
|
||||
SL_OT_COEX_EVENT_GRANT_WAIT_TIMEOUT_COUNT,
|
||||
SL_OT_COEX_EVENT_GRANT_DEACTIVATED_DURING_REQUEST_COUNT,
|
||||
SL_OT_COEX_EVENT_DELAYED_GRANT_COUNT,
|
||||
SL_OT_COEX_EVENT_AVG_REQUEST_TO_GRANT_TIME
|
||||
} sl_coex_events;
|
||||
|
||||
typedef struct sl_ot_coex_counter
|
||||
{
|
||||
otRadioCoexMetrics metrics;
|
||||
uint64_t timestamp;
|
||||
uint64_t totalTxReqToGrantDuration;
|
||||
uint64_t totalRxReqToGrantDuration;
|
||||
} sl_ot_coex_counter_t;
|
||||
|
||||
/**
|
||||
* Reset the radio coex counters.
|
||||
*/
|
||||
void sli_radio_coex_reset(void);
|
||||
|
||||
#endif // RADIO_COEX_H_
|
||||
@@ -0,0 +1,78 @@
|
||||
/*******************************************************************************
|
||||
* @file
|
||||
* @brief This file defines the radio counters updated by the efr32 PAL
|
||||
*******************************************************************************
|
||||
* # License
|
||||
* <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* SPDX-License-Identifier: Zlib
|
||||
*
|
||||
* The licensor of this software is Silicon Laboratories Inc.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef RADIO_COUNTERS_H_
|
||||
#define RADIO_COUNTERS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef struct efr32RadioCounters
|
||||
{
|
||||
uint32_t mRailPlatTxTriggered;
|
||||
uint32_t mRailPlatRadioReceiveDoneCbCount;
|
||||
uint32_t mRailPlatRadioReceiveProcessedCount;
|
||||
uint32_t mRailPlatRadioEnergyScanDoneCbCount;
|
||||
uint32_t mRailPlatRadioTxDoneCbCount;
|
||||
uint32_t mRailTxStarted;
|
||||
uint32_t mRailTxStartFailed;
|
||||
uint32_t mRailEventAcksReceived;
|
||||
uint32_t mRailEventConfigScheduled;
|
||||
uint32_t mRailEventConfigUnScheduled;
|
||||
uint32_t mRailEventPacketSent;
|
||||
uint32_t mRailEventChannelBusy;
|
||||
uint32_t mRailEventEnergyScanCompleted;
|
||||
uint32_t mRailEventCalNeeded;
|
||||
uint32_t mRailEventPacketReceived;
|
||||
uint32_t mRailEventNoAck;
|
||||
uint32_t mRailEventTxAbort;
|
||||
uint32_t mRailEventSchedulerStatusError;
|
||||
uint32_t mRailEventsSchedulerStatusTransmitBusy;
|
||||
uint32_t mRailEventsSchedulerStatusLastStatus;
|
||||
uint32_t mRailEventsEnhAckTxFailed;
|
||||
uint32_t mRailEventsScheduledTxTriggeredCount;
|
||||
uint32_t mRailEventsScheduledTxStartedCount;
|
||||
union
|
||||
{
|
||||
// Allow for reuse / overloading of fields for various debugging
|
||||
uint32_t m32;
|
||||
uint16_t m16[2];
|
||||
uint8_t m8[4]; // see defines below for suggested subfield usage
|
||||
} mRadioDebugData;
|
||||
} efr32RadioCounters;
|
||||
|
||||
// Offsets for use with Radio Debug Data subfields
|
||||
enum
|
||||
{
|
||||
RX_DEBUG_COUNTER0 = 0,
|
||||
RX_DEBUG_COUNTER1,
|
||||
TX_DEBUG_COUNTER0,
|
||||
TX_DEBUG_COUNTER1
|
||||
};
|
||||
#endif // RADIO_COUNTERS_H_
|
||||
@@ -0,0 +1,691 @@
|
||||
/*******************************************************************************
|
||||
* @file
|
||||
* @brief Defines the Silicon Labs extension to the openthread platform radio interface.
|
||||
*******************************************************************************
|
||||
* # License
|
||||
* <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b>
|
||||
*******************************************************************************
|
||||
*
|
||||
* SPDX-License-Identifier: Zlib
|
||||
*
|
||||
* The licensor of this software is Silicon Laboratories Inc.
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
* 3. This notice may not be removed or altered from any source distribution.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _RADIO_EXTENSION_H
|
||||
#define _RADIO_EXTENSION_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <openthread/error.h>
|
||||
|
||||
#include "radio_counters.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @addtogroup plat-radio
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup radio-extension Radio Extension
|
||||
*
|
||||
* @brief
|
||||
* This module includes the Silicon Labs extension to the openthread
|
||||
* platform radio interface.
|
||||
*
|
||||
* The functions in this modules provide an API that can be called from
|
||||
* SoC or host based openthread applications.
|
||||
*
|
||||
* @note Many of the functions defined in this module are wrappers on
|
||||
* top of the Silicon Labs RAIL API. For additional information on the
|
||||
* RAIl API please refer to the `Silicon Labs RAIL API Reference Guide`.
|
||||
* Those functions that are wrappers to RAIL functions include a
|
||||
* reference to the underlying RAIL function.
|
||||
*
|
||||
* @{
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the antenna diversity transmit antenna mode.
|
||||
*
|
||||
* Requires the `ot_ant_div` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ant_div_get_tx_antenna_mode()**
|
||||
*
|
||||
* @param[out] aMode A pointer to the location where the current transmit
|
||||
* antenna mode will be returned. Antenna modes are
|
||||
* defined by the RAIL `sl_rail_util_antenna_mode_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the transmit antenna mode.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aMode parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Antenna diversity is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetTxAntennaMode(uint8_t *aMode);
|
||||
|
||||
/**
|
||||
* Set the antenna diversity transmit antenna mode.
|
||||
*
|
||||
* Requires the `ot_ant_div` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ant_div_set_tx_antenna_mode()**
|
||||
*
|
||||
* @param[in] aMode The antenna mode to use for transmit. Antenna modes are
|
||||
* defined by the RAIL `sl_rail_util_antenna_mode_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the transmit antenna mode.
|
||||
* @retval OT_ERROR_FAILED The specified transmit antenna mode is not supported.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Antenna diversity is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetTxAntennaMode(uint8_t aMode);
|
||||
|
||||
/**
|
||||
* Get the antenna diversity receive antenna mode.
|
||||
*
|
||||
* Requires the `ot_ant_div` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ant_div_get_rx_antenna_mode()**
|
||||
*
|
||||
* @param[out] aMode A pointer to the location where the current receive
|
||||
* antenna mode will be returned. Antenna modes are
|
||||
* defined by the RAIL `sl_rail_util_antenna_mode_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the receive antenna mode.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aMode parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Antenna diversity is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetRxAntennaMode(uint8_t *aMode);
|
||||
|
||||
/**
|
||||
* Set the antenna diversity receive antenna mode.
|
||||
*
|
||||
* Requires the `ot_ant_div` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ant_div_set_rx_antenna_mode()**
|
||||
*
|
||||
* @param[in] aMode The antenna mode to use for receive. Antenna modes are
|
||||
* defined by the RAIL `sl_rail_util_antenna_mode_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the receive antenna mode.
|
||||
* @retval OT_ERROR_FAILED The specified receive antenna mode is not supported.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Antenna diversity is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetRxAntennaMode(uint8_t aMode);
|
||||
|
||||
/**
|
||||
* Get the antenna diversity active phy state.
|
||||
*
|
||||
* Requires the `ot_ant_div` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ieee802154_get_active_radio_config()**
|
||||
*
|
||||
* @param[out] aActivePhy A pointer to the location where the current phy
|
||||
* state will be returned. Phy states are defined by
|
||||
* the RAIL `sl_rail_util_ieee802154_radio_config_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the phy state.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aActivePhy parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Antenna diversity is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetActivePhy(uint8_t *aActivePhy);
|
||||
|
||||
/**
|
||||
* Get the coexistence directional priority state and pulse width.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_directional_priority_pulse_width()**
|
||||
*
|
||||
* @param[out] aDpPulse A pointer to the location where the current directional
|
||||
* priority state will be returned. If @p aDpPulse is 0
|
||||
* then directional priority is disabled. If @p aDpPulse is
|
||||
* not 0 then directional priority is enabled and the value
|
||||
* is the pulse width in microseconds.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the directional priority.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aDpPulse parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetDpState(uint8_t *aDpPulse);
|
||||
|
||||
/**
|
||||
* Set the coexistence directional priority state and pulse width.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_directional_priority_pulse_width()**
|
||||
*
|
||||
* @param[in] aDpPulse The directional priority state to set. If @p aDpPulse is 0
|
||||
* then directional priority will be disabled. If @p aDpPulse is
|
||||
* not 0 then directional priority will be enabled and the value
|
||||
* will be the pulse width to use in microseconds.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the directional priority.
|
||||
* @retval OT_ERROR_FAILED The @p aDpPulse is invalid.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetDpState(uint8_t aDpPulse);
|
||||
|
||||
/**
|
||||
* Get the override input value of a GPIO.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_gpio_input_override()**
|
||||
*
|
||||
* @param[in] aGpioIndex The GPIO index
|
||||
* - 0x00 = Radio Holdoff GPIO index
|
||||
* - 0x01 = Request GPIO index
|
||||
* - 0x02 = Grant GPIO index
|
||||
* - 0x03 = PHY Select index
|
||||
* @param[out] aEnabled A pointer to the location where the boolean override input
|
||||
* value will be returned. A TRUE value indicating the
|
||||
* override input value is enabled, FALSE disabled. The return
|
||||
* is inverted if the selected GPIO is active low.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the override input value.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aGpioIndex parameter is invalid and/or @p aDpPulse parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetGpioInputOverride(uint8_t aGpioIndex, bool *aEnabled);
|
||||
|
||||
/**
|
||||
* Set the override input value of a GPIO.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_gpio_input_override()**
|
||||
*
|
||||
* @param[in] aGpioIndex The GPIO index
|
||||
* - 0x00 = Radio Holdoff GPIO index
|
||||
* - 0x01 = Request GPIO index
|
||||
* - 0x02 = Grant GPIO index
|
||||
* - 0x03 = PHY Select index
|
||||
* @param[in] aEnabled The boolean override input value. A TRUE value indicating the
|
||||
* override input value is enabled, FALSE disabled.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the override input value.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aGpioIndex parameter is invalid.
|
||||
* @retval OT_ERROR_FAILED The override input value of the specified GPIO can not be set.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetGpioInputOverride(uint8_t aGpioIndex, bool aEnabled);
|
||||
|
||||
/**
|
||||
* Get the coexistence active phy state.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_ieee802154_get_active_radio_config()**
|
||||
*
|
||||
* @param[out] aActivePhy A pointer to the location where the current phy
|
||||
* state will be returned. Phy states are defined by
|
||||
* the RAIL `sl_rail_util_ieee802154_radio_config_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the phy state.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aActivePhy parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetActiveRadio(uint8_t *aActivePhy);
|
||||
|
||||
/**
|
||||
* Get the coexistence phy select state and timeout.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_phy_select_timeout()**
|
||||
*
|
||||
* @param[out] aTimeout A pointer to the location where the current phy
|
||||
* select state will be returned. If @p aTimeout is 0
|
||||
* then phy select is disabled. If @p aTimeout is
|
||||
* not 0 then phy select is enabled and the value
|
||||
* is the timeout in milliseconds.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the phy select state.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aTimeout parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetPhySelectTimeout(uint8_t *aTimeout);
|
||||
|
||||
/**
|
||||
* Set the coexistence phy select state and timeout.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_phy_select_timeout()**
|
||||
*
|
||||
* @param[in] aTimeout The phy select state to set. If @p aTimeout is 0
|
||||
* then phy select will be disabled. If @p aTimeout is
|
||||
* not 0 then phy select will be enabled and the value
|
||||
* will be the timeout to use in milliseconds.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the directional priority.
|
||||
* @retval OT_ERROR_FAILED The @p aTimeout is invalid.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetPhySelectTimeout(uint8_t aTimeout);
|
||||
|
||||
/**
|
||||
* Get the coexistence bitmask of features.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_options()**
|
||||
*
|
||||
* @param[out] aPtaOptions A pointer to the location where the coexistence
|
||||
* feature bitmask will be returned. The feature
|
||||
* bitmask is defined by the set of macros making up
|
||||
* the RAIL `sl_rail_util_coex_options_t` type.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the bitmask of features.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aPtaOptions parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetCoexOptions(uint32_t *aPtaOptions);
|
||||
|
||||
/**
|
||||
* Set the coexistence bitmask of features.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_options()**
|
||||
*
|
||||
* @param[in] aPtaOptions The coexistence feature bitmask to set. The feature
|
||||
* bitmask is defined by the set of macros making up
|
||||
* the RAIL `sl_rail_util_coex_options_t` type.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the bitmask of features.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aPtaOptions is invalid.
|
||||
* @retval OT_ERROR_FAILED The bitmask of features can not be set.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetCoexOptions(uint32_t aPtaOptions);
|
||||
|
||||
/**
|
||||
* Get the coexistence bitmask of constant PTA features that can not be modified using public APIs.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_constant_options()**
|
||||
*
|
||||
* @param[out] aPtaOptions A pointer to the location where the coexistence
|
||||
* constant PTA feature bitmask will be returned. The feature
|
||||
* bitmask is defined by the set of macros making up
|
||||
* the RAIL `sl_rail_util_coex_options_t` type.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the bitmask of of constant PTA features.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aPtaOptions parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetCoexConstantOptions(uint32_t *aPtaOptions);
|
||||
|
||||
/**
|
||||
* Get the coexistence enabled status.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_is_enabled()**
|
||||
*
|
||||
* @param[out] aPtaState A pointer to the location where the coexistence
|
||||
* enabled status will be returned.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the coexistence status.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aPtaState parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionIsCoexEnabled(bool *aPtaState);
|
||||
|
||||
/**
|
||||
* Set the coexistence enabled status.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_enable()**
|
||||
*
|
||||
* @param[in] aPtaState The coexistence enabled status.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the coexistence status.
|
||||
* @retval OT_ERROR_FAILED The coexistence status can not be set.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetCoexEnable(bool aPtaState);
|
||||
|
||||
/**
|
||||
* Get the coexistence PWM configuration.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_get_request_pwm_args()**
|
||||
*
|
||||
* @param[out] aPwmReq A pointer to the location where the coexistence
|
||||
* PWM request is returned. The value is defined
|
||||
* as a bitmap using shift values from the RAIL
|
||||
* `COEX_Req_t` enumeration.
|
||||
* @param[out] aPwmDutyCycle A pointer to the location where the coexistence
|
||||
* PWM duty cycle value is returned.
|
||||
* @param[out] aPwmPeriodHalfMs A pointer to the location where the coexistence
|
||||
* PWM period half MS value is returned.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the PWM configuration.
|
||||
* @retval OT_ERROR_INVALID_ARGS One or more of the parameters @p aPwmReq,
|
||||
* @p aPwmDutyCycle, or @p aPwmPeriodHalfMs is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetRequestPwmArgs(uint8_t *aPwmReq, uint8_t *aPwmDutyCycle, uint8_t *aPwmPeriodHalfMs);
|
||||
|
||||
/**
|
||||
* Set the coexistence PWM configuration.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_request_pwm()**
|
||||
*
|
||||
* @param[in] aPwmReq The coexistence PWM request. The value is defined
|
||||
* as a bitmap using shift values from the RAIL
|
||||
* `COEX_Req_t` enumeration.
|
||||
* @param[in] aPwmDutyCycle The coexistence PWM duty cycle.
|
||||
* @param[in] aPwmPeriodHalfMs The coexistencec PWM period half MS.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the PWM configuration.
|
||||
* @retval OT_ERROR_FAILED The coexistence radio PWM configuration can not be set/\.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetRequestPwmArgs(uint8_t aPwmReq, uint8_t aPwmDutyCycle, uint8_t aPwmPeriodHalfMs);
|
||||
|
||||
/**
|
||||
* Clear the coexistence counters.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully cleared the coexistence counters.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented or `SL_OPENTHREAD_COEX_COUNTER_ENABLE`
|
||||
* is not enabled.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionClearCoexCounters(void);
|
||||
|
||||
/**
|
||||
* Get the coexistence counters.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @param[in] aNumEntries The number of entries in @p aCoexCounters
|
||||
* array where counters will be returned.
|
||||
* @param[out] aCoexCounters A pointer to an array where the coexistence
|
||||
* counters will be returned. See @ref
|
||||
* otPlatRadioExtensionCoexEvent_t which defines
|
||||
* what coexistence counter each array element stores.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the coexistence counters.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aNumEntries is not `OT_PLAT_RADIO_EXTENSION_COEX_EVENT_COUNT`
|
||||
* or @p aCoexCounters is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented or `SL_OPENTHREAD_COEX_COUNTER_ENABLE`
|
||||
* is not enabled.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetCoexCounters(uint8_t aNumEntries, uint32_t aCoexCounters[]);
|
||||
|
||||
/**
|
||||
* Set the coexistence radio holdoff status.
|
||||
*
|
||||
* Requires the `ot_coex` component.
|
||||
*
|
||||
* @sa RAIL API: **sl_rail_util_coex_set_radio_holdoff()**
|
||||
*
|
||||
* @param[in] aEnabled The coexistence radio holdoff status.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the coexistence radio holdoff status.
|
||||
* @retval OT_ERROR_FAILED The coexistence radio holdoff status can not be set.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Coexistence is not implemented.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetRadioHoldoff(bool aEnabled);
|
||||
|
||||
#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
/**
|
||||
* Get the PTI (Packet Trace Information) radio config.
|
||||
*
|
||||
* Requires the `ot_test_custom_cli` component.
|
||||
*
|
||||
* @sa RAIL API: **RAIL_IEEE802154_GetPtiRadioConfig()**
|
||||
*
|
||||
* @param[out] aRadioConfig A pointer to the location where the PTI radio
|
||||
* config will be returned. The value is defined
|
||||
* by the RAIL `RAIL_IEEE802154_PtiRadioConfig_t`
|
||||
* enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained the PTI radio config.
|
||||
* @retval OT_ERROR_INVALID_ARGS The @p aRadioConfig parameter is NULL.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetPtiRadioConfig(uint16_t *aRadioConfig);
|
||||
|
||||
/**
|
||||
* Set the radio CCA mode.
|
||||
*
|
||||
* Requires the `ot_test_custom_cli` component.
|
||||
*
|
||||
* @sa RAIL API: **RAIL_IEEE802154_ConfigCcaMode()**
|
||||
*
|
||||
* @param[in] aMode The CCA mode to set. Modes are defined by the RAIL
|
||||
* `RAIL_IEEE802154_CcaMode_t` enumeration.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the CCA mode.
|
||||
* @retval OT_ERROR_FAILED The @p aTimeout is invalid.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionSetCcaMode(uint8_t aMode);
|
||||
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
|
||||
/**
|
||||
* This enumeration defines the coex event counters and can be used as an
|
||||
* index into the `aCoexCounters` table returned in a call to
|
||||
* @ref otPlatRadioExtensionGetCoexCounters.
|
||||
*
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/** Low priority request initiated */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_LO_PRI_REQUESTED,
|
||||
/** High priority request initiated */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_HI_PRI_REQUESTED,
|
||||
/** Low priority request denied */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_LO_PRI_DENIED,
|
||||
/** High priority request denied */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_HI_PRI_DENIED,
|
||||
/** Low priority transmission aborted mid packet */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_LO_PRI_TX_ABORTED,
|
||||
/** High priority transmission aborted mid packet */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_HI_PRI_TX_ABORTED,
|
||||
/** Number of coexistence events */
|
||||
OT_PLAT_RADIO_EXTENSION_COEX_EVENT_COUNT,
|
||||
} otPlatRadioExtensionCoexEvent_t;
|
||||
|
||||
/**
|
||||
* Get RAIL debug counter values.
|
||||
*
|
||||
* Requires the `ot_efr32_custom_cli` component.
|
||||
*
|
||||
* @param[out] *aCounters Pointer to struct to store counter values.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully obtained radio counter values.
|
||||
* @retval OT_ERROR_INVALID_ARGS @p aCounters is NULL.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT is not enabled.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionGetRadioCounters(efr32RadioCounters *aCounters);
|
||||
|
||||
/**
|
||||
* Clear the RAIL debug counters.
|
||||
*
|
||||
* Requires the `ot_efr32_custom_cli` component.
|
||||
*
|
||||
* @return Error code indicating success of the function call.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully cleared radio counter values.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED RADIO_CONFIG_DEBUG_COUNTERS_SUPPORT is not enabled.
|
||||
* @retval OT_ERROR_NOT_FOUND Returned to host applications when the coprocessor
|
||||
* is not built with the required component.
|
||||
*
|
||||
*/
|
||||
otError otPlatRadioExtensionClearRadioCounters(void);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _RADIO_EXTENSION_H
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2024, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 the copyright holder 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file defines the APIs required to support multi-channel feature on EFR devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef SL_CATALOG_RAIL_UTIL_IEEE802154_FAST_CHANNEL_SWITCHING_PRESENT
|
||||
#include "sl_rail_util_ieee802154_fast_channel_switching_config.h"
|
||||
#endif // SL_CATALOG_RAIL_UTIL_IEEE802154_FAST_CHANNEL_SWITCHING_PRESENT
|
||||
|
||||
#if SL_RAIL_UTIL_IEEE802154_FAST_CHANNEL_SWITCHING_ENABLED && !defined(SL_CATALOG_RAIL_MULTIPLEXER_PRESENT)
|
||||
// When RAIL multiplexer is present, we handle fast channel switching in the multiplexer code
|
||||
// turn off the feature here since OT lower mac is unaware of the goings on in the zigbee stack
|
||||
#define FAST_CHANNEL_SWITCHING_SUPPORT 1
|
||||
#else
|
||||
#define FAST_CHANNEL_SWITCHING_SUPPORT 0
|
||||
#endif // SL_RAIL_UTIL_IEEE802154_FAST_CHANNEL_SWITCHING_ENABLED && !defined(SL_CATALOG_RAIL_MULTIPLEXER_PRESENT)
|
||||
|
||||
/**
|
||||
* Check if the multi-channel feature is enabled.
|
||||
*
|
||||
* @retval true Multi-channel is enabled.
|
||||
* @retval false Multi-channel is disabled.
|
||||
*
|
||||
*/
|
||||
bool sl_is_multi_channel_enabled(void);
|
||||
|
||||
/**
|
||||
* Get the channel switching configuration.
|
||||
*
|
||||
* @param[out] channelSwitchingCfg Pointer to memory to store the switching config into.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Channel switching config was copied succesfully.
|
||||
* @retval OT_ERROR_INVALID_ARGS Argument passed was invalid.
|
||||
*
|
||||
*/
|
||||
otError sl_get_channel_switching_cfg(RAIL_IEEE802154_RxChannelSwitchingCfg_t *channelSwitchingCfg);
|
||||
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* Copyright (c) 2024, The OpenThread Authors.
|
||||
* All rights reserved.
|
||||
*
|
||||
* 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 the copyright holder 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file
|
||||
* This file defines the APIs required to support multi-channel feature on EFR devices.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <openthread-system.h>
|
||||
#include <openthread/link.h>
|
||||
#include <openthread/platform/radio.h>
|
||||
#if OPENTHREAD_CONFIG_MULTIPAN_RCP_ENABLE
|
||||
#include <openthread/platform/multipan.h>
|
||||
#endif
|
||||
|
||||
#include "board_config.h"
|
||||
#include "platform-efr32.h"
|
||||
#include "sl_common.h"
|
||||
#include "common/code_utils.hpp"
|
||||
#include "common/debug.hpp"
|
||||
#include "common/logging.hpp"
|
||||
#include "utils/code_utils.h"
|
||||
|
||||
#define SL_INVALID_TX_POWER (127)
|
||||
|
||||
#if RADIO_CONFIG_2P4GHZ_OQPSK_SUPPORT
|
||||
#define SL_CHANNEL_MAX OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX
|
||||
#define SL_CHANNEL_MIN OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN
|
||||
#define SL_MAX_CHANNELS_SUPPORTED ((OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MAX - OT_RADIO_2P4GHZ_OQPSK_CHANNEL_MIN) + 1)
|
||||
#elif RADIO_CONFIG_SUBGHZ_SUPPORT
|
||||
#define SL_CHANNEL_MAX OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX
|
||||
#define SL_CHANNEL_MIN OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN
|
||||
#define SL_MAX_CHANNELS_SUPPORTED \
|
||||
((OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MAX \
|
||||
- OPENTHREAD_CONFIG_PLATFORM_RADIO_PROPRIETARY_CHANNEL_MIN) \
|
||||
+ 1)
|
||||
|
||||
#elif RADIO_CONFIG_915MHZ_OQPSK_SUPPORT // Not supported
|
||||
#define SL_CHANNEL_MAX OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX
|
||||
#define SL_CHANNEL_MIN OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN
|
||||
#define SL_MAX_CHANNELS_SUPPORTED ((OT_RADIO_915MHZ_OQPSK_CHANNEL_MAX - OT_RADIO_915MHZ_OQPSK_CHANNEL_MIN) + 1)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Set the radio's max tx power for the given channel. THis value is maintained in the device
|
||||
*
|
||||
* @note This API is not available when @p OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE is enabled.
|
||||
*
|
||||
* @param[in] instance The OpenThread instance structure.
|
||||
* @param[in] channel Radio channel of interest.
|
||||
* @param[in] max_power Max Radio Tx power for the given @p channel.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the max transmit power.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError sli_set_channel_max_tx_power(otInstance *instance, uint8_t channel, int8_t max_power);
|
||||
|
||||
/**
|
||||
* Set the radio tx power in RAIL
|
||||
*
|
||||
* @param[in] tx_power Desired tx power in dbm.
|
||||
*
|
||||
*/
|
||||
void sli_set_tx_power_in_rail(int8_t tx_power);
|
||||
|
||||
/**
|
||||
* Update the Tx power following a RAIL config change.
|
||||
*
|
||||
* @param[in] tx_power_config Tx power configuration
|
||||
* @param[in] tx_power Desired tx power in dbm.
|
||||
*
|
||||
*/
|
||||
void sli_update_tx_power_after_config_update(const RAIL_TxPowerConfig_t *tx_power_config, int8_t tx_power);
|
||||
|
||||
/**
|
||||
* Initialize the power manager.
|
||||
*/
|
||||
void sli_init_power_manager(void);
|
||||
|
||||
/**
|
||||
* Set Openthreads default power configuration for all the channels.
|
||||
*
|
||||
* @note This API is not available when @p OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE is enabled.
|
||||
*
|
||||
* @param[in] instance The OpenThread instance structure.
|
||||
* @param[in] tx_power Desired tx power in dbm.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set the max transmit power.
|
||||
* @retval OT_ERROR_NOT_IMPLEMENTED Transmit power configuration via dBm is not implemented.
|
||||
*
|
||||
*/
|
||||
otError sli_set_default_tx_power(otInstance *instance, int8_t tx_power);
|
||||
|
||||
/**
|
||||
* Get the operating Tx power based on all Openthread configurations.
|
||||
*
|
||||
* @note When @p OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE is enabled, the device reads the
|
||||
* calibrated power values from power calibration module in Openthread.
|
||||
*
|
||||
* When disabled, the device will look up Max Tx power table and default power configured and select
|
||||
* the minimum of these values.
|
||||
*
|
||||
* In multiprotocol the above operation happens for all IIDs and minimum value of those will be selected.
|
||||
*
|
||||
* @param[in] instance The OpenThread instance structure.
|
||||
*
|
||||
* @retval The transmit power in dBm.
|
||||
*
|
||||
*/
|
||||
int8_t sl_get_tx_power_for_current_channel(otInstance *instance);
|
||||
|
||||
/**
|
||||
* This is a callback to parse the Raw Power calibration value received from the Openthread stack. A weak
|
||||
* default implementation is provided in the PAL, which picks the 0th byte of @p raw_power_setting as the
|
||||
* operating tx power. Application can implement its own parser but the callback is expected to return the
|
||||
* radio power in dbm and the FEM configuration if any in respective output pointers.
|
||||
*
|
||||
* @note This callback is available when @p OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE is enabled.
|
||||
*
|
||||
* @param[in] raw_power_calibration Pointer to raw power calibration received from Openthread stack.
|
||||
* @param[in] raw_setting_length Raw power calibration length.
|
||||
* @param[out] radio_power Pointer to parsed Radio Power in dbm (for RAIL).
|
||||
* @param[out] fem_setting Pointer to FEM settings.
|
||||
* @param[out] fem_setting_length Pointer to length of FEM settings.
|
||||
*
|
||||
* @retval OT_ERROR_NONE Successfully set parsed theraw power calibration.
|
||||
* @retval OT_ERROR_PARSE There was a parsing error.
|
||||
*
|
||||
*/
|
||||
otError sl_parse_raw_power_calibration_cb(uint8_t *raw_power_calibration,
|
||||
uint16_t raw_setting_length,
|
||||
int8_t *radio_power,
|
||||
uint8_t *fem_setting,
|
||||
uint16_t *fem_setting_length);
|
||||
|
||||
/**
|
||||
* This is a callback to con figure the FEM as required. A weak default implementation is provided in the PAL,
|
||||
* Application can use its own implementation to configure the FEM based on the values provided.
|
||||
*
|
||||
* @note This callback is available when @p OPENTHREAD_CONFIG_POWER_CALIBRATION_ENABLE is enabled.
|
||||
*
|
||||
* @param[in] fem_setting FEM settings.
|
||||
* @param[in] fem_setting_length Length of FEM settings.
|
||||
*
|
||||
*/
|
||||
void sl_configure_fem_cb(uint8_t *fem_setting, uint16_t fem_setting_length);
|
||||
Reference in New Issue
Block a user