Machine System Timer (MTIME) HW driver source file.
More...
Machine System Timer (MTIME) HW driver source file.
- Note
- These functions should only be used if the MTIME unit was synthesized (IO_MTIME_EN = true).
- See also
- https://stnolting.github.io/neorv32/sw/files.html
◆ 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_get_unixtime()
uint64_t neorv32_mtime_get_unixtime |
( |
void | | ) |
|
Get Unix time from TIME.
- Returns
- Unix time since 00:00:00 UTC, January 1st, 1970 in seconds.
◆ 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] | time | New 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] | timecmp | System time for interrupt (uint64_t) |
◆ neorv32_mtime_set_unixtime()
void neorv32_mtime_set_unixtime |
( |
uint64_t | unixtime | ) |
|
Set TIME to Unix time.
- Parameters
-
[in] | unixtime | Unix time since 00:00:00 UTC, January 1st, 1970 in seconds. |