root / hw / sh_intc.h @ ab7d9131
History | View | Annotate | Download (1.8 kB)
1 | 80f515e6 | balrog | #ifndef __SH_INTC_H__
|
---|---|---|---|
2 | 80f515e6 | balrog | #define __SH_INTC_H__
|
3 | 80f515e6 | balrog | |
4 | 80f515e6 | balrog | typedef unsigned char intc_enum; |
5 | 80f515e6 | balrog | |
6 | 80f515e6 | balrog | struct intc_vect {
|
7 | 80f515e6 | balrog | intc_enum enum_id; |
8 | 80f515e6 | balrog | unsigned short vect; |
9 | 80f515e6 | balrog | }; |
10 | 80f515e6 | balrog | |
11 | 80f515e6 | balrog | #define INTC_VECT(enum_id, vect) { enum_id, vect }
|
12 | 80f515e6 | balrog | |
13 | 80f515e6 | balrog | struct intc_group {
|
14 | 80f515e6 | balrog | intc_enum enum_id; |
15 | 80f515e6 | balrog | intc_enum enum_ids[32];
|
16 | 80f515e6 | balrog | }; |
17 | 80f515e6 | balrog | |
18 | 80f515e6 | balrog | #define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
|
19 | 80f515e6 | balrog | |
20 | 80f515e6 | balrog | struct intc_mask_reg {
|
21 | 80f515e6 | balrog | unsigned long set_reg, clr_reg, reg_width; |
22 | 80f515e6 | balrog | intc_enum enum_ids[32];
|
23 | 80f515e6 | balrog | unsigned long value; |
24 | 80f515e6 | balrog | }; |
25 | 80f515e6 | balrog | |
26 | 80f515e6 | balrog | struct intc_prio_reg {
|
27 | 80f515e6 | balrog | unsigned long set_reg, clr_reg, reg_width, field_width; |
28 | 80f515e6 | balrog | intc_enum enum_ids[16];
|
29 | 80f515e6 | balrog | unsigned long value; |
30 | 80f515e6 | balrog | }; |
31 | 80f515e6 | balrog | |
32 | 80f515e6 | balrog | #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a) |
33 | 80f515e6 | balrog | |
34 | 80f515e6 | balrog | struct intc_source {
|
35 | 80f515e6 | balrog | unsigned short vect; |
36 | 80f515e6 | balrog | intc_enum next_enum_id; |
37 | 80f515e6 | balrog | |
38 | e96e2044 | ths | int asserted; /* emulates the interrupt signal line from device to intc */ |
39 | 80f515e6 | balrog | int enable_count;
|
40 | 80f515e6 | balrog | int enable_max;
|
41 | e96e2044 | ths | int pending; /* emulates the result of signal and masking */ |
42 | e96e2044 | ths | struct intc_desc *parent;
|
43 | 80f515e6 | balrog | }; |
44 | 80f515e6 | balrog | |
45 | 80f515e6 | balrog | struct intc_desc {
|
46 | 80f515e6 | balrog | struct intc_source *sources;
|
47 | 80f515e6 | balrog | int nr_sources;
|
48 | 80f515e6 | balrog | struct intc_mask_reg *mask_regs;
|
49 | 80f515e6 | balrog | int nr_mask_regs;
|
50 | 80f515e6 | balrog | struct intc_prio_reg *prio_regs;
|
51 | 80f515e6 | balrog | int nr_prio_regs;
|
52 | 80f515e6 | balrog | |
53 | 80f515e6 | balrog | int iomemtype;
|
54 | e96e2044 | ths | int pending; /* number of interrupt sources that has pending set */ |
55 | 80f515e6 | balrog | }; |
56 | 80f515e6 | balrog | |
57 | e96e2044 | ths | int sh_intc_get_pending_vector(struct intc_desc *desc, int imask); |
58 | 80f515e6 | balrog | struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id); |
59 | e96e2044 | ths | void sh_intc_toggle_source(struct intc_source *source, |
60 | e96e2044 | ths | int enable_adj, int assert_adj); |
61 | 80f515e6 | balrog | |
62 | 80f515e6 | balrog | void sh_intc_register_sources(struct intc_desc *desc, |
63 | 80f515e6 | balrog | struct intc_vect *vectors,
|
64 | 80f515e6 | balrog | int nr_vectors,
|
65 | 80f515e6 | balrog | struct intc_group *groups,
|
66 | 80f515e6 | balrog | int nr_groups);
|
67 | 80f515e6 | balrog | |
68 | 80f515e6 | balrog | int sh_intc_init(struct intc_desc *desc, |
69 | 80f515e6 | balrog | int nr_sources,
|
70 | 80f515e6 | balrog | struct intc_mask_reg *mask_regs,
|
71 | 80f515e6 | balrog | int nr_mask_regs,
|
72 | 80f515e6 | balrog | struct intc_prio_reg *prio_regs,
|
73 | 80f515e6 | balrog | int nr_prio_regs);
|
74 | 80f515e6 | balrog | |
75 | 80f515e6 | balrog | #endif /* __SH_INTC_H__ */ |