S32 SDK

Detailed Description

Watchdog Timer Hardware Abstraction Level.

This HAL provides low-level access to all hardware features of the WDOG.

Data Structures

struct  wdog_op_mode_t
 WDOG configuration structure Implements : wdog_op_mode_t_Class. More...
 
struct  wdog_user_config_t
 WDOG configuration structure Implements : wdog_user_config_t_Class. More...
 

Macros

#define WDOG_UNLOCK32(base)
 
#define WDOG_UNLOCK16(base)
 
#define WDOG_UNLOCK(base)
 

Enumerations

enum  wdog_clk_source_t { WDOG_BUS_CLOCK = 0x00U, WDOG_LPO_CLOCK = 0x01U, WDOG_SOSC_CLOCK = 0x02U, WDOG_SIRC_CLOCK = 0x03U }
 Clock sources for the WDOG. Implements : wdog_clk_source_t_Class. More...
 
enum  wdog_test_mode_t { WDOG_TST_DISABLED = 0x00U, WDOG_TST_USER = 0x01U, WDOG_TST_LOW = 0x02U, WDOG_TST_HIGH = 0x03U }
 Test modes for the WDOG. Implements : wdog_test_mode_t_Class. More...
 

WDOG Common Configurations

void WDOG_HAL_Init (WDOG_Type *base)
 Initializes the WDOG. More...
 
static bool WDOG_HAL_IsEnabled (const WDOG_Type *base)
 Verifies if the WDOG is enabled. More...
 
static void WDOG_HAL_Enable (WDOG_Type *base)
 Enables the WDOG. More...
 
static void WDOG_HAL_Disable (WDOG_Type *base)
 Disables the WDOG. More...
 
static void WDOG_HAL_Trigger (WDOG_Type *base)
 Refreshes the WDOG counter. More...
 
void WDOG_HAL_Config (WDOG_Type *base, const wdog_user_config_t *config)
 Configures all WDOG registers. More...
 
wdog_user_config_t WDOG_HAL_GetConfig (const WDOG_Type *base)
 Gets the current WDOG configuration. More...
 
static void WDOG_HAL_SetWindow (WDOG_Type *base, bool enable)
 Enables/Disables window mode. More...
 
static bool WDOG_HAL_GetInt (const WDOG_Type *base)
 Gets Interrupt Flag (FLG) status. More...
 
static void WDOG_HAL_ClearInt (WDOG_Type *base)
 Clears the Interrupt Flag. More...
 
static void WDOG_HAL_SetPrescaler (WDOG_Type *base, bool enable)
 Enables/Disables prescaler. More...
 
static void WDOG_HAL_SetClockSource (WDOG_Type *base, wdog_clk_source_t clkSource)
 Selects the clock source used by the WDOG. More...
 
static void WDOG_HAL_SetInt (WDOG_Type *base, bool enable)
 Enables/Disables WDOG interrupt. More...
 
static bool WDOG_HAL_IsUpdateEnabled (const WDOG_Type *base)
 Verifies if the WDOG updates are allowed. More...
 
static void WDOG_HAL_SetUpdate (WDOG_Type *base, bool enable)
 Enables/Disables WDOG updates. More...
 
static wdog_test_mode_t WDOG_HAL_GetTestMode (const WDOG_Type *base)
 Gets the WDOG test mode. More...
 
static void WDOG_HAL_SetTestMode (WDOG_Type *base, wdog_test_mode_t testMode)
 Changes the WDOG test mode. More...
 
static void WDOG_HAL_SetDebug (WDOG_Type *base, bool enable)
 Enables/Disables WDOG in debug mode. More...
 
static void WDOG_HAL_SetWait (WDOG_Type *base, bool enable)
 Enables/Disables WDOG in wait mode. More...
 
static void WDOG_HAL_SetStop (WDOG_Type *base, bool enable)
 Enables/Disables WDOG in stop mode. More...
 
static uint16_t WDOG_HAL_GetCounter (const WDOG_Type *base)
 Gets the value of the WDOG counter. More...
 
static void WDOG_HAL_SetCounter (WDOG_Type *base, uint32_t counter)
 Sets the value of the WDOG counter. More...
 
static uint16_t WDOG_HAL_GetTimeout (const WDOG_Type *base)
 Gets the value of the WDOG timeout. More...
 
