Statistics
| Branch: | Revision:

root / hw / sh_intc.h @ 80f515e6

History | View | Annotate | Download (1.4 kB)

1
#ifndef __SH_INTC_H__
2
#define __SH_INTC_H__
3

    
4
typedef unsigned char intc_enum;
5

    
6
struct intc_vect {
7
    intc_enum enum_id;
8
    unsigned short vect;
9
};
10

    
11
#define INTC_VECT(enum_id, vect) { enum_id, vect }
12

    
13
struct intc_group {
14
    intc_enum enum_id;
15
    intc_enum enum_ids[32];
16
};
17

    
18
#define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
19

    
20
struct intc_mask_reg {
21
    unsigned long set_reg, clr_reg, reg_width;
22
    intc_enum enum_ids[32];
23
    unsigned long value;
24
};
25

    
26
struct intc_prio_reg {
27
    unsigned long set_reg, clr_reg, reg_width, field_width;
28
    intc_enum enum_ids[16];
29
    unsigned long value;
30
};
31

    
32
#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
33

    
34
struct intc_source {
35
    unsigned short vect;
36
    intc_enum next_enum_id;
37

    
38
    int asserted;
39
    int enable_count;
40
    int enable_max;
41
};
42

    
43
struct intc_desc {
44
    struct intc_source *sources;
45
    int nr_sources;
46
    struct intc_mask_reg *mask_regs;
47
    int nr_mask_regs;
48
    struct intc_prio_reg *prio_regs;
49
    int nr_prio_regs;
50

    
51
    int iomemtype;
52
};
53

    
54
struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id);
55

    
56
void sh_intc_register_sources(struct intc_desc *desc,
57
                              struct intc_vect *vectors,
58
                              int nr_vectors,
59
                              struct intc_group *groups,
60
                              int nr_groups);
61

    
62
int sh_intc_init(struct intc_desc *desc,
63
                 int nr_sources,
64
                 struct intc_mask_reg *mask_regs,
65
                 int nr_mask_regs,
66
                 struct intc_prio_reg *prio_regs,
67
                 int nr_prio_regs);
68

    
69
#endif /* __SH_INTC_H__ */