90fe94d24945a83d8300d50c5e4cb268cd54347e
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-tiger / drv_usb.h
1 /******************************************************************************
2  ** File Name:    common.h                                                    *
3  ** Author:       Daniel.Ding                                                 *
4  ** DATE:         3/25/2005                                                    *
5  ** Copyright:    2005 Spreatrum, Incoporated. All Rights Reserved.           *
6  ** Description:                                                              *
7  ******************************************************************************/
8 /******************************************************************************
9  **                   Edit    History                                         *
10  **---------------------------------------------------------------------------*
11  ** DATE          NAME            DESCRIPTION                                 *
12  ** 3/25/2005      Daniel.Ding     Create.                                     *
13  ******************************************************************************/
14 #ifndef _USB_
15 #define _USB_
16 /*----------------------------------------------------------------------------*
17  **                         Dependencies                                      *
18  **-------------------------------------------------------------------------- */
19 #include "common.h"
20 #include "sc_fdl_reg.h"
21 #include "usb200_fdl.h"
22 #include "fdl_conf.h"
23
24 /**---------------------------------------------------------------------------*
25  **                             Compiler Flag                                 *
26  **---------------------------------------------------------------------------*/
27 #ifdef   __cplusplus
28 extern   "C"
29 {
30 #endif
31 /**----------------------------------------------------------------------------*
32 **                               Micro Define                                 **
33 **----------------------------------------------------------------------------*/
34 #define USB_RECV_LIMIT  (2048)
35 #define TABLE_MAX_NUM       (64)
36 /**----------------------------------------------------------------------------*
37 **                             Data Prototype                                 **
38 **----------------------------------------------------------------------------*/
39 /**----------------------------------------------------------------------------*
40 **                             Data Prototype                                 **
41 **----------------------------------------------------------------------------*/
42 typedef enum
43 {
44     NONE,
45     TIME_OUT,
46     MAX_ERROR_CODE
47 }
48 USB_ERROR_E;
49
50 typedef struct usb_rx_data_tag
51 {
52     unsigned int *start;
53     unsigned int *end;
54     short         remain;
55     short         total;
56 } usb_rx_data, *usb_rx_data_ptr;
57
58 typedef struct USB_rx_buf_tag
59 {
60     volatile unsigned int  read;
61     volatile unsigned int  write;
62     volatile unsigned char usb_rx_buf[USB_RECV_LIMIT];
63 } USB_rx_buf_T, *USB_rx_buf_P;
64 /**----------------------------------------------------------------------------*
65 **                         Local Function Prototype                           **
66 **----------------------------------------------------------------------------*/
67
68 /**----------------------------------------------------------------------------*
69 **                           Function Prototype                               **
70 **----------------------------------------------------------------------------*/
71 /*****************************************************************************/
72 //  Description:
73 //  Global resource dependence:
74 //  Author:         Daniel.Ding
75 //  Note:
76 /*****************************************************************************/
77 void USB_Init (unsigned long ext_clk26M);
78 /*****************************************************************************/
79 //  Description:
80 //  Global resource dependence:
81 //  Author:         Daniel.Ding
82 //  Note:           USB_Init doesn't enable USB ,
83 //                  must call this function to enable it .
84 /*****************************************************************************/
85 void USB_Enable (void);
86 /*****************************************************************************/
87 //  Description:
88 //  Global resource dependence:
89 //  Author:         Daniel.Ding
90 //  Note:           Call this function to stop all USB actions .
91 /*****************************************************************************/
92 void USB_Disable (void);
93
94 /*****************************************************************************/
95 //  Description:
96 //  Global resource dependence:
97 //  Author:         Daniel.Ding
98 //  Note:
99 /*****************************************************************************/
100 uint16 WSwapHL (uint16 Word);
101 /*****************************************************************************/
102 //  Description:
103 //  Global resource dependence:
104 //  Author:         Daniel.Ding
105 //  Note:
106 /*****************************************************************************/
107 uint32 DWSwapHL (uint32 DWord);
108
109 /*****************************************************************************/
110 //  Description:
111 //  Global resource dependence:
112 //  Author:         Daniel.Ding
113 //  Note:
114 /*****************************************************************************/
115 int USB_EP0InDmaReq (int *pBuf,short len);
116
117
118 /*****************************************************************************/
119 //  Description:
120 //  Global resource dependence:
121 //  Author:         Daniel.Ding
122 //  Note:
123 /*****************************************************************************/
124 BOOLEAN USB_EP0Config (void);
125
126 /*****************************************************************************/
127 //  Description:
128 //  Global resource dependence:
129 //  Author:         Daniel.Ding
130 //  Note:
131 /*****************************************************************************/
132 BOOLEAN USB_EP1Config (void);
133
134 /*****************************************************************************/
135 //  Description:
136 //  Global resource dependence:
137 //  Author:         Daniel.Ding
138 //  Note:
139 /*****************************************************************************/
140 BOOLEAN USB_EP2Config (void);
141
142 /*****************************************************************************/
143 //  Description:
144 //  Global resource dependence:
145 //  Author:         Daniel.Ding
146 //  Note:
147 /*****************************************************************************/
148 BOOLEAN USB_EP3Config (void);
149
150 /*****************************************************************************/
151 //  Description:
152 //  Global resource dependence:
153 //  Author:         Daniel.Ding
154 //  Note:
155 /*****************************************************************************/
156 int USB_EPxSendData (char ep_id ,unsigned int *pBuf,short len);
157
158 /*****************************************************************************/
159 //  Description:
160 //  Global resource dependence:
161 //  Author:         Daniel.Ding
162 //  Note:
163 /*****************************************************************************/
164 int USB_EPxReceiveData (char ep_id ,unsigned int *pBuf,short len);
165
166 /*****************************************************************************/
167 //  Description:
168 //  Global resource dependence:
169 //  Author:         Daniel.Ding
170 //  Note:
171 /*****************************************************************************/
172 void USB_Ep0_handler (void);
173
174 /*****************************************************************************/
175 //  Description:
176 //  Global resource dependence:
177 //  Author:         Daniel.Ding
178 //  Note:
179 /*****************************************************************************/
180 void USB_Ep1_handler (void);
181
182 /*****************************************************************************/
183 //  Description:
184 //  Global resource dependence:
185 //  Author:         Daniel.Ding
186 //  Note:
187 /*****************************************************************************/
188 void USB_Ep2_handler (void);
189
190 /*****************************************************************************/
191 //  Description:
192 //  Global resource dependence:
193 //  Author:         Daniel.Ding
194 //  Note:
195 /*****************************************************************************/
196 void USB_Ep3_handler (void);
197
198 /*****************************************************************************/
199 //  Description:
200 //  Global resource dependence:
201 //  Author:         Daniel.Ding
202 //  Note:
203 /*****************************************************************************/
204 void USB_Ep4_handler (void);
205
206 /**----------------------------------------------------------------------------*
207 **                         Compiler Flag                                      **
208 **----------------------------------------------------------------------------*/
209 #ifdef   __cplusplus
210 }
211 #endif
212 /**---------------------------------------------------------------------------*/
213 #endif
214 // End