root / vl.h @ b67d5959
History | View | Annotate | Download (3.3 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 | 33e3963e | bellard | /* vl.c */
|
28 | 313aa567 | bellard | struct CPUX86State;
|
29 | 313aa567 | bellard | extern int reset_requested; |
30 | 313aa567 | bellard | |
31 | 313aa567 | bellard | typedef void (IOPortWriteFunc)(struct CPUX86State *env, uint32_t address, uint32_t data); |
32 | 313aa567 | bellard | typedef uint32_t (IOPortReadFunc)(struct CPUX86State *env, uint32_t address); |
33 | 313aa567 | bellard | |
34 | 33e3963e | bellard | void *get_mmap_addr(unsigned long size); |
35 | 313aa567 | bellard | int register_ioport_read(int start, int length, IOPortReadFunc *func, int size); |
36 | 313aa567 | bellard | int register_ioport_write(int start, int length, IOPortWriteFunc *func, int size); |
37 | 313aa567 | bellard | |
38 | 313aa567 | bellard | void kbd_put_keycode(int keycode); |
39 | 313aa567 | bellard | |
40 | 313aa567 | bellard | #define MOUSE_EVENT_LBUTTON 0x01 |
41 | 313aa567 | bellard | #define MOUSE_EVENT_RBUTTON 0x02 |
42 | 313aa567 | bellard | #define MOUSE_EVENT_MBUTTON 0x04 |
43 | 313aa567 | bellard | void kbd_mouse_event(int dx, int dy, int dz, int buttons_state); |
44 | 33e3963e | bellard | |
45 | fc01f7e7 | bellard | /* block.c */
|
46 | fc01f7e7 | bellard | typedef struct BlockDriverState BlockDriverState; |
47 | fc01f7e7 | bellard | |
48 | 33e3963e | bellard | BlockDriverState *bdrv_open(const char *filename, int snapshot); |
49 | fc01f7e7 | bellard | void bdrv_close(BlockDriverState *bs);
|
50 | fc01f7e7 | bellard | int bdrv_read(BlockDriverState *bs, int64_t sector_num,
|
51 | fc01f7e7 | bellard | uint8_t *buf, int nb_sectors);
|
52 | fc01f7e7 | bellard | int bdrv_write(BlockDriverState *bs, int64_t sector_num,
|
53 | fc01f7e7 | bellard | const uint8_t *buf, int nb_sectors); |
54 | fc01f7e7 | bellard | void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr);
|
55 | 33e3963e | bellard | int bdrv_commit(BlockDriverState *bs);
|
56 | 33e3963e | bellard | |
57 | 33e3963e | bellard | /* user mode linux compatible COW file */
|
58 | 33e3963e | bellard | #define COW_MAGIC 0x4f4f4f4d /* MOOO */ |
59 | 33e3963e | bellard | #define COW_VERSION 2 |
60 | fc01f7e7 | bellard | |
61 | 33e3963e | bellard | struct cow_header_v2 {
|
62 | 33e3963e | bellard | uint32_t magic; |
63 | 9dfa5b42 | bellard | uint32_t version; |
64 | 33e3963e | bellard | char backing_file[1024]; |
65 | 33e3963e | bellard | int32_t mtime; |
66 | 33e3963e | bellard | uint64_t size; |
67 | 33e3963e | bellard | uint32_t sectorsize; |
68 | 33e3963e | bellard | }; |
69 | fc01f7e7 | bellard | |
70 | 313aa567 | bellard | /* vga.c */
|
71 | 313aa567 | bellard | |
72 | 313aa567 | bellard | #define VGA_RAM_SIZE (8192 * 1024) |
73 | 313aa567 | bellard | |
74 | 313aa567 | bellard | typedef struct DisplayState { |
75 | 313aa567 | bellard | uint8_t *data; |
76 | 313aa567 | bellard | int linesize;
|
77 | 313aa567 | bellard | int depth;
|
78 | 313aa567 | bellard | void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h); |
79 | 313aa567 | bellard | void (*dpy_resize)(struct DisplayState *s, int w, int h); |
80 | 313aa567 | bellard | void (*dpy_refresh)(struct DisplayState *s); |
81 | 313aa567 | bellard | } DisplayState; |
82 | 313aa567 | bellard | |
83 | 313aa567 | bellard | static inline void dpy_update(DisplayState *s, int x, int y, int w, int h) |
84 | 313aa567 | bellard | { |
85 | 313aa567 | bellard | s->dpy_update(s, x, y, w, h); |
86 | 313aa567 | bellard | } |
87 | 313aa567 | bellard | |
88 | 313aa567 | bellard | static inline void dpy_resize(DisplayState *s, int w, int h) |
89 | 313aa567 | bellard | { |
90 | 313aa567 | bellard | s->dpy_resize(s, w, h); |
91 | 313aa567 | bellard | } |
92 | 313aa567 | bellard | |
93 | 313aa567 | bellard | int vga_init(DisplayState *ds, uint8_t *vga_ram_base,
|
94 | 313aa567 | bellard | unsigned long vga_ram_offset, int vga_ram_size); |
95 | 313aa567 | bellard | void vga_update_display(void); |
96 | 313aa567 | bellard | |
97 | 313aa567 | bellard | /* sdl.c */
|
98 | 313aa567 | bellard | void sdl_display_init(DisplayState *ds);
|
99 | 313aa567 | bellard | |
100 | fc01f7e7 | bellard | #endif /* VL_H */ |