DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦7b48181c8⟧ TextFile

    Length: 8618 (0x21aa)
    Types: TextFile
    Notes: UNIX file
    Names: »fd.h«

Derivation

└─⟦a6ab2eb36⟧ Bits:30004042/kconfig3.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦a6ab2eb36⟧ UNIX Filesystem
    └─⟦this⟧ »kc/new/usr/include/sys/fd.h« 

TextFile

/*
 * Parameters for PC AT floppy disk driver.
 */

/*
 * Copyrighted as an unpublished work.
 * (c) Copyright 1986 INTERACTIVE Systems Corporation
 * All rights reserved.
 *
 * RESTRICTED RIGHTS
 *
 * These programs are supplied under a license.  They may be used,
 * disclosed, and/or copied only as permitted under such license
 * agreement.  Any copy must contain the above copyright notice and
 * this restricted rights notice.  Use, copying, and/or disclosure
 * of the programs is strictly prohibited unless otherwise provided
 * in the license agreement.
 */

#ident "@(#)fd.h	1.12 - 88/03/15"

#define	FD0	0	/* major device number for floppy disk */

/*
 * the floppy disk minor device number is interpreted as follows:
 *     bits:
 *	 7  4 3 21 0
 * 	+----+-+--+-+
 * 	|fmt |s|pt|u|
 * 	+----+-+--+-+
 *     codes:
 *	u   - unit no. (0 or 1)
 *	pt  - partition no. (0 - 3)
 *	s   - single/double sided (1 = single)
 *	fmt - format code, no. of bytes per sector/ no. of sectors per trk.
 */

#define	PARTITION(x)	((minor(x) & 0x06) >> 1)
#define UNIT(x)		(minor(x) & 0x01)
#define	FRMT(x)		((minor(x) & 0xf0) >> 4)
#define	SIDES(x)	((minor(x) & 0x08) ? 1 : 2)

#define	FDNPART		4	/* maximum number of partitions */
#define	FDNSECT		16	/* maximum number of format types */

/*
 * Defines for controller access.
 */
#define	FDSTAT	0x3f4	/* I/O port addr of floppy controller status port */
#define	FDDATA	0x3f5	/* I/O port addr of floppy controller data port */

#define	FCBUSY	0x10	/* controller busy bit */
#define	IODIR	0x40	/* data reg I/O direction, 1 = read, 0 = write */
#define	IORDY	0x80	/* data register ready to xfer bit */

#define	FCRETRY	2000	/* this many ten microseconds equals 20ms. */

#define	CTIMOUT	0x02	/* Timed out waiting for IORDY in fdcmd */
#define	RTIMOUT	0x03	/* Timed out waiting for IORDY in fdresult*/
#define	NECERR	0x04	/* Controller wont go idle error flag */

#define ONESIDE 0x08    /* indicates in minor dev that we want single sided */

#define NUMDRV  2           /* maximum number of drives supported */
#define NHDS    2           /* default number of heads */
#define NSECS   9           /* default number of sectors per track */
#define NCYLS   40          /* default number of cylinders */
#define SECSIZE 512         /* default sector size */
#define SECSHFT 9
#define SECMASK (SECSIZE-1)

#define OPEN_EMAX   1       /* max number of retries during open processing */
#define FORM_EMAX   3       /* max number of retries during format */
#define TRYRESET    5       /* try a reset after this many errrors */
#define NORM_EMAX   10      /* normal max number of retries */

#define RUNTIM  2
#define WAITTIM 4
#define LOADTIM 10
#ifdef AT386
#define MTIME   100	/* no. of clock ticks in one second */
#define ETIMOUT 50	/* no. of clock ticks in 1/2 second */
#define T25MS   3	/* no. of clock ticks in 25 milliseconds */
#define T500MS  50	/* no. of clock ticks in 50 milliseconds */
#define T50MS   5	/* no. of clock ticks in 50 milliseconds */
#define T750MS  75	/* no. of clock ticks in 750 milliseconds */
#else
#define MTIME   60
#define ETIMOUT 30
#define T25MS   2
#define T500MS  30
#define T50MS   4
#define T750MS  45
#endif /* AT386 */

#define OPEN    0x01
#define WOPEN   0x02
#define RECAL   0x04
#define CLOSING 0x08
#define RSTDOPN 0x20

#define WINTR   0x01
#define	WRESET	0x02

#define DMA_RD      0x46
#define DMA_WR      0x4A

#define FDCSR1      0x03F7
#define DOOROPEN    0x80
#define FDCTRL      0x03F2
#define NORESET     0x04
#ifdef PS2
#define ENABINT     0x00
#else
#define ENABINT     0x08
#endif
#define ENABMOTOR   0x10

#define FD0BSY      0x01    /* drive is seeking */
#define FD1BSY      0x02
#define FD2BSY      0x04
#define FD3BSY      0x08
#define FCBSY       0x10    /* controller is busy */
#define NODMA       0x20    /* controller in non-DMA mode */

/*
 * Floppy controller commands
 */
#define RDCMD       0x26
#define SEEK        0x0F
#define FORMAT      0x0D
#define READID      0x0A
#define SENSE_INT   0x08
#define REZERO      0x07
#define WRCMD       0x05
#define SENSE_DRV   0x04        /* read status register 3 */
#define SPECIFY     0x03
#ifdef VPIX
#define READDEL     0x0C
#define WRITEDEL    0x09
#define READTRACK   0x02
#define RAWCMD      0x7F	/* command is thru raw I/O ioctl */
#endif

