swim.h (1413B)
1/* 2 * QEMU Macintosh floppy disk controller emulator (SWIM) 3 * 4 * Copyright (c) 2014-2018 Laurent Vivier <laurent@vivier.eu> 5 * 6 * This work is licensed under the terms of the GNU GPL, version 2. See 7 * the COPYING file in the top-level directory. 8 * 9 */ 10 11#ifndef SWIM_H 12#define SWIM_H 13 14#include "hw/sysbus.h" 15#include "qom/object.h" 16 17#define SWIM_MAX_FD 2 18 19typedef struct SWIMCtrl SWIMCtrl; 20 21#define TYPE_SWIM_DRIVE "swim-drive" 22OBJECT_DECLARE_SIMPLE_TYPE(SWIMDrive, SWIM_DRIVE) 23 24struct SWIMDrive { 25 DeviceState qdev; 26 int32_t unit; 27 BlockConf conf; 28}; 29 30#define TYPE_SWIM_BUS "swim-bus" 31OBJECT_DECLARE_SIMPLE_TYPE(SWIMBus, SWIM_BUS) 32 33struct SWIMBus { 34 BusState bus; 35 struct SWIMCtrl *ctrl; 36}; 37 38typedef struct FDrive { 39 SWIMCtrl *swimctrl; 40 BlockBackend *blk; 41 BlockConf *conf; 42} FDrive; 43 44struct SWIMCtrl { 45 MemoryRegion iomem; 46 FDrive drives[SWIM_MAX_FD]; 47 int mode; 48 /* IWM mode */ 49 int iwm_switch; 50 uint16_t regs[8]; 51#define IWM_PH0 0 52#define IWM_PH1 1 53#define IWM_PH2 2 54#define IWM_PH3 3 55#define IWM_MTR 4 56#define IWM_DRIVE 5 57#define IWM_Q6 6 58#define IWM_Q7 7 59 uint8_t iwm_data; 60 uint8_t iwm_mode; 61 /* SWIM mode */ 62 uint8_t swim_phase; 63 uint8_t swim_mode; 64 SWIMBus bus; 65}; 66 67#define TYPE_SWIM "swim" 68OBJECT_DECLARE_SIMPLE_TYPE(Swim, SWIM) 69 70struct Swim { 71 SysBusDevice parent_obj; 72 SWIMCtrl ctrl; 73}; 74#endif