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

- Main Page
- Modules
- Data Structures
- Files

Data Structures | Enumerations | Functions
Always-on Counters

Always-on Counters. More...

## Data Structures
struct | qm_aonpt_config_t
| QM Always-on Periodic Timer configuration type. More...

## Enumerations
enum | qm_aonpt_status_t { QM_AONPT_READY = 0, QM_AONPT_EXPIRED }
| Always on counter status. More...

## Functions
int | qm_aonc_enable (const qm_aonc_t aonc)
| Enable the Always-on Counter. More...
int | qm_aonc_disable (const qm_aonc_t aonc)
| Disable the Always-on Counter. More...
int | qm_aonc_get_value (const qm_aonc_t aonc, uint32_t *const val)
| Get the current value of the Always-on Counter. More...
int | qm_aonpt_set_config (const qm_aonc_t aonc, const qm_aonpt_config_t *const cfg)
| Set the Always-on Periodic Timer configuration. More...
int | qm_aonpt_get_value (const qm_aonc_t aonc, uint32_t *const val)
| Get the current value of the Always-on Periodic Timer. More...
int | qm_aonpt_get_status (const qm_aonc_t aonc, qm_aonpt_status_t *const status)
| Get the current status of an Always-on Periodic Timer. More...
int | qm_aonpt_clear (const qm_aonc_t aonc)
| Clear the status of the Always-on Periodic Timer. More...
int | qm_aonpt_reset (const qm_aonc_t aonc)
| Reset the Always-on Periodic Timer back to the configured value. More...
int | qm_aonpt_save_context (const qm_aonc_t aonc, qm_aonc_context_t *const ctx)
| Save the Always-on Periodic Timer context. More...
int | qm_aonpt_restore_context (const qm_aonc_t aonc, const qm_aonc_context_t *const ctx)
| Restore the Always-on Periodic Timer context. More...

## Detailed Description

Always-on Counters.

Note
  The always on counters are in the 32kHz clock domain. Some register operations take a minimum of a 32kHz clock cycle to complete. If the Always on timer interrupt is not configured to be edge triggered, multiple interrupts will occur.

## Enumeration Type Documentation

enum qm_aonpt_status_t

Always on counter status.

Enumerator
QM_AONPT_READY | Default Timer Status.
QM_AONPT_EXPIRED | Timer expired. Status must be cleared with qm_aonpt_clear().

Definition at line 26 of file qm_aon_counters.h.

## Function Documentation

int qm_aonc_disable | ( | const qm_aonc_t | aonc | ) |

Disable the Always-on Counter.

Parameters

  [in] | aonc | Always-on counter to read.

Returns
  Standard errno return type for QMSI.

Return values

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

Definition at line 140 of file qm_aon_counters.c.

int qm_aonc_enable | ( | const qm_aonc_t | aonc | ) |

Enable the Always-on Counter.

Parameters

  [in] | aonc | Always-on counter to read.

Returns
  Standard errno return type for QMSI.

Return values

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

Definition at line 130 of file qm_aon_counters.c.

int qm_aonc_get_value | ( | const qm_aonc_t | aonc,
|  | uint32_t *const | val
| ) |  |

Get the current value of the Always-on Counter.

Returns a 32-bit value which represents the number of clock cycles since the counter was first enabled.

Parameters

  [in] | aonc | Always-on counter to read.
  [out] | val | Value of the counter. 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_aon_counters.c.

int qm_aonpt_clear | ( | const qm_aonc_t | aonc | ) |

Clear the status of the Always-on Periodic Timer.

The status must be clear before the Always-on Periodic Timer can trigger another interrupt.

Parameters

  [in] | aonc | Always-on counter to read.

Returns
  Standard errno return type for QMSI.

Return values

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

Definition at line 210 of file qm_aon_counters.c.

int qm_aonpt_get_status | ( | const qm_aonc_t | aonc,
|  | qm_aonpt_status_t *const | status
| ) |  |

Get the current status of an Always-on Periodic Timer.

Parameters

  [in] | aonc | Always-on counter to read.
  [out] | status | Status of the Always-on Periodic Timer. 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 195 of file qm_aon_counters.c.

References QM_AONPT_EXPIRED, and QM_AONPT_READY.

int qm_aonpt_get_value | ( | const qm_aonc_t | aonc,
|  | uint32_t *const | val
| ) |  |

Get the current value of the Always-on Periodic Timer.

Returns a 32-bit value which represents the number of clock cycles remaining before the timer fires. This is the initial configured number minus the number of cycles that have passed.

Parameters

  [in] | aonc | Always-on counter to read.
  [out] | val | Value of the Always-on Periodic Timer. 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 184 of file qm_aon_counters.c.

int qm_aonpt_reset | ( | const qm_aonc_t | aonc | ) |

Reset the Always-on Periodic Timer back to the configured value.

Parameters

  [in] | aonc | Always-on counter to read.

Returns
  Standard errno return type for QMSI.

Return values

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

Definition at line 224 of file qm_aon_counters.c.

int qm_aonpt_restore_context | ( | const qm_aonc_t | aonc,
|  | const qm_aonc_context_t *const | ctx
| ) |  |

Restore the Always-on Periodic Timer context.

Restore the configuration of the specified AONC peripheral after exiting sleep.

Parameters

  [in] | aonc | AONC index.
  [in] | ctx | AONC 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 246 of file qm_aon_counters.c.

int qm_aonpt_save_context | ( | const qm_aonc_t | aonc,
|  | qm_aonc_context_t *const | ctx
| ) |  |

Save the Always-on Periodic Timer context.

Save the configuration of the specified AONC peripheral before entering sleep.

Parameters

  [in] | aonc | AONC index.
  [out] | ctx | AONC 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 235 of file qm_aon_counters.c.

int qm_aonpt_set_config | ( | const qm_aonc_t | aonc,
|  | const qm_aonpt_config_t *const | cfg
| ) |  |

Set the Always-on Periodic Timer configuration.

This includes the initial value of the Always-on Periodic Timer, the interrupt enable and the callback function that will be run when the timer expiers and an interrupt is triggered. The Periodic Timer is disabled if the counter is set to 0.

Parameters

  [in] | aonc | Always-on counter to read.
  [in] | cfg | New configuration for the Always-on Periodic Timer. 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 160 of file qm_aon_counters.c.

References qm_aonpt_config_t::callback, qm_aonpt_config_t::callback_data, qm_aonpt_config_t::count, and qm_aonpt_config_t::int_en.