diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-03-14 21:44:30 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2004-03-14 21:44:30 +0000 |
commit | c4b1fcc0f9594cae64d5bf172548a522db0c2545 (patch) | |
tree | 35c0e88cabbb961b444541387e2a2734297643ed /vl.h | |
parent | 0f35920cd8d323f77d553d18e1f4edd7e761aebf (diff) |
added I/O API - io port API change - added multiple network interface support - redirect serial port to a pseudo terminal if using graphical mode
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@663 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.h')
-rw-r--r-- | vl.h | 100 |
1 files changed, 75 insertions, 25 deletions
@@ -31,16 +31,16 @@ extern int reset_requested; 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); @@ -49,10 +49,37 @@ extern const char *bios_dir; 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); @@ -62,6 +89,27 @@ void bdrv_get_geometry(BlockDriverState *bs, int64_t *nb_sectors_ptr); 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) @@ -97,9 +145,8 @@ 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 { @@ -138,20 +185,13 @@ void SB16_init (void); #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); + BlockDriverState **fds); +int fdctrl_get_drive_type(int drive_num); /* ne2000.c */ -#define MAX_ETH_FRAME_SIZE 1514 - -void ne2000_init(int base, int irq); -int ne2000_can_receive(void); -void ne2000_receive(uint8_t *buf, int size); - -extern int net_fd; +void ne2000_init(int base, int irq, NetDriverState *nd); /* pckbd.c */ @@ -179,10 +219,14 @@ void rtc_timer(void); /* 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 */ @@ -206,7 +250,7 @@ typedef struct PITChannelState { 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); @@ -217,4 +261,10 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device, 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 */ |