HPM SDK
HPMicro Software Development Kit
hpm_ewdg_drv.c File Reference
#include "hpm_ewdg_drv.h"

Macros

#define EWDG_CTRL_REG_PARITY_BIT_MASK   (1UL << 31)
 
#define EWDG_CTRL_DIV_VAL_MAX   (EWDG_CTRL0_DIV_VALUE_MASK >> EWDG_CTRL0_DIV_VALUE_SHIFT)
 
#define EWDG_CTRL_WIN_UPPER_MAX   (EWDG_CTRL0_WIN_UPPER_MASK >> EWDG_CTRL0_WIN_UPPER_SHIFT)
 
#define EWDG_CTRL_REG_UPDATE_PERIOD_DEFAULT   (4UL) /* 512 Bus clock */
 
#define EWDG_RING_LEFT_SHIFT_1(val)   (((uint16_t)(val) << 1) | ((uint16_t)(val) >> 15))
 
#define EWDG_REFRESH_PERIOD_DEFAULT   (10000U)
 
#define EWDG_INTERRUPT_TIMEOUT_TICKS_DEFAULT   (0UL)
 
#define EWDG_RESET_TIMEOUT_TICKS_DEFAULT   (65535UL)
 
#define EWDG_TIMEOUT_TICK_MAX   (0xFFFFFFFFUL)
 

Functions

static bool ewdg_need_set_parity_bit (uint32_t reg_val)
 
void ewdg_get_default_config (EWDG_Type *ptr, ewdg_config_t *config)
 Get default configuration for EWDG. More...
 
hpm_stat_t ewdg_init_ctrl_func (EWDG_Type *ptr, ewdg_func_ctrl_config_t *config, uint32_t cnt_src_freq)
 Initialize the Control function for EWDG. More...
 
hpm_stat_t ewdg_init_interrupt_reset (EWDG_Type *ptr, ewdg_interrupt_reset_config_t *config)
 Initialize the Error function for EWDG. More...
 
hpm_stat_t ewdg_init (EWDG_Type *ptr, ewdg_config_t *config)
 Initialize the EWDG module. More...
 
hpm_stat_t ewdg_unlock_refresh (EWDG_Type *ptr)
 Unlock the write to refresh register. More...
 
hpm_stat_t ewdg_refresh (EWDG_Type *ptr)
 Refresh EWDG. More...
 
uint32_t ewdg_get_count_clock_freq (EWDG_Type *ptr, uint32_t src_clk_freq)
 Get the Divided Counter Clock Frequency for EWDG. More...
 
uint64_t ewdg_convert_timeout_us_to_timeout_ticks (uint32_t src_clk_freq, uint32_t timeout_us)
 Convert the timeout in terms of microseconds to the timeout in terms of timeout ticks. More...
 
uint32_t ewdg_convert_timeout_ticks_to_timeout_us (EWDG_Type *ptr, uint32_t src_clk_freq, uint32_t timeout_ticks)
 Convert the timeout in terms of timeout ticks to the timeout in terms of microseconds. More...
 
void ewdg_enable_interrupt (EWDG_Type *ptr, uint32_t mask)
 Enable EWDG interrupt. More...
 
void ewdg_disable_interrupt (EWDG_Type *ptr, uint32_t mask)
 Disable EWDG interrupt. More...
 
void ewdg_enable_reset (EWDG_Type *ptr, uint32_t mask)
 Enable EWDG Reset. More...
 
void ewdg_disable_reset (EWDG_Type *ptr, uint32_t mask)
 Disable EWDG Reset. More...
 
void ewdg_switch_clock_source (EWDG_Type *ptr, ewdg_cnt_clk_sel_t clk_sel)
 Switch the EWDG clock source. More...
 
void ewdg_enable (EWDG_Type *ptr)
 Enable EWDG. More...
 
void ewdg_disable (EWDG_Type *ptr)
 Disable EWDG. More...
 

Macro Definition Documentation

◆ EWDG_CTRL_DIV_VAL_MAX

#define EWDG_CTRL_DIV_VAL_MAX   (EWDG_CTRL0_DIV_VALUE_MASK >> EWDG_CTRL0_DIV_VALUE_SHIFT)

◆ EWDG_CTRL_REG_PARITY_BIT_MASK

#define EWDG_CTRL_REG_PARITY_BIT_MASK   (1UL << 31)

Parity bit for Control Register

◆ EWDG_CTRL_REG_UPDATE_PERIOD_DEFAULT

#define EWDG_CTRL_REG_UPDATE_PERIOD_DEFAULT   (4UL) /* 512 Bus clock */

◆ EWDG_CTRL_WIN_UPPER_MAX

#define EWDG_CTRL_WIN_UPPER_MAX   (EWDG_CTRL0_WIN_UPPER_MASK >> EWDG_CTRL0_WIN_UPPER_SHIFT)

◆ EWDG_INTERRUPT_TIMEOUT_TICKS_DEFAULT

#define EWDG_INTERRUPT_TIMEOUT_TICKS_DEFAULT   (0UL)

◆ EWDG_REFRESH_PERIOD_DEFAULT

#define EWDG_REFRESH_PERIOD_DEFAULT   (10000U)

◆ EWDG_RESET_TIMEOUT_TICKS_DEFAULT

#define EWDG_RESET_TIMEOUT_TICKS_DEFAULT   (65535UL)

◆ EWDG_RING_LEFT_SHIFT_1

#define EWDG_RING_LEFT_SHIFT_1 (   val)    (((uint16_t)(val) << 1) | ((uint16_t)(val) >> 15))

◆ EWDG_TIMEOUT_TICK_MAX

#define EWDG_TIMEOUT_TICK_MAX   (0xFFFFFFFFUL)

Function Documentation

◆ ewdg_need_set_parity_bit()

static bool ewdg_need_set_parity_bit ( uint32_t  reg_val)
static