#define INVALID     0x80        /* status register 0 */
#define ABNRMTERM   0x40
#define SEEKEND     0x20
#define EQCHK       0x10
#define NOTRDY      0x08

#define EOCYL       0x80        /* status register 1 */
#define CRCERR      0x20
#define OVRRUN      0x10
#define NODATA      0x04
#define MADR        0x01

#define FAULT       0x80        /* status register 3 */
#define WPROT       0x40
#define RDY         0x20
#define TWOSIDE     0x08

/* NEW_HARDWARE CMOS drive descriptions */
#define DRV_NONE    0x00
#define DRV_DBL     0x01
#define DRV_QUAD    0x02
#define DRV_720     0x04	/* LOW_35 gets changed to this for or'ing */
#define DRV_144     0x08	/* HI35 gets changed to this for or'ing */

#define LOW_35      0x03
#define HI_35	    0x04

	    /* encodings for the 'fdf_den' field in structure 'fdparam' */
#define DEN_MFM 0x40        /* double density disks */
#define DEN_FM  0x00        /* single density disks */

	    /* encodings for the 'fdf_bps' field in structure 'fdparam' */
#define BPS128  0           /* 128 bytes per sector */
#define BPS256  1           /* 256 bytes per sector */
#define BPS512  2           /* 512 bytes per sector */
#define BPS1024 3           /* 1024 bytes per sector */
#define MAXBPS  3           /* maximum value of the 'fdf_bps' field */

/*
 * partition table for floppy disks
 * we support, 3 different partitions:
 * 	0 - the whole disk;
 *	1 - the first cylinder on the disk
 *	2 - the whole disk minus the first cylinder
 */
struct fdpartab {
	int	startcyl;	/* cylinder no. where partition starts */
	int	numcyls;	/* number of cylinders in partition */
};

/*
 * sector table for floppy disks,
 * specifies number of bytes per sector and
 * number of sectors per track and number of cylinders
 */
struct fdsectab {
	unsigned short	fd_ssize;	/* number of bytes in a sector */
	unsigned short	fd_sshift;	/* shift to convert bytes to sectors */
	unsigned short	fd_ncyls;	/* number of cylinders */
	unsigned char	fd_nsect;	/* number of sectors per track */
	unsigned char	fd_drvs;	/* bitmask of drive types supporting */
	unsigned char	fd_gpln;	/* normal gap length */
	unsigned char	fd_gplf;	/* format gap length */
};

struct fdstate {
	char     fd_status;
	char     fd_maxerr;
	unsigned char  fd_drvtype;
	unsigned char  fd_trnsfr;
	unsigned char  fd_hst;
	unsigned char  fd_mst;
	unsigned char  fd_dstep;
	unsigned short fd_cylskp;
	unsigned short fd_ncyls;
	unsigned short fd_secsiz;
	unsigned short fd_secmsk;
	unsigned char  fd_secsft;
	unsigned char  fd_nsides;
	unsigned char  fd_nsects;
	unsigned char  fd_cylsiz;
	unsigned char  fd_curcyl;
	unsigned char  fd_lsterr;
	unsigned short fd_n512b;
	dev_t	       fd_device;
	struct   proc *fd_proc;
};

struct fdparam {        /* used by FDSPARAM and FDGPARAM commands */
	char    fdf_bps;    /* number of bytes per sector - encoded */
	char    fdf_spt;    /* number of sectors per track */
	char    fdf_gpln;   /* gap length for normal R/W operations */
	char    fdf_gplf;   /* gap length for format operations */
	char    fdf_dtl;    /* length of sector if 'fdf_bps' = 0 */
	char    fdf_fil;    /* fill byte to use while formatting */
	char    fdf_den;    /* FM or MFM encoding */
	char    fdf_nhd;    /* number of heads */
	short   fdf_ncyl;   /* number of cylinders */
};

struct fdformid {       /* used by FDFMTTRK command */
	char    fdf_track;
	char    fdf_head;
	char    fdf_sec;
	char    fdf_secsiz;
};

#ifdef VPIX
#define FIOC		('F'<<8)
#define	F_DTYP		(FIOC|60)	/* returns fd_drvtype */
#define F_FCR		(FIOC|61)	/* output to Floppy Control Register */
#define F_DOR		(FIOC|62)	/* output to Digital Output Register */
#define F_RAW		(FIOC|63)	/* general raw controller interface */

struct fdraw {			/* used by F_RAW command */
	char	fr_cmd[10];	/* user-supplied command bytes */
	short	fr_cnum;	/* number of command bytes */
	char	fr_result[10];	/* controller-supplied result bytes */
	short	fr_nbytes;	/* number to transfer if read/write command */
	char   *fr_addr;	/* where to transfer if read/write command */
};

#define FDMEMSIZE       (36*512)        /* Size in bytes of initial raw i/o */
					/* request supported.  Must be less */
					/* than 65536 for dma wrap avoidance*/

struct  fdbufstruct {
	int         fbs_flags;
	caddr_t     fbs_addr;
	unsigned    int     fbs_size;
	};
#endif