Synergy Software Package User's Manual

Driver for the Watchdog Timer (WDT). More...

Data Structures

struct  wdt_instance_ctrl_t
 

Functions

ssp_err_t R_WDT_Open (wdt_ctrl_t *const p_api_ctrl, wdt_cfg_t const *const p_cfg)
 Configure the WDT in register start mode. In auto-start_mode the NMI callback can be registered. Implements wdt_api_t::open. More...
 
ssp_err_t R_WDT_CfgGet (wdt_ctrl_t *const p_api_ctrl, wdt_cfg_t *const p_cfg)
 Read the configuration of the WDT in both register-start and auto-start modes. Implements wdt_api_t::cfgGet. More...
 
ssp_err_t R_WDT_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_WDT_Refresh (wdt_ctrl_t *const p_api_ctrl)
 Refresh the watchdog timer. Implements wdt_api_t::refresh. More...
 
ssp_err_t R_WDT_StatusGet (wdt_ctrl_t *const p_api_ctrl, wdt_status_t *const p_status)
 Read the WDT status flags. Implements wdt_api_t::statusGet. More...
 
ssp_err_t R_WDT_StatusClear (wdt_ctrl_t *const p_api_ctrl, const wdt_status_t status)
 Clear the WDT status and error flags. Implements wdt_api_t::statusClear. More...
 
ssp_err_t R_WDT_CounterGet (wdt_ctrl_t *const p_api_ctrl, uint32_t *const p_count)
 Read the current count value of the WDT. Implements wdt_api_t::counterGet. More...
 
ssp_err_t R_WDT_VersionGet (ssp_version_t *const p_data)
 Return WDT HAL driver version. Implements wdt_api_t::versionGet. More...
 

Detailed Description

Driver for the Watchdog Timer (WDT).

Summary

This module supports the Watchdog Timer (WDT). It implements the WDT Interface. The WDT HAL APIs provide the ability to configure the operation of the WDT (when used in register start mode), refresh the watchdog, read the timer value and read and clear status flags.

Function Documentation

◆ R_WDT_CfgGet()

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

Read the configuration of the WDT in both register-start and auto-start modes. Implements wdt_api_t::cfgGet.

Return values
SSP_SUCCESSWDT successfully configured.
SSP_ERR_ASSERTIONNull Pointer.
SSP_ERR_NOT_OPENInstance control block is not initialized.
Note
This function is reentrant.

Register-start mode.

Get timeout value from WDTCR register.

◆ R_WDT_CounterGet()

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

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

Return values
SSP_SUCCESSWDT current count successfully read.
SSP_ERR_ASSERTIONNull pointer passed as a parameter.
SSP_ERR_NOT_OPENInstance control block is not initialized.
Note
This function is reentrant.

Read the WDT status

Get WDT down counter value

◆ R_WDT_Open()

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

Configure the WDT in register start mode. In auto-start_mode the NMI callback can be registered. Implements wdt_api_t::open.

This function should only be called once as WDT configuration registers can only be written to once so subsequent calls will have no effect.

Return values
SSP_SUCCESSWDT successfully configured.
SSP_ERR_ASSERTIONNull Pointer(s).
SSP_ERR_INVALID_ARGUMENTOne or more configuration options is invalid.
SSP_ERR_INVALID_MODEAn attempt to open the WDT in register-start mode when the OFS0 register is configured for auto-start mode. Or to open the WDT in auto-start mode when the OSF0 is configured for register start mode.
Returns
See Common Error Codes or functions called by this function for other possible return codes. This function calls:
Note
This function is reentrant. In auto-start mode the only valid configuration option is for registering the callback for the NMI ISR if NMI output has been selected.

g_wdt_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 this data structure is not optimised away.

Eliminate toolchain warning when NMI output is not being used.

Check the expected start mode matches the OSF0 configuration.

Lock the IWDT Hardware Resource

Initialize global pointer to WDT for NMI callback use.

Configuration only valid when WDT operating in register-start mode.

Register-start mode.

Register callback with BSP NMI ISR.

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

Start the timer by performing a refresh.

◆ R_WDT_Refresh()

ssp_err_t R_WDT_Refresh ( wdt_ctrl_t *const  p_api_ctrl)

Refresh the watchdog timer. Implements wdt_api_t::refresh.

In addition to refreshing the watchdog counter this function can be used, in register start mode to start the counter.

Return values
SSP_SUCCESSWDT successfully refreshed.
SSP_ERR_NOT_OPENInstance control block is not initialized.
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. This function must not be called before calling R_WDT_Open().

Refresh the WDT Down counter

◆ R_WDT_StatusClear()

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

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

Return values
SSP_SUCCESSWDT flag(s) successfully cleared.
SSP_ERR_ASSERTIONNull pointer as a parameter.
SSP_ERR_NOT_OPENInstance control block is not initialized.
Note
This function is reentrant.

Write zero to clear flags.

◆ R_WDT_StatusGet()

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

Read the WDT status flags. Implements wdt_api_t::statusGet.

Indicates both status and error conditions.

Return values
SSP_SUCCESSWDT status successfully read.
SSP_ERR_ASSERTIONNull pointer as a parameter.
SSP_ERR_NOT_OPENInstance control block is not initialized.
Note
This function is reentrant. When the WDT is configured to output a reset on underflow or refresh error reading the status and error flags serves no purpose as they will always indicate that no underflow has occurred and there is no refresh error. Reading the status and error flags is only valid when interrupt request output is enabled.

Read the WDT status

Get the value of refresh or underflow error flag

◆ R_WDT_TimeoutGet()

ssp_err_t R_WDT_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 timeout value successfully read.
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().

Read the configuration of the WDT

Get the frequency of the clock supplying the WDT

◆ R_WDT_VersionGet()

ssp_err_t R_WDT_VersionGet ( ssp_version_t *const  p_data)

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

Return values
SSP_SUCCESSVersion information successfully read.
SSP_ERR_ASSERTIONNull pointer passed as a parameter
Note
This function is reentrant.