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

⟦5abc07336⟧ TextFile

    Length: 8845 (0x228d)
    Types: TextFile
    Notes: UNIX file
    Names: »tmc.h«

Derivation

└─⟦5fb5a153b⟧ Bits:30004042/hpdd.imd SW95705I 386/ix Multi-user Release 1.2
└─⟦5fb5a153b⟧ UNIX Filesystem
    └─⟦this⟧ »hp/new/usr/include/sys/tmc.h« 

TextFile

/*
 *      TMC-8X0 SCSI Host Adapter Driver Definition File
 */

#ident  "@(#)tmc.h	1.1 - 88/03/15"

/*
 * memory mapped address offsets
 */
#define READ_ROM		0x0000
#define	READ_RAM		0x1800
#define	WRITE_RAM		0x1800
#define	READ_SCSI		0x1e00
#define	WRITE_SCSI		0x1e00

/* read_status and write_control replace READ_STATUS and WRITE_CONTROL
 * read_status   =  0x8      0x2
 * write_control =  0x2  or  0x8  depending on TMC 830/840/880
 */

/*
 * control port output codes
 */
#define	C_RESET			0x01	/* assert SCSI reset line */
#define	C_SELECT		0x02	/* assert SCSI select line */
#define	C_BUSY			0x04	/* assert SCSI busy line */
#define	C_ATTENTION		0x08	/* assert SCSI attention line */
#define	C_ARBITRATION		0x10	/* start arbitration */
#define	C_PARITY_ENABLE		0x20	/* parity enable */
#define	C_INT			0x40	/* enable interrupt */
#define	C_BUS_ENABLE		0x80	/* bus enable */

/*
 * input status byte
 */
#define	I_BUSY			0x01	/* busy status from SCSI */
#define	I_MESSAGE		0x02	/* message status line from SCSI */
#define	I_IO			0x04	/* input/output line from SCSI */
#define	I_CD			0x08	/* command/data line from SCSI */
#define	I_REQUEST		0x10	/* request line from SCSI */
#define	I_SELECT		0x20	/* select line from SCSI */
#define	I_PARITY		0x40	/* parity error status */
#define	I_ARB_COMP		0x80	/* arbitration complete */

/*
 * status byte
 */
#define	S_PARITY		0x01	/* parity error */
#define	S_CHECK_CONDITION	0x02	/* error exists --> request sense */
#define	S_BUSY			0x08	/* busy, cont. can't accept command */

/*
 * message bytes
 */
#define	M_SAVE_DATA_POINTERS	0x02	/* drive is going to disconnect */
#define	M_DISCONNECT		0x04	/* drive disconnect */
#define	M_IDENTIFY		0x80	/* establish connection */
#define	M_SUPPORT_DISCONNECT	0x40	/* adapter supports discon/recon */

/*
 * opcodes
 */
#define	OP_TEST_UNIT_READY	0x00
#define	OP_REQUEST_SENSE	0x03
#define	OP_READ			0x08
#define	OP_WRITE		0x0a
#define	OP_START_STOP		0x1b
#define	OP_READ_CAPACITY	0x25

/*
 * return codes
 */
#define DK_DONE			0x0
#define DK_DISCONNECTING	0x1
#define	DK_BUSY			0x2
#define DK_RETRY		0x3
#define DK_ERROR		-1

/*
 * adapter scsi id
 */
#define SCSI_ADAPTER_ID		0x40

/*
 * selector macros to get at scsi memory addresses
 */
#define SCSI_IN(a)		(scsiptr[a])
#define	SCSI_OUT(a,v)		(scsiptr[a] = v)

/*
 * phase macros
 */
#define	MSK(m, v)		(((m) << 8) | (v))
#define	PHASE_SIGNALS		0x1E
#define	DATA_OUT		(I_REQUEST)
#define	DATA_IN			(I_REQUEST|I_IO)
#define	MESSAGE_OUT		0x1A
#define	MESSAGE_IN		0x1E
#define	DATA_OUT_PHASE		(adapter_status_check( \
					MSK(PHASE_SIGNALS, DATA_OUT)) == 0)
