This functional group implements setting, configuring and reading the counters of the watchdog timers.
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_id | The watchdog timer identifier. |
val | The counter value to load. |
- Return values
-
ALT_E_SUCCESS | The operation was successful. |
ALT_E_ERROR | The operation failed. |
ALT_E_BAD_ARG | Tried to write an invalid watchdog timer or timeout value. |
Returns the current counter value of the specified timer.
- Parameters
-
tmr_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The current 32-bit counter value. |
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_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The current 32-bit counter value (in milliseconds). |
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_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The current 32-bit counter value. 0 Indicates an error. |
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_id | The watchdog timer identifier. |
- Return values
-
uint64_t | The currently-selected watchdog delay time (in nanoseconds). |
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_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The 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
-
val | The eight-bit prescaler value to load (maximum 255). |
- Return values
-
ALT_E_SUCCESS | The operation was successful. |
ALT_E_BAD_ARG | Bad 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
-
val | The eight-bit prescaler value. |
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_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The current 32-bit counter value. |
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_id | The watchdog timer identifier. |
- Return values
-
uint64_t | The maximum delay time before timeout (in nanoseconds). |
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_id | The watchdog timer identifier. |
- Return values
-
uint32_t | The maximum delay time before timeout (in milliseconds). |