Revision fd06c375 hw/pc.c
b/hw/pc.c | ||
---|---|---|
36 | 36 |
#define KERNEL_PARAMS_ADDR 0x00090000 |
37 | 37 |
#define KERNEL_CMDLINE_ADDR 0x00099000 |
38 | 38 |
|
39 |
int speaker_data_on; |
|
40 |
int dummy_refresh_clock; |
|
41 | 39 |
static fdctrl_t *floppy_controller; |
42 | 40 |
static RTCState *rtc_state; |
43 | 41 |
static PITState *pit; |
... | ... | |
273 | 271 |
// rtc_set_memory(s, 0x38, 1); |
274 | 272 |
} |
275 | 273 |
|
276 |
static void speaker_ioport_write(void *opaque, uint32_t addr, uint32_t val) |
|
277 |
{ |
|
278 |
speaker_data_on = (val >> 1) & 1; |
|
279 |
pit_set_gate(pit, 2, val & 1); |
|
280 |
} |
|
281 |
|
|
282 |
static uint32_t speaker_ioport_read(void *opaque, uint32_t addr) |
|
283 |
{ |
|
284 |
int out; |
|
285 |
out = pit_get_out(pit, 2, qemu_get_clock(vm_clock)); |
|
286 |
dummy_refresh_clock ^= 1; |
|
287 |
return (speaker_data_on << 1) | pit_get_gate(pit, 2) | (out << 5) | |
|
288 |
(dummy_refresh_clock << 4); |
|
289 |
} |
|
290 |
|
|
291 | 274 |
void ioport_set_a20(int enable) |
292 | 275 |
{ |
293 | 276 |
/* XXX: send to all CPUs ? */ |
... | ... | |
783 | 766 |
} |
784 | 767 |
|
785 | 768 |
rtc_state = rtc_init(0x70, 8); |
786 |
register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL); |
|
787 |
register_ioport_write(0x61, 1, 1, speaker_ioport_write, NULL); |
|
788 | 769 |
|
789 | 770 |
register_ioport_read(0x92, 1, 1, ioport92_read, NULL); |
790 | 771 |
register_ioport_write(0x92, 1, 1, ioport92_write, NULL); |
... | ... | |
794 | 775 |
} |
795 | 776 |
isa_pic = pic_init(pic_irq_request, first_cpu); |
796 | 777 |
pit = pit_init(0x40, 0); |
778 |
pcspk_init(pit); |
|
797 | 779 |
if (pci_enabled) { |
798 | 780 |
pic_set_alt_irq_func(isa_pic, ioapic_set_irq, ioapic); |
799 | 781 |
} |
Also available in: Unified diff