Revision bc24a225 hw/zaurus.c
b/hw/zaurus.c | ||
---|---|---|
29 | 29 |
|
30 | 30 |
/* SCOOP devices */ |
31 | 31 |
|
32 |
struct scoop_info_s {
|
|
32 |
struct ScoopInfo {
|
|
33 | 33 |
qemu_irq handler[16]; |
34 | 34 |
qemu_irq *in; |
35 | 35 |
uint16_t status; |
... | ... | |
58 | 58 |
#define SCOOP_GPWR 0x24 |
59 | 59 |
#define SCOOP_GPRR 0x28 |
60 | 60 |
|
61 |
static inline void scoop_gpio_handler_update(struct scoop_info_s *s) {
|
|
61 |
static inline void scoop_gpio_handler_update(ScoopInfo *s) {
|
|
62 | 62 |
uint32_t level, diff; |
63 | 63 |
int bit; |
64 | 64 |
level = s->gpio_level & s->gpio_dir; |
... | ... | |
73 | 73 |
|
74 | 74 |
static uint32_t scoop_readb(void *opaque, target_phys_addr_t addr) |
75 | 75 |
{ |
76 |
struct scoop_info_s *s = (struct scoop_info_s *) opaque;
|
|
76 |
ScoopInfo *s = (ScoopInfo *) opaque;
|
|
77 | 77 |
|
78 | 78 |
switch (addr) { |
79 | 79 |
case SCOOP_MCR: |
... | ... | |
106 | 106 |
|
107 | 107 |
static void scoop_writeb(void *opaque, target_phys_addr_t addr, uint32_t value) |
108 | 108 |
{ |
109 |
struct scoop_info_s *s = (struct scoop_info_s *) opaque;
|
|
109 |
ScoopInfo *s = (ScoopInfo *) opaque;
|
|
110 | 110 |
value &= 0xffff; |
111 | 111 |
|
112 | 112 |
switch (addr) { |
... | ... | |
160 | 160 |
|
161 | 161 |
void scoop_gpio_set(void *opaque, int line, int level) |
162 | 162 |
{ |
163 |
struct scoop_info_s *s = (struct scoop_info_s *) s;
|
|
163 |
ScoopInfo *s = (ScoopInfo *) s;
|
|
164 | 164 |
|
165 | 165 |
if (level) |
166 | 166 |
s->gpio_level |= (1 << line); |
... | ... | |
168 | 168 |
s->gpio_level &= ~(1 << line); |
169 | 169 |
} |
170 | 170 |
|
171 |
qemu_irq *scoop_gpio_in_get(struct scoop_info_s *s)
|
|
171 |
qemu_irq *scoop_gpio_in_get(ScoopInfo *s)
|
|
172 | 172 |
{ |
173 | 173 |
return s->in; |
174 | 174 |
} |
175 | 175 |
|
176 |
void scoop_gpio_out_set(struct scoop_info_s *s, int line,
|
|
176 |
void scoop_gpio_out_set(ScoopInfo *s, int line,
|
|
177 | 177 |
qemu_irq handler) { |
178 | 178 |
if (line >= 16) { |
179 | 179 |
fprintf(stderr, "No GPIO pin %i\n", line); |
... | ... | |
185 | 185 |
|
186 | 186 |
static void scoop_save(QEMUFile *f, void *opaque) |
187 | 187 |
{ |
188 |
struct scoop_info_s *s = (struct scoop_info_s *) opaque;
|
|
188 |
ScoopInfo *s = (ScoopInfo *) opaque;
|
|
189 | 189 |
qemu_put_be16s(f, &s->status); |
190 | 190 |
qemu_put_be16s(f, &s->power); |
191 | 191 |
qemu_put_be32s(f, &s->gpio_level); |
... | ... | |
202 | 202 |
static int scoop_load(QEMUFile *f, void *opaque, int version_id) |
203 | 203 |
{ |
204 | 204 |
uint16_t dummy; |
205 |
struct scoop_info_s *s = (struct scoop_info_s *) opaque;
|
|
205 |
ScoopInfo *s = (ScoopInfo *) opaque;
|
|
206 | 206 |
qemu_get_be16s(f, &s->status); |
207 | 207 |
qemu_get_be16s(f, &s->power); |
208 | 208 |
qemu_get_be32s(f, &s->gpio_level); |
... | ... | |
220 | 220 |
return 0; |
221 | 221 |
} |
222 | 222 |
|
223 |
struct scoop_info_s *scoop_init(struct pxa2xx_state_s *cpu,
|
|
223 |
ScoopInfo *scoop_init(PXA2xxState *cpu,
|
|
224 | 224 |
int instance, |
225 | 225 |
target_phys_addr_t target_base) { |
226 | 226 |
int iomemtype; |
227 |
struct scoop_info_s *s;
|
|
227 |
ScoopInfo *s;
|
|
228 | 228 |
|
229 |
s = (struct scoop_info_s *)
|
|
230 |
qemu_mallocz(sizeof(struct scoop_info_s));
|
|
231 |
memset(s, 0, sizeof(struct scoop_info_s));
|
|
229 |
s = (ScoopInfo *)
|
|
230 |
qemu_mallocz(sizeof(ScoopInfo));
|
|
231 |
memset(s, 0, sizeof(ScoopInfo));
|
|
232 | 232 |
|
233 | 233 |
s->status = 0x02; |
234 | 234 |
s->in = qemu_allocate_irqs(scoop_gpio_set, s, 16); |
Also available in: Unified diff