static void WDOG_HAL_SetTimeout (WDOG_Type *base, uint16_t timeout)
 Sets the value of the WDOG timeout. More...
 
static void WDOG_HAL_SetWindowValue (WDOG_Type *base, uint16_t window)
 Sets the value of the WDOG window. More...
 
static bool WDOG_HAL_IsUnlocked (const WDOG_Type *base)
 Checks if the WDOG is unlocked. More...
 
static bool WDOG_HAL_IsReconfigurationComplete (const WDOG_Type *base)
 Checks if the last configuration of the WDOG was successful. More...
 
static void WDOG_HAL_SetCmd32 (WDOG_Type *base, bool enable)
 Enables/Disables support for 32-bit refresh/unlock command write words. More...
 

Macro Definition Documentation

#define WDOG_UNLOCK (   base)
Value:
{ \
if (((base)->CS & WDOG_CS_CMD32EN_MASK) != 0U) \
{ \
WDOG_UNLOCK32(base); \
} \
else \
{ \
WDOG_UNLOCK16(base); \
} \
}
#define WDOG_CS_CMD32EN_MASK
Definition: S32K144.h:11343

Definition at line 118 of file wdog_hal.h.

#define WDOG_UNLOCK16 (   base)
Value:
{ \
(void)(base)->CNT; \
(void)(base)->CNT; \
}
#define FEATURE_WDOG_UNLOCK16_SECOND_VALUE
#define FEATURE_WDOG_UNLOCK16_FIRST_VALUE

Definition at line 111 of file wdog_hal.h.

#define WDOG_UNLOCK32 (   base)
Value:
{ \
(base)->CNT = FEATURE_WDOG_UNLOCK_VALUE; \
(void)(base)->CNT; \
}
#define FEATURE_WDOG_UNLOCK_VALUE

Definition at line 106 of file wdog_hal.h.

Enumeration Type Documentation

Clock sources for the WDOG. Implements : wdog_clk_source_t_Class.

Enumerator
WDOG_BUS_CLOCK 

Bus clock

WDOG_LPO_CLOCK 

LPO clock

WDOG_SOSC_CLOCK 

SOSC clock

WDOG_SIRC_CLOCK 

SIRC clock

Definition at line 58 of file wdog_hal.h.

Test modes for the WDOG. Implements : wdog_test_mode_t_Class.

Enumerator
WDOG_TST_DISABLED 

Test mode disabled

WDOG_TST_USER 

User mode enabled. (Test mode disabled.)

WDOG_TST_LOW 

Test mode enabled, only the low byte is used.

WDOG_TST_HIGH 

Test mode enabled, only the high byte is used.

Definition at line 69 of file wdog_hal.h.

Function Documentation

static void WDOG_HAL_ClearInt ( WDOG_Type base)
inlinestatic

Clears the Interrupt Flag.

This function clears the Interrupt Flag (FLG).

Parameters
[in]baseWDOG base pointer. Implements : WDOG_HAL_ClearInt_Activity

Definition at line 287 of file wdog_hal.h.

void WDOG_HAL_Config ( WDOG_Type base,
const wdog_user_config_t config 
)

Configures all WDOG registers.

This function configures all WDOG registers.

Parameters
[in]baseWDOG base pointer.
[in]configthe new configuration to be used.

Definition at line 64 of file wdog_hal.c.

static void WDOG_HAL_Disable ( WDOG_Type base)
inlinestatic

Disables the WDOG.

This function diables the WDOG.

Parameters
[in]baseWDOG base pointer. Implements : WDOG_HAL_Disable_Activity

Definition at line 195 of file wdog_hal.h.

static void WDOG_HAL_Enable ( WDOG_Type base)
inlinestatic

Enables the WDOG.

This function enables the WDOG.

Parameters
[in]baseWDOG base pointer. Implements : WDOG_HAL_Enable_Activity

Definition at line 179 of file wdog_hal.h.

wdog_user_config_t WDOG_HAL_GetConfig ( const WDOG_Type base)

Gets the current WDOG configuration.

This function gets the current WDOG configuration

Parameters
[in]baseWDOG base pointer.
Returns
the current WDOG configuration

Definition at line 103 of file wdog_hal.c.

static uint16_t WDOG_HAL_GetCounter ( const WDOG_Type base)
inlinestatic

Gets the value of the WDOG counter.

This function gets the value of the WDOG counter.

