summaryrefslogtreecommitdiff
path: root/hw/fdc.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/fdc.c')
-rw-r--r--hw/fdc.c346
1 files changed, 173 insertions, 173 deletions
diff --git a/hw/fdc.c b/hw/fdc.c
index 389d9e6a0..1580d3d86 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -61,43 +61,43 @@
#define FD_RESET_SENSEI_COUNT 4 /* Number of sense interrupts on RESET */
/* Floppy disk drive emulation */
-typedef enum fdisk_type_t {
+typedef enum fdisk_type {
FDRIVE_DISK_288 = 0x01, /* 2.88 MB disk */
FDRIVE_DISK_144 = 0x02, /* 1.44 MB disk */
FDRIVE_DISK_720 = 0x03, /* 720 kB disk */
FDRIVE_DISK_USER = 0x04, /* User defined geometry */
FDRIVE_DISK_NONE = 0x05, /* No disk */
-} fdisk_type_t;
+} e_fdisk_type;
-typedef enum fdrive_type_t {
+typedef enum fdrive_type {
FDRIVE_DRV_144 = 0x00, /* 1.44 MB 3"5 drive */
FDRIVE_DRV_288 = 0x01, /* 2.88 MB 3"5 drive */
FDRIVE_DRV_120 = 0x02, /* 1.2 MB 5"25 drive */
FDRIVE_DRV_NONE = 0x03, /* No drive connected */
-} fdrive_type_t;
+} e_fdrive_type;
-typedef enum fdisk_flags_t {
+typedef enum fdisk_flags {
FDISK_DBL_SIDES = 0x01,
-} fdisk_flags_t;
+} e_fdisk_flags;
-typedef struct fdrive_t {
+typedef struct fdrive {
BlockDriverState *bs;
/* Drive status */
- fdrive_type_t drive;
+ e_fdrive_type drive;
uint8_t perpendicular; /* 2.88 MB access mode */
/* Position */
uint8_t head;
uint8_t track;
uint8_t sect;
/* Media */
- fdisk_flags_t flags;
+ e_fdisk_flags flags;
uint8_t last_sect; /* Nb sector per track */
uint8_t max_track; /* Nb of tracks */
uint16_t bps; /* Bytes per sector */
uint8_t ro; /* Is read-only */
-} fdrive_t;
+} a_fdrive;
-static void fd_init (fdrive_t *drv, BlockDriverState *bs)
+static void fd_init (a_fdrive *drv, BlockDriverState *bs)
{
/* Drive */
drv->bs = bs;
@@ -115,7 +115,7 @@ static int _fd_sector (uint8_t head, uint8_t track,
}
/* Returns current position, in sectors, for given drive */
-static int fd_sector (fdrive_t *drv)
+static int fd_sector (a_fdrive *drv)
{
return _fd_sector(drv->head, drv->track, drv->sect, drv->last_sect);
}
@@ -127,7 +127,7 @@ static int fd_sector (fdrive_t *drv)
* returns 3 if sector is invalid
* returns 4 if seek is disabled
*/
-static int fd_seek (fdrive_t *drv, uint8_t head, uint8_t track, uint8_t sect,
+static int fd_seek (a_fdrive *drv, uint8_t head, uint8_t track, uint8_t sect,
int enable_seek)
{
uint32_t sector;
@@ -169,7 +169,7 @@ static int fd_seek (fdrive_t *drv, uint8_t head, uint8_t track, uint8_t sect,
}
/* Set drive back to track 0 */
-static void fd_recalibrate (fdrive_t *drv)
+static void fd_recalibrate (a_fdrive *drv)
{
FLOPPY_DPRINTF("recalibrate\n");
drv->head = 0;
@@ -178,16 +178,16 @@ static void fd_recalibrate (fdrive_t *drv)
}
/* Recognize floppy formats */
-typedef struct fd_format_t {
- fdrive_type_t drive;
- fdisk_type_t disk;
+typedef struct fd_format {
+ e_fdrive_type drive;
+ e_fdisk_type disk;
uint8_t last_sect;
uint8_t max_track;
uint8_t max_head;
const char *str;
-} fd_format_t;
+} a_fd_format;
-static const fd_format_t fd_formats[] = {
+static const a_fd_format fd_formats[] = {
/* First entry is default format */
/* 1.44 MB 3"1/2 floppy disks */
{ FDRIVE_DRV_144, FDRIVE_DISK_144, 18, 80, 1, "1.44 MB 3\"1/2", },
@@ -235,9 +235,9 @@ static const fd_format_t fd_formats[] = {
};
/* Revalidate a disk drive after a disk change */
-static void fd_revalidate (fdrive_t *drv)
+static void fd_revalidate (a_fdrive *drv)
{
- const fd_format_t *parse;
+ const a_fd_format *parse;
uint64_t nb_sectors, size;
int i, first_match, match;
int nb_heads, max_track, last_sect, ro;
@@ -302,23 +302,23 @@ static void fd_revalidate (fdrive_t *drv)
/********************************************************/
/* Intel 82078 floppy disk controller emulation */
-static void fdctrl_reset (fdctrl_t *fdctrl, int do_irq);
-static void fdctrl_reset_fifo (fdctrl_t *fdctrl);
+static void fdctrl_reset (a_fdctrl *fdctrl, int do_irq);
+static void fdctrl_reset_fifo (a_fdctrl *fdctrl);
static int fdctrl_transfer_handler (void *opaque, int nchan,
- int dma_pos, int dma_len);
-static void fdctrl_raise_irq (fdctrl_t *fdctrl, uint8_t status0);
-
-static uint32_t fdctrl_read_statusA (fdctrl_t *fdctrl);
-static uint32_t fdctrl_read_statusB (fdctrl_t *fdctrl);
-static uint32_t fdctrl_read_dor (fdctrl_t *fdctrl);
-static void fdctrl_write_dor (fdctrl_t *fdctrl, uint32_t value);
-static uint32_t fdctrl_read_tape (fdctrl_t *fdctrl);
-static void fdctrl_write_tape (fdctrl_t *fdctrl, uint32_t value);
-static uint32_t fdctrl_read_main_status (fdctrl_t *fdctrl);
-static void fdctrl_write_rate (fdctrl_t *fdctrl, uint32_t value);
-static uint32_t fdctrl_read_data (fdctrl_t *fdctrl);
-static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value);
-static uint32_t fdctrl_read_dir (fdctrl_t *fdctrl);
+ int dma_pos, int dma_len);
+static void fdctrl_raise_irq (a_fdctrl *fdctrl, uint8_t status0);
+
+static uint32_t fdctrl_read_statusA (a_fdctrl *fdctrl);
+static uint32_t fdctrl_read_statusB (a_fdctrl *fdctrl);
+static uint32_t fdctrl_read_dor (a_fdctrl *fdctrl);
+static void fdctrl_write_dor (a_fdctrl *fdctrl, uint32_t value);
+static uint32_t fdctrl_read_tape (a_fdctrl *fdctrl);
+static void fdctrl_write_tape (a_fdctrl *fdctrl, uint32_t value);
+static uint32_t fdctrl_read_main_status (a_fdctrl *fdctrl);
+static void fdctrl_write_rate (a_fdctrl *fdctrl, uint32_t value);
+static uint32_t fdctrl_read_data (a_fdctrl *fdctrl);
+static void fdctrl_write_data (a_fdctrl *fdctrl, uint32_t value);
+static uint32_t fdctrl_read_dir (a_fdctrl *fdctrl);
enum {
FD_DIR_WRITE = 0,
@@ -470,7 +470,7 @@ enum {
#define FD_DID_SEEK(state) ((state) & FD_STATE_SEEK)
#define FD_FORMAT_CMD(state) ((state) & FD_STATE_FORMAT)
-struct fdctrl_t {
+struct fdctrl {
/* Controller's identification */
uint8_t version;
/* HW */
@@ -511,23 +511,23 @@ struct fdctrl_t {
int sun4m;
/* Floppy drives */
uint8_t num_floppies;
- fdrive_t drives[MAX_FD];
+ a_fdrive drives[MAX_FD];
int reset_sensei;
};
-typedef struct fdctrl_sysbus_t {
+typedef struct fdctrl_sysbus {
SysBusDevice busdev;
- struct fdctrl_t state;
-} fdctrl_sysbus_t;
+ struct fdctrl state;
+} a_fdctrl_sysbus;
-typedef struct fdctrl_isabus_t {
+typedef struct fdctrl_isabus {
ISADevice busdev;
- struct fdctrl_t state;
-} fdctrl_isabus_t;
+ struct fdctrl state;
+} a_fdctrl_isabus;
static uint32_t fdctrl_read (void *opaque, uint32_t reg)
{
- fdctrl_t *fdctrl = opaque;
+ a_fdctrl *fdctrl = opaque;
uint32_t retval;
switch (reg) {
@@ -563,7 +563,7 @@ static uint32_t fdctrl_read (void *opaque, uint32_t reg)
static void fdctrl_write (void *opaque, uint32_t reg, uint32_t value)
{
- fdctrl_t *fdctrl = opaque;
+ a_fdctrl *fdctrl = opaque;
FLOPPY_DPRINTF("write reg%d: 0x%02x\n", reg & 7, value);
@@ -595,13 +595,13 @@ static void fdctrl_write_port (void *opaque, uint32_t reg, uint32_t value)
fdctrl_write(opaque, reg & 7, value);
}
-static uint32_t fdctrl_read_mem (void *opaque, target_phys_addr_t reg)
+static uint32_t fdctrl_read_mem (void *opaque, a_target_phys_addr reg)
{
return fdctrl_read(opaque, (uint32_t)reg);
}
static void fdctrl_write_mem (void *opaque,
- target_phys_addr_t reg, uint32_t value)
+ a_target_phys_addr reg, uint32_t value)
{
fdctrl_write(opaque, (uint32_t)reg, value);
}
@@ -636,23 +636,23 @@ static const VMStateDescription vmstate_fdrive = {
.minimum_version_id = 1,
.minimum_version_id_old = 1,
.fields = (VMStateField []) {
- VMSTATE_UINT8(head, fdrive_t),
- VMSTATE_UINT8(track, fdrive_t),
- VMSTATE_UINT8(sect, fdrive_t),
+ VMSTATE_UINT8(head, a_fdrive),
+ VMSTATE_UINT8(track, a_fdrive),
+ VMSTATE_UINT8(sect, a_fdrive),
VMSTATE_END_OF_LIST()
}
};
static void fdc_pre_save(const void *opaque)
{
- fdctrl_t *s = (void *)opaque;
+ a_fdctrl *s = (void *)opaque;
s->dor_vmstate = s->dor | GET_CUR_DRV(s);
}
static int fdc_post_load(void *opaque)
{
- fdctrl_t *s = opaque;
+ a_fdctrl *s = opaque;
SET_CUR_DRV(s, s->dor_vmstate & FD_DOR_SELMASK);
s->dor = s->dor_vmstate & ~FD_DOR_SELMASK;
@@ -668,46 +668,46 @@ static const VMStateDescription vmstate_fdc = {
.post_load = fdc_post_load,
.fields = (VMStateField []) {
/* Controller State */
- VMSTATE_UINT8(sra, fdctrl_t),
- VMSTATE_UINT8(srb, fdctrl_t),
- VMSTATE_UINT8(dor_vmstate, fdctrl_t),
- VMSTATE_UINT8(tdr, fdctrl_t),
- VMSTATE_UINT8(dsr, fdctrl_t),
- VMSTATE_UINT8(msr, fdctrl_t),
- VMSTATE_UINT8(status0, fdctrl_t),
- VMSTATE_UINT8(status1, fdctrl_t),
- VMSTATE_UINT8(status2, fdctrl_t),
+ VMSTATE_UINT8(sra, a_fdctrl),
+ VMSTATE_UINT8(srb, a_fdctrl),
+ VMSTATE_UINT8(dor_vmstate, a_fdctrl),
+ VMSTATE_UINT8(tdr, a_fdctrl),
+ VMSTATE_UINT8(dsr, a_fdctrl),
+ VMSTATE_UINT8(msr, a_fdctrl),
+ VMSTATE_UINT8(status0, a_fdctrl),
+ VMSTATE_UINT8(status1, a_fdctrl),
+ VMSTATE_UINT8(status2, a_fdctrl),
/* Command FIFO */
- VMSTATE_VARRAY(fifo, fdctrl_t, fifo_size, 0, vmstate_info_uint8, uint8),
- VMSTATE_UINT32(data_pos, fdctrl_t),
- VMSTATE_UINT32(data_len, fdctrl_t),
- VMSTATE_UINT8(data_state, fdctrl_t),
- VMSTATE_UINT8(data_dir, fdctrl_t),
- VMSTATE_UINT8(eot, fdctrl_t),
+ VMSTATE_VARRAY(fifo, a_fdctrl, fifo_size, 0, vmstate_info_uint8, uint8),
+ VMSTATE_UINT32(data_pos, a_fdctrl),
+ VMSTATE_UINT32(data_len, a_fdctrl),
+ VMSTATE_UINT8(data_state, a_fdctrl),
+ VMSTATE_UINT8(data_dir, a_fdctrl),
+ VMSTATE_UINT8(eot, a_fdctrl),
/* States kept only to be returned back */
- VMSTATE_UINT8(timer0, fdctrl_t),
- VMSTATE_UINT8(timer1, fdctrl_t),
- VMSTATE_UINT8(precomp_trk, fdctrl_t),
- VMSTATE_UINT8(config, fdctrl_t),
- VMSTATE_UINT8(lock, fdctrl_t),
- VMSTATE_UINT8(pwrd, fdctrl_t),
- VMSTATE_UINT8_EQUAL(num_floppies, fdctrl_t),
- VMSTATE_STRUCT_ARRAY(drives, fdctrl_t, MAX_FD, 1,
- vmstate_fdrive, fdrive_t),
+ VMSTATE_UINT8(timer0, a_fdctrl),
+ VMSTATE_UINT8(timer1, a_fdctrl),
+ VMSTATE_UINT8(precomp_trk, a_fdctrl),
+ VMSTATE_UINT8(config, a_fdctrl),
+ VMSTATE_UINT8(lock, a_fdctrl),
+ VMSTATE_UINT8(pwrd, a_fdctrl),
+ VMSTATE_UINT8_EQUAL(num_floppies, a_fdctrl),
+ VMSTATE_STRUCT_ARRAY(drives, a_fdctrl, MAX_FD, 1,
+ vmstate_fdrive, a_fdrive),
VMSTATE_END_OF_LIST()
}
};
static void fdctrl_external_reset(void *opaque)
{
- fdctrl_t *s = opaque;
+ a_fdctrl *s = opaque;
fdctrl_reset(s, 0);
}
static void fdctrl_handle_tc(void *opaque, int irq, int level)
{
- //fdctrl_t *s = opaque;
+ //a_fdctrl *s = opaque;
if (level) {
// XXX
@@ -716,13 +716,13 @@ static void fdctrl_handle_tc(void *opaque, int irq, int level)
}
/* XXX: may change if moved to bdrv */
-int fdctrl_get_drive_type(fdctrl_t *fdctrl, int drive_num)
+int fdctrl_get_drive_type(a_fdctrl *fdctrl, int drive_num)
{
return fdctrl->drives[drive_num].drive;
}
/* Change IRQ state */
-static void fdctrl_reset_irq (fdctrl_t *fdctrl)
+static void fdctrl_reset_irq (a_fdctrl *fdctrl)
{
if (!(fdctrl->sra & FD_SRA_INTPEND))
return;
@@ -731,7 +731,7 @@ static void fdctrl_reset_irq (fdctrl_t *fdctrl)
fdctrl->sra &= ~FD_SRA_INTPEND;
}
-static void fdctrl_raise_irq (fdctrl_t *fdctrl, uint8_t status0)
+static void fdctrl_raise_irq (a_fdctrl *fdctrl, uint8_t status0)
{
/* Sparc mutation */
if (fdctrl->sun4m && (fdctrl->msr & FD_MSR_CMDBUSY)) {
@@ -751,7 +751,7 @@ static void fdctrl_raise_irq (fdctrl_t *fdctrl, uint8_t status0)
}
/* Reset controller */
-static void fdctrl_reset (fdctrl_t *fdctrl, int do_irq)
+static void fdctrl_reset (a_fdctrl *fdctrl, int do_irq)
{
int i;
@@ -780,12 +780,12 @@ static void fdctrl_reset (fdctrl_t *fdctrl, int do_irq)
}
}
-static inline fdrive_t *drv0 (fdctrl_t *fdctrl)
+static inline a_fdrive *drv0 (a_fdctrl *fdctrl)
{
return &fdctrl->drives[(fdctrl->tdr & FD_TDR_BOOTSEL) >> 2];
}
-static inline fdrive_t *drv1 (fdctrl_t *fdctrl)
+static inline a_fdrive *drv1 (a_fdctrl *fdctrl)
{
if ((fdctrl->tdr & FD_TDR_BOOTSEL) < (1 << 2))
return &fdctrl->drives[1];
@@ -794,7 +794,7 @@ static inline fdrive_t *drv1 (fdctrl_t *fdctrl)
}
#if MAX_FD == 4
-static inline fdrive_t *drv2 (fdctrl_t *fdctrl)
+static inline a_fdrive *drv2 (a_fdctrl *fdctrl)
{
if ((fdctrl->tdr & FD_TDR_BOOTSEL) < (2 << 2))
return &fdctrl->drives[2];
@@ -802,7 +802,7 @@ static inline fdrive_t *drv2 (fdctrl_t *fdctrl)
return &fdctrl->drives[1];
}
-static inline fdrive_t *drv3 (fdctrl_t *fdctrl)
+static inline a_fdrive *drv3 (a_fdctrl *fdctrl)
{
if ((fdctrl->tdr & FD_TDR_BOOTSEL) < (3 << 2))
return &fdctrl->drives[3];
@@ -811,7 +811,7 @@ static inline fdrive_t *drv3 (fdctrl_t *fdctrl)
}
#endif
-static fdrive_t *get_cur_drv (fdctrl_t *fdctrl)
+static a_fdrive *get_cur_drv (a_fdctrl *fdctrl)
{
switch (fdctrl->cur_drv) {
case 0: return drv0(fdctrl);
@@ -825,7 +825,7 @@ static fdrive_t *get_cur_drv (fdctrl_t *fdctrl)
}
/* Status A register : 0x00 (read-only) */
-static uint32_t fdctrl_read_statusA (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_statusA (a_fdctrl *fdctrl)
{
uint32_t retval = fdctrl->sra;
@@ -835,7 +835,7 @@ static uint32_t fdctrl_read_statusA (fdctrl_t *fdctrl)
}
/* Status B register : 0x01 (read-only) */
-static uint32_t fdctrl_read_statusB (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_statusB (a_fdctrl *fdctrl)
{
uint32_t retval = fdctrl->srb;
@@ -845,7 +845,7 @@ static uint32_t fdctrl_read_statusB (fdctrl_t *fdctrl)
}
/* Digital output register : 0x02 */
-static uint32_t fdctrl_read_dor (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_dor (a_fdctrl *fdctrl)
{
uint32_t retval = fdctrl->dor;
@@ -856,7 +856,7 @@ static uint32_t fdctrl_read_dor (fdctrl_t *fdctrl)
return retval;
}
-static void fdctrl_write_dor (fdctrl_t *fdctrl, uint32_t value)
+static void fdctrl_write_dor (a_fdctrl *fdctrl, uint32_t value)
{
FLOPPY_DPRINTF("digital output register set to 0x%02x\n", value);
@@ -895,7 +895,7 @@ static void fdctrl_write_dor (fdctrl_t *fdctrl, uint32_t value)
}
/* Tape drive register : 0x03 */
-static uint32_t fdctrl_read_tape (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_tape (a_fdctrl *fdctrl)
{
uint32_t retval = fdctrl->tdr;
@@ -904,7 +904,7 @@ static uint32_t fdctrl_read_tape (fdctrl_t *fdctrl)
return retval;
}
-static void fdctrl_write_tape (fdctrl_t *fdctrl, uint32_t value)
+static void fdctrl_write_tape (a_fdctrl *fdctrl, uint32_t value)
{
/* Reset mode */
if (!(fdctrl->dor & FD_DOR_nRESET)) {
@@ -918,7 +918,7 @@ static void fdctrl_write_tape (fdctrl_t *fdctrl, uint32_t value)
}
/* Main status register : 0x04 (read) */
-static uint32_t fdctrl_read_main_status (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_main_status (a_fdctrl *fdctrl)
{
uint32_t retval = fdctrl->msr;
@@ -931,7 +931,7 @@ static uint32_t fdctrl_read_main_status (fdctrl_t *fdctrl)
}
/* Data select rate register : 0x04 (write) */
-static void fdctrl_write_rate (fdctrl_t *fdctrl, uint32_t value)
+static void fdctrl_write_rate (a_fdctrl *fdctrl, uint32_t value)
{
/* Reset mode */
if (!(fdctrl->dor & FD_DOR_nRESET)) {
@@ -951,7 +951,7 @@ static void fdctrl_write_rate (fdctrl_t *fdctrl, uint32_t value)
fdctrl->dsr = value;
}
-static int fdctrl_media_changed(fdrive_t *drv)
+static int fdctrl_media_changed(a_fdrive *drv)
{
int ret;
@@ -965,7 +965,7 @@ static int fdctrl_media_changed(fdrive_t *drv)
}
/* Digital input register : 0x07 (read-only) */
-static uint32_t fdctrl_read_dir (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_dir (a_fdctrl *fdctrl)
{
uint32_t retval = 0;
@@ -984,7 +984,7 @@ static uint32_t fdctrl_read_dir (fdctrl_t *fdctrl)
}
/* FIFO state control */
-static void fdctrl_reset_fifo (fdctrl_t *fdctrl)
+static void fdctrl_reset_fifo (a_fdctrl *fdctrl)
{
fdctrl->data_dir = FD_DIR_WRITE;
fdctrl->data_pos = 0;
@@ -992,7 +992,7 @@ static void fdctrl_reset_fifo (fdctrl_t *fdctrl)
}
/* Set FIFO status for the host to read */
-static void fdctrl_set_fifo (fdctrl_t *fdctrl, int fifo_len, int do_irq)
+static void fdctrl_set_fifo (a_fdctrl *fdctrl, int fifo_len, int do_irq)
{
fdctrl->data_dir = FD_DIR_READ;
fdctrl->data_len = fifo_len;
@@ -1003,7 +1003,7 @@ static void fdctrl_set_fifo (fdctrl_t *fdctrl, int fifo_len, int do_irq)
}
/* Set an error: unimplemented/unknown command */
-static void fdctrl_unimplemented (fdctrl_t *fdctrl, int direction)
+static void fdctrl_unimplemented (a_fdctrl *fdctrl, int direction)
{
FLOPPY_ERROR("unimplemented command 0x%02x\n", fdctrl->fifo[0]);
fdctrl->fifo[0] = FD_SR0_INVCMD;
@@ -1011,7 +1011,7 @@ static void fdctrl_unimplemented (fdctrl_t *fdctrl, int direction)
}
/* Seek to next sector */
-static int fdctrl_seek_to_next_sect (fdctrl_t *fdctrl, fdrive_t *cur_drv)
+static int fdctrl_seek_to_next_sect (a_fdctrl *fdctrl, a_fdrive *cur_drv)
{
FLOPPY_DPRINTF("seek to next sector (%d %02x %02x => %d)\n",
cur_drv->head, cur_drv->track, cur_drv->sect,
@@ -1045,10 +1045,10 @@ static int fdctrl_seek_to_next_sect (fdctrl_t *fdctrl, fdrive_t *cur_drv)
}
/* Callback for transfer end (stop or abort) */
-static void fdctrl_stop_transfer (fdctrl_t *fdctrl, uint8_t status0,
+static void fdctrl_stop_transfer (a_fdctrl *fdctrl, uint8_t status0,
uint8_t status1, uint8_t status2)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
cur_drv = get_cur_drv(fdctrl);
FLOPPY_DPRINTF("transfer status: %02x %02x %02x (%02x)\n",
@@ -1071,9 +1071,9 @@ static void fdctrl_stop_transfer (fdctrl_t *fdctrl, uint8_t status0,
}
/* Prepare a data transfer (either DMA or FIFO) */
-static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction)
+static void fdctrl_start_transfer (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
uint8_t kh, kt, ks;
int did_seek = 0;
@@ -1173,7 +1173,7 @@ static void fdctrl_start_transfer (fdctrl_t *fdctrl, int direction)
}
/* Prepare a transfer of deleted data */
-static void fdctrl_start_transfer_del (fdctrl_t *fdctrl, int direction)
+static void fdctrl_start_transfer_del (a_fdctrl *fdctrl, int direction)
{
FLOPPY_ERROR("fdctrl_start_transfer_del() unimplemented\n");
@@ -1187,8 +1187,8 @@ static void fdctrl_start_transfer_del (fdctrl_t *fdctrl, int direction)
static int fdctrl_transfer_handler (void *opaque, int nchan,
int dma_pos, int dma_len)
{
- fdctrl_t *fdctrl;
- fdrive_t *cur_drv;
+ a_fdctrl *fdctrl;
+ a_fdrive *cur_drv;
int len, start_pos, rel_pos;
uint8_t status0 = 0x00, status1 = 0x00, status2 = 0x00;
@@ -1294,9 +1294,9 @@ static int fdctrl_transfer_handler (void *opaque, int nchan,
}
/* Data register : 0x05 */
-static uint32_t fdctrl_read_data (fdctrl_t *fdctrl)
+static uint32_t fdctrl_read_data (a_fdctrl *fdctrl)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
uint32_t retval = 0;
int pos;
@@ -1342,9 +1342,9 @@ static uint32_t fdctrl_read_data (fdctrl_t *fdctrl)
return retval;
}
-static void fdctrl_format_sector (fdctrl_t *fdctrl)
+static void fdctrl_format_sector (a_fdctrl *fdctrl)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
uint8_t kh, kt, ks;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
@@ -1404,16 +1404,16 @@ static void fdctrl_format_sector (fdctrl_t *fdctrl)
}
}
-static void fdctrl_handle_lock (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_lock (a_fdctrl *fdctrl, int direction)
{
fdctrl->lock = (fdctrl->fifo[0] & 0x80) ? 1 : 0;
fdctrl->fifo[0] = fdctrl->lock << 4;
fdctrl_set_fifo(fdctrl, 1, fdctrl->lock);
}
-static void fdctrl_handle_dumpreg (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_dumpreg (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
/* Drives position */
fdctrl->fifo[0] = drv0(fdctrl)->track;
@@ -1436,22 +1436,22 @@ static void fdctrl_handle_dumpreg (fdctrl_t *fdctrl, int direction)
fdctrl_set_fifo(fdctrl, 10, 0);
}
-static void fdctrl_handle_version (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_version (a_fdctrl *fdctrl, int direction)
{
/* Controller's version */
fdctrl->fifo[0] = fdctrl->version;
fdctrl_set_fifo(fdctrl, 1, 1);
}
-static void fdctrl_handle_partid (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_partid (a_fdctrl *fdctrl, int direction)
{
fdctrl->fifo[0] = 0x41; /* Stepping 1 */
fdctrl_set_fifo(fdctrl, 1, 0);
}
-static void fdctrl_handle_restore (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_restore (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
/* Drives position */
drv0(fdctrl)->track = fdctrl->fifo[3];
@@ -1472,9 +1472,9 @@ static void fdctrl_handle_restore (fdctrl_t *fdctrl, int direction)
fdctrl_reset_fifo(fdctrl);
}
-static void fdctrl_handle_save (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_save (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
fdctrl->fifo[0] = 0;
fdctrl->fifo[1] = 0;
@@ -1502,9 +1502,9 @@ static void fdctrl_handle_save (fdctrl_t *fdctrl, int direction)
fdctrl_set_fifo(fdctrl, 15, 1);
}
-static void fdctrl_handle_readid (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_readid (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
/* XXX: should set main status register to busy */
cur_drv->head = (fdctrl->fifo[1] >> 2) & 1;
@@ -1512,9 +1512,9 @@ static void fdctrl_handle_readid (fdctrl_t *fdctrl, int direction)
qemu_get_clock(vm_clock) + (get_ticks_per_sec() / 50));
}
-static void fdctrl_handle_format_track (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_format_track (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1541,7 +1541,7 @@ static void fdctrl_handle_format_track (fdctrl_t *fdctrl, int direction)
fdctrl_stop_transfer(fdctrl, 0x00, 0x00, 0x00);
}
-static void fdctrl_handle_specify (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_specify (a_fdctrl *fdctrl, int direction)
{
fdctrl->timer0 = (fdctrl->fifo[1] >> 4) & 0xF;
fdctrl->timer1 = fdctrl->fifo[2] >> 1;
@@ -1553,9 +1553,9 @@ static void fdctrl_handle_specify (fdctrl_t *fdctrl, int direction)
fdctrl_reset_fifo(fdctrl);
}
-static void fdctrl_handle_sense_drive_status (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_sense_drive_status (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1569,9 +1569,9 @@ static void fdctrl_handle_sense_drive_status (fdctrl_t *fdctrl, int direction)
fdctrl_set_fifo(fdctrl, 1, 0);
}
-static void fdctrl_handle_recalibrate (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_recalibrate (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1581,9 +1581,9 @@ static void fdctrl_handle_recalibrate (fdctrl_t *fdctrl, int direction)
fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
}
-static void fdctrl_handle_sense_interrupt_status (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_sense_interrupt_status (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
if(fdctrl->reset_sensei > 0) {
fdctrl->fifo[0] =
@@ -1603,9 +1603,9 @@ static void fdctrl_handle_sense_interrupt_status (fdctrl_t *fdctrl, int directio
fdctrl->status0 = FD_SR0_RDYCHG;
}
-static void fdctrl_handle_seek (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_seek (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1619,9 +1619,9 @@ static void fdctrl_handle_seek (fdctrl_t *fdctrl, int direction)
}
}
-static void fdctrl_handle_perpendicular_mode (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_perpendicular_mode (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
if (fdctrl->fifo[1] & 0x80)
cur_drv->perpendicular = fdctrl->fifo[1] & 0x7;
@@ -1629,7 +1629,7 @@ static void fdctrl_handle_perpendicular_mode (fdctrl_t *fdctrl, int direction)
fdctrl_reset_fifo(fdctrl);
}
-static void fdctrl_handle_configure (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_configure (a_fdctrl *fdctrl, int direction)
{
fdctrl->config = fdctrl->fifo[2];
fdctrl->precomp_trk = fdctrl->fifo[3];
@@ -1637,22 +1637,22 @@ static void fdctrl_handle_configure (fdctrl_t *fdctrl, int direction)
fdctrl_reset_fifo(fdctrl);
}
-static void fdctrl_handle_powerdown_mode (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_powerdown_mode (a_fdctrl *fdctrl, int direction)
{
fdctrl->pwrd = fdctrl->fifo[1];
fdctrl->fifo[0] = fdctrl->fifo[1];
fdctrl_set_fifo(fdctrl, 1, 1);
}
-static void fdctrl_handle_option (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_option (a_fdctrl *fdctrl, int direction)
{
/* No result back */
fdctrl_reset_fifo(fdctrl);
}
-static void fdctrl_handle_drive_specification_command (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_drive_specification_command (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
if (fdctrl->fifo[fdctrl->data_pos - 1] & 0x80) {
/* Command parameters done */
@@ -1672,9 +1672,9 @@ static void fdctrl_handle_drive_specification_command (fdctrl_t *fdctrl, int dir
}
}
-static void fdctrl_handle_relative_seek_out (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_relative_seek_out (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1688,9 +1688,9 @@ static void fdctrl_handle_relative_seek_out (fdctrl_t *fdctrl, int direction)
fdctrl_raise_irq(fdctrl, FD_SR0_SEEK);
}
-static void fdctrl_handle_relative_seek_in (fdctrl_t *fdctrl, int direction)
+static void fdctrl_handle_relative_seek_in (a_fdctrl *fdctrl, int direction)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK);
cur_drv = get_cur_drv(fdctrl);
@@ -1709,7 +1709,7 @@ static const struct {
uint8_t mask;
const char* name;
int parameters;
- void (*handler)(fdctrl_t *fdctrl, int direction);
+ void (*handler)(a_fdctrl *fdctrl, int direction);
int direction;
} handlers[] = {
{ FD_CMD_READ, 0x1f, "READ", 8, fdctrl_start_transfer, FD_DIR_READ },
@@ -1748,9 +1748,9 @@ static const struct {
/* Associate command to an index in the 'handlers' array */
static uint8_t command_to_handler[256];
-static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value)
+static void fdctrl_write_data (a_fdctrl *fdctrl, uint32_t value)
{
- fdrive_t *cur_drv;
+ a_fdrive *cur_drv;
int pos;
/* Reset mode */
@@ -1815,8 +1815,8 @@ static void fdctrl_write_data (fdctrl_t *fdctrl, uint32_t value)
static void fdctrl_result_timer(void *opaque)
{
- fdctrl_t *fdctrl = opaque;
- fdrive_t *cur_drv = get_cur_drv(fdctrl);
+ a_fdctrl *fdctrl = opaque;
+ a_fdrive *cur_drv = get_cur_drv(fdctrl);
/* Pretend we are spinning.
* This is needed for Coherent, which uses READ ID to check for
@@ -1829,7 +1829,7 @@ static void fdctrl_result_timer(void *opaque)
}
/* Init functions */
-static void fdctrl_connect_drives(fdctrl_t *fdctrl, BlockDriverState **fds)
+static void fdctrl_connect_drives(a_fdctrl *fdctrl, BlockDriverState **fds)
{
unsigned int i;
@@ -1839,14 +1839,14 @@ static void fdctrl_connect_drives(fdctrl_t *fdctrl, BlockDriverState **fds)
}
}
-fdctrl_t *fdctrl_init_isa(BlockDriverState **fds)
+a_fdctrl *fdctrl_init_isa(BlockDriverState **fds)
{
- fdctrl_t *fdctrl;
+ a_fdctrl *fdctrl;
ISADevice *dev;
int dma_chann = 2;
dev = isa_create_simple("isa-fdc");
- fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
+ fdctrl = &(DO_UPCAST(a_fdctrl_isabus, busdev, dev)->state);
fdctrl->dma_chann = dma_chann;
DMA_register_channel(dma_chann, &fdctrl_transfer_handler, fdctrl);
@@ -1856,17 +1856,17 @@ fdctrl_t *fdctrl_init_isa(BlockDriverState **fds)
return fdctrl;
}
-fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
- target_phys_addr_t mmio_base,
+a_fdctrl *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
+ a_target_phys_addr mmio_base,
BlockDriverState **fds)
{
- fdctrl_t *fdctrl;
+ a_fdctrl *fdctrl;
DeviceState *dev;
- fdctrl_sysbus_t *sys;
+ a_fdctrl_sysbus *sys;
dev = qdev_create(NULL, "sysbus-fdc");
qdev_init(dev);
- sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);
+ sys = DO_UPCAST(a_fdctrl_sysbus, busdev.qdev, dev);
fdctrl = &sys->state;
sysbus_connect_irq(&sys->busdev, 0, irq);
sysbus_mmio_map(&sys->busdev, 0, mmio_base);
@@ -1878,16 +1878,16 @@ fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
return fdctrl;
}
-fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
+a_fdctrl *sun4m_fdctrl_init (qemu_irq irq, a_target_phys_addr io_base,
BlockDriverState **fds, qemu_irq *fdc_tc)
{
DeviceState *dev;
- fdctrl_sysbus_t *sys;
- fdctrl_t *fdctrl;
+ a_fdctrl_sysbus *sys;
+ a_fdctrl *fdctrl;
dev = qdev_create(NULL, "SUNW,fdtwo");
qdev_init(dev);
- sys = DO_UPCAST(fdctrl_sysbus_t, busdev.qdev, dev);
+ sys = DO_UPCAST(a_fdctrl_sysbus, busdev.qdev, dev);
fdctrl = &sys->state;
sysbus_connect_irq(&sys->busdev, 0, irq);
sysbus_mmio_map(&sys->busdev, 0, io_base);
@@ -1900,7 +1900,7 @@ fdctrl_t *sun4m_fdctrl_init (qemu_irq irq, target_phys_addr_t io_base,
return fdctrl;
}
-static int fdctrl_init_common(fdctrl_t *fdctrl)
+static int fdctrl_init_common(a_fdctrl *fdctrl)
{
int i, j;
static int command_tables_inited = 0;
@@ -1935,8 +1935,8 @@ static int fdctrl_init_common(fdctrl_t *fdctrl)
static int isabus_fdc_init1(ISADevice *dev)
{
- fdctrl_isabus_t *isa = DO_UPCAST(fdctrl_isabus_t, busdev, dev);
- fdctrl_t *fdctrl = &isa->state;
+ a_fdctrl_isabus *isa = DO_UPCAST(a_fdctrl_isabus, busdev, dev);
+ a_fdctrl *fdctrl = &isa->state;
int iobase = 0x3f0;
int isairq = 6;
@@ -1955,7 +1955,7 @@ static int isabus_fdc_init1(ISADevice *dev)
static int sysbus_fdc_init1(SysBusDevice *dev)
{
- fdctrl_t *fdctrl = &(FROM_SYSBUS(fdctrl_sysbus_t, dev)->state);
+ a_fdctrl *fdctrl = &(FROM_SYSBUS(a_fdctrl_sysbus, dev)->state);
int io;
io = cpu_register_io_memory(fdctrl_mem_read, fdctrl_mem_write, fdctrl);
@@ -1968,7 +1968,7 @@ static int sysbus_fdc_init1(SysBusDevice *dev)
static int sun4m_fdc_init1(SysBusDevice *dev)
{
- fdctrl_t *fdctrl = &(FROM_SYSBUS(fdctrl_sysbus_t, dev)->state);
+ a_fdctrl *fdctrl = &(FROM_SYSBUS(a_fdctrl_sysbus, dev)->state);
int io;
io = cpu_register_io_memory(fdctrl_mem_read_strict,
@@ -1984,19 +1984,19 @@ static int sun4m_fdc_init1(SysBusDevice *dev)
static ISADeviceInfo isa_fdc_info = {
.init = isabus_fdc_init1,
.qdev.name = "isa-fdc",
- .qdev.size = sizeof(fdctrl_isabus_t),
+ .qdev.size = sizeof(a_fdctrl_isabus),
};
static SysBusDeviceInfo sysbus_fdc_info = {
.init = sysbus_fdc_init1,
.qdev.name = "sysbus-fdc",
- .qdev.size = sizeof(fdctrl_sysbus_t),
+ .qdev.size = sizeof(a_fdctrl_sysbus),
};
static SysBusDeviceInfo sun4m_fdc_info = {
.init = sun4m_fdc_init1,
.qdev.name = "SUNW,fdtwo",
- .qdev.size = sizeof(fdctrl_sysbus_t),
+ .qdev.size = sizeof(a_fdctrl_sysbus),
};
static void fdc_register_devices(void)