1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
4 * BCM1250CPCI USB Driver File: sl11h.h
6 * USB Include definitions
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);
56 short uFindUsbDev(unsigned short UsbProd
);
57 short uCloseUsbDev(void);
61 unsigned char bmRequest
,bRequest
;
62 unsigned short wValue
,wIndex
,wLength
;
63 } SetupPKG
, *PSetupPKG
;
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
;
83 { unsigned char bLength
;
85 unsigned short wLength
;
86 unsigned char bNumIntf
;
90 unsigned char bMaxPower
;
91 } sConfDesc
, *pConfDesc
;
94 { unsigned char bLength
;
97 unsigned char iAltString
;
98 unsigned char bEndPoints
;
101 unsigned char iProto
;
102 unsigned char iIndex
;
103 } sIntfDesc
, *pIntfDesc
;
106 { unsigned char bLength
;
108 unsigned char bEPAdd
;
110 unsigned short wPayLoad
;
111 unsigned char bInterval
;
114 #define SL11_ADDR USBCTL_PHYS // Address from bcm1250cpci.h
115 #define PC_ADDR USBCTL_PHYS // Address from bcm1250cpci.h
117 #define outportb _outp
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 */
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 *-------------------------------------------------------------------------
145 #define IntStatus 0x0d
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
211 #define CONFIGURATION 0x02
213 #define INTERFACE 0x04
214 #define ENDPOINT 0x05
216 /*-------------------------------------------------------------------------
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
228 #define PID_SETUP 0x2d
231 #define MAX_RETRY 0x3FFF
232 //#define TIMEOUT 6000L /* 5 seconds */