Parameters
[in]baseWDOG base pointer.
Returns
the value of the WDOG counter. Implements : WDOG_HAL_GetCounter_Activity

Definition at line 519 of file wdog_hal.h.

static bool WDOG_HAL_GetInt ( const WDOG_Type base)
inlinestatic

Gets Interrupt Flag (FLG) status.

This function verifies if an interrupt occurred.

Parameters
[in]baseWDOG base pointer.
Returns
the state of the Interrupt Flag:
  • false: no interrupt occurred
  • true: an interrupt occurred Implements : WDOG_HAL_GetInt_Activity

Definition at line 273 of file wdog_hal.h.

static wdog_test_mode_t WDOG_HAL_GetTestMode ( const WDOG_Type base)
inlinestatic

Gets the WDOG test mode.

This function verifies the test mode of the WDOG.

Parameters
[in]baseWDOG base pointer.
Returns
the test mode:
  • 0x00U: Test mode disabled
  • 0x01U: User mode enabled (test mode disabled)
  • 0x02U: Test mode enabled (for the low byte)
  • 0x03U: Test mode enabled (for the high byte) Implements : WDOG_HAL_GetTestMode_Activity

Definition at line 403 of file wdog_hal.h.

static uint16_t WDOG_HAL_GetTimeout ( const WDOG_Type base)
inlinestatic

Gets the value of the WDOG timeout.

This function gets the value of the WDOG timeout.

Parameters
[in]baseWDOG base pointer.
Returns
the value of the WDOG timeout. Implements : WDOG_HAL_GetTimeout_Activity

Definition at line 549 of file wdog_hal.h.

void WDOG_HAL_Init ( WDOG_Type base)

Initializes the WDOG.

This function initializes the WDOG to known state.

Parameters
[in]baseWDOG base pointer.

Definition at line 42 of file wdog_hal.c.

static bool WDOG_HAL_IsEnabled ( const WDOG_Type base)
inlinestatic

Verifies if the WDOG is enabled.

This function verifies the state of the WDOG.

Parameters
[in]baseWDOG base pointer.
Returns
the state of the WDOG:
  • false: WDOG is disabled
  • true: WDOG is enabled Implements : WDOG_HAL_IsEnabled_Activity

Definition at line 165 of file wdog_hal.h.

static bool WDOG_HAL_IsReconfigurationComplete ( const WDOG_Type base)
inlinestatic

Checks if the last configuration of the WDOG was successful.

This function checks if the last configuration of the WDOG was successful.

Parameters
[in]baseWDOG base pointer.
Returns
true if the configuration was successful, false if not. Implements : WDOG_HAL_IsReconfigurationComplete_Activity

Definition at line 614 of file wdog_hal.h.

static bool WDOG_HAL_IsUnlocked ( const WDOG_Type base)
inlinestatic

Checks if the WDOG is unlocked.

This function checks if the WDOG is unlocked. If the module is unlocked, reconfiguration of the registers is allowed.

Parameters
[in]baseWDOG base pointer.
Returns
true if the module is unlocked, false if the module is locked. Implements : WDOG_HAL_IsUnlocked_Activity

Definition at line 599 of file wdog_hal.h.

static bool WDOG_HAL_IsUpdateEnabled ( const WDOG_Type base)
inlinestatic

Verifies if the WDOG updates are allowed.

This function verifies if software is allowed to reconfigure the WDOG without a reset.

Parameters
[in]baseWDOG base pointer.
Returns
the state of the WDOG updates:
  • false: updates are not allowed
  • true: updates are allowed Implements : WDOG_HAL_IsUpdateEnabled_Activity

Definition at line 367 of file wdog_hal.h.

static void WDOG_HAL_SetClockSource ( WDOG_Type base,
wdog_clk_source_t  clkSource 
)
inlinestatic

Selects the clock source used by the WDOG.

This function selects the clock source used by the WDOG.

Parameters
[in]baseWDOG base pointer.
[in]clkSourcethe clock source to be used by the WDOG:
  • 0x00U: Bus clock
  • 0x01U: LPO clock
  • 0x02U: System oscillator clock (SOSC, from SCG)
  • 0x03U: Slow internal reference clock (SIRC, from SCG) Implements : WDOG_HAL_SetClockSource_Activity

Definition at line 325 of file wdog_hal.h.

static void WDOG_HAL_SetCmd32 ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables support for 32-bit refresh/unlock command write words.

