[style] relocate OT_UNUSED_VARIABLE (#3299)

This commit is contained in:
Jonathan Hui
2018-11-17 12:04:41 -08:00
parent f6afc5599a
commit e14d763e2e
70 changed files with 570 additions and 383 deletions
+2 -2
View File
@@ -53,10 +53,10 @@ void otPlatReset(otInstance *aInstance)
*/
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
otPlatResetReason ret;
OT_UNUSED_VARIABLE(aInstance);
otPlatResetReason ret;
switch (SysCtrlResetSourceGet())
{
case RSTSRC_PWR_ON:
+30 -24
View File
@@ -1207,10 +1207,10 @@ void cc1352RadioInit(void)
*/
otError otPlatRadioEnable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc1352_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1259,6 +1259,7 @@ exit:
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != cc1352_stateDisabled);
}
@@ -1267,10 +1268,10 @@ bool otPlatRadioIsEnabled(otInstance *aInstance)
*/
otError otPlatRadioDisable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc1352_stateDisabled)
{
error = OT_ERROR_NONE;
@@ -1294,10 +1295,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
*/
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc1352_stateSleep)
{
sState = cc1352_stateEdScan;
@@ -1314,10 +1315,10 @@ exit:
*/
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = sCurrentOutputPower->dbm;
@@ -1330,11 +1331,11 @@ exit:
*/
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
unsigned int i;
output_config_t const *powerCfg = &(rgOutputPower[0]);
OT_UNUSED_VARIABLE(aInstance);
for (i = 1; i < OUTPUT_CONFIG_COUNT; i++)
{
if (rgOutputPower[i].dbm >= aPower)
@@ -1357,10 +1358,10 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
*/
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc1352_stateSleep)
{
sState = cc1352_stateReceive;
@@ -1411,10 +1412,10 @@ exit:
*/
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc1352_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1440,6 +1441,7 @@ otError otPlatRadioSleep(otInstance *aInstance)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
@@ -1473,6 +1475,7 @@ exit:
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sRfStats.maxRssi;
}
@@ -1482,6 +1485,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
}
@@ -1509,11 +1513,11 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
*/
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindShortSrcMatchIdx(aShortAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC1352_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1543,11 +1547,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindShortSrcMatchIdx(aShortAddress)) != CC1352_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
@@ -1573,11 +1577,11 @@ exit:
*/
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC1352_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1606,11 +1610,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC1352_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
@@ -1690,6 +1694,7 @@ exit:
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* we are promiscuous if we are not filtering */
return sReceiveCmd.frameFiltOpt.frameFiltEn == 0;
}
@@ -1720,11 +1725,11 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
*/
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
uint8_t * eui64;
unsigned int i;
OT_UNUSED_VARIABLE(aInstance);
/*
* The IEEE MAC address can be stored two places. We check the Customer
* Configuration was not set before defaulting to the Factory
@@ -1997,5 +2002,6 @@ void cc1352RadioProcess(otInstance *aInstance)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return CC1352_RECEIVE_SENSITIVITY;
}
+1
View File
@@ -75,6 +75,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
}
+30 -22
View File
@@ -188,6 +188,8 @@ void setTxPower(int8_t aTxPower)
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
// EUI64 is in a mixed-endian format. Split in two halves, each 32-bit
// half is in little-endian format (machine endian). However, the
// most significant part of the EUI64 comes first, so we can't cheat
@@ -197,8 +199,6 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
volatile uint32_t *eui64 = &HWREG(IEEE_EUI64);
OT_UNUSED_VARIABLE(aInstance);
// Read first 32-bits
uint32_t part = eui64[0];
for (uint8_t i = 0; i < (OT_EXT_ADDRESS_SIZE / 2); i++)
@@ -283,6 +283,7 @@ void cc2538RadioInit(void)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED) ? true : false;
}
@@ -310,10 +311,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE)
{
otLogDebgPlat("State=OT_RADIO_STATE_SLEEP", NULL);
@@ -327,10 +328,10 @@ otError otPlatRadioSleep(otInstance *aInstance)
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState != OT_RADIO_STATE_DISABLED)
{
otLogDebgPlat("State=OT_RADIO_STATE_RECEIVE", NULL);
@@ -371,10 +372,10 @@ static void setupTransmit(otRadioFrame *aFrame)
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE)
{
int i;
@@ -464,24 +465,28 @@ exit:
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return 0;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_NONE;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (HWREG(RFCORE_XREG_FRMFILT0) & RFCORE_XREG_FRMFILT0_FRAME_FILTER_EN) == 0;
}
@@ -805,12 +810,12 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = findSrcMatchAvailEntry(true);
uint32_t *addr = (uint32_t *)RFCORE_FFSM_SRCADDRESS_TABLE;
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Add ShortAddr entry: %d", entry);
otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_BUFS);
@@ -830,12 +835,12 @@ exit:
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = findSrcMatchAvailEntry(false);
uint32_t *addr = (uint32_t *)RFCORE_FFSM_SRCADDRESS_TABLE;
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Add ExtAddr entry: %d", entry);
otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_BUFS);
@@ -855,11 +860,11 @@ exit:
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = findSrcMatchShortEntry(aShortAddress);
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Clear ShortAddr entry: %d", entry);
otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_ADDRESS);
@@ -872,11 +877,11 @@ exit:
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = findSrcMatchExtEntry(aExtAddress);
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Clear ExtAddr entry: %d", entry);
otEXPECT_ACTION(entry >= 0, error = OT_ERROR_NO_ADDRESS);
@@ -889,11 +894,11 @@ exit:
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t *addrEn = (uint32_t *)RFCORE_XREG_SRCSHORTEN0;
uint32_t *addrAutoPendEn = (uint32_t *)RFCORE_FFSM_SRCSHORTPENDEN0;
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Clear ShortAddr entries", NULL);
for (uint8_t i = 0; i < RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE; i++)
@@ -905,11 +910,11 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t *addrEn = (uint32_t *)RFCORE_XREG_SRCEXTEN0;
uint32_t *addrAutoPendEn = (uint32_t *)RFCORE_FFSM_SRCEXTPENDEN0;
OT_UNUSED_VARIABLE(aInstance);
otLogDebgPlat("Clear ExtAddr entries", NULL);
for (uint8_t i = 0; i < RFCORE_XREG_SRCMATCH_ENABLE_STATUS_SIZE; i++)
@@ -924,15 +929,16 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aScanChannel);
OT_UNUSED_VARIABLE(aScanDuration);
return OT_ERROR_NOT_IMPLEMENTED;
}
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = sTxPower;
@@ -943,6 +949,7 @@ exit:
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
setTxPower(aPower);
return OT_ERROR_NONE;
}
@@ -950,5 +957,6 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return CC2538_RECEIVE_SENSITIVITY;
}
+22 -22
View File
@@ -1152,10 +1152,10 @@ void cc2650RadioInit(void)
*/
otError otPlatRadioEnable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2650_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1192,10 +1192,10 @@ bool otPlatRadioIsEnabled(otInstance *aInstance)
*/
otError otPlatRadioDisable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2650_stateDisabled)
{
error = OT_ERROR_NONE;
@@ -1219,10 +1219,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
*/
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2650_stateSleep)
{
sState = cc2650_stateEdScan;
@@ -1239,10 +1239,10 @@ exit:
*/
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = sCurrentOutputPower->dbm;
@@ -1255,11 +1255,11 @@ exit:
*/
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
unsigned int i;
output_config_t const *powerCfg = &(rgOutputPower[0]);
OT_UNUSED_VARIABLE(aInstance);
for (i = 1; i < OUTPUT_CONFIG_COUNT; i++)
{
if (rgOutputPower[i].dbm >= aPower)
@@ -1282,10 +1282,10 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
*/
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2650_stateSleep)
{
sState = cc2650_stateReceive;
@@ -1334,10 +1334,10 @@ exit:
*/
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2650_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1432,11 +1432,11 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
*/
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindShortSrcMatchIdx(aShortAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC2650_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1466,11 +1466,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindShortSrcMatchIdx(aShortAddress)) != CC2650_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
@@ -1496,11 +1496,11 @@ exit:
*/
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC2650_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1529,11 +1529,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC2650_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
+1
View File
@@ -95,6 +95,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
}
+3 -2
View File
@@ -44,6 +44,7 @@
void otPlatReset(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
SysCtrlSystemReset();
}
@@ -52,10 +53,10 @@ void otPlatReset(otInstance *aInstance)
*/
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
otPlatResetReason ret;
OT_UNUSED_VARIABLE(aInstance);
otPlatResetReason ret;
switch (SysCtrlResetSourceGet())
{
case RSTSRC_PWR_ON:
+30 -24
View File
@@ -1206,10 +1206,10 @@ void cc2652RadioInit(void)
*/
otError otPlatRadioEnable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2652_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1239,6 +1239,7 @@ exit:
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != cc2652_stateDisabled);
}
@@ -1247,10 +1248,10 @@ bool otPlatRadioIsEnabled(otInstance *aInstance)
*/
otError otPlatRadioDisable(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2652_stateDisabled)
{
error = OT_ERROR_NONE;
@@ -1274,10 +1275,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
*/
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2652_stateSleep)
{
sState = cc2652_stateEdScan;
@@ -1294,10 +1295,10 @@ exit:
*/
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = sCurrentOutputPower->dbm;
@@ -1310,11 +1311,11 @@ exit:
*/
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
unsigned int i;
output_config_t const *powerCfg = &(rgOutputPower[0]);
OT_UNUSED_VARIABLE(aInstance);
for (i = 1; i < OUTPUT_CONFIG_COUNT; i++)
{
if (rgOutputPower[i].dbm >= aPower)
@@ -1337,10 +1338,10 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
*/
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2652_stateSleep)
{
sState = cc2652_stateReceive;
@@ -1391,10 +1392,10 @@ exit:
*/
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_BUSY;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_BUSY;
if (sState == cc2652_stateSleep)
{
error = OT_ERROR_NONE;
@@ -1420,6 +1421,7 @@ otError otPlatRadioSleep(otInstance *aInstance)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
@@ -1453,6 +1455,7 @@ exit:
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sRfStats.maxRssi;
}
@@ -1462,6 +1465,7 @@ int8_t otPlatRadioGetRssi(otInstance *aInstance)
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
}
@@ -1489,11 +1493,11 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
*/
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindShortSrcMatchIdx(aShortAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC2652_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1523,11 +1527,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindShortSrcMatchIdx(aShortAddress)) != CC2652_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
@@ -1553,11 +1557,11 @@ exit:
*/
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress);
OT_UNUSED_VARIABLE(aInstance);
if (idx == CC2652_SRC_MATCH_NONE)
{
/* the entry does not exist already, add it */
@@ -1586,11 +1590,11 @@ exit:
*/
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
uint8_t idx;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION((idx = rfCoreFindExtSrcMatchIdx((uint64_t *)aExtAddress)) != CC2652_SRC_MATCH_NONE,
error = OT_ERROR_NO_ADDRESS);
@@ -1670,6 +1674,7 @@ exit:
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* we are promiscuous if we are not filtering */
return sReceiveCmd.frameFiltOpt.frameFiltEn == 0;
}
@@ -1700,11 +1705,11 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
*/
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
uint8_t * eui64;
unsigned int i;
OT_UNUSED_VARIABLE(aInstance);
/*
* The IEEE MAC address can be stored two places. We check the Customer
* Configuration was not set before defaulting to the Factory
@@ -1978,5 +1983,6 @@ void cc2652RadioProcess(otInstance *aInstance)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return CC2652_RECEIVE_SENSITIVITY;
}
+1
View File
@@ -90,6 +90,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
hw_timer0_freeze();
}
+2
View File
@@ -36,12 +36,14 @@
void otPlatReset(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
hw_cpm_reboot_system();
}
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_PLAT_RESET_REASON_POWER_ON;
}
+9 -1
View File
@@ -146,6 +146,7 @@ void da15000RadioInit(void)
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
memcpy(aIeeeEui64, sEui64, RADIO_EUI64_TABLE_SIZE);
}
@@ -220,6 +221,7 @@ otError otPlatRadioDisable(otInstance *aInstance)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sRadioState != OT_RADIO_STATE_DISABLED);
}
@@ -406,6 +408,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
@@ -431,18 +434,21 @@ exit:
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sRssiReal;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_TRANSMIT_RETRIES | OT_RADIO_CAPS_CSMA_BACKOFF;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sRadioPromiscuous;
}
@@ -465,9 +471,10 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = sTxPower;
@@ -609,5 +616,6 @@ exit:
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return DA15000_RECEIVE_SENSITIVITY;
}
+2
View File
@@ -94,6 +94,7 @@ uint32_t otPlatTimeGetXtalAccuracy(void)
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(aInstance);
sAlarmT0 = t0;
sAlarmDt = dt;
sIsRunning = true;
@@ -102,6 +103,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
}
+2 -2
View File
@@ -55,10 +55,10 @@ void otPlatReset(otInstance *aInstance)
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
otPlatResetReason reason;
OT_UNUSED_VARIABLE(aInstance);
otPlatResetReason reason;
if (sResetCause & RMU_RSTCAUSE_PORST)
{
reason = OT_PLAT_RESET_REASON_POWER_ON;
+33 -26
View File
@@ -207,11 +207,11 @@ void efr32RadioDeinit(void)
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
uint64_t eui64;
uint8_t *eui64Ptr = NULL;
OT_UNUSED_VARIABLE(aInstance);
eui64 = SYSTEM_GetUnique();
eui64Ptr = (uint8_t *)&eui64;
@@ -223,10 +223,10 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
{
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
RAIL_Status_t status;
otLogInfoPlat("PANID=%X", aPanId);
sPanId = aPanId;
@@ -236,10 +236,10 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aAddress)
{
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
RAIL_Status_t status;
otLogInfoPlat("ExtAddr=%X%X%X%X%X%X%X%X", aAddress->m8[7], aAddress->m8[6], aAddress->m8[5], aAddress->m8[4],
aAddress->m8[3], aAddress->m8[2], aAddress->m8[1], aAddress->m8[0]);
@@ -249,10 +249,10 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aA
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
{
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
RAIL_Status_t status;
otLogInfoPlat("ShortAddr=%X", aAddress);
status = RAIL_IEEE802154_SetShortAddress(sRailHandle, aAddress, 0);
@@ -262,6 +262,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t aAddress)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED);
}
@@ -289,10 +290,10 @@ exit:
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED),
error = OT_ERROR_INVALID_STATE);
@@ -307,11 +308,11 @@ exit:
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION(sState != OT_RADIO_STATE_DISABLED, error = OT_ERROR_INVALID_STATE);
status = RAIL_StartRx(sRailHandle, aChannel, NULL);
@@ -366,33 +367,37 @@ exit:
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (int8_t)(RAIL_GetAverageRssi(sRailHandle) >> 2);
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_CSMA_BACKOFF;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sPromiscuous;
}
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
RAIL_Status_t status;
sPromiscuous = aEnable;
status = RAIL_IEEE802154_SetPromiscuousMode(sRailHandle, aEnable);
assert(status == RAIL_STATUS_NO_ERROR);
@@ -510,11 +515,11 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = -1;
OT_UNUSED_VARIABLE(aInstance);
entry = findSrcMatchAvailEntry(true);
otLogDebgPlat("Add ShortAddr entry: %d", entry);
@@ -528,11 +533,11 @@ exit:
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = -1;
OT_UNUSED_VARIABLE(aInstance);
entry = findSrcMatchAvailEntry(false);
otLogDebgPlat("Add ExtAddr entry: %d", entry);
@@ -546,11 +551,11 @@ exit:
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = -1;
OT_UNUSED_VARIABLE(aInstance);
entry = findSrcMatchShortEntry(aShortAddress);
otLogDebgPlat("Clear ShortAddr entry: %d", entry);
@@ -564,11 +569,11 @@ exit:
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
int8_t entry = -1;
OT_UNUSED_VARIABLE(aInstance);
entry = findSrcMatchExtEntry(aExtAddress);
otLogDebgPlat("Clear ExtAddr entry: %d", entry);
@@ -773,6 +778,7 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aScanChannel);
OT_UNUSED_VARIABLE(aScanDuration);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -810,10 +816,10 @@ void efr32RadioProcess(otInstance *aInstance)
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(aPower != NULL, error = OT_ERROR_INVALID_ARGS);
*aPower = (int8_t)(RAIL_GetTxPowerDbm(sRailHandle) / 10);
@@ -823,10 +829,10 @@ exit:
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
RAIL_Status_t status;
OT_UNUSED_VARIABLE(aInstance);
RAIL_Status_t status;
status = RAIL_SetTxPowerDbm(sRailHandle, ((RAIL_TxPower_t)aPower) * 10);
assert(status == RAIL_STATUS_NO_ERROR);
@@ -836,5 +842,6 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return EFR32_RECEIVE_SENSITIVITY;
}
+2
View File
@@ -54,6 +54,7 @@ uint32_t otPlatAlarmMilliGetNow(void)
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(aInstance);
expires = t0 + dt;
sIsRunning = true;
}
@@ -61,6 +62,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsRunning = false;
}
+3 -1
View File
@@ -31,14 +31,16 @@
void otPlatReset(otInstance *aInstance)
{
// Default
OT_UNUSED_VARIABLE(aInstance);
// Default
mrf24j40_hard_reset();
}
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
// TODO: Write me!
return OT_PLAT_RESET_REASON_POWER_ON;
}
+25 -10
View File
@@ -240,10 +240,10 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
{
uint8_t pan[2];
OT_UNUSED_VARIABLE(aInstance);
uint8_t pan[2];
pan[0] = (uint8_t)(panid & 0xFF);
pan[1] = (uint8_t)(panid >> 8);
mrf24j40_set_pan(pan);
@@ -252,16 +252,17 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address)
{
OT_UNUSED_VARIABLE(aInstance);
/* cast to remove const, FIXME: perhaps the bsp library should be updated? */
mrf24j40_set_eui((uint8_t *)(address->m8));
}
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
{
uint8_t addr[2];
OT_UNUSED_VARIABLE(aInstance);
uint8_t addr[2];
addr[0] = (uint8_t)(address & 0xFF);
addr[1] = (uint8_t)(address >> 8);
mrf24j40_set_short_addr(addr);
@@ -331,6 +332,7 @@ void emskRadioInit(void)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED);
}
@@ -356,10 +358,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -372,10 +374,10 @@ otError otPlatRadioSleep(otInstance *aInstance)
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState != OT_RADIO_STATE_DISABLED)
{
error = OT_ERROR_NONE;
@@ -390,11 +392,11 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aFrame);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -407,24 +409,28 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aFrame)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return 0;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_NONE;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (bool)(mrf24j40_read_short_ctrl_reg(MRF24J40_RXMCR) & MRF24J40_PROMI);
}
@@ -432,6 +438,7 @@ bool otPlatRadioGetPromiscuous(otInstance *aInstance)
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
mrf24j40_set_promiscuous(~aEnable);
}
@@ -637,6 +644,7 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aShortAddress);
return OT_ERROR_NONE;
}
@@ -644,6 +652,7 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aExtAddress);
return OT_ERROR_NONE;
}
@@ -651,6 +660,7 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aShortAddress);
return OT_ERROR_NONE;
}
@@ -658,6 +668,7 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aExtAddress);
return OT_ERROR_NONE;
}
@@ -676,6 +687,7 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aScanChannel);
OT_UNUSED_VARIABLE(aScanDuration);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -684,6 +696,7 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
// TODO: Create a proper implementation for this driver.
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -692,11 +705,13 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
// TODO: Create a proper implementation for this driver.
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return EMSK_RECEIVE_SENSITIVITY;
}
+1
View File
@@ -57,6 +57,7 @@ static void qorvoAlarmFired(void *aInstance)
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t t0, uint32_t dt)
{
OT_UNUSED_VARIABLE(t0);
qorvoAlarmUnScheduleEventArg((qorvoAlarmCallback_t)qorvoAlarmFired, aInstance);
qorvoAlarmScheduleEventArg(dt * 1000, qorvoAlarmFired, aInstance);
}
+1
View File
@@ -120,6 +120,7 @@ exit:
otError utilsFlashStatusWait(uint32_t aTimeout)
{
OT_UNUSED_VARIABLE(aTimeout);
return OT_ERROR_NONE;
}
+2 -2
View File
@@ -92,13 +92,13 @@ int PlatOtLogLevelToSysLogLevel(otLogLevel aLogLevel)
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
OT_UNUSED_VARIABLE(aLogRegion);
char logString[512];
unsigned int offset;
int charsWritten;
va_list args;
OT_UNUSED_VARIABLE(aLogRegion);
offset = 0;
va_start(args, aFormat);
+3 -2
View File
@@ -44,10 +44,10 @@ extern void platformUartRestore(void);
void otPlatReset(otInstance *aInstance)
{
char *argv[gArgumentsCount + 1];
OT_UNUSED_VARIABLE(aInstance);
char *argv[gArgumentsCount + 1];
for (int i = 0; i < gArgumentsCount; ++i)
{
argv[i] = gArguments[i];
@@ -66,6 +66,7 @@ void otPlatReset(otInstance *aInstance)
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_PLAT_RESET_REASON_POWER_ON;
}
+22 -2
View File
@@ -83,12 +83,14 @@ static int8_t sLastReceivedPower = 127;
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioGetIeeeEui64(aIeeeEui64);
}
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetPanId(panid);
otCachedSettings.panid = panid;
}
@@ -96,18 +98,21 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetExtendedAddress(address->m8);
}
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioSetShortAddress(address);
}
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED);
}
@@ -143,10 +148,10 @@ exit:
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE)
{
qorvoRadioSetRxOnWhenIdle(false);
@@ -227,24 +232,28 @@ void cbQorvoRadioReceiveDone(otRadioFrame *aPacket, otError aError)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sLastReceivedPower;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN | OT_RADIO_CAPS_TRANSMIT_RETRIES;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return false;
}
@@ -257,36 +266,42 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
qorvoRadioEnableSrcMatch(aEnable);
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioAddSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchShortEntry(aShortAddress, otCachedSettings.panid);
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
return qorvoRadioClearSrcMatchExtEntry(aExtAddress->m8, otCachedSettings.panid);
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* clear both short and extended addresses here */
qorvoRadioClearSrcMatchEntries();
}
@@ -294,6 +309,7 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
/* not implemented */
/* assumes clearing of short and extended entries is done simultaniously by the openthread stack */
}
@@ -301,6 +317,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
OT_UNUSED_VARIABLE(aInstance);
sScanstate = 1;
return qorvoRadioEnergyScan(aScanChannel, aScanDuration);
}
@@ -316,6 +333,7 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
// TODO: Create a proper implementation for this driver.
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -324,11 +342,13 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
// TODO: Create a proper implementation for this driver.
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return GP712_RECEIVE_SENSITIVITY;
}
+1
View File
@@ -78,6 +78,7 @@ void platformDummy(void *dummyPointer)
static void cbKeyPressed(uint8_t Param)
{
OT_UNUSED_VARIABLE(Param);
qorvoAlarmScheduleEventArg(0, platformDummy, (void *)&s_in_fd);
}
+1
View File
@@ -188,6 +188,7 @@ exit:
void PlatSocketRxSignaled(uint8_t id)
{
OT_UNUSED_VARIABLE(id);
//Dummy callback function to flush pipe
uint8_t readChar;
//Remove trigger byte from pipe
+2
View File
@@ -80,12 +80,14 @@ void kw41zAlarmProcess(otInstance *aInstance)
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
OT_UNUSED_VARIABLE(aInstance);
sAlarmTime = aT0 + aDt;
}
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sAlarmTime = 0;
}
+2 -2
View File
@@ -43,10 +43,10 @@ void otPlatReset(otInstance *aInstance)
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
otPlatResetReason reason;
OT_UNUSED_VARIABLE(aInstance);
otPlatResetReason reason;
if (RCM->SRS0 & RCM_SRS0_POR_MASK)
{
reason = OT_PLAT_RESET_REASON_POWER_ON;
+29 -22
View File
@@ -127,16 +127,17 @@ static bool rf_process_rx_frame(void);
otRadioState otPlatRadioGetState(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sState;
}
void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t addrLo;
uint32_t addrHi;
OT_UNUSED_VARIABLE(aInstance);
if ((RSIM->MAC_LSB == 0xffffffff) && (RSIM->MAC_MSB == 0xff))
{
addrLo = SIM->UIDL;
@@ -163,11 +164,11 @@ void otPlatRadioSetPanId(otInstance *aInstance, uint16_t aPanId)
void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t addrLo;
uint32_t addrHi;
OT_UNUSED_VARIABLE(aInstance);
memcpy(&addrLo, aExtAddress->m8, sizeof(addrLo));
memcpy(&addrHi, aExtAddress->m8 + sizeof(addrLo), sizeof(addrHi));
@@ -213,15 +214,16 @@ exit:
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sState != OT_RADIO_STATE_DISABLED;
}
otError otPlatRadioSleep(otInstance *aInstance)
{
otError status = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError status = OT_ERROR_NONE;
otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED)),
status = OT_ERROR_INVALID_STATE);
@@ -234,10 +236,10 @@ exit:
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError status = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError status = OT_ERROR_NONE;
otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED)),
status = OT_ERROR_INVALID_STATE);
@@ -283,46 +285,46 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
uint16_t checksum = sPanId + aShortAddress;
OT_UNUSED_VARIABLE(aInstance);
uint16_t checksum = sPanId + aShortAddress;
return rf_add_addr_table_entry(checksum, false);
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
uint16_t checksum = rf_get_addr_checksum((uint8_t *)aExtAddress->m8, true, sPanId);
OT_UNUSED_VARIABLE(aInstance);
uint16_t checksum = rf_get_addr_checksum((uint8_t *)aExtAddress->m8, true, sPanId);
return rf_add_addr_table_entry(checksum, true);
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
uint16_t checksum = sPanId + aShortAddress;
OT_UNUSED_VARIABLE(aInstance);
uint16_t checksum = sPanId + aShortAddress;
return rf_remove_addr_table_entry(checksum);
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
uint16_t checksum = rf_get_addr_checksum((uint8_t *)aExtAddress->m8, true, sPanId);
OT_UNUSED_VARIABLE(aInstance);
uint16_t checksum = rf_get_addr_checksum((uint8_t *)aExtAddress->m8, true, sPanId);
return rf_remove_addr_table_entry(checksum);
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
uint32_t i;
OT_UNUSED_VARIABLE(aInstance);
uint32_t i;
for (i = 0; i < RADIO_CONFIG_SRC_MATCH_ENTRY_NUM; i++)
{
/* Optimization: sExtSrcAddrBitmap[i / 8] & (1 << (i % 8)) */
@@ -335,10 +337,10 @@ void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
uint32_t i;
OT_UNUSED_VARIABLE(aInstance);
uint32_t i;
for (i = 0; i < RADIO_CONFIG_SRC_MATCH_ENTRY_NUM; i++)
{
/* Optimization: sExtSrcAddrBitmap[i / 8] & (1 << (i % 8))*/
@@ -352,6 +354,7 @@ void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTxFrame;
}
@@ -421,18 +424,21 @@ exit:
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (ZLL->LQI_AND_RSSI & ZLL_LQI_AND_RSSI_RSSI_MASK) >> ZLL_LQI_AND_RSSI_RSSI_SHIFT;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_ACK_TIMEOUT | OT_RADIO_CAPS_ENERGY_SCAN;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (ZLL->PHY_CTRL & ZLL_PHY_CTRL_PROMISCUOUS_MASK) == ZLL_PHY_CTRL_PROMISCUOUS_MASK;
}
@@ -456,11 +462,11 @@ void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
{
OT_UNUSED_VARIABLE(aInstance);
otError status = OT_ERROR_NONE;
uint32_t timeout;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT_ACTION(((sState != OT_RADIO_STATE_TRANSMIT) && (sState != OT_RADIO_STATE_DISABLED)),
status = OT_ERROR_INVALID_STATE);
@@ -512,6 +518,7 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return -100;
}
+3 -3
View File
@@ -44,12 +44,12 @@ otInstance *sInstance;
void otSysInit(int argc, char *argv[])
{
uint32_t temp, tempTrim;
uint8_t revId;
OT_UNUSED_VARIABLE(argc);
OT_UNUSED_VARIABLE(argv);
uint32_t temp, tempTrim;
uint8_t revId;
/* enable clock for PORTs */
CLOCK_EnableClock(kCLOCK_PortA);
CLOCK_EnableClock(kCLOCK_PortB);
+1
View File
@@ -71,6 +71,7 @@ void nrf5MiscDeinit(void)
void otPlatReset(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
#if OPENTHREAD_PLATFORM_USE_PSEUDO_RESET
gPlatformPseudoResetWasRequested = true;
sResetReason = POWER_RESETREAS_SREQ_Msk;
+13 -12
View File
@@ -321,10 +321,10 @@ otError otPlatRadioSleep(otInstance *aInstance)
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
bool result;
OT_UNUSED_VARIABLE(aInstance);
bool result;
nrf_802154_channel_set(aChannel);
nrf_802154_tx_power_set(sDefaultTxPower);
result = nrf_802154_receive();
@@ -407,10 +407,10 @@ void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
otError error;
OT_UNUSED_VARIABLE(aInstance);
otError error;
uint8_t shortAddress[SHORT_ADDRESS_SIZE];
convertShortAddress(shortAddress, aShortAddress);
@@ -428,10 +428,10 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
otError error;
OT_UNUSED_VARIABLE(aInstance);
otError error;
if (nrf_802154_pending_bit_for_addr_set(aExtAddress->m8, true))
{
error = OT_ERROR_NONE;
@@ -446,10 +446,10 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
otError error;
OT_UNUSED_VARIABLE(aInstance);
otError error;
uint8_t shortAddress[SHORT_ADDRESS_SIZE];
convertShortAddress(shortAddress, aShortAddress);
@@ -467,10 +467,10 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
otError error;
OT_UNUSED_VARIABLE(aInstance);
otError error;
if (nrf_802154_pending_bit_for_addr_clear(aExtAddress->m8, true))
{
error = OT_ERROR_NONE;
@@ -522,10 +522,10 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
if (aPower == NULL)
{
error = OT_ERROR_INVALID_ARGS;
@@ -799,6 +799,7 @@ void nrf_802154_energy_detected(uint8_t result)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return NRF52840_RECEIVE_SENSITIVITY;
}
+4
View File
@@ -78,6 +78,7 @@ uint32_t otPlatAlarmMilliGetNow(void)
void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
OT_UNUSED_VARIABLE(aInstance);
sMsAlarm = aT0 + aDt;
sIsMsRunning = true;
}
@@ -85,6 +86,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsMsRunning = false;
}
@@ -96,6 +98,7 @@ uint32_t otPlatAlarmMicroGetNow(void)
void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
{
OT_UNUSED_VARIABLE(aInstance);
sUsAlarm = aT0 + aDt;
sIsUsRunning = true;
}
@@ -103,6 +106,7 @@ void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
void otPlatAlarmMicroStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsUsRunning = false;
}
+1
View File
@@ -128,6 +128,7 @@ exit:
otError utilsFlashStatusWait(uint32_t aTimeout)
{
OT_UNUSED_VARIABLE(aTimeout);
return OT_ERROR_NONE;
}
+3 -3
View File
@@ -58,14 +58,14 @@
(OPENTHREAD_CONFIG_LOG_OUTPUT == OPENTHREAD_CONFIG_LOG_OUTPUT_NCP_SPINEL)
OT_TOOL_WEAK void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
char logString[512];
unsigned int offset;
int charsWritten;
va_list args;
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
offset = 0;
LOG_PRINTF("[%d] ", gNodeId);
+4 -2
View File
@@ -70,6 +70,7 @@ void otPlatReset(otInstance *aInstance)
otPlatResetReason otPlatGetResetReason(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sPlatResetReason;
}
@@ -80,10 +81,10 @@ void otPlatWakeHost(void)
otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState)
{
otError error = OT_ERROR_NONE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
switch (aState)
{
case OT_PLAT_MCU_POWER_STATE_ON:
@@ -102,5 +103,6 @@ otError otPlatSetMcuPowerState(otInstance *aInstance, otPlatMcuPowerState aState
otPlatMcuPowerState otPlatGetMcuPowerState(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return gPlatMcuPowerState;
}
+31 -15
View File
@@ -378,6 +378,7 @@ void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
sPromiscuous = aEnable;
}
@@ -451,6 +452,7 @@ void platformRadioDeinit(void)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED) ? true : false;
}
@@ -476,10 +478,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -491,10 +493,10 @@ otError otPlatRadioSleep(otInstance *aInstance)
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState != OT_RADIO_STATE_DISABLED)
{
error = OT_ERROR_NONE;
@@ -508,11 +510,11 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aRadio)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aRadio);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -525,17 +527,18 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aRadio)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
int8_t rssi = POSIX_LOW_RSSI_SAMPLE;
uint8_t channel = sReceiveFrame.mChannel;
uint32_t probabilityThreshold;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT((OT_RADIO_CHANNEL_MIN <= channel) && channel <= (OT_RADIO_CHANNEL_MAX));
// To emulate a simple interference model, we return either a high or
@@ -556,12 +559,14 @@ exit:
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_NONE;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sPromiscuous;
}
@@ -831,12 +836,15 @@ exit:
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
sSrcMatchEnabled = aEnable;
OT_UNUSED_VARIABLE(aInstance);
sSrcMatchEnabled = aEnable;
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sShortAddressMatchTableCount < sizeof(sShortAddressMatchTable) / sizeof(uint16_t),
error = OT_ERROR_NO_BUFS);
@@ -849,12 +857,13 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a
sShortAddressMatchTable[sShortAddressMatchTableCount++] = aShortAddress;
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sExtAddressMatchTableCount < sizeof(sExtAddressMatchTable) / sizeof(otExtAddress),
@@ -869,12 +878,13 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
sExtAddressMatchTable[sExtAddressMatchTableCount++] = *aExtAddress;
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
otEXPECT(sShortAddressMatchTableCount > 0);
@@ -889,12 +899,13 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t
}
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
otEXPECT(sExtAddressMatchTableCount > 0);
@@ -910,20 +921,21 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
}
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
sShortAddressMatchTableCount = 0;
OT_UNUSED_VARIABLE(aInstance);
sShortAddressMatchTableCount = 0;
}
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
sExtAddressMatchTableCount = 0;
OT_UNUSED_VARIABLE(aInstance);
sExtAddressMatchTableCount = 0;
}
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
@@ -931,12 +943,14 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aScanChannel);
OT_UNUSED_VARIABLE(aScanDuration);
return OT_ERROR_NOT_IMPLEMENTED;
}
otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
OT_UNUSED_VARIABLE(aInstance);
*aPower = sTxPower;
return OT_ERROR_NONE;
@@ -945,6 +959,7 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
sTxPower = aPower;
return OT_ERROR_NONE;
@@ -953,6 +968,7 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return POSIX_RECEIVE_SENSITIVITY;
}
+3
View File
@@ -51,6 +51,7 @@ static uint32_t sUsAlarm = 0;
void platformAlarmInit(uint32_t aSpeedUpFactor)
{
OT_UNUSED_VARIABLE(aSpeedUpFactor);
sNow = 0;
}
@@ -80,6 +81,7 @@ void otPlatAlarmMilliStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
void otPlatAlarmMilliStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsMsRunning = false;
}
@@ -99,6 +101,7 @@ void otPlatAlarmMicroStartAt(otInstance *aInstance, uint32_t aT0, uint32_t aDt)
void otPlatAlarmMicroStop(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
sIsUsRunning = false;
}
@@ -65,6 +65,7 @@ uint16_t sPortOffset;
static void handleSignal(int aSignal)
{
OT_UNUSED_VARIABLE(aSignal);
gTerminate = true;
}
+32 -13
View File
@@ -343,6 +343,7 @@ void otPlatRadioGetIeeeEui64(otInstance *aInstance, uint8_t *aIeeeEui64)
void otPlatRadioSetPanId(otInstance *aInstance, uint16_t panid)
{
OT_UNUSED_VARIABLE(aInstance);
sPanid = panid;
}
@@ -359,12 +360,14 @@ void otPlatRadioSetExtendedAddress(otInstance *aInstance, const otExtAddress *aE
void otPlatRadioSetShortAddress(otInstance *aInstance, uint16_t address)
{
OT_UNUSED_VARIABLE(aInstance);
sShortAddress = address;
}
void otPlatRadioSetPromiscuous(otInstance *aInstance, bool aEnable)
{
OT_UNUSED_VARIABLE(aInstance);
sPromiscuous = aEnable;
}
@@ -378,6 +381,7 @@ void platformRadioInit(void)
bool otPlatRadioIsEnabled(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return (sState != OT_RADIO_STATE_DISABLED) ? true : false;
}
@@ -403,10 +407,10 @@ otError otPlatRadioDisable(otInstance *aInstance)
otError otPlatRadioSleep(otInstance *aInstance)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_SLEEP || sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -418,10 +422,10 @@ otError otPlatRadioSleep(otInstance *aInstance)
otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_INVALID_STATE;
if (sState != OT_RADIO_STATE_DISABLED)
{
error = OT_ERROR_NONE;
@@ -435,11 +439,11 @@ otError otPlatRadioReceive(otInstance *aInstance, uint8_t aChannel)
otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aRadio)
{
otError error = OT_ERROR_INVALID_STATE;
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aRadio);
otError error = OT_ERROR_INVALID_STATE;
if (sState == OT_RADIO_STATE_RECEIVE)
{
error = OT_ERROR_NONE;
@@ -452,24 +456,28 @@ otError otPlatRadioTransmit(otInstance *aInstance, otRadioFrame *aRadio)
otRadioFrame *otPlatRadioGetTransmitBuffer(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return &sTransmitFrame;
}
int8_t otPlatRadioGetRssi(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return 0;
}
otRadioCaps otPlatRadioGetCaps(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_RADIO_CAPS_NONE;
}
bool otPlatRadioGetPromiscuous(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return sPromiscuous;
}
@@ -658,12 +666,15 @@ exit:
void otPlatRadioEnableSrcMatch(otInstance *aInstance, bool aEnable)
{
sSrcMatchEnabled = aEnable;
OT_UNUSED_VARIABLE(aInstance);
sSrcMatchEnabled = aEnable;
}
otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sShortAddressMatchTableCount < sizeof(sShortAddressMatchTable) / sizeof(uint16_t),
error = OT_ERROR_NO_BUFS);
@@ -676,12 +687,13 @@ otError otPlatRadioAddSrcMatchShortEntry(otInstance *aInstance, const uint16_t a
sShortAddressMatchTable[sShortAddressMatchTableCount++] = aShortAddress;
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NONE;
otEXPECT_ACTION(sExtAddressMatchTableCount < sizeof(sExtAddressMatchTable) / sizeof(otExtAddress),
@@ -696,12 +708,13 @@ otError otPlatRadioAddSrcMatchExtEntry(otInstance *aInstance, const otExtAddress
sExtAddressMatchTable[sExtAddressMatchTableCount++] = *aExtAddress;
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t aShortAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
otEXPECT(sShortAddressMatchTableCount > 0);
@@ -716,12 +729,13 @@ otError otPlatRadioClearSrcMatchShortEntry(otInstance *aInstance, const uint16_t
}
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddress *aExtAddress)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
otEXPECT(sExtAddressMatchTableCount > 0);
@@ -737,20 +751,21 @@ otError otPlatRadioClearSrcMatchExtEntry(otInstance *aInstance, const otExtAddre
}
exit:
OT_UNUSED_VARIABLE(aInstance);
return error;
}
void otPlatRadioClearSrcMatchShortEntries(otInstance *aInstance)
{
sShortAddressMatchTableCount = 0;
OT_UNUSED_VARIABLE(aInstance);
sShortAddressMatchTableCount = 0;
}
void otPlatRadioClearSrcMatchExtEntries(otInstance *aInstance)
{
sExtAddressMatchTableCount = 0;
OT_UNUSED_VARIABLE(aInstance);
sExtAddressMatchTableCount = 0;
}
otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint16_t aScanDuration)
@@ -758,6 +773,7 @@ otError otPlatRadioEnergyScan(otInstance *aInstance, uint8_t aScanChannel, uint1
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aScanChannel);
OT_UNUSED_VARIABLE(aScanDuration);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -765,6 +781,7 @@ otError otPlatRadioGetTransmitPower(otInstance *aInstance, int8_t *aPower)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
@@ -772,12 +789,14 @@ otError otPlatRadioSetTransmitPower(otInstance *aInstance, int8_t aPower)
{
OT_UNUSED_VARIABLE(aInstance);
OT_UNUSED_VARIABLE(aPower);
return OT_ERROR_NOT_IMPLEMENTED;
}
int8_t otPlatRadioGetReceiveSensitivity(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return POSIX_RECEIVE_SENSITIVITY;
}
+1
View File
@@ -61,6 +61,7 @@ static volatile bool gTerminate = false;
static void handleSignal(int aSignal)
{
OT_UNUSED_VARIABLE(aSignal);
gTerminate = true;
}
#endif
+4 -3
View File
@@ -124,6 +124,7 @@ OT_TOOL_WEAK
otError otPlatDebugUart_logfile(const char *filename)
{
OT_UNUSED_VARIABLE(filename);
return OT_ERROR_FAILED;
}
@@ -131,12 +132,12 @@ otError otPlatDebugUart_logfile(const char *filename)
/* this should not be a WEAK function */
void otPlatLog(otLogLevel aLogLevel, otLogRegion aLogRegion, const char *aFormat, ...)
{
va_list ap;
uint32_t now;
OT_UNUSED_VARIABLE(aLogLevel);
OT_UNUSED_VARIABLE(aLogRegion);
va_list ap;
uint32_t now;
now = otPlatAlarmMilliGetNow();
otPlatDebugUart_printf("%3d.%03d | ", (int)(now / 1000), (int)(now % 1000));
va_start(ap, aFormat);
+11 -8
View File
@@ -128,14 +128,14 @@ static void initSettings(uint32_t aBase, uint32_t aFlag)
static uint32_t swapSettingsBlock(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
uint32_t oldBase = sSettingsBaseAddress;
uint32_t swapAddress = oldBase;
uint32_t usedSize = sSettingsUsedSize;
uint8_t pageNum = SETTINGS_CONFIG_PAGE_NUM;
uint32_t settingsSize = pageNum > 1 ? SETTINGS_CONFIG_PAGE_SIZE * pageNum / 2 : SETTINGS_CONFIG_PAGE_SIZE;
OT_UNUSED_VARIABLE(aInstance);
otEXPECT(pageNum > 1);
sSettingsBaseAddress =
@@ -257,12 +257,12 @@ exit:
// settings API
void otPlatSettingsInit(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
uint8_t index;
uint32_t settingsSize = SETTINGS_CONFIG_PAGE_NUM > 1 ? SETTINGS_CONFIG_PAGE_SIZE * SETTINGS_CONFIG_PAGE_NUM / 2
: SETTINGS_CONFIG_PAGE_SIZE;
OT_UNUSED_VARIABLE(aInstance);
sSettingsBaseAddress = SETTINGS_CONFIG_BASE_ADDRESS;
utilsFlashInit();
@@ -307,30 +307,33 @@ void otPlatSettingsInit(otInstance *aInstance)
otError otPlatSettingsBeginChange(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NONE;
}
otError otPlatSettingsCommitChange(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NONE;
}
otError otPlatSettingsAbandonChange(otInstance *aInstance)
{
OT_UNUSED_VARIABLE(aInstance);
return OT_ERROR_NONE;
}
otError otPlatSettingsGet(otInstance *aInstance, uint16_t aKey, int aIndex, uint8_t *aValue, uint16_t *aValueLength)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
uint32_t address = sSettingsBaseAddress + OT_SETTINGS_FLAG_SIZE;
uint16_t valueLength = 0;
int index = 0;
OT_UNUSED_VARIABLE(aInstance);
while (address < (sSettingsBaseAddress + sSettingsUsedSize))
{
struct settingsBlock block;
@@ -397,12 +400,12 @@ otError otPlatSettingsAdd(otInstance *aInstance, uint16_t aKey, const uint8_t *a
otError otPlatSettingsDelete(otInstance *aInstance, uint16_t aKey, int aIndex)
{
OT_UNUSED_VARIABLE(aInstance);
otError error = OT_ERROR_NOT_FOUND;
uint32_t address = sSettingsBaseAddress + OT_SETTINGS_FLAG_SIZE;
int index = 0;
OT_UNUSED_VARIABLE(aInstance);
while (address < (sSettingsBaseAddress + sSettingsUsedSize))
{
struct settingsBlock block;