[spinel] add CSL Accuracy and CSL Uncertainty properties (#7638)

Allow the host to get CSL Accuracy and CSL Uncertainty from the RCP.
This commit is contained in:
Eduardo Montoya
2022-05-11 15:57:55 -07:00
committed by GitHub
parent adea4c4b2a
commit b8f305b825
11 changed files with 107 additions and 13 deletions
@@ -619,4 +619,8 @@
"SRP host uses dynamic heap array to store addresses so no need for config on max number of addresses".
#endif
#ifdef OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT
#error "OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT was removed and no longer supported"
#endif
#endif // OPENTHREAD_CORE_CONFIG_CHECK_H_
-10
View File
@@ -176,14 +176,4 @@
#endif
#endif
/**
* @def OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT
*
* The Uncertainty of the scheduling CSL of transmission by the parent, in ±10 us units.
*
*/
#ifndef OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT
#define OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT UINT8_MAX
#endif
#endif // CONFIG_PLATFORM_H_
+2
View File
@@ -809,7 +809,9 @@ inline uint8_t Radio::GetCslAccuracy(void)
{
return otPlatRadioGetCslAccuracy(GetInstancePtr());
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
inline uint8_t Radio::GetCslClockUncertainty(void)
{
return otPlatRadioGetCslClockUncertainty(GetInstancePtr());
+1 -1
View File
@@ -254,7 +254,7 @@ OT_TOOL_WEAK uint8_t otPlatRadioGetCslClockUncertainty(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OPENTHREAD_CONFIG_PLATFORM_CSL_UNCERT;
return UINT8_MAX;
}
OT_TOOL_WEAK otError otPlatRadioGetFemLnaGain(otInstance *aInstance, int8_t *aGain)
+22
View File
@@ -701,6 +701,28 @@ public:
const otExtAddress & aExtAddress);
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
/**
* Get the current accuracy, in units of ± ppm, of the clock used for scheduling CSL operations.
*
* @note Platforms may optimize this value based on operational conditions (i.e.: temperature).
*
* @retval The current CSL rx/tx scheduling drift, in units of ± ppm.
*
*/
uint8_t GetCslAccuracy(void);
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
/**
* Get the current uncertainty, in units of 10 us, of the clock used for scheduling CSL operations.
*
* @retval The current CSL Clock Uncertainty in units of 10 us.
*
*/
uint8_t GetCslUncertainty(void);
#endif
/**
* This method checks whether the spinel interface is radio-only.
*
+24
View File
@@ -2461,5 +2461,29 @@ otError RadioSpinel<InterfaceType, ProcessContextType>::ConfigureEnhAckProbing(o
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
template <typename InterfaceType, typename ProcessContextType>
uint8_t RadioSpinel<InterfaceType, ProcessContextType>::GetCslAccuracy(void)
{
uint8_t accuracy = UINT8_MAX;
otError error = Get(SPINEL_PROP_RCP_CSL_ACCURACY, SPINEL_DATATYPE_UINT8_S, &accuracy);
LogIfFail("Get CSL Accuracy failed", error);
return accuracy;
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
template <typename InterfaceType, typename ProcessContextType>
uint8_t RadioSpinel<InterfaceType, ProcessContextType>::GetCslUncertainty(void)
{
uint8_t uncertainty = UINT8_MAX;
otError error = Get(SPINEL_PROP_RCP_CSL_UNCERTAINTY, SPINEL_DATATYPE_UINT8_S, &uncertainty);
LogIfFail("Get CSL Uncertainty failed", error);
return uncertainty;
}
#endif
} // namespace Spinel
} // namespace ot
+2
View File
@@ -1401,6 +1401,8 @@ const char *spinel_prop_key_to_cstr(spinel_prop_key_t prop_key)
{SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT, "CHILD_SUPERVISION_CHECK_TIMEOUT"},
{SPINEL_PROP_RCP_VERSION, "RCP_VERSION"},
{SPINEL_PROP_RCP_ENH_ACK_PROBING, "ENH_ACK_PROBING"},
{SPINEL_PROP_RCP_CSL_ACCURACY, "CSL_ACCURACY"},
{SPINEL_PROP_RCP_CSL_UNCERTAINTY, "CSL_UNCERTAINTY"},
{SPINEL_PROP_PARENT_RESPONSE_INFO, "PARENT_RESPONSE_INFO"},
{SPINEL_PROP_SLAAC_ENABLED, "SLAAC_ENABLED"},
{SPINEL_PROP_SUPPORTED_RADIO_LINKS, "SUPPORTED_RADIO_LINKS"},
+19 -1
View File
@@ -377,7 +377,7 @@
* Please see section "Spinel definition compatibility guideline" for more details.
*
*/
#define SPINEL_RCP_API_VERSION 5
#define SPINEL_RCP_API_VERSION 6
/**
* @def SPINEL_MIN_HOST_SUPPORTED_RCP_API_VERSION
@@ -4731,6 +4731,24 @@ enum
*/
SPINEL_PROP_RCP_ENH_ACK_PROBING = SPINEL_PROP_RCP_EXT__BEGIN + 3,
/// CSL Accuracy
/** Format: `C`
* Required capability: `SPINEL_CAP_NET_THREAD_1_2`
*
* The current CSL rx/tx scheduling drift, in units of ± ppm.
*
*/
SPINEL_PROP_RCP_CSL_ACCURACY = SPINEL_PROP_RCP_EXT__BEGIN + 4,
/// CSL Uncertainty
/** Format: `C`
* Required capability: `SPINEL_CAP_NET_THREAD_1_2`
*
* The current uncertainty, in units of 10 us, of the clock used for scheduling CSL operations.
*
*/
SPINEL_PROP_RCP_CSL_UNCERTAINTY = SPINEL_PROP_RCP_EXT__BEGIN + 5,
SPINEL_PROP_RCP_EXT__END = 0x900,
SPINEL_PROP_NEST__BEGIN = 0x3BC0,
+14
View File
@@ -1547,6 +1547,20 @@ exit:
return error;
}
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_RCP_CSL_ACCURACY>(void)
{
return mEncoder.WriteUint8(otPlatRadioGetCslAccuracy(mInstance));
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_RCP_CSL_UNCERTAINTY>(void)
{
return mEncoder.WriteUint8(otPlatRadioGetCslClockUncertainty(mInstance));
}
#endif
otError NcpBase::EncodeChannelMask(uint32_t aChannelMask)
{
otError error = OT_ERROR_NONE;
+6
View File
@@ -210,6 +210,12 @@ NcpBase::PropertyHandler NcpBase::FindGetPropertyHandler(spinel_prop_key_t aKey)
#if OPENTHREAD_RADIO || OPENTHREAD_CONFIG_LINK_RAW_ENABLE
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_RCP_TIMESTAMP),
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_RCP_CSL_ACCURACY),
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_RCP_CSL_UNCERTAINTY),
#endif
#if OPENTHREAD_MTD || OPENTHREAD_FTD
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_UNSOL_UPDATE_FILTER),
OT_NCP_GET_HANDLER_ENTRY(SPINEL_PROP_UNSOL_UPDATE_LIST),
+13 -1
View File
@@ -35,6 +35,7 @@
#include <string.h>
#include "common/code_utils.hpp"
#include "common/new.hpp"
#include "lib/spinel/radio_spinel.hpp"
#include "posix/platform/radio.hpp"
@@ -603,12 +604,23 @@ uint32_t otPlatRadioGetBusSpeed(otInstance *aInstance)
return sRadioSpinel.GetBusSpeed();
}
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE || OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
uint8_t otPlatRadioGetCslAccuracy(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return 0;
return sRadioSpinel.GetCslAccuracy();
}
#endif
#if OPENTHREAD_CONFIG_MAC_CSL_TRANSMITTER_ENABLE
uint8_t otPlatRadioGetCslClockUncertainty(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sRadioSpinel.GetCslUncertainty();
}
#endif
otError otPlatRadioSetChannelMaxTransmitPower(otInstance *aInstance, uint8_t aChannel, int8_t aMaxPower)
{