![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
Data Structures | |
struct | stc_hwwdg_config |
Hardware Watchdog configuration. More... | |
Defines | |
#define | HWWDG_CTL_INTEN (0x01u) |
#define | HWWDG_CTL_RESEN (0x02u) |
#define | HWWDG_MAGIC_WORD_CHK1 (0x38D1AE5Cu) |
#define | HWWDG_MAGIC_WORD_CHK2 (0x7624D1BCu) |
#define | HWWDG_MAGIC_WORD_CHK_RESULT (0xFFFFFFFFu) |
#define | HWWDG_REG_UNLOCK_1 (0x1ACCE551u) |
#define | HWWDG_REG_UNLOCK_2 (0xE5331AAEu) |
Typedefs | |
typedef struct stc_hwwdg_config | stc_hwwdg_config_t |
Hardware Watchdog configuration. | |
Functions | |
void | HwwdgIrqHandler (void) |
Hardware Watchdog Interrupt Handler. | |
en_result_t | Hwwdg_Init (stc_hwwdg_config_t *pstcConfig) |
Initialize Hardware Watchdog. | |
en_result_t | Hwwdg_DeInit (uint32_t u32MagicWord1, uint32_t u32MagicWord2) |
Un-Initialize Hardware Watchdog. | |
en_result_t | Hwwdg_Start (func_ptr_t pfnHwwdgCb) |
Start the Hardware Watchdog. | |
void | Hwwdg_Stop (void) |
Stop the Hardware Watchdog. | |
void | Hwwdg_WriteWdgLoad (uint32_t u32LoadValue) |
Write the load value for Hardware Watchdog. | |
uint32_t | Hwwdg_ReadWdgValue (void) |
Read the count value for Hardware Watchdog. | |
void | Hwwdg_Feed (uint8_t u8ClearPattern1, uint8_t u8ClearPattern2) |
Feed Hardware Watchdog (Call function) | |
void | Hwwdg_EnableDbgBrkWdgCtl (void) |
Enable Debug Break Watchdog Timer Control. | |
void | Hwwdg_DisableDbgBrkWdgCtl (void) |
Disable Debug Break Watchdog Timer Control. | |
static void | Hwwdg_QuickFeed (uint8_t u8ClearPattern1, uint8_t u8ClearPattern2) |
Quickly feed Hardware Watchdog (inline function) | |
Variables | |
static func_ptr_t | pfnHwwdgCallback |
callback function pointer for HW-Wdg Irq |
Provided functions of HWWDG module:
This module has dedicated interrupt callback functions, in which the user has to feed the Hardware Watchdog.
For the Hardware Watchdog Hwwdg_Init() is used for setting the interval time. Hwwdg_Feed() resets the Watchdog timer by a function call. Hwwdg_QuickFeed() does the same, but the code is inline expanded for e.g. time-critical polling loops.
Hwwdg_Init() sets the Hardware Watchdog interval. Hwwdg_DeInit() stops and disables the Hardware Watchdog, if two magic words as parameters are used. Hwwdg_Start() starts interruption and count of the Hardware Watchdog. Hwwdg_Stop() stops interruption and count of the Hardware Watchdog. Hwwdg_WriteWdgLoad() writes load value for the Hardware Watchdog. Hwwdg_ReadWdgValue() reads counter value of the Hardware Watchdog. Hwwdg_Feed() and Hwwdg_QuickFeed() do the same as their correspondig functions for the Software Watchdog, but here are two parameter needed, the 2nd one the inverted value of the 1st. Hwwdg_EnableDbgBrkWdgCtl() continues counting at the tool break. Hwwdg_DisableDbgBrkWdgCtl() stops counting at the tool break.
#define HWWDG_CTL_INTEN (0x01u) |
#define HWWDG_CTL_RESEN (0x02u) |
Definition at line 71 of file hwwdg.c.
Referenced by Hwwdg_Init().
#define HWWDG_MAGIC_WORD_CHK1 (0x38D1AE5Cu) |
Definition at line 74 of file hwwdg.c.
Referenced by Hwwdg_DeInit().
#define HWWDG_MAGIC_WORD_CHK2 (0x7624D1BCu) |
Definition at line 75 of file hwwdg.c.
Referenced by Hwwdg_DeInit().
#define HWWDG_MAGIC_WORD_CHK_RESULT (0xFFFFFFFFu) |
Definition at line 76 of file hwwdg.c.
Referenced by Hwwdg_DeInit().
#define HWWDG_REG_UNLOCK_1 (0x1ACCE551u) |
Definition at line 120 of file hwwdg.h.
Referenced by Hwwdg_DeInit(), Hwwdg_Feed(), Hwwdg_Init(), Hwwdg_QuickFeed(), Hwwdg_Start(), Hwwdg_Stop(), and Hwwdg_WriteWdgLoad().
#define HWWDG_REG_UNLOCK_2 (0xE5331AAEu) |
Definition at line 121 of file hwwdg.h.
Referenced by Hwwdg_DeInit(), Hwwdg_Init(), Hwwdg_Start(), and Hwwdg_Stop().
typedef struct stc_hwwdg_config stc_hwwdg_config_t |
Hardware Watchdog configuration.
en_result_t Hwwdg_DeInit | ( | uint32_t | u32MagicWord1, |
uint32_t | u32MagicWord2 | ||
) |
Un-Initialize Hardware Watchdog.
This function disables and un-initializes the Hardware Watchdog, when the first argument is 0xC72E51A3 and the second agrument 0x89DB2E43. The magic words are together 64-bit wide and have a balanced entropy. (32 zero and 32 one bits)
[in] | u32MagicWord1 | 1st Magic word for disabling (0xC72E51A3) |
[in] | u32MagicWord2 | 2nd Magic word for disabling (0x89DB2E43) |
Ok | disable sucessful |
ErrorInvalidParameter | not diabled => magic word is wrong! |
Definition at line 182 of file hwwdg.c.
References ErrorInvalidParameter, HWWDG_MAGIC_WORD_CHK1, HWWDG_MAGIC_WORD_CHK2, HWWDG_MAGIC_WORD_CHK_RESULT, HWWDG_REG_UNLOCK_1, HWWDG_REG_UNLOCK_2, Ok, PDL_DEFAULT_INTERRUPT_LEVEL, and pfnHwwdgCallback.
void Hwwdg_DisableDbgBrkWdgCtl | ( | void | ) |
void Hwwdg_EnableDbgBrkWdgCtl | ( | void | ) |
void Hwwdg_Feed | ( | uint8_t | u8ClearPattern1, |
uint8_t | u8ClearPattern2 | ||
) |
Feed Hardware Watchdog (Call function)
This function feeds the Hardware Watchdog with the unlock, feed, and lock sequence. Take care of the arbitrary values, because there are not checked for plausibility!
[in] | u8ClearPattern1 | Pattern of arbitrary value |
[in] | u8ClearPattern2 | Inverted arbitrary value |
Definition at line 308 of file hwwdg.c.
References HWWDG_REG_UNLOCK_1.
en_result_t Hwwdg_Init | ( | stc_hwwdg_config_t * | pstcConfig | ) |
Initialize Hardware Watchdog.
[in] | pstcConfig | Pointer to Hardware Watchdog configuration |
Ok | Setup successful |
ErrorInvalidParameter | pstcConfig == NULL |
Definition at line 127 of file hwwdg.c.
References stc_hwwdg_config::bResetEnable, ErrorInvalidParameter, HWWDG_CTL_RESEN, HWWDG_REG_UNLOCK_1, HWWDG_REG_UNLOCK_2, Ok, PDL_IRQ_LEVEL_HWWDG, pfnHwwdgCallback, TRUE, and stc_hwwdg_config::u32LoadValue.
static __INLINE void Hwwdg_QuickFeed | ( | uint8_t | u8ClearPattern1, |
uint8_t | u8ClearPattern2 | ||
) | [static] |
Quickly feed Hardware Watchdog (inline function)
This function feeds the Hardware Watchdog with the unlock, feed, and lock sequence as an inline function for quick execution in polling loops. Take care of the arbitrary values, because there are not checked for plausibility!
[in] | u8ClearPattern1 | Pattern of arbitrary value |
[in] | u8ClearPattern2 | Inverted arbitrary value |
Definition at line 191 of file hwwdg.h.
References HWWDG_REG_UNLOCK_1.
uint32_t Hwwdg_ReadWdgValue | ( | void | ) |
en_result_t Hwwdg_Start | ( | func_ptr_t | pfnHwwdgCb | ) |
Start the Hardware Watchdog.
[in] | pfnHwwdgCb | Pointer to callback function (Can set to NULL) |
Ok | Setup successful |
ErrorOperationInProgress | Hardware Watchdog is active now |
Definition at line 226 of file hwwdg.c.
References ErrorOperationInProgress, HWWDG_REG_UNLOCK_1, HWWDG_REG_UNLOCK_2, Ok, pfnHwwdgCallback, and TRUE.
void Hwwdg_Stop | ( | void | ) |
Stop the Hardware Watchdog.
Definition at line 258 of file hwwdg.c.
References FALSE, HWWDG_REG_UNLOCK_1, HWWDG_REG_UNLOCK_2, and TRUE.
void Hwwdg_WriteWdgLoad | ( | uint32_t | u32LoadValue | ) |
Write the load value for Hardware Watchdog.
[in] | u32LoadValue | Load value |
Definition at line 278 of file hwwdg.c.
References HWWDG_REG_UNLOCK_1.
void HwwdgIrqHandler | ( | void | ) |
Hardware Watchdog Interrupt Handler.
Definition at line 103 of file hwwdg.c.
References pfnHwwdgCallback, and TRUE.
Referenced by NMI_Handler().
func_ptr_t pfnHwwdgCallback [static] |
callback function pointer for HW-Wdg Irq
Definition at line 81 of file hwwdg.c.
Referenced by Hwwdg_DeInit(), Hwwdg_Init(), Hwwdg_Start(), and HwwdgIrqHandler().