Commit 0b845e99 authored by Rahix's avatar Rahix

chore(interrupts): Make api_interrupt_trigger() return void

api_interrupt_trigger() cannot fail except by a programmer error
(passing an invalid ID) in which case we should raise an assertion.
Thus, make it return `void` instead of `int`.

This is also in preparation for future work to schedule interrupts
asynchroneously.
Signed-off-by: Rahix's avatarRahix <rahix@rahix.de>
parent 12992926
#include "api/interrupt-sender.h"
#include "api/common.h"
#include "tmr_utils.h"
#include <assert.h>
static bool int_enabled[EPIC_INT_NUM];
int api_interrupt_trigger(api_int_id_t id)
void api_interrupt_trigger(api_int_id_t id)
{
if (id >= EPIC_INT_NUM) {
return -EINVAL;
}
assert(id < EPIC_INT_NUM);
if (int_enabled[id]) {
while (API_CALL_MEM->int_id != (api_int_id_t)(-1))
......@@ -17,7 +16,6 @@ int api_interrupt_trigger(api_int_id_t id)
API_CALL_MEM->int_id = id;
TMR_TO_Start(MXC_TMR5, 1, 0);
}
return 0;
}
void api_interrupt_init(void)
......
......@@ -2,4 +2,4 @@
#include "api/common.h"
void api_interrupt_init(void);
int api_interrupt_trigger(api_int_id_t id);
void api_interrupt_trigger(api_int_id_t id);
......@@ -140,7 +140,10 @@ static int max86150_handle_sample(struct max86150_sensor_data *data)
LOG_WARN("max86150", "queue full");
return -EIO;
}
return api_interrupt_trigger(EPIC_INT_MAX86150);
api_interrupt_trigger(EPIC_INT_MAX86150);
return 0;
}
static int max86150_fetch_fifo(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment