root / vl.h @ 2aebb3eb
History | View | Annotate | Download (12.4 kB)
1 | fc01f7e7 | bellard | /*
|
---|---|---|---|
2 | fc01f7e7 | bellard | * QEMU System Emulator header
|
3 | fc01f7e7 | bellard | *
|
4 | fc01f7e7 | bellard | * Copyright (c) 2003 Fabrice Bellard
|
5 | fc01f7e7 | bellard | *
|
6 | fc01f7e7 | bellard | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
7 | fc01f7e7 | bellard | * of this software and associated documentation files (the "Software"), to deal
|
8 | fc01f7e7 | bellard | * in the Software without restriction, including without limitation the rights
|
9 | fc01f7e7 | bellard | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10 | fc01f7e7 | bellard | * copies of the Software, and to permit persons to whom the Software is
|
11 | fc01f7e7 | bellard | * furnished to do so, subject to the following conditions:
|
12 | fc01f7e7 | bellard | *
|
13 | fc01f7e7 | bellard | * The above copyright notice and this permission notice shall be included in
|
14 | fc01f7e7 | bellard | * all copies or substantial portions of the Software.
|
15 | fc01f7e7 | bellard | *
|
16 | fc01f7e7 | bellard | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17 | fc01f7e7 | bellard | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18 | fc01f7e7 | bellard | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
19 | fc01f7e7 | bellard | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20 | fc01f7e7 | bellard | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21 | fc01f7e7 | bellard | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22 | fc01f7e7 | bellard | * THE SOFTWARE.
|
23 | fc01f7e7 | bellard | */
|
24 | fc01f7e7 | bellard | #ifndef VL_H
|
25 | fc01f7e7 | bellard | #define VL_H
|
26 | fc01f7e7 | bellard | |
27 | 67b915a5 | bellard | /* we put basic includes here to avoid repeating them in device drivers */
|
28 | 67b915a5 | bellard | #include <stdlib.h> |
29 | 67b915a5 | bellard | #include <stdio.h> |
30 | 67b915a5 | bellard | #include <stdarg.h> |
31 | 67b915a5 | bellard | #include <string.h> |
32 | 67b915a5 | bellard | #include <inttypes.h> |
33 | 8a7ddc38 | bellard | #include <time.h> |
34 | 67b915a5 | bellard | #include <ctype.h> |
35 | 67b915a5 | bellard | #include <errno.h> |
36 | 67b915a5 | bellard | #include <unistd.h> |
37 | 67b915a5 | bellard | #include <fcntl.h> |
38 | 67b915a5 | bellard | |
39 | 67b915a5 | bellard | #ifndef O_LARGEFILE
|
40 | 67b915a5 | bellard | #define O_LARGEFILE 0 |
41 | 67b915a5 | bellard | #endif
|
42 | 40c3bac3 | bellard | #ifndef O_BINARY
|
43 | 40c3bac3 | bellard | #define O_BINARY 0 |
44 | 40c3bac3 | bellard | #endif
|
45 | 67b915a5 | bellard | |
46 | 67b915a5 | bellard | #ifdef _WIN32
|
47 | 67b915a5 | bellard | #define lseek64 lseek
|
48 | 67b915a5 | bellard | #endif
|
49 | 8a7ddc38 | bellard | |
50 | 16f62432 | bellard | #include "cpu.h" |
51 | 16f62432 | bellard | |
52 | 67b915a5 | bellard | #ifndef glue
|
53 | 67b915a5 | bellard | #define xglue(x, y) x ## y |
54 | 67b915a5 | bellard | #define glue(x, y) xglue(x, y)
|
55 | 67b915a5 | bellard | #define stringify(s) tostring(s)
|
56 | 67b915a5 | bellard | #define tostring(s) #s |
57 | 67b915a5 | bellard | #endif
|
58 | 67b915a5 | bellard | |
59 | 67b915a5 | bellard | #if defined(WORDS_BIGENDIAN)
|
60 | 67b915a5 | bellard | static inline uint32_t be32_to_cpu(uint32_t v) |
61 | 67b915a5 | bellard | { |
62 | 67b915a5 | bellard | return v;
|
63 | 67b915a5 | bellard | } |
64 | 67b915a5 | bellard | |
65 | 67b915a5 | bellard | static inline uint16_t be16_to_cpu(uint16_t v) |
66 | 67b915a5 | bellard | { |
67 | 67b915a5 | bellard | return v;
|
68 | 67b915a5 | bellard | } |
69 | 67b915a5 | bellard | |
70 | 67b915a5 | bellard | static inline uint32_t le32_to_cpu(uint32_t v) |
71 | 67b915a5 | bellard | { |
72 | 67b915a5 | bellard | return bswap32(v);
|
73 | 67b915a5 | bellard | } |
74 | 67b915a5 | bellard | |
75 | 67b915a5 | bellard | static inline uint16_t le16_to_cpu(uint16_t v) |
76 | 67b915a5 | bellard | { |
77 | 67b915a5 | bellard | return bswap16(v);
|
78 | 67b915a5 | bellard | } |
79 | 67b915a5 | bellard | |
80 | 67b915a5 | bellard | #else
|
81 | 67b915a5 | bellard | static inline uint32_t be32_to_cpu(uint32_t v) |
82 | 67b915a5 | bellard | { |
83 | 67b915a5 | bellard | return bswap32(v);
|
84 | 67b915a5 | bellard | } |
85 | 67b915a5 | bellard | |
86 | 67b915a5 | bellard | static inline uint16_t be16_to_cpu(uint16_t v) |
87 | 67b915a5 | bellard | { |
88 | 67b915a5 | bellard | return bswap16(v);
|
89 | 67b915a5 | bellard | } |
90 | 67b915a5 | bellard | |
91 | 67b915a5 | bellard | static inline uint32_t le32_to_cpu(uint32_t v) |
92 | 67b915a5 | bellard | { |
93 | 67b915a5 | bellard | return v;
|
94 | 67b915a5 | bellard | } |
95 | 67b915a5 | bellard | |
96 | 67b915a5 | bellard | static inline uint16_t le16_to_cpu(uint16_t v) |
97 | 67b915a5 | bellard | { |
98 | 67b915a5 | bellard | return v;
|
99 | 67b915a5 | bellard | } |
100 | 67b915a5 | bellard | #endif
|
101 | 67b915a5 | bellard | |
102 | 67b915a5 | bellard | |
103 | 33e3963e | bellard | /* vl.c */
|
104 | 313aa567 | bellard | extern int reset_requested; |
105 | 313aa567 | bellard | |
106 | c4b1fcc0 | bellard | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
107 | c4b1fcc0 | bellard | typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
108 | 313aa567 | bellard | |
109 | c4b1fcc0 | bellard | int register_ioport_read(int start, int length, int size, |
110 | c4b1fcc0 | bellard | IOPortReadFunc *func, void *opaque);
|
111 | c4b1fcc0 | bellard | int register_ioport_write(int start, int length, int size, |
112 | c4b1fcc0 | bellard | IOPortWriteFunc *func, void *opaque);
|
113 | 80cabfad | bellard | uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c); |
114 | 313aa567 | bellard | |
115 | 80cabfad | bellard | void hw_error(const char *fmt, ...); |
116 | 80cabfad | bellard | |
117 | 80cabfad | bellard | int load_image(const char *filename, uint8_t *addr); |
118 | 80cabfad | bellard | extern const char *bios_dir; |
119 | 80cabfad | bellard | |
120 | 80cabfad | bellard | void pstrcpy(char *buf, int buf_size, const char *str); |
121 | 80cabfad | bellard | char *pstrcat(char *buf, int buf_size, const char *s); |
122 | 33e3963e | bellard | |
123 | c4b1fcc0 | bellard | int serial_open_device(void); |
124 | c4b1fcc0 | bellard | |
125 | 8a7ddc38 | bellard | extern int vm_running; |
126 | 8a7ddc38 | bellard | |
127 | 8a7ddc38 | bellard | typedef void VMStopHandler(void *opaque, int reason); |
128 | 8a7ddc38 | bellard | |
129 | 8a7ddc38 | bellard | int qemu_add_vm_stop_handler(VMStopHandler *cb, void *opaque); |
130 | 8a7ddc38 | bellard | void qemu_del_vm_stop_handler(VMStopHandler *cb, void *opaque); |
131 | 8a7ddc38 | bellard | |
132 | 8a7ddc38 | bellard | void vm_start(void); |
133 | 8a7ddc38 | bellard | void vm_stop(int reason); |
134 | 8a7ddc38 | bellard | |
135 | c4b1fcc0 | bellard | /* network redirectors support */
|
136 | c4b1fcc0 | bellard | |
137 | c4b1fcc0 | bellard | #define MAX_NICS 8 |
138 | c4b1fcc0 | bellard | |
139 | c4b1fcc0 | bellard | typedef struct NetDriverState { |
140 | c4b1fcc0 | bellard | int fd;
|
141 | c4b1fcc0 | bellard | uint8_t macaddr[6];
|
142 | c4b1fcc0 | bellard | char ifname[16]; |
143 | c4b1fcc0 | bellard | } NetDriverState; |
144 | c4b1fcc0 | bellard | |
145 | c4b1fcc0 | bellard | extern int nb_nics; |
146 | c4b1fcc0 | bellard | extern NetDriverState nd_table[MAX_NICS];
|
147 | c4b1fcc0 | bellard | |
148 | c4b1fcc0 | bellard | void net_send_packet(NetDriverState *nd, const uint8_t *buf, int size); |
149 | c4b1fcc0 | bellard | |
150 | c4b1fcc0 | bellard | /* async I/O support */
|
151 | c4b1fcc0 | bellard | |
152 | c4b1fcc0 | bellard | typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size); |
153 | c4b1fcc0 | bellard | typedef int IOCanRWHandler(void *opaque); |
154 | c4b1fcc0 | bellard | |
155 | 8a7ddc38 | bellard | int qemu_add_fd_read_handler(int fd, IOCanRWHandler *fd_can_read, |
156 | 8a7ddc38 | bellard | IOReadHandler *fd_read, void *opaque);
|
157 | 8a7ddc38 | bellard | void qemu_del_fd_read_handler(int fd); |
158 | 8a7ddc38 | bellard | |
159 | 8a7ddc38 | bellard | /* timers */
|
160 | 8a7ddc38 | bellard | |
161 | 8a7ddc38 | bellard | typedef struct QEMUClock QEMUClock; |
162 | 8a7ddc38 | bellard | typedef struct QEMUTimer QEMUTimer; |
163 | 8a7ddc38 | bellard | typedef void QEMUTimerCB(void *opaque); |
164 | 8a7ddc38 | bellard | |
165 | 8a7ddc38 | bellard | /* The real time clock should be used only for stuff which does not
|
166 | 8a7ddc38 | bellard | change the virtual machine state, as it is run even if the virtual
|
167 | 8a7ddc38 | bellard | machine is stopped. The real time clock has a frequency or 1000
|
168 | 8a7ddc38 | bellard | Hz. */
|
169 | 8a7ddc38 | bellard | extern QEMUClock *rt_clock;
|
170 | 8a7ddc38 | bellard | |
171 | 8a7ddc38 | bellard | /* Rge virtual clock is only run during the emulation. It is stopped
|
172 | 8a7ddc38 | bellard | when the virtual machine is stopped. Virtual timers use a high
|
173 | 8a7ddc38 | bellard | precision clock, usually cpu cycles (use ticks_per_sec). */
|
174 | 8a7ddc38 | bellard | extern QEMUClock *vm_clock;
|
175 | 8a7ddc38 | bellard | |
176 | 8a7ddc38 | bellard | int64_t qemu_get_clock(QEMUClock *clock); |
177 | 8a7ddc38 | bellard | |
178 | 8a7ddc38 | bellard | QEMUTimer *qemu_new_timer(QEMUClock *clock, QEMUTimerCB *cb, void *opaque);
|
179 | 8a7ddc38 | bellard | void qemu_free_timer(QEMUTimer *ts);
|
180 | 8a7ddc38 | bellard | void qemu_del_timer(QEMUTimer *ts);
|
181 | 8a7ddc38 | bellard | void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time);
|
182 | 8a7ddc38 | bellard | int qemu_timer_pending(QEMUTimer *ts);
|
183 | 8a7ddc38 | bellard | |
184 | 8a7ddc38 | bellard | extern int64_t ticks_per_sec;
|
185 | 8a7ddc38 | bellard | extern int pit_min_timer_count; |
186 | 8a7ddc38 | bellard | |
187 | 8a7ddc38 | bellard | void cpu_enable_ticks(void); |
188 | 8a7ddc38 | bellard | void cpu_disable_ticks(void); |
189 | 8a7ddc38 | bellard | |
190 | 8a7ddc38 | bellard | /* VM Load/Save */
|
191 | 8a7ddc38 | bellard | |
192 | 8a7ddc38 | bellard | typedef FILE QEMUFile;
|
193 | 8a7ddc38 | bellard | |
194 | 8a7ddc38 | bellard | void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); |
195 | 8a7ddc38 | bellard | void qemu_put_byte(QEMUFile *f, int v); |
196 | 8a7ddc38 | bellard | void qemu_put_be16(QEMUFile *f, unsigned int v); |
197 | 8a7ddc38 | bellard | void qemu_put_be32(QEMUFile *f, unsigned int v); |
198 | 8a7ddc38 | bellard | void qemu_put_be64(QEMUFile *f, uint64_t v);
|
199 | 8a7ddc38 | bellard | int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size); |
200 | 8a7ddc38 | bellard | int qemu_get_byte(QEMUFile *f);
|
201 | 8a7ddc38 | bellard | unsigned int qemu_get_be16(QEMUFile *f); |
202 | 8a7ddc38 | bellard | unsigned int qemu_get_be32(QEMUFile *f); |
203 | 8a7ddc38 | bellard | uint64_t qemu_get_be64(QEMUFile *f); |
204 | 8a7ddc38 | bellard | |
205 | 8a7ddc38 | bellard | static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) |
206 | 8a7ddc38 | bellard | { |
207 | 8a7ddc38 | bellard | qemu_put_be64(f, *pv); |
208 | 8a7ddc38 | bellard | } |
209 | 8a7ddc38 | bellard | |
210 | 8a7ddc38 | bellard | static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) |
211 | 8a7ddc38 | bellard | { |
212 | 8a7ddc38 | bellard | qemu_put_be32(f, *pv); |
213 | 8a7ddc38 | bellard | } |
214 | 8a7ddc38 | bellard | |
215 | 8a7ddc38 | bellard | static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) |
216 | 8a7ddc38 | bellard | { |
217 | 8a7ddc38 | bellard | qemu_put_be16(f, *pv); |
218 | 8a7ddc38 | bellard | } |
219 | 8a7ddc38 | bellard | |
220 | 8a7ddc38 | bellard | static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) |
221 | 8a7ddc38 | bellard | { |
222 | 8a7ddc38 | bellard | qemu_put_byte(f, *pv); |
223 | 8a7ddc38 | bellard | } |
224 | 8a7ddc38 | bellard | |
225 | 8a7ddc38 | bellard | static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) |
226 | 8a7ddc38 | bellard | { |
227 | 8a7ddc38 | bellard | *pv = qemu_get_be64(f); |
228 | 8a7ddc38 | bellard | } |
229 | 8a7ddc38 | bellard | |
230 | 8a7ddc38 | bellard | static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) |
231 | 8a7ddc38 | bellard | { |
232 | 8a7ddc38 | bellard | *pv = qemu_get_be32(f); |
233 | 8a7ddc38 | bellard | } |
234 | 8a7ddc38 | bellard | |
235 | 8a7ddc38 | bellard | static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) |
236 | 8a7ddc38 | bellard | { |
237 | 8a7ddc38 | bellard | *pv = qemu_get_be16(f); |
238 | 8a7ddc38 | bellard | } |
239 | 8a7ddc38 | bellard | |
240 | 8a7ddc38 | bellard | static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) |
241 | 8a7ddc38 | bellard | { |
242 | 8a7ddc38 | bellard | *pv = qemu_get_byte(f); |
243 | 8a7ddc38 | bellard | } |
244 | 8a7ddc38 | bellard | |
245 | 8a7ddc38 | bellard | int64_t qemu_ftell(QEMUFile *f); |
246 | 8a7ddc38 | bellard | int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
247 | 8a7ddc38 | bellard | |
248 | 8a7ddc38 | bellard | typedef void SaveStateHandler(QEMUFile *f, void *opaque); |
249 | 8a7ddc38 | bellard | typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id); |
250 | 8a7ddc38 | bellard | |
251 | 8a7ddc38 | bellard | int qemu_loadvm(const char *filename); |
252 | 8a7ddc38 | bellard | int qemu_savevm(const char *filename); |
253 | 8a7ddc38 | bellard | int register_savevm(const char *idstr, |
254 | 8a7ddc38 | bellard | int instance_id,
|
255 | 8a7ddc38 | bellard | int version_id,
|
256 | 8a7ddc38 | bellard | SaveStateHandler *save_state, |
257 | 8a7ddc38 | bellard | LoadStateHandler *load_state, |
258 | 8a7ddc38 | bellard | void *opaque);
|
259 | 8a7ddc38 | bellard | void qemu_get_timer(QEMUFile *f, QEMUTimer *ts);
|
260 | 8a7ddc38 | bellard | void qemu_put_timer(QEMUFile *f, QEMUTimer *ts);
|
261 | c4b1fcc0 | bellard | |
262 | fc01f7e7 | bellard | /* block.c */
|
263 | fc01f7e7 | bellard | typedef struct BlockDriverState BlockDriverState; |
264 | fc01f7e7 | bellard | |
265 | c4b1fcc0 | bellard | BlockDriverState *bdrv_new(const char *device_name); |
266 | c4b1fcc0 | bellard | void bdrv_delete(BlockDriverState *bs);
|
267 | c4b1fcc0 | bellard | int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot); |
268 | fc01f7e7 | bellard | void bdrv_close(BlockDriverState *bs);
|
269 | fc01f7e7 | bellard | int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
270 | fc01f7e7 | bellard | uint8_t *buf, int nb_sectors);
|
271 | fc01f7e7 | bellard | int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
272 | fc01f7e7 | bellard | const uint8_t *buf, int nb_sectors); |
273 | fc01f7e7 | bellard | void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr);
|
274 | 33e3963e | bellard | int bdrv_commit(BlockDriverState *bs);
|
275 | 77fef8c1 | bellard | void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size); |
276 | 33e3963e | bellard | |
277 | c4b1fcc0 | bellard | #define BDRV_TYPE_HD 0 |
278 | c4b1fcc0 | bellard | #define BDRV_TYPE_CDROM 1 |
279 | c4b1fcc0 | bellard | #define BDRV_TYPE_FLOPPY 2 |
280 | c4b1fcc0 | bellard | |
281 | c4b1fcc0 | bellard | void bdrv_set_geometry_hint(BlockDriverState *bs,
|
282 | c4b1fcc0 | bellard | int cyls, int heads, int secs); |
283 | c4b1fcc0 | bellard | void bdrv_set_type_hint(BlockDriverState *bs, int type); |
284 | c4b1fcc0 | bellard | void bdrv_get_geometry_hint(BlockDriverState *bs,
|
285 | c4b1fcc0 | bellard | int *pcyls, int *pheads, int *psecs); |
286 | c4b1fcc0 | bellard | int bdrv_get_type_hint(BlockDriverState *bs);
|
287 | c4b1fcc0 | bellard | int bdrv_is_removable(BlockDriverState *bs);
|
288 | c4b1fcc0 | bellard | int bdrv_is_read_only(BlockDriverState *bs);
|
289 | c4b1fcc0 | bellard | int bdrv_is_inserted(BlockDriverState *bs);
|
290 | c4b1fcc0 | bellard | int bdrv_is_locked(BlockDriverState *bs);
|
291 | c4b1fcc0 | bellard | void bdrv_set_locked(BlockDriverState *bs, int locked); |
292 | c4b1fcc0 | bellard | void bdrv_set_change_cb(BlockDriverState *bs,
|
293 | c4b1fcc0 | bellard | void (*change_cb)(void *opaque), void *opaque); |
294 | c4b1fcc0 | bellard | |
295 | c4b1fcc0 | bellard | void bdrv_info(void); |
296 | c4b1fcc0 | bellard | BlockDriverState *bdrv_find(const char *name); |
297 | c4b1fcc0 | bellard | |
298 | 313aa567 | bellard | /* vga.c */
|
299 | 313aa567 | bellard | |
300 | 4fa0f5d2 | bellard | #define VGA_RAM_SIZE (4096 * 1024) |
301 | 313aa567 | bellard | |
302 | 313aa567 | bellard | typedef struct DisplayState { |
303 | 313aa567 | bellard | uint8_t *data; |
304 | 313aa567 | bellard | int linesize;
|
305 | 313aa567 | bellard | int depth;
|
306 | 313aa567 | bellard | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
307 | 313aa567 | bellard | void (*dpy_resize)(struct DisplayState *s, int w, int h); |
308 | 313aa567 | bellard | void (*dpy_refresh)(struct DisplayState *s); |
309 | 313aa567 | bellard | } DisplayState; |
310 | 313aa567 | bellard | |
311 | 313aa567 | bellard | static inline void dpy_update(DisplayState *s, int x, int y, int w, int h) |
312 | 313aa567 | bellard | { |
313 | 313aa567 | bellard | s->dpy_update(s, x, y, w, h); |
314 | 313aa567 | bellard | } |
315 | 313aa567 | bellard | |
316 | 313aa567 | bellard | static inline void dpy_resize(DisplayState *s, int w, int h) |
317 | 313aa567 | bellard | { |
318 | 313aa567 | bellard | s->dpy_resize(s, w, h); |
319 | 313aa567 | bellard | } |
320 | 313aa567 | bellard | |
321 | 7138fcfb | bellard | int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base,
|
322 | 7138fcfb | bellard | unsigned long vga_ram_offset, int vga_ram_size); |
323 | 313aa567 | bellard | void vga_update_display(void); |
324 | 59a983b9 | bellard | void vga_screen_dump(const char *filename); |
325 | 313aa567 | bellard | |
326 | 313aa567 | bellard | /* sdl.c */
|
327 | 313aa567 | bellard | void sdl_display_init(DisplayState *ds);
|
328 | 313aa567 | bellard | |
329 | 5391d806 | bellard | /* ide.c */
|
330 | 5391d806 | bellard | #define MAX_DISKS 4 |
331 | 5391d806 | bellard | |
332 | 5391d806 | bellard | extern BlockDriverState *bs_table[MAX_DISKS];
|
333 | 5391d806 | bellard | |
334 | c4b1fcc0 | bellard | void ide_init(int iobase, int iobase2, int irq, |
335 | c4b1fcc0 | bellard | BlockDriverState *hd0, BlockDriverState *hd1); |
336 | 5391d806 | bellard | |
337 | 27503323 | bellard | /* oss.c */
|
338 | 27503323 | bellard | typedef enum { |
339 | 27503323 | bellard | AUD_FMT_U8, |
340 | 27503323 | bellard | AUD_FMT_S8, |
341 | 27503323 | bellard | AUD_FMT_U16, |
342 | 27503323 | bellard | AUD_FMT_S16 |
343 | 27503323 | bellard | } audfmt_e; |
344 | 27503323 | bellard | |
345 | 27503323 | bellard | void AUD_open (int rfreq, int rnchannels, audfmt_e rfmt); |
346 | 27503323 | bellard | void AUD_reset (int rfreq, int rnchannels, audfmt_e rfmt); |
347 | 27503323 | bellard | int AUD_write (void *in_buf, int size); |
348 | 27503323 | bellard | void AUD_run (void); |
349 | 27503323 | bellard | void AUD_adjust_estimate (int _leftover); |
350 | 27503323 | bellard | int AUD_get_free (void); |
351 | 27503323 | bellard | int AUD_get_live (void); |
352 | 27503323 | bellard | int AUD_get_buffer_size (void); |
353 | 27503323 | bellard | void AUD_init (void); |
354 | 27503323 | bellard | |
355 | 27503323 | bellard | /* dma.c */
|
356 | 16f62432 | bellard | typedef int (*DMA_transfer_handler) (void *opaque, target_ulong addr, int size); |
357 | 27503323 | bellard | int DMA_get_channel_mode (int nchan); |
358 | 27503323 | bellard | void DMA_hold_DREQ (int nchan); |
359 | 27503323 | bellard | void DMA_release_DREQ (int nchan); |
360 | 16f62432 | bellard | void DMA_schedule(int nchan); |
361 | 27503323 | bellard | void DMA_run (void); |
362 | 27503323 | bellard | void DMA_init (void); |
363 | 27503323 | bellard | void DMA_register_channel (int nchan, |
364 | 16f62432 | bellard | DMA_transfer_handler transfer_handler, void *opaque);
|
365 | 27503323 | bellard | |
366 | 27503323 | bellard | /* sb16.c */
|
367 | 27503323 | bellard | void SB16_run (void); |
368 | 27503323 | bellard | void SB16_init (void); |
369 | 27503323 | bellard | |
370 | 7138fcfb | bellard | /* fdc.c */
|
371 | 7138fcfb | bellard | #define MAX_FD 2 |
372 | 7138fcfb | bellard | extern BlockDriverState *fd_table[MAX_FD];
|
373 | 7138fcfb | bellard | |
374 | baca51fa | bellard | typedef struct fdctrl_t fdctrl_t; |
375 | baca51fa | bellard | |
376 | baca51fa | bellard | fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, |
377 | baca51fa | bellard | uint32_t io_base, |
378 | baca51fa | bellard | BlockDriverState **fds); |
379 | baca51fa | bellard | int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num); |
380 | 7138fcfb | bellard | |
381 | 80cabfad | bellard | /* ne2000.c */
|
382 | 80cabfad | bellard | |
383 | c4b1fcc0 | bellard | void ne2000_init(int base, int irq, NetDriverState *nd); |
384 | 80cabfad | bellard | |
385 | 80cabfad | bellard | /* pckbd.c */
|
386 | 80cabfad | bellard | |
387 | 80cabfad | bellard | void kbd_put_keycode(int keycode); |
388 | 80cabfad | bellard | |
389 | 80cabfad | bellard | #define MOUSE_EVENT_LBUTTON 0x01 |
390 | 80cabfad | bellard | #define MOUSE_EVENT_RBUTTON 0x02 |
391 | 80cabfad | bellard | #define MOUSE_EVENT_MBUTTON 0x04 |
392 | 80cabfad | bellard | void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); |
393 | 80cabfad | bellard | |
394 | 80cabfad | bellard | void kbd_init(void); |
395 | 80cabfad | bellard | |
396 | 80cabfad | bellard | /* mc146818rtc.c */
|
397 | 80cabfad | bellard | |
398 | 8a7ddc38 | bellard | typedef struct RTCState RTCState; |
399 | 80cabfad | bellard | |
400 | 8a7ddc38 | bellard | RTCState *rtc_init(int base, int irq); |
401 | 8a7ddc38 | bellard | void rtc_set_memory(RTCState *s, int addr, int val); |
402 | 8a7ddc38 | bellard | void rtc_set_date(RTCState *s, const struct tm *tm); |
403 | 80cabfad | bellard | |
404 | 80cabfad | bellard | /* serial.c */
|
405 | 80cabfad | bellard | |
406 | c4b1fcc0 | bellard | typedef struct SerialState SerialState; |
407 | c4b1fcc0 | bellard | |
408 | c4b1fcc0 | bellard | extern SerialState *serial_console;
|
409 | c4b1fcc0 | bellard | |
410 | c4b1fcc0 | bellard | SerialState *serial_init(int base, int irq, int fd); |
411 | c4b1fcc0 | bellard | int serial_can_receive(SerialState *s);
|
412 | c4b1fcc0 | bellard | void serial_receive_byte(SerialState *s, int ch); |
413 | c4b1fcc0 | bellard | void serial_receive_break(SerialState *s);
|
414 | 80cabfad | bellard | |
415 | 80cabfad | bellard | /* i8259.c */
|
416 | 80cabfad | bellard | |
417 | 80cabfad | bellard | void pic_set_irq(int irq, int level); |
418 | 80cabfad | bellard | void pic_init(void); |
419 | c5df018e | bellard | uint32_t pic_intack_read(CPUState *env); |
420 | 80cabfad | bellard | |
421 | 80cabfad | bellard | /* i8254.c */
|
422 | 80cabfad | bellard | |
423 | 80cabfad | bellard | #define PIT_FREQ 1193182 |
424 | 80cabfad | bellard | |
425 | 80cabfad | bellard | typedef struct PITChannelState { |
426 | 80cabfad | bellard | int count; /* can be 65536 */ |
427 | 80cabfad | bellard | uint16_t latched_count; |
428 | 80cabfad | bellard | uint8_t rw_state; |
429 | 80cabfad | bellard | uint8_t mode; |
430 | 80cabfad | bellard | uint8_t bcd; /* not supported */
|
431 | 80cabfad | bellard | uint8_t gate; /* timer start */
|
432 | 80cabfad | bellard | int64_t count_load_time; |
433 | 8a7ddc38 | bellard | /* irq handling */
|
434 | 8a7ddc38 | bellard | int64_t next_transition_time; |
435 | 8a7ddc38 | bellard | QEMUTimer *irq_timer; |
436 | 8a7ddc38 | bellard | int irq;
|
437 | 80cabfad | bellard | } PITChannelState; |
438 | 80cabfad | bellard | |
439 | 80cabfad | bellard | extern PITChannelState pit_channels[3]; |
440 | 80cabfad | bellard | |
441 | 8a7ddc38 | bellard | void pit_init(int base, int irq); |
442 | 80cabfad | bellard | void pit_set_gate(PITChannelState *s, int val); |
443 | 8a7ddc38 | bellard | int pit_get_out(PITChannelState *s, int64_t current_time);
|
444 | 80cabfad | bellard | int pit_get_out_edges(PITChannelState *s);
|
445 | 80cabfad | bellard | |
446 | 80cabfad | bellard | /* pc.c */
|
447 | 80cabfad | bellard | void pc_init(int ram_size, int vga_ram_size, int boot_device, |
448 | 80cabfad | bellard | DisplayState *ds, const char **fd_filename, int snapshot, |
449 | 80cabfad | bellard | const char *kernel_filename, const char *kernel_cmdline, |
450 | 80cabfad | bellard | const char *initrd_filename); |
451 | 80cabfad | bellard | |
452 | c4b1fcc0 | bellard | /* monitor.c */
|
453 | c4b1fcc0 | bellard | void monitor_init(void); |
454 | 40c3bac3 | bellard | void term_printf(const char *fmt, ...) __attribute__ ((__format__ (__printf__, 1, 2))); |
455 | c4b1fcc0 | bellard | void term_flush(void); |
456 | c4b1fcc0 | bellard | void term_print_help(void); |
457 | c4b1fcc0 | bellard | |
458 | 8a7ddc38 | bellard | /* gdbstub.c */
|
459 | 8a7ddc38 | bellard | |
460 | 8a7ddc38 | bellard | #define DEFAULT_GDBSTUB_PORT 1234 |
461 | 8a7ddc38 | bellard | |
462 | 8a7ddc38 | bellard | int gdbserver_start(int port); |
463 | 8a7ddc38 | bellard | |
464 | fc01f7e7 | bellard | #endif /* VL_H */ |