Intel® Quark™ Microcontroller Software Interface 1.4.0 Intel® Quark™ Microcontroller BSP

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Functions
RTC

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...

## Detailed Description

Real Time Clock.

Warning
  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 a transaction to complete the SOC will not wake from sleep.

## Function Documentation

int qm_rtc_read | ( | const qm_rtc_t | rtc,
|  | uint32_t *const | value
| ) |  |

Read the RTC register value.

Parameters

  [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.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 101 of file qm_rtc.c.

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.

Parameters

  [in] | rtc | RTC index.
  [in] | ctx | RTC context structure. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 158 of file qm_rtc.c.

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.

Parameters

  [in] | rtc | RTC index.
  [out] | ctx | RTC context structure. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  0 | on success.
  Negative | errno for possible error codes.

Definition at line 150 of file qm_rtc.c.

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.

Parameters

  [in] | rtc | RTC index.
  [in] | alarm_val | Value to set alarm to.

Returns
  Standard errno return type for QMSI.

Return values

  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.

Parameters

  [in] | rtc | RTC index.
  [in] | cfg | New RTC configuration. This must not be NULL.

Returns
  Standard errno return type for QMSI.

Return values

  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().