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

External Interrupt controller HW driver header file. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  neorv32_xirq_t
 

Macros

IO Device: External Interrupt Controller (XIRQ)
#define NEORV32_XIRQ   ((neorv32_xirq_t*) (NEORV32_XIRQ_BASE))
 
#define XIRQ_TRIGGER_LEVEL_LOW   (0b00)
 
#define XIRQ_TRIGGER_LEVEL_HIGH   (0b01)
 
#define XIRQ_TRIGGER_EDGE_FALLING   (0b10)
 
#define XIRQ_TRIGGER_EDGE_RISING   (0b11)
 

Functions

Prototypes
int neorv32_xirq_available (void)
 
int neorv32_xirq_setup (void)
 
void neorv32_xirq_global_enable (void)
 
void neorv32_xirq_global_disable (void)
 
int neorv32_xirq_get_num (void)
 
void neorv32_xirq_setup_trigger (int channel, int config)
 
void neorv32_xirq_clear_pending (int channel)
 
void neorv32_xirq_channel_enable (int channel)
 
void neorv32_xirq_channel_disable (int channel)
 
int neorv32_xirq_install (int channel, void(*handler)(void))
 
int neorv32_xirq_uninstall (int channel)
 

Detailed Description

External Interrupt controller HW driver header file.

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

Macro Definition Documentation

◆ NEORV32_XIRQ

#define NEORV32_XIRQ   ((neorv32_xirq_t*) (NEORV32_XIRQ_BASE))

XIRQ module hardware access (neorv32_xirq_t)

◆ XIRQ_TRIGGER_EDGE_FALLING

#define XIRQ_TRIGGER_EDGE_FALLING   (0b10)

XIRQ trigger configuration

◆ XIRQ_TRIGGER_EDGE_RISING

#define XIRQ_TRIGGER_EDGE_RISING   (0b11)

XIRQ trigger configuration

◆ XIRQ_TRIGGER_LEVEL_HIGH

#define XIRQ_TRIGGER_LEVEL_HIGH   (0b01)

XIRQ trigger configuration

◆ XIRQ_TRIGGER_LEVEL_LOW

#define XIRQ_TRIGGER_LEVEL_LOW   (0b00)

XIRQ trigger configuration

Function Documentation

◆ neorv32_xirq_available()

int neorv32_xirq_available ( void )

Check if external interrupt controller was synthesized.

Returns
0 if XIRQ was not synthesized, 1 if EXTIRQ is available.

◆ neorv32_xirq_channel_disable()

void neorv32_xirq_channel_disable ( int channel)

Disable IRQ channel.

Parameters
[in]channelXIRQ interrupt channel (0..31).

◆ neorv32_xirq_channel_enable()

void neorv32_xirq_channel_enable ( int channel)

Enable IRQ channel.

Parameters
[in]channelXIRQ interrupt channel (0..31).

◆ neorv32_xirq_clear_pending()

void neorv32_xirq_clear_pending ( int channel)

Clear pending interrupt.

Parameters
[in]channelXIRQ interrupt channel (0..31).

◆ neorv32_xirq_get_num()

int neorv32_xirq_get_num ( void )

Get number of implemented XIRQ channels

Returns
Number of implemented channels (0..32).

◆ neorv32_xirq_global_disable()

void neorv32_xirq_global_disable ( void )

Globally disable XIRQ interrupts (via according FIRQ channel).

Note
Triggered / triggering XIRQ will remain pending.

◆ neorv32_xirq_global_enable()

void neorv32_xirq_global_enable ( void )

Globally enable XIRQ interrupts (via according FIRQ channel).

Note
Triggered / triggering XIRQ will remain pending.

◆ neorv32_xirq_install()

int neorv32_xirq_install ( int channel,
void(* handler )(void) )

Install interrupt handler function for XIRQ channel.

Parameters
[in]channelXIRQ interrupt channel (0..31).
[in]handlerThe actual handler function for the specified interrupt (function MUST be of type "void function(void);").
Returns
0 if success, 1 if error.

◆ neorv32_xirq_setup()

int neorv32_xirq_setup ( void )

Initialize XIRQ controller.

Note
All interrupt channels will be deactivated, all pending IRQs will be deleted and all handler addresses will be deleted.
Returns
0 if success, != 0 if error.

◆ neorv32_xirq_setup_trigger()

void neorv32_xirq_setup_trigger ( int channel,
int config )

Configure a channel's trigger type.

Parameters
[in]channelXIRQ interrupt channel (0..31).
[in]configTrigger type: 00 = low-level, 01 = high-level, 10 = falling-edge, 11 = rising-edge.

◆ neorv32_xirq_uninstall()

int neorv32_xirq_uninstall ( int channel)

Uninstall interrupt handler function for XIRQ channel.

Note
This will also deactivate the according XIRQ channel.
Parameters
[in]channelXIRQ interrupt channel (0..31).
Returns
0 if success, 1 if error.