Synergy Software Package User's Manual

Driver for the Independent Watchdog Timer (IWDT). More...

Data Structures

struct  iwdt_instance_ctrl_t
 

Functions

ssp_err_t R_IWDT_Open (wdt_ctrl_t *const p_api_ctrl, wdt_cfg_t const *const p_cfg)
 Register the IWDT NMI callback. More...
 
ssp_err_t R_IWDT_CfgGet (wdt_ctrl_t *const p_api_ctrl, wdt_cfg_t *const p_cfg)
 Read the configuration of the IWDT. Implements wdt_api_t::cfgGet. More...
 
ssp_err_t R_IWDT_Refresh (wdt_ctrl_t *const p_api_ctrl)
 Refresh the Independent Watchdog Timer. Implements wdt_api_t::refresh. More...
 
ssp_err_t R_IWDT_StatusGet (wdt_ctrl_t *const p_api_ctrl, wdt_status_t *const p_status)
 Read the IWDT status flags. More...
 
ssp_err_t R_IWDT_StatusClear (wdt_ctrl_t *const p_api_ctrl, const wdt_status_t status)
 Clear the IWDT status and error flags. Implements wdt_api_t::statusClear. More...
 
ssp_err_t R_IWDT_CounterGet (wdt_ctrl_t *const p_api_ctrl, uint32_t *const p_count)
 Read the current count value of the IWDT. Implements wdt_api_t::counterGet. More...
 
ssp_err_t R_IWDT_TimeoutGet (wdt_ctrl_t *const p_api_ctrl, wdt_timeout_values_t *const p_timeout)
 Read timeout information for the watchdog timer. Implements wdt_api_t::timeoutGet. More...
 
ssp_err_t R_IWDT_VersionGet (ssp_version_t *const p_data)
 Return IWDT HAL driver version. Implements wdt_api_t::versionGet. More...
 

Detailed Description

Driver for the Independent Watchdog Timer (IWDT).

Summary

This module supports the Independent Watchdog Timer (IWDT). It implements the WDT Interface. Extends WDT_API HAL layer drivers for interfacing with the Independent Watchdog Timer (IWDT) peripheral.

The IWDT HAL APIs provide the ability to refresh the independent watchdog, read the timer value and read and clear status flags. When used in NMI output mode the callback to be called by the NMI ISR can be registered.

Function Documentation

◆ R_IWDT_CfgGet()

ssp_err_t R_IWDT_CfgGet ( wdt_ctrl_t *const  p_api_ctrl,
wdt_cfg_t *const  p_cfg 
)

Read the configuration of the IWDT. Implements wdt_api_t::cfgGet.

Return values
SSP_SUCCESSIWDT configuration successfully read.
SSP_ERR_ASSERTIONNull Pointer.
SSP_ERR_INVALID_ARGUMENTOne or more configuration options is invalid.
Note
This function is reentrant.

Get timeout value from OFS0 register.

◆ R_IWDT_CounterGet()

ssp_err_t R_IWDT_CounterGet ( wdt_ctrl_t *const  p_api_ctrl,
uint32_t *const  p_count 
)

Read the current count value of the IWDT. Implements wdt_api_t::counterGet.

Return values
SSP_SUCCESSIWDT current count successfully read.
SSP_ERR_ASSERTIONNull pointer passed as a parameter.
SSP_ERR_NOT_OPENThe driver has not been opened. Perform R_IWDT_Open() first.
Note
This function is reentrant.

◆ R_IWDT_Open()

ssp_err_t R_IWDT_Open ( wdt_ctrl_t *const  p_api_ctrl,
wdt_cfg_t const *const  p_cfg 
)

Register the IWDT NMI callback.

Return values
SSP_SUCCESSIWDT NMI callback successfully configured.
SSP_ERR_ASSERTIONNull Pointer.
SSP_ERR_INVALID_MODEAn attempt to open the IWDT when the OFS0 register is not configured for auto-start mode.
SSP_ERR_HW_LOCKEDIWDT module has already been called.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is not reentrant.

g_iwdt_version is accessed by the ASSERT macro only and so compiler toolchain can issue a warning that it is not accessed. The code below eliminates this warning and also ensures these data structures are not optimized away.

Eliminate toolchain warning when NMI output is not being used.

Lock the IWDT Hardware Resource

Initialize global pointer to WDT for NMI callback use.

Check for NMI output mode

NMI output mode

Enable the IWDT underflow/refresh error interrupt (will generate an NMI).

◆ R_IWDT_Refresh()

ssp_err_t R_IWDT_Refresh ( wdt_ctrl_t *const  p_api_ctrl)

Refresh the Independent Watchdog Timer. Implements wdt_api_t::refresh.

Return values
SSP_SUCCESSIWDT successfully refreshed.
SSP_ERR_NOT_OPENThe driver has not been opened. Perform R_IWDT_Open() first.
Note
This function is reentrant. This function only returns SSP_SUCCESS. If the refresh fails due to being performed outside of the permitted refresh period the device will either reset or trigger an NMI ISR to run.

◆ R_IWDT_StatusClear()

ssp_err_t R_IWDT_StatusClear ( wdt_ctrl_t *const  p_api_ctrl,
const wdt_status_t  status 
)

Clear the IWDT status and error flags. Implements wdt_api_t::statusClear.

Return values
SSP_SUCCESSIWDT flag(s) successfully cleared.
SSP_ERR_ASSERTIONNull pointer as a parameter.
SSP_ERR_NOT_OPENThe driver has not been opened. Perform R_IWDT_Open() first.
Note
This function is reentrant.

Write zero to clear flags

◆ R_IWDT_StatusGet()

ssp_err_t R_IWDT_StatusGet ( wdt_ctrl_t *const  p_api_ctrl,
wdt_status_t *const  p_status 
)

Read the IWDT status flags.

Indicates both status and error conditions.

Return values
SSP_SUCCESSIWDT status successfully read.
SSP_ERR_ASSERTIONNull pointer as a parameter.
SSP_ERR_NOT_OPENThe driver has not been opened. Perform R_IWDT_Open() first.
Note
This function is reentrant. When the IWDT is configured to output a reset on underflow or refresh error reading the status and error flags can be read after reset to establish if the IWDT caused the reset. Reading the status and error flags in NMI output mode indicates whether the IWDT generated the NMI interrupt.

◆ R_IWDT_TimeoutGet()

ssp_err_t R_IWDT_TimeoutGet ( wdt_ctrl_t *const  p_api_ctrl,
wdt_timeout_values_t *const  p_timeout 
)

Read timeout information for the watchdog timer. Implements wdt_api_t::timeoutGet.

Return values
SSP_SUCCESSWDT successfully refreshed.
SSP_ERR_ASSERTIONNull Pointer.
SSP_ERR_ABORTEDInvalid clock divider for this watchdog
Note
This function is reentrant. This function must not be called before calling R_WDT_Open().

◆ R_IWDT_VersionGet()

ssp_err_t R_IWDT_VersionGet ( ssp_version_t *const  p_data)

Return IWDT HAL driver version. Implements wdt_api_t::versionGet.

Return values
SSP_SUCCESSCall successful.
SSP_ERR_ASSERTIONNull pointer passed as a parameter.
Note
This function is reentrant.