RTEMS 6.1-rc1
fsl_wdog.h
1/*
2 * Copyright (c) 2016, Freescale Semiconductor, Inc.
3 * Copyright 2016-2019 NXP
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 */
8#ifndef _FSL_WDOG_H_
9#define _FSL_WDOG_H_
10
11#include "fsl_common.h"
12
18/*******************************************************************************
19 * Definitions
20 *******************************************************************************/
24#define FSL_WDOG_DRIVER_VERSION (MAKE_VERSION(2, 1, 1))
28#define WDOG_REFRESH_KEY (0xAAAA5555U)
32typedef struct _wdog_work_mode
33{
38
40typedef struct _wdog_config
41{
45 uint16_t timeoutValue;
51
58{
59 kWDOG_InterruptEnable = WDOG_WICR_WIE_MASK
60};
61
68{
69 kWDOG_RunningFlag = WDOG_WCR_WDE_MASK,
70 kWDOG_PowerOnResetFlag = WDOG_WRSR_POR_MASK,
71 kWDOG_TimeoutResetFlag = WDOG_WRSR_TOUT_MASK,
72 kWDOG_SoftwareResetFlag = WDOG_WRSR_SFTW_MASK,
73 kWDOG_InterruptFlag = WDOG_WICR_WTIS_MASK
74};
75
76/*******************************************************************************
77 * API
78 *******************************************************************************/
79
80#if defined(__cplusplus)
81extern "C" {
82#endif /* __cplusplus */
83
110
128void WDOG_Init(WDOG_Type *base, const wdog_config_t *config);
129
138void WDOG_Deinit(WDOG_Type *base);
139
148static inline void WDOG_Enable(WDOG_Type *base)
149{
150 base->WCR |= WDOG_WCR_WDE_MASK;
151}
152
161static inline void WDOG_Disable(WDOG_Type *base)
162{
163 base->WCR &= ~(uint16_t)WDOG_WCR_WDE_MASK;
164}
165
175static inline void WDOG_TriggerSystemSoftwareReset(WDOG_Type *base)
176{
177 base->WCR &= ~(uint16_t)WDOG_WCR_SRS_MASK;
178}
179
191static inline void WDOG_TriggerSoftwareSignal(WDOG_Type *base)
192{
193 base->WCR &= ~(uint16_t)WDOG_WCR_WDA_MASK;
194}
195
207static inline void WDOG_EnableInterrupts(WDOG_Type *base, uint16_t mask)
208{
209 base->WICR |= mask;
210}
211
226uint16_t WDOG_GetStatusFlags(WDOG_Type *base);
227
242void WDOG_ClearInterruptStatus(WDOG_Type *base, uint16_t mask);
243
255static inline void WDOG_SetTimeoutValue(WDOG_Type *base, uint16_t timeoutCount)
256{
257 base->WCR = (base->WCR & (uint16_t)~WDOG_WCR_WT_MASK) | WDOG_WCR_WT(timeoutCount);
258}
259
270static inline void WDOG_SetInterrputTimeoutValue(WDOG_Type *base, uint16_t timeoutCount)
271{
272 base->WICR = (base->WICR & ~(uint16_t)WDOG_WICR_WICT_MASK) | WDOG_WICR_WICT(timeoutCount);
273}
274
283static inline void WDOG_DisablePowerDownEnable(WDOG_Type *base)
284{
285 base->WMCR &= ~(uint16_t)WDOG_WMCR_PDE_MASK;
286}
287
296void WDOG_Refresh(WDOG_Type *base);
299#if defined(__cplusplus)
300}
301#endif /* __cplusplus */
302
305#endif /* _FSL_WDOG_H_ */
#define WDOG_WCR_WT(x)
Definition: MIMXRT1052.h:51055
#define WDOG_WICR_WICT(x)
Definition: MIMXRT1052.h:51109
_wdog_status_flags
WDOG status flags.
Definition: fsl_wdog.h:68
void WDOG_Refresh(WDOG_Type *base)
Refreshes the WDOG timer.
Definition: fsl_wdog.c:205
uint16_t timeoutValue
Definition: fsl_wdog.h:45
bool softwareResetExtension
Definition: fsl_wdog.h:47
uint16_t WDOG_GetStatusFlags(WDOG_Type *base)
Gets the WDOG all reset status flags.
Definition: fsl_wdog.c:162
void WDOG_ClearInterruptStatus(WDOG_Type *base, uint16_t mask)
Clears the WDOG flag.
Definition: fsl_wdog.c:189
bool enableWdog
Definition: fsl_wdog.h:42
void WDOG_Init(WDOG_Type *base, const wdog_config_t *config)
Initializes the WDOG.
Definition: fsl_wdog.c:104
bool enableWait
Definition: fsl_wdog.h:34
_wdog_interrupt_enable
WDOG interrupt configuration structure, default settings all disabled.
Definition: fsl_wdog.h:58
bool enableDebug
Definition: fsl_wdog.h:36
bool enableTimeOutAssert
Definition: fsl_wdog.h:49
bool enableStop
Definition: fsl_wdog.h:35
uint16_t interruptTimeValue
Definition: fsl_wdog.h:46
void WDOG_Deinit(WDOG_Type *base)
Shuts down the WDOG.
Definition: fsl_wdog.c:140
void WDOG_GetDefaultConfig(wdog_config_t *config)
Initializes the WDOG configuration structure.
Definition: fsl_wdog.c:68
bool enableInterrupt
Definition: fsl_wdog.h:44
struct _wdog_work_mode wdog_work_mode_t
Defines WDOG work mode.
wdog_work_mode_t workMode
Definition: fsl_wdog.h:43
bool enablePowerDown
Definition: fsl_wdog.h:48
struct _wdog_config wdog_config_t
Describes WDOG configuration structure.
@ kWDOG_RunningFlag
Definition: fsl_wdog.h:69
@ kWDOG_TimeoutResetFlag
Definition: fsl_wdog.h:71
@ kWDOG_SoftwareResetFlag
Definition: fsl_wdog.h:72
@ kWDOG_InterruptFlag
Definition: fsl_wdog.h:73
@ kWDOG_PowerOnResetFlag
Definition: fsl_wdog.h:70
@ kWDOG_InterruptEnable
Definition: fsl_wdog.h:59
Definition: MIMXRT1052.h:50962
Describes WDOG configuration structure.
Definition: fsl_wdog.h:41
Defines WDOG work mode.
Definition: fsl_wdog.h:33
Definition: deflate.c:114