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