blob: 85e6af87be6c82ad11f5c8eb63180e35e3cb9cc3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* SPDX-License-Identifier: copyleft-next-0.3.1 */
/* Copyright 2021 - 2022, Kim Kuparinen < kimi.h.kuparinen@gmail.com > */
#ifndef KMI_ARCH_IRQ_H
#define KMI_ARCH_IRQ_H
/** Type for IRQ id. */
typedef uint_fast32_t irq_t;
/**
* @file irq.h
* Arch-specific interrupt handling, generally implemented in
* arch/whatever/kernel/irq.c
*
* \todo These should probably also be stat_t...
*/
#if defined(__riscv)
# if __riscv_xlen == 64
#include "../../arch/riscv64/include/irq.h"
# else
#include "../../arch/riscv32/include/irq.h"
# endif
#endif
/**
* Initialize arch-specific IRQ stuff.
*
* @param fdt Global FDT pointer.
*/
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_irqs();
/** Disable IRQs. */
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_ARCH_IRQ_H */
|