Statistics
| Branch: | Revision:

root / sysemu.h @ b3c7724c

History | View | Annotate | Download (4.9 kB)

1 87ecb68b pbrook
#ifndef SYSEMU_H
2 87ecb68b pbrook
#define SYSEMU_H
3 87ecb68b pbrook
/* Misc. things related to the system emulator.  */
4 87ecb68b pbrook
5 87ecb68b pbrook
/* vl.c */
6 87ecb68b pbrook
extern const char *bios_name;
7 87ecb68b pbrook
extern const char *bios_dir;
8 87ecb68b pbrook
9 87ecb68b pbrook
extern int vm_running;
10 87ecb68b pbrook
extern const char *qemu_name;
11 87ecb68b pbrook
12 87ecb68b pbrook
typedef struct vm_change_state_entry VMChangeStateEntry;
13 87ecb68b pbrook
typedef void VMChangeStateHandler(void *opaque, int running);
14 87ecb68b pbrook
typedef void VMStopHandler(void *opaque, int reason);
15 87ecb68b pbrook
16 87ecb68b pbrook
VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
17 87ecb68b pbrook
                                                     void *opaque);
18 87ecb68b pbrook
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
19 87ecb68b pbrook
20 87ecb68b pbrook
int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque);
21 87ecb68b pbrook
void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque);
22 87ecb68b pbrook
23 87ecb68b pbrook
void vm_start(void);
24 87ecb68b pbrook
void vm_stop(int reason);
25 87ecb68b pbrook
26 87ecb68b pbrook
int64_t cpu_get_ticks(void);
27 87ecb68b pbrook
void cpu_enable_ticks(void);
28 87ecb68b pbrook
void cpu_disable_ticks(void);
29 87ecb68b pbrook
30 87ecb68b pbrook
void qemu_system_reset_request(void);
31 87ecb68b pbrook
void qemu_system_shutdown_request(void);
32 87ecb68b pbrook
void qemu_system_powerdown_request(void);
33 cf7a2fe2 aurel32
int qemu_shutdown_requested(void);
34 cf7a2fe2 aurel32
int qemu_reset_requested(void);
35 cf7a2fe2 aurel32
int qemu_powerdown_requested(void);
36 cf7a2fe2 aurel32
#if !defined(TARGET_SPARC) && !defined(TARGET_I386)
37 87ecb68b pbrook
// Please implement a power failure function to signal the OS
38 87ecb68b pbrook
#define qemu_system_powerdown() do{}while(0)
39 87ecb68b pbrook
#else
40 87ecb68b pbrook
void qemu_system_powerdown(void);
41 87ecb68b pbrook
#endif
42 cf7a2fe2 aurel32
void qemu_system_reset(void);
43 87ecb68b pbrook
44 87ecb68b pbrook
void do_savevm(const char *name);
45 87ecb68b pbrook
void do_loadvm(const char *name);
46 87ecb68b pbrook
void do_delvm(const char *name);
47 87ecb68b pbrook
void do_info_snapshots(void);
48 87ecb68b pbrook
49 87ecb68b pbrook
void main_loop_wait(int timeout);
50 87ecb68b pbrook
51 87ecb68b pbrook
/* Polling handling */
52 87ecb68b pbrook
53 87ecb68b pbrook
/* return TRUE if no sleep should be done afterwards */
54 87ecb68b pbrook
typedef int PollingFunc(void *opaque);
55 87ecb68b pbrook
56 87ecb68b pbrook
int qemu_add_polling_cb(PollingFunc *func, void *opaque);
57 87ecb68b pbrook
void qemu_del_polling_cb(PollingFunc *func, void *opaque);
58 87ecb68b pbrook
59 87ecb68b pbrook
#ifdef _WIN32
60 87ecb68b pbrook
/* Wait objects handling */
61 87ecb68b pbrook
typedef void WaitObjectFunc(void *opaque);
62 87ecb68b pbrook
63 87ecb68b pbrook
int qemu_add_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
64 87ecb68b pbrook
void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
65 87ecb68b pbrook
#endif
66 87ecb68b pbrook
67 87ecb68b pbrook
/* TAP win32 */
68 87ecb68b pbrook
int tap_win32_init(VLANState *vlan, const char *ifname);
69 87ecb68b pbrook
70 87ecb68b pbrook
/* SLIRP */
71 87ecb68b pbrook
void do_info_slirp(void);
72 87ecb68b pbrook
73 87ecb68b pbrook
extern int bios_size;
74 87ecb68b pbrook
extern int cirrus_vga_enabled;
75 87ecb68b pbrook
extern int vmsvga_enabled;
76 87ecb68b pbrook
extern int graphic_width;
77 87ecb68b pbrook
extern int graphic_height;
78 87ecb68b pbrook
extern int graphic_depth;
79 87ecb68b pbrook
extern const char *keyboard_layout;
80 87ecb68b pbrook
extern int win2k_install_hack;
81 87ecb68b pbrook
extern int alt_grab;
82 87ecb68b pbrook
extern int usb_enabled;
83 87ecb68b pbrook
extern int smp_cpus;
84 87ecb68b pbrook
extern int cursor_hide;
85 87ecb68b pbrook
extern int graphic_rotate;
86 87ecb68b pbrook
extern int no_quit;
87 87ecb68b pbrook
extern int semihosting_enabled;
88 87ecb68b pbrook
extern int autostart;
89 87ecb68b pbrook
extern int old_param;
90 87ecb68b pbrook
extern const char *bootp_filename;
91 87ecb68b pbrook
92 87ecb68b pbrook
93 87ecb68b pbrook
#ifdef USE_KQEMU
94 87ecb68b pbrook
extern int kqemu_allowed;
95 87ecb68b pbrook
#endif
96 87ecb68b pbrook
97 87ecb68b pbrook
#define MAX_OPTION_ROMS 16
98 87ecb68b pbrook
extern const char *option_rom[MAX_OPTION_ROMS];
99 87ecb68b pbrook
extern int nb_option_roms;
100 87ecb68b pbrook
101 87ecb68b pbrook
#ifdef TARGET_SPARC
102 87ecb68b pbrook
#define MAX_PROM_ENVS 128
103 87ecb68b pbrook
extern const char *prom_envs[MAX_PROM_ENVS];
104 87ecb68b pbrook
extern unsigned int nb_prom_envs;
105 87ecb68b pbrook
#endif
106 87ecb68b pbrook
107 87ecb68b pbrook
#if defined (TARGET_PPC)
108 87ecb68b pbrook
#define BIOS_SIZE (1024 * 1024)
109 87ecb68b pbrook
#elif defined (TARGET_SPARC64)
110 87ecb68b pbrook
#define BIOS_SIZE ((512 + 32) * 1024)
111 87ecb68b pbrook
#elif defined(TARGET_MIPS)
112 87ecb68b pbrook
#define BIOS_SIZE (4 * 1024 * 1024)
113 87ecb68b pbrook
#endif
114 87ecb68b pbrook
115 e4bcb14c ths
typedef enum {
116 e4bcb14c ths
    IF_IDE, IF_SCSI, IF_FLOPPY, IF_PFLASH, IF_MTD, IF_SD
117 e4bcb14c ths
} BlockInterfaceType;
118 e4bcb14c ths
119 e4bcb14c ths
typedef struct DriveInfo {
120 e4bcb14c ths
    BlockDriverState *bdrv;
121 f60d39bc ths
    BlockInterfaceType type;
122 e4bcb14c ths
    int bus;
123 e4bcb14c ths
    int unit;
124 e4bcb14c ths
} DriveInfo;
125 e4bcb14c ths
126 e4bcb14c ths
#define MAX_IDE_DEVS        2
127 e4bcb14c ths
#define MAX_SCSI_DEVS        7
128 e4bcb14c ths
#define MAX_DRIVES 32
129 e4bcb14c ths
130 4d7a0880 blueswir1
extern int nb_drives;
131 4d7a0880 blueswir1
extern DriveInfo drives_table[MAX_DRIVES+1];
132 e4bcb14c ths
133 f60d39bc ths
extern int drive_get_index(BlockInterfaceType type, int bus, int unit);
134 f60d39bc ths
extern int drive_get_max_bus(BlockInterfaceType type);
135 87ecb68b pbrook
136 87ecb68b pbrook
/* serial ports */
137 87ecb68b pbrook
138 87ecb68b pbrook
#define MAX_SERIAL_PORTS 4
139 87ecb68b pbrook
140 87ecb68b pbrook
extern CharDriverState *serial_hds[MAX_SERIAL_PORTS];
141 87ecb68b pbrook
142 87ecb68b pbrook
/* parallel ports */
143 87ecb68b pbrook
144 87ecb68b pbrook
#define MAX_PARALLEL_PORTS 3
145 87ecb68b pbrook
146 87ecb68b pbrook
extern CharDriverState *parallel_hds[MAX_PARALLEL_PORTS];
147 87ecb68b pbrook
148 87ecb68b pbrook
#ifdef NEED_CPU_H
149 87ecb68b pbrook
/* loader.c */
150 87ecb68b pbrook
int get_image_size(const char *filename);
151 293f78bc blueswir1
int load_image(const char *filename, uint8_t *addr); /* deprecated */
152 293f78bc blueswir1
int load_image_targphys(const char *filename, target_phys_addr_t, int max_sz);
153 87ecb68b pbrook
int load_elf(const char *filename, int64_t virt_to_phys_addend,
154 87ecb68b pbrook
             uint64_t *pentry, uint64_t *lowaddr, uint64_t *highaddr);