#define	DATA_IN_PHASE		(adapter_status_check( \
					MSK(PHASE_SIGNALS, DATA_IN)) == 0)
#define	COMMAND_PHASE		(adapter_status_check(command_msk) == 0)
#define	STATUS_PHASE		(adapter_status_check(status_msk) == 0)
#define	MESSAGE_OUT_PHASE	(adapter_status_check( \
					MSK(PHASE_SIGNALS, MESSAGE_OUT)) == 0)
#define	MESSAGE_IN_PHASE	(adapter_status_check( \
					MSK(PHASE_SIGNALS, MESSAGE_IN)) == 0)

/*
 * control line macros
 */
#define	ARB_COMPLETE	(adapter_status_check(MSK(I_ARB_COMP, I_ARB_COMP))==0)
#define	BUSY_LOW	(adapter_status_check(MSK(I_BUSY, 0)) == 0)
#define	BUSY_HIGH	(adapter_status_check(MSK(I_BUSY, I_BUSY)))
#define	REQUEST_HIGH	(adapter_status_check(MSK(I_REQUEST, I_REQUEST)) == 0)
#define	MESSAGE_HIGH	(adapter_status_check(message_high_msk) == 0)
#define	MESSAGE_LOW	(adapter_status_check(message_low_msk) == 0)
#define	CD_HIGH		(adapter_status_check(cd_high_msk) == 0)
#define	CD_LOW		(adapter_status_check(cd_low_msk) == 0)
#define	IO_HIGH		(adapter_status_check(MSK(I_IO, I_IO)) == 0)
#define	IO_LOW		(adapter_status_check(MSK(I_IO, 0)) == 0)
#define	SELECT_HIGH	(adapter_status_check(MSK(I_SELECT, I_SELECT)) == 0)
#define	SELECT_LOW	(adapter_status_check(MSK(I_SELECT, 0)) == 0)
#define	ADAPTER_IDLE	(adapter_status_check( \
			    MSK(I_BUSY|I_CD|I_IO|I_REQUEST|I_MESSAGE, 0)) == 0)

/*
 * miscellaneous macros
 */
#define	NBPS(dr)		defined_drives[dr]->bytes_p_sect
#define	NSPT(dr)		defined_drives[dr]->sect_p_trk
#define NTPC(dr)		defined_drives[dr]->trk_p_cyl
#define	NSPC(dr)		defined_drives[dr]->sect_p_cyl
#define	NSPB(dr)		(BSIZE / NBPS(dr))
#define	b_hold_partp		b_resid

/*
 * constants
 */
#define	FALSE			0
#define	TRUE			1
#define	NDK			2	/* number of drives */
#define NSCSI_IDS		8	/* available scsi ids */
#define	NPARTS			8	/* number of logical disks per drive */
#define ERRLIM                  0       /* number of retries before error */
#define	MAXSECTORS		256	/* largest request */
#define	SCSI_TIMEOUT		240	/* 4 minute timeout value */
#define	STARTUP_TIME		3
#define TINY_WAIT               30L    /* used when checking for arbitration */
#define SHORT_WAIT		1236L
#define KINDA_SHORT_WAIT        12360L
#define MEDIUM_WAIT		200000L	/* longer than long */
#define LONG_WAIT		120000L
#define RESET_DELAY		(5 * HZ)/* time to delay() after reset */
#define RESET_SPIN		700000L/* how long to spin after reset */
#define IO_DELAY		(1 * HZ)/* time to delay() after garbage I/O */
#define IO_SPIN			150000L	/* how long to spin after I/O */
#define	CB_FLAG			0
#define	ECB_FLAG		1

#define	DOS12_ID		1
#define	ROOT_ID			2
#define	USER_ID			3
#define	DOS16_ID		4
#define	BADTT_ID		0xff
#define	PART_WHOLE		0
#define	PART_1			1
#define	PART_2			2
#define	PART_3			3
#define	PART_4			4
#define	PART_ACT		5
#define	MAX_BADT		256


