11#include "fsl_common.h"
23#define WDOG_FIRST_WORD_OF_UNLOCK (RTWDOG_UPDATE_KEY & 0xFFFFU)
24#define WDOG_SECOND_WORD_OF_UNLOCK ((RTWDOG_UPDATE_KEY >> 16U) & 0xFFFFU)
29#define WDOG_FIRST_WORD_OF_REFRESH (RTWDOG_REFRESH_KEY & 0xFFFFU)
30#define WDOG_SECOND_WORD_OF_REFRESH ((RTWDOG_REFRESH_KEY >> 16U) & 0xFFFFU)
35#define FSL_RTWDOG_DRIVER_VERSION (MAKE_VERSION(2, 1, 2))
111#if defined(__cplusplus)
165#if defined(DOXYGEN_OUTPUT) && DOXYGEN_OUTPUT
199 base->CS |= RTWDOG_CS_EN_MASK;
211static inline void RTWDOG_Disable(
RTWDOG_Type *base)
213 base->CS &= ~RTWDOG_CS_EN_MASK;
228static inline void RTWDOG_EnableInterrupts(
RTWDOG_Type *base, uint32_t mask)
245static inline void RTWDOG_DisableInterrupts(
RTWDOG_Type *base, uint32_t mask)
265static inline uint32_t RTWDOG_GetStatusFlags(
RTWDOG_Type *base)
267 return (base->CS & (RTWDOG_CS_EN_MASK | RTWDOG_CS_FLG_MASK));
276static inline void RTWDOG_EnableWindowMode(
RTWDOG_Type *base,
bool enable)
280 base->CS |= RTWDOG_CS_WIN_MASK;
284 base->CS &= ~RTWDOG_CS_WIN_MASK;
298static inline uint32_t RTWDOG_CountToMesec(
RTWDOG_Type *base, uint32_t count, uint32_t clockFreqInHz)
300 if ((base->CS & RTWDOG_CS_PRES_MASK) != 0U)
302 clockFreqInHz /= 256U;
304 return count * 1000U / clockFreqInHz;
333static inline void RTWDOG_SetTimeoutValue(
RTWDOG_Type *base, uint16_t timeoutCount)
335 base->TOVAL = timeoutCount;
348static inline void RTWDOG_SetWindowValue(
RTWDOG_Type *base, uint16_t windowValue)
350 base->WIN = windowValue;
366 if (((base->CS) & RTWDOG_CS_CMD32EN_MASK) != 0U)
368 base->CNT = RTWDOG_UPDATE_KEY;
375 while ((base->CS & RTWDOG_CS_ULK_MASK) == 0U)
388static inline void RTWDOG_Refresh(
RTWDOG_Type *base)
390 uint32_t primaskValue = 0U;
391 primaskValue = DisableGlobalIRQ();
392 if (((base->CS) & RTWDOG_CS_CMD32EN_MASK) != 0U)
394 base->CNT = RTWDOG_REFRESH_KEY;
401 EnableGlobalIRQ(primaskValue);
412static inline uint16_t RTWDOG_GetCounterValue(
RTWDOG_Type *base)
414 return (uint16_t)base->CNT;
419#if defined(__cplusplus)
enum _rtwdog_clock_source rtwdog_clock_source_t
Describes RTWDOG clock source.
#define WDOG_FIRST_WORD_OF_REFRESH
Definition: fsl_rtwdog.h:29
bool enableStop
Definition: fsl_rtwdog.h:58
uint16_t windowValue
Definition: fsl_rtwdog.h:82
rtwdog_test_mode_t testMode
Definition: fsl_rtwdog.h:78
rtwdog_work_mode_t workMode
Definition: fsl_rtwdog.h:77
#define WDOG_SECOND_WORD_OF_REFRESH
Definition: fsl_rtwdog.h:30
bool enableWindowMode
Definition: fsl_rtwdog.h:81
enum _rtwdog_test_mode rtwdog_test_mode_t
Describes RTWDOG test mode.
_rtwdog_interrupt_enable_t
RTWDOG interrupt configuration structure.
Definition: fsl_rtwdog.h:92
uint16_t timeoutValue
Definition: fsl_rtwdog.h:83
void RTWDOG_Deinit(RTWDOG_Type *base)
De-initializes the RTWDOG module.
Definition: fsl_rtwdog.c:139
_rtwdog_test_mode
Describes RTWDOG test mode.
Definition: fsl_rtwdog.h:64
void RTWDOG_ClearStatusFlags(RTWDOG_Type *base, uint32_t mask)
Clears the RTWDOG flag.
Definition: fsl_rtwdog.c:34
struct _rtwdog_config rtwdog_config_t
Describes RTWDOG configuration structure.
enum _rtwdog_clock_prescaler rtwdog_clock_prescaler_t
Describes the selection of the clock prescaler.
#define WDOG_FIRST_WORD_OF_UNLOCK
Definition: fsl_rtwdog.h:23
bool enableUpdate
Definition: fsl_rtwdog.h:79
void RTWDOG_GetDefaultConfig(rtwdog_config_t *config)
Initializes the RTWDOG configuration structure.
Definition: fsl_rtwdog.c:65
_rtwdog_clock_prescaler
Describes the selection of the clock prescaler.
Definition: fsl_rtwdog.h:49
_rtwdog_status_flags_t
RTWDOG status flags.
Definition: fsl_rtwdog.h:102
bool enableWait
Definition: fsl_rtwdog.h:57
_rtwdog_clock_source
Describes RTWDOG clock source.
Definition: fsl_rtwdog.h:40
rtwdog_clock_prescaler_t prescaler
Definition: fsl_rtwdog.h:76
bool enableInterrupt
Definition: fsl_rtwdog.h:80
__STATIC_FORCEINLINE void RTWDOG_Unlock(RTWDOG_Type *base)
Unlocks the RTWDOG register written.
Definition: fsl_rtwdog.h:364
rtwdog_clock_source_t clockSource
Definition: fsl_rtwdog.h:75
#define WDOG_SECOND_WORD_OF_UNLOCK
Definition: fsl_rtwdog.h:24
struct _rtwdog_work_mode rtwdog_work_mode_t
Defines RTWDOG work mode.
bool enableRtwdog
Definition: fsl_rtwdog.h:74
bool enableDebug
Definition: fsl_rtwdog.h:59
@ kRTWDOG_InterruptEnable
Definition: fsl_rtwdog.h:93
@ kRTWDOG_TestModeDisabled
Definition: fsl_rtwdog.h:65
@ kRTWDOG_HighByteTest
Definition: fsl_rtwdog.h:68
@ kRTWDOG_LowByteTest
Definition: fsl_rtwdog.h:67
@ kRTWDOG_UserModeEnabled
Definition: fsl_rtwdog.h:66
@ kRTWDOG_ClockPrescalerDivide256
Definition: fsl_rtwdog.h:51
@ kRTWDOG_ClockPrescalerDivide1
Definition: fsl_rtwdog.h:50
@ kRTWDOG_RunningFlag
Definition: fsl_rtwdog.h:103
@ kRTWDOG_InterruptFlag
Definition: fsl_rtwdog.h:104
@ kRTWDOG_ClockSource1
Definition: fsl_rtwdog.h:42
@ kRTWDOG_ClockSource2
Definition: fsl_rtwdog.h:43
@ kRTWDOG_ClockSource0
Definition: fsl_rtwdog.h:41
@ kRTWDOG_ClockSource3
Definition: fsl_rtwdog.h:44
Definition: MIMXRT1052.h:39520
Describes RTWDOG configuration structure.
Definition: fsl_rtwdog.h:73
Defines RTWDOG work mode.
Definition: fsl_rtwdog.h:56
Definition: deflate.c:114