main: switch qemu_set_fd_handler to g_io_add_watch
[qemu.git] / rwhandler.h
blobb2a57905484ccfe47e98f27341c83f069b76115b
1 #ifndef READ_WRITE_HANDLER_H
2 #define READ_WRITE_HANDLER_H
4 #include "qemu-common.h"
5 #include "ioport.h"
7 typedef struct ReadWriteHandler ReadWriteHandler;
9 /* len is guaranteed to be one of 1, 2 or 4, addr is guaranteed to fit in an
10 * appropriate type (io/memory/etc). They do not need to be range checked. */
11 typedef void WriteHandlerFunc(ReadWriteHandler *, pcibus_t addr,
12 uint32_t value, int len);
13 typedef uint32_t ReadHandlerFunc(ReadWriteHandler *, pcibus_t addr, int len);
15 struct ReadWriteHandler {
16 WriteHandlerFunc *write;
17 ReadHandlerFunc *read;
20 /* Helpers for when we want to use a single routine with length. */
21 /* CPU memory handler: both read and write must be present. */
22 int cpu_register_io_memory_simple(ReadWriteHandler *, int endian);
23 /* io port handler: can supply only read or write handlers. */
24 int register_ioport_simple(ReadWriteHandler *,
25 pio_addr_t start, int length, int size);
27 #endif