1 /******************************************************************************
2 ** File Name: common.h *
3 ** Author: Daniel.Ding *
5 ** Copyright: 2005 Spreatrum, Incoporated. All Rights Reserved. *
7 ******************************************************************************/
8 /******************************************************************************
10 **---------------------------------------------------------------------------*
11 ** DATE NAME DESCRIPTION *
12 ** 3/25/2005 Daniel.Ding Create. *
13 ******************************************************************************/
16 /*----------------------------------------------------------------------------*
18 **-------------------------------------------------------------------------- */
20 #include "sc_fdl_reg.h"
21 #include "usb200_fdl.h"
24 /**---------------------------------------------------------------------------*
26 **---------------------------------------------------------------------------*/
31 /**----------------------------------------------------------------------------*
33 **----------------------------------------------------------------------------*/
34 #define USB_RECV_LIMIT (2048)
35 #define TABLE_MAX_NUM (64)
36 /**----------------------------------------------------------------------------*
38 **----------------------------------------------------------------------------*/
39 /**----------------------------------------------------------------------------*
41 **----------------------------------------------------------------------------*/
50 typedef struct usb_rx_data_tag
56 } usb_rx_data, *usb_rx_data_ptr;
58 typedef struct USB_rx_buf_tag
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 **----------------------------------------------------------------------------*/
68 /**----------------------------------------------------------------------------*
69 ** Function Prototype **
70 **----------------------------------------------------------------------------*/
71 /*****************************************************************************/
73 // Global resource dependence:
74 // Author: Daniel.Ding
76 /*****************************************************************************/
77 void USB_Init (unsigned long ext_clk26M);
78 /*****************************************************************************/
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 /*****************************************************************************/
88 // Global resource dependence:
89 // Author: Daniel.Ding
90 // Note: Call this function to stop all USB actions .
91 /*****************************************************************************/
92 void USB_Disable (void);
94 /*****************************************************************************/
96 // Global resource dependence:
97 // Author: Daniel.Ding
99 /*****************************************************************************/
100 uint16 WSwapHL (uint16 Word);
101 /*****************************************************************************/
103 // Global resource dependence:
104 // Author: Daniel.Ding
106 /*****************************************************************************/
107 uint32 DWSwapHL (uint32 DWord);
109 /*****************************************************************************/
111 // Global resource dependence:
112 // Author: Daniel.Ding
114 /*****************************************************************************/
115 int USB_EP0InDmaReq (int *pBuf,short len);
118 /*****************************************************************************/
120 // Global resource dependence:
121 // Author: Daniel.Ding
123 /*****************************************************************************/
124 BOOLEAN USB_EP0Config (void);
126 /*****************************************************************************/
128 // Global resource dependence:
129 // Author: Daniel.Ding
131 /*****************************************************************************/
132 BOOLEAN USB_EP1Config (void);
134 /*****************************************************************************/
136 // Global resource dependence:
137 // Author: Daniel.Ding
139 /*****************************************************************************/
140 BOOLEAN USB_EP2Config (void);
142 /*****************************************************************************/
144 // Global resource dependence:
145 // Author: Daniel.Ding
147 /*****************************************************************************/
148 BOOLEAN USB_EP3Config (void);
150 /*****************************************************************************/
152 // Global resource dependence:
153 // Author: Daniel.Ding
155 /*****************************************************************************/
156 int USB_EPxSendData (char ep_id ,unsigned int *pBuf,short len);
158 /*****************************************************************************/
160 // Global resource dependence:
161 // Author: Daniel.Ding
163 /*****************************************************************************/
164 int USB_EPxReceiveData (char ep_id ,unsigned int *pBuf,short len);
166 /*****************************************************************************/
168 // Global resource dependence:
169 // Author: Daniel.Ding
171 /*****************************************************************************/
172 void USB_Ep0_handler (void);
174 /*****************************************************************************/
176 // Global resource dependence:
177 // Author: Daniel.Ding
179 /*****************************************************************************/
180 void USB_Ep1_handler (void);
182 /*****************************************************************************/
184 // Global resource dependence:
185 // Author: Daniel.Ding
187 /*****************************************************************************/
188 void USB_Ep2_handler (void);
190 /*****************************************************************************/
192 // Global resource dependence:
193 // Author: Daniel.Ding
195 /*****************************************************************************/
196 void USB_Ep3_handler (void);
198 /*****************************************************************************/
200 // Global resource dependence:
201 // Author: Daniel.Ding
203 /*****************************************************************************/
204 void USB_Ep4_handler (void);
206 /**----------------------------------------------------------------------------*
208 **----------------------------------------------------------------------------*/
212 /**---------------------------------------------------------------------------*/