1 #ifndef KERNEL_INTERRUPTCONTROLLERS_H
2 #define KERNEL_INTERRUPTCONTROLLERS_H
4 Copyright © 2017, The AROS Development Team. All rights reserved.
10 #ifdef KERNELIRQ_NEEDSCONTROLLERS
13 /* Interrupt controller definitions ... */
18 typedef UWORD icintrid_t
;
20 #define ICINTR_ICID(icintr) ((icintr >> 8) & 0xFF)
21 #define ICINTR_INST(icintr) (icintr & 0xFF)
26 * .ln_Node = "Controller Type" Name - set by the "driver".
27 * .ln_Type = icid_t - value filled in by/returned from krnAddInterruptController.
28 * .ln_Pri = use count - value filled in by/returned from krnAddInterruptController.
34 ULONG ic_Type
; /* IC drivers private "type" */
37 icid_t (*ic_Register
)(struct KernelBase
*); /* one time initialization called during Add */
38 BOOL (*ic_Init
)(struct KernelBase
*, icid_t
); /* */
39 BOOL (*ic_IntrEnable
)(APTR
, icid_t
, icid_t
);
40 BOOL (*ic_IntrDisable
)(APTR
, icid_t
, icid_t
);
41 BOOL (*ic_IntrAck
)(APTR
, icid_t
, icid_t
);
46 struct Node im_Node
; /* NB - ln_Pri == source IRQ */
47 UBYTE im_IRQ
; /* actual IRQ to use */
51 * Interrupt controller needs to re-enable
52 * the interrupt after acknowledging/processing
54 #define ICF_ACKENABLE (1 << 0)
56 #define ICF_READY (1 << 30)
57 #define ICF_DISABLED (1 << 31)
59 static inline struct IntrController
*krnGetInterruptController(struct KernelBase
*KernelBase
, icid_t icid
)
61 struct IntrController
*intContr
;
62 ForeachNode(&KernelBase
->kb_ICList
, intContr
)
64 if (intContr
->ic_Node
.ln_Type
== icid
)
72 /* Functions to be called by machine-specific code */
73 icintrid_t
krnAddInterruptController(struct KernelBase
*, struct IntrController
*);
74 struct IntrController
*krnFindInterruptController(struct KernelBase
*, ULONG
);
75 int krnInitInterruptControllers(struct KernelBase
*);
76 BOOL
krnInitInterrupt(struct KernelBase
*, icid_t
, icid_t
, icid_t
);
77 struct IntrMapping
*krnInterruptMapping(struct KernelBase
*, icid_t
);
78 struct IntrMapping
*krnInterruptMapped(struct KernelBase
*, icid_t
);
80 #endif /* KERNELIRQ_NEEDSCONTROLLERS */
81 #endif /* !KERNEL_INTERRUPTCONTROLLERS_H */