updated floppy driver: formatting code, disk geometry auto detect (Jocelyn Mayer)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@671 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2004-03-19 23:05:34 +00:00
parent bc51c5c989
commit baca51faff
3 changed files with 945 additions and 546 deletions

1475
hw/fdc.c

File diff suppressed because it is too large Load Diff

View File

@ -57,6 +57,7 @@
int speaker_data_on; int speaker_data_on;
int dummy_refresh_clock; int dummy_refresh_clock;
static fdctrl_t *floppy_controller;
static void ioport80_write(void *opaque, uint32_t addr, uint32_t data) static void ioport80_write(void *opaque, uint32_t addr, uint32_t data)
{ {
@ -106,8 +107,8 @@ static void cmos_init(int ram_size, int boot_device)
/* floppy type */ /* floppy type */
fd0 = fdctrl_get_drive_type(0); fd0 = fdctrl_get_drive_type(floppy_controller, 0);
fd1 = fdctrl_get_drive_type(1); fd1 = fdctrl_get_drive_type(floppy_controller, 1);
s->cmos_data[0x10] = 0; s->cmos_data[0x10] = 0;
switch (fd0) { switch (fd0) {
@ -370,7 +371,7 @@ void pc_init(int ram_size, int vga_ram_size, int boot_device,
DMA_init(); DMA_init();
SB16_init(); SB16_init();
fdctrl_init(6, 2, 0, 0x3f0, fd_table); floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table);
cmos_init(ram_size, boot_device); cmos_init(ram_size, boot_device);
} }

9
vl.h
View File

@ -186,9 +186,12 @@ void SB16_init (void);
#define MAX_FD 2 #define MAX_FD 2
extern BlockDriverState *fd_table[MAX_FD]; extern BlockDriverState *fd_table[MAX_FD];
void fdctrl_init (int irq_lvl, int dma_chann, int mem_mapped, uint32_t base, typedef struct fdctrl_t fdctrl_t;
BlockDriverState **fds);
int fdctrl_get_drive_type(int drive_num); 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);
/* ne2000.c */ /* ne2000.c */