root / qemu-char.h @ c2bc0e38
History | View | Annotate | Download (2.6 kB)
1 |
#ifndef QEMU_CHAR_H
|
---|---|
2 |
#define QEMU_CHAR_H
|
3 |
|
4 |
/* character device */
|
5 |
|
6 |
#define CHR_EVENT_BREAK 0 /* serial break char */ |
7 |
#define CHR_EVENT_FOCUS 1 /* focus to this terminal (modal input needed) */ |
8 |
#define CHR_EVENT_RESET 2 /* new connection established */ |
9 |
|
10 |
|
11 |
#define CHR_IOCTL_SERIAL_SET_PARAMS 1 |
12 |
typedef struct { |
13 |
int speed;
|
14 |
int parity;
|
15 |
int data_bits;
|
16 |
int stop_bits;
|
17 |
} QEMUSerialSetParams; |
18 |
|
19 |
#define CHR_IOCTL_SERIAL_SET_BREAK 2 |
20 |
|
21 |
#define CHR_IOCTL_PP_READ_DATA 3 |
22 |
#define CHR_IOCTL_PP_WRITE_DATA 4 |
23 |
#define CHR_IOCTL_PP_READ_CONTROL 5 |
24 |
#define CHR_IOCTL_PP_WRITE_CONTROL 6 |
25 |
#define CHR_IOCTL_PP_READ_STATUS 7 |
26 |
#define CHR_IOCTL_PP_EPP_READ_ADDR 8 |
27 |
#define CHR_IOCTL_PP_EPP_READ 9 |
28 |
#define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 |
29 |
#define CHR_IOCTL_PP_EPP_WRITE 11 |
30 |
|
31 |
typedef void IOEventHandler(void *opaque, int event); |
32 |
|
33 |
struct CharDriverState {
|
34 |
int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len); |
35 |
void (*chr_update_read_handler)(struct CharDriverState *s); |
36 |
int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg); |
37 |
IOEventHandler *chr_event; |
38 |
IOCanRWHandler *chr_can_read; |
39 |
IOReadHandler *chr_read; |
40 |
void *handler_opaque;
|
41 |
void (*chr_send_event)(struct CharDriverState *chr, int event); |
42 |
void (*chr_close)(struct CharDriverState *chr); |
43 |
void (*chr_accept_input)(struct CharDriverState *chr); |
44 |
void *opaque;
|
45 |
int focus;
|
46 |
QEMUBH *bh; |
47 |
}; |
48 |
|
49 |
CharDriverState *qemu_chr_open(const char *filename); |
50 |
void qemu_chr_close(CharDriverState *chr);
|
51 |
void qemu_chr_printf(CharDriverState *s, const char *fmt, ...); |
52 |
int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len); |
53 |
void qemu_chr_send_event(CharDriverState *s, int event); |
54 |
void qemu_chr_add_handlers(CharDriverState *s,
|
55 |
IOCanRWHandler *fd_can_read, |
56 |
IOReadHandler *fd_read, |
57 |
IOEventHandler *fd_event, |
58 |
void *opaque);
|
59 |
int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg); |
60 |
void qemu_chr_reset(CharDriverState *s);
|
61 |
int qemu_chr_can_read(CharDriverState *s);
|
62 |
void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len); |
63 |
void qemu_chr_accept_input(CharDriverState *s);
|
64 |
|
65 |
/* async I/O support */
|
66 |
|
67 |
int qemu_set_fd_handler2(int fd, |
68 |
IOCanRWHandler *fd_read_poll, |
69 |
IOHandler *fd_read, |
70 |
IOHandler *fd_write, |
71 |
void *opaque);
|
72 |
int qemu_set_fd_handler(int fd, |
73 |
IOHandler *fd_read, |
74 |
IOHandler *fd_write, |
75 |
void *opaque);
|
76 |
|
77 |
#endif
|