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

PIC timer. More...

Data Structures

struct  qm_pic_timer_config_t
 PIC timer configuration type. More...
 

Enumerations

enum  qm_pic_timer_mode_t { QM_PIC_TIMER_MODE_ONE_SHOT, QM_PIC_TIMER_MODE_PERIODIC }
 PIC timer mode type. More...
 

Functions

int qm_pic_timer_set_config (const qm_pic_timer_config_t *const cfg)
 Set the PIC timer configuration. More...
 
int qm_pic_timer_set (const uint32_t count)
 Set the current count value of the PIC timer. More...
 
int qm_pic_timer_get (uint32_t *const count)
 Get the current count value of the PIC timer. More...
 
int qm_pic_timer_save_context (qm_pic_timer_context_t *const ctx)
 Save PIC Timer peripheral's context. More...
 
int qm_pic_timer_restore_context (const qm_pic_timer_context_t *const ctx)
 Restore PIC Timer peripheral's context. More...
 

Detailed Description

PIC timer.

Enumeration Type Documentation

PIC timer mode type.

Enumerator
QM_PIC_TIMER_MODE_ONE_SHOT 

One shot mode.

QM_PIC_TIMER_MODE_PERIODIC 

Periodic mode.

Definition at line 21 of file qm_pic_timer.h.

Function Documentation

int qm_pic_timer_get ( uint32_t *const  count)

Get the current count value of the PIC timer.

Parameters
[out]countPointer to the store the timer count. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 76 of file qm_pic_timer.c.

int qm_pic_timer_restore_context ( const qm_pic_timer_context_t *const  ctx)

Restore PIC Timer peripheral's context.

Restore the configuration of the specified PIC Timer peripheral after exiting sleep. The timer is restored to the count saved before sleep.

Parameters
[in]ctxPIC Timer context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 116 of file qm_pic_timer.c.

References qm_pic_timer_context_t::lvttimer, qm_pic_timer_context_t::timer_dcr, and qm_pic_timer_context_t::timer_icr.

int qm_pic_timer_save_context ( qm_pic_timer_context_t *const  ctx)

Save PIC Timer peripheral's context.

Saves the configuration of the specified PIC Timer peripheral before entering sleep.

Parameters
[out]ctxPIC Timer context structure. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 109 of file qm_pic_timer.c.

References qm_pic_timer_context_t::lvttimer, qm_pic_timer_context_t::timer_dcr, and qm_pic_timer_context_t::timer_icr.

int qm_pic_timer_set ( const uint32_t  count)

Set the current count value of the PIC timer.

Set the current count value of the PIC timer. A value equal to 0 effectively stops the timer.

Parameters
[in]countValue to load the timer with.
Returns
Standard errno return type for QMSI.
Return values
Alwaysreturns 0.
Negativeerrno for possible error codes.

Definition at line 69 of file qm_pic_timer.c.

int qm_pic_timer_set_config ( const qm_pic_timer_config_t *const  cfg)

Set the PIC timer configuration.

Set the PIC timer configuration. This includes timer mode and if interrupts are enabled. If interrupts are enabled, it will configure the callback function.

Parameters
[in]cfgPIC timer configuration. This must not be NULL.
Returns
Standard errno return type for QMSI.
Return values
0on success.
Negativeerrno for possible error codes.

Definition at line 41 of file qm_pic_timer.c.

References qm_pic_timer_config_t::callback, qm_pic_timer_config_t::callback_data, qm_pic_timer_config_t::int_en, qm_pic_timer_config_t::mode, and QM_PIC_TIMER_MODE_PERIODIC.