fdc.h

00001 /**************************************************************************************
00002  Copyright (c) 2002 The UbixOS Project
00003  All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
00006 
00007 Redistributions of source code must retain the above copyright notice, this list of conditions, the following disclaimer and the list of authors.
00008 Redistributions in binary form must reproduce the above copyright notice, this list of conditions, the following disclaimer and the list of authors
00009 in the documentation and/or other materials provided with the distribution. Neither the name of the UbixOS Project nor the names of its
00010 contributors may be used to endorse or promote products derived from this software without specific prior written permission.
00011 
00012 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
00013 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00014 PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00015 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00016 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00017 OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00018 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00019 
00020  $Id$
00021 
00022 **************************************************************************************/
00023 
00024 #ifndef _FDC_H
00025 #define _FDC_H
00026 
00027 #include <ubixos/types.h>
00028 
00029 typedef struct DrvGeom {
00030    byte heads;
00031    byte tracks;
00032    byte spt;
00033 } drvGeom;
00034 
00035 
00036 #define fdcMsr  (0x3f4)
00037 #define fdcData (0x3f5)
00038 #define fdcDir  (0x3f7)
00039 #define fdcCcr  (0x3f7)
00040 #define fdcDor  (0x3f2)
00041 #define fdcDrs  (0x3f4)
00042 
00043 #define cmdWrite   (0xc5)
00044 #define cmdRead    (0xe6)
00045 #define cmdSeek    (0x0f)
00046 #define cmdSensei  (0x08)
00047 #define cmdRecal   (0x07)
00048 #define cmdSpecify (0x03)
00049 
00050 #define dg144Heads  2     /* heads per drive (1.44M) */
00051 #define dg144Tracks 80
00052 #define dg144Spt    18
00053 #define dg144Gap3rw 0x1b
00054 #define dg168Gap3rw 0x1c
00055 
00056 
00057 
00058 void fdcInit();
00059 void floppyIsr();
00060 void floppyIsrhndlr();
00061 void sendByte(int byte);
00062 int getByte();
00063 bool fdcRw(int block,byte *blockBuffer,bool read,unsigned long numSectors);
00064 void block2Hts(int block,int *head,int *track,int *sector);
00065 void motorOn(void);
00066 void motorOff(void);
00067 bool seek(int track);
00068 bool waitFdc(bool sensei);
00069 int getByte();
00070 void sendByte(int byte);
00071 void recalibrate(void);
00072 void reset(void);
00073 bool writeBlock(int block,byte *blockBuffer, unsigned long numSectors);
00074 bool readBlock(int block,byte *blockBuffer, unsigned long numSectors);
00075 void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount);
00076 void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount);
00077 
00078 #endif
00079 

Generated on Wed Apr 28 17:49:34 2004 for Ubixos by doxygen 1.3.3