tests: Fixes test-io-channel-file by mask only owner file state mask bits
[qemu/ar7.git] / include / hw / block / swim.h
blob8287da7c30d1d5a9d22adf6de896cd93d2e60315
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 "qemu/osdep.h"
15 #include "hw/sysbus.h"
16 #include "qom/object.h"
18 #define SWIM_MAX_FD 2
20 typedef struct SWIMDrive SWIMDrive;
21 typedef struct SWIMBus SWIMBus;
22 typedef struct SWIMCtrl SWIMCtrl;
24 #define TYPE_SWIM_DRIVE "swim-drive"
25 DECLARE_INSTANCE_CHECKER(SWIMDrive, SWIM_DRIVE,
26 TYPE_SWIM_DRIVE)
28 struct SWIMDrive {
29 DeviceState qdev;
30 int32_t unit;
31 BlockConf conf;
34 #define TYPE_SWIM_BUS "swim-bus"
35 DECLARE_INSTANCE_CHECKER(SWIMBus, SWIM_BUS,
36 TYPE_SWIM_BUS)
38 struct SWIMBus {
39 BusState bus;
40 struct SWIMCtrl *ctrl;
43 typedef struct FDrive {
44 SWIMCtrl *swimctrl;
45 BlockBackend *blk;
46 BlockConf *conf;
47 } FDrive;
49 struct SWIMCtrl {
50 MemoryRegion iomem;
51 FDrive drives[SWIM_MAX_FD];
52 int mode;
53 /* IWM mode */
54 int iwm_switch;
55 uint16_t regs[8];
56 #define IWM_PH0 0
57 #define IWM_PH1 1
58 #define IWM_PH2 2
59 #define IWM_PH3 3
60 #define IWM_MTR 4
61 #define IWM_DRIVE 5
62 #define IWM_Q6 6
63 #define IWM_Q7 7
64 uint8_t iwm_data;
65 uint8_t iwm_mode;
66 /* SWIM mode */
67 uint8_t swim_phase;
68 uint8_t swim_mode;
69 SWIMBus bus;
72 #define TYPE_SWIM "swim"
73 typedef struct Swim Swim;
74 DECLARE_INSTANCE_CHECKER(Swim, SWIM,
75 TYPE_SWIM)
77 struct Swim {
78 SysBusDevice parent_obj;
79 SWIMCtrl ctrl;
81 #endif