155 293f78bc blueswir1
int load_aout(const char *filename, target_phys_addr_t addr, int max_sz);
156 87ecb68b pbrook
int load_uboot(const char *filename, target_ulong *ep, int *is_linux);
157 293f78bc blueswir1
158 293f78bc blueswir1
int fread_targphys(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
159 293f78bc blueswir1
int fread_targphys_ok(target_phys_addr_t dst_addr, size_t nbytes, FILE *f);
160 293f78bc blueswir1
int read_targphys(int fd, target_phys_addr_t dst_addr, size_t nbytes);
161 293f78bc blueswir1
void pstrcpy_targphys(target_phys_addr_t dest, int buf_size,
162 293f78bc blueswir1
                      const char *source);
163 87ecb68b pbrook
#endif
164 87ecb68b pbrook
165 87ecb68b pbrook
#ifdef HAS_AUDIO
166 87ecb68b pbrook
struct soundhw {
167 87ecb68b pbrook
    const char *name;
168 87ecb68b pbrook
    const char *descr;
169 87ecb68b pbrook
    int enabled;
170 87ecb68b pbrook
    int isa;
171 87ecb68b pbrook
    union {
172 87ecb68b pbrook
        int (*init_isa) (AudioState *s, qemu_irq *pic);
173 87ecb68b pbrook
        int (*init_pci) (PCIBus *bus, AudioState *s);
174 87ecb68b pbrook
    } init;
175 87ecb68b pbrook
};
176 87ecb68b pbrook
177 87ecb68b pbrook
extern struct soundhw soundhw[];
178 87ecb68b pbrook
#endif
179 87ecb68b pbrook
180 87ecb68b pbrook
void do_usb_add(const char *devname);
181 87ecb68b pbrook
void do_usb_del(const char *devname);
182 87ecb68b pbrook
void usb_info(void);
183 87ecb68b pbrook
184 87ecb68b pbrook
#endif