Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

software: fix clic-nonvector-interrupts timer interrupt registration error #612

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions software/clic-nonvector-interrupts/clic-nonvector-interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ int main (void)
}
metal_interrupt_init(cpu_intr);

// Lets get a CLIC interrupt controller explicitly
clic = metal_interrupt_get_controller(METAL_CLIC_CONTROLLER,
metal_cpu_get_current_hartid());
if (clic == NULL) {
printf("Exit. This example need a clic interrupt controller.\n");
return 0;
}
metal_interrupt_init(clic);

// Lets set CLIC in Hardware Vector mode. Note this must be done AFTER init!!
metal_interrupt_set_vector_mode(clic, METAL_SELECTIVE_NONVECTOR_MODE);

// Setup Timer interrupt
tmr_intr = metal_cpu_timer_interrupt_controller(cpu);
if (tmr_intr == NULL) {
Expand All @@ -82,18 +94,6 @@ int main (void)
return (rc * -1);
}

// Lets get a CLIC interrupt controller explicitly
clic = metal_interrupt_get_controller(METAL_CLIC_CONTROLLER,
metal_cpu_get_current_hartid());
if (clic == NULL) {
printf("Exit. This example need a clic interrupt controller.\n");
return 0;
}
metal_interrupt_init(clic);

// Lets set CLIC in Hardware Vector mode. Note this must be done AFTER init!!
metal_interrupt_set_vector_mode(clic, METAL_SELECTIVE_NONVECTOR_MODE);

csip_irq = 12;
rc = metal_interrupt_register_handler(clic, csip_irq, csip_isr, NULL);
if (rc < 0) {
Expand Down