2 * ReactOS Floppy Driver
3 * Copyright (C) 2004, Vizzini (vizzini@plasmic.com)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 * PROJECT: ReactOS Floppy Driver
21 * PURPOSE: Header for Main floppy driver routines
22 * PROGRAMMER: Vizzini (vizzini@plasmic.com)
24 * 15-Feb-2004 vizzini - Created
27 #define MAX_DEVICE_NAME 255
28 #define MAX_ARC_PATH_LEN 255
29 #define MAX_DRIVES_PER_CONTROLLER 4
30 #define MAX_CONTROLLERS 4
32 /* MS doesn't prototype this but the w2k kernel exports it */
33 int _cdecl
swprintf(const WCHAR
*, ...);
35 /* need ioctls in ddk build mode */
38 struct _CONTROLLER_INFO
;
40 typedef struct _DRIVE_INFO
42 struct _CONTROLLER_INFO
*ControllerInfo
;
43 UCHAR UnitNumber
; /* 0,1,2,3 */
44 LARGE_INTEGER MotorStartTime
;
45 PDEVICE_OBJECT DeviceObject
;
46 CM_FLOPPY_DEVICE_DATA FloppyDeviceData
;
47 DISK_GEOMETRY DiskGeometry
;
48 UCHAR BytesPerSectorCode
;
49 WCHAR SymLinkBuffer
[MAX_DEVICE_NAME
];
50 WCHAR ArcPathBuffer
[MAX_ARC_PATH_LEN
];
51 ULONG DiskChangeCount
;
53 } DRIVE_INFO
, *PDRIVE_INFO
;
55 typedef struct _CONTROLLER_INFO
59 ULONG ControllerNumber
;
60 INTERFACE_TYPE InterfaceType
;
66 KINTERRUPT_MODE InterruptMode
;
70 PVOID MapRegisterBase
;
74 PKINTERRUPT InterruptObject
;
75 PADAPTER_OBJECT AdapterObject
;
78 DRIVE_INFO DriveInfo
[MAX_DRIVES_PER_CONTROLLER
];
79 PDRIVE_INFO CurrentDrive
;
81 KEVENT MotorStoppedEvent
;
84 BOOLEAN StopDpcQueued
;
85 } CONTROLLER_INFO
, *PCONTROLLER_INFO
;
88 DriverEntry(PDRIVER_OBJECT DriverObject
, PUNICODE_STRING RegistryPath
);
91 SignalMediaChanged(PDEVICE_OBJECT DeviceObject
, PIRP Irp
);
94 WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo
);
97 ResetChangeFlag(PDRIVE_INFO DriveInfo
);
100 StartMotor(PDRIVE_INFO DriveInfo
);
103 StopMotor(PCONTROLLER_INFO ControllerInfo
);
108 * This table was found at http://www.nondot.org/sabre/os/files/Disk/FloppyMediaIDs.txt.
109 * Thanks to raster@indirect.com for this information.
111 * Format Size Cyls Heads Sec/Trk FATs Sec/FAT Sec/Root Media
112 * 160K 5 1/4 40 1 8 2 ? ? FE
113 * 180K 5 1/4 40 1 9 2 ? 4 FC
114 * 320K 5 1/4 40 2 8 2 ? ? FF
115 * 360K 5 1/4 40 2 9 2 4 7 FD
116 * 1.2M 5 1/4 80 2 15 2 14 14 F9
117 * 720K 3 1/2 80 2 9 2 6 7 F9
118 * 1.44M 3 1/2 80 2 18 2 18 14 F0
121 #define GEOMETRY_144_MEDIATYPE F3_1Pt44_512
122 #define GEOMETRY_144_CYLINDERS 80
123 #define GEOMETRY_144_TRACKSPERCYLINDER 2
124 #define GEOMETRY_144_SECTORSPERTRACK 18
125 #define GEOMETRY_144_BYTESPERSECTOR 512