wdg_pal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2017-2018 NXP
3  * All rights reserved.
4  *
5  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
6  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
7  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
8  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
9  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
10  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
11  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
12  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
13  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
14  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
15  * THE POSSIBILITY OF SUCH DAMAGE.
16  */
17 
29 #ifndef WDG_PAL_H
30 #define WDG_PAL_H
31 
32 #include "status.h"
33 #include "wdg_pal_mapping.h"
34 #include "wdg_pal_cfg.h"
35 
43 /*******************************************************************************
44  * Variables
45  ******************************************************************************/
46 
47 /*******************************************************************************
48  * Definitions
49  ******************************************************************************/
50 
55 typedef enum
56 {
62 
67 typedef struct
68 {
69  bool wait;
70  bool stop;
71  bool debug;
73 
74 #if defined(WDG_OVER_EWM)
75 
80 typedef enum
81 {
82  WDG_IN_ASSERT_DISABLED = 0x00U,
83  WDG_IN_ASSERT_ON_LOGIC_ZERO = 0x01U,
84  WDG_IN_ASSERT_ON_LOGIC_ONE = 0x02U
85 } wdg_in_assert_logic_t;
86 
91 typedef struct
92 {
93  wdg_in_assert_logic_t assertLogic;
94  uint8_t prescalerValue;
95 } extension_ewm_for_wdg_t;
96 #endif /* defined(WDG_OVER_EWM) */
97 
102 typedef struct
103 {
106  uint32_t timeoutValue;
107  uint8_t percentWindow;
108  bool intEnable;
109  bool winEnable;
111 #if defined(WDG_OVER_EWM)
112  void *extension;
113 #endif
114 } wdg_config_t;
115 
116 /*******************************************************************************
117  * API
118  ******************************************************************************/
124 #if defined(__cplusplus)
125 extern "C" {
126 #endif
127 
142 status_t WDG_Init(const wdg_instance_t * const instance,
143  const wdg_config_t * configPtr);
144 
152 void WDG_GetDefaultConfig(wdg_config_t * const config);
153 
161 void WDG_Refresh(const wdg_instance_t * const instance);
162 
174 status_t WDG_Deinit(const wdg_instance_t * const instance);
175 
192 status_t WDG_SetInt(const wdg_instance_t * const instance,
193  bool enable);
194 
207 status_t WDG_SetTimeout(const wdg_instance_t * const instance,
208  uint32_t value);
209 
225 status_t WDG_SetWindow(const wdg_instance_t * const instance,
226  bool enable,
227  uint32_t value);
228 
243 status_t WDG_GetCounter(const wdg_instance_t * const instance,
244  uint32_t * value);
245 
253 void WDG_ClearIntFlag(const wdg_instance_t * const instance);
254 
257 #if defined(__cplusplus)
258 }
259 #endif
260 
263 #endif /* WDG_PAL_H */
264 /*******************************************************************************
265  * EOF
266  ******************************************************************************/
void WDG_Refresh(const wdg_instance_t *const instance)
Refreshes the WDG PAL counter.
Definition: wdg_pal.c:246
WDG PAL configuration structure Implements : wdg_config_t_Class.
Definition: wdg_pal.h:102
wdg_clock_source_t clkSource
Definition: wdg_pal.h:104
wdg_clock_source_t
Clock sources for the WDG PAL. Implements : wdg_clock_source_t_Class.
Definition: wdg_pal.h:55
Structure storing PAL instance information.
bool winEnable
Definition: wdg_pal.h:109
status_t WDG_SetInt(const wdg_instance_t *const instance, bool enable)
Set interrupt for WDG PAL.
Definition: wdg_pal.c:319
uint32_t timeoutValue
Definition: wdg_pal.h:106
status_t WDG_Deinit(const wdg_instance_t *const instance)
De-initializes the WDG PAL.
Definition: wdg_pal.c:285
status_t WDG_SetWindow(const wdg_instance_t *const instance, bool enable, uint32_t value)
Set window mode and window value of the WDG PAL.
Definition: wdg_pal.c:389
wdg_option_mode_t opMode
Definition: wdg_pal.h:105
status_t
Status return codes. Common error codes will be a unified enumeration (C enum) that will contain all ...
Definition: status.h:44
bool intEnable
Definition: wdg_pal.h:108
status_t WDG_GetCounter(const wdg_instance_t *const instance, uint32_t *value)
Gets the value of the WDG PAL counter.
Definition: wdg_pal.c:427
status_t WDG_Init(const wdg_instance_t *const instance, const wdg_config_t *configPtr)
Initializes the WDG PAL.
Definition: wdg_pal.c:83
bool prescalerEnable
Definition: wdg_pal.h:110
status_t WDG_SetTimeout(const wdg_instance_t *const instance, uint32_t value)
Sets the value of the WDG PAL timeout.
Definition: wdg_pal.c:354
void WDG_ClearIntFlag(const wdg_instance_t *const instance)
Clears the Timeout Interrupt Flag.
Definition: wdg_pal.c:471
void WDG_GetDefaultConfig(wdg_config_t *const config)
Gets default configuration of the WDG PAL.
Definition: wdg_pal.c:209
WDG PAL option mode configuration structure Implements : wdg_option_mode_t_Class. ...
Definition: wdg_pal.h:67
uint8_t percentWindow
Definition: wdg_pal.h:107