VSF Documented
Data Structures | Macros | Typedefs | Enumerations | Functions
vsf_template_wdt.h File Reference
#include "./vsf_template_hal_driver.h"
#include "hal/arch/vsf_arch.h"

Go to the source code of this file.

Data Structures

struct  vsf_wdt_isr_t
 WDT interrupt configuration structure. More...
 
struct  vsf_wdt_cfg_t
 WDT configuration structure. More...
 
struct  vsf_wdt_capability_t
 Predefined VSF WDT capability that can be reimplemented in specific hal drivers. The vsf_wdt_capability_t structure defines the features supported by the WDT hardware. When reimplementing this structure, all existing members must be preserved. More...
 
struct  vsf_wdt_op_t
 WDT operation function pointer type, used for WDT Multi Class support. More...
 
struct  vsf_wdt_t
 WDT instance structure, used for WDT Multi Class support, not needed in non Multi Class mode. More...
 

Macros

#define VSF_WDT_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_WDT_CFG_PREFIX   vsf
 We can redefine macro VSF_WDT_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code. Example:
 
#define VSF_WDT_CFG_FUNCTION_RENAME   ENABLED
 After define VSF_WDT_CFG_FUNCTION_RENAME to DISABLED, calling any vsf_wdt_xxx() function will not be renamed. It has higher priority than VSF_WDT_CFG_PREFIX.
 
#define VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE   DISABLED
 In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE to redefine enum vsf_wdt_mode_t.
 
#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG to redefine struct vsf_wdt_cfg_t. For compatibility, members should not be deleted when redefining it.
 
#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY to redefine struct vsf_wdt_capability_t. For compatibility, members should not be deleted when redefining it.
 
#define VSF_WDT_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 In specific hardware driver, we can enable macro VSF_WDT_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t.
 
#define VSF_WDT_APIS(__prefix)
 WDT API template, used to generate WDT type, specific prefix function declarations, etc.
 

Typedefs

typedef enum vsf_wdt_mode_t vsf_wdt_mode_t
 Predefined VSF WDT modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:
 
typedef struct vsf_wdt_t vsf_wdt_t
 WDT forward declaration.
 
typedef void vsf_wdt_isr_handler_t(void *target_ptr, vsf_wdt_t *wdt_ptr)
 WDT interrupt handler type declaration.
 
typedef struct vsf_wdt_isr_t vsf_wdt_isr_t
 WDT interrupt configuration structure.
 
typedef struct vsf_wdt_cfg_t vsf_wdt_cfg_t
 WDT configuration structure.
 
typedef struct vsf_wdt_capability_t vsf_wdt_capability_t
 Predefined VSF WDT capability that can be reimplemented in specific hal drivers. The vsf_wdt_capability_t structure defines the features supported by the WDT hardware. When reimplementing this structure, all existing members must be preserved.
 
typedef struct vsf_wdt_op_t vsf_wdt_op_t
 WDT operation function pointer type, used for WDT Multi Class support.
 

Enumerations

enum  vsf_wdt_mode_t {
  VSF_WDT_MODE_NO_EARLY_WAKEUP = (0 << 0) ,
  VSF_WDT_MODE_EARLY_WAKEUP = (1 << 0) ,
  VSF_WDT_MODE_RESET_NONE = (0 << 1) ,
  VSF_WDT_MODE_RESET_CPU = (1 << 1) ,
  VSF_WDT_MODE_RESET_SOC = (2 << 1)
}
 Predefined VSF WDT modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver: More...
 
enum  {
  VSF_WDT_MODE_EARLY_WAKEUP_MASK ,
  VSF_WDT_MODE_RESET_MASK ,
  VSF_WDT_MODE_ALL_BITS_MASK
}
 WDT mode completion, used to simplify the definition of WDT mode. More...
 

Functions

vsf_err_t vsf_wdt_init (vsf_wdt_t *wdt_ptr, vsf_wdt_cfg_t *cfg_ptr)
 Initialize a WDT instance.
 
void vsf_wdt_fini (vsf_wdt_t *wdt_ptr)
 Finalize a WDT instance.
 
fsm_rt_t vsf_wdt_enable (vsf_wdt_t *wdt_ptr)
 Enable a WDT instance.
 
