From 9073d0d99a7e6677b2789c80f231f5f226888c49 Mon Sep 17 00:00:00 2001 From: Jonathan Hui Date: Thu, 25 May 2017 09:08:45 -0700 Subject: [PATCH] Cleanup reset reason names. (#1824) --- examples/drivers/windows/otLwf/command.c | 2 +- examples/platforms/cc2538/misc.c | 2 +- examples/platforms/cc2650/misc.c | 10 +++++----- examples/platforms/da15000/misc.c | 2 +- examples/platforms/efr32/misc.c | 14 +++++++------- examples/platforms/emsk/misc.c | 2 +- examples/platforms/kw41z/misc.c | 14 +++++++------- examples/platforms/nrf52840/misc.c | 12 ++++++------ examples/platforms/posix/misc.c | 2 +- include/openthread/platform/misc.h | 20 ++++++++++---------- src/ncp/ncp_base.cpp | 16 ++++++++-------- tests/unit/test_platform.cpp | 2 +- 12 files changed, 49 insertions(+), 49 deletions(-) diff --git a/examples/drivers/windows/otLwf/command.c b/examples/drivers/windows/otLwf/command.c index 2f4be77d0..ac5f505ec 100644 --- a/examples/drivers/windows/otLwf/command.c +++ b/examples/drivers/windows/otLwf/command.c @@ -81,7 +81,7 @@ otLwfCmdInitialize( { pFilter->cmdTIDsInUse = 0; pFilter->cmdNextTID = 1; - pFilter->cmdResetReason = kPlatResetReason_PowerOn; + pFilter->cmdResetReason = OT_PLAT_RESET_REASON_POWER_ON; NdisAllocateSpinLock(&pFilter->cmdLock); InitializeListHead(&pFilter->cmdHandlers); diff --git a/examples/platforms/cc2538/misc.c b/examples/platforms/cc2538/misc.c index 3f32f7c58..167cc3826 100644 --- a/examples/platforms/cc2538/misc.c +++ b/examples/platforms/cc2538/misc.c @@ -41,7 +41,7 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { (void)aInstance; // TODO: Write me! - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; } void otPlatWakeHost(void) diff --git a/examples/platforms/cc2650/misc.c b/examples/platforms/cc2650/misc.c index 0665413b0..cf204f39a 100644 --- a/examples/platforms/cc2650/misc.c +++ b/examples/platforms/cc2650/misc.c @@ -49,24 +49,24 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) switch (SysCtrlResetSourceGet()) { case RSTSRC_PWR_ON: - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; case RSTSRC_PIN_RESET: - return kPlatResetReason_External; + return OT_PLAT_RESET_REASON_EXTERNAL; case RSTSRC_VDDS_LOSS: case RSTSRC_VDD_LOSS: case RSTSRC_VDDR_LOSS: case RSTSRC_CLK_LOSS: - return kPlatResetReason_Crash; + return OT_PLAT_RESET_REASON_CRASH; case RSTSRC_WARMRESET: case RSTSRC_SYSRESET: case RSTSRC_WAKEUP_FROM_SHUTDOWN: - return kPlatResetReason_Software; + return OT_PLAT_RESET_REASON_SOFTWARE; default: - return kPlatResetReason_Unknown; + return OT_PLAT_RESET_REASON_UNKNOWN; } } diff --git a/examples/platforms/da15000/misc.c b/examples/platforms/da15000/misc.c index 9d9ce80cd..c2a9a7027 100644 --- a/examples/platforms/da15000/misc.c +++ b/examples/platforms/da15000/misc.c @@ -41,7 +41,7 @@ void otPlatReset(otInstance *aInstance) otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { (void)aInstance; - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; } void otPlatWakeHost(void) diff --git a/examples/platforms/efr32/misc.c b/examples/platforms/efr32/misc.c index d3b105720..bbf32473b 100644 --- a/examples/platforms/efr32/misc.c +++ b/examples/platforms/efr32/misc.c @@ -61,34 +61,34 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) if (sResetCause & RMU_RSTCAUSE_PORST) { - reason = kPlatResetReason_PowerOn; + reason = OT_PLAT_RESET_REASON_POWER_ON; } else if (sResetCause & RMU_RSTCAUSE_SYSREQRST) { - reason = kPlatResetReason_Software; + reason = OT_PLAT_RESET_REASON_SOFTWARE; } else if (sResetCause & RMU_RSTCAUSE_WDOGRST) { - reason = kPlatResetReason_Watchdog; + reason = OT_PLAT_RESET_REASON_WATCHDOG; } else if (sResetCause & RMU_RSTCAUSE_EXTRST) { - reason = kPlatResetReason_External; + reason = OT_PLAT_RESET_REASON_EXTERNAL; } else if (sResetCause & RMU_RSTCAUSE_LOCKUPRST) { - reason = kPlatResetReason_Fault; + reason = OT_PLAT_RESET_REASON_FAULT; } else if ((sResetCause & RMU_RSTCAUSE_AVDDBOD) || (sResetCause & RMU_RSTCAUSE_DECBOD) || (sResetCause & RMU_RSTCAUSE_DVDDBOD) || (sResetCause & RMU_RSTCAUSE_EM4RST)) { - reason = kPlatResetReason_Assert; + reason = OT_PLAT_RESET_REASON_ASSERT; } else { - reason = kPlatResetReason_Unknown; + reason = OT_PLAT_RESET_REASON_UNKNOWN; } return reason; diff --git a/examples/platforms/emsk/misc.c b/examples/platforms/emsk/misc.c index 30df877ed..228f0ae1f 100755 --- a/examples/platforms/emsk/misc.c +++ b/examples/platforms/emsk/misc.c @@ -40,7 +40,7 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { (void)aInstance; // TODO: Write me! - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; } void otPlatWakeHost(void) diff --git a/examples/platforms/kw41z/misc.c b/examples/platforms/kw41z/misc.c index 35ada18f6..6b5192ec1 100644 --- a/examples/platforms/kw41z/misc.c +++ b/examples/platforms/kw41z/misc.c @@ -46,35 +46,35 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) if (RCM->SRS0 & RCM_SRS0_POR_MASK) { - reason = kPlatResetReason_PowerOn; + reason = OT_PLAT_RESET_REASON_POWER_ON; } else if (RCM->SRS1 & RCM_SRS1_SW_MASK) { - reason = kPlatResetReason_Software; + reason = OT_PLAT_RESET_REASON_SOFTWARE; } else if (RCM->SRS0 & RCM_SRS0_WDOG_MASK) { - reason = kPlatResetReason_Watchdog; + reason = OT_PLAT_RESET_REASON_WATCHDOG; } else if (RCM->SRS0 & RCM_SRS0_PIN_MASK) { - reason = kPlatResetReason_External; + reason = OT_PLAT_RESET_REASON_EXTERNAL; } else if ((RCM->SRS0 & RCM_SRS0_LOC_MASK) || (RCM->SRS1 & RCM_SRS1_SACKERR_MASK) || (RCM->SRS1 & RCM_SRS1_LOCKUP_MASK)) { - reason = kPlatResetReason_Fault; + reason = OT_PLAT_RESET_REASON_FAULT; } else if ((RCM->SRS0 & RCM_SRS0_WAKEUP_MASK) || (RCM->SRS0 & RCM_SRS0_LVD_MASK) || (RCM->SRS1 & RCM_SRS1_MDM_AP_MASK)) { - reason = kPlatResetReason_Assert; + reason = OT_PLAT_RESET_REASON_ASSERT; } else { - reason = kPlatResetReason_Other; + reason = OT_PLAT_RESET_REASON_OTHER; } return reason; diff --git a/examples/platforms/nrf52840/misc.c b/examples/platforms/nrf52840/misc.c index a3987cc1f..06950c49b 100644 --- a/examples/platforms/nrf52840/misc.c +++ b/examples/platforms/nrf52840/misc.c @@ -70,19 +70,19 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) if (sResetReason & POWER_RESETREAS_RESETPIN_Msk) { - reason = kPlatResetReason_External; + reason = OT_PLAT_RESET_REASON_EXTERNAL; } else if (sResetReason & POWER_RESETREAS_DOG_Msk) { - reason = kPlatResetReason_Watchdog; + reason = OT_PLAT_RESET_REASON_WATCHDOG; } else if (sResetReason & POWER_RESETREAS_SREQ_Msk) { - reason = kPlatResetReason_Software; + reason = OT_PLAT_RESET_REASON_SOFTWARE; } else if (sResetReason & POWER_RESETREAS_LOCKUP_Msk) { - reason = kPlatResetReason_Fault; + reason = OT_PLAT_RESET_REASON_FAULT; } else if ((sResetReason & POWER_RESETREAS_OFF_Msk) || (sResetReason & POWER_RESETREAS_LPCOMP_Msk) || @@ -90,11 +90,11 @@ otPlatResetReason otPlatGetResetReason(otInstance *aInstance) (sResetReason & POWER_RESETREAS_NFC_Msk) || (sResetReason & POWER_RESETREAS_VBUS_Msk)) { - reason = kPlatResetReason_Other; + reason = OT_PLAT_RESET_REASON_OTHER; } else { - reason = kPlatResetReason_PowerOn; + reason = OT_PLAT_RESET_REASON_POWER_ON; } return reason; diff --git a/examples/platforms/posix/misc.c b/examples/platforms/posix/misc.c index 2b833bb55..9543549b7 100644 --- a/examples/platforms/posix/misc.c +++ b/examples/platforms/posix/misc.c @@ -40,7 +40,7 @@ void otPlatReset(otInstance *aInstance) otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { (void)aInstance; - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; } void otPlatWakeHost(void) diff --git a/include/openthread/platform/misc.h b/include/openthread/platform/misc.h index d1e7b5e97..0115c0ec7 100644 --- a/include/openthread/platform/misc.h +++ b/include/openthread/platform/misc.h @@ -69,17 +69,17 @@ void otPlatReset(otInstance *aInstance); */ typedef enum { - kPlatResetReason_PowerOn = 0, - kPlatResetReason_External = 1, - kPlatResetReason_Software = 2, - kPlatResetReason_Fault = 3, - kPlatResetReason_Crash = 4, - kPlatResetReason_Assert = 5, - kPlatResetReason_Other = 6, - kPlatResetReason_Unknown = 7, - kPlatResetReason_Watchdog = 8, + OT_PLAT_RESET_REASON_POWER_ON = 0, + OT_PLAT_RESET_REASON_EXTERNAL = 1, + OT_PLAT_RESET_REASON_SOFTWARE = 2, + OT_PLAT_RESET_REASON_FAULT = 3, + OT_PLAT_RESET_REASON_CRASH = 4, + OT_PLAT_RESET_REASON_ASSERT = 5, + OT_PLAT_RESET_REASON_OTHER = 6, + OT_PLAT_RESET_REASON_UNKNOWN = 7, + OT_PLAT_RESET_REASON_WATCHDOG = 8, - kPlatResetReason_Count, + OT_PLAT_RESET_REASON_COUNT, } otPlatResetReason; /** diff --git a/src/ncp/ncp_base.cpp b/src/ncp/ncp_base.cpp index 6ea7d30e0..b62f80aec 100644 --- a/src/ncp/ncp_base.cpp +++ b/src/ncp/ncp_base.cpp @@ -479,28 +479,28 @@ static spinel_status_t ResetReasonToSpinelStatus(otPlatResetReason reason) spinel_status_t ret; switch (reason) { - case kPlatResetReason_PowerOn: + case OT_PLAT_RESET_REASON_POWER_ON: ret = SPINEL_STATUS_RESET_POWER_ON; break; - case kPlatResetReason_External: + case OT_PLAT_RESET_REASON_EXTERNAL: ret = SPINEL_STATUS_RESET_EXTERNAL; break; - case kPlatResetReason_Software: + case OT_PLAT_RESET_REASON_SOFTWARE: ret = SPINEL_STATUS_RESET_SOFTWARE; break; - case kPlatResetReason_Fault: + case OT_PLAT_RESET_REASON_FAULT: ret = SPINEL_STATUS_RESET_FAULT; break; - case kPlatResetReason_Crash: + case OT_PLAT_RESET_REASON_CRASH: ret = SPINEL_STATUS_RESET_CRASH; break; - case kPlatResetReason_Assert: + case OT_PLAT_RESET_REASON_ASSERT: ret = SPINEL_STATUS_RESET_ASSERT; break; - case kPlatResetReason_Watchdog: + case OT_PLAT_RESET_REASON_WATCHDOG: ret = SPINEL_STATUS_RESET_WATCHDOG; break; - case kPlatResetReason_Other: + case OT_PLAT_RESET_REASON_OTHER: ret = SPINEL_STATUS_RESET_OTHER; break; default: diff --git a/tests/unit/test_platform.cpp b/tests/unit/test_platform.cpp index 38309c608..90b8c2837 100644 --- a/tests/unit/test_platform.cpp +++ b/tests/unit/test_platform.cpp @@ -415,7 +415,7 @@ exit: otPlatResetReason otPlatGetResetReason(otInstance *aInstance) { (void)aInstance; - return kPlatResetReason_PowerOn; + return OT_PLAT_RESET_REASON_POWER_ON; } void otPlatLog(otLogLevel, otLogRegion, const char *, ...)