Annotation of 43BSDReno/sys/tahoevba/mpreg.h, revision 1.1.1.1

1.1       root        1: /*
                      2:  * Copyright (c) 1988 Regents of the University of California.
                      3:  * All rights reserved.
                      4:  *
                      5:  * This code is derived from software contributed to Berkeley by
                      6:  * Computer Consoles Inc.
                      7:  *
                      8:  * Redistribution is only permitted until one year after the first shipment
                      9:  * of 4.4BSD by the Regents.  Otherwise, redistribution and use in source and
                     10:  * binary forms are permitted provided that: (1) source distributions retain
                     11:  * this entire copyright notice and comment, and (2) distributions including
                     12:  * binaries display the following acknowledgement:  This product includes
                     13:  * software developed by the University of California, Berkeley and its
                     14:  * contributors'' in the documentation or other materials provided with the
                     15:  * distribution and in all advertising materials mentioning features or use
                     16:  * of this software.  Neither the name of the University nor the names of
                     17:  * its contributors may be used to endorse or promote products derived from
                     18:  * this software without specific prior written permission.
                     19:  * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
                     20:  * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
                     21:  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
                     22:  *
                     23:  *     @(#)mpreg.h     7.4 (Berkeley) 6/28/90
                     24:  */
                     25: 
                     26: /*
                     27:  * MPCC Asynchronous Communications Interface.
                     28:  */
                     29: #define MPINTRBASE     0xa0            /* base vector for interupts */
                     30: #define MPMAGIC                1969            /* magic number for mblok */
                     31: #define MPMAXPORT      32              /* maximum number of ports on an MPCC */
                     32: 
                     33: /*
                     34:  * MPCC's are capable of supporting one of a
                     35:  * the protocols listed below.  This driver
                     36:  * supports only the async terminal protocol.
                     37:  */
                     38: #define MPPROTO_UNUSED 0       /* port not in use */
                     39: #define MPPROTO_ASYNC  1       /* async protocol */
                     40: #define MPPROTO_X25    2       /* x25 protocol (unsupported) */
                     41: #define MPPROTO_BISYNC 3       /* bisync protocol (unsupported) */
                     42: #define MPPROTO_SNA    4       /* sna protocol (unsupported) */
                     43: 
                     44: #define NMPPROTO       5       /* max protocols supported by MPCC */
                     45: 
                     46: #define MPINSET                8
                     47: #define MPOUTSET       8
                     48: 
                     49: /*
                     50:  * Host Interface semaphores
                     51:  */
                     52: #define MPSEMA_AVAILABLE       1
                     53: #define MPSEMA_WORK            4
                     54: 
                     55: /*
                     56:  * Host Interface imok values
                     57:  */
                     58: #define MPIMOK_ALIVE   0x01
                     59: #define MPIMOK_DEAD    0x80
                     60: 
                     61: /*
                     62:  * Host Interface Structure
                     63:  */
                     64: struct his {
                     65:        u_char  semaphore;
                     66:        u_char  imok;
                     67:        u_char  brdnum;         /* Virtual brd number for protocol */
                     68:        u_char  unused;
                     69:        struct {
                     70:                u_char  inbdone[MPMAXPORT];     /* Ports w/ inbound completed */
                     71:                u_char  outbdone[MPMAXPORT];    /* Ports w/outbound available */
                     72:                u_int   fill[2];
                     73:        } proto[NMPPROTO];
                     74: };
                     75: 
                     76: #define MPPORT_EOL     0xff            /* end of port list */
                     77: 
                     78: /*
                     79:  * Async host transmit list structure.
                     80:  */
                     81: #define MPXMIT 4       /* # of transmit ptrs/MP_WRITE event */
                     82: 
                     83: struct hxmtl {
                     84:        caddr_t dblock[MPXMIT]; /* ptrs to data blocks */
                     85:        u_short size[MPXMIT];   /* size of each block */
                     86: };
                     87: 
                     88: /*
                     89:  * MPCC asynchronous protocol events.
                     90:  */
                     91: struct mpevent {
                     92:        u_char  ev_status;      /* Go Status */
                     93:        u_char  ev_cmd;         /* Optional Op-code */
                     94:        u_short ev_opts;        /* Optional flags */
                     95:        u_short ev_error;       /* error status returned */
                     96:        u_short ev_flags;       /* optional event flags field */
                     97:        caddr_t ev_params;      /* pointer to event parameters */
                     98:        union {
                     99:                struct  hxmtl *hxl;     /* pointer to host xmit list */
                    100:                u_char  *rcvblk;        /* pointer to receive block */
                    101:        } ev_un;
                    102:        u_short ev_count;       /* # ptrs in xmit list/# receive chars  */
                    103:        u_short ev_unused;      /* round to longword */
                    104:        u_int   ev_unused2;     /* round to size of BSC struct. GROT!! */
                    105: };
                    106: 
                    107: /* defines for ev_status */
                    108: #define EVSTATUS_FREE  0
                    109: #define EVSTATUS_GO    1
                    110: #define EVSTATUS_BUSY  2
                    111: #define EVSTATUS_DONE  4
                    112: 
                    113: /* defines for ev_cmd */
                    114: #define EVCMD_OPEN     1
                    115: #define EVCMD_CLOSE    2
                    116: #define EVCMD_RESET    3
                    117: #define EVCMD_IOCTL    4
                    118: #define EVCMD_WRITE    5
                    119: #define EVCMD_READ     6
                    120: #define EVCMD_STATUS   7
                    121: #define EVCMD_EVENT    8
                    122: 
                    123: /*
                    124:  * Host-MPCC interface block.
                    125:  */
                    126: struct mblok {
                    127:        u_char  mb_status;              /* mpcc status */
                    128:        u_char  mb_ivec;                /* host interrupt vector */
                    129:        u_short mb_magic;
                    130:        u_char  mb_diagswitch[2];       /* run diagnostics/application */
                    131:        u_char  mb_softerr;             /* soft error code */
                    132:        u_char  mb_harderr;             /* hard error code */
                    133:        struct mpdl {           /* download/config area */
                    134:                u_char  mpdl_status;    /* control/status */
                    135:                u_char  mpdl_cmd;       /* request type */
                    136:                u_short mpdl_count;     /* size of parameter block */
                    137:                caddr_t mpdl_data;      /* command parameters */
                    138:        } mb_dl;
                    139:        u_char  mb_hiport, mb_loport;   /* high-low mpcc port numbers */
                    140:        u_char  mb_unit;                /* mpcc unit number */
                    141:        u_char  mb_hndshk;              /* handshaking timer */
                    142:        caddr_t mb_imokclk;             /* handshaking clock */
                    143:        u_char  mb_nointcnt;            /* no interrupt from handshake */
                    144:        u_char  mb_mpintcnt;            /* # outstanding interupts to MPCC */
                    145:        short   mb_unused;
                    146:        caddr_t mb_mpintclk;            /* MPCC interrupt clock */
                    147:        struct  his mb_hostint;         /* To Talk with Host */
                    148:        u_char  mb_proto[MPMAXPORT];    /* per-port protocols */
                    149:        u_char  mb_intr[MPMAXPORT];     /* per-port host->mpcc int flags */
                    150:        struct  mpport {        /* per-port structure */
                    151:                u_short mp_proto;       /* protocol of port */
                    152:                u_char  mp_on;          /* Next available entry on Host */
                    153:                u_char  mp_off;         /* Next expected 'DONE' entry on Host */
                    154:                struct  mpevent mp_recvq[MPINSET]; /* queue of events to host */
                    155:                struct  mpevent mp_sendq[MPOUTSET];/* queue of events to mpcc */
                    156:                u_char  mp_nextrcv;     /* next expected 'DONE' entry on Host */
                    157:                u_char  mp_flags;       /* host flags */
                    158:                short   mp_unused;
                    159:                caddr_t mp_data;        /* pointer to data for port */
                    160:        } mb_port[MPMAXPORT];
                    161: };
                    162: 
                    163: /* status defines for mblok.status */
                    164: #define MP_DLPEND      1
                    165: #define MP_DLOPEN      2
                    166: #define MP_DLDONE      3
                    167: #define MP_OPCLOSE     4
                    168: #define MP_OPOPEN      5
                    169: #define MP_DLTIME      6
                    170: #define MP_DLERROR     (-1)
                    171: 
                    172: /* hard error status values loaded into mblock.herr */
                    173: #define NOHERR         0       /* no error */
                    174: #define MPBUSERR       1       /* bus error */
                    175: #define ADDRERR                2       /* address error */
                    176: #define UNDECC         3       /* undefined ecc interrupt */
                    177: #define UNDINT         4       /* undefined interrupt */
                    178: #define PWRFL          5       /* power fail occurred */
                    179: #define NOXENTRY       6       /* xdone was enterred w/o xmit entry on queue */
                    180: #define TWOFTMRS       7       /* tried to start two fast timers on one port */
                    181: #define INTQFULL       8       /* interupt queue full */
                    182: #define INTQERR                9       /* interupt queue ack error */
                    183: #define CBPERR         10      /* uncorrectable DMA parity error */
                    184: #define ACPDEAD                11      /* acap has died */
                    185: /* additional panic codes not listed */
                    186: 
                    187: /* soft error status values loaded into mblock.serr */
                    188: #define NOSERR 0               /* no error */
                    189: #define DMAPERR        1               /* dma parity error */
                    190: #define ECCERR 2               /* local memory ecc error */
                    191: 
                    192: /* Defines for flags */
                    193: #define MP_PROGRESS    1       /* Open or Close is in progress */
                    194: #define MP_IOCTL       2       /* IOCTL is in progress */
                    195: #define MP_REMBSY      4       /* remote station busy */
                    196: 
                    197: /*
                    198:  * Asynchronous Terminal Protocol Definitions.
                    199:  */
                    200: #define A_RCVTIM       2       /* default max tix for receive event (~20ms) */
                    201: #define ACPTMR         300     /* approx. 5 secs to wait for acap     */
                    202: #define A_MAXEVTP      3       /* maximum # of L1 or Host Events to    */
                    203:                                /* process per port at one time  */
                    204: #define A_MAXRCV       128     /* max # of chars in rcv event - enough */
                    205:                                /* to hold 20ms of chars at 19.2KB      */
                    206: #define A_NUMRCV       32      /* number of rcv buffers per port       */
                    207: #define A_NUMXMT       2       /* max number of concurrent xmits/port  */
                    208: #define A_NUMEVT       32      /* number of evt bufs for status evts   */
                    209:                                /* and L2 to L1 transmit evts      */
                    210: #define WR5    5               /* SCC Write Reg 5                    */
                    211: #define TXENBL 0x08            /* mask to enable transmitter in WR 5   */
                    212: #define RTSON  0x02            /* mask to turn on RTS in wreg 5        */
                    213: #define CHR5MSK        0x1F            /* mask for 5-bit transmit data  */
                    214: 
                    215: /*
                    216:  * macro to adjust a circular buffer ptr
                    217:  *      x  = pointer or index
                    218:  *      sz = size of circular buffer
                    219:  */
                    220: #define adjptr(x,sz)   ((x) = ((++(x) == (sz)) ? 0 : (x)))
                    221: #define adjptrbk(x,sz) ((x) = ((x) == 0) ? (sz) : --(x))
                    222: 
                    223: /*
                    224:  * Events from ASYNC Level 1 to Level 2
                    225:  */
                    226: #define RCVDTA 10      /* normal receive data available */
                    227: #define PARERR 11      /* receive data with parity error */
                    228: #define OVRNERR        12      /* receive data with overrun error */
                    229: #define OVFERR 13      /* receive data with overflow error */
                    230: #define FRAMERR        14      /* receive data with framing error */
                    231: #define ACKXMT 15      /* successful completion of transmit */
                    232: #define NORBUF 16      /* No Receive Buffers available  */
                    233: #define NOEBUF 17      /* No Event Buffers available */
                    234: #define BRKASRT        18      /* Break condition detected */
                    235: 
                    236: /* defines for error conditions */
                    237: #define A_OK           0       /* No Errors */
                    238: #define A_INVEVT       1       /* Invalid Event Error */
                    239: #define A_IOCERR       2       /* Error while configuring port */
                    240: #define A_SIZERR       3       /* Error in count of data chars to xmt */
                    241: #define A_NXBERR       4       /* Transmit Incomplete due to lack of bufs */
                    242: 
                    243: /*
                    244:  * Modem control signal control structure.
                    245:  */
                    246: struct mdmctl {
                    247:        u_char  mc_rngdsr;      /* ring or dsr */
                    248:        u_char  mc_rts;         /* request to send */
                    249:        u_char  mc_rate;
                    250:        u_char  mc_dcd;         /* data carrier detect */
                    251:        u_char  mc_sectx;       /* secondary transmit */
                    252:        u_char  mc_cts;         /* clear to send */
                    253:        u_char  mc_secrx;       /* secondary receive */
                    254:        u_char  mc_dtr;         /* data terminal ready */
                    255: };
                    256: 
                    257: /* defines for modem control lines */
                    258: #define ASSERT 1               /* line asserted */
                    259: #define DROP   2               /* line dropped */
                    260: #define AUTO   3               /* auto mode enabled, rts only */
                    261: 
                    262: /*
                    263:  * Async parameter structure.
                    264:  */
                    265: struct asyncparam {
                    266:        u_char  ap_xon, ap_xoff;        /* xon-xoff characters */
                    267:        u_char  ap_xena;                /* xon/xoff enabled */
                    268:        u_char  ap_xany;                /* any received char enables xmitter */
                    269:        struct  mdmctl ap_modem;        /* port modem control lines */
                    270:        struct  mdmctl ap_intena;       /* modem signals which generate */
                    271:                                        /* status change events */
                    272:        u_char  ap_data;                /* number of data bits */
                    273:        u_char  ap_stop;                /* number of stop bits */
                    274:        u_char  ap_baud;                /* baud rate */
                    275:        u_char  ap_parity;              /* even/odd/no parity */
                    276:        u_char  ap_loop;                /* enable for local loopback */
                    277:        u_char  ap_rtimer;              /* receive timer value (msec) */
                    278:        short   ap_fill;                /* round to longword */
                    279: };
                    280: 
                    281: /* enable/disable signal codes */
                    282: #define MPA_ENA        1               /* condition enabled */
                    283: #define MPA_DIS        2               /* condition disabled */
                    284: 
                    285: /* defines for ap_data */
                    286: #define MPCHAR_5       0       /* 5 bits per character */
                    287: #define MPCHAR_6       2       /* 6 bits per character */
                    288: #define MPCHAR_7       1       /* 7 bits per character */
                    289: #define MPCHAR_8       3       /* 8 bits per character */
                    290: 
                    291: /* defines for ap_stop */
                    292: #define MPSTOP_1       1       /* 1 stop bit per character */
                    293: #define MPSTOP_1_5     2       /* 1 1/2 stop bits per character */
                    294: #define MPSTOP_2       3       /* 2 stop bits per character */
                    295: 
                    296: /* defines for ap_baud */
                    297: #define MODEM  0
                    298: #define M0     0               /* baud rate = 0 */
                    299: #define M50    1               /* baud rate = 50 */
                    300: #define M75    2               /* baud rate = 75 */
                    301: #define M110   3               /* baud rate = 110 */
                    302: #define M134_5 4               /* baud rate = 134.5 */
                    303: #define M150   5               /* baud rate = 150 */
                    304: #define M200   6               /* baud rate = 200 */
                    305: #define M300   7               /* baud rate = 300 */
                    306: #define M600   8               /* baud rate = 600 */
                    307: #define M1200  9               /* baud rate = 1200 */
                    308: #define M1800  10              /* baud rate = 1800 */
                    309: #define M2400  11              /* baud rate = 2400 */
                    310: #define M4800  12              /* baud rate = 4800 */
                    311: #define M9600  13              /* baud rate = 9600 */
                    312: #define MEXTA  14              /* baud rate = Ext A */
                    313: #define MEXTB  15              /* baud rate = Ext B */
                    314: #define M2000  16              /* baud rate = 2000 */
                    315: #define M3600  17              /* baud rate = 3600 */
                    316: #define M7200  18              /* baud rate = 7200 */
                    317: #define M19200 19              /* baud rate = 19,200 */
                    318: #define M24000 20              /* baud rate = 24,000 */
                    319: #define M28400 21              /* baud rate = 28,400 */
                    320: #define M37800 22              /* baud rate = 37,800 */
                    321: #define M40300 23              /* baud rate = 40,300 */
                    322: #define M48000 24              /* baud rate = 48,000 */
                    323: #define M52000 25              /* baud rate = 52,000 */
                    324: #define M56800 26              /* baud rate = 56,800 */
                    325: 
                    326: /* defines for ap_parity */
                    327: #define MPPAR_NONE     0       /* no parity */
                    328: #define MPPAR_ODD      1       /* odd parity */
                    329: #define MPPAR_EVEN     3       /* even parity */
                    330: 
                    331: /* possible flags for Host MP_IOCTL Events */
                    332: #define A_CHGX         1       /* IOCTL is only chging xonxoff params */
                    333: #define A_MDMCHG       2       /* change modem control lines */
                    334: #define A_MDMGET       3       /* get current state of modem ctl lines */
                    335: #define A_CHGL1P       4       /* IOCTL is changing changing L1 params */
                    336: #define A_BRKON                5       /* set port break bit */
                    337: #define A_BRKOFF       6       /* clear port break bit */
                    338: #define A_CHGALL       7       /* IOCTL is changing xonxoff params, */
                    339:                                /* pcnfg struct, & modem ctl structs */
                    340: #define A_DISABX       8       /* disable port transmitter (ctl-s) */
                    341: #define A_ENABLX       9       /* enable port transmitter (ctl-q) */
                    342: 
                    343: /* possible flags for Host MP_WRITE Events */
                    344: #define A_FLUSH                1       /* flush any queued transmit events */
                    345: #define A_SSTOP                2       /* transmit a port stop (xoff) char */
                    346:                                /* before sending rest of event xmts */
                    347: #define A_SSTART       3       /* transmit a port start (xon) char */
                    348:                                /* before sending rest of event xmts */
                    349: 
                    350: /* possible flags for Outbound MP_READ Events */
                    351: #define A_XOFF         1       /* transmitter stopped from by xoff char */
                    352: 
                    353: /* Perpos flags for modem control fields */
                    354: #define A_RNGDSR       00001
                    355: #define A_RTS          00002
                    356: #define A_RATE         00004 
                    357: #define A_DCD          00010
                    358: #define A_SECTX                00020 
                    359: #define A_CTS          00040
                    360: #define A_SECRX                00100
                    361: #define A_DTR          00200
                    362: 
                    363: #define DCDASRT                100     /* data carrier detect asserted */
                    364: #define DTRASRT                101     /* data terminal ready asserted */
                    365: #define RNGASRT                102     /* ring indicator asserted */
                    366: #define DSRASRT                102     /* data set ready asserted */
                    367: #define CTSASRT                103     /* clear to send asserted */
                    368: #define RTSASRT                104     /* ready to send asserted */
                    369: #define STXASRT                105     /* secondary transmit asserted */
                    370: #define SRXASRT                106     /* secondary recieve asserted */
                    371: #define RATEASRT       107     /* rate signal asserted */
                    372: #define DCDDROP                108     /* data carrier detect dropped */
                    373: #define DTRDROP                109     /* data terminal ready dropped */
                    374: #define RNGDROP                110     /* ring indicator dropped */
                    375: #define MPDSRDROP      110     /* data set ready dropped */
                    376: #define CTSDROP                111     /* clear to send dropped */
                    377: #define RTSDROP                112     /* ready to send dropped */
                    378: #define STXDROP                113     /* secondary transmit dropped */
                    379: #define SRXDROP                114     /* secondary recieve dropped */
                    380: #define RATEDROP       115     /* rate signal dropped */
                    381: 
                    382: /* Defines for filters and intena in portstat */
                    383: #define MDM_OFF        0
                    384: #define MDM_ON 1
                    385: 
                    386: /* Modem on/off flags */
                    387: #define MMOD_OFF       0
                    388: #define MMOD_ON                1
                    389: 
                    390: /* defintions for DL interface */
                    391: 
                    392: #define MPDLBUFSIZE    1024
                    393: 
                    394: /* mpdlioctl command defines */
                    395: 
                    396: struct protports {
                    397:        char protoport[MPMAXPORT];
                    398: };
                    399: 
                    400: struct abdcf {
                    401:        short xmtbsz;           /* transmit buffer size - should */
                    402:                                /* equal # of chars in a cblock  */
                    403: };
                    404: 
                    405: struct bdcf {
                    406:        char loadname[NMPPROTO+1];
                    407:        char protoports[MPMAXPORT];
                    408:        char fccstimer;         /* powerfail timer */
                    409:        char fccsports;         /* ports to affect */
                    410:        char fccssoc;           /* ports which will 'switch on close' */
                    411: };
                    412: 
                    413: 
                    414: /* These ioctls are for the dlmpcc command */
                    415: #define MPIOPORTMAP            _IOW('m',1, struct protports)
                    416: #define MPIOHILO               _IOW('m',3, short)
                    417: #define MPIOENDCODE            _IO('m',4)
                    418: #define MPIOASYNCNF            _IOW('m',7, struct abdcf)
                    419: #define MPIOENDDL              _IO('m',10)
                    420: #define MPIOSTARTDL            _IO('m',11)
                    421: #define MPIORESETBOARD         _IO('m',12)
                    422: 
                    423: /* mpdlwrite opcode defines */
                    424: 
                    425: #define MPDLCMD_NORMAL 1
                    426: 
                    427: /* error messages printed at console , board & port # filled in later */
                    428: 
                    429: #define A_INVSTS       "Invalid Status Event "
                    430: #define A_INVCMD       "Invalid Event From the MPCC " 
                    431: #define A_NORBUF       "No More Available Receive Buffers "
                    432: #define A_NOEBUF       "No More Available Event Buffers "
                    433: #define A_OVRN         "Overrun Error Detected "
                    434: #define A_OVRF         "Overflow Error Detected "
                    435: #define A_NOXBUF       "No More Available Transmit Event Buffers "
                    436: #define A_XSIZE                "Transmit Data Block Size Exceeds Event Data Buffer Size "
                    437: #define A_NOFREIN      "No Available Inbound Entries to Send Close Event "

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.