VSF Documented
wdt.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __HAL_DRIVER_${SERIES/WDT_IP}_WDT_H__
19#define __HAL_DRIVER_${SERIES/WDT_IP}_WDT_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_WDT == ENABLED
26
27// HW/IPCore
32// HW/IPCore end
33
34#include "../../__device.h"
35
36/*\note Refer to template/README.md for usage cases.
37 * For peripheral drivers, blackbox mode is recommended but not required, reimplementation part MUST be open.
38 * For IPCore drivers, class structure, MULTI_CLASS configuration, reimplementation and class APIs should be open to user.
39 * For emulated drivers, **** No reimplementation ****.
40 */
41
42/*\note Includes CAN ONLY be put here. */
43/*\note If current header is for a peripheral driver(hw driver), and inherit from an IPCore driver, include IPCore header here. */
44
45// IPCore
46#if defined(__VSF_HAL_${WDT_IP}_WDT_CLASS_IMPLEMENT)
47# define __VSF_CLASS_IMPLEMENT__
48#elif defined(__VSF_HAL_${WDT_IP}_WDT_CLASS_INHERIT__)
49# define __VSF_CLASS_INHERIT__
50#endif
51
52#include "utilities/ooc_class.h"
53// IPCore end
54
55#ifdef __cplusplus
56extern "C" {
57#endif
58
59/*============================ MACROS ========================================*/
60
61/*\note VSF_${WDT_IP}_WDT_CFG_MULTI_CLASS should be implemented for IP drives and open to user,
62 * while VSF_HW_WDT_CFG_MULTI_CLASS should be in wdt.c.
63 */
64
65// IPCore
66#ifndef VSF_${WDT_IP}_WDT_CFG_MULTI_CLASS
67# define VSF_${WDT_IP}_WDT_CFG_MULTI_CLASS VSF_WDT_CFG_MULTI_CLASS
68#endif
69// IPCore end
70
71// HW
72/*\note hw WDT driver can reimplement following types:
73 * To enable reimplementation, please enable macro below:
74 * VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE for vsf_wdt_mode_t
75 * VSF_WDT_CFG_REIMPLEMENT_TYPE_IRQ_MASK for vsf_wdt_irq_mask_t
76 * VSF_WDT_CFG_REIMPLEMENT_TYPE_CTRL for vsf_wdt_ctrl_t
77 * VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG for vsf_wdt_cfg_t
78 * VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY for vsf_wdt_capability_t
79 * Reimplementation is used for optimization hw/IPCore drivers, reimplement the bit mask according to hw registers.
80 * *** DO NOT reimplement these in emulated drivers. ***
81 */
82
83#define VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE ENABLED
84#define VSF_WDT_CFG_REIMPLEMENT_TYPE_IRQ_MASK ENABLED
85#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CTRL ENABLED
86#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG ENABLED
87#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY ENABLED
88// HW end
89
90/*============================ MACROFIED FUNCTIONS ===========================*/
91/*============================ TYPES =========================================*/
92
93// IPCore
94vsf_class(vsf_${wdt_ip}_wdt_t) {
95#if VSF_${WDT_IP}_CFG_MULTI_CLASS == ENABLED
96 public_member(
97 vsf_wdt_t vsf_wdt;
98 )
99#endif
100
101/*\note You can add more member in vsf_${wdt_ip}_wdt_t instance.
102 * For members accessible from child, put in protected_member.
103 * Else, put in private_member.
104 */
105
106 protected_member(
107 vsf_${wdt_ip}_wdt_reg_t *reg;
110};
111// IPCore end
112
113// HW/IPCore, not for emulated drivers
114#if VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE == ENABLED
115typedef enum vsf_wdt_mode_t {
121
122 // more vendor specified modes can be added here
124#endif
125
126#if VSF_WDT_CFG_REIMPLEMENT_TYPE_IRQ_MASK == ENABLED
127typedef enum vsf_wdt_irq_mask_t {
129
130 // more vendor specified irq_masks can be added here
132#endif
133
134#if VSF_WDT_CFG_REIMPLEMENT_TYPE_CTRL == ENABLED
135typedef enum vsf_wdt_ctrl_t {
137
138 // more vendor specified ctrl can be added here
140#endif
141
142#if VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG == ENABLED
143typedef struct vsf_wdt_t vsf_wdt_t;
144typedef void vsf_wdt_isr_handler_t(void *target_ptr, vsf_wdt_t *wdt_ptr);
145typedef struct vsf_wdt_isr_t {
147 void *target_ptr;
150typedef struct vsf_wdt_cfg_t {
156#endif
157
158#if VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY == ENABLED
159typedef struct vsf_wdt_capability_t {
167
168 // more vendor specified capability can be added here
170#endif
171// HW/IPCore end
172
173
174/*============================ INCLUDES ======================================*/
175
176// IPCore
177/*\note Extern APIs for ip core diriver.
178 * There is no requirement about how APIs of IPCore drivers should be implemented.
179 * Just consider the simplicity for actual peripheral drivers.
180 */
181// IPCore end
182
183#ifdef __cplusplus
184}
185#endif
186
187// IPCore
188#undef __VSF_HAL_${WDT_IP}_WDT_CLASS_IMPLEMENT
189#undef __VSF_HAL_${WDT_IP}_WDT_CLASS_INHERIT__
190// IPCore end
191
192#endif // VSF_HAL_USE_WDT
193#endif // __HAL_DRIVER_${SERIES/WDT_IP}_WDT_H__
194/* EOF */
vsf_wdt_mode_t
Definition wdt.h:31
@ VSF_WDT_MODE_RESET_SOC
Definition wdt.h:36
@ VSF_WDT_MODE_NO_EARLY_WAKEUP
Definition wdt.h:32
@ VSF_WDT_MODE_RESET_CPU
Definition wdt.h:37
@ VSF_WDT_MODE_RESET_NONE
Definition wdt.h:38
@ VSF_WDT_MODE_EARLY_WAKEUP
Definition wdt.h:33
Definition adc.h:94
vsf_arch_prio_t
Definition cortex_a_generic.h:88
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
Predefined VSF WDT capability that can be reimplemented in specific hal drivers. The vsf_wdt_capabili...
Definition vsf_template_wdt.h:329
uint8_t support_reset_soc
Indicates if SoC reset mode is supported.
Definition vsf_template_wdt.h:337
uint8_t support_disable
Indicates if WDT can be disabled after startup.
Definition vsf_template_wdt.h:338
uint8_t support_reset_none
Definition wdt.h:161
uint8_t support_early_wakeup
Definition wdt.h:160
uint8_t support_reset_cpu
Indicates if core reset mode is supported.
Definition vsf_template_wdt.h:336
uint32_t max_timeout_ms
Maximum timeout in milliseconds.
Definition vsf_template_wdt.h:340
uint8_t support_min_timeout
Indicates if minimum timeout is supported.
Definition vsf_template_wdt.h:339
WDT configuration structure.
Definition vsf_template_wdt.h:310
vsf_wdt_mode_t mode
WDT mode, refer to vsf_wdt_mode_t.
Definition vsf_template_wdt.h:311
uint32_t min_ms
Minimum timeout in milliseconds.
Definition vsf_template_wdt.h:313
uint32_t max_ms
Maximum timeout in milliseconds.
Definition vsf_template_wdt.h:312
vsf_wdt_isr_t isr
WDT interrupt configuration, refer to vsf_wdt_isr_t.
Definition vsf_template_wdt.h:314
WDT interrupt configuration structure.
Definition vsf_template_wdt.h:297
vsf_wdt_isr_handler_t * handler_fn
Interrupt handler function pointer.
Definition vsf_template_wdt.h:298
void * target_ptr
User-defined target pointer.
Definition vsf_template_wdt.h:299
vsf_arch_prio_t prio
Interrupt priority.
Definition vsf_template_wdt.h:300
WDT instance structure, used for WDT Multi Class support, not needed in non Multi Class mode.
Definition vsf_template_wdt.h:362
vsf_wdt_irq_mask_t
Definition wdt.h:127
@ VSF_WDT_IRQ_MASK_OVERFLOW
Definition wdt.h:128
vsf_wdt_isr_t isr
Definition wdt.h:109
void vsf_wdt_isr_handler_t(void *target_ptr, vsf_wdt_t *wdt_ptr)
Definition wdt.h:144
class vsf_$ * reg
vsf_wdt_ctrl_t
Definition wdt.h:135
@ __VSF_WDT_CTRL_DUMMY
Definition wdt.h:136
Generated from commit: vsfteam/vsf@2b286be