fsm_rt_t vsf_wdt_disable (vsf_wdt_t *wdt_ptr)
 Disable a WDT instance.
 
vsf_wdt_capability_t vsf_wdt_capability (vsf_wdt_t *wdt_ptr)
 Get the capability of WDT instance.
 
void vsf_wdt_feed (vsf_wdt_t *wdt_ptr)
 WDT feed operation.
 

Macro Definition Documentation

◆ VSF_WDT_CFG_MULTI_CLASS

#define VSF_WDT_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_WDT_CFG_PREFIX

#define VSF_WDT_CFG_PREFIX   vsf

We can redefine macro VSF_WDT_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code. Example:

#define VSF_WDT_CFG_PREFIX my_device // Use my device hardware WDT driver
vsf_wdt_init() // Will be expanded to my_device_wdt_init()
vsf_err_t vsf_wdt_init(vsf_wdt_t *wdt_ptr, vsf_wdt_cfg_t *cfg_ptr)
Initialize a WDT instance.
Definition wdt_common.c:38
Note
This macro is only valid when VSF_WDT_CFG_FUNCTION_RENAME is ENABLED.

◆ VSF_WDT_CFG_FUNCTION_RENAME

#define VSF_WDT_CFG_FUNCTION_RENAME   ENABLED

After define VSF_WDT_CFG_FUNCTION_RENAME to DISABLED, calling any vsf_wdt_xxx() function will not be renamed. It has higher priority than VSF_WDT_CFG_PREFIX.

◆ VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE

#define VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE   DISABLED

In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_MODE to redefine enum vsf_wdt_mode_t.

◆ VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_CFG to redefine struct vsf_wdt_cfg_t. For compatibility, members should not be deleted when redefining it.

◆ VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

In specific hardware driver, we can enable macro VSF_WDT_CFG_REIMPLEMENT_TYPE_CAPABILITY to redefine struct vsf_wdt_capability_t. For compatibility, members should not be deleted when redefining it.

◆ VSF_WDT_CFG_INHERIT_HAL_CAPABILITY

#define VSF_WDT_CFG_INHERIT_HAL_CAPABILITY   ENABLED

In specific hardware driver, we can enable macro VSF_WDT_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t.

◆ VSF_WDT_APIS

#define VSF_WDT_APIS (   __prefix)
Value:
__VSF_HAL_TEMPLATE_API(__prefix, vsf_err_t, wdt, init, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr, vsf_wdt_cfg_t *cfg_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix, void, wdt, fini, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix, fsm_rt_t, wdt, enable, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix, fsm_rt_t, wdt, disable, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix, vsf_wdt_capability_t, wdt, capability, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix, void, wdt, feed, VSF_MCONNECT(__prefix, _wdt_t) *wdt_ptr)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_FLASH_CFG_IMP_PREFIX, _flash_t)
Definition flash.c:53
__le16 capability
Definition ieee80211.h:134
Predefined VSF WDT capability that can be reimplemented in specific hal drivers. The vsf_wdt_capabili...
Definition vsf_template_wdt.h:329
WDT configuration structure.
Definition vsf_template_wdt.h:310
fsm_rt_t
Definition vsf_fsm.h:315
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:57

WDT API template, used to generate WDT type, specific prefix function declarations, etc.

Parameters
[in]__prefixThe prefix used for generating WDT functions.

Typedef Documentation

◆ vsf_wdt_mode_t

Predefined VSF WDT modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:

  • VSF_WDT_MODE_NO_EARLY_WAKEUP
  • VSF_WDT_MODE_EARLY_WAKEUP
  • VSF_WDT_MODE_RESET_NONE
  • VSF_WDT_MODE_RESET_CPU
  • VSF_WDT_MODE_RESET_SOC

In specific drivers, we can implement optional modes. Optional modes require the driver to provide one or more enumeration options, and provide macros with the same name (users can determine whether to support the mode at compile time). If these options are N to 1, the corresponding MASK option is also required (users can select different modes at runtime).

◆ vsf_wdt_t

typedef struct vsf_wdt_t vsf_wdt_t

WDT forward declaration.

◆ vsf_wdt_isr_handler_t

