![]() |
S32 SDK
|
External Watchdog Monitor Peripheral Driver.
Features:
The EWM can be initialized only once as all the configuration registers are write once per reset
The EWM Driver does not handle clock setup (from PCC) or any kind of pin configuration (done by PORT module). This is handled by the Clock Manager and PORT module, respectively. The driver assumes that correct clock configurations have been made, so it is the user's responsibility to set up clocking and pin configurations correctly.
The EWM module can generate interrupts, if enabled on EWM_DRV_Init()
but they are not handled by the driver. The EWM shares the interrupt vector with the Watchdog Timer. The following code snippet is an example of how enable the interrupt and assign a handler:
Data Structures | |
struct | ewm_init_config_t |
Enumerations | |
enum | ewm_in_assert_logic_t { EWM_IN_ASSERT_DISABLED = 0x00U, EWM_IN_ASSERT_ON_LOGIC_ZERO = 0x01U, EWM_IN_ASSERT_ON_LOGIC_ONE = 0x02U } |
EWM Driver API | |
status_t | EWM_DRV_Init (uint32_t instance, const ewm_init_config_t *config) |
Init EWM. This method initializes EWM instance to the configuration from the passed structure. The user must make sure that the clock is enabled. This is the only method needed to be called to start the module. More... | |
void | EWM_DRV_GetDefaultConfig (ewm_init_config_t *config) |
Init configuration structure to default values. More... | |
void | EWM_DRV_Refresh (uint32_t instance) |
Refresh EWM. This method needs to be called within the window period specified by the Compare Low and Compare High registers. More... | |
ewm_in_assert_logic_t | EWM_DRV_GetInputPinAssertLogic (uint32_t instance) |
Get the Input pin assert logic. More... | |
Enumerator | |
---|---|
EWM_IN_ASSERT_DISABLED |
Input pin disabled |
EWM_IN_ASSERT_ON_LOGIC_ZERO |
Input pin asserts EWM when on logic 0 |
EWM_IN_ASSERT_ON_LOGIC_ONE |
Input pin asserts EWM when on logic 1 |
Definition at line 43 of file ewm_driver.h.
void EWM_DRV_GetDefaultConfig | ( | ewm_init_config_t * | config | ) |
Init configuration structure to default values.
[out] | config | Pointer to the configuration structure to initialize |
Definition at line 131 of file ewm_driver.c.
ewm_in_assert_logic_t EWM_DRV_GetInputPinAssertLogic | ( | uint32_t | instance | ) |
Get the Input pin assert logic.
[in] | instance | EWM instance number |
Definition at line 175 of file ewm_driver.c.
status_t EWM_DRV_Init | ( | uint32_t | instance, |
const ewm_init_config_t * | config | ||
) |
Init EWM. This method initializes EWM instance to the configuration from the passed structure. The user must make sure that the clock is enabled. This is the only method needed to be called to start the module.
Example configuration structure:
This configuration will enable the peripheral, with input pin configured to assert on logic low, interrupt enabled, prescaler 128 and maximum refresh window.
The EWM can be initialized only once per CPU reset as the registers are write once.
[in] | instance | EWM instance number |
[in] | config | Pointer to the module configuration structure. |
Definition at line 63 of file ewm_driver.c.
void EWM_DRV_Refresh | ( | uint32_t | instance | ) |
Refresh EWM. This method needs to be called within the window period specified by the Compare Low and Compare High registers.
[in] | instance | EWM instance number |
Definition at line 153 of file ewm_driver.c.