1 /* $OpenBSD: ueaglereg.h,v 1.2 2005/04/19 08:21:47 damien Exp $ */ 2 3 /*- 4 * Copyright (c) 2003-2005 5 * Damien Bergamini <damien.bergamini@free.fr> 6 * 7 * Permission to use, copy, modify, and distribute this software for any 8 * purpose with or without fee is hereby granted, provided that the above 9 * copyright notice and this permission notice appear in all copies. 10 * 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 /* OPTN: default values from analog devices */ 21 #ifndef UEAGLE_OPTN0 22 #define UEAGLE_OPTN0 0x80020066 23 #endif 24 #ifndef UEAGLE_OPTN2 25 #define UEAGLE_OPTN2 0x23700000 26 #endif 27 #ifndef UEAGLE_OPTN7 28 #define UEAGLE_OPTN7 0x02cd8044 29 #endif 30 31 #define UEAGLE_CONFIG_NO 1 32 33 #define UEAGLE_INTR_IFACE_NO 0 34 #define UEAGLE_US_IFACE_NO 1 35 #define UEAGLE_DS_IFACE_NO 2 36 37 #define UEAGLE_ESISTR 4 38 39 #define UEAGLE_TX_PIPE 0x02 40 #define UEAGLE_IDMA_PIPE 0x04 41 #define UEAGLE_INTR_PIPE 0x84 42 #define UEAGLE_RX_PIPE 0x88 43 44 #define UEAGLE_REQUEST 0 45 46 #define UEAGLE_SETBLOCK 0x0001 47 #define UEAGLE_SETMODE 0x0003 48 #define UEAGLE_SET2183DATA 0x0004 49 50 #define UEAGLE_LOOPBACKOFF 0x0002 51 #define UEAGLE_LOOPBACKON 0x0003 52 #define UEAGLE_BOOTIDMA 0x0006 53 #define UEAGLE_STARTRESET 0x0007 54 #define UEAGLE_ENDRESET 0x0008 55 #define UEAGLE_SWAPMAILBOX 0x7fcd 56 #define UEAGLE_MPTXSTART 0x7fce 57 #define UEAGLE_MPTXMAILBOX 0x7fd6 58 #define UEAGLE_MPRXMAILBOX 0x7fdf 59 60 /* block within a firmware page */ 61 struct ueagle_block_info { 62 uWord wHdr; 63 #define UEAGLE_BLOCK_INFO_HDR 0xabcd 64 65 uWord wAddress; 66 uWord wSize; 67 uWord wOvlOffset; 68 uWord wOvl; /* overlay */ 69 uWord wLast; 70 } UPACKED; 71 72 /* CMV (Configuration and Management Variable) */ 73 struct ueagle_cmv { 74 uWord wPreamble; 75 #define UEAGLE_CMV_PREAMBLE 0x535c 76 77 uByte bDst; 78 #define UEAGLE_HOST 0x01 79 #define UEAGLE_MODEM 0x10 80 81 uByte bFunction; 82 #define UEAGLE_CR 0x10 83 #define UEAGLE_CW 0x11 84 #define UEAGLE_CR_ACK 0x12 85 #define UEAGLE_CW_ACK 0x13 86 #define UEAGLE_MODEMREADY 0x71 87 88 uWord wIndex; 89 uDWord dwSymbolicAddress; 90 #define UEAGLE_MAKESA(a, b, c, d) ((c) << 24 | (d) << 16 | (a) << 8 | (b)) 91 #define UEAGLE_CMV_CNTL UEAGLE_MAKESA('C', 'N', 'T', 'L') 92 #define UEAGLE_CMV_DIAG UEAGLE_MAKESA('D', 'I', 'A', 'G') 93 #define UEAGLE_CMV_INFO UEAGLE_MAKESA('I', 'N', 'F', 'O') 94 #define UEAGLE_CMV_OPTN UEAGLE_MAKESA('O', 'P', 'T', 'N') 95 #define UEAGLE_CMV_RATE UEAGLE_MAKESA('R', 'A', 'T', 'E') 96 #define UEAGLE_CMV_STAT UEAGLE_MAKESA('S', 'T', 'A', 'T') 97 98 uWord wOffsetAddress; 99 uDWord dwData; 100 #define UGETDATA(w) ((w)[2] | (w)[3] << 8 | (w)[0] << 16 | (w)[1] << 24) 101 #define USETDATA(w, v) \ 102 ((w)[2] = (uint8_t)(v), \ 103 (w)[3] = (uint8_t)((v) >> 8), \ 104 (w)[0] = (uint8_t)((v) >> 16), \ 105 (w)[1] = (uint8_t)((v) >> 24)) 106 } UPACKED; 107 108 struct ueagle_swap { 109 uByte bPageNo; 110 uByte bOvl; /* overlay */ 111 } UPACKED; 112 113 struct ueagle_intr { 114 uByte bType; 115 uByte bNotification; 116 uWord wValue; 117 uWord wIndex; 118 uWord wLength; 119 uWord wInterrupt; 120 #define UEAGLE_INTR_SWAP 1 121 #define UEAGLE_INTR_CMV 2 122 } UPACKED; 123 124 #define UEAGLE_INTR_MAXSIZE 28 125