/* $NetBSD: tsreg.h,v 1.6 2024/02/05 22:18:18 andvar Exp $ */
/*
* Copyright (c) 1995 Ludd, University of Lule}, Sweden.
* All rights reserved.
*
* This code is derived from software contributed to Ludd by
* Bertram Barth.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* TSV05 u.g. 5-11:
*
* The TSV05 Subsystem has four device registers that occupy only two
* LSI-11 Bus word locations: a Data Buffer (TSDB), a Bus Address
* Register (TSBA), a Status Register (TSSR), and an Extended Data
* Buffer (TSDBX). The TSDB is an 18-bit register that is ...
*/
#ifdef notdef
struct tsdevice {
unsigned short tsdb;/* Data Buffer (TSDB)/Bus Address Register (TSBA) */
unsigned short tssr;/* Status Reg. (TSSR)/Extended Data Buffer(TSDBX) */
};
#endif
#define TSDB 0
#define TSBA 0
#define TSSR 2
#define TSDBX 3
/*
* TSSR Register bit definitions
*/
#define TS_SC 0x8000 /* Special Condition */
#define TS_UPE 0x4000 /* not used in TSV05, UPE in TS11 */
#define TS_SCE 0x2000 /* Sanity Check Error, SPE in TS11 */
#define TS_RMR 0x1000 /* Register Modification Refused */
#define TS_NXM 0x0800 /* Nonexistent Memory */
#define TS_NBA 0x0400 /* Need Buffer Address */
#define TS_A11 0x0300 /* Address Bits 17-16 */
#define TS_SSR 0x0080 /* Subsystem Ready */
#define TS_OFL 0x0040 /* Off Line */
#define TS_FTC 0x0030 /* Fatal Termination Class Code */
#define TS_TC 0x000E /* Termination Class Code */
#define TS_NU 0x0001 /* Not Used */
/*
* Termination Codes
*/
#define TS_FTC_IDF (0<<4) /* internal diagnostic failure */
#define TS_FTC_RSVD (1<<4) /* Reserved */
#define TS_FTC_NU (2<<4) /* Not Used */
#define TS_FTC_DPD (3<<4) /* Detection of Power Down (not implemented) */
#define TS_TC_NORM (0<<1) /* Normal Termination */
#define TS_TC_ATTN (1<<1) /* Attention Condition */
#define TS_TC_TSA (2<<1) /* Tape status alert */
#define TS_TC_FR (3<<1) /* Function reject */
#define TS_TC_TPD (4<<1) /* Tape position is one record down (recov.) */
#define TS_TC_TNM (5<<1) /* Tape not moved (recoverable) */
#define TS_TC_TPL (6<<1) /* Tape position lost (unrecoverable) */
#define TS_TC_FCE (7<<1) /* Fatal Controller Error (see FTC) */
struct cmd { /* command packet (not all words required) */
unsigned short cmdr; /* command word */
unsigned short cw1; /* low order data pointer address (A15-00) */
unsigned short cw2; /* high order data pointer address (A21-16) */
unsigned short cw3; /* count parameter */
};
#define TS_CC_STAT 0x0F /* GET STATUS */
#define TS_CMD_STAT TS_CMD(0,TS_CC_STAT) /* Get Status (END) */
struct status { /* message packet */
unsigned short hdr; /* ACK, class-code, format 1, message type */
unsigned short dfl; /* data field length (8 bit) */
unsigned short rbpcr; /* residual b/r/tm count word */
unsigned short xst0; /* Extended Status Registers 0-4 */
unsigned short xst1;
unsigned short xst2;
unsigned short xst3;
unsigned short xst4; /* total size: 16 bytes */
};
struct chr {
unsigned short sadrl; /* low-word of status addr */
unsigned short sadrh;
unsigned short onesix; /* 016/020 */
unsigned short chrw; /* Characteristics word */
unsigned short xchrw; /* TS05 extra word */
};
/*
* Flags used in write-characteristics command
*/
#define TS_WC_ESS (1<<7) /* Enable Skip Tape Marks Stop */
#define TS_WC_ENB (1<<6) /* Enable Tape Mark Stop at Bot */
#define TS_WC_EAI (1<<5) /* Enable Attention interrupts */
#define TS_WC_ERI (1<<4) /* Enable Message Buffer Release interrupts */
#define TS_WCX_HSP (1<<5) /* High Speed Select (25 in/s vs. 100 in/s) */
#define TS_WCX_RBUF (1<<4) /* Enable read buffering */
#define TS_WCX_WBUF (1<<3) /* Enable write buffering */
/*
* Status flags
*
* Extended Status register 0 (XST0) -- XST0 appears as the fourth word
* in the message buffer stored by the TSV05 subsystem upon completion of
* a command or an ATTN
*/
#define TS_SF_TMK (1<<15) /* Tape Mark Detected */
#define TS_SF_RLS (1<<14) /* Record Length Short */
#define TS_SF_LET (1<<13) /* Logical End of Tape */
#define TS_SF_RLL (1<<12) /* Record Length Long */
#define TS_SF_WLE (1<<11) /* Write Lock Error */
#define TS_SF_NEF (1<<10) /* Nonexecutable Function */
#define TS_SF_ILC (1<< 9) /* Illegal Command */
#define TS_SF_ILA (1<< 8) /* Illegal Address */
#define TS_SF_MOT (1<< 7) /* Motion */
#define TS_SF_ONL (1<< 6) /* On-Line */
#define TS_SF_IE (1<< 5) /* Interrupt Enable */
#define TS_SF_VCK (1<< 4) /* Volume Check */
#define TS_SF_PED (1<< 3) /* Phase Encoded Drive */
#define TS_SF_WLK (1<< 2) /* Write Locked */
#define TS_SF_BOT (1<< 1) /* Beginning of Tape */
#define TS_SF_EOT (1<< 0) /* End of Tape */
#define TS_XST0_BITS "\20\20TMK\17RLS\16LET\15RLL\14WLE\13NEF\12ILC\11ILA" \
"\10MOT\07ONL\06IE \05VCK\04PED\03WLK\02BOT\01EOT"
/*
* Extended Status register 1 (XST1) -- XST1 appears as the fifth word
* in the message buffer stored by the TSV05 subsystem upon completion of
* a command or an ATTN
*/
#define TS_SF_DLT (1<<15) /* Data Late */
#define TS_SF_COR (1<<13) /* Correctable Data */
#define TS_SF_CRS (1<<12) /* TS11: Crease Detected */
#define TS_SF_TIG (1<<11) /* TS11: Trash in Gap */
#define TS_SF_DBF (1<<10) /* TS11: Desckew Buffer Fail */
#define TS_SF_SCK (1<< 9) /* TS11: Speed Check */
#define TS_SF_RBP (1<< 8) /* Read Bus Parity Error */
#define TS_SF_IPR (1<< 7) /* TS11: Invalid Preamble */
#define TS_SF_IPO (1<< 6) /* TS11: Invalid Postamble */
#define TS_SF_SYN (1<< 5) /* TS11: Sync Failure */
#define TS_SF_IED (1<< 4) /* TS11: Invalid End Data */
#define TS_SF_POS (1<< 3) /* TS11: Postamble short */
#define TS_SF_POL (1<< 2) /* TS11: Postamble long */
#define TS_SF_UNC (1<< 1) /* Uncorrectable Data or Hard Error */
#define TS_SF_MTE (1<< 0) /* TS11: Multitrack Error */