Revision bf5b7423 hw/sh_serial.c
b/hw/sh_serial.c | ||
---|---|---|
55 | 55 |
int flags; |
56 | 56 |
|
57 | 57 |
CharDriverState *chr; |
58 |
|
|
59 |
struct intc_source *eri; |
|
60 |
struct intc_source *rxi; |
|
61 |
struct intc_source *txi; |
|
62 |
struct intc_source *tei; |
|
63 |
struct intc_source *bri; |
|
58 | 64 |
} sh_serial_state; |
59 | 65 |
|
60 | 66 |
static void sh_serial_ioport_write(void *opaque, uint32_t offs, uint32_t val) |
... | ... | |
74 | 80 |
s->brr = val; |
75 | 81 |
return; |
76 | 82 |
case 0x08: /* SCR */ |
77 |
s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfb : 0xff);
|
|
83 |
s->scr = val & ((s->feat & SH_SERIAL_FEAT_SCIF) ? 0xfa : 0xff);
|
|
78 | 84 |
if (!(val & (1 << 5))) |
79 | 85 |
s->flags |= SH_SERIAL_FLAG_TEND; |
86 |
if ((s->feat & SH_SERIAL_FEAT_SCIF) && s->txi) { |
|
87 |
if ((val & (1 << 7)) && !(s->txi->asserted)) |
|
88 |
sh_intc_toggle_source(s->txi, 0, 1); |
|
89 |
else if (!(val & (1 << 7)) && s->txi->asserted) |
|
90 |
sh_intc_toggle_source(s->txi, 0, -1); |
|
91 |
} |
|
80 | 92 |
return; |
81 | 93 |
case 0x0c: /* FTDR / TDR */ |
82 | 94 |
if (s->chr) { |
... | ... | |
159 | 171 |
#endif |
160 | 172 |
if (s->feat & SH_SERIAL_FEAT_SCIF) { |
161 | 173 |
switch(offs) { |
174 |
case 0x00: /* SMR */ |
|
175 |
ret = s->smr; |
|
176 |
break; |
|
177 |
case 0x08: /* SCR */ |
|
178 |
ret = s->scr; |
|
179 |
break; |
|
162 | 180 |
case 0x10: /* FSR */ |
163 | 181 |
ret = 0; |
164 | 182 |
if (s->flags & SH_SERIAL_FLAG_TEND) |
... | ... | |
278 | 296 |
}; |
279 | 297 |
|
280 | 298 |
void sh_serial_init (target_phys_addr_t base, int feat, |
281 |
uint32_t freq, CharDriverState *chr) |
|
299 |
uint32_t freq, CharDriverState *chr, |
|
300 |
struct intc_source *eri_source, |
|
301 |
struct intc_source *rxi_source, |
|
302 |
struct intc_source *txi_source, |
|
303 |
struct intc_source *tei_source, |
|
304 |
struct intc_source *bri_source) |
|
282 | 305 |
{ |
283 | 306 |
sh_serial_state *s; |
284 | 307 |
int s_io_memory; |
... | ... | |
314 | 337 |
if (chr) |
315 | 338 |
qemu_chr_add_handlers(chr, sh_serial_can_receive1, sh_serial_receive1, |
316 | 339 |
sh_serial_event, s); |
340 |
|
|
341 |
s->eri = eri_source; |
|
342 |
s->rxi = rxi_source; |
|
343 |
s->txi = txi_source; |
|
344 |
s->tei = tei_source; |
|
345 |
s->bri = bri_source; |
|
317 | 346 |
} |
Also available in: Unified diff