root / hw / hw.h @ c701b35b
History | View | Annotate | Download (2.8 kB)
1 | 87ecb68b | pbrook | /* Declarations for use by hardware emulation. */
|
---|---|---|---|
2 | 87ecb68b | pbrook | #ifndef QEMU_HW_H
|
3 | 87ecb68b | pbrook | #define QEMU_HW_H
|
4 | 87ecb68b | pbrook | |
5 | 87ecb68b | pbrook | #include "qemu-common.h" |
6 | 87ecb68b | pbrook | #include "irq.h" |
7 | 87ecb68b | pbrook | |
8 | 87ecb68b | pbrook | /* VM Load/Save */
|
9 | 87ecb68b | pbrook | |
10 | 87ecb68b | pbrook | QEMUFile *qemu_fopen(const char *filename, const char *mode); |
11 | 87ecb68b | pbrook | void qemu_fflush(QEMUFile *f);
|
12 | 87ecb68b | pbrook | void qemu_fclose(QEMUFile *f);
|
13 | 87ecb68b | pbrook | void qemu_put_buffer(QEMUFile *f, const uint8_t *buf, int size); |
14 | 87ecb68b | pbrook | void qemu_put_byte(QEMUFile *f, int v); |
15 | 87ecb68b | pbrook | void qemu_put_be16(QEMUFile *f, unsigned int v); |
16 | 87ecb68b | pbrook | void qemu_put_be32(QEMUFile *f, unsigned int v); |
17 | 87ecb68b | pbrook | void qemu_put_be64(QEMUFile *f, uint64_t v);
|
18 | 87ecb68b | pbrook | int qemu_get_buffer(QEMUFile *f, uint8_t *buf, int size); |
19 | 87ecb68b | pbrook | int qemu_get_byte(QEMUFile *f);
|
20 | 87ecb68b | pbrook | unsigned int qemu_get_be16(QEMUFile *f); |
21 | 87ecb68b | pbrook | unsigned int qemu_get_be32(QEMUFile *f); |
22 | 87ecb68b | pbrook | uint64_t qemu_get_be64(QEMUFile *f); |
23 | 87ecb68b | pbrook | |
24 | 87ecb68b | pbrook | static inline void qemu_put_be64s(QEMUFile *f, const uint64_t *pv) |
25 | 87ecb68b | pbrook | { |
26 | 87ecb68b | pbrook | qemu_put_be64(f, *pv); |
27 | 87ecb68b | pbrook | } |
28 | 87ecb68b | pbrook | |
29 | 87ecb68b | pbrook | static inline void qemu_put_be32s(QEMUFile *f, const uint32_t *pv) |
30 | 87ecb68b | pbrook | { |
31 | 87ecb68b | pbrook | qemu_put_be32(f, *pv); |
32 | 87ecb68b | pbrook | } |
33 | 87ecb68b | pbrook | |
34 | 87ecb68b | pbrook | static inline void qemu_put_be16s(QEMUFile *f, const uint16_t *pv) |
35 | 87ecb68b | pbrook | { |
36 | 87ecb68b | pbrook | qemu_put_be16(f, *pv); |
37 | 87ecb68b | pbrook | } |
38 | 87ecb68b | pbrook | |
39 | 87ecb68b | pbrook | static inline void qemu_put_8s(QEMUFile *f, const uint8_t *pv) |
40 | 87ecb68b | pbrook | { |
41 | 87ecb68b | pbrook | qemu_put_byte(f, *pv); |
42 | 87ecb68b | pbrook | } |
43 | 87ecb68b | pbrook | |
44 | 87ecb68b | pbrook | static inline void qemu_get_be64s(QEMUFile *f, uint64_t *pv) |
45 | 87ecb68b | pbrook | { |
46 | 87ecb68b | pbrook | *pv = qemu_get_be64(f); |
47 | 87ecb68b | pbrook | } |
48 | 87ecb68b | pbrook | |
49 | 87ecb68b | pbrook | static inline void qemu_get_be32s(QEMUFile *f, uint32_t *pv) |
50 | 87ecb68b | pbrook | { |
51 | 87ecb68b | pbrook | *pv = qemu_get_be32(f); |
52 | 87ecb68b | pbrook | } |
53 | 87ecb68b | pbrook | |
54 | 87ecb68b | pbrook | static inline void qemu_get_be16s(QEMUFile *f, uint16_t *pv) |
55 | 87ecb68b | pbrook | { |
56 | 87ecb68b | pbrook | *pv = qemu_get_be16(f); |
57 | 87ecb68b | pbrook | } |
58 | 87ecb68b | pbrook | |
59 | 87ecb68b | pbrook | static inline void qemu_get_8s(QEMUFile *f, uint8_t *pv) |
60 | 87ecb68b | pbrook | { |
61 | 87ecb68b | pbrook | *pv = qemu_get_byte(f); |
62 | 87ecb68b | pbrook | } |
63 | 87ecb68b | pbrook | |
64 | 87ecb68b | pbrook | #ifdef NEED_CPU_H
|
65 | 87ecb68b | pbrook | #if TARGET_LONG_BITS == 64 |
66 | 87ecb68b | pbrook | #define qemu_put_betl qemu_put_be64
|
67 | 87ecb68b | pbrook | #define qemu_get_betl qemu_get_be64
|
68 | 87ecb68b | pbrook | #define qemu_put_betls qemu_put_be64s
|
69 | 87ecb68b | pbrook | #define qemu_get_betls qemu_get_be64s
|
70 | 87ecb68b | pbrook | #else
|
71 | 87ecb68b | pbrook | #define qemu_put_betl qemu_put_be32
|
72 | 87ecb68b | pbrook | #define qemu_get_betl qemu_get_be32
|
73 | 87ecb68b | pbrook | #define qemu_put_betls qemu_put_be32s
|
74 | 87ecb68b | pbrook | #define qemu_get_betls qemu_get_be32s
|
75 | 87ecb68b | pbrook | #endif
|
76 | 87ecb68b | pbrook | #endif
|
77 | 87ecb68b | pbrook | |
78 | 87ecb68b | pbrook | int64_t qemu_ftell(QEMUFile *f); |
79 | 87ecb68b | pbrook | int64_t qemu_fseek(QEMUFile *f, int64_t pos, int whence);
|
80 | 87ecb68b | pbrook | |
81 | 87ecb68b | pbrook | typedef void SaveStateHandler(QEMUFile *f, void *opaque); |
82 | 87ecb68b | pbrook | typedef int LoadStateHandler(QEMUFile *f, void *opaque, int version_id); |
83 | 87ecb68b | pbrook | |
84 | 87ecb68b | pbrook | int register_savevm(const char *idstr, |
85 | 87ecb68b | pbrook | int instance_id,
|
86 | 87ecb68b | pbrook | int version_id,
|
87 | 87ecb68b | pbrook | SaveStateHandler *save_state, |
88 | 87ecb68b | pbrook | LoadStateHandler *load_state, |
89 | 87ecb68b | pbrook | void *opaque);
|
90 | 87ecb68b | pbrook | |
91 | 87ecb68b | pbrook | typedef void QEMUResetHandler(void *opaque); |
92 | 87ecb68b | pbrook | |
93 | 87ecb68b | pbrook | void qemu_register_reset(QEMUResetHandler *func, void *opaque); |
94 | 87ecb68b | pbrook | |
95 | 0ecdffbb | aurel32 | /* handler to set the boot_device for a specific type of QEMUMachine */
|
96 | 0ecdffbb | aurel32 | /* return 0 if success */
|
97 | 3b4366de | blueswir1 | typedef int QEMUBootSetHandler(void *opaque, const char *boot_device); |
98 | 3b4366de | blueswir1 | void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque); |
99 | 0ecdffbb | aurel32 | |
100 | 87ecb68b | pbrook | /* These should really be in isa.h, but are here to make pc.h happy. */
|
101 | 87ecb68b | pbrook | typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data); |
102 | 87ecb68b | pbrook | typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address); |
103 | 87ecb68b | pbrook | |
104 | 87ecb68b | pbrook | #endif |