picvar.h revision 1.1.2.2 1 #ifndef _ARM_PIC31_PICVAR_H_
2 #define _ARM_PIC31_PICVAR_H_
3
4 struct pic_softc;
5 struct intrsource;
6
7 int pic_handle_intr(void *);
8 void pic_mark_pending(struct pic_softc *pic, int irq);
9 void pic_mark_pending_source(struct pic_softc *pic, struct intrsource *is);
10 void *pic_establish_intr(struct pic_softc *pic, int irq, int ipl, int type,
11 int (*func)(void *), void *arg);
12 int pic_alloc_irq(struct pic_softc *pic);
13 void pic_disestablish_source(struct intrsource *is);
14 void pic_do_pending_ints(register_t psw, int newipl);
15 void pic_dispatch(struct intrsource *is, void *frame);
16
17 #ifdef _INTR_PRIVATE
18
19 #ifndef PIC_MAXPICS
20 #define PIC_MAXPICS 32
21 #endif
22 #ifndef PIC_MAXSOURCES
23 #define PIC_MAXSOURCES 64
24 #endif
25
26 struct intrsource {
27 int (*is_func)(void *);
28 void *is_arg;
29 struct pic_softc *is_pic; /* owning PIC */
30 uint8_t is_type; /* IST_xxx */
31 uint8_t is_ipl; /* IPL_xxx */
32 uint8_t is_irq; /* local to pic */
33 struct evcnt is_ev;
34 char is_source[16];
35 };
36
37 struct pic_softc {
38 const struct pic_ops *pic_ops;
39 struct intrsource **pic_sources;
40 uint32_t pic_pending_irqs[(PIC_MAXSOURCES + 31) / 32];
41 uint32_t pic_pending_ipls;
42 size_t pic_maxsources;
43 uint8_t pic_id;
44 uint16_t pic_irqbase;
45 char pic_name[14];
46 };
47
48 struct pic_ops {
49 void (*pic_unblock_irqs)(struct pic_softc *, size_t, uint32_t);
50 void (*pic_block_irqs)(struct pic_softc *, size_t, uint32_t);
51 int (*pic_find_pending_irqs)(struct pic_softc *);
52
53 void (*pic_establish_irq)(struct pic_softc *, int, int, int);
54 void (*pic_source_name)(struct pic_softc *, int, char *, size_t);
55 };
56
57
58 bool pic_add(struct pic_softc *, int);
59 void pic_do_pending_int(void);
60
61 extern struct pic_softc * pic_list[PIC_MAXPICS];
62 extern volatile uint32_t pic_pending_pics[(PIC_MAXPICS + 31) / 32];
63 extern volatile uint32_t pic_pending_ipls;
64 extern int pic_pending_ipl_refcnt[NIPL];
65
66 #endif /* _INTR_PRIVATE */
67
68 #endif /* _ARM_PIC_PICVAR_H_ */
69