RA Flexible Software Package Documentation  Release v5.6.0

 
WDT Interface

Detailed Description

Interface for watch dog timer functions.

Summary

The WDT interface for the Watchdog Timer (WDT) peripheral provides watchdog functionality including resetting the device or generating an interrupt.

Data Structures

struct  wdt_callback_args_t
 
struct  wdt_timeout_values_t
 
struct  wdt_cfg_t
 
struct  wdt_api_t
 
struct  wdt_instance_t
 

Typedefs

typedef void wdt_ctrl_t
 

Enumerations

enum  wdt_timeout_t
 
enum  wdt_clock_division_t
 
enum  wdt_window_start_t
 
enum  wdt_window_end_t
 
enum  wdt_reset_control_t
 
enum  wdt_stop_control_t
 
enum  wdt_status_t
 

Data Structure Documentation

◆ wdt_callback_args_t

struct wdt_callback_args_t

Callback function parameter data

Data Fields
void const * p_context Placeholder for user data. Set in wdt_api_t::open function in wdt_cfg_t.

◆ wdt_timeout_values_t

struct wdt_timeout_values_t

WDT timeout data. Used to return frequency of WDT clock and timeout period

Data Fields
uint32_t clock_frequency_hz Frequency of watchdog clock after divider.
uint32_t timeout_clocks Timeout period in units of watchdog clock ticks.

◆ wdt_cfg_t

struct wdt_cfg_t

WDT configuration parameters.

Data Fields

wdt_timeout_t timeout
 Timeout period.
 
wdt_clock_division_t clock_division
 Clock divider.
 
wdt_window_start_t window_start
 Refresh permitted window start position.
 
wdt_window_end_t window_end
 Refresh permitted window end position.
 
wdt_reset_control_t reset_control
 Select NMI/IRQ or reset generated on underflow.
 
wdt_stop_control_t stop_control
 Select whether counter operates in sleep mode.
 
void(* p_callback )(wdt_callback_args_t *p_args)
 Callback provided when a WDT ISR occurs.
 
void const * p_context
 
void const * p_extend
 Placeholder for user extension.
 

Field Documentation

◆ p_context

void const* wdt_cfg_t::p_context

Placeholder for user data. Passed to the user callback in wdt_callback_args_t.

◆ wdt_api_t

struct wdt_api_t

WDT functions implemented at the HAL layer will follow this API.

Data Fields

fsp_err_t(* open )(wdt_ctrl_t *const p_ctrl, wdt_cfg_t const *const p_cfg)
 
fsp_err_t(* refresh )(wdt_ctrl_t *const p_ctrl)
 
fsp_err_t(* statusGet )(wdt_ctrl_t *const p_ctrl, wdt_status_t *const p_status)
 
fsp_err_t(* statusClear )(wdt_ctrl_t *const p_ctrl, const wdt_status_t status)
 
fsp_err_t(* counterGet )(wdt_ctrl_t *const p_ctrl, uint32_t *const p_count)
 
fsp_err_t(* timeoutGet )(wdt_ctrl_t *const p_ctrl, wdt_timeout_values_t *const p_timeout)
 
fsp_err_t(* callbackSet )(wdt_ctrl_t *const p_ctrl, void(*p_callback)(wdt_callback_args_t *), void const *const p_context, wdt_callback_args_t *const p_callback_memory)
 

Field Documentation

◆ open

fsp_err_t(* wdt_api_t::open) (wdt_ctrl_t *const p_ctrl, wdt_cfg_t const *const p_cfg)

Initialize the WDT in register start mode. In auto-start mode (Supported devices only) with NMI output it registers the NMI callback.

Parameters
[in]p_ctrlPointer to control structure.
[in]p_cfgPointer to pin configuration structure.

◆ refresh

fsp_err_t(* wdt_api_t::refresh) (wdt_ctrl_t *const p_ctrl)

Refresh the watchdog timer.

Parameters
[in]p_ctrlPointer to control structure.

◆ statusGet

fsp_err_t(* wdt_api_t::statusGet) (wdt_ctrl_t *const p_ctrl, wdt_status_t *const p_status)

Read the status of the WDT.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_statusPointer to variable to return status information through.

◆ statusClear

fsp_err_t(* wdt_api_t::statusClear) (wdt_ctrl_t *const p_ctrl, const wdt_status_t status)

Clear the status flags of the WDT.

Parameters
[in]p_ctrlPointer to control structure.
[in]statusStatus condition(s) to clear.

◆ counterGet

