Statistics
| Branch: | Revision:

root / sysemu.h @ 818220f5

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