Annotation of coherent/f/usr/include.78/sys/xlfdc.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * /usr/include/sys/xlfd.h
                      3:  *
                      4:  * FDC support for Archive floppy tape.
                      5:  * This header should disappear soon!
                      6:  *
                      7:  * Revised: Fri May 21 13:32:25 1993 CDT
                      8:  */
                      9: #ifndef __SYS_XLFD_H__
                     10: #define __SYS_XLFD_H__
                     11: 
                     12: #define        FD0     0       /* major device number for floppy disk */
                     13: 
                     14: /*
                     15:  * the floppy disk minor device number is interpreted as follows:
                     16:  *     bits:
                     17:  *      7  4 3 21 0
                     18:  *     +----+-+--+-+
                     19:  *     |fmt |s|pt|u|
                     20:  *     +----+-+--+-+
                     21:  *     codes:
                     22:  *     u   - unit no. (0 or 1)
                     23:  *     pt  - partition no. (0 - 3)
                     24:  *     s   - single/double sided (1 = single)
                     25:  *     fmt - format code, no. of bytes per sector/ no. of sectors per trk.
                     26:  */
                     27: 
                     28: #define        PARTITION(x)    ((getminor(x) & 0x06) >> 1)
                     29: #define UNIT(x)                (getminor(x) & 0x01)
                     30: #define        FRMT(x)         ((getminor(x) & 0xf0) >> 4)
                     31: #define        SIDES(x)        ((getminor(x) & 0x08) ? 1 : 2)
                     32: 
                     33: /*
                     34:  * Defines for controller access.
                     35:  */
                     36: #define        FDSTAT  0x3f4   /* I/O port addr of floppy controller status port */
                     37: #define        FDDATA  0x3f5   /* I/O port addr of floppy controller data port */
                     38: 
                     39: #define        FCBUSY  0x10    /* controller busy bit */
                     40: #define        IODIR   0x40    /* data reg I/O direction, 1 = read, 0 = write */
                     41: #define        IORDY   0x80    /* data register ready to xfer bit */
                     42: 
                     43: #define        FCRETRY 4000    /* this many ten microseconds equals 40ms. */
                     44: 
                     45: #define        CTIMOUT 0x02    /* Timed out waiting for IORDY in fdcmd */
                     46: #define        RTIMOUT 0x03    /* Timed out waiting for IORDY in fdresult*/
                     47: #define        NECERR  0x04    /* Controller wont go idle error flag */
                     48: 
                     49: #define ONESIDE 0x08    /* indicates in minor dev that we want single sided */
                     50: 
                     51: #define NUMDRV  2           /* maximum number of drives supported */
                     52: #define NHDS    2           /* default number of heads */
                     53: #define NSECS   9           /* default number of sectors per track */
                     54: #define NCYLS   40          /* default number of cylinders */
                     55: #define SECSIZE 512         /* default sector size */
                     56: #define SECSHFT 9
                     57: #define SECMASK (SECSIZE-1)
                     58: 
                     59: #define FD          ('R'<<8)
                     60: #define FDSPARAM    (FD | 00)   /* set the drive paramaters */
                     61: #define FDGPARAM    (FD | 01)   /* get the drive paramaters */
                     62: #define FDFMTTRK    (FD | 02)   /* format a single track */
                     63: 
                     64: #define OPEN_EMAX   1       /* max number of retries during open processing */
                     65: #define FORM_EMAX   3       /* max number of retries during format */
                     66: #define TRYRESET    5       /* try a reset after this many errrors */
                     67: #define NORM_EMAX   10      /* normal max number of retries */
                     68: 
                     69: #define RUNTIM  3
                     70: #define WAITTIM 4
                     71: #define LOADTIM 10
                     72: #define MTIME   100    /* no. of clock ticks in one second */
                     73: #define ETIMOUT 50     /* no. of clock ticks in 1/2 second */
                     74: #define T25MS   3      /* no. of clock ticks in 25 milliseconds */
                     75: #define T500MS  50     /* no. of clock ticks in 500 milliseconds */
                     76: #define T50MS   5      /* no. of clock ticks in 50 milliseconds */
                     77: #define T750MS  75     /* no. of clock ticks in 750 milliseconds */
                     78: 
                     79: #define OPENED  0x01
                     80: #define OPENING 0x02
                     81: #define RECAL   0x04
                     82: #define CLOSING 0x08
                     83: #define EXCLUSV 0x10
                     84: #define RSTDOPN 0x20
                     85: 
                     86: #define WINTR   0x01
                     87: #define        WRESET  0x02
                     88: 
                     89: #define D_NTRK  40      /* 40 tracks - double density */
                     90: #define Q_NTRK  80      /* 80 tracks - quad density */
                     91: 
                     92: 
                     93: #define FDCSR1      0x03F7
                     94: #define DOOROPEN    0x80
                     95: #define FDCTRL      0x03F2
                     96: #define NORESET     0x04
                     97: #define ENABINT     0x08
                     98: #define ENABMOTOR   0x10
                     99: 
                    100: #define FD0BSY      0x01    /* drive is seeking */
                    101: #define FD1BSY      0x02
                    102: #define FD2BSY      0x04
                    103: #define FD3BSY      0x08
                    104: #define FCBSY       0x10    /* controller is busy */
                    105: #define NODMA       0x20    /* controller in non-DMA mode */
                    106: 
                    107: /*
                    108:  * Floppy controller commands
                    109:  */
                    110: #define RDCMD       0x26
                    111: #define SEEK        0x0F
                    112: #define FORMAT      0x0D
                    113: #define READID      0x0A
                    114: #define SENSE_INT   0x08
                    115: #define REZERO      0x07
                    116: #define WRCMD       0x05
                    117: #define SENSE_DRV   0x04        /* read status register 3 */
                    118: #define SPECIFY     0x03
                    119: 
                    120: #define READDEL     0x0C
                    121: #define WRITEDEL    0x09
                    122: #define READTRACK   0x02
                    123: #define RAWCMD      0x7F       /* command is thru raw I/O ioctl */
                    124: 
                    125: #define INVALID     0x80        /* status register 0 */
                    126: #define ABNRMTERM   0x40
                    127: #define SEEKEND     0x20
                    128: #define EQCHK       0x10
                    129: #define NOTRDY      0x08
                    130: 
                    131: #define EOCYL       0x80        /* status register 1 */
                    132: #define CRCERR      0x20
                    133: #define OVRRUN      0x10
                    134: #define NODATA      0x04
                    135: #define MADR        0x01
                    136: 
                    137: #define FAULT       0x80        /* status register 3 */
                    138: #define WPROT       0x40
                    139: #define RDY         0x20
                    140: #define TWOSIDE     0x08
                    141: 
                    142: /* NEW_HARDWARE CMOS drive descriptions */
                    143: #define DRV_NONE    0x00
                    144: #define DRV_DBL     0x01
                    145: #define DRV_QUAD    0x02
                    146: 
                    147:            /* encodings for the 'fdf_den' field in structure 'fdparam' */
                    148: #define DEN_MFM 0x40        /* double density disks */
                    149: #define DEN_FM  0x00        /* single density disks */
                    150: 
                    151:            /* encodings for the 'fdf_bps' field in structure 'fdparam' */
                    152: #define BPS128  0           /* 128 bytes per sector */
                    153: #define BPS256  1           /* 256 bytes per sector */
                    154: #define BPS512  2           /* 512 bytes per sector */
                    155: #define BPS1024 3           /* 1024 bytes per sector */
                    156: #define MAXBPS  3           /* maximum value of the 'fdf_bps' field */
                    157: 
                    158: #define        FDNPART 3       /* number of partitions supported */
                    159: #define        FDMEMSIZE       (36*512)
                    160: /*
                    161:  * partition table for floppy disks
                    162:  * we support, 3 different partitions:
                    163:  *     0 - the whole disk;
                    164:  *     1 - the first cylinder on the disk
                    165:  *     2 - the whole disk minus the first cylinder
                    166:  */
                    167: struct fdpartab {
                    168:        int     startcyl;       /* cylinder no. where partition starts */
                    169:        int     numcyls;        /* number of cylinders in partition */
                    170: };
                    171: 
                    172: #define        FDNSECT 8       /* no. of sector size/count types supported */
                    173: /*
                    174:  * sector table for floppy disks,
                    175:  * specifies number of bytes per sector and
                    176:  * number of sectors per track.
                    177:  */
                    178: struct fdsectab {
                    179:        unsigned short  fd_ssize;       /* number of bytes in a sector */
                    180:        unsigned short  fd_sshift;      /* shift to convert bytes to sectors */
                    181:        unsigned char   fd_nsect;       /* number of sectors per track */
                    182:        unsigned char   fd_drvs;        /* bitmask of drive types supporting */
                    183:        unsigned char   fd_gpln;        /* normal gap length */
                    184:        unsigned char   fd_gplf;        /* format gap length */
                    185: };
                    186: 
                    187: struct fdstate {
                    188:        char     fd_status;
                    189:        char     fd_maxerr;
                    190:        unsigned char  fd_drvtype;
                    191:        unsigned char  fd_trnsfr;
                    192:        unsigned char  fd_hst;
                    193:        unsigned char  fd_mst;
                    194:        unsigned char  fd_dstep;
                    195:        unsigned short fd_cylskp;
                    196:        unsigned short fd_ncyls;
                    197:        unsigned short fd_secsiz;
                    198:        unsigned short fd_secmsk;
                    199:        unsigned char  fd_secsft;
                    200:        unsigned char  fd_nsides;
                    201:        unsigned char  fd_nsects;
                    202:        unsigned char  fd_cylsiz;
                    203:        unsigned char  fd_curcyl;
                    204:        unsigned char  fd_lsterr;
                    205:        unsigned short fd_n512b;
                    206:        dev_t          fd_device;
                    207:        struct   proc *fd_proc;
                    208:        unsigned char  fd_fmt;          /* auto format detection */
                    209:        unsigned char  fd_dskchg;       /* if == 0, format is up to date */
                    210: };
                    211: 
                    212: struct fdparam {        /* used by FDSPARAM and FDGPARAM commands */
                    213:        char    fdf_bps;    /* number of bytes per sector - encoded */
                    214:        char    fdf_spt;    /* number of sectors per track */
                    215:        char    fdf_gpln;   /* gap length for normal R/W operations */
                    216:        char    fdf_gplf;   /* gap length for format operations */
                    217:        char    fdf_dtl;    /* length of sector if 'fdf_bps' = 0 */
                    218:        char    fdf_fil;    /* fill byte to use while formatting */
                    219:        char    fdf_den;    /* FM or MFM encoding */
                    220:        char    fdf_nhd;    /* number of heads */
                    221:        short   fdf_ncyl;   /* number of cylinders */
                    222: };
                    223: 
                    224: struct fdformid {       /* used by FDFMTTRK command */
                    225:        char    fdf_track;
                    226:        char    fdf_head;
                    227:        char    fdf_sec;
                    228:        char    fdf_secsiz;
                    229: };
                    230: 
                    231: #define FIOC           ('F'<<8)
                    232: #define        F_DTYP          (FIOC|60)       /* returns fd_drvtype */
                    233: #define F_FCR          (FIOC|61)       /* output to Floppy Control Register */
                    234: #define F_DOR          (FIOC|62)       /* output to Digital Output Register */
                    235: #define F_RAW          (FIOC|63)       /* general raw controller interface */
                    236: 
                    237: struct fdraw {                 /* used by F_RAW command */
                    238:        char    fr_cmd[10];     /* user-supplied command bytes */
                    239:        short   fr_cnum;        /* number of command bytes */
                    240:        char    fr_result[10];  /* controller-supplied result bytes */
                    241:        short   fr_nbytes;      /* number to transfer if read/write command */
                    242:        char   *fr_addr;        /* where to transfer if read/write command */
                    243: };
                    244: 
                    245: struct  fdbufstruct {
                    246:        int         fbs_flags;
                    247:        caddr_t     fbs_addr;
                    248:        unsigned    int     fbs_size;
                    249: };
                    250: 
                    251: #endif /* __SYS_XLFD_H__ */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.