Software APIs
Functions
dif_aon_timer.h File Reference

(3b97605)

Always-On Timer Device Interface Functions More...

#include <stdbool.h>
#include <stdint.h>
#include "sw/device/lib/base/macros.h"
#include "sw/device/lib/base/mmio.h"
#include "sw/device/lib/dif/dif_base.h"
#include "sw/device/lib/dif/autogen/dif_aon_timer_autogen.h"

Go to the source code of this file.

Functions

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_start (const dif_aon_timer_t *aon, uint64_t threshold, uint32_t prescaler)
 Starts Always-On Timer (wake-up timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_stop (const dif_aon_timer_t *aon)
 Stops Always-On Timer (wake-up timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_restart (const dif_aon_timer_t *aon)
 Restarts Always-On Timer (wake-up timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_is_enabled (const dif_aon_timer_t *aon, bool *is_enabled)
 Checks whether this Always-On Timer (wake-up timer) is enabled. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_get_wakeup_cause (const dif_aon_timer_t *aon, bool *cause)
 Gets the wakeup cause. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_clear_wakeup_cause (const dif_aon_timer_t *aon)
 Clear Always-On Timer wakeup cause. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_get_count (const dif_aon_timer_t *aon, uint64_t *count)
 Retrieves Always-On Timer (wake-up timer) tick count. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_start (const dif_aon_timer_t *aon, uint32_t bark_threshold, uint32_t bite_threshold, bool pause_in_sleep, bool lock)
 Starts Always-On Timer (watchdog timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_stop (const dif_aon_timer_t *aon)
 Stops Always-On Timer (watchdog timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_restart (const dif_aon_timer_t *aon)
 Restarts Always-On Timer (watchdog timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_is_enabled (const dif_aon_timer_t *aon, bool *is_enabled)
 Checks whether this Always-On Timer (watchdog timer) is enabled. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_get_count (const dif_aon_timer_t *aon, uint32_t *count)
 Retrieves Always-On Timer (watchdog timer) tick count. More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_pet (const dif_aon_timer_t *aon)
 Clears Always-On Timer (watchdog timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_lock (const dif_aon_timer_t *aon)
 Locks Always-On Timer (watchdog timer). More...
 
OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_is_locked (const dif_aon_timer_t *aon, bool *is_locked)
 Checks whether this Always-On Timer (watchdog timer) is locked. More...
 

Detailed Description

Always-On Timer Device Interface Functions

Definition in file dif_aon_timer.h.

Function Documentation

◆ dif_aon_timer_clear_wakeup_cause()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_clear_wakeup_cause ( const dif_aon_timer_t aon)

Clear Always-On Timer wakeup cause.

Clears WKUP_CAUSE register

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 140 of file dif_aon_timer.c.

◆ dif_aon_timer_get_wakeup_cause()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_get_wakeup_cause ( const dif_aon_timer_t aon,
bool *  cause 
)

Gets the wakeup cause.

Parameters
aonAn Always-On Timer handle.
[out]causeThe current cause state.
Returns
The result of the operation.

Definition at line 129 of file dif_aon_timer.c.

◆ dif_aon_timer_wakeup_get_count()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_get_count ( const dif_aon_timer_t aon,
uint64_t *  count 
)

Retrieves Always-On Timer (wake-up timer) tick count.

Parameters
aonAn Always-On Timer handle.
[out]countCurrent timer tick count.
Returns
The result of the operation.

Definition at line 148 of file dif_aon_timer.c.

◆ dif_aon_timer_wakeup_is_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_is_enabled ( const dif_aon_timer_t aon,
bool *  is_enabled 
)

Checks whether this Always-On Timer (wake-up timer) is enabled.

Parameters
aonAn Always-On Timer handle.
[out]is_enabledOut-param for the enabled state.
Returns
The result of the operation.

Definition at line 115 of file dif_aon_timer.c.

◆ dif_aon_timer_wakeup_restart()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_restart ( const dif_aon_timer_t aon)

Restarts Always-On Timer (wake-up timer).

Clears the counter and restarts the timer using the existing configuration.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 103 of file dif_aon_timer.c.

◆ dif_aon_timer_wakeup_start()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_start ( const dif_aon_timer_t aon,
uint64_t  threshold,
uint32_t  prescaler 
)

Starts Always-On Timer (wake-up timer).

This operation starts the wake-up timer with the provided configuration. Note that the timer is stopped and counter cleared, before the timer is started with the new configuration.

Parameters
aonAn Always-On Timer handle.
thresholdThreshold in ticks.
prescaler12 bit pre-scaler to enable very long timeouts (one tick every N + 1 clock cycles, where N is the pre-scaler value).
Returns
The result of the operation.

Definition at line 63 of file dif_aon_timer.c.

◆ dif_aon_timer_wakeup_stop()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_wakeup_stop ( const dif_aon_timer_t aon)

Stops Always-On Timer (wake-up timer).

Stops the timer. Configuration is not touched, and can be restarted via dif_aon_timer_wakeup_restart.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 93 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_get_count()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_get_count ( const dif_aon_timer_t aon,
uint32_t *  count 
)

Retrieves Always-On Timer (watchdog timer) tick count.

Parameters
aonAn Always-On Timer handle.
[out]countCurrent timer tick count.
Returns
The result of the operation.

Definition at line 261 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_is_enabled()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_is_enabled ( const dif_aon_timer_t aon,
bool *  is_enabled 
)

Checks whether this Always-On Timer (watchdog timer) is enabled.

Parameters
aonAn Always-On Timer handle.
[out]is_enabledOut-param for the enabled state.
Returns
The result of the operation.

Definition at line 247 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_is_locked()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_is_locked ( const dif_aon_timer_t aon,
bool *  is_locked 
)

Checks whether this Always-On Timer (watchdog timer) is locked.

Parameters
aonAn Always-On Timer handle.
[out]is_lockedOut-param for the locked state.
Returns
The result of the operation.

Definition at line 292 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_lock()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_lock ( const dif_aon_timer_t aon)

Locks Always-On Timer (watchdog timer).

The watchdog configuration will be locked until the next reset. This means that this timer cannot be stopped, restarted or reconfigured, however the count can be cleared via dif_aon_timer_watchdog_pet.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 282 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_pet()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_pet ( const dif_aon_timer_t aon)

Clears Always-On Timer (watchdog timer).

This function must be called periodically to satisfy "Bite" and "Bark" thresholds. The semantics of this function are similar to dif_aon_timer_watchdog_restart, however it does not write to the control register, and is guaranteed to succeed even when the watchdog is locked.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 272 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_restart()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_restart ( const dif_aon_timer_t aon)

Restarts Always-On Timer (watchdog timer).

Clears the counter and restarts the timer using the existing configuration.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 232 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_start()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_start ( const dif_aon_timer_t aon,
uint32_t  bark_threshold,
uint32_t  bite_threshold,
bool  pause_in_sleep,
bool  lock 
)

Starts Always-On Timer (watchdog timer).

This operation starts the watchdog timer with the provided configuration. Note that the timer is stopped and counter cleared, before the timer is started with the new configuration.

Parameters
aonAn Always-On Timer handle.
bark_threshold"Bark" threshold in ticks.
bite_threshold"Bite" threshold in ticks.
pause_in_sleepWatchdog is paused when device is in one of the low power modes.
lockLock access to watchdog configuration registers.
Returns
The result of the operation.

Definition at line 179 of file dif_aon_timer.c.

◆ dif_aon_timer_watchdog_stop()

OT_WARN_UNUSED_RESULT dif_result_t dif_aon_timer_watchdog_stop ( const dif_aon_timer_t aon)

Stops Always-On Timer (watchdog timer).

Stops the timer. Configuration is not touched, and can be restarted via dif_aon_timer_watchdog_restart.

Parameters
aonAn Always-On Timer handle.
Returns
The result of the operation.

Definition at line 218 of file dif_aon_timer.c.