Avoid running audio ctl's when vm is not running
[qemu/mdroth.git] / hw / pc.h
blob7f21144cfa69b4148eb593124edefdbd5aa22453
1 #ifndef HW_PC_H
2 #define HW_PC_H
3 /* PC-style peripherals (also used by other machines). */
5 /* serial.c */
7 SerialState *serial_init(int base, qemu_irq irq, int baudbase,
8 CharDriverState *chr);
9 SerialState *serial_mm_init (target_phys_addr_t base, int it_shift,
10 qemu_irq irq, int baudbase,
11 CharDriverState *chr, int ioregister);
12 uint32_t serial_mm_readb (void *opaque, target_phys_addr_t addr);
13 void serial_mm_writeb (void *opaque, target_phys_addr_t addr, uint32_t value);
14 uint32_t serial_mm_readw (void *opaque, target_phys_addr_t addr);
15 void serial_mm_writew (void *opaque, target_phys_addr_t addr, uint32_t value);
16 uint32_t serial_mm_readl (void *opaque, target_phys_addr_t addr);
17 void serial_mm_writel (void *opaque, target_phys_addr_t addr, uint32_t value);
19 /* parallel.c */
21 typedef struct ParallelState ParallelState;
22 ParallelState *parallel_init(int base, qemu_irq irq, CharDriverState *chr);
23 ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq, CharDriverState *chr);
25 /* i8259.c */
27 typedef struct PicState2 PicState2;
28 extern PicState2 *isa_pic;
29 void pic_set_irq(int irq, int level);
30 void pic_set_irq_new(void *opaque, int irq, int level);
31 qemu_irq *i8259_init(qemu_irq parent_irq);
32 void pic_set_alt_irq_func(PicState2 *s, SetIRQFunc *alt_irq_func,
33 void *alt_irq_opaque);
34 int pic_read_irq(PicState2 *s);
35 void pic_update_irq(PicState2 *s);
36 uint32_t pic_intack_read(PicState2 *s);
37 void pic_info(void);
38 void irq_info(void);
40 /* APIC */
41 typedef struct IOAPICState IOAPICState;
43 int apic_init(CPUState *env);
44 int apic_accept_pic_intr(CPUState *env);
45 void apic_deliver_pic_intr(CPUState *env, int level);
46 int apic_get_interrupt(CPUState *env);
47 IOAPICState *ioapic_init(void);
48 void ioapic_set_irq(void *opaque, int vector, int level);
49 void apic_reset_irq_delivered(void);
50 int apic_get_irq_delivered(void);
52 /* i8254.c */
54 #define PIT_FREQ 1193182
56 typedef struct PITState PITState;
58 PITState *pit_init(int base, qemu_irq irq);
59 void pit_set_gate(PITState *pit, int channel, int val);
60 int pit_get_gate(PITState *pit, int channel);
61 int pit_get_initial_count(PITState *pit, int channel);
62 int pit_get_mode(PITState *pit, int channel);
63 int pit_get_out(PITState *pit, int channel, int64_t current_time);
65 void hpet_pit_disable(void);
66 void hpet_pit_enable(void);
68 /* vmport.c */
69 void vmport_init(void);
70 void vmport_register(unsigned char command, IOPortReadFunc *func, void *opaque);
72 /* vmmouse.c */
73 void *vmmouse_init(void *m);
75 /* pckbd.c */
77 void i8042_init(qemu_irq kbd_irq, qemu_irq mouse_irq, uint32_t io_base);
78 void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
79 target_phys_addr_t base, ram_addr_t size,
80 target_phys_addr_t mask);
82 /* mc146818rtc.c */
84 typedef struct RTCState RTCState;
86 RTCState *rtc_init(int base, qemu_irq irq, int base_year);
87 RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq,
88 int base_year);
89 void rtc_set_memory(RTCState *s, int addr, int val);
90 void rtc_set_date(RTCState *s, const struct tm *tm);
91 void cmos_set_s3_resume(void);
93 /* pc.c */
94 extern int fd_bootchk;
96 void ioport_set_a20(int enable);
97 int ioport_get_a20(void);
99 /* acpi.c */
100 extern int acpi_enabled;
101 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
102 qemu_irq sci_irq);
103 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
104 void acpi_bios_init(void);
106 /* hpet.c */
107 extern int no_hpet;
109 /* pcspk.c */
110 void pcspk_init(PITState *);
111 int pcspk_audio_init(AudioState *, qemu_irq *pic);
113 /* piix_pci.c */
114 PCIBus *i440fx_init(PCIDevice **pi440fx_state, qemu_irq *pic);
115 void i440fx_set_smm(PCIDevice *d, int val);
116 int piix3_init(PCIBus *bus, int devfn);
117 void i440fx_init_memory_mappings(PCIDevice *d);
119 extern PCIDevice *piix4_dev;
120 int piix4_init(PCIBus *bus, int devfn);
122 /* vga.c */
123 enum vga_retrace_method {
124 VGA_RETRACE_DUMB,
125 VGA_RETRACE_PRECISE
128 extern enum vga_retrace_method vga_retrace_method;
130 #if !defined(TARGET_SPARC) || defined(TARGET_SPARC64)
131 #define VGA_RAM_SIZE (8192 * 1024)
132 #else
133 #define VGA_RAM_SIZE (9 * 1024 * 1024)
134 #endif
136 int isa_vga_init(uint8_t *vga_ram_base,
137 unsigned long vga_ram_offset, int vga_ram_size);
138 int pci_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
139 unsigned long vga_ram_offset, int vga_ram_size,
140 unsigned long vga_bios_offset, int vga_bios_size);
141 int isa_vga_mm_init(uint8_t *vga_ram_base,
142 unsigned long vga_ram_offset, int vga_ram_size,
143 target_phys_addr_t vram_base, target_phys_addr_t ctrl_base,
144 int it_shift);
146 /* cirrus_vga.c */
147 void pci_cirrus_vga_init(PCIBus *bus, uint8_t *vga_ram_base,
148 ram_addr_t vga_ram_offset, int vga_ram_size);
149 void isa_cirrus_vga_init(uint8_t *vga_ram_base,
150 ram_addr_t vga_ram_offset, int vga_ram_size);
152 /* ide.c */
153 void isa_ide_init(int iobase, int iobase2, qemu_irq irq,
154 BlockDriverState *hd0, BlockDriverState *hd1);
155 void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
156 int secondary_ide_enabled);
157 void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
158 qemu_irq *pic);
159 void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
160 qemu_irq *pic);
162 /* ne2000.c */
164 void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd);
166 #endif