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
29 #define MAX_DEVICE_NAME 255
30 #define MAX_ARC_PATH_LEN 255
31 #define MAX_DRIVES_PER_CONTROLLER 4
32 #define MAX_CONTROLLERS 4
34 /* MS doesn't prototype this but the w2k kernel exports it */
35 int _cdecl
swprintf(const WCHAR
*, ...);
37 /* need ioctls in ddk build mode */
40 struct _CONTROLLER_INFO
;
42 typedef struct _DRIVE_INFO
44 struct _CONTROLLER_INFO
*ControllerInfo
;
45 UCHAR UnitNumber
; /* 0,1,2,3 */
46 LARGE_INTEGER MotorStartTime
;
47 PDEVICE_OBJECT DeviceObject
;
48 CM_FLOPPY_DEVICE_DATA FloppyDeviceData
;
49 DISK_GEOMETRY DiskGeometry
;
50 UCHAR BytesPerSectorCode
;
51 WCHAR SymLinkBuffer
[MAX_DEVICE_NAME
];
52 WCHAR ArcPathBuffer
[MAX_ARC_PATH_LEN
];
53 ULONG DiskChangeCount
;
55 } DRIVE_INFO
, *PDRIVE_INFO
;
57 typedef struct _CONTROLLER_INFO
61 ULONG ControllerNumber
;
62 INTERFACE_TYPE InterfaceType
;
68 KINTERRUPT_MODE InterruptMode
;
72 PVOID MapRegisterBase
;
76 PKINTERRUPT InterruptObject
;
77 PADAPTER_OBJECT AdapterObject
;
80 DRIVE_INFO DriveInfo
[MAX_DRIVES_PER_CONTROLLER
];
81 PDRIVE_INFO CurrentDrive
;
83 KEVENT MotorStoppedEvent
;
86 BOOLEAN StopDpcQueued
;
87 } CONTROLLER_INFO
, *PCONTROLLER_INFO
;
90 DriverEntry(PDRIVER_OBJECT DriverObject
, PUNICODE_STRING RegistryPath
);
93 SignalMediaChanged(PDEVICE_OBJECT DeviceObject
, PIRP Irp
);
96 WaitForControllerInterrupt(PCONTROLLER_INFO ControllerInfo
);
99 ResetChangeFlag(PDRIVE_INFO DriveInfo
);
102 StartMotor(PDRIVE_INFO DriveInfo
);
105 StopMotor(PCONTROLLER_INFO ControllerInfo
);
110 * This table was found at http://www.nondot.org/sabre/os/files/Disk/FloppyMediaIDs.txt.
111 * Thanks to raster@indirect.com for this information.
113 * Format Size Cyls Heads Sec/Trk FATs Sec/FAT Sec/Root Media
114 * 160K 5 1/4 40 1 8 2 ? ? FE
115 * 180K 5 1/4 40 1 9 2 ? 4 FC
116 * 320K 5 1/4 40 2 8 2 ? ? FF
117 * 360K 5 1/4 40 2 9 2 4 7 FD
118 * 1.2M 5 1/4 80 2 15 2 14 14 F9
119 * 720K 3 1/2 80 2 9 2 6 7 F9
120 * 1.44M 3 1/2 80 2 18 2 18 14 F0
123 #define GEOMETRY_144_MEDIATYPE F3_1Pt44_512
124 #define GEOMETRY_144_CYLINDERS 80
125 #define GEOMETRY_144_TRACKSPERCYLINDER 2
126 #define GEOMETRY_144_SECTORSPERTRACK 18
127 #define GEOMETRY_144_BYTESPERSECTOR 512