[radio] remove transmit power config from core (#2352)

Thread (and OpenThread) does not employ any form of transmit power control.
As a result, while OpenThread provides APIs to control transmit power, it
simply buffers and passes the transmit power value straight through to the
radio.

Currently, the transmit power APIs allow specifying an int8_t in units of
dBm.  This is overly constraining for platforms that have more advanced ways
of configuring the transmit power.

This commit removes the transmit power configuration from the core.  This
provides better flexibility in platform-specific ways to configure transmit
power.
This commit is contained in:
Jonathan Hui
2017-11-28 17:33:32 +00:00
committed by GitHub
parent 8bd588301e
commit 741941e271
38 changed files with 302 additions and 196 deletions
@@ -457,8 +457,8 @@ typedef enum _OTLWF_NOTIF_TYPE
OTLWF_CTL_CODE(156, METHOD_BUFFERED, FILE_WRITE_DATA)
// GUID - InterfaceGuid
#define IOCTL_OTLWF_OT_MAX_TRANSMIT_POWER \
OTLWF_CTL_CODE(157, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
//#define IOCTL_OTLWF_OT_TRANSMIT_POWER \
// OTLWF_CTL_CODE(157, METHOD_BUFFERED, FILE_READ_DATA | FILE_WRITE_DATA)
// GUID - InterfaceGuid
// int8_t - aPower
-23
View File
@@ -1653,29 +1653,6 @@ otThreadSetPSKc(
return DwordToThreadError(SendIOCTL(aInstance->ApiHandle, IOCTL_OTLWF_OT_PSKC, Buffer, sizeof(Buffer), nullptr, 0));
}
OTAPI
int8_t
OTCALL
otLinkGetMaxTransmitPower(
_In_ otInstance *aInstance
)
{
int8_t Result = 0;
if (aInstance) (void)QueryIOCTL(aInstance, IOCTL_OTLWF_OT_MAX_TRANSMIT_POWER, &Result);
return Result;
}
OTAPI
void
OTCALL
otLinkSetMaxTransmitPower(
_In_ otInstance *aInstance,
int8_t aPower
)
{
if (aInstance) (void)SetIOCTL(aInstance, IOCTL_OTLWF_OT_MAX_TRANSMIT_POWER, aPower);
}
OTAPI
const otIp6Address *
OTCALL
+1 -1
View File
@@ -956,7 +956,7 @@ otLwfCmdSendMacFrameAsync(
Packet->mPsdu,
(uint32_t)Packet->mLength,
Packet->mChannel,
Packet->mPower
Packet->mRssi
);
if (!NT_SUCCESS(status))
{
@@ -1019,7 +1019,7 @@ otLwfEventWorkerThread(
SPINEL_DATATYPE_STRUCT_S( // Vendor-data
SPINEL_DATATYPE_UINT_PACKED_S
),
&pFilter->otReceiveFrame.mPower,
&pFilter->otReceiveFrame.mRssi,
&noiseFloor,
&flags,
&pFilter->otReceiveFrame.mChannel,
+4 -6
View File
@@ -102,7 +102,7 @@ OTLWF_IOCTL_HANDLER IoCtls[] =
{ "IOCTL_OTLWF_OT_REMOVE_MAC_BLACKLIST", REF_IOCTL_FUNC(otRemoveMacBlacklist) },
{ "IOCTL_OTLWF_OT_NEXT_MAC_BLACKLIST", REF_IOCTL_FUNC(otNextMacBlacklist) },
{ "IOCTL_OTLWF_OT_CLEAR_MAC_BLACKLIST", REF_IOCTL_FUNC(otClearMacBlacklist) },
{ "IOCTL_OTLWF_OT_MAX_TRANSMIT_POWER", REF_IOCTL_FUNC(otMaxTransmitPower) },
{ "IOCTL_OTLWF_OT_TRANSMIT_POWER", REF_IOCTL_FUNC(otTransmitPower) },
{ "IOCTL_OTLWF_OT_NEXT_ON_MESH_PREFIX", REF_IOCTL_FUNC(otNextOnMeshPrefix) },
{ "IOCTL_OTLWF_OT_POLL_PERIOD", REF_IOCTL_FUNC(otPollPeriod) },
{ "IOCTL_OTLWF_OT_LOCAL_LEADER_PARTITION_ID", REF_IOCTL_FUNC(otLocalLeaderPartitionId) },
@@ -4786,7 +4786,7 @@ otLwfIoCtl_otClearMacBlacklist(
_IRQL_requires_max_(PASSIVE_LEVEL)
NTSTATUS
otLwfIoCtl_otMaxTransmitPower(
otLwfIoCtl_otTransmitPower(
_In_ PMS_FILTER pFilter,
_In_reads_bytes_(InBufferLength)
PUCHAR InBuffer,
@@ -4800,15 +4800,13 @@ otLwfIoCtl_otMaxTransmitPower(
if (InBufferLength >= sizeof(int8_t))
{
otLinkSetMaxTransmitPower(pFilter->otCtx, *(int8_t*)InBuffer);
status = STATUS_SUCCESS;
status = ThreadErrorToNtstatus(otPlatRadioSetTransmitPower(pFilter->otCtx, *(int8_t*)InBuffer));
*OutBufferLength = 0;
}
else if (*OutBufferLength >= sizeof(int8_t))
{
*(int8_t*)OutBuffer = otLinkGetMaxTransmitPower(pFilter->otCtx);
status = ThreadErrorToNtstatus(otPlatRadioGetTransmitPower(pFilter->otCtx, (int8_t*)OutBuffer));
*OutBufferLength = sizeof(int8_t);
status = STATUS_SUCCESS;
}
else
{
+1 -1
View File
@@ -188,7 +188,7 @@ DECL_IOCTL_FUNC(otAddMacBlacklist);
DECL_IOCTL_FUNC(otRemoveMacBlacklist);
DECL_IOCTL_FUNC(otNextMacBlacklist);
DECL_IOCTL_FUNC(otClearMacBlacklist);
DECL_IOCTL_FUNC(otMaxTransmitPower);
DECL_IOCTL_FUNC(otTransmitPower);
DECL_IOCTL_FUNC(otNextOnMeshPrefix);
DECL_IOCTL_FUNC(otPollPeriod);
DECL_IOCTL_FUNC(otLocalLeaderPartitionId);
+27 -1
View File
@@ -802,7 +802,30 @@ error:
return NT_SUCCESS(status) ? OT_ERROR_NONE : OT_ERROR_FAILED;
}
void otPlatRadioSetDefaultTxPower(_In_ otInstance *otCtx, int8_t aPower)
otError otPlatRadioGetTransmitPower(_In_ otInstance *otCtx, int8_t *aPower)
{
NT_ASSERT(otCtx);
PMS_FILTER pFilter = otCtxToFilter(otCtx);
NTSTATUS status;
status =
otLwfCmdGetProp(
pFilter,
NULL,
SPINEL_PROP_PHY_TX_POWER,
SPINEL_DATATYPE_INT8_S,
aPower
);
if (!NT_SUCCESS(status))
{
LogError(DRIVER_DEFAULT, "Get SPINEL_PROP_PHY_TX_POWER, failed, %!STATUS!", status);
}
return NT_SUCCESS(status) ? OT_ERROR_NONE : OT_ERROR_FAILED;
}
otError otPlatRadioSetTransmitPower(_In_ otInstance *otCtx, int8_t aPower)
{
NT_ASSERT(otCtx);
PMS_FILTER pFilter = otCtxToFilter(otCtx);
@@ -816,10 +839,13 @@ void otPlatRadioSetDefaultTxPower(_In_ otInstance *otCtx, int8_t aPower)
SPINEL_DATATYPE_INT8_S,
aPower
);
if (!NT_SUCCESS(status))
{
LogError(DRIVER_DEFAULT, "Set SPINEL_PROP_PHY_TX_POWER failed, %!STATUS!", status);
}
return NT_SUCCESS(status) ? OT_ERROR_NONE : OT_ERROR_FAILED;
}
int8_t otPlatRadioGetReceiveSensitivity(_In_ otInstance *otCtx)