diff options
author | Randall Spangler <rspangler@chromium.org> | 2011-12-12 14:03:49 -0800 |
---|---|---|
committer | Randall Spangler <rspangler@chromium.org> | 2011-12-12 14:23:04 -0800 |
commit | 1ce694189a847727e8eca53fbc324f67b92238e5 (patch) | |
tree | 44d08152e97fad7c73986ab3cdf3e87f5caaaa43 /include/task.h | |
parent | 70c3e30b633b530acb913a99d7cb602c9e8baf99 (diff) | |
download | chrome-ec-1ce694189a847727e8eca53fbc324f67b92238e5.tar.gz |
Add IRQ constants, and task functions to enable/disable/trigger IRQs.
The constants don't work with the DECLARE_IRQ() macro yet, because it
relies on stringizing the IRQ number.
Signed-off-by: Randall Spangler <rspangler@chromium.org>
BUG=none
TEST=none
Change-Id: Ie6ddecd79e28c319b095089131579ba994a17da3
(cherry picked from commit e24904644a977f2618f51629cc066b93a3d53595)
Diffstat (limited to 'include/task.h')
-rw-r--r-- | include/task.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/include/task.h b/include/task.h index 35bbc46943..8db98c26f9 100644 --- a/include/task.h +++ b/include/task.h @@ -42,7 +42,7 @@ task_id_t task_get_current(void); uint32_t *task_get_event_bitmap(task_id_t tsk); /** - * Wait for the incoming next message. + * Waits for the incoming next message. * * if an event is already pending, it returns it immediatly, else it * de-schedules the calling task and wake up the next one in the priority order @@ -55,7 +55,7 @@ uint32_t *task_get_event_bitmap(task_id_t tsk); uint32_t task_wait_msg(int timeout_us); /** - * Change the task scheduled after returning from the exception. + * Changes the task scheduled after returning from the exception. * * If task_send_msg has been called and has set need_resched flag, * we re-compute which task is running and eventually swap the context @@ -66,20 +66,34 @@ uint32_t task_wait_msg(int timeout_us); */ void task_resched_if_needed(void *excep_return); -/* Initialize tasks and interrupt controller */ +/* Initializes tasks and interrupt controller. */ int task_init(void); -/* Start the task scheduling */ +/* Starts task scheduling. */ int task_start(void); +/* Enables an interrupt. */ +void task_enable_irq(int irq); + +/* Disables an interrupt. */ +void task_disable_irq(int irq); + +/* Software-triggers an interrupt. */ +void task_trigger_irq(int irq); + + struct irq_priority { uint8_t irq; uint8_t priority; }; /** - * Connect the interrupt handler "routine" to the irq number "irq" and - * ensure it is enabled in the interrupt controller with the right priority + * Connects the interrupt handler "routine" to the irq number "irq" and + * ensures it is enabled in the interrupt controller with the right priority. + * + * Note that you MUST pass irq as the number ("5") not as a #defined constant, + * because it's stringized and matched up with a weak reference from init.S. + * TODO: fix that; it's typo-prone. */ #define DECLARE_IRQ(irq, routine, priority) \ void irq_##irq##_handler(void) \ |