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

Machine System Timer (MTIME) HW driver header file. More...

Go to the source code of this file.

Data Structures

struct  neorv32_mtime_t
 

Macros

IO Device: Machine System Timer (MTIME)
#define NEORV32_MTIME   ((neorv32_mtime_t*) (NEORV32_MTIME_BASE))
 

Functions

Prototypes
int neorv32_mtime_available (void)
 
void neorv32_mtime_set_time (uint64_t time)
 
uint64_t neorv32_mtime_get_time (void)
 
void neorv32_mtime_set_timecmp (uint64_t timecmp)
 
uint64_t neorv32_mtime_get_timecmp (void)
 

Detailed Description

Machine System Timer (MTIME) HW driver header file.

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

Macro Definition Documentation

◆ NEORV32_MTIME

#define NEORV32_MTIME   ((neorv32_mtime_t*) (NEORV32_MTIME_BASE))

MTIME module hardware access (neorv32_mtime_t)

Function Documentation

◆ neorv32_mtime_available()

int neorv32_mtime_available ( void )

Check if MTIME unit was synthesized.

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

◆ neorv32_mtime_get_time()

uint64_t neorv32_mtime_get_time ( void )

Get current system time.

Note
The MTIME timer increments with the primary processor clock.
Returns
Current system time (uint64_t)

◆ neorv32_mtime_get_timecmp()

uint64_t neorv32_mtime_get_timecmp ( void )

Get compare time register (MTIMECMP).

Returns
Current MTIMECMP value.

◆ neorv32_mtime_set_time()

void neorv32_mtime_set_time ( uint64_t time)

Set current system time.

Note
The MTIME timer increments with the primary processor clock.
Parameters
[in]timeNew system time (uint64_t)

◆ neorv32_mtime_set_timecmp()

void neorv32_mtime_set_timecmp ( uint64_t timecmp)

Set compare time register (MTIMECMP) for generating interrupts.

Note
The interrupt is triggered when MTIME >= MTIMECMP.
Global interrupts and the timer interrupt source have to be enabled .
Parameters
[in]timecmpSystem time for interrupt (uint64_t)