fsp_err_t(* wdt_api_t::counterGet) (wdt_ctrl_t *const p_ctrl, uint32_t *const p_count)

Read the current WDT counter value.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_countPointer to variable to return current WDT counter value.

◆ timeoutGet

fsp_err_t(* wdt_api_t::timeoutGet) (wdt_ctrl_t *const p_ctrl, wdt_timeout_values_t *const p_timeout)

Read the watchdog timeout values.

Parameters
[in]p_ctrlPointer to control structure.
[out]p_timeoutPointer to structure to return timeout values.

◆ callbackSet

fsp_err_t(* wdt_api_t::callbackSet) (wdt_ctrl_t *const p_ctrl, void(*p_callback)(wdt_callback_args_t *), void const *const p_context, wdt_callback_args_t *const p_callback_memory)

Specify callback function and optional context pointer and working memory pointer.

Parameters
[in]p_ctrlPointer to the WDT control block.
[in]p_callbackCallback function
[in]p_contextPointer to send to callback function
[in]p_callback_memoryPointer to volatile memory where callback structure can be allocated. Callback arguments allocated here are only valid during the callback.

◆ wdt_instance_t

struct wdt_instance_t

This structure encompasses everything that is needed to use an instance of this interface.

Data Fields
wdt_ctrl_t * p_ctrl Pointer to the control structure for this instance.
wdt_cfg_t const * p_cfg Pointer to the configuration structure for this instance.
wdt_api_t const * p_api Pointer to the API structure for this instance.

Typedef Documentation

◆ wdt_ctrl_t

typedef void wdt_ctrl_t

WDT control block. Allocate an instance specific control block to pass into the WDT API calls.

Enumeration Type Documentation

◆ wdt_timeout_t

WDT time-out periods.

Enumerator
WDT_TIMEOUT_128 

128 clock cycles

WDT_TIMEOUT_512 

512 clock cycles

WDT_TIMEOUT_1024 

1024 clock cycles

WDT_TIMEOUT_2048 

2048 clock cycles

WDT_TIMEOUT_4096 

4096 clock cycles

WDT_TIMEOUT_8192 

8192 clock cycles

WDT_TIMEOUT_16384 

16384 clock cycles

◆ wdt_clock_division_t

WDT clock division ratio.

Enumerator
WDT_CLOCK_DIVISION_1 

CLK/1.

WDT_CLOCK_DIVISION_4 

CLK/4.

WDT_CLOCK_DIVISION_16 

CLK/16.

WDT_CLOCK_DIVISION_32 

CLK/32.

WDT_CLOCK_DIVISION_64 

CLK/64.

WDT_CLOCK_DIVISION_128 

CLK/128.

WDT_CLOCK_DIVISION_256 

CLK/256.

WDT_CLOCK_DIVISION_512 

CLK/512.

WDT_CLOCK_DIVISION_2048 

CLK/2048.

WDT_CLOCK_DIVISION_8192 

CLK/8192.

◆ wdt_window_start_t

WDT refresh permitted period window start position.

Enumerator
WDT_WINDOW_START_25 

Start position = 25%.

WDT_WINDOW_START_50 

Start position = 50%.

WDT_WINDOW_START_75 

Start position = 75%.

WDT_WINDOW_START_100 

Start position = 100%.

◆ wdt_window_end_t

WDT refresh permitted period window end position.

Enumerator
WDT_WINDOW_END_75 

End position = 75%.

WDT_WINDOW_END_50 

End position = 50%.

WDT_WINDOW_END_25 

End position = 25%.

WDT_WINDOW_END_0 

End position = 0%.

◆ wdt_reset_control_t

WDT Counter underflow and refresh error control.

Enumerator
WDT_RESET_CONTROL_NMI 

NMI/IRQ request when counter underflows.

WDT_RESET_CONTROL_RESET 

Reset request when counter underflows.

◆ wdt_stop_control_t

WDT Counter operation in sleep mode.

Enumerator
WDT_STOP_CONTROL_DISABLE 

Count will not stop when device enters sleep mode.

WDT_STOP_CONTROL_ENABLE 

Count will automatically stop when device enters sleep mode.

◆ wdt_status_t

WDT status

Enumerator
WDT_STATUS_NO_ERROR 

No status flags set.

WDT_STATUS_UNDERFLOW 

Underflow flag set.

WDT_STATUS_REFRESH_ERROR 

Refresh error flag set. Refresh outside of permitted window.

WDT_STATUS_UNDERFLOW_AND_REFRESH_ERROR 

Underflow and refresh error flags set.

WDT_STATUS_OVERFLOW 

Overflow flag set.