Merge tag 'v9.0.0-rc3'
[qemu/ar7.git] / include / hw / block / swim.h
blob5f567e8d59579b54b76080eb56fad95f0d12f6e5
1 /*
2 * QEMU Macintosh floppy disk controller emulator (SWIM)
4 * Copyright (c) 2014-2018 Laurent Vivier <laurent@vivier.eu>
6 * This work is licensed under the terms of the GNU GPL, version 2. See
7 * the COPYING file in the top-level directory.
9 */
11 #ifndef SWIM_H
12 #define SWIM_H
14 #include "hw/block/block.h"
15 #include "hw/sysbus.h"
16 #include "qom/object.h"
18 #define SWIM_MAX_FD 2
20 typedef struct SWIMCtrl SWIMCtrl;
22 #define TYPE_SWIM_DRIVE "swim-drive"
23 OBJECT_DECLARE_SIMPLE_TYPE(SWIMDrive, SWIM_DRIVE)
25 struct SWIMDrive {
26 DeviceState qdev;
27 int32_t unit;
28 BlockConf conf;
31 #define TYPE_SWIM_BUS "swim-bus"
32 OBJECT_DECLARE_SIMPLE_TYPE(SWIMBus, SWIM_BUS)
34 struct SWIMBus {
35 BusState bus;
36 struct SWIMCtrl *ctrl;
39 typedef struct FDrive {
40 SWIMCtrl *swimctrl;
41 BlockBackend *blk;
42 BlockConf *conf;
43 } FDrive;
45 struct SWIMCtrl {
46 MemoryRegion swim;
47 MemoryRegion iwm;
48 MemoryRegion ism;
49 FDrive drives[SWIM_MAX_FD];
50 int mode;
51 /* IWM mode */
52 int iwm_switch;
53 uint8_t iwm_latches;
54 uint8_t iwmregs[8];
55 /* SWIM mode */
56 uint8_t ismregs[16];
57 uint8_t swim_phase;
58 uint8_t swim_mode;
59 uint8_t swim_status;
60 uint8_t pram[16];
61 uint8_t pram_idx;
62 SWIMBus bus;
65 #define TYPE_SWIM "swim"
66 OBJECT_DECLARE_SIMPLE_TYPE(Swim, SWIM)
68 struct Swim {
69 SysBusDevice parent_obj;
70 SWIMCtrl ctrl;
72 #endif