Intel® Quark™ Microcontroller Software Interface
1.4.0
Intel® Quark™ Microcontroller BSP
|
Real Time Clock. More...
Data Structures | |
struct | qm_rtc_config_t |
QM RTC configuration type. More... | |
Functions | |
int | qm_rtc_set_config (const qm_rtc_t rtc, const qm_rtc_config_t *const cfg) |
Set RTC configuration. More... | |
int | qm_rtc_set_alarm (const qm_rtc_t rtc, const uint32_t alarm_val) |
Set Alarm value. More... | |
int | qm_rtc_read (const qm_rtc_t rtc, uint32_t *const value) |
Read the RTC register value. More... | |
int | qm_rtc_save_context (const qm_rtc_t rtc, qm_rtc_context_t *const ctx) |
Save RTC context. More... | |
int | qm_rtc_restore_context (const qm_rtc_t rtc, const qm_rtc_context_t *const ctx) |
Restore RTC context. More... | |
Real Time Clock.
int qm_rtc_read | ( | const qm_rtc_t | rtc, |
uint32_t *const | value | ||
) |
Read the RTC register value.
[in] | rtc | RTC index. |
[out] | value | Location to store RTC value. This must not be NULL. |
The RTC clock resides in a different clock domain to the system clock. It takes 3-4 RTC ticks for a system clock write to propagate to the RTC domain. If an entry to sleep is initiated without waiting for the transaction to complete the SOC will not wake from sleep.
0 | on success. |
Negative | errno for possible error codes. |
int qm_rtc_restore_context | ( | const qm_rtc_t | rtc, |
const qm_rtc_context_t *const | ctx | ||
) |
Restore RTC context.
Restore the configuration of the specified RTC peripheral after exiting sleep.
[in] | rtc | RTC index. |
[in] | ctx | RTC context structure. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
int qm_rtc_save_context | ( | const qm_rtc_t | rtc, |
qm_rtc_context_t *const | ctx | ||
) |
Save RTC context.
Save the configuration of the specified RTC peripheral before entering sleep.
[in] | rtc | RTC index. |
[out] | ctx | RTC context structure. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
int qm_rtc_set_alarm | ( | const qm_rtc_t | rtc, |
const uint32_t | alarm_val | ||
) |
Set Alarm value.
Set a new RTC alarm value after an alarm, that has been set using the qm_rtc_set_config function, has expired and a new alarm value is required.
The RTC clock resides in a different clock domain to the system clock. It takes 3-4 RTC ticks for a system clock write to propagate to the RTC domain. If an entry to sleep is initiated without waiting for the transaction to complete the SOC will not wake from sleep.
[in] | rtc | RTC index. |
[in] | alarm_val | Value to set alarm to. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 85 of file qm_rtc.c.
Referenced by qm_rtc_set_config().
int qm_rtc_set_config | ( | const qm_rtc_t | rtc, |
const qm_rtc_config_t *const | cfg | ||
) |
Set RTC configuration.
This includes the initial value in RTC clock periods, and the alarm value if an alarm is required. If the alarm is enabled, register an ISR with the user defined callback function.
[in] | rtc | RTC index. |
[in] | cfg | New RTC configuration. This must not be NULL. |
0 | on success. |
Negative | errno for possible error codes. |
Definition at line 37 of file qm_rtc.c.
References qm_rtc_config_t::alarm_en, qm_rtc_config_t::alarm_val, qm_rtc_config_t::callback, qm_rtc_config_t::callback_data, clk_rtc_set_div(), qm_rtc_config_t::init_val, qm_rtc_config_t::prescaler, and qm_rtc_set_alarm().