#define uchar_t unchar

/*
 * control block
 */
struct cb {
	uchar_t	cb_opcode;
	uchar_t	cb_unit;
	uchar_t	cb_block_address[2];
	uchar_t	cb_transfer_length;
	uchar_t	cb_control_byte;
};

/*
 * extended control block
 */
struct ecb {
	uchar_t	ecb_opcode;
	uchar_t	ecb_unit;
	uchar_t	ecb_block_address[4];
	uchar_t	ecb_reserved;
	uchar_t	ecb_transfer_length[2];
	uchar_t	ecb_control_byte;
};

struct read_cap_data {
	uchar_t rcd_block_address[4];
	uchar_t rcd_block_length[4];
};

struct sense_data {
	uchar_t	sd_error;
	uchar_t sd_segment_no;
	uchar_t sd_sense_key;
	uchar_t sd_info[4];
	uchar_t	sd_sense_length;
	uchar_t sd_res1[4];
	uchar_t sd_sense_code;
	uchar_t sd_res2[5];
};

struct part_struc {
    char  	boot_ind_hd;		/* boot indication */
    char  	begin_head_hd;		/* beginning head number (1-???) */
    char  	begin_sector_hd;	/* beginning sector number (1-170) */
    char  	begin_cyl_hd;		/* beginning cylinder number (0-???) */
    char	system_ind_hd;		/* system id byte */
    char  	stop_head_hd;		/* ending head number */
    char  	stop_sector_hd;		/* ending sector number */
    char  	stop_cyl_hd;		/* ending cylinder number */
    daddr_t	rel_sector_hd;		/* relative starting sector number */
    daddr_t	total_sector_hd;	/* total num of sectors in partition */
};
    
struct boot_part {
    char	boot_code[ 512 - (4 * sizeof( struct part_struc ))
		- sizeof(unsigned) ];
    struct	part_struc  partition_table[ 4 ];	/* partition table */
    unsigned	signature_hd;				/* signature */
};

/*
 * table of pointers to each of the drive characteristics for each
 * drive; these are initialized at 'scsireset' time and are used to
 * get the pointer quick without extensive calculations.
 */
struct drive_types {
    unsigned	cylinders;		/* # of cylinders */
    unsigned 	trk_p_cyl;		/* # tracks per cyl (heads) */
    unsigned	write_precomp;		/* precomp cylinder */
    unsigned 	sect_p_trk;		/* # sectors per track */
    unsigned    sect_p_cyl;		/* # sectors per cylinder */
    unsigned	phy_p_log;		/* # of sectors per block */
    unsigned	bytes_p_sect;		/* # of bytes per sector */
    unsigned	parking;		/* parking cylinder for transport */
    unsigned	reserved1;
    unsigned	reserved2;
};

/*
 * start and length of each logical disk on each physical disk.
 * also contains the start and end pointers into the bad track
 * table so that each request does not have to scan the entire
 * table.
 */
struct partab {
	daddr_t		len;		/* number of sectors in partition */
	daddr_t		sector_start;	/* start sector of partition */
	unsigned	*strt_badt_ptr;	/* starting & ending indexes for this */
	unsigned	*end_badt_ptr;	/* partition in the badt table */
	char		part_type;	/* sys id byte from disk structure */
};

/*
 *  For drive specific information, such as tape open functions  
 *  (where a specific density mode needs to be set), or other 
 *  drive specific things that need to happen at file open time.
 */

struct drive_specific  {
	char *ds_vendor;           /* vender ID ASCII  8 bytes  */
	char *ds_product;       /* product ID ASCII 16 bytes */
	char *ds_revision;        /* revision level ASCII 4 bytes */
	int (*ds_open_func)();     /* tape drive open function or NULL */
};

#define ds_vid(X)  (X->ds_vendor)
#define ds_pid(X)  (X->ds_product)
#define ds_rev(X)  (X->ds_revision)
#define ds_open(X) (X->ds_open_func)
			
struct mode_select {
	int mode;
	int density;
	int blk_len;
};

typedef struct mode_select mode_sel_t;