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