Skip to content

Commit

Permalink
[sw/example] adjust XIRQ programs
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting committed Oct 20, 2024
1 parent b3b73c5 commit 07eb83d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
7 changes: 1 addition & 6 deletions sw/example/demo_xirq/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,6 @@ int main() {
// All incoming XIRQ interrupt requests are "prioritized" in this example. The XIRQ FIRQ handler
// reads the ID of the interrupt with the highest priority from the XIRQ controller ("source" register) and calls the according
// handler function (installed via neorv32_xirq_install();).
// Non-prioritized handling of interrupts (or custom prioritization) can be implemented by manually reading the
// XIRQ controller's "pending" register. Then it is up to the software to define which pending IRQ should be serviced first.

asm volatile ("nop");
asm volatile ("nop");
Expand All @@ -165,15 +163,12 @@ int main() {


// just as an example: to disable certain XIRQ interrupt channels, we can
// un-install the according handler. this will also clear a pending interrupt for that channel
// un-install the according handler. this will also disable the according channel.
neorv32_xirq_uninstall(0); // disable XIRQ channel 0 and remove associated handler
neorv32_xirq_uninstall(1); // disable XIRQ channel 1 and remove associated handler
neorv32_xirq_uninstall(2); // disable XIRQ channel 2 and remove associated handler
neorv32_xirq_uninstall(3); // disable XIRQ channel 3 and remove associated handler

// you can also manually clear pending interrupts
neorv32_xirq_clear_pending(0); // clear pending interrupt of channel 0

// manually enable and disable XIRQ channels
neorv32_xirq_channel_enable(0); // enable channel 0
neorv32_xirq_channel_disable(0); // disable channel 0
Expand Down
2 changes: 0 additions & 2 deletions sw/example/processor_check/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1324,8 +1324,6 @@ int main() {
xirq_err_cnt += neorv32_xirq_install(1, xirq_trap_handler1); // install XIRQ IRQ handler channel 1
neorv32_xirq_setup_trigger(0, XIRQ_TRIGGER_EDGE_RISING); // configure channel 0 as rising-edge trigger
neorv32_xirq_setup_trigger(1, XIRQ_TRIGGER_EDGE_RISING); // configure channel 1 as rising-edge trigger
neorv32_xirq_clear_pending(0); // clear any pending request
neorv32_xirq_clear_pending(1); // clear any pending request
neorv32_xirq_channel_enable(0); // enable XIRQ channel 0
neorv32_xirq_channel_enable(1); // enable XIRQ channel 1

Expand Down

0 comments on commit 07eb83d

Please sign in to comment.