Annotation of sys/arch/mvme88k/dev/vxreg.h, Revision 1.1
1.1 ! nbrk 1: /* $OpenBSD: vxreg.h,v 1.9 2006/02/06 17:19:31 jmc Exp $ */
! 2:
! 3: /*
! 4: * Copyright (c) 1999 Steve Murphree, Jr. All rights reserved.
! 5: *
! 6: *
! 7: * Redistribution and use in source and binary forms, with or without
! 8: * modification, are permitted provided that the following conditions
! 9: * are met:
! 10: * 1. Redistributions of source code must retain the above copyright
! 11: * notice, this list of conditions and the following disclaimer.
! 12: * 2. Redistributions in binary form must reproduce the above copyright
! 13: * notice, this list of conditions and the following disclaimer in the
! 14: * documentation and/or other materials provided with the distribution.
! 15: * 3. All advertising materials mentioning features or use of this software
! 16: * must display the following acknowledgement:
! 17: * This product includes software developed by Dale Rahn.
! 18: * 4. The name of the author may not be used to endorse or promote products
! 19: * derived from this software without specific prior written permission.
! 20: *
! 21: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
! 22: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
! 23: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
! 24: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
! 25: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
! 26: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
! 27: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
! 28: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
! 29: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
! 30: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
! 31: */
! 32:
! 33: /* IPC - Intelligent Peripheral Controller */
! 34:
! 35: struct vxreg {
! 36: /*0x0*/volatile u_short ipc_addrh; /* IPC addr reg, most significant */
! 37: /*0x2*/volatile u_short ipc_addrl; /* IPC addr reg, least significant */
! 38: /*0x4*/volatile u_char ipc_amr; /* IPC address modifier reg */
! 39: /*0x5*/volatile u_char unused1;
! 40: /*0x6*/volatile u_short ipc_cr; /* IPC control reg */
! 41: /*0x8*/volatile u_short ipc_sr; /* IPC status reg */
! 42: /*0xA*/volatile u_char ipc_mdbp; /* IPC model data byte pointer */
! 43: /*0xB*/volatile u_char reserved3;
! 44: /*0xC*/volatile u_char ipc_avrp; /* IPC abort vector reg pointer */
! 45: /*0xD*/volatile u_char unused2;
! 46: /*0xE*/volatile u_short ipc_tas; /* IPC test and set reg */
! 47: };
! 48:
! 49: #define IPC_CR_SYSFI 0x1000 /* inhibit sysfail */
! 50: #define IPC_CR_ATTEN 0x2000 /* attention bit */
! 51: #define IPC_CR_RESET 0x4000 /* reset bit */
! 52: #define IPC_CR_BUSY 0x8000 /* busy bit */
! 53:
! 54: #define IPC_SR_BUSERROR 0x4000 /* bus error */
! 55: #define IPC_SR_ERROR 0x8000 /* general error */
! 56: #define IPC_SR_INVAL 0xFFFF /* invalid command */
! 57:
! 58: #define IPC_TAS_COMPLETE 0x1000
! 59: #define IPC_TAS_VALID_STATUS 0x2000
! 60: #define IPC_TAS_VALID_CMD 0x4000
! 61: #define IPC_TAS_TAS 0x8000
! 62:
! 63: #define IPC_CSR_CREATE 0x0001
! 64: #define IPC_CSR_DELETE 0x0002
! 65:
! 66: #define CSW_OFFSET 0x0010
! 67:
! 68: #define CMD_INIT 0x0000
! 69: #define CMD_READW 0x0001
! 70: #define CMD_WRITEW 0x0002
! 71: #define CMD_OPEN 0x0003
! 72: #define CMD_IOCTL 0x0004
! 73: #define CMD_CLOSE 0x0005
! 74: #define CMD_EVENT 0x0006
! 75: #define CMD_PROCESSED 0x00FF
! 76:
! 77: #define IOCTL_LDOPEN 0x4400
! 78: #define IOCTL_LDCLOSE 0x4401
! 79: #define IOCTL_LDCHG 0x4402
! 80: #define IOCTL_LDGETT 0x4408
! 81: #define IOCTL_LDSETT 0x4409
! 82: #define IOCTL_TCGETA 0x5401 /* get dev termio struct */
! 83: #define IOCTL_TCSETA 0x5402 /* set dev termio struct */
! 84: #define IOCTL_TCSETAW 0x5403 /* set dev termio struct - wait */
! 85: #define IOCTL_TCSETAF 0x5404 /* set dev termio struct - wait - flush */
! 86: #define IOCTL_TCSBRK 0x5405 /* transmit a break seq */
! 87: #define IOCTL_TCXONC 0x5406 /* sus or res, xon or xoff, RTS or DTR */
! 88: #define IOCTL_TCFLSH 0x5407 /* Flush */
! 89: #define IOCTL_TCSETHW 0x5440 /* enable/disable HW handshake */
! 90: #define IOCTL_TCGETHW 0x5441 /* get current HW handshake info */
! 91: #define IOCTL_TCGETDL 0x5442 /* get daownloadable addr and mem size */
! 92: #define IOCTL_TCDLOAD 0x5443 /* download code/data to mem */
! 93: #define IOCTL_TCLINE 0x5444 /* copy line discipline */
! 94: #define IOCTL_TCEXEC 0x5445 /* exec code in local mem */
! 95: #define IOCTL_TCGETVR 0x5446 /* get version and revison of firmware */
! 96: #define IOCTL_TCGETDF 0x5447 /* get default termio struct */
! 97: #define IOCTL_TCSETDF 0x5448 /* set default termio struct */
! 98: #define IOCTL_TCGETSYM 0x5449 /* get firmware symbol table */
! 99: #define IOCTL_TCWHAT 0x544A /* get all SCSI IDs of FW files */
! 100: #define IOCTL_TIOGETP 0x7408 /* get devs curr termio struct by sgttyb */
! 101: #define IOCTL_TIOSETP 0x7409 /* set devs curr termio struct by sgttyb */
! 102:
! 103: #define IPC_EIO 5 /* I/O error */
! 104: #define IPC_ENXIO 6 /* no such device or address */
! 105: #define IPC_ENOMEM 12 /* not enough space */
! 106: #define IPC_EEXIST 17 /* device or address exists */
! 107: #define IPC_EINVAL 22 /* invalid caommand argument */
! 108:
! 109: /*
! 110: * Index into c_cc[VNCC];
! 111: */
! 112: #define VVINTR 0 /* ISIG */
! 113: #define VVQUIT 1 /* ISIG */
! 114: #define VVERASE 2 /* ICANON */
! 115: #define VVKILL 3 /* ICANON */
! 116: #define VVEOF 4 /* ICANON */
! 117: #define VVEOL 5 /* ICANON */
! 118: #define VVSWTCH 6
! 119:
! 120: /*
! 121: * Input flags - software input processing
! 122: */
! 123: #define VIGNBRK 0000001 /* ignore BREAK condition */
! 124: #define VBRKINT 0000002 /* map BREAK to SIGINTR */
! 125: #define VIGNPAR 0000004 /* ignore (discard) parity errors */
! 126: #define VPARMRK 0000010 /* mark parity and framing errors */
! 127: #define VINPCK 0000020 /* enable checking of parity errors */
! 128: #define VISTRIP 0000040 /* strip 8th bit off chars */
! 129: #define VINLCR 0000100 /* map NL into CR */
! 130: #define VIGNCR 0000200 /* ignore CR */
! 131: #define VICRNL 0000400 /* map CR to NL (ala CRMOD) */
! 132: #define VIUCLC 0001000 /* translate upper to lower case */
! 133: #define VIXON 0002000 /* enable output flow control */
! 134: #define VIXANY 0004000 /* any char will restart after stop */
! 135: #define VIXOFF 0010000 /* enable input flow control */
! 136:
! 137: /*
! 138: * Output flags - software output processing
! 139: */
! 140: #define VOPOST 0000001 /* enable following output processing */
! 141: #define VOLCUC 0000002 /* translate lower case to upper case */
! 142: #define VONLCR 0000004 /* map NL to CR-NL (ala CRMOD) */
! 143: #define VOCRNL 0000010 /* map CR to NL */
! 144: #define VONOCR 0000020 /* No CR output at column 0 */
! 145: #define VONLRET 0000040 /* NL performs the CR function */
! 146: #define VOFILL 0000100
! 147: #define VOFDEL 0000200
! 148: #define VOXTABS 0014000 /* expand tabs to spaces */
! 149:
! 150: /*
! 151: * Control flags - hardware control of terminal
! 152: */
! 153:
! 154: #define VCBAUD 0000017 /* baud rate */
! 155: #define VB0 0000000 /* hang up */
! 156: #define VB50 0000001
! 157: #define VB75 0000002
! 158: #define VB110 0000003
! 159: #define VB134 0000004
! 160: #define VB150 0000005
! 161: #define VB200 0000006
! 162: #define VB300 0000007
! 163: #define VB600 0000010
! 164: #define VB1200 0000011
! 165: #define VB1800 0000012
! 166: #define VB2400 0000013
! 167: #define VB4800 0000014
! 168: #define VB9600 0000015
! 169: #define VB19200 0000016
! 170: #define VB38400 0000017
! 171: #define VEXTA 0000016
! 172: #define VEXTB 0000017
! 173: #define VCSIZE 0000060 /* character size mask */
! 174: #define VCS5 0000000 /* 5 bits (pseudo) */
! 175: #define VCS6 0000020 /* 6 bits */
! 176: #define VCS7 0000040 /* 7 bits */
! 177: #define VCS8 0000060 /* 8 bits */
! 178: #define VCSTOPB 0000100 /* send 2 stop bits */
! 179: #define VCREAD 0000200 /* enable receiver */
! 180: #define VPARENB 0000400 /* parity enable */
! 181: #define VPARODD 0001000 /* odd parity, else even */
! 182: #define VHUPCL 0002000 /* hang up on last close */
! 183: #define VCLOCAL 0004000 /* ignore modem status lines */
! 184:
! 185: /*
! 186: * "Local" flags - dumping ground for other state
! 187: *
! 188: * Warning: some flags in this structure begin with
! 189: * the letter "I" and look like they belong in the
! 190: * input flag.
! 191: */
! 192:
! 193: #define VISIG 0000001 /* enable signals INTR, QUIT, [D]SUSP */
! 194: #define VICANON 0000002 /* canonicalize input lines */
! 195: #define VXCASE 0000004 /* canonical upper/lower case */
! 196: #define VECHO 0000010 /* enable echoing */
! 197: #define VECHOE 0000020 /* visually erase chars */
! 198: #define VECHOK 0000040 /* echo NL after line kill */
! 199: #define VECHONL 0000100 /* echo NL even if ECHO is off */
! 200: #define VNOFLSH 0000200 /* don't flush after interrupt */
! 201:
! 202:
! 203: #define VNCC 9 /* 18 bytes */
! 204: struct termio {
! 205: volatile unsigned short c_iflag;
! 206: volatile unsigned short c_oflag;
! 207: volatile unsigned short c_cflag;
! 208: volatile unsigned short c_lflag;
! 209: volatile char c_line;
! 210: volatile unsigned char c_cc[VNCC];
! 211: };
! 212:
! 213: struct vx_sgttyb { /* 6 bytes */
! 214: volatile char sg_ispeed;
! 215: volatile char sg_ospeed;
! 216: volatile char sg_erase;
! 217: volatile char sg_kill;
! 218: volatile short sg_flags;
! 219: };
! 220:
! 221: struct termcb { /* 6 bytes */
! 222: volatile char st_flgs;
! 223: volatile char st_termt;
! 224: volatile char st_crow;
! 225: volatile char st_ccol;
! 226: volatile char st_vrow;
! 227: volatile char st_lrow;
! 228: };
! 229:
! 230: struct ctdesc {
! 231: unsigned short csw,
! 232: resv;
! 233: unsigned long magic,
! 234: lcnt,
! 235: fatal,
! 236: error,
! 237: faddr,
! 238: expdata,
! 239: readdata;
! 240: };
! 241:
! 242: struct dl_info { /* 18 bytes */
! 243: volatile unsigned long host_addr;
! 244: volatile unsigned long ipc_addr;
! 245: volatile unsigned long count;
! 246: volatile unsigned long extra_long;
! 247: volatile unsigned short extra_short;
! 248: };
! 249:
! 250: struct packet { /* 68 bytes */
! 251: volatile u_long link; /* was eyecatcher */
! 252: volatile u_char command_pipe_number;
! 253: volatile u_char status_pipe_number;
! 254: volatile char filler0[4];
! 255: volatile short command;
! 256: volatile char filler1[1];
! 257: volatile char command_dependent;
! 258: volatile char filler2[1];
! 259: volatile char interrupt_level; /* init only */
! 260: volatile u_char device_number;
! 261: volatile char filler3[1];
! 262: volatile u_short ioctl_cmd_h;
! 263: volatile u_short ioctl_cmd_l;
! 264: #define init_info_ptr_h ioctl_cmd_h
! 265: #define init_info_ptr_l ioctl_cmd_l
! 266: volatile u_short ioctl_arg_h;
! 267: volatile u_short ioctl_arg_l;
! 268: volatile u_short ioctl_mode_h;
! 269: volatile u_short ioctl_mode_l;
! 270: #define interrupt_vec ioctl_mode_l
! 271: volatile char filler4[6];
! 272: volatile u_short error_h;
! 273: volatile u_short error_l;
! 274: volatile short event_code;
! 275: volatile char filler5[6];
! 276: union {
! 277: struct termio tio;
! 278: struct termcb tcb;
! 279: struct vx_sgttyb sgt;
! 280: struct dl_info dl;
! 281: long param;
! 282: } pb;
! 283: short reserved; /* for alignment */
! 284: } packet;
! 285:
! 286: struct envelope { /* 12 bytes */
! 287: volatile u_long link;
! 288: volatile u_long packet_ptr;
! 289: volatile char valid_flag;
! 290: volatile char reserved1;
! 291: volatile char reserved[2];
! 292: };
! 293:
! 294: struct channel { /* 24 bytes */
! 295: volatile u_short command_pipe_head_ptr_h;
! 296: volatile u_short command_pipe_head_ptr_l;
! 297: volatile u_short command_pipe_tail_ptr_h;
! 298: volatile u_short command_pipe_tail_ptr_l;
! 299: volatile u_short status_pipe_head_ptr_h;
! 300: volatile u_short status_pipe_head_ptr_l;
! 301: volatile u_short status_pipe_tail_ptr_h;
! 302: volatile u_short status_pipe_tail_ptr_l;
! 303: volatile char interrupt_level;
! 304: volatile char interrupt_vec;
! 305: volatile char channel_priority;
! 306: volatile char address_modifier;
! 307: volatile char channel_number;
! 308: volatile char valid;
! 309: volatile char datasize;
! 310: volatile char reserved;
! 311: };
! 312:
! 313: #define WRING_DATA_SIZE 4096 /* for a total struct size of 4104 (4K + 6 + 2 bytes) */
! 314: #define WRING_BUF_SIZE WRING_DATA_SIZE
! 315: struct wring {
! 316: volatile unsigned short reserved;
! 317: volatile unsigned short put;
! 318: volatile unsigned short get;
! 319: volatile char data[WRING_BUF_SIZE];
! 320: char res[2]; /* for alignment */
! 321: };
! 322:
! 323: #define RRING_DATA_SIZE 2048 /* for a total struct size of 2054 (2K + 6 + 2 bytes) */
! 324: #define RRING_BUF_SIZE RRING_DATA_SIZE
! 325: struct rring {
! 326: volatile unsigned short reserved;
! 327: volatile unsigned short put;
! 328: volatile unsigned short get;
! 329: volatile char data[RRING_BUF_SIZE];
! 330: char res[2]; /* for alignment */
! 331: };
! 332:
! 333: #define EOFRAME 0xA
! 334: #define DELIMITER 0x1
! 335:
! 336: struct init_info { /* 88 bytes */
! 337: volatile u_short write_ring_ptr_h;
! 338: volatile u_short write_ring_ptr_l;
! 339: volatile u_short read_ring_ptr_h;
! 340: volatile u_short read_ring_ptr_l;
! 341: volatile unsigned short write_ring_size;
! 342: volatile unsigned short read_ring_size;
! 343: volatile struct termio def_termio;
! 344: volatile unsigned short reserved1;
! 345: volatile unsigned short reserved2;
! 346: volatile unsigned short reserved3;
! 347: volatile unsigned short reserved4;
! 348: volatile char init_data[56];
! 349: };
! 350:
! 351: /* IPC event codes */
! 352: #define E_INTR 0x0001
! 353: #define E_QUIT 0x0002
! 354: #define E_HUP 0x0004
! 355: #define E_DCD 0x0008
! 356: #define E_DSR 0x0010
! 357: #define E_CTS 0x0020
! 358: #define E_LOST_DCD 0x0040
! 359: #define E_LOST_DSR 0x0080
! 360: #define E_LOST_CTS 0x0100
! 361: #define E_PR_FAULT 0x0200
! 362: #define E_PR_POUT 0x0400
! 363: #define E_PR_SELECT 0x0800
! 364: #define E_SWITCH 0x4000
! 365: #define E_BREAK 0x8000
! 366:
! 367: /*
! 368: * All structures must reside in dual port user memory.
! 369: * ($FFxx0100 to $FFxxFFF0)
! 370: * All structures must be word aligned (see byte counts above)
! 371: *
! 372: * +--------------------------------+
! 373: * | IPC Control/Status Register | $FFxx0000
! 374: * | (16 bytes) |
! 375: * |--------------------------------|
! 376: * | Confidence Test Descriptor | $FFxx0010
! 377: * | (32 bytes) |
! 378: * |--------------------------------|
! 379: * | Dump Area | $FFxx0030
! 380: * | (208 bytes) |
! 381: * |--------------------------------|
! 382: * | | $FFxx0100
! 383: * | |
! 384: * : User Space :
! 385: * : :
! 386: * : (65,264 bytes) :
! 387: * | |
! 388: * | |
! 389: * |--------------------------------|
! 390: * | Interrupt Vector Registers | $FFxxFFF0
! 391: * | (16 bytes) |
! 392: * +--------------------------------+
! 393: */
! 394:
! 395: #define NVXPORTS 9
! 396:
! 397: #define NENVELOPES 30
! 398: #define NPACKETS NENVELOPES
! 399: #define USER_AREA (0x0100)
! 400: #define CHANNEL_H (0x0100)
! 401: #define ENVELOPE_AREA (CHANNEL_H + sizeof(struct channel))
! 402: #define ENVELOPE_AREA_SIZE (NENVELOPES * sizeof(struct envelope))
! 403: #define PACKET_AREA (ENVELOPE_AREA + ENVELOPE_AREA_SIZE)
! 404: #define PACKET_AREA_SIZE (NPACKETS * sizeof(struct packet))
! 405: #define INIT_INFO_AREA (PACKET_AREA + PACKET_AREA_SIZE)
! 406: #define INIT_INFO_AREA_SIZE (NVXPORTS * sizeof(struct init_info))
! 407: #define WRING_AREA roundup(INIT_INFO_AREA + INIT_INFO_AREA_SIZE, 8)
! 408: #define WRING_AREA_SIZE (NVXPORTS * sizeof(struct wring))
! 409: #define RRING_AREA (WRING_AREA + WRING_AREA_SIZE)
! 410: #define RRING_AREA_SIZE (NVXPORTS * sizeof(struct rring))
! 411: #define USER_AREA_SIZE (RRING_AREA + RRING_AREA_SIZE - USER_AREA)
! 412:
! 413: /* Hardware's view of the dual ported memory */
! 414: #define LOCAL_DPMEM_ADDRESS 0x00f30000
CVSweb