BCM WL 6.30.102.9 (r366174)
[tomato.git] / release / src-rt / cfe / cfe / arch / mips / board / bcm1250cpci / include / sl11h.h
blobcea0640528ba42b431d6efe5da4c64eab1d2da63
1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
3 *
4 * BCM1250CPCI USB Driver File: sl11h.h
5 *
6 * USB Include definitions
7 *
8 * Author: Paul Burrell
9 * Parts of code extracted from Scanlogic USB demo driver
11 *********************************************************************
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
16 * This software is furnished under license and may be used and
17 * copied only in accordance with the following terms and
18 * conditions. Subject to these conditions, you may download,
19 * copy, install, use, modify and distribute modified or unmodified
20 * copies of this software in source and/or binary form. No title
21 * or ownership is transferred hereby.
23 * 1) Any source code used, modified or distributed must reproduce
24 * and retain this copyright notice and list of conditions
25 * as they appear in the source file.
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. The "Broadcom Corporation"
29 * name may not be used to endorse or promote products derived
30 * from this software without the prior written permission of
31 * Broadcom Corporation.
33 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
37 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
38 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
43 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
45 * THE POSSIBILITY OF SUCH DAMAGE.
46 ********************************************************************* */
50 unsigned char SL11Read(unsigned char address);
51 void SL11Write(unsigned char address, unsigned char data);
52 void SL11BufRead(short address,unsigned char *buffer, short byte_count);
53 void SL11BufWrite(short address, unsigned char *buffer, short byte_count);
54 int SL11HMemTest(void);
55 void USBReset(void);
56 short uFindUsbDev(unsigned short UsbProd);
57 short uCloseUsbDev(void);
59 typedef struct
61 unsigned char bmRequest,bRequest;
62 unsigned short wValue,wIndex,wLength;
63 } SetupPKG, *PSetupPKG;
65 typedef struct
66 { unsigned char bLength;
67 unsigned char bDescriptorType;
68 unsigned short bcdUSB;
69 unsigned char bDeviceClass;
70 unsigned char bDeviceSubClass;
71 unsigned char bDeviceProtocol;
72 unsigned char bMaxPacketSize0;
73 unsigned short idVendor;
74 unsigned short idProduct;
75 unsigned short bcdDevice;
76 unsigned char iManufacturer;
77 unsigned char iProduct;
78 unsigned char iSerialNumber;
79 unsigned char bNumConfigurations;
80 } sDevDesc, *pDevDesc;
82 typedef struct
83 { unsigned char bLength;
84 unsigned char bType;
85 unsigned short wLength;
86 unsigned char bNumIntf;
87 unsigned char bCV;
88 unsigned char bIndex;
89 unsigned char bAttr;
90 unsigned char bMaxPower;
91 } sConfDesc, *pConfDesc;
93 typedef struct
94 { unsigned char bLength;
95 unsigned char bType;
96 unsigned char iNum;
97 unsigned char iAltString;
98 unsigned char bEndPoints;
99 unsigned char iClass;
100 unsigned char iSub;
101 unsigned char iProto;
102 unsigned char iIndex;
103 } sIntfDesc, *pIntfDesc;
105 typedef struct
106 { unsigned char bLength;
107 unsigned char bType;
108 unsigned char bEPAdd;
109 unsigned char bAttr;
110 unsigned short wPayLoad;
111 unsigned char bInterval;
112 } sEPDesc, *pEPDesc;
114 #define SL11_ADDR USBCTL_PHYS // Address from bcm1250cpci.h
115 #define PC_ADDR USBCTL_PHYS // Address from bcm1250cpci.h
116 #define A0_OFFSET 8
117 #define outportb _outp
118 #define inportb _inp
120 /*-------------------------------------------------------------------------
121 * EP0 use for configuration and Vendor Specific command interface
122 *-------------------------------------------------------------------------
124 #define EP0Buf 0x40 /* SL11 memory start at 0x40 */
125 #define EP0Len 0x40 /* Length of config buffer EP0Buf */
126 #define EP1Buf 0x60
127 #define EP1Len 0x40
129 /*-------------------------------------------------------------------------
130 * SL11 memory from 80h-ffh use as ping-pong buffer for endpoint1-endpoint3
131 * These buffers are share for endpoint 1-endpoint 3.
132 * For DMA: endpoint3 will be used
133 *-------------------------------------------------------------------------
135 #define uBufA 0x80 /* buffer A address for DATA0 */
136 #define uBufB 0xc0 /* buffer B address for DATA1 */
137 #define uXferLen 0x40 /* xfer length */
138 #define sMemSize 0xc0 /* Total SL11 memory size */
140 /*-------------------------------------------------------------------------
141 * SL11 Register Control memory map
142 *-------------------------------------------------------------------------
144 #define CtrlReg 0x05
145 #define IntStatus 0x0d
146 #define USBAdd 0x07
147 #define IntEna 0x06
148 #define DATASet 0x0e
149 #define cSOFcnt 0x0f
150 #define cDATASet 0x0e
152 #define sDMACntLow 0x35
153 #define sDMACntHigh 0x36
155 #define IntMask 0x57 /* Reset|DMA|EP0|EP2|EP1 for IntEna */
156 #define HostMask 0x47 /* Host request command for IntStatus */
157 #define ReadMask 0xd7 /* Read mask interrupt for IntStatus */
159 #define EP0Control 0x00
160 #define EP0Address 0x01
161 #define EP0XferLen 0x02
162 #define EP0Status 0x03
163 #define EP0Counter 0x04
165 #define EP1AControl 0x10
166 #define EP1AAddress 0x11
167 #define EP1AXferLen 0x12
168 #define EP1ACounter 0x14
170 #define EP1BControl 0x18
171 #define EP1BAddress 0x19
172 #define EP1BXferLen 0x1a
173 #define EP1BCounter 0x1c
175 #define EP2AControl 0x20
176 #define EP2AAddress 0x21
177 #define EP2AXferLen 0x22
178 #define EP2ACounter 0x24
180 #define EP2BControl 0x28
181 #define EP2BAddress 0x29
182 #define EP2BXferLen 0x2a
183 #define EP2BCounter 0x2c
185 #define EP3AControl 0x30
186 #define EP3AAddress 0x31
187 #define EP3AXferLen 0x32
188 #define EP3ACounter 0x34
190 #define EP3BControl 0x38
191 #define EP3BAddress 0x39
192 #define EP3BXferLen 0x3a
193 #define EP3BCounter 0x3c
195 /*-------------------------------------------------------------------------
196 * Standard Chapter 9 definition
197 *-------------------------------------------------------------------------
199 #define GET_STATUS 0x00
200 #define CLEAR_FEATURE 0x01
201 #define SET_FEATURE 0x03
202 #define SET_ADDRESS 0x05
203 #define GET_DESCRIPTOR 0x06
204 #define SET_DESCRIPTOR 0x07
205 #define GET_CONFIG 0x08
206 #define SET_CONFIG 0x09
207 #define GET_INTERFACE 0x0a
208 #define SET_INTERFACE 0x0b
210 #define DEVICE 0x01
211 #define CONFIGURATION 0x02
212 #define STRING 0x03
213 #define INTERFACE 0x04
214 #define ENDPOINT 0x05
216 /*-------------------------------------------------------------------------
217 * SL11H definition
218 *-------------------------------------------------------------------------
220 #define DATA0_WR 0x07
221 #define DATA1_WR 0x47
222 #define ZDATA0_WR 0x05
223 #define ZDATA1_WR 0x45
224 #define DATA0_RD 0x03
225 #define DATA1_RD 0x43
227 #define PID_SOF 0xA5
228 #define PID_SETUP 0x2d
229 #define PID_IN 0x69
230 #define PID_OUT 0xe1
231 #define MAX_RETRY 0x3FFF
232 //#define TIMEOUT 6000L /* 5 seconds */
233 #define TIMEOUT 100L