# fdc.h

Go to the documentation of this file.

    00001 /*****************************************************************************************
    00002  Copyright (c) 2002-2004 The UbixOS Project
    00003  All rights reserved.
    00004
    00005  Redistribution and use in source and binary forms, with or without modification, are
    00006  permitted provided that the following conditions are met:
    00007
    00008  Redistributions of source code must retain the above copyright notice, this list of
    00009  conditions, the following disclaimer and the list of authors.  Redistributions in binary
    00010  form must reproduce the above copyright notice, this list of conditions, the following
    00011  disclaimer and the list of authors in the documentation and/or other materials provided
    00012  with the distribution. Neither the name of the UbixOS Project nor the names of its
    00013  contributors may be used to endorse or promote products derived from this software
    00014  without specific prior written permission.
    00015
    00016  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    00017  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
    00018  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    00019  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    00020  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    00021  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    00022  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    00023  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    00024  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    00025
    00026  $Id: fdc_8h-source.html 88 2016-01-12 00:11:29Z reddawg $
    00027
    00028 *****************************************************************************************/
    00029
    00030 #ifndef _FDC_H
    00031 #define _FDC_H
    00032
    00033 #include <ubixos/types.h>
    00034
    00035 typedef struct DrvGeom {
    00036    Int8 heads;
    00037    Int8 tracks;
    00038    Int8 spt;
    00039 } drvGeom;
    00040
    00041
    00042 #define fdcMsr  (0x3f4)
    00043 #define fdcData (0x3f5)
    00044 #define fdcDir  (0x3f7)
    00045 #define fdcCcr  (0x3f7)
    00046 #define fdcDor  (0x3f2)
    00047 #define fdcDrs  (0x3f4)
    00048
    00049 #define cmdWrite   (0xc5)
    00050 #define cmdRead    (0xe6)
    00051 #define cmdSeek    (0x0f)
    00052 #define cmdSensei  (0x08)
    00053 #define cmdRecal   (0x07)
    00054 #define cmdSpecify (0x03)
    00055
    00056 #define dg144Heads  2     /* heads per drive (1.44M) */
    00057 #define dg144Tracks 80
    00058 #define dg144Spt    18
    00059 #define dg144Gap3rw 0x1b
    00060 #define dg168Gap3rw 0x1c
    00061
    00062
    00063
    00064 int fdc_init();
    00065 void floppyIsr();
    00066 void floppyIsrhndlr();
    00067 void sendByte(int Int8);
    00068 int getByte();
    00069 bool fdcRw(int block,Int8 *blockBuffer,bool read,unsigned long numSectors);
    00070 void block2Hts(int block,int *head,int *track,int *sector);
    00071 void motorOn(void);
    00072 void motorOff(void);
    00073 bool seek(int track);
    00074 bool waitFdc(bool sensei);
    00075 int getByte();
    00076 void sendByte(int Int8);
    00077 void recalibrate(void);
    00078 void reset(void);
    00079 bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
    00080 bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
    00081 void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount);
    00082 void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount);
    00083
    00084 #endif
    00085
    00086 /***
    00087  $Log: fdc_8h-source.html,v $
    00087  Revision 1.7  2006/12/15 17:47:05  reddawg
    00087  Updates
    00087
    00088  Revision 1.1.1.1  2006/06/01 12:46:14  reddawg
    00089  ubix2
    00090
    00091  Revision 1.2  2005/10/12 00:13:36  reddawg
    00092  Removed
    00093
    00094  Revision 1.1.1.1  2005/09/26 17:23:39  reddawg
    00095  no message
    00096
    00097  Revision 1.6  2004/07/17 02:38:31  reddawg
    00098  Fixed a few problems
    00099
    00100  Revision 1.5  2004/07/14 12:42:46  reddawg
    00101  fdc: fdcInit to fdc_init
    00102  Changed Startup Routines
    00103
    00104  Revision 1.4  2004/05/21 14:57:16  reddawg
    00105  Cleaned up
    00106
    00107  END
    00108  ***/