📄 npreg.h
字号:
/*- * Copyright (c) 1986 MICOM-Interlan, Inc., Boxborough Mass * Copyright (c) 1991 The Regents of the University of California. * All rights reserved. * * 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. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. * * @(#)npreg.h 7.4 (Berkeley) 5/9/91 *//* * Merged header file for MICOM-Interlan NP100. *//* * np100.h version 1.3 * * This version retrieved: 8/18/86 @ 18:58:44 * This delta created: 8/18/86 @ 18:27:32 *//* * Typedefs for the VAX */typedef short sign16; /* 16 bit signed value */typedef unsigned short unsign16; /* 16 bit unsigned value */typedef unsigned unsign32; /* 32 bit unsigned value */typedef long paddr_t; /* Physical addresses *//* * Tunables */#define NUMCQE 40 /* Number of CQE's per board *//* Host configuration word in Status Block *//* * To disable the lock/unlock internal function calls clear the 0x8000 * bit in the host configuration word (HOSTCONF) */#define HOSTCONF 0x0109 /* See above */#define LOWBYTE 1#define HIGHBYTE 0#define BUFFMAPPED 0/* * Memory mapping definintions for PM68DUAL hardware. */#ifdef PM68DUAL#define PISHMEM 0x200000#define PISHMEMSIZE 2#define PIOFF 0x8000 /* change this to unique mem add. */#define PIWINDOW MBUSBUFR + PIOFF#define WINDOWSIZE 2#endif#define NPMAXXFR 32768 /* Maximum number of bytes / read */ /* * Define the protocols supported by the NP Driver. */#define NONE 0x00 /* No protocols active for a process */#define NPMAINT 0x01 /* Maintenance protocol, superusers only */#define NPNTS 0x02 /* NTS Terminal Server */#define NPIDP 0x04 /* Direct Datalink Access */#define NPDLA 0x04 /* Direct Datalink Access */#define NPXNS 0x06 /* Xerox NS ITP */#define NPTCP 0x08 /* TCP/IP */#define NPISO 0x0A /* ISO */#define NPCLCONN 0xFF /* Closed connection, i.e. no protocol *//* * Convert the protocol to a value used in the Device Protocol Mask field * of the Shared Memory Status Block. */#define PROTOMASK(x) ( 1 << (x) )/* * Special requests handled by the NP Driver */#define OS_STP 03400 /* Shut down connection on I Board */#define NPSTOP 3 /* Conversion from above (OS_STP) */#define NPCHNGP 50 /* Change the protocol on a connection */#define NPCHNGB 51 /* Change the Board number *//* * Miscellaneous */#define ON 0x8000 /* Used for Command Q's scan and change flag */#define UBADDRMASK 0x3FFFF /* 18 bit UNIBUS address */#define INTMASK 0xFFFFFFFC /* Used for address validation */#define CMDMASK 0xFFFF /* Mask ioctl cmd field (see ioctl.h) */#define NPPSADDR 0x324 /* Pointer to addr of on-board panic string */#define PANLEN 133 /* length of the panic buffer *//* * Map function code from user to I-Board format */#define FUNCTMAP(x) (((x) << 6) | 077) /* Maps user function to NP funcs *//* * Round up to a 16 byte boundary */#define ROUND16(x) (((x) + 15) & (~0x0F)) /* Round to 16 byte boundary */#define ADDR24 1 /* Used by iomalloc() to specify 24 bit address */#define NPERRSHIFT 8 /* Used in function ReqDone() */#define NPOK 0#define LOWORD(X) (((ushort *)&(X))[0])#define HIWORD(X) (((ushort *)&(X))[1])/* Everyday flag settings */#define NPSET 1#define NPCLEAR 0/* * Command Queue Elements are the primary data structure for passing data * between the driver and the device. */struct CQE { struct npreq *cqe_reqid;/* Address of asssociated npreq */ union { unsign32 cqe_Famid; /* Family ID (Process ID) - wn */ unsign16 cqe_PrtSig[2]; /* port and signal - tn */ } u1;#define cqe_famid u1.cqe_Famid#define cqe_port u1.cqe_PrtSig[0]#define cqe_signal u1.cqe_PrtSig[1] unsign16 cqe_func; /* I/O function to be performed */#ifdef mc68000 char cqe_prot; /* Protocol type for I/O request */ char cqe_lenrpb; /* Length of the RPB in bytes */#else char cqe_lenrpb; /* Length of the RPB in bytes */ char cqe_prot; /* Protocol type for I/O request */#endif union { unsign16 cqe_ustS[2]; /* Protocol status return */ unsign32 cqe_ustL; /* Protocol status return */ } u2;#define cqe_ust0 u2.cqe_ustS[0]#define cqe_ust1 u2.cqe_ustS[1]#define cqe_usts u2.cqe_ustL unsign16 cqe_devrsv; /* Reserved for use by device only! */#ifdef mc68000 char cqe_char; /* CQE characteristics */ char cqe_sts; /* Status return from device to user */ char cqe_wind; /* Buffer mapping window size (page units) */ char cqe_nbuf; /* Number of data buffers for I/O */#else char cqe_sts; /* Status return from device to user */ char cqe_char; /* CQE characteristics */ char cqe_nbuf; /* Number of data buffers for I/O */ char cqe_wind; /* Buffer mapping window size (page units) */#endif unsign16 cqe_bcnt; /* Total number of bytes in the data buffer */ union { unsign16 cqe_Unused; /* Unused */ struct { char cqe_Maxbcnt; /* Maximum size of buffer */ char cqe_Bflags; /* Used by the SPI */ } s; } u3;#define cqe_unused u3.cqe_Unused#define cqe_maxbcnt u3.s.cqe_Maxbcnt#define cqe_bflags u3.s.cqe_Bflags unsign16 cqe_dma[2]; /* Address of the MULTIBUS data buffer */ unsign16 rpb1; /* Word 1 of protocol parameters */ unsign16 rpb2; /* Word 2 of protocol parameters */ unsign16 rpb3; /* Word 3 of protocol parameters */ unsign16 rpb4; /* Word 4 of protocol parameters */ unsign16 rpb5; /* Word 5 of protocol parameters */ unsign16 rpb6; /* Word 6 of protocol parameters */ unsign16 rpb7; /* Word 7 of protocol parameters */ unsign16 rpb8; /* Word 8 of protocol parameters */ unsign16 rpb9; /* Word 9 of protocol parameters */ unsign16 rpb10; /* Word 10 of protocol parameters */ unsign16 rpb11; /* Word 11 of protocol parameters */ unsign16 rpb12; /* Word 12 of protocol parameters */};/* * NP Driver Request structure contains information about a request * maintained solely by the driver. One per CQE, plus a header. */ struct npreq { struct npreq *forw; /* Forward pointer for active list */ struct npreq *back; /* Backward pointer for active list */ struct npreq *free; /* Next member on free list */ struct CQE *element; /* CQE associated with this request */ int flags; /* Always useful */ int reqcnt; /* Request count for reqtab */ int bufoffset; /* Offset into buffer for turns */ int bytecnt; /* Number of bytes to transfer */ caddr_t virtmem; /* Virtual address of buffer */ int mapbase; /* Address of the mapping register */ int mapsize; /* Size of mapped area */ caddr_t bufaddr; /* Address of the user buffer */ struct buf buf; /* Buf structure needed for mem. mgmt */ struct proc *procp; /* Pointer to process of requestor */ caddr_t user; /* Structure passed by user from itpuser.h */ int (*intr)(); /* Ptr to routine to call at interrupt time */ int int_param; /* Paramater to be used by above routine */};/* * Npmaster structure, one per device, is used for boardwise centralization * of relevant information including queues, I/O addresses and request pools. */struct npmaster { struct npmaster *next; /* Linked list of these, NULL terminator */ struct npspace *shmemp; /* Shared memory address (driver <-> device) */ struct uba_device *devp; /* UBA Device for this unit */ struct NPREG *iobase; /* I/O base address for this board */ struct npreq *reqtab; /* Header for pool of CQE requests */ int iomapbase; /* Base index of I/O map reg's allocated */ int flags; /* State of the Board */ int unit; /* Unit number of this device */ int vector; /* Interrupt vector for this unit */};struct NPREG { unsign16 CSR0; /* Control Status Register 0 */ unsign16 CSR1; /* Control Status Register 1 */ unsign16 CSR2; /* Control Status Register 2 */ unsign16 CSR3; /* Control Status Register 3 */};/* * The following structures are used for communicating with the * Intelligent Board and are located in Shared Memory. *//* * Status Block */struct NpStat{ unsign16 sb_drw; /* Device Request Word */ unsign16 sb_hcw; /* Host Configuration Word */ unsign16 sb_dcw; /* Device Configuration Word */ unsign16 sb_dpm; /* Device Protocol Mask */ unsign16 sb_dcq; /* Offset to Device CQ */ unsign16 sb_hcq; /* Offset to Host CQ */};/* * Command Queue, two per device. One is owned by the driver and the other * is owned by the device. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -