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