📄 mpreg.h
字号:
/* * Copyright (c) 1988 Regents of the University of California. * All rights reserved. * * This code is derived from software contributed to Berkeley by * Computer Consoles Inc. * * 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. * * @(#)mpreg.h 7.4 (Berkeley) 6/28/90 *//* * MPCC Asynchronous Communications Interface. */#define MPINTRBASE 0xa0 /* base vector for interupts */#define MPMAGIC 1969 /* magic number for mblok */#define MPMAXPORT 32 /* maximum number of ports on an MPCC *//* * MPCC's are capable of supporting one of a * the protocols listed below. This driver * supports only the async terminal protocol. */#define MPPROTO_UNUSED 0 /* port not in use */#define MPPROTO_ASYNC 1 /* async protocol */#define MPPROTO_X25 2 /* x25 protocol (unsupported) */#define MPPROTO_BISYNC 3 /* bisync protocol (unsupported) */#define MPPROTO_SNA 4 /* sna protocol (unsupported) */#define NMPPROTO 5 /* max protocols supported by MPCC */#define MPINSET 8#define MPOUTSET 8/* * Host Interface semaphores */#define MPSEMA_AVAILABLE 1#define MPSEMA_WORK 4/* * Host Interface imok values */#define MPIMOK_ALIVE 0x01#define MPIMOK_DEAD 0x80/* * Host Interface Structure */struct his { u_char semaphore; u_char imok; u_char brdnum; /* Virtual brd number for protocol */ u_char unused; struct { u_char inbdone[MPMAXPORT]; /* Ports w/ inbound completed */ u_char outbdone[MPMAXPORT]; /* Ports w/outbound available */ u_int fill[2]; } proto[NMPPROTO];};#define MPPORT_EOL 0xff /* end of port list *//* * Async host transmit list structure. */#define MPXMIT 4 /* # of transmit ptrs/MP_WRITE event */struct hxmtl { caddr_t dblock[MPXMIT]; /* ptrs to data blocks */ u_short size[MPXMIT]; /* size of each block */};/* * MPCC asynchronous protocol events. */struct mpevent { u_char ev_status; /* Go Status */ u_char ev_cmd; /* Optional Op-code */ u_short ev_opts; /* Optional flags */ u_short ev_error; /* error status returned */ u_short ev_flags; /* optional event flags field */ caddr_t ev_params; /* pointer to event parameters */ union { struct hxmtl *hxl; /* pointer to host xmit list */ u_char *rcvblk; /* pointer to receive block */ } ev_un; u_short ev_count; /* # ptrs in xmit list/# receive chars */ u_short ev_unused; /* round to longword */ u_int ev_unused2; /* round to size of BSC struct. GROT!! */};/* defines for ev_status */#define EVSTATUS_FREE 0#define EVSTATUS_GO 1#define EVSTATUS_BUSY 2#define EVSTATUS_DONE 4/* defines for ev_cmd */#define EVCMD_OPEN 1#define EVCMD_CLOSE 2#define EVCMD_RESET 3#define EVCMD_IOCTL 4#define EVCMD_WRITE 5#define EVCMD_READ 6#define EVCMD_STATUS 7#define EVCMD_EVENT 8/* * Host-MPCC interface block. */struct mblok { u_char mb_status; /* mpcc status */ u_char mb_ivec; /* host interrupt vector */ u_short mb_magic; u_char mb_diagswitch[2]; /* run diagnostics/application */ u_char mb_softerr; /* soft error code */ u_char mb_harderr; /* hard error code */ struct mpdl { /* download/config area */ u_char mpdl_status; /* control/status */ u_char mpdl_cmd; /* request type */ u_short mpdl_count; /* size of parameter block */ caddr_t mpdl_data; /* command parameters */ } mb_dl; u_char mb_hiport, mb_loport; /* high-low mpcc port numbers */ u_char mb_unit; /* mpcc unit number */ u_char mb_hndshk; /* handshaking timer */ caddr_t mb_imokclk; /* handshaking clock */ u_char mb_nointcnt; /* no interrupt from handshake */ u_char mb_mpintcnt; /* # outstanding interupts to MPCC */ short mb_unused; caddr_t mb_mpintclk; /* MPCC interrupt clock */ struct his mb_hostint; /* To Talk with Host */ u_char mb_proto[MPMAXPORT]; /* per-port protocols */ u_char mb_intr[MPMAXPORT]; /* per-port host->mpcc int flags */ struct mpport { /* per-port structure */ u_short mp_proto; /* protocol of port */ u_char mp_on; /* Next available entry on Host */ u_char mp_off; /* Next expected 'DONE' entry on Host */ struct mpevent mp_recvq[MPINSET]; /* queue of events to host */ struct mpevent mp_sendq[MPOUTSET];/* queue of events to mpcc */ u_char mp_nextrcv; /* next expected 'DONE' entry on Host */ u_char mp_flags; /* host flags */ short mp_unused; caddr_t mp_data; /* pointer to data for port */ } mb_port[MPMAXPORT];};/* status defines for mblok.status */#define MP_DLPEND 1#define MP_DLOPEN 2#define MP_DLDONE 3#define MP_OPCLOSE 4#define MP_OPOPEN 5#define MP_DLTIME 6#define MP_DLERROR (-1)/* hard error status values loaded into mblock.herr */#define NOHERR 0 /* no error */#define MPBUSERR 1 /* bus error */#define ADDRERR 2 /* address error */#define UNDECC 3 /* undefined ecc interrupt */#define UNDINT 4 /* undefined interrupt */#define PWRFL 5 /* power fail occurred */#define NOXENTRY 6 /* xdone was enterred w/o xmit entry on queue */#define TWOFTMRS 7 /* tried to start two fast timers on one port */#define INTQFULL 8 /* interupt queue full */#define INTQERR 9 /* interupt queue ack error */#define CBPERR 10 /* uncorrectable DMA parity error */#define ACPDEAD 11 /* acap has died *//* additional panic codes not listed *//* soft error status values loaded into mblock.serr */#define NOSERR 0 /* no error */#define DMAPERR 1 /* dma parity error */#define ECCERR 2 /* local memory ecc error *//* Defines for flags */#define MP_PROGRESS 1 /* Open or Close is in progress */#define MP_IOCTL 2 /* IOCTL is in progress */#define MP_REMBSY 4 /* remote station busy *//* * Asynchronous Terminal Protocol Definitions. */#define A_RCVTIM 2 /* default max tix for receive event (~20ms) */#define ACPTMR 300 /* approx. 5 secs to wait for acap */#define A_MAXEVTP 3 /* maximum # of L1 or Host Events to */ /* process per port at one time */#define A_MAXRCV 128 /* max # of chars in rcv event - enough */ /* to hold 20ms of chars at 19.2KB */#define A_NUMRCV 32 /* number of rcv buffers per port */#define A_NUMXMT 2 /* max number of concurrent xmits/port */#define A_NUMEVT 32 /* number of evt bufs for status evts */ /* and L2 to L1 transmit evts */#define WR5 5 /* SCC Write Reg 5 */#define TXENBL 0x08 /* mask to enable transmitter in WR 5 */#define RTSON 0x02 /* mask to turn on RTS in wreg 5 */#define CHR5MSK 0x1F /* mask for 5-bit transmit data */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -