diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-07-31 22:24:29 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-07-31 22:24:29 +0300 |
| commit | 6ad1b899ed93f8bc110cdec7a722c8740f9f8d66 (patch) | |
| tree | 99fe36028ffc4583c59e77d03bea2ade7a6c5ace /include/arch/irq.h | |
| parent | 3212707a9ab549119ad0ad6441a07fe774c99f3b (diff) | |
| download | kmi-6ad1b899ed93f8bc110cdec7a722c8740f9f8d66.tar.gz kmi-6ad1b899ed93f8bc110cdec7a722c8740f9f8d66.zip | |
start working on irqs
Diffstat (limited to 'include/arch/irq.h')
| -rw-r--r-- | include/arch/irq.h | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/include/arch/irq.h b/include/arch/irq.h index 72b998e..85a7360 100644 --- a/include/arch/irq.h +++ b/include/arch/irq.h @@ -1,8 +1,11 @@ /* SPDX-License-Identifier: copyleft-next-0.3.1 */ /* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */ -#ifndef KMI_IRQ_H -#define KMI_IRQ_H +#ifndef KMI_ARCH_IRQ_H +#define KMI_ARCH_IRQ_H + +/** Type for IRQ id. */ +typedef uint_fast32_t irq_t; /** * @file irq.h @@ -19,16 +22,42 @@ #endif /** - * Initialize IRQ subsystem. + * Initialize arch-specific IRQ stuff. * * @param fdt Global FDT pointer. */ -void init_irq(void *fdt); +void setup_irq(void *fdt); + +/** + * Activate IRQ for \p id. + * Assumes there's one interrupt controller for the whole system, which might be + * an oversimplification. + * + * @param id IRQ id to deactivate. + * @return OK on success, non-zero otherwise. + */ +stat_t activate_irq(irq_t id); + +/** + * Deactivates IRQ for \p id. + * + * @param id IRQ id to deactivate. + * @return OK on success, non-zero otherwise. + */ +stat_t deactivate_irq(irq_t id); /** Enable IRQs. */ -void enable_irq(); +void enable_irqs(); /** Disable IRQs. */ -void disable_irq(); +void disable_irqs(); + +/** Get IRQ to handle. + * + * @return ID of IRQ to handle. + * + * @todo what about illegal IRQs due to bug or something? + */ +irq_t get_irq(); -#endif /* KMI_IRQ_H */ +#endif /* KMI_ARCH_IRQ_H */ |
