Skip to content

Commit

Permalink
[sw] XIRQ: fix auto channel-enabling
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Jun 29, 2024
1 parent c0c8c21 commit 49660bc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 7 additions & 0 deletions sw/example/demo_xirq/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ int main() {
return 1;
}

// enable XIRQ channels
neorv32_xirq_channel_enable(0);
neorv32_xirq_channel_enable(1);
neorv32_xirq_channel_enable(2);
neorv32_xirq_channel_enable(3);


// allow XIRQ to trigger CPU interrupt
neorv32_xirq_global_enable();

Expand Down
5 changes: 0 additions & 5 deletions sw/lib/source/neorv32_xirq.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ void neorv32_xirq_channel_disable(int channel) {
/**********************************************************************//**
* Install interrupt handler function for XIRQ channel.
*
* @note This will also activate the according XIRQ channel and clear a pending IRQ at this channel.
*
* @param[in] channel XIRQ interrupt channel (0..31).
* @param[in] handler The actual handler function for the specified interrupt (function MUST be of type "void function(void);").
* @return 0 if success, 1 if error.
Expand All @@ -225,9 +223,6 @@ int neorv32_xirq_install(int channel, void (*handler)(void)) {
// channel valid?
if (channel < 32) {
__neorv32_xirq_vector_lut[channel] = (uint32_t)handler; // install handler
uint32_t mask = 1 << channel;
NEORV32_XIRQ->EIP = ~mask; // clear if pending
NEORV32_XIRQ->EIE |= mask; // enable channel
return 0;
}
return 1;
Expand Down

0 comments on commit 49660bc

Please sign in to comment.