NEORV32 Software Framework Documentation
The NEORV32 RISC-V Processor
Loading...
Searching...
No Matches
neorv32_clint.h File Reference

Hardware Local Interruptor (CLINT) HW driver header file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  neorv32_clint_t
 

Macros

IO Device: Core Local Interruptor (CLINT)
#define NEORV32_CLINT   ((neorv32_clint_t*) (NEORV32_CLINT_BASE))
 

Functions

Prototypes
int neorv32_clint_available (void)
 
void neorv32_clint_msi_set (int hart)
 
void neorv32_clint_msi_clr (int hart)
 
uint32_t neorv32_clint_msi_get (int hart)
 
void neorv32_clint_time_set (uint64_t time)
 
uint64_t neorv32_clint_time_get (void)
 
void neorv32_clint_mtimecmp_set (uint64_t timecmp)
 
uint64_t neorv32_clint_mtimecmp_get (void)
 
void neorv32_clint_unixtime_set (uint64_t unixtime)
 
uint64_t neorv32_clint_unixtime_get (void)
 

Detailed Description

Hardware Local Interruptor (CLINT) HW driver header file.

See also
https://stnolting.github.io/neorv32/sw/files.html

Macro Definition Documentation

◆ NEORV32_CLINT

#define NEORV32_CLINT   ((neorv32_clint_t*) (NEORV32_CLINT_BASE))

CLINT module hardware access (neorv32_clint_t)

Function Documentation

◆ neorv32_clint_available()

int neorv32_clint_available ( void )

Check if CLINT module was synthesized.

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

◆ neorv32_clint_msi_clr()

void neorv32_clint_msi_clr ( int hart)

Clear machine software interrupt.

Parameters
[in]hartHart index (0..4095).

◆ neorv32_clint_msi_get()

uint32_t neorv32_clint_msi_get ( int hart)

Get machine software interrupt register.

Parameters
[in]hartHart index (0..4095).

◆ neorv32_clint_msi_set()

void neorv32_clint_msi_set ( int hart)

Trigger machine software interrupt.

Parameters
[in]hartHart index (0..4095).

◆ neorv32_clint_mtimecmp_get()

uint64_t neorv32_clint_mtimecmp_get ( void )

Get MTIMER compare time register (MTIMECMP).

Note
This functions uses MHARTID to automatically select the according hart's MTIMECMP register.
Returns
Current MTIMECMP value.

◆ neorv32_clint_mtimecmp_set()

void neorv32_clint_mtimecmp_set ( uint64_t timecmp)

Set MTIMER compare time register (MTIMECMP) for generating interrupts.

Note
This functions uses MHARTID to automatically select the according hart's MTIMECMP register.
Parameters
[in]timecmpSystem time for interrupt (uint64_t).

◆ neorv32_clint_time_get()

uint64_t neorv32_clint_time_get ( void )

Get current system time.

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

◆ neorv32_clint_time_set()

void neorv32_clint_time_set ( uint64_t time)

Set current CLINT system time.

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

◆ neorv32_clint_unixtime_get()

uint64_t neorv32_clint_unixtime_get ( void )

Get Unix time from MTIMER.

Returns
Unix time since 00:00:00 UTC, January 1st, 1970 in seconds.

◆ neorv32_clint_unixtime_set()

void neorv32_clint_unixtime_set ( uint64_t unixtime)

Set MTIMER to Unix time.

Parameters
[in]unixtimeUnix time since 00:00:00 UTC, January 1st, 1970 in seconds.