Revision 5fafdf24 hw/fdc.c
b/hw/fdc.c | ||
---|---|---|
1 | 1 |
/* |
2 | 2 |
* QEMU Floppy disk emulator (Intel 82078) |
3 |
*
|
|
3 |
* |
|
4 | 4 |
* Copyright (c) 2003, 2007 Jocelyn Mayer |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | 7 |
* of this software and associated documentation files (the "Software"), to deal |
8 | 8 |
* in the Software without restriction, including without limitation the rights |
... | ... | |
217 | 217 |
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 9, 40, 0, "180 kB 5\"1/4", }, |
218 | 218 |
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 41, 1, "410 kB 5\"1/4", }, |
219 | 219 |
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 10, 42, 1, "420 kB 5\"1/4", }, |
220 |
/* 320 kB 5"1/4 floppy disks */
|
|
220 |
/* 320 kB 5"1/4 floppy disks */ |
|
221 | 221 |
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 8, 40, 1, "320 kB 5\"1/4", }, |
222 | 222 |
{ FDRIVE_DRV_120, FDRIVE_DISK_288, 8, 40, 0, "160 kB 5\"1/4", }, |
223 | 223 |
/* 360 kB must match 5"1/4 better than 3"1/2... */ |
... | ... | |
467 | 467 |
return fdctrl_read(opaque, (uint32_t)reg); |
468 | 468 |
} |
469 | 469 |
|
470 |
static void fdctrl_write_mem (void *opaque,
|
|
470 |
static void fdctrl_write_mem (void *opaque, |
|
471 | 471 |
target_phys_addr_t reg, uint32_t value) |
472 | 472 |
{ |
473 | 473 |
fdctrl_write(opaque, (uint32_t)reg, value); |
... | ... | |
578 | 578 |
fdctrl_reset(s, 0); |
579 | 579 |
} |
580 | 580 |
|
581 |
fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped,
|
|
581 |
fdctrl_t *fdctrl_init (qemu_irq irq, int dma_chann, int mem_mapped, |
|
582 | 582 |
target_phys_addr_t io_base, |
583 | 583 |
BlockDriverState **fds) |
584 | 584 |
{ |
... | ... | |
590 | 590 |
fdctrl = qemu_mallocz(sizeof(fdctrl_t)); |
591 | 591 |
if (!fdctrl) |
592 | 592 |
return NULL; |
593 |
fdctrl->result_timer = qemu_new_timer(vm_clock,
|
|
593 |
fdctrl->result_timer = qemu_new_timer(vm_clock, |
|
594 | 594 |
fdctrl_result_timer, fdctrl); |
595 | 595 |
|
596 | 596 |
fdctrl->version = 0x90; /* Intel 82078 controller */ |
... | ... | |
842 | 842 |
static int fdctrl_media_changed(fdrive_t *drv) |
843 | 843 |
{ |
844 | 844 |
int ret; |
845 |
if (!drv->bs)
|
|
845 |
if (!drv->bs) |
|
846 | 846 |
return 0; |
847 | 847 |
ret = bdrv_media_changed(drv->bs); |
848 | 848 |
if (ret) { |
... | ... | |
1141 | 1141 |
cur_drv->sect = 1; |
1142 | 1142 |
if (FD_MULTI_TRACK(fdctrl->data_state)) { |
1143 | 1143 |
if (cur_drv->head == 0 && |
1144 |
(cur_drv->flags & FDISK_DBL_SIDES) != 0) {
|
|
1144 |
(cur_drv->flags & FDISK_DBL_SIDES) != 0) { |
|
1145 | 1145 |
cur_drv->head = 1; |
1146 | 1146 |
} else { |
1147 | 1147 |
cur_drv->head = 0; |
... | ... | |
1732 | 1732 |
FLOPPY_DPRINTF("treat READ_ID command\n"); |
1733 | 1733 |
/* XXX: should set main status register to busy */ |
1734 | 1734 |
cur_drv->head = (fdctrl->fifo[1] >> 2) & 1; |
1735 |
qemu_mod_timer(fdctrl->result_timer,
|
|
1735 |
qemu_mod_timer(fdctrl->result_timer, |
|
1736 | 1736 |
qemu_get_clock(vm_clock) + (ticks_per_sec / 50)); |
1737 | 1737 |
break; |
1738 | 1738 |
case 0x4C: |
Also available in: Unified diff