UbixOS V2  2.0
fdc.h
Go to the documentation of this file.
1 /*****************************************************************************************
2  Copyright (c) 2002-2004 The UbixOS Project
3  All rights reserved.
4 
5  Redistribution and use in source and binary forms, with or without modification, are
6  permitted provided that the following conditions are met:
7 
8  Redistributions of source code must retain the above copyright notice, this list of
9  conditions, the following disclaimer and the list of authors. Redistributions in binary
10  form must reproduce the above copyright notice, this list of conditions, the following
11  disclaimer and the list of authors in the documentation and/or other materials provided
12  with the distribution. Neither the name of the UbixOS Project nor the names of its
13  contributors may be used to endorse or promote products derived from this software
14  without specific prior written permission.
15 
16  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
17  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19  THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21  OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26  $Id: fdc.h 79 2016-01-11 16:21:27Z reddawg $
27 
28 *****************************************************************************************/
29 
30 #ifndef _FDC_H
31 #define _FDC_H
32 
33 #include <sys/types.h>
34 
35 typedef struct DrvGeom {
36  Int8 heads;
37  Int8 tracks;
38  Int8 spt;
39 } drvGeom;
40 
41 
42 #define fdcMsr (0x3f4)
43 #define fdcData (0x3f5)
44 #define fdcDir (0x3f7)
45 #define fdcCcr (0x3f7)
46 #define fdcDor (0x3f2)
47 #define fdcDrs (0x3f4)
48 
49 #define cmdWrite (0xc5)
50 #define cmdRead (0xe6)
51 #define cmdSeek (0x0f)
52 #define cmdSensei (0x08)
53 #define cmdRecal (0x07)
54 #define cmdSpecify (0x03)
55 
56 #define dg144Heads 2 /* heads per drive (1.44M) */
57 #define dg144Tracks 80
58 #define dg144Spt 18
59 #define dg144Gap3rw 0x1b
60 #define dg168Gap3rw 0x1c
61 
62 
63 
64 int fdc_init();
65 void floppyIsr();
66 void floppyIsrhndlr();
67 void sendByte(int Int8);
68 int getByte();
69 bool fdcRw(int block,unsigned char *blockBuffer,bool read,unsigned long numSectors);
70 void block2Hts(int block,int *head,int *track,int *sector);
71 void motorOn(void);
72 void motorOff(void);
73 bool seek(int track);
74 bool waitFdc(bool sensei);
75 int getByte();
76 void sendByte(int Int8);
77 void recalibrate(void);
78 void reset(void);
79 bool writeBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
80 bool readBlock(int block,Int8 *blockBuffer, unsigned long numSectors);
81 void fdcWrite(void *info,void *,uInt32 startSector,uInt32 sectorCount);
82 void fdcRead(void *info,void *,uInt32 startSector,uInt32 sectorCount);
83 
84 #endif
85 
86 /***
87  $Log: fdc.h,v $
88  Revision 1.1.1.1 2006/06/01 12:46:14 reddawg
89  ubix2
90 
91  Revision 1.2 2005/10/12 00:13:36 reddawg
92  Removed
93 
94  Revision 1.1.1.1 2005/09/26 17:23:39 reddawg
95  no message
96 
97  Revision 1.6 2004/07/17 02:38:31 reddawg
98  Fixed a few problems
99 
100  Revision 1.5 2004/07/14 12:42:46 reddawg
101  fdc: fdcInit to fdc_init
102  Changed Startup Routines
103 
104  Revision 1.4 2004/05/21 14:57:16 reddawg
105  Cleaned up
106 
107  END
108  ***/
floppyIsr
void floppyIsr()
getByte
int getByte()
Definition: fdc.c:114
uInt32
unsigned long int uInt32
Definition: objgfx30.h:49
Int8
signed char Int8
Definition: objgfx30.h:43
fdcWrite
void fdcWrite(void *info, void *, uInt32 startSector, uInt32 sectorCount)
Definition: fdc.c:309
motorOn
void motorOn(void)
Definition: fdc.c:206
waitFdc
bool waitFdc(bool sensei)
Definition: fdc.c:255
DrvGeom::tracks
Int8 tracks
Definition: fdc.h:62
types.h
fdcRw
bool fdcRw(int block, unsigned char *blockBuffer, bool read, unsigned long numSectors)
Definition: fdc.c:127
motorOff
void motorOff(void)
Definition: fdc.c:213
writeBlock
bool writeBlock(int block, Int8 *blockBuffer, unsigned long numSectors)
Definition: fdc.c:251
recalibrate
void recalibrate(void)
Definition: fdc.c:280
floppyIsrhndlr
void floppyIsrhndlr()
Definition: fdc.c:96
DrvGeom::spt
Int8 spt
Definition: fdc.h:63
DrvGeom
Definition: fdc.h:34
DrvGeom::heads
Int8 heads
Definition: fdc.h:61
block2Hts
void block2Hts(int block, int *head, int *track, int *sector)
Definition: fdc.c:200
fdc_init
int fdc_init()
Definition: fdc.c:61
reset
void reset(void)
Definition: fdc.c:288
read
int read(struct thread *td, struct read_args *uap)
Definition: gen_calls.c:100
drvGeom
struct DrvGeom drvGeom
seek
bool seek(int track)
Definition: fdc.c:221
readBlock
bool readBlock(int block, Int8 *blockBuffer, unsigned long numSectors)
Definition: fdc.c:240
fdcRead
void fdcRead(void *info, void *, uInt32 startSector, uInt32 sectorCount)
Definition: fdc.c:303
sendByte
void sendByte(int Int8)
Definition: fdc.c:101