725573f0f1a41f54c47da2ebaf17e0f9b00d50d1
[firmerware] / include / 0cpm / irq.h
1 /*
2  * http://devel.0cpm.org/ -- Open source firmware for SIP phones.
3  *
4  * Interrupt drivers
5  */
6
7
8 #ifndef HEADER_IRQ
9 #define HEADER_IRQ
10
11
12 /* Interrupt drivers are split in a top half and a bottom half.  The top half is generic,
13  * the bottom half is device-specific.  The bottom half routines start with bottom_irq_
14  * while the top half functions start with irq_
15  *
16  * The bottom system is only aware of the hardware interrupts, and whether they have
17  * occurred.  The top half is responsible for accepting interrupts from the bottom
18  * half, and using them to notify top handlers.
19  */
20
21
22 /* A top-half interrupt handler is a plain C function that is called shortly after
23  * a bottom-half interrupt has occurred.
24  */
25
26 typedef struct irq_type irq_t;
27 typedef void (*irq_handler_t) (irq_t *);
28
29 /* An irq_t structure represents an interrupt and how it invokes top-half handlers.
30  */
31 struct irq_type {
32         irq_handler_t irq_handler;
33         irq_t *irq_next;
34         priority_t irq_priority;
35 };
36
37
38 /* Manage interrupts; fire one */
39 void irq_fire (irq_t *irq);
40
41 /* Top-half operations to manipulate interrupts */
42
43
44 /* Bottom-half operations to manipulate interrupts */
45 void bottom_irq_start (void);
46 void bottom_irq_stop (void);
47 void bottom_irq_enable  (irq_t *irq, irq_handler_t hdl);
48 void bottom_irq_disable (irq_t *irq);
49 void bottom_irq_wait (void);
50
51
52 #endif