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