NEORV32 - Software Framework Documentation
Loading...
Searching...
No Matches
Data Structures
neorv32_gptmr.h File Reference

General purpose timer (GPTMR) HW driver header file. More...

Go to the source code of this file.

Data Structures

struct  neorv32_gptmr_t
 

Functions

Prototypes
int neorv32_gptmr_available (void)
 
void neorv32_gptmr_setup (int prsc, int mode, uint32_t threshold)
 
void neorv32_gptmr_disable (void)
 
void neorv32_gptmr_enable (void)
 
void neorv32_gptmr_restart (void)
 

IO Device: General Purpose Timer (GPTMR)

#define NEORV32_GPTMR   ((neorv32_gptmr_t*) (NEORV32_GPTMR_BASE))
 
enum  NEORV32_GPTMR_CTRL_enum {
  GPTMR_CTRL_EN = 0 , GPTMR_CTRL_PRSC0 = 1 , GPTMR_CTRL_PRSC1 = 2 , GPTMR_CTRL_PRSC2 = 3 ,
  GPTMR_CTRL_MODE = 4
}
 

Detailed Description

General purpose timer (GPTMR) HW driver header file.

Note
These functions should only be used if the GPTMR unit was synthesized (IO_GPTMR_EN = true).

Macro Definition Documentation

◆ NEORV32_GPTMR

#define NEORV32_GPTMR   ((neorv32_gptmr_t*) (NEORV32_GPTMR_BASE))

GPTMR module hardware access (neorv32_gptmr_t)

Enumeration Type Documentation

◆ NEORV32_GPTMR_CTRL_enum

GPTMR control/data register bits

Enumerator
GPTMR_CTRL_EN 

GPTIMR control register(0) (r/w): Timer unit enable

GPTMR_CTRL_PRSC0 

GPTIMR control register(1) (r/w): Clock prescaler select bit 0

GPTMR_CTRL_PRSC1 

GPTIMR control register(2) (r/w): Clock prescaler select bit 1

GPTMR_CTRL_PRSC2 

GPTIMR control register(3) (r/w): Clock prescaler select bit 2

GPTMR_CTRL_MODE 

GPTIMR control register(4) (r/w): Timer mode: 0=single-shot mode, 1=continuous mode

Function Documentation

◆ neorv32_gptmr_available()

int neorv32_gptmr_available ( void  )

Check if general purpose timer unit was synthesized.

Returns
0 if GPTMR was not synthesized, 1 if GPTMR is available.

◆ neorv32_gptmr_disable()

void neorv32_gptmr_disable ( void  )

Disable general purpose timer.

◆ neorv32_gptmr_enable()

void neorv32_gptmr_enable ( void  )

Enable general purpose timer.

◆ neorv32_gptmr_restart()

void neorv32_gptmr_restart ( void  )

Reset general purpose timer's counter register.

◆ neorv32_gptmr_setup()

void neorv32_gptmr_setup ( int  prsc,
int  mode,
uint32_t  threshold 
)

Enable and configure general purpose timer.

Parameters
[in]prscClock prescaler select (0..7). See NEORV32_CLOCK_PRSC_enum.
[in]mode0=single-shot mode, 1=continuous mode
[in]thresholdThreshold value to trigger interrupt.