mirror of
https://github.com/espressif/openthread.git
synced 2026-08-23 10:49:51 +00:00
[diag] add power calibration related diag commands (#8584)
he power calibration is supported by OT, this commit adds diag commands that are used to measure the mapping between the actual power and raw power settings, show the platform used power settings table. 1. Add "diag powersettings" to show the platform currently used power settings table. 2. Add "diag rawpowersetting" to make the platform to use the given raw power settings to transmit frames. 3. Add "diag cw" to transmit the continuous carrier wave.
This commit is contained in:
@@ -55,6 +55,8 @@ enum
|
||||
|
||||
static otGpioMode sGpioMode = OT_GPIO_MODE_INPUT;
|
||||
static bool sGpioValue = false;
|
||||
static uint8_t sRawPowerSetting[OPENTHREAD_CONFIG_POWER_CALIBRATION_RAW_POWER_SETTING_SIZE];
|
||||
static uint16_t sRawPowerSettingLength = 0;
|
||||
|
||||
void otPlatDiagModeSet(bool aMode) { sDiagMode = aMode; }
|
||||
|
||||
@@ -116,4 +118,54 @@ otError otPlatDiagGpioGetMode(uint32_t aGpio, otGpioMode *aMode)
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatDiagRadioSetRawPowerSetting(otInstance *aInstance,
|
||||
const uint8_t *aRawPowerSetting,
|
||||
uint16_t aRawPowerSettingLength)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength <= sizeof(sRawPowerSetting)),
|
||||
error = OT_ERROR_INVALID_ARGS);
|
||||
memcpy(sRawPowerSetting, aRawPowerSetting, aRawPowerSettingLength);
|
||||
sRawPowerSettingLength = aRawPowerSettingLength;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatDiagRadioGetRawPowerSetting(otInstance *aInstance,
|
||||
uint8_t *aRawPowerSetting,
|
||||
uint16_t *aRawPowerSettingLength)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
otError error = OT_ERROR_NONE;
|
||||
|
||||
otEXPECT_ACTION((aRawPowerSetting != NULL) && (aRawPowerSettingLength != NULL), error = OT_ERROR_INVALID_ARGS);
|
||||
otEXPECT_ACTION((sRawPowerSettingLength != 0), error = OT_ERROR_NOT_FOUND);
|
||||
otEXPECT_ACTION((sRawPowerSettingLength <= *aRawPowerSettingLength), error = OT_ERROR_INVALID_ARGS);
|
||||
|
||||
memcpy(aRawPowerSetting, sRawPowerSetting, sRawPowerSettingLength);
|
||||
*aRawPowerSettingLength = sRawPowerSettingLength;
|
||||
|
||||
exit:
|
||||
return error;
|
||||
}
|
||||
|
||||
otError otPlatDiagRadioRawPowerSettingEnable(otInstance *aInstance, bool aEnable)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aEnable);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
|
||||
otError otPlatDiagRadioTransmitCarrier(otInstance *aInstance, bool aEnable)
|
||||
{
|
||||
OT_UNUSED_VARIABLE(aInstance);
|
||||
OT_UNUSED_VARIABLE(aEnable);
|
||||
|
||||
return OT_ERROR_NONE;
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_DIAG_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user