typedef void vsf_wdt_isr_handler_t(void *target_ptr, vsf_wdt_t *wdt_ptr)

WDT interrupt handler type declaration.

Parameters
[in,out]target_ptruser defined target pointer
[in,out]wdt_ptrvsf_wdt_t watchdog timer structure pointer

◆ vsf_wdt_isr_t

typedef struct vsf_wdt_isr_t vsf_wdt_isr_t

WDT interrupt configuration structure.

◆ vsf_wdt_cfg_t

typedef struct vsf_wdt_cfg_t vsf_wdt_cfg_t

WDT configuration structure.

◆ vsf_wdt_capability_t

Predefined VSF WDT capability that can be reimplemented in specific hal drivers. The vsf_wdt_capability_t structure defines the features supported by the WDT hardware. When reimplementing this structure, all existing members must be preserved.

◆ vsf_wdt_op_t

typedef struct vsf_wdt_op_t vsf_wdt_op_t

WDT operation function pointer type, used for WDT Multi Class support.

Enumeration Type Documentation

◆ vsf_wdt_mode_t

Predefined VSF WDT modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:

  • VSF_WDT_MODE_NO_EARLY_WAKEUP
  • VSF_WDT_MODE_EARLY_WAKEUP
  • VSF_WDT_MODE_RESET_NONE
  • VSF_WDT_MODE_RESET_CPU
  • VSF_WDT_MODE_RESET_SOC

In specific drivers, we can implement optional modes. Optional modes require the driver to provide one or more enumeration options, and provide macros with the same name (users can determine whether to support the mode at compile time). If these options are N to 1, the corresponding MASK option is also required (users can select different modes at runtime).

Enumerator
VSF_WDT_MODE_NO_EARLY_WAKEUP 

No early wakeup.

VSF_WDT_MODE_EARLY_WAKEUP 

Early wakeup.

VSF_WDT_MODE_RESET_NONE 

No reset when timeout.

VSF_WDT_MODE_RESET_CPU 

Reset CPU when timeout.

VSF_WDT_MODE_RESET_SOC 

Reset SOC when timeout.

◆ anonymous enum

anonymous enum

WDT mode completion, used to simplify the definition of WDT mode.

Enumerator
VSF_WDT_MODE_EARLY_WAKEUP_MASK 

early wakeup mask

VSF_WDT_MODE_RESET_MASK 

reset mask

VSF_WDT_MODE_ALL_BITS_MASK 

Function Documentation

◆ vsf_wdt_init()

vsf_err_t vsf_wdt_init ( vsf_wdt_t wdt_ptr,
vsf_wdt_cfg_t cfg_ptr 
)
extern

Initialize a WDT instance.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
[in]cfg_ptra pointer to structure vsf_wdt_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if WDT was initialized, or a negative error code
Note
It is not necessary to call vsf_wdt_fini() for deinitialization. vsf_wdt_init() should be called before any other WDT API except vsf_wdt_capability().

◆ vsf_wdt_fini()

void vsf_wdt_fini ( vsf_wdt_t wdt_ptr)
extern

Finalize a WDT instance.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
Returns
none

◆ vsf_wdt_enable()

fsm_rt_t vsf_wdt_enable ( vsf_wdt_t wdt_ptr)
extern

Enable a WDT instance.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
Returns
fsm_rt_t: FSM_RT_CPL if WDT was enabled, fsm_rt_on_going if WDT is still enabling

◆ vsf_wdt_disable()

fsm_rt_t vsf_wdt_disable ( vsf_wdt_t wdt_ptr)
extern

Disable a WDT instance.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
Returns
fsm_rt_t: FSM_RT_CPL if WDT was disabled, fsm_rt_on_going if WDT is still disabling

◆ vsf_wdt_capability()

vsf_wdt_capability_t vsf_wdt_capability ( vsf_wdt_t wdt_ptr)
extern

Get the capability of WDT instance.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
Returns
vsf_wdt_capability_t: all capability of current WDT vsf_wdt_capability_t

◆ vsf_wdt_feed()

void vsf_wdt_feed ( vsf_wdt_t wdt_ptr)
extern

WDT feed operation.

Parameters
[in]wdt_ptra pointer to structure vsf_wdt_t
Generated from commit: vsfteam/vsf@2b286be