iotests/287: Clean up subshell test image
[qemu.git] / include / hw / block / swim.h
blobc1bd5f65557d9e4598035b3e0182ad9e4c08c60c
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/sysbus.h"
15 #include "qom/object.h"
17 #define SWIM_MAX_FD 2
19 typedef struct SWIMCtrl SWIMCtrl;
21 #define TYPE_SWIM_DRIVE "swim-drive"
22 OBJECT_DECLARE_SIMPLE_TYPE(SWIMDrive, SWIM_DRIVE)
24 struct SWIMDrive {
25 DeviceState qdev;
26 int32_t unit;
27 BlockConf conf;
30 #define TYPE_SWIM_BUS "swim-bus"
31 OBJECT_DECLARE_SIMPLE_TYPE(SWIMBus, SWIM_BUS)
33 struct SWIMBus {
34 BusState bus;
35 struct SWIMCtrl *ctrl;
38 typedef struct FDrive {
39 SWIMCtrl *swimctrl;
40 BlockBackend *blk;
41 BlockConf *conf;
42 } FDrive;
44 struct 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;
67 #define TYPE_SWIM "swim"
68 OBJECT_DECLARE_SIMPLE_TYPE(Swim, SWIM)
70 struct Swim {
71 SysBusDevice parent_obj;
72 SWIMCtrl ctrl;
74 #endif