2007-10-05 01:53:55 +04:00
|
|
|
#ifndef __SH_INTC_H__
|
|
|
|
#define __SH_INTC_H__
|
|
|
|
|
2008-11-22 00:06:42 +03:00
|
|
|
#include "qemu-common.h"
|
|
|
|
#include "irq.h"
|
2012-12-17 21:19:49 +04:00
|
|
|
#include "exec/address-spaces.h"
|
2008-11-22 00:06:42 +03:00
|
|
|
|
2007-10-05 01:53:55 +04:00
|
|
|
typedef unsigned char intc_enum;
|
|
|
|
|
|
|
|
struct intc_vect {
|
|
|
|
intc_enum enum_id;
|
|
|
|
unsigned short vect;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define INTC_VECT(enum_id, vect) { enum_id, vect }
|
|
|
|
|
|
|
|
struct intc_group {
|
|
|
|
intc_enum enum_id;
|
|
|
|
intc_enum enum_ids[32];
|
|
|
|
};
|
|
|
|
|
2009-05-13 21:53:17 +04:00
|
|
|
#define INTC_GROUP(enum_id, ...) { enum_id, { __VA_ARGS__ } }
|
2007-10-05 01:53:55 +04:00
|
|
|
|
|
|
|
struct intc_mask_reg {
|
|
|
|
unsigned long set_reg, clr_reg, reg_width;
|
|
|
|
intc_enum enum_ids[32];
|
|
|
|
unsigned long value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct intc_prio_reg {
|
|
|
|
unsigned long set_reg, clr_reg, reg_width, field_width;
|
|
|
|
intc_enum enum_ids[16];
|
|
|
|
unsigned long value;
|
|
|
|
};
|
|
|
|
|
2008-12-22 23:33:55 +03:00
|
|
|
#define _INTC_ARRAY(a) a, ARRAY_SIZE(a)
|
2007-10-05 01:53:55 +04:00
|
|
|
|
|
|
|
struct intc_source {
|
|
|
|
unsigned short vect;
|
|
|
|
intc_enum next_enum_id;
|
|
|
|
|
2007-12-02 09:18:24 +03:00
|
|
|
int asserted; /* emulates the interrupt signal line from device to intc */
|
2007-10-05 01:53:55 +04:00
|
|
|
int enable_count;
|
|
|
|
int enable_max;
|
2007-12-02 09:18:24 +03:00
|
|
|
int pending; /* emulates the result of signal and masking */
|
|
|
|
struct intc_desc *parent;
|
2007-10-05 01:53:55 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct intc_desc {
|
2011-11-17 17:23:01 +04:00
|
|
|
MemoryRegion iomem;
|
|
|
|
MemoryRegion *iomem_aliases;
|
2008-11-22 00:06:42 +03:00
|
|
|
qemu_irq *irqs;
|
2007-10-05 01:53:55 +04:00
|
|
|
struct intc_source *sources;
|
|
|
|
int nr_sources;
|
|
|
|
struct intc_mask_reg *mask_regs;
|
|
|
|
int nr_mask_regs;
|
|
|
|
struct intc_prio_reg *prio_regs;
|
|
|
|
int nr_prio_regs;
|
2007-12-02 09:18:24 +03:00
|
|
|
int pending; /* number of interrupt sources that has pending set */
|
2007-10-05 01:53:55 +04:00
|
|
|
};
|
|
|
|
|
2007-12-02 09:18:24 +03:00
|
|
|
int sh_intc_get_pending_vector(struct intc_desc *desc, int imask);
|
2007-10-05 01:53:55 +04:00
|
|
|
struct intc_source *sh_intc_source(struct intc_desc *desc, intc_enum id);
|
2007-12-02 09:18:24 +03:00
|
|
|
void sh_intc_toggle_source(struct intc_source *source,
|
|
|
|
int enable_adj, int assert_adj);
|
2007-10-05 01:53:55 +04:00
|
|
|
|
|
|
|
void sh_intc_register_sources(struct intc_desc *desc,
|
|
|
|
struct intc_vect *vectors,
|
|
|
|
int nr_vectors,
|
|
|
|
struct intc_group *groups,
|
|
|
|
int nr_groups);
|
|
|
|
|
2011-11-17 17:23:01 +04:00
|
|
|
int sh_intc_init(MemoryRegion *sysmem,
|
|
|
|
struct intc_desc *desc,
|
2007-10-05 01:53:55 +04:00
|
|
|
int nr_sources,
|
|
|
|
struct intc_mask_reg *mask_regs,
|
|
|
|
int nr_mask_regs,
|
|
|
|
struct intc_prio_reg *prio_regs,
|
|
|
|
int nr_prio_regs);
|
|
|
|
|
2008-12-07 21:49:57 +03:00
|
|
|
void sh_intc_set_irl(void *opaque, int n, int level);
|
|
|
|
|
2007-10-05 01:53:55 +04:00
|
|
|
#endif /* __SH_INTC_H__ */
|