Annotation of qemu/qemu-char.h, revision 1.1.1.8

1.1       root        1: #ifndef QEMU_CHAR_H
                      2: #define QEMU_CHAR_H
                      3: 
1.1.1.4   root        4: #include "qemu-common.h"
1.1.1.5   root        5: #include "qemu-queue.h"
                      6: #include "qemu-option.h"
                      7: #include "qemu-config.h"
                      8: #include "qobject.h"
1.1.1.7   root        9: #include "qstring.h"
1.1.1.4   root       10: 
1.1       root       11: /* character device */
                     12: 
1.1.1.4   root       13: #define CHR_EVENT_BREAK   0 /* serial break char */
                     14: #define CHR_EVENT_FOCUS   1 /* focus to this terminal (modal input needed) */
1.1.1.5   root       15: #define CHR_EVENT_OPENED  2 /* new connection established */
1.1.1.4   root       16: #define CHR_EVENT_MUX_IN  3 /* mux-focus was set to this terminal */
                     17: #define CHR_EVENT_MUX_OUT 4 /* mux-focus will move on */
1.1.1.5   root       18: #define CHR_EVENT_CLOSED  5 /* connection closed */
1.1       root       19: 
                     20: 
                     21: #define CHR_IOCTL_SERIAL_SET_PARAMS   1
                     22: typedef struct {
                     23:     int speed;
                     24:     int parity;
                     25:     int data_bits;
                     26:     int stop_bits;
                     27: } QEMUSerialSetParams;
                     28: 
                     29: #define CHR_IOCTL_SERIAL_SET_BREAK    2
                     30: 
                     31: #define CHR_IOCTL_PP_READ_DATA        3
                     32: #define CHR_IOCTL_PP_WRITE_DATA       4
                     33: #define CHR_IOCTL_PP_READ_CONTROL     5
                     34: #define CHR_IOCTL_PP_WRITE_CONTROL    6
                     35: #define CHR_IOCTL_PP_READ_STATUS      7
                     36: #define CHR_IOCTL_PP_EPP_READ_ADDR    8
                     37: #define CHR_IOCTL_PP_EPP_READ         9
                     38: #define CHR_IOCTL_PP_EPP_WRITE_ADDR  10
                     39: #define CHR_IOCTL_PP_EPP_WRITE       11
1.1.1.2   root       40: #define CHR_IOCTL_PP_DATA_DIR        12
                     41: 
                     42: #define CHR_IOCTL_SERIAL_SET_TIOCM   13
                     43: #define CHR_IOCTL_SERIAL_GET_TIOCM   14
                     44: 
                     45: #define CHR_TIOCM_CTS  0x020
                     46: #define CHR_TIOCM_CAR  0x040
                     47: #define CHR_TIOCM_DSR  0x100
                     48: #define CHR_TIOCM_RI   0x080
                     49: #define CHR_TIOCM_DTR  0x002
                     50: #define CHR_TIOCM_RTS  0x004
1.1       root       51: 
                     52: typedef void IOEventHandler(void *opaque, int event);
                     53: 
                     54: struct CharDriverState {
1.1.1.2   root       55:     void (*init)(struct CharDriverState *s);
1.1       root       56:     int (*chr_write)(struct CharDriverState *s, const uint8_t *buf, int len);
                     57:     void (*chr_update_read_handler)(struct CharDriverState *s);
                     58:     int (*chr_ioctl)(struct CharDriverState *s, int cmd, void *arg);
1.1.1.4   root       59:     int (*get_msgfd)(struct CharDriverState *s);
1.1.1.8 ! root       60:     int (*chr_add_client)(struct CharDriverState *chr, int fd);
1.1       root       61:     IOEventHandler *chr_event;
1.1.1.6   root       62:     IOCanReadHandler *chr_can_read;
1.1       root       63:     IOReadHandler *chr_read;
                     64:     void *handler_opaque;
                     65:     void (*chr_send_event)(struct CharDriverState *chr, int event);
                     66:     void (*chr_close)(struct CharDriverState *chr);
                     67:     void (*chr_accept_input)(struct CharDriverState *chr);
1.1.1.7   root       68:     void (*chr_set_echo)(struct CharDriverState *chr, bool echo);
1.1.1.8 ! root       69:     void (*chr_guest_open)(struct CharDriverState *chr);
        !            70:     void (*chr_guest_close)(struct CharDriverState *chr);
1.1       root       71:     void *opaque;
                     72:     QEMUBH *bh;
1.1.1.2   root       73:     char *label;
                     74:     char *filename;
1.1.1.6   root       75:     int opened;
1.1.1.8 ! root       76:     int avail_connections;
1.1.1.5   root       77:     QTAILQ_ENTRY(CharDriverState) next;
1.1       root       78: };
                     79: 
