Altera HWLIB  16.0
The Altera HW Manager API Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups
Watchdog Timer Counter Configuration

Description

This functional group implements setting, configuring and reading the counters of the watchdog timers.

Functions

ALT_STATUS_CODE alt_wdog_counter_set (ALT_WDOG_TIMER_t tmr_id, uint32_t val)
 
uint32_t alt_wdog_counter_get_current (ALT_WDOG_TIMER_t tmr_id)
 
uint32_t alt_wdog_counter_get_curtime_millisecs (ALT_WDOG_TIMER_t tmr_id)
 
uint32_t alt_wdog_counter_get_init (ALT_WDOG_TIMER_t tmr_id)
 
uint64_t alt_wdog_counter_get_inittime_nanosecs (ALT_WDOG_TIMER_t tmr_id)
 
uint32_t alt_wdog_counter_get_inittime_millisecs (ALT_WDOG_TIMER_t tmr_id)
 
ALT_STATUS_CODE alt_wdog_core_prescaler_set (uint32_t val)
 
uint32_t alt_wdog_core_prescaler_get (void)
 
uint32_t alt_wdog_counter_get_max (ALT_WDOG_TIMER_t tmr_id)
 
uint64_t alt_wdog_counter_get_max_nanosecs (ALT_WDOG_TIMER_t tmr_id)
 
uint32_t alt_wdog_counter_get_max_millisecs (ALT_WDOG_TIMER_t tmr_id)
 

Function Documentation

ALT_STATUS_CODE alt_wdog_counter_set ( ALT_WDOG_TIMER_t  tmr_id,
uint32_t  val 
)

Sets the countdown value of the specified timer. This is a regular value for ALT_CPU_WATCHDOG. For tmr_id = ALT_WATCHDOG0, ALT_WATCHDOG1, ALT_WATCHDOG0_INITIAL or ALT_WATCHDOG1_INITIAL however, this is an encoded power-of-two value such that 2**(16 + val).
If this value is set before the watchdog timer is started, then this value is used from the start. If this value is set after the timer has been started, it takes effect when the timer rolls over or the next time it is started.

Parameters
tmr_idThe watchdog timer identifier.
valThe counter value to load.
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_ERRORThe operation failed.
ALT_E_BAD_ARGTried to write an invalid watchdog timer or timeout value.
uint32_t alt_wdog_counter_get_current ( ALT_WDOG_TIMER_t  tmr_id)

Returns the current counter value of the specified timer.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe current 32-bit counter value.
uint32_t alt_wdog_counter_get_curtime_millisecs ( ALT_WDOG_TIMER_t  tmr_id)

Returns the current counter value of the specified timer, as measured in milliseconds. For ALT_CPU_WATCHDOG, this includes the effects of the prescaler setting.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe current 32-bit counter value (in milliseconds).
uint32_t alt_wdog_counter_get_init ( ALT_WDOG_TIMER_t  tmr_id)

Returns the initial counter value of the specified timer as a 32-bit integer value. This is the value that will be reloaded when the timer is reset or restarted. For the timers where this value is set as an encoded powers-of-two between 15 and 31, the value is converted into the equivalent binary value before returning it.
For ALT_CPU_WATCHDOG, the returned value does not include the effects of the prescaler setting.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe current 32-bit counter value. 0 Indicates an error.
uint64_t alt_wdog_counter_get_inittime_nanosecs ( ALT_WDOG_TIMER_t  tmr_id)

Returns the initial value of the specified timer in nanoseconds. This is the value that will be reloaded when the timer is reset or restarted. For ALT_CPU_WATCHDOG, this includes the effects of the prescaler setting. This call returns a more precise result than alt_wdog_counter_get_inittime_millisecs(), but as an unsigned 64-bit integer.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint64_tThe currently-selected watchdog delay time (in nanoseconds).
uint32_t alt_wdog_counter_get_inittime_millisecs ( ALT_WDOG_TIMER_t  tmr_id)

Returns the initialized value of the specified timer in milliseconds. This is the value that will be reloaded when the timer is reset or restarted. For ALT_CPU_WATCHDOG, this includes the effects of the prescaler setting. This call returns a 32-bit unsigned integer, though is less precise than alt_wdog_counter_get_inittime_nanosecs().

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe currently-selected watchdog delay time (in milliseconds). 0 Indicates an error.
ALT_STATUS_CODE alt_wdog_core_prescaler_set ( uint32_t  val)

Sets the value of the CPU watchdog timer ALT_CPU_WATCHDOG prescaler. Must be set before the watchdog timer is enabled.

Parameters
valThe eight-bit prescaler value to load (maximum 255).
Return values
ALT_E_SUCCESSThe operation was successful.
ALT_E_BAD_ARGBad prescaler value specified.
uint32_t alt_wdog_core_prescaler_get ( void  )

Returns the value of the prescaler of the CPU core watchdog timer ALT_CPU_WATCHDOG.

Return values
valThe eight-bit prescaler value.
uint32_t alt_wdog_counter_get_max ( ALT_WDOG_TIMER_t  tmr_id)

Returns the maximum possible counter value of the specified timer as a 32-bit value. For the timers where this value is encoded (as powers-of-two between 15 and 31), the encoded value is converted into the equivalent binary value before returning it. This does not include the effects of the prescaler available for ALT_CPU_WATCHDOG.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe current 32-bit counter value.
uint64_t alt_wdog_counter_get_max_nanosecs ( ALT_WDOG_TIMER_t  tmr_id)

Returns the maximum possible delay time of the specified timer specified in nanoseconds. For ALT_CPU_WATCHDOG, this includes the prescaler setting. This call returns a more precise reading of the counter than alt_wdog_counter_get_max_millisecs(), though in an unsigned 64-bit integer.

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint64_tThe maximum delay time before timeout (in nanoseconds).
uint32_t alt_wdog_counter_get_max_millisecs ( ALT_WDOG_TIMER_t  tmr_id)

Returns the maximum possible delay time of the specified timer specified in milliseconds. For ALT_CPU_WATCHDOG, this includes the prescaler setting. This call returns a 32-bit unsigned integer, though is less precise than alt_wdog_counter_get_max_nanosecs().

Parameters
tmr_idThe watchdog timer identifier.
Return values
uint32_tThe maximum delay time before timeout (in milliseconds).