2019-10-26 19:45:44 +03:00
|
|
|
/*
|
|
|
|
* QEMU Macintosh floppy disk controller emulator (SWIM)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014-2018 Laurent Vivier <laurent@vivier.eu>
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2. See
|
|
|
|
* the COPYING file in the top-level directory.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SWIM_H
|
|
|
|
#define SWIM_H
|
|
|
|
|
2022-12-21 16:35:51 +03:00
|
|
|
#include "hw/block/block.h"
|
2019-10-26 19:45:44 +03:00
|
|
|
#include "hw/sysbus.h"
|
2020-09-03 23:43:22 +03:00
|
|
|
#include "qom/object.h"
|
2019-10-26 19:45:44 +03:00
|
|
|
|
|
|
|
#define SWIM_MAX_FD 2
|
|
|
|
|
|
|
|
typedef struct SWIMCtrl SWIMCtrl;
|
|
|
|
|
|
|
|
#define TYPE_SWIM_DRIVE "swim-drive"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(SWIMDrive, SWIM_DRIVE)
|
2019-10-26 19:45:44 +03:00
|
|
|
|
|
|
|
struct SWIMDrive {
|
|
|
|
DeviceState qdev;
|
|
|
|
int32_t unit;
|
|
|
|
BlockConf conf;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TYPE_SWIM_BUS "swim-bus"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(SWIMBus, SWIM_BUS)
|
2019-10-26 19:45:44 +03:00
|
|
|
|
|
|
|
struct SWIMBus {
|
|
|
|
BusState bus;
|
|
|
|
struct SWIMCtrl *ctrl;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct FDrive {
|
|
|
|
SWIMCtrl *swimctrl;
|
|
|
|
BlockBackend *blk;
|
|
|
|
BlockConf *conf;
|
|
|
|
} FDrive;
|
|
|
|
|
|
|
|
struct SWIMCtrl {
|
2023-10-04 11:37:58 +03:00
|
|
|
MemoryRegion swim;
|
|
|
|
MemoryRegion iwm;
|
|
|
|
MemoryRegion ism;
|
2019-10-26 19:45:44 +03:00
|
|
|
FDrive drives[SWIM_MAX_FD];
|
|
|
|
int mode;
|
|
|
|
/* IWM mode */
|
|
|
|
int iwm_switch;
|
2023-10-04 11:37:59 +03:00
|
|
|
uint8_t iwm_latches;
|
|
|
|
uint8_t iwmregs[8];
|
2019-10-26 19:45:44 +03:00
|
|
|
/* SWIM mode */
|
2023-10-04 11:37:58 +03:00
|
|
|
uint8_t ismregs[16];
|
2019-10-26 19:45:44 +03:00
|
|
|
uint8_t swim_phase;
|
|
|
|
uint8_t swim_mode;
|
2023-10-04 11:37:59 +03:00
|
|
|
uint8_t swim_status;
|
|
|
|
uint8_t pram[16];
|
|
|
|
uint8_t pram_idx;
|
2019-10-26 19:45:44 +03:00
|
|
|
SWIMBus bus;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define TYPE_SWIM "swim"
|
2020-09-16 21:25:19 +03:00
|
|
|
OBJECT_DECLARE_SIMPLE_TYPE(Swim, SWIM)
|
2019-10-26 19:45:44 +03:00
|
|
|
|
2020-09-03 23:43:22 +03:00
|
|
|
struct Swim {
|
2019-10-26 19:45:44 +03:00
|
|
|
SysBusDevice parent_obj;
|
|
|
|
SWIMCtrl ctrl;
|
2020-09-03 23:43:22 +03:00
|
|
|
};
|
2019-10-26 19:45:44 +03:00
|
|
|
#endif
|