iwmreg.h revision 1.1 1 /* $Id: iwmreg.h,v 1.1 1999/02/18 07:38:26 scottr Exp $ */
2
3 /*
4 * Copyright (c) 1996-98 Hauke Fath. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28 #ifndef _MAC68K_IWMREG_H
29 #define _MAC68K_IWMREG_H
30
31 /*
32 * iwmreg.h -- Interface declarations for iwm.
33 */
34
35 /*
36 * Configuration
37 */
38 int iwmInit(void);
39
40 /* Virtual Drive flags register */
41 enum dFlags {
42 IWM_DS_DISK = 0x01,
43 IWM_NO_DISK = 0x02,
44 IWM_MOTOR_OFF = 0x04,
45 IWM_WRITEABLE = 0x08,
46 IWM_DD_DISK = 0x10,
47 IWM_NO_DRIVE = 0x80000000
48 };
49 int iwmCheckDrive(int drive);
50
51 /*
52 * Access
53 */
54 enum dErrors {
55 noDriveErr = -64, /* Drive not installed */
56 offLinErr = -65, /* R/W requested for an offline drive */
57 noNybErr = -66, /* Disk is probably blank */
58 noAdrMkErr = -67, /* Can't find an address mark */
59 dataVerErr = -68, /* Read verify compare failed */
60 badCkSmErr = -69, /* Bad address mark checksum */
61 badBtSlpErr = -70, /* Bad address mark (no lead-out) */
62 noDtaMkErr = -71, /* Could not find a data mark */
63 badDCkSum = -72, /* Bad data mark checksum */
64 badDBtSlp = -73, /* One of the data mark bit slip */
65 /* nibbles was incorrect. */
66 wrUnderRun = -74, /* Could not write fast enough to */
67 /* keep up with the IWM */
68 cantStepErr = -75, /* Step handshake failed during seek */
69 tk0BadErr = -76, /* Track 00 sensor does not change */
70 /* during head calibration */
71 initIWMErr = -77, /* Unable to initialize IWM */
72 twoSideErr = -78, /* Tried to access a double-sided disk */
73 /* on a single-sided drive (400K drive) */
74 spAdjErr = -79, /* Can't adjust drive speed (400K drive) */
75 seekErr = -80, /* Wrong track number read in a sector's */
76 /* address field */
77 sectNFErr = -81, /* Sector number never found on a track */
78 fmt1Err = -82, /* Can't find sector 0 after track format */
79 fmt2Err = -83, /* Can't get enough sync */
80 verErr = -84 /* Track failed to verify */
81 };
82 typedef enum dErrors dErrors_t;
83
84 /*
85 * This is byte-aligned (just in case anyone's interested...)
86 */
87 struct sectorHdr {
88 u_int8_t side;
89 u_int8_t track;
90 u_int8_t sector;
91 u_int8_t Tags[13]; /* XXX Looks like it, although IM */
92 /* specifies 12 tag bytes */
93 };
94 typedef struct sectorHdr sectorHdr_t;
95
96 int iwmSelectDrive __P((int drive));
97 int iwmSelectSide __P((int side));
98 int iwmTrack00 __P((void));
99 int iwmSeek __P((int steps));
100
101 int iwmReadSector __P((caddr_t buf, sectorHdr_t *hdr));
102 int iwmWriteSector __P((caddr_t buf, sectorHdr_t *hdr));
103
104 int iwmDiskEject __P((int drive)); /* drive = [0..1] */
105 int iwmMotor __P((int drive, int onOff)); /* on(1)/off(0) */
106
107 /*
108 * Debugging only
109 */
110 int iwmQueryDrvFlag __P((int drive, int reg)); /* reg = [0..15] */
111
112 /* Make sure we run at splhigh when calling! */
113 int iwmReadSectHdr __P((sectorHdr_t *hdr));
114
115 int iwmReadRawSector __P((int ID, caddr_t buf));
116 int iwmWriteRawSector __P((int ID, caddr_t buf));
117 int iwmReadRawTrack __P((int mode, caddr_t buf));
118
119 #endif /* _MAC68K_IWMREG_H */
120