From fb14009916c39db43bf637648b0ff3c17e454f5f Mon Sep 17 00:00:00 2001 From: konradderda <55538957+konradderda@users.noreply.github.com> Date: Wed, 16 Oct 2019 19:50:26 +0200 Subject: [PATCH] [radio] handle CCA ED threshold property configuration (#4246) Changes: - Radio interface simply passes calls to platform functions - Platform implementation for nRF52840 and nRF52833 - Placeholders for other platforms (resulting with OT_ERROR_NOT_IMPLEMENTED) - Spinel property configuration handlers --- examples/platforms/cc1352/radio.c | 22 ++++++++++++ examples/platforms/cc2538/radio.c | 16 +++++++++ examples/platforms/cc2650/radio.c | 22 ++++++++++++ examples/platforms/cc2652/radio.c | 22 ++++++++++++ examples/platforms/efr32mg12/radio.c | 16 +++++++++ examples/platforms/efr32mg21/radio.c | 16 +++++++++ examples/platforms/gp712/radio.c | 16 +++++++++ examples/platforms/kw41z/radio.c | 16 +++++++++ examples/platforms/nrf528xx/src/radio.c | 48 ++++++++++++++++++++++++- examples/platforms/posix/radio.c | 19 ++++++++++ examples/platforms/qpg6095/radio.c | 14 ++++++++ examples/platforms/samr21/radio.c | 16 +++++++++ include/openthread/platform/radio.h | 26 ++++++++++++++ src/core/radio/radio.hpp | 28 +++++++++++++++ src/ncp/ncp_base.cpp | 31 ++++++++++++++++ src/ncp/ncp_base_dispatcher.cpp | 6 ++++ src/posix/platform/radio_spinel.cpp | 28 +++++++++++++++ src/posix/platform/radio_spinel.hpp | 24 +++++++++++++ 18 files changed, 385 insertions(+), 1 deletion(-) diff --git a/examples/platforms/cc1352/radio.c b/examples/platforms/cc1352/radio.c index 080072c43..b5a65ec87 100644 --- a/examples/platforms/cc1352/radio.c +++ b/examples/platforms/cc1352/radio.c @@ -1327,6 +1327,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + /** * Function documented in platform/radio.h */ diff --git a/examples/platforms/cc2538/radio.c b/examples/platforms/cc2538/radio.c index a81aa803f..d7b3ca1d3 100644 --- a/examples/platforms/cc2538/radio.c +++ b/examples/platforms/cc2538/radio.c @@ -1162,6 +1162,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/cc2650/radio.c b/examples/platforms/cc2650/radio.c index d959475dd..b2db50894 100644 --- a/examples/platforms/cc2650/radio.c +++ b/examples/platforms/cc2650/radio.c @@ -1283,6 +1283,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + /** * Function documented in platform/radio.h */ diff --git a/examples/platforms/cc2652/radio.c b/examples/platforms/cc2652/radio.c index 655528057..e699f3755 100644 --- a/examples/platforms/cc2652/radio.c +++ b/examples/platforms/cc2652/radio.c @@ -1307,6 +1307,28 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +/** + * Function documented in platform/radio.h + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + /** * Function documented in platform/radio.h */ diff --git a/examples/platforms/efr32mg12/radio.c b/examples/platforms/efr32mg12/radio.c index fa10217f1..00dfc6ad4 100644 --- a/examples/platforms/efr32mg12/radio.c +++ b/examples/platforms/efr32mg12/radio.c @@ -966,6 +966,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/efr32mg21/radio.c b/examples/platforms/efr32mg21/radio.c index 1c16f9e15..d1820b0d6 100644 --- a/examples/platforms/efr32mg21/radio.c +++ b/examples/platforms/efr32mg21/radio.c @@ -941,6 +941,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/gp712/radio.c b/examples/platforms/gp712/radio.c index ff6031c2e..f10b5f8aa 100644 --- a/examples/platforms/gp712/radio.c +++ b/examples/platforms/gp712/radio.c @@ -350,6 +350,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NOT_IMPLEMENTED; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/kw41z/radio.c b/examples/platforms/kw41z/radio.c index db639cf31..4baa4433e 100644 --- a/examples/platforms/kw41z/radio.c +++ b/examples/platforms/kw41z/radio.c @@ -515,6 +515,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/nrf528xx/src/radio.c b/examples/platforms/nrf528xx/src/radio.c index c3a1c8a23..b9593f219 100644 --- a/examples/platforms/nrf528xx/src/radio.c +++ b/examples/platforms/nrf528xx/src/radio.c @@ -74,7 +74,8 @@ enum { - NRF528XX_RECEIVE_SENSITIVITY = -100, // dBm + NRF528XX_RECEIVE_SENSITIVITY = -100, // dBm + NRF528XX_MIN_CCA_ED_THRESHOLD = -94, // dBm }; static bool sDisabled; @@ -560,6 +561,51 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError error = OT_ERROR_NONE; + nrf_802154_cca_cfg_t ccaConfig; + + if (aThreshold == NULL) + { + error = OT_ERROR_INVALID_ARGS; + } + else + { + nrf_802154_cca_cfg_get(&ccaConfig); + // The radio driver has no function to convert ED threshold to dBm + *aThreshold = (int8_t)ccaConfig.ed_threshold + NRF528XX_MIN_CCA_ED_THRESHOLD; + } + + return error; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + + otError error = OT_ERROR_NONE; + nrf_802154_cca_cfg_t ccaConfig; + + // The minimum value of ED threshold for radio driver is -94 dBm + if (aThreshold < NRF528XX_MIN_CCA_ED_THRESHOLD) + { + error = OT_ERROR_INVALID_ARGS; + } + else + { + memset(&ccaConfig, 0, sizeof(ccaConfig)); + ccaConfig.mode = NRF_RADIO_CCA_MODE_ED; + ccaConfig.ed_threshold = nrf_802154_ccaedthres_from_dbm_calculate(aThreshold); + + nrf_802154_cca_cfg_set(&ccaConfig); + } + + return error; +} + void nrf5RadioProcess(otInstance *aInstance) { bool isEventPending = false; diff --git a/examples/platforms/posix/radio.c b/examples/platforms/posix/radio.c index ccdcb2aca..b93d35873 100644 --- a/examples/platforms/posix/radio.c +++ b/examples/platforms/posix/radio.c @@ -109,6 +109,7 @@ static otPanId sPanid; static bool sPromiscuous = false; static bool sTxWait = false; static int8_t sTxPower = 0; +static int8_t sCcaEdThresh = -74; static bool sSrcMatchEnabled = false; @@ -800,6 +801,24 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + assert(aInstance != NULL); + + *aThreshold = sCcaEdThresh; + + return OT_ERROR_NONE; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + assert(aInstance != NULL); + + sCcaEdThresh = aThreshold; + + return OT_ERROR_NONE; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { assert(aInstance != NULL); diff --git a/examples/platforms/qpg6095/radio.c b/examples/platforms/qpg6095/radio.c index d6b7c2588..6e8fee14a 100644 --- a/examples/platforms/qpg6095/radio.c +++ b/examples/platforms/qpg6095/radio.c @@ -327,6 +327,20 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NOT_IMPLEMENTED; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/examples/platforms/samr21/radio.c b/examples/platforms/samr21/radio.c index 6a6f3a312..1f951e18b 100644 --- a/examples/platforms/samr21/radio.c +++ b/examples/platforms/samr21/radio.c @@ -652,6 +652,22 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return OT_ERROR_NONE; } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aThreshold); + + return OT_ERROR_NOT_IMPLEMENTED; +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/include/openthread/platform/radio.h b/include/openthread/platform/radio.h index 4acfc98a7..a40b0103a 100644 --- a/include/openthread/platform/radio.h +++ b/include/openthread/platform/radio.h @@ -381,6 +381,32 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower); */ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower); +/** + * Get the radio's CCA ED threshold in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[out] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully retrieved the CCA ED threshold. + * @retval OT_ERROR_INVALID_ARGS @p aThreshold was NULL. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold); + +/** + * Set the radio's CCA ED threshold in dBm. + * + * @param[in] aInstance The OpenThread instance structure. + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully set the transmit power. + * @retval OT_ERROR_INVALID_ARGS Given threshold is out of range. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold); + /** * Get the status of promiscuous mode. * diff --git a/src/core/radio/radio.hpp b/src/core/radio/radio.hpp index cad96ae51..91aca839f 100644 --- a/src/core/radio/radio.hpp +++ b/src/core/radio/radio.hpp @@ -288,6 +288,34 @@ public: */ otError SetTransmitPower(int8_t aPower) { return otPlatRadioSetTransmitPower(GetInstance(), aPower); } + /** + * This method gets the radio's CCA ED threshold in dBm. + * + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE A reference to output the CCA ED threshold in dBm. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ + otError GetCcaEnergyDetectThreshold(int8_t &aThreshold) + { + return otPlatRadioGetCcaEnergyDetectThreshold(GetInstance(), &aThreshold); + } + + /** + * This method sets the radio's CCA ED threshold in dBm. + * + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Successfully set the CCA ED threshold. + * @retval OT_ERROR_NOT_IMPLEMENTED CCA ED threshold configuration via dBm is not implemented. + * + */ + otError SetCcaEnergyDetectThreshold(int8_t &aThreshold) + { + return otPlatRadioSetCcaEnergyDetectThreshold(GetInstance(), aThreshold); + } + /** * This method gets the status of promiscuous mode. * diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index af8e0e3da..69f1064ce 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -2074,6 +2074,37 @@ template <> otError NcpBase::HandlePropertyGet(v return mEncoder.WriteInt8(otPlatRadioGetReceiveSensitivity(mInstance)); } +template <> otError NcpBase::HandlePropertyGet(void) +{ + int8_t threshold; + otError error = OT_ERROR_NONE; + + error = otPlatRadioGetCcaEnergyDetectThreshold(mInstance, &threshold); + + if (error == OT_ERROR_NONE) + { + error = mEncoder.WriteInt8(threshold); + } + else + { + error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error)); + } + + return error; +} + +template <> otError NcpBase::HandlePropertySet(void) +{ + int8_t threshold = 0; + otError error = OT_ERROR_NONE; + + SuccessOrExit(error = mDecoder.ReadInt8(threshold)); + error = otPlatRadioSetCcaEnergyDetectThreshold(mInstance, threshold); + +exit: + return error; +} + template <> otError NcpBase::HandlePropertyGet(void) { int8_t power; diff --git a/src/ncp/ncp_base_dispatcher.cpp b/src/ncp/ncp_base_dispatcher.cpp index 77689207d..391be23b8 100644 --- a/src/ncp/ncp_base_dispatcher.cpp +++ b/src/ncp/ncp_base_dispatcher.cpp @@ -86,6 +86,9 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey) case SPINEL_PROP_PHY_RX_SENSITIVITY: handler = &NcpBase::HandlePropertyGet; break; + case SPINEL_PROP_PHY_CCA_THRESHOLD: + handler = &NcpBase::HandlePropertyGet; + break; case SPINEL_PROP_PHY_TX_POWER: handler = &NcpBase::HandlePropertyGet; break; @@ -693,6 +696,9 @@ NcpBase::PropertyHandler NcpBase::FindSetPropertyHandler(spinel_prop_key_t aKey) case SPINEL_PROP_UNSOL_UPDATE_FILTER: handler = &NcpBase::HandlePropertySet; break; + case SPINEL_PROP_PHY_CCA_THRESHOLD: + handler = &NcpBase::HandlePropertySet; + break; case SPINEL_PROP_PHY_TX_POWER: handler = &NcpBase::HandlePropertySet; break; diff --git a/src/posix/platform/radio_spinel.cpp b/src/posix/platform/radio_spinel.cpp index cd67543cb..c955f6a02 100644 --- a/src/posix/platform/radio_spinel.cpp +++ b/src/posix/platform/radio_spinel.cpp @@ -886,6 +886,14 @@ otError RadioSpinel::GetTransmitPower(int8_t &aPower) return error; } +otError RadioSpinel::GetCcaEnergyDetectThreshold(int8_t &aThreshold) +{ + otError error = Get(SPINEL_PROP_PHY_CCA_THRESHOLD, SPINEL_DATATYPE_INT8_S, &aThreshold); + + LogIfFail("Get CCA ED threshold failed", error); + return error; +} + int8_t RadioSpinel::GetRssi(void) { int8_t rssi = OT_RADIO_RSSI_INVALID; @@ -957,6 +965,13 @@ otError RadioSpinel::SetTransmitPower(int8_t aPower) return error; } +otError RadioSpinel::SetCcaEnergyDetectThreshold(int8_t aThreshold) +{ + otError error = Set(SPINEL_PROP_PHY_CCA_THRESHOLD, SPINEL_DATATYPE_INT8_S, aThreshold); + LogIfFail("Set CCA ED threshold failed", error); + return error; +} + otError RadioSpinel::EnergyScan(uint8_t aScanChannel, uint16_t aScanDuration) { otError error; @@ -1681,6 +1696,19 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower) return sRadioSpinel.SetTransmitPower(aPower); } +otError otPlatRadioGetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t *aThreshold) +{ + assert(aThreshold != NULL); + OT_UNUSED_VARIABLE(aInstance); + return sRadioSpinel.GetTransmitPower(*aThreshold); +} + +otError otPlatRadioSetCcaEnergyDetectThreshold(otInstance *aInstance, int8_t aThreshold) +{ + OT_UNUSED_VARIABLE(aInstance); + return sRadioSpinel.GetCcaEnergyDetectThreshold(aThreshold); +} + int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance) { OT_UNUSED_VARIABLE(aInstance); diff --git a/src/posix/platform/radio_spinel.hpp b/src/posix/platform/radio_spinel.hpp index d327b6aba..aecb096b4 100644 --- a/src/posix/platform/radio_spinel.hpp +++ b/src/posix/platform/radio_spinel.hpp @@ -162,6 +162,30 @@ public: */ otError SetTransmitPower(int8_t aPower); + /** + * This method gets the radio's CCA ED threshold in dBm. + * + * @param[out] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Succeeded. + * @retval OT_ERROR_BUSY Failed due to another operation is on going. + * @retval OT_ERROR_RESPONSE_TIMEOUT Failed due to no response received from the transceiver. + * + */ + otError GetCcaEnergyDetectThreshold(int8_t &aThreshold); + + /** + * This method sets the radio's CCA ED threshold in dBm. + * + * @param[in] aThreshold The CCA ED threshold in dBm. + * + * @retval OT_ERROR_NONE Succeeded. + * @retval OT_ERROR_BUSY Failed due to another operation is on going. + * @retval OT_ERROR_RESPONSE_TIMEOUT Failed due to no response received from the transceiver. + * + */ + otError SetCcaEnergyDetectThreshold(int8_t aThreshold); + /** * This method returns the radio sw version string. *