RV32 SoC DS UG
High-Perf RV32 SoC DS UG
RV64 SoC DS UG API and Examples
Embedded IDE UG
Loading...
Searching...
No Matches
timer.h File Reference
#include "type.h"
#include "io.h"

Go to the source code of this file.

Overview

User Timer driver API definitions.

Author
Efinix Inc

This file provides data structures and APIs for controlling the User Timer peripheral on the EfxSapphireSoC platform.

Definition in file timer.h.

Data Structures

struct  timer_hwreg_t
 UserTimer hardware register map. More...
struct  timer_instance_t
 UserTimer instance. Holds the software registers and hardware pointer. More...

Macros

#define TIMER_CONFIG_WITH_PRESCALER   0x2
 Prescaler Enabled *‍/.
#define TIMER_CONFIG_WITHOUT_PRESCALER   0x1
 No Prescaler *‍/.
#define TIMER_CONFIG_SELF_RESTART   0x10000
 Self Restart *‍/.

Functions

void timer_applyConfig (timer_instance_t *inst)
 Apply the software configuration to the hardware.
void timer_clearValue (timer_instance_t *inst)
 Clear Timer Value to zero.
UserTimer (Get Functions)

Read values from the Timer hardware registers.

u32 timer_getConfig (timer_instance_t *inst)
 Get stored Timer Configuration.
u32 timer_getLimit (timer_instance_t *inst)
 Get stored Timer Limit (Reload Value).
u32 timer_getValue (timer_instance_t *inst)
 Get current Timer Value.
u32 timer_getPrescalerValue (timer_instance_t *inst)
 Get stored Prescaler Value.
UserTimer (Set Functions)

Write values to the Timer registers.

Note
Call timer_applyConfig() to make these changes effective.
u32 timer_setConfig (timer_instance_t *inst, u32 value)
 Set Timer Configuration.
u32 timer_setPrescalerValue (timer_instance_t *inst, u32 value)
 Set Prescaler Value.
u32 timer_setLimit (timer_instance_t *inst, u32 value)
 Get stored Timer Limit (Reload Value).