extern int64_t ticks_per_sec;
extern int pit_min_timer_count;
-typedef void (IOPortWriteFunc)(struct CPUState *env, uint32_t address, uint32_t data);
-typedef uint32_t (IOPortReadFunc)(struct CPUState *env, uint32_t address);
+typedef void (IOPortWriteFunc)(void *opaque, uint32_t address, uint32_t data);
+typedef uint32_t (IOPortReadFunc)(void *opaque, uint32_t address);
-int register_ioport_read(int start, int length, IOPortReadFunc *func, int size);
-int register_ioport_write(int start, int length, IOPortWriteFunc *func, int size);
+int register_ioport_read(int start, int length, int size,
+ IOPortReadFunc *func, void *opaque);
+int register_ioport_write(int start, int length, int size,
+ IOPortWriteFunc *func, void *opaque);
int64_t cpu_get_ticks(void);
uint64_t muldiv64(uint64_t a, uint32_t b, uint32_t c);
-void net_send_packet(int net_fd, const uint8_t *buf, int size);
-
void hw_error(const char *fmt, ...);
int load_image(const char *filename, uint8_t *addr);
void pstrcpy(char *buf, int buf_size, const char *str);
char *pstrcat(char *buf, int buf_size, const char *s);
+int serial_open_device(void);
+
+/* network redirectors support */
+
+#define MAX_NICS 8
+
+typedef struct NetDriverState {
+ int fd;
+ uint8_t macaddr[6];
+ char ifname[16];
+} NetDriverState;
+
+extern int nb_nics;
+extern NetDriverState nd_table[MAX_NICS];
+
+void net_send_packet(NetDriverState *nd, const uint8_t *buf, int size);
+
+/* async I/O support */
+
+typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
+typedef int IOCanRWHandler(void *opaque);
+
+int add_fd_read_handler(int fd, IOCanRWHandler *fd_can_read,
+ IOReadHandler *fd_read, void *opaque);
+
/* block.c */
typedef struct BlockDriverState BlockDriverState;
-BlockDriverState *bdrv_open(const char *filename, int snapshot);
+BlockDriverState *bdrv_new(const char *device_name);
+void bdrv_delete(BlockDriverState *bs);
+int bdrv_open(BlockDriverState *bs, const char *filename, int snapshot);
void bdrv_close(BlockDriverState *bs);
int bdrv_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors);
int bdrv_commit(BlockDriverState *bs);
void bdrv_set_boot_sector(BlockDriverState *bs, const uint8_t *data, int size);
+#define BDRV_TYPE_HD 0
+#define BDRV_TYPE_CDROM 1
+#define BDRV_TYPE_FLOPPY 2
+
+void bdrv_set_geometry_hint(BlockDriverState *bs,
+ int cyls, int heads, int secs);
+void bdrv_set_type_hint(BlockDriverState *bs, int type);
+void bdrv_get_geometry_hint(BlockDriverState *bs,
+ int *pcyls, int *pheads, int *psecs);
+int bdrv_get_type_hint(BlockDriverState *bs);
+int bdrv_is_removable(BlockDriverState *bs);
+int bdrv_is_read_only(BlockDriverState *bs);
+int bdrv_is_inserted(BlockDriverState *bs);
+int bdrv_is_locked(BlockDriverState *bs);
+void bdrv_set_locked(BlockDriverState *bs, int locked);
+void bdrv_set_change_cb(BlockDriverState *bs,
+ void (*change_cb)(void *opaque), void *opaque);
+
+void bdrv_info(void);
+BlockDriverState *bdrv_find(const char *name);
+
/* vga.c */
#define VGA_RAM_SIZE (4096 * 1024)
int vga_initialize(DisplayState *ds, uint8_t *vga_ram_base,
unsigned long vga_ram_offset, int vga_ram_size);
void vga_update_display(void);
+void vga_screen_dump(const char *filename);
/* sdl.c */
void sdl_display_init(DisplayState *ds);
extern BlockDriverState *bs_table[MAX_DISKS];
-void ide_init(void);
-void ide_set_geometry(int n, int cyls, int heads, int secs);
-void ide_set_cdrom(int n, int is_cdrom);
+void ide_init(int iobase, int iobase2, int irq,
+ BlockDriverState *hd0, BlockDriverState *hd1);
/* oss.c */
typedef enum {
#define MAX_FD 2
extern BlockDriverState *fd_table[MAX_FD];
-void cmos_register_fd (uint8_t fd0, uint8_t fd1);
-void fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, uint32_t base,
- char boot_device);
-int fdctrl_disk_change (int idx, const unsigned char *filename, int ro);
-
-/* ne2000.c */
+typedef struct fdctrl_t fdctrl_t;
-#define MAX_ETH_FRAME_SIZE 1514
+fdctrl_t *fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped,
+ uint32_t io_base,
+ BlockDriverState **fds);
+int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num);
-void ne2000_init(int base, int irq);
-int ne2000_can_receive(void);
-void ne2000_receive(uint8_t *buf, int size);
+/* ne2000.c */
-extern int net_fd;
+void ne2000_init(int base, int irq, NetDriverState *nd);
/* pckbd.c */
/* serial.c */
-void serial_init(int base, int irq);
-int serial_can_receive(void);
-void serial_receive_byte(int ch);
-void serial_receive_break(void);
+typedef struct SerialState SerialState;
+
+extern SerialState *serial_console;
+
+SerialState *serial_init(int base, int irq, int fd);
+int serial_can_receive(SerialState *s);
+void serial_receive_byte(SerialState *s, int ch);
+void serial_receive_break(SerialState *s);
/* i8259.c */
extern PITChannelState pit_channels[3];
-void pit_init(void);
+void pit_init(int base);
void pit_set_gate(PITChannelState *s, int val);
int pit_get_out(PITChannelState *s);
int pit_get_out_edges(PITChannelState *s);
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename);
+/* monitor.c */
+void monitor_init(void);
+void term_printf(const char *fmt, ...);
+void term_flush(void);
+void term_print_help(void);
+
#endif /* VL_H */