[mac] enable radio layer before setting parameters (#2048)

This commit adjusts the order for calling radio layer API to make sure otPlatRadioEnable() is the first called to radio layer. This mainly addresses the issue of otInstance which is not provided when initializing radio layer.
This commit is contained in:
Buke Po
2017-08-01 09:50:52 -07:00
committed by Jonathan Hui
parent 6c9bba5445
commit 515519f7b6
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -310,7 +310,7 @@ extern "C" {
#define otLogCritMle(aInstance, aFormat, ...) otLogCrit(&aInstance, OT_LOG_REGION_MLE, aFormat, ## __VA_ARGS__)
#define otLogWarnMle(aInstance, aFormat, ...) otLogWarn(&aInstance, OT_LOG_REGION_MLE, aFormat, ## __VA_ARGS__)
#define otLogWarnMleErr(aInstance, aError, aFormat, ...) \
otLogWarn(&aInstance, OT_LOG_REGION_MAC, "Error %s: " aFormat, otThreadErrorToString(aError), ## __VA_ARGS__)
otLogWarn(&aInstance, OT_LOG_REGION_MLE, "Error %s: " aFormat, otThreadErrorToString(aError), ## __VA_ARGS__)
#define otLogInfoMle(aInstance, aFormat, ...) otLogInfo(&aInstance, OT_LOG_REGION_MLE, aFormat, ## __VA_ARGS__)
#define otLogDebgMle(aInstance, aFormat, ...) otLogDebg(&aInstance, OT_LOG_REGION_MLE, aFormat, ## __VA_ARGS__)
#else
+2 -2
View File
@@ -185,13 +185,13 @@ Mac::Mac(ThreadNetif &aThreadNetif):
memset(&mCounters, 0, sizeof(otMacCounters));
otPlatRadioEnable(&GetInstance());
SetExtendedPanId(sExtendedPanidInit);
SetNetworkName(sNetworkNameInit);
SetPanId(mPanId);
SetExtAddress(mExtAddress);
SetShortAddress(mShortAddress);
otPlatRadioEnable(&GetInstance());
}
otError Mac::ActiveScan(uint32_t aScanChannels, uint16_t aScanDuration, ActiveScanHandler aHandler, void *aContext)