1 2 3 /* $Header$ */ 4 5 /* 6 * ACC IF-11/HDH interface 7 */ 8 9 struct hdhregs { /* device registers */ 10 u_short csr; /* control and status register */ 11 u_char iochn; /* logical channel */ 12 u_char ioadx; /* address extension (A16,A17) */ 13 u_short ioadl; /* buffer address (A0-A15) */ 14 u_short iocnt; /* byte count */ 15 u_char iofcn; /* UMC funciton code */ 16 u_char iosbf; /* UMC subfunction code */ 17 u_char ioini; /* comm regs valid flag */ 18 u_char staack; /* interrupt acknowledge flag */ 19 u_char ionmi; /* NMI routine active flag */ 20 u_char ioxfrg; /* UMR transfer grant flag */ 21 u_char stachn; /* interrupt channel number */ 22 u_char statyp; /* interrupt type code */ 23 u_char stacc; /* completion function code */ 24 u_char stacs; /* completion subfunction code */ 25 u_short stacnt; /* completion byte count */ 26 }; 27 28 /* defines for CSR */ 29 30 #define HDH_UER 0100000 /* UMC error condition */ 31 #define HDH_NXM 0040000 /* non-existent memory error */ 32 #define HDH_PER 0020000 /* UNIBUS parity error */ 33 #define HDH_ZRUN 0010000 /* Z80 running */ 34 #define HDH_ZGO 0004000 /* Z80 not in wait state */ 35 #define HDH_MBLK 0000200 /* memory swap state (0=main, 1=srv) */ 36 #define HDH_SRV 0000100 /* select UMC service memory */ 37 #define HDH_MAIN 0000040 /* select UMC main memory */ 38 #define HDH_DMA 0000020 /* DMA enable */ 39 #define HDH_WRT 0000010 /* DMA write enable */ 40 #define HDH_IEN 0000004 /* interrupt enable */ 41 #define HDH_RST 0000002 /* reset */ 42 #define HDH_NMI 0000001 /* cause NMI */ 43 44 #define HDH_BITS \ 45 "\10\20UER\17NXM\16PER\15ZRUN\14ZGO\10MBLK\7SRV\6MAIN\5DMA\4WRT\3IEN\2RST\1NMI" 46 47 /* start i/o function code definitions */ 48 49 #define HDHWRT 0 /* write to if-11 */ 50 #define HDHRDB 1 /* read from if-11 */ 51 #define HDHSTR 2 /* stream flag */ 52 #define HDHEOS 6 /* end of stream flag */ 53 #define HDHABT 8 /* abort flag */ 54 #define HDHUMR 16 /* UMR protocol flag */ 55 56 /* interrupt type definitions */ 57 58 #define HDHSACK 0 /* start i/o ack */ 59 #define HDHDONE 1 /* i/o completion */ 60 #define HDHXREQ 2 /* UMR protocol transfer request */ 61 62 /* i/o completion codes */ 63 64 #define HDHIOCOK 0001 /* successful completion */ 65 #define HDHIOCOKP 0002 /* successful completion, more data pending */ 66 #define HDHIOCABT 0361 /* i/o aborted */ 67 #define HDHIOCERR 0321 /* program error */ 68 #define HDHIOCOVR 0363 /* overrun error */ 69 #define HDHIOCUBE 0374 /* non-existant memory or unibus error */ 70 71 /* UMR protocol transfer grant code definitions */ 72 73 #define HDHXEVN 1 /* start with even address */ 74 #define HDHXODD 2 /* start with odd address */ 75 #define HDHNUMR 4 /* non-UMR transfer */ 76 #define HDHXABT 8 /* abort transfer */ 77 78 /* HDH supervisor request code definitions */ 79 #define HDHINIT 0x42 /* SYSINIT opcode */ 80 81 #define HDHSUP 0xf0 /* supervisor HDH status/line control prefix */ 82 #define HDHIMP 0x400 /* IMP line up modifier */ 83 #define HDHREFL 0x800 /* reflect mode modifier */ 84 #define HDHINLB 0x1000 /* internal loopback modifier */ 85 #define HDHEXLP 0x2000 /* external loopback modifier */ 86 #define HDHRQST HDHSUP+0x0000 /* line status request */ 87 #define HDHRQUP HDHSUP+0x0100 /* line up request */ 88 #define HDHRQDN HDHSUP+0x0200 /* line down request */ 89 90 /* HDH supervisor reply code definitions */ 91 92 #define HDHIACK HDHSUP+0x4200 /* line init ack */ 93 #define HDHLNUP HDHSUP+0x0100 /* line up reply */ 94 #define HDHLNDN HDHSUP+0x0200 /* line down reply */ 95 #define HDHLNACK HDHSUP+0x0300 /* ack line up request (but line is down now) */ 96 #define HDHTIMO HDHSUP+0x0400 /* line timeout */ 97 #define HDHLOOP HDHSUP+0x0500 /* loopback message */ 98 #define HDHDTERR HDHSUP+0x0600 /* host data error detected */ 99 #define HDHSQRCV HDHSUP+0x0700 /* HDLC sequence error detected by IMP */ 100 #define HDHSQERR HDHSUP+0x0800 /* HDLC sequence error detected by if-11 */ 101