1.1.1.5   root       80: QemuOpts *qemu_chr_parse_compat(const char *label, const char *filename);
                     81: CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
                     82:                                     void (*init)(struct CharDriverState *s));
1.1.1.2   root       83: CharDriverState *qemu_chr_open(const char *label, const char *filename, void (*init)(struct CharDriverState *s));
1.1.1.7   root       84: void qemu_chr_set_echo(struct CharDriverState *chr, bool echo);
1.1.1.8 ! root       85: void qemu_chr_guest_open(struct CharDriverState *chr);
        !            86: void qemu_chr_guest_close(struct CharDriverState *chr);
1.1       root       87: void qemu_chr_close(CharDriverState *chr);
1.1.1.7   root       88: void qemu_chr_printf(CharDriverState *s, const char *fmt, ...)
                     89:     GCC_FMT_ATTR(2, 3);
1.1       root       90: int qemu_chr_write(CharDriverState *s, const uint8_t *buf, int len);
                     91: void qemu_chr_send_event(CharDriverState *s, int event);
                     92: void qemu_chr_add_handlers(CharDriverState *s,
1.1.1.6   root       93:                            IOCanReadHandler *fd_can_read,
1.1       root       94:                            IOReadHandler *fd_read,
                     95:                            IOEventHandler *fd_event,
                     96:                            void *opaque);
                     97: int qemu_chr_ioctl(CharDriverState *s, int cmd, void *arg);
1.1.1.5   root       98: void qemu_chr_generic_open(CharDriverState *s);
1.1       root       99: int qemu_chr_can_read(CharDriverState *s);
                    100: void qemu_chr_read(CharDriverState *s, uint8_t *buf, int len);
1.1.1.4   root      101: int qemu_chr_get_msgfd(CharDriverState *s);
1.1       root      102: void qemu_chr_accept_input(CharDriverState *s);
1.1.1.8 ! root      103: int qemu_chr_add_client(CharDriverState *s, int fd);
1.1.1.5   root      104: void qemu_chr_info_print(Monitor *mon, const QObject *ret_data);
                    105: void qemu_chr_info(Monitor *mon, QObject **ret_data);
                    106: CharDriverState *qemu_chr_find(const char *name);
1.1.1.2   root      107: 
1.1.1.6   root      108: /* add an eventfd to the qemu devices that are polled */
                    109: CharDriverState *qemu_chr_open_eventfd(int eventfd);
                    110: 
1.1.1.2   root      111: extern int term_escape_char;
1.1       root      112: 
1.1.1.7   root      113: /* memory chardev */
                    114: void qemu_chr_init_mem(CharDriverState *chr);
                    115: void qemu_chr_close_mem(CharDriverState *chr);
                    116: QString *qemu_chr_mem_to_qs(CharDriverState *chr);
                    117: size_t qemu_chr_mem_osize(const CharDriverState *chr);
                    118: 
1.1       root      119: /* async I/O support */
                    120: 
                    121: int qemu_set_fd_handler2(int fd,
1.1.1.6   root      122:                          IOCanReadHandler *fd_read_poll,
1.1       root      123:                          IOHandler *fd_read,
                    124:                          IOHandler *fd_write,
                    125:                          void *opaque);
                    126: int qemu_set_fd_handler(int fd,
                    127:                         IOHandler *fd_read,
                    128:                         IOHandler *fd_write,
                    129:                         void *opaque);
                    130: #endif

unix.superglobalmegacorp.com