Hi XiangJun Rong,
thank you for your answer.
You are wrong again. --> the source-code in your anwer doesn't use any of my mentioned values "RCM_SRSy_xxx".
I use RCM_GetPreviousResetSources() in "fsl_rcm.h" to determine the last reset source.
Demo source is KSDK_2.0\boards\twrk64f120m\driver_examples\wdog\iar.
out of "fsl_rcm.h" -->
* Example:
@code
uint32_t resetStatus;
resetStatus = RCM_GetPreviousResetSources(RCM) & kRCM_SourceAll;
resetStatus = RCM_GetPreviousResetSources(RCM) & kRCM_SourceWdog;
resetStatus = RCM_GetPreviousResetSources(RCM) & (kRCM_SourceWdog | kRCM_SourcePin);
@endcode
*
* @param base RCM peripheral base address.
* @return All reset source status bit map.
*/
static inline uint32_t RCM_GetPreviousResetSources(RCM_Type *base)
{
#if (defined(FSL_FEATURE_RCM_REG_WIDTH) && (FSL_FEATURE_RCM_REG_WIDTH == 32))
return base->SRS;
#else
return (uint32_t)((uint32_t)base->SRS0 | ((uint32_t)base->SRS1 << 8U));
#endif
}
Here is the second (else - case) Definition used.
When I try to get the reason for last reset, the SRS1 - values from "MK64F12.h" need to be shifted in "fsl_rcm.h";
original:
#if (defined(FSL_FEATURE_RCM_HAS_JTAG) && FSL_FEATURE_RCM_HAS_JTAG)
kRCM_SourceJtag = RCM_SRS1_JTAG_MASK << 8U,
#endif
kRCM_SourceLockup = RCM_SRS1_LOCKUP_MASK << 8U,
kRCM_SourceSw = RCM_SRS1_SW_MASK,
#if (defined(FSL_FEATURE_RCM_HAS_MDM_AP) && FSL_FEATURE_RCM_HAS_MDM_AP)
kRCM_SourceMdmap = RCM_SRS1_MDM_AP_MASK << 8U,
#endif
#if (defined(FSL_FEATURE_RCM_HAS_EZPORT) && FSL_FEATURE_RCM_HAS_EZPORT)
kRCM_SourceEzpt = RCM_SRS1_EZPT_MASK << 8U,
#endif
the corrected line must be:
kRCM_SourceSw = RCM_SRS1_SW_MASK << 8,
--> just
.. and say that I'm right.
Best regards
Manfred