root / hw / sh_intc.h @ aebcf56f
History | View | Annotate | Download (2 kB)
1 | 80f515e6 | balrog | #ifndef __SH_INTC_H__
|
---|---|---|---|
2 | 80f515e6 | balrog | #define __SH_INTC_H__
|
3 | 80f515e6 | balrog | |
4 | 96e2fc41 | aurel32 | #include "qemu-common.h" |
5 | 96e2fc41 | aurel32 | #include "irq.h" |
6 | b279e5ef | Benoît Canet | #include "exec-memory.h" |
7 | 96e2fc41 | aurel32 | |
8 | 80f515e6 | balrog | typedef unsigned char intc_enum; |
9 | 80f515e6 | balrog | |
10 | 80f515e6 | balrog | struct intc_vect {
|
11 | 80f515e6 | balrog | intc_enum enum_id; |
12 | 80f515e6 | balrog | unsigned short vect; |
13 | 80f515e6 | balrog | }; |
14 | 80f515e6 | balrog | |
15 | 80f515e6 | balrog | #define INTC_VECT(enum_id, vect) { enum_id, vect }
|
16 | 80f515e6 | balrog | |
17 | 80f515e6 | balrog | struct intc_group {
|
18 | 80f515e6 | balrog | intc_enum enum_id; |
19 | 80f515e6 | balrog | intc_enum enum_ids[32];
|
20 | 80f515e6 | balrog | }; |
21 | 80f515e6 | balrog | |
22 | 001faf32 | Blue Swirl | #define INTC_GROUP(enum_id, ...) { enum_id, { __VA_ARGS__ } }
|
23 | 80f515e6 | balrog | |
24 | 80f515e6 | balrog | struct intc_mask_reg {
|
25 | 80f515e6 | balrog | unsigned long set_reg, clr_reg, reg_width; |
26 | 80f515e6 | balrog | intc_enum enum_ids[32];
|
27 | 80f515e6 | balrog | unsigned long value; |
28 | 80f515e6 | balrog | }; |
29 | 80f515e6 | balrog | |
30 | 80f515e6 | balrog | struct intc_prio_reg {
|
31 | 80f515e6 | balrog | unsigned long set_reg, clr_reg, reg_width, field_width; |
32 | 80f515e6 | balrog | intc_enum enum_ids[16];
|
33 | 80f515e6 | balrog | unsigned long value; |
34 | 80f515e6 | balrog | }; |
35 | 80f515e6 | balrog | |
36 | b1503cda | malc | #define _INTC_ARRAY(a) a, ARRAY_SIZE(a)
|
37 | 80f515e6 | balrog | |
38 | 80f515e6 | balrog | struct intc_source {
|
39 | 80f515e6 | balrog | unsigned short vect; |
40 | 80f515e6 | balrog | intc_enum next_enum_id; |
41 | 80f515e6 | balrog | |
42 | e96e2044 | ths | int asserted; /* emulates the interrupt signal line from device to intc */ |
43 | 80f515e6 | balrog | int enable_count;
|
44 | 80f515e6 | balrog | int enable_max;
|
45 | e96e2044 | ths | int pending; /* emulates the result of signal and masking */ |
46 | e96e2044 | ths | struct intc_desc *parent;
|
47 | 80f515e6 | balrog | }; |
48 | 80f515e6 | balrog | |
49 | 80f515e6 | balrog | struct intc_desc {
|
50 | b279e5ef | Benoît Canet | MemoryRegion iomem; |
51 | b279e5ef | Benoît Canet | MemoryRegion *iomem_aliases; |
52 | 96e2fc41 | aurel32 | qemu_irq *irqs; |
53 | 80f515e6 | balrog | struct intc_source *sources;
|
54 | 80f515e6 | balrog | int nr_sources;
|
55 | 80f515e6 | balrog | struct intc_mask_reg *mask_regs;
|
56 | 80f515e6 | balrog | int nr_mask_regs;
|
57 | 80f515e6 | balrog | struct intc_prio_reg *prio_regs;
|
58 | 80f515e6 | balrog | int nr_prio_regs;
|
59 | e96e2044 | ths | int pending; /* number of interrupt sources that has pending set */ |
60 | 80f515e6 | balrog | }; |
61 | 80f515e6 | balrog | |
62 | e96e2044 | ths | int sh_intc_get_pending_vector(struct intc_desc *desc, int imask); |
63 | 80f515e6 | balrog | struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id); |
64 | e96e2044 | ths | void sh_intc_toggle_source(struct intc_source *source, |
65 | e96e2044 | ths | int enable_adj, int assert_adj); |
66 | 80f515e6 | balrog | |
67 | 80f515e6 | balrog | void sh_intc_register_sources(struct intc_desc *desc, |
68 | 80f515e6 | balrog | struct intc_vect *vectors,
|
69 | 80f515e6 | balrog | int nr_vectors,
|
70 | 80f515e6 | balrog | struct intc_group *groups,
|
71 | 80f515e6 | balrog | int nr_groups);
|
72 | 80f515e6 | balrog | |
73 | b279e5ef | Benoît Canet | int sh_intc_init(MemoryRegion *sysmem,
|
74 | b279e5ef | Benoît Canet | struct intc_desc *desc,
|
75 | 80f515e6 | balrog | int nr_sources,
|
76 | 80f515e6 | balrog | struct intc_mask_reg *mask_regs,
|
77 | 80f515e6 | balrog | int nr_mask_regs,
|
78 | 80f515e6 | balrog | struct intc_prio_reg *prio_regs,
|
79 | 80f515e6 | balrog | int nr_prio_regs);
|
80 | 80f515e6 | balrog | |
81 | c6d86a33 | balrog | void sh_intc_set_irl(void *opaque, int n, int level); |
82 | c6d86a33 | balrog | |
83 | 80f515e6 | balrog | #endif /* __SH_INTC_H__ */ |