Fixed ZDE build - missing header file
[ZeXOS.git] / kernel / include / fdc.h
blobcbf1abdb57c1e26d408f1e20df67b9969fe9d298
1 /*
2 * ZeX/OS
3 * Copyright (C) 2007 Tomas 'ZeXx86' Jedrzejek (zexx86@zexos.org)
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef FDC_H
21 #define FDC_H
23 #include "mytypes.h"
24 #include <partition.h>
26 /* datatypes */
28 /* drive geometry */
29 typedef struct DrvGeom {
30 char heads;
31 char tracks;
32 char spt; /* sectors per track */
33 } DrvGeom;
35 /* drive geometries */
36 #define DG144_HEADS 2 /* heads per drive (1.44M) */
37 #define DG144_TRACKS 80 /* number of tracks (1.44M) */
38 #define DG144_SPT 18 /* sectors per track (1.44M) */
39 #define DG144_GAP3FMT 0x54 /* gap3 while formatting (1.44M) */
40 #define DG144_GAP3RW 0x1b /* gap3 while reading/writing (1.44M) */
42 #define DG168_HEADS 2 /* heads per drive (1.68M) */
43 #define DG168_TRACKS 80 /* number of tracks (1.68M) */
44 #define DG168_SPT 21 /* sectors per track (1.68M) */
45 #define DG168_GAP3FMT 0x0c /* gap3 while formatting (1.68M) */
46 #define DG168_GAP3RW 0x1c /* gap3 while reading/writing (1.68M) */
48 /* IO ports */
49 #define FDC_DOR (0x3f2) /* Digital Output Register */
50 #define FDC_MSR (0x3f4) /* Main Status Register (input) */
51 #define FDC_DRS (0x3f4) /* Data Rate Select Register (output) */
52 #define FDC_DATA (0x3f5) /* Data Register */
53 #define FDC_DIR (0x3f7) /* Digital Input Register (input) */
54 #define FDC_CCR (0x3f7) /* Configuration Control Register (output) */
56 /* command bytes (these are 765 commands + options such as MFM, etc) */
57 #define CMD_SPECIFY (0x03) /* specify drive timings */
58 #define CMD_WRITE (0xc5) /* write data (+ MT,MFM) */
59 #define CMD_READ (0xe6) /* read data (+ MT,MFM,SK) */
60 #define CMD_RECAL (0x07) /* recalibrate */
61 #define CMD_SENSEI (0x08) /* sense interrupt status */
62 #define CMD_FORMAT (0x4d) /* format track (+ MFM) */
63 #define CMD_SEEK (0x0f) /* seek track */
64 #define CMD_VERSION (0x10) /* FDC version */
67 /* function prototypes */
68 extern unsigned int init_floppy ();
69 extern void reset (void);
70 extern bool diskchange (void);
71 extern void motoron (void);
72 extern void motoroff (void);
73 extern void recalibrate (void);
74 extern bool seek (int track);
75 extern bool log_disk (DrvGeom *g);
76 extern bool read_block (int block, char *blockbuff, unsigned long nosectors);
77 extern bool write_block (int block, char *blockbuff, unsigned long nosectors);
78 extern bool format_track (char track, DrvGeom *g);
79 extern unsigned int floppy_detect (void);
80 extern bool floppy_acthandler (unsigned act, partition_t *p, char *block, char *more, int n);
82 #endif /* FDC_H */