This function enables/disables support for 32-bit refresh/unlock command write words.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable 32-bit refresh/unlock command write words. Implements : WDOG_HAL_SetCmd32_Activity

Definition at line 629 of file wdog_hal.h.

static void WDOG_HAL_SetCounter ( WDOG_Type base,
uint32_t  counter 
)
inlinestatic

Sets the value of the WDOG counter.

This sets the value of the WDOG counter.

Parameters
[in]baseWDOG base pointer.
[in]counterthe value of the WDOG counter. Implements : WDOG_HAL_SetCounter_Activity

Definition at line 534 of file wdog_hal.h.

static void WDOG_HAL_SetDebug ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables WDOG in debug mode.

This function enables/disables the WDOG in debug mode.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable WDOG in debug mode Implements : WDOG_HAL_SetDebug_Activity

Definition at line 468 of file wdog_hal.h.

static void WDOG_HAL_SetInt ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables WDOG interrupt.

This function enables/disables the interrupts from the WDOG.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable interrupts. Implements : WDOG_HAL_SetInt_Activity

Definition at line 347 of file wdog_hal.h.

static void WDOG_HAL_SetPrescaler ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables prescaler.

This function enables/disables the prescaler for the WDOG.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable prescaler. Implements : WDOG_HAL_SetPrescaler_Activity

Definition at line 304 of file wdog_hal.h.

static void WDOG_HAL_SetStop ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables WDOG in stop mode.

This function enables/disables the WDOG in stop mode.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable WDOG in stop mode. Implements : WDOG_HAL_SetStop_Activity

Definition at line 502 of file wdog_hal.h.

static void WDOG_HAL_SetTestMode ( WDOG_Type base,
wdog_test_mode_t  testMode 
)
inlinestatic

Changes the WDOG test mode.

This function changes the test mode of the WDOG. If the WDOG is tested in mode, software should set this field to 0x01U in order to indicate that the WDOG is functioning normally.

Parameters
[in]baseWDOG base pointer.
testModethe test mode:
  • 0x00U: Test mode disabled
  • 0x01U: User mode enabled (test mode disabled)
  • 0x02U: Test mode enabled (for the low byte)
  • 0x03U: Test mode enabled (for the high byte) Implements : WDOG_HAL_SetTestMode_Activity

Definition at line 446 of file wdog_hal.h.

static void WDOG_HAL_SetTimeout ( WDOG_Type base,
uint16_t  timeout 
)
inlinestatic

Sets the value of the WDOG timeout.

This sets the value of the WDOG timeout.

Parameters
[in]baseWDOG base pointer.
[in]timeoutthe value of the WDOG timeout. Implements : WDOG_HAL_SetTimeout_Activity

Definition at line 564 of file wdog_hal.h.

static void WDOG_HAL_SetUpdate ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables WDOG updates.

This function enables/disables the possibility to update the WDOG config.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable updates. Implements : WDOG_HAL_SetUpdate_Activity

Definition at line 382 of file wdog_hal.h.

static void WDOG_HAL_SetWait ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables WDOG in wait mode.

This function enables/disables the WDOG in wait mode.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable WDOG in wait mode. Implements : WDOG_HAL_SetWait_Activity

Definition at line 485 of file wdog_hal.h.

static void WDOG_HAL_SetWindow ( WDOG_Type base,
bool  enable 
)
inlinestatic

Enables/Disables window mode.

This function enables/disables window mode for the WDOG.

Parameters
[in]baseWDOG base pointer.
[in]enableenable/disable window mode Implements : WDOG_HAL_SetWindow_Activity

Definition at line 254 of file wdog_hal.h.

static void WDOG_HAL_SetWindowValue ( WDOG_Type base,
uint16_t  window 
)
inlinestatic

Sets the value of the WDOG window.

This sets the value of the WDOG window.

Parameters
[in]baseWDOG base pointer.
[in]windowthe value of the WDOG window. Implements : WDOG_HAL_SetWindowValue_Activity

Definition at line 581 of file wdog_hal.h.

static void WDOG_HAL_Trigger ( WDOG_Type base)
inlinestatic

Refreshes the WDOG counter.

Parameters
[in]baseWDOG base pointer. Implements : WDOG_HAL_Trigger_Activity

Definition at line 208 of file wdog_hal.h.