Skip to content
Snippets Groups Projects
Verified Commit 941fb5c4 authored by rahix's avatar rahix
Browse files

fix(api): Change interrupt idle value to -1


Previously 0 was used but as 0 is also the ID of the reset interrupt,
this could lead to weird behaviors.

Signed-off-by: default avatarRahix <rahix@rahix.de>
parent b8940bcd
No related branches found
No related tags found
No related merge requests found
...@@ -231,6 +231,9 @@ void __dispatch_isr(api_int_id_t id) ...@@ -231,6 +231,9 @@ void __dispatch_isr(api_int_id_t id)
f_client.write(tmp.format(**isr)) f_client.write(tmp.format(**isr))
tmp = """\ tmp = """\
case (-1):
/* Ignore a spurious interrupt */
break;
default: default:
epic_isr_default_handler(id); epic_isr_default_handler(id);
break; break;
......
...@@ -10,5 +10,5 @@ void TMR5_IRQHandler(void) ...@@ -10,5 +10,5 @@ void TMR5_IRQHandler(void)
{ {
TMR_IntClear(MXC_TMR5); TMR_IntClear(MXC_TMR5);
__dispatch_isr(API_CALL_MEM->int_id); __dispatch_isr(API_CALL_MEM->int_id);
API_CALL_MEM->int_id = 0; API_CALL_MEM->int_id = (-1);
} }
...@@ -11,8 +11,9 @@ int api_interrupt_trigger(api_int_id_t id) ...@@ -11,8 +11,9 @@ int api_interrupt_trigger(api_int_id_t id)
} }
if (int_enabled[id]) { if (int_enabled[id]) {
while (API_CALL_MEM->int_id) while (API_CALL_MEM->int_id != (-1))
; ;
API_CALL_MEM->int_id = id; API_CALL_MEM->int_id = id;
TMR_TO_Start(MXC_TMR5, 1, 0); TMR_TO_Start(MXC_TMR5, 1, 0);
} }
...@@ -21,7 +22,7 @@ int api_interrupt_trigger(api_int_id_t id) ...@@ -21,7 +22,7 @@ int api_interrupt_trigger(api_int_id_t id)
void api_interrupt_init(void) void api_interrupt_init(void)
{ {
API_CALL_MEM->int_id = 0; API_CALL_MEM->int_id = (-1);
for (int i = 0; i < EPIC_INT_NUM; i++) { for (int i = 0; i < EPIC_INT_NUM; i++) {
int_enabled[i] = false; int_enabled[i] = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment