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