root / qemu-char.h @ 2966b390
History | View | Annotate | Download (3.7 kB)
1 | 87ecb68b | pbrook | #ifndef QEMU_CHAR_H
|
---|---|---|---|
2 | 87ecb68b | pbrook | #define QEMU_CHAR_H
|
3 | 87ecb68b | pbrook | |
4 | 376253ec | aliguori | #include "qemu-common.h" |
5 | 72cf2d4f | Blue Swirl | #include "qemu-queue.h" |
6 | 191bc01b | Gerd Hoffmann | #include "qemu-option.h" |
7 | 191bc01b | Gerd Hoffmann | #include "qemu-config.h" |
8 | 376253ec | aliguori | |
9 | 87ecb68b | pbrook | /* character device */
|
10 | 87ecb68b | pbrook | |
11 | 2724b180 | aliguori | #define CHR_EVENT_BREAK 0 /* serial break char */ |
12 | 2724b180 | aliguori | #define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ |
13 | b6b8df56 | Amit Shah | #define CHR_EVENT_OPENED 2 /* new connection established */ |
14 | 2724b180 | aliguori | #define CHR_EVENT_MUX_IN 3 /* mux-focus was set to this terminal */ |
15 | 2724b180 | aliguori | #define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */ |
16 | 793cbfb5 | Amit Shah | #define CHR_EVENT_CLOSED 5 /* connection closed */ |
17 | 87ecb68b | pbrook | |
18 | 87ecb68b | pbrook | |
19 | 87ecb68b | pbrook | #define CHR_IOCTL_SERIAL_SET_PARAMS 1 |
20 | 87ecb68b | pbrook | typedef struct { |
21 | 87ecb68b | pbrook | int speed;
|
22 | 87ecb68b | pbrook | int parity;
|
23 | 87ecb68b | pbrook | int data_bits;
|
24 | 87ecb68b | pbrook | int stop_bits;
|
25 | 87ecb68b | pbrook | } QEMUSerialSetParams; |
26 | 87ecb68b | pbrook | |
27 | 87ecb68b | pbrook | #define CHR_IOCTL_SERIAL_SET_BREAK 2 |
28 | 87ecb68b | pbrook | |
29 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_READ_DATA 3 |
30 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_WRITE_DATA 4 |
31 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_READ_CONTROL 5 |
32 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_WRITE_CONTROL 6 |
33 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_READ_STATUS 7 |
34 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_EPP_READ_ADDR 8 |
35 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_EPP_READ 9 |
36 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 |
37 | 87ecb68b | pbrook | #define CHR_IOCTL_PP_EPP_WRITE 11 |
38 | 563e3c6e | aurel32 | #define CHR_IOCTL_PP_DATA_DIR 12 |
39 | 87ecb68b | pbrook | |
40 | f0664048 | aurel32 | #define CHR_IOCTL_SERIAL_SET_TIOCM 13 |
41 | f0664048 | aurel32 | #define CHR_IOCTL_SERIAL_GET_TIOCM 14 |
42 | 81174dae | aliguori | |
43 | 81174dae | aliguori | #define CHR_TIOCM_CTS 0x020 |
44 | 81174dae | aliguori | #define CHR_TIOCM_CAR 0x040 |
45 | 81174dae | aliguori | #define CHR_TIOCM_DSR 0x100 |
46 | 81174dae | aliguori | #define CHR_TIOCM_RI 0x080 |
47 | 81174dae | aliguori | #define CHR_TIOCM_DTR 0x002 |
48 | 81174dae | aliguori | #define CHR_TIOCM_RTS 0x004 |
49 | 81174dae | aliguori | |
50 | 87ecb68b | pbrook | typedef void IOEventHandler(void *opaque, int event); |
51 | 87ecb68b | pbrook | |
52 | 87ecb68b | pbrook | struct CharDriverState {
|
53 | ceecf1d1 | aurel32 | void (*init)(struct CharDriverState *s); |
54 | 87ecb68b | pbrook | int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); |
55 | 87ecb68b | pbrook | void (*chr_update_read_handler)(struct CharDriverState *s); |
56 | 87ecb68b | pbrook | int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); |
57 | 7d174059 | Mark McLoughlin | int (*get_msgfd)(struct CharDriverState *s); |
58 | 87ecb68b | pbrook | IOEventHandler *chr_event; |
59 | 87ecb68b | pbrook | IOCanRWHandler *chr_can_read; |
60 | 87ecb68b | pbrook | IOReadHandler *chr_read; |
61 | 87ecb68b | pbrook | void *handler_opaque;
|
62 | 87ecb68b | pbrook | void (*chr_send_event)(struct CharDriverState *chr, int event); |
63 | 87ecb68b | pbrook | void (*chr_close)(struct CharDriverState *chr); |
64 | bd9bdce6 | balrog | void (*chr_accept_input)(struct CharDriverState *chr); |
65 | 87ecb68b | pbrook | void *opaque;
|
66 | 87ecb68b | pbrook | QEMUBH *bh; |
67 | 5ccfae10 | aliguori | char *label;
|
68 | 5ccfae10 | aliguori | char *filename;
|
69 | 72cf2d4f | Blue Swirl | QTAILQ_ENTRY(CharDriverState) next; |
70 | 87ecb68b | pbrook | }; |
71 | 87ecb68b | pbrook | |
72 | 191bc01b | Gerd Hoffmann | CharDriverState *qemu_chr_open_opts(QemuOpts *opts, |
73 | 191bc01b | Gerd Hoffmann | void (*init)(struct CharDriverState *s)); |
74 | ceecf1d1 | aurel32 | CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s)); |
75 | 9596ebb7 | pbrook | void qemu_chr_close(CharDriverState *chr);
|
76 | 87ecb68b | pbrook | void qemu_chr_printf(CharDriverState *s, const char *fmt, ...); |
77 | 87ecb68b | pbrook | int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len); |
78 | 87ecb68b | pbrook | void qemu_chr_send_event(CharDriverState *s, int event); |
79 | 87ecb68b | pbrook | void qemu_chr_add_handlers(CharDriverState *s,
|
80 | 87ecb68b | pbrook | IOCanRWHandler *fd_can_read, |
81 | 87ecb68b | pbrook | IOReadHandler *fd_read, |
82 | 87ecb68b | pbrook | IOEventHandler *fd_event, |
83 | 87ecb68b | pbrook | void *opaque);
|
84 | 87ecb68b | pbrook | int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg); |
85 | 87ecb68b | pbrook | void qemu_chr_reset(CharDriverState *s);
|
86 | 2970a6c9 | aliguori | void qemu_chr_initial_reset(void); |
87 | 87ecb68b | pbrook | int qemu_chr_can_read(CharDriverState *s);
|
88 | 87ecb68b | pbrook | void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len); |
89 | 7d174059 | Mark McLoughlin | int qemu_chr_get_msgfd(CharDriverState *s);
|
90 | bd9bdce6 | balrog | void qemu_chr_accept_input(CharDriverState *s);
|
91 | 376253ec | aliguori | void qemu_chr_info(Monitor *mon);
|
92 | c845f401 | Gerd Hoffmann | CharDriverState *qemu_chr_find(const char *name); |
93 | 87ecb68b | pbrook | |
94 | 0e82f34d | aliguori | extern int term_escape_char; |
95 | 0e82f34d | aliguori | |
96 | 87ecb68b | pbrook | /* async I/O support */
|
97 | 87ecb68b | pbrook | |
98 | 87ecb68b | pbrook | int qemu_set_fd_handler2(int fd, |
99 | 87ecb68b | pbrook | IOCanRWHandler *fd_read_poll, |
100 | 87ecb68b | pbrook | IOHandler *fd_read, |
101 | 87ecb68b | pbrook | IOHandler *fd_write, |
102 | 87ecb68b | pbrook | void *opaque);
|
103 | 87ecb68b | pbrook | int qemu_set_fd_handler(int fd, |
104 | 87ecb68b | pbrook | IOHandler *fd_read, |
105 | 87ecb68b | pbrook | IOHandler *fd_write, |
106 | 87ecb68b | pbrook | void *opaque);
|
107 | 87ecb68b | pbrook | |
108 | 87ecb68b | pbrook | #endif |