Rev 1 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1 | Rev 196 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /******************** (C) COPYRIGHT 2006 STMicroelectronics ******************** |
1 | /******************** (C) COPYRIGHT 2008 STMicroelectronics ******************** |
2 | * File Name : usb_regs.c |
2 | * File Name : usb_regs.c |
3 | * Author : MCD Application Team |
3 | * Author : MCD Application Team |
- | 4 | * Version : V4.0.0 |
|
4 | * Date First Issued : 10/27/2003 : V1.0 |
5 | * Date : 09/29/2008 |
5 | * Description : Interface functions to USB cell registers |
6 | * Description : Interface functions to USB cell registers. |
6 | ******************************************************************************** |
7 | ******************************************************************************** |
7 | * History: |
- | |
8 | * 09/18/2006 : V3.0 |
- | |
9 | * 09/01/2006 : V2.0 |
- | |
10 | * 10/27/2003 : V1.0 |
- | |
11 | ******************************************************************************** |
- | |
12 | * THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
8 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS |
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
9 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. |
14 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
10 | * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, |
15 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
11 | * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE |
16 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
12 | * CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING |
17 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
13 | * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. |
Line 24... | Line 20... | ||
24 | /* Private macro -------------------------------------------------------------*/ |
20 | /* Private macro -------------------------------------------------------------*/ |
25 | /* Private variables ---------------------------------------------------------*/ |
21 | /* Private variables ---------------------------------------------------------*/ |
26 | /* Extern variables ----------------------------------------------------------*/ |
22 | /* Extern variables ----------------------------------------------------------*/ |
27 | /* Private function prototypes -----------------------------------------------*/ |
23 | /* Private function prototypes -----------------------------------------------*/ |
28 | /* Private functions ---------------------------------------------------------*/ |
24 | /* Private functions ---------------------------------------------------------*/ |
- | 25 | ||
29 | /******************************************************************************* |
26 | /******************************************************************************* |
30 | * Function Name : SetCNTR |
27 | * Function Name : SetCNTR. |
31 | * Description : |
28 | * Description : Set the CNTR register value. |
32 | * Input : wRegValue |
29 | * Input : wRegValue: new register value. |
33 | * Output : None |
30 | * Output : None. |
34 | * Return : None |
31 | * Return : None. |
35 | *******************************************************************************/ |
32 | *******************************************************************************/ |
36 | void SetCNTR(u16 wRegValue) |
33 | void SetCNTR(u16 wRegValue) |
37 | { |
34 | { |
38 | _SetCNTR(wRegValue); |
35 | _SetCNTR(wRegValue); |
39 | } |
36 | } |
- | 37 | ||
40 | /******************************************************************************* |
38 | /******************************************************************************* |
41 | * Function Name : GetCNTR |
39 | * Function Name : GetCNTR. |
42 | * Description : |
40 | * Description : returns the CNTR register value. |
43 | * Input : None |
41 | * Input : None. |
44 | * Output : None |
42 | * Output : None. |
45 | * Return : CNTR register Value |
43 | * Return : CNTR register Value. |
46 | *******************************************************************************/ |
44 | *******************************************************************************/ |
47 | u16 GetCNTR(void) |
45 | u16 GetCNTR(void) |
48 | { |
46 | { |
49 | return(_GetCNTR()); |
47 | return(_GetCNTR()); |
50 | } |
48 | } |
- | 49 | ||
51 | /******************************************************************************* |
50 | /******************************************************************************* |
52 | * Function Name : SetISTR |
51 | * Function Name : SetISTR. |
53 | * Description : |
52 | * Description : Set the ISTR register value. |
54 | * Input : wRegValue |
53 | * Input : wRegValue: new register value. |
55 | * Output : None |
54 | * Output : None. |
56 | * Return : None |
55 | * Return : None. |
57 | *******************************************************************************/ |
56 | *******************************************************************************/ |
58 | void SetISTR(u16 wRegValue) |
57 | void SetISTR(u16 wRegValue) |
59 | { |
58 | { |
60 | _SetISTR(wRegValue); |
59 | _SetISTR(wRegValue); |
61 | } |
60 | } |
- | 61 | ||
62 | /******************************************************************************* |
62 | /******************************************************************************* |
63 | * Function Name : GetISTR |
63 | * Function Name : GetISTR. |
64 | * Description : |
64 | * Description : Returns the ISTR register value. |
65 | * Input : |
65 | * Input : None. |
66 | * Output : |
66 | * Output : None. |
67 | * Return : ISTR register Value |
67 | * Return : ISTR register Value. |
68 | *******************************************************************************/ |
68 | *******************************************************************************/ |
69 | u16 GetISTR(void) |
69 | u16 GetISTR(void) |
70 | { |
70 | { |
71 | return(_GetISTR()); |
71 | return(_GetISTR()); |
72 | } |
72 | } |
- | 73 | ||
73 | /******************************************************************************* |
74 | /******************************************************************************* |
74 | * Function Name : GetFNR |
75 | * Function Name : GetFNR. |
75 | * Description : |
76 | * Description : Returns the FNR register value. |
76 | * Input : |
77 | * Input : None. |
77 | * Output : |
78 | * Output : None. |
78 | * Return : FNR register Value |
79 | * Return : FNR register Value. |
79 | *******************************************************************************/ |
80 | *******************************************************************************/ |
80 | u16 GetFNR(void) |
81 | u16 GetFNR(void) |
81 | { |
82 | { |
82 | return(_GetFNR()); |
83 | return(_GetFNR()); |
83 | } |
84 | } |
- | 85 | ||
84 | /******************************************************************************* |
86 | /******************************************************************************* |
85 | * Function Name : SetDADDR |
87 | * Function Name : SetDADDR. |
86 | * Description : |
88 | * Description : Set the DADDR register value. |
87 | * Input : wRegValue |
89 | * Input : wRegValue: new register value. |
88 | * Output : |
90 | * Output : None. |
89 | * Return : |
91 | * Return : None. |
90 | *******************************************************************************/ |
92 | *******************************************************************************/ |
91 | void SetDADDR(u16 wRegValue) |
93 | void SetDADDR(u16 wRegValue) |
92 | { |
94 | { |
93 | _SetDADDR(wRegValue); |
95 | _SetDADDR(wRegValue); |
94 | } |
96 | } |
- | 97 | ||
95 | /******************************************************************************* |
98 | /******************************************************************************* |
96 | * Function Name : GetDADDR |
99 | * Function Name : GetDADDR. |
97 | * Description : |
100 | * Description : Returns the DADDR register value. |
98 | * Input : |
101 | * Input : None. |
99 | * Output : |
102 | * Output : None. |
100 | * Return : DADDR register Value |
103 | * Return : DADDR register Value |
101 | *******************************************************************************/ |
104 | *******************************************************************************/ |
102 | u16 GetDADDR(void) |
105 | u16 GetDADDR(void) |
103 | { |
106 | { |
104 | return(_GetDADDR()); |
107 | return(_GetDADDR()); |
105 | } |
108 | } |
- | 109 | ||
106 | /******************************************************************************* |
110 | /******************************************************************************* |
107 | * Function Name : SetBTABLE |
111 | * Function Name : SetBTABLE. |
108 | * Description : |
112 | * Description : Set the BTABLE. |
109 | * Input : wRegValue |
113 | * Input : wRegValue: New register value. |
110 | * Output : |
114 | * Output : None. |
111 | * Return : |
115 | * Return : None. |
112 | *******************************************************************************/ |
116 | *******************************************************************************/ |
113 | void SetBTABLE(u16 wRegValue) |
117 | void SetBTABLE(u16 wRegValue) |
114 | { |
118 | { |
115 | _SetBTABLE(wRegValue); |
119 | _SetBTABLE(wRegValue); |
116 | } |
120 | } |
Line 117... | Line 121... | ||
117 | 121 | ||
118 | /******************************************************************************* |
122 | /******************************************************************************* |
119 | * Function Name : GetBTABLE |
123 | * Function Name : GetBTABLE. |
120 | * Description : |
124 | * Description : Returns the BTABLE register value. |
121 | * Input : |
125 | * Input : None. |
122 | * Output : |
126 | * Output : None. |
123 | * Return : BTABLE address |
127 | * Return : BTABLE address. |
124 | *******************************************************************************/ |
128 | *******************************************************************************/ |
125 | u16 GetBTABLE(void) |
129 | u16 GetBTABLE(void) |
126 | { |
130 | { |
127 | return(_GetBTABLE()); |
131 | return(_GetBTABLE()); |
- | 132 | } |
|
128 | } |
133 | |
129 | /******************************************************************************* |
134 | /******************************************************************************* |
130 | * Function Name : SetENDPOINT |
135 | * Function Name : SetENDPOINT. |
131 | * Description : |
136 | * Description : Setthe Endpoint register value. |
- | 137 | * Input : bEpNum: Endpoint Number. |
|
132 | * Input : bEpNum, wRegValue |
138 | * wRegValue. |
133 | * Output : |
139 | * Output : None. |
134 | * Return : |
140 | * Return : None. |
135 | *******************************************************************************/ |
141 | *******************************************************************************/ |
136 | void SetENDPOINT(u8 bEpNum, u16 wRegValue) |
142 | void SetENDPOINT(u8 bEpNum, u16 wRegValue) |
137 | { |
143 | { |
138 | _SetENDPOINT(bEpNum,wRegValue); |
144 | _SetENDPOINT(bEpNum, wRegValue); |
- | 145 | } |
|
139 | } |
146 | |
140 | /******************************************************************************* |
147 | /******************************************************************************* |
141 | * Function Name : GetENDPOINT |
148 | * Function Name : GetENDPOINT. |
142 | * Description : |
149 | * Description : Return the Endpoint register value. |
143 | * Input : bEpNum |
150 | * Input : bEpNum: Endpoint Number. |
144 | * Output : |
151 | * Output : None. |
145 | * Return : |
152 | * Return : Endpoint register value. |
146 | *******************************************************************************/ |
153 | *******************************************************************************/ |
147 | u16 GetENDPOINT(u8 bEpNum) |
154 | u16 GetENDPOINT(u8 bEpNum) |
148 | { |
155 | { |
149 | return(_GetENDPOINT(bEpNum)); |
156 | return(_GetENDPOINT(bEpNum)); |
- | 157 | } |
|
150 | } |
158 | |
151 | /******************************************************************************* |
159 | /******************************************************************************* |
152 | * Function Name : SetEPType |
160 | * Function Name : SetEPType. |
153 | * Description : |
161 | * Description : sets the type in the endpoint register. |
- | 162 | * Input : bEpNum: Endpoint Number. |
|
154 | * Input : bEpNum, wType |
163 | * wType: type definition. |
155 | * Output : |
164 | * Output : None. |
156 | * Return : |
165 | * Return : None. |
157 | *******************************************************************************/ |
166 | *******************************************************************************/ |
158 | void SetEPType(u8 bEpNum, u16 wType) |
167 | void SetEPType(u8 bEpNum, u16 wType) |
159 | { |
168 | { |
160 | _SetEPType(bEpNum, wType); |
169 | _SetEPType(bEpNum, wType); |
- | 170 | } |
|
161 | } |
171 | |
162 | /******************************************************************************* |
172 | /******************************************************************************* |
163 | * Function Name : GetEPType |
173 | * Function Name : GetEPType. |
164 | * Description : |
174 | * Description : Returns the endpoint type. |
165 | * Input : bEpNum, |
175 | * Input : bEpNum: Endpoint Number. |
166 | * Output : |
176 | * Output : None. |
167 | * Return : Endpoint Type |
177 | * Return : Endpoint Type. |
168 | *******************************************************************************/ |
178 | *******************************************************************************/ |
169 | u16 GetEPType(u8 bEpNum) |
179 | u16 GetEPType(u8 bEpNum) |
170 | { |
180 | { |
171 | return(_GetEPType(bEpNum)); |
181 | return(_GetEPType(bEpNum)); |
- | 182 | } |
|
172 | } |
183 | |
173 | /******************************************************************************* |
184 | /******************************************************************************* |
174 | * Function Name : SetEPTxStatus |
185 | * Function Name : SetEPTxStatus. |
175 | * Description : |
186 | * Description : Set the status of Tx endpoint. |
- | 187 | * Input : bEpNum: Endpoint Number. |
|
176 | * Input : bEpNum, wState |
188 | * wState: new state. |
177 | * Output : |
189 | * Output : None. |
178 | * Return : |
190 | * Return : None. |
179 | *******************************************************************************/ |
191 | *******************************************************************************/ |
180 | void SetEPTxStatus(u8 bEpNum, u16 wState) |
192 | void SetEPTxStatus(u8 bEpNum, u16 wState) |
181 | { |
193 | { |
182 | _SetEPTxStatus(bEpNum,wState); |
194 | _SetEPTxStatus(bEpNum, wState); |
- | 195 | } |
|
183 | } |
196 | |
184 | /******************************************************************************* |
197 | /******************************************************************************* |
185 | * Function Name : SetEPRxStatus |
198 | * Function Name : SetEPRxStatus. |
186 | * Description : |
199 | * Description : Set the status of Rx endpoint. |
- | 200 | * Input : bEpNum: Endpoint Number. |
|
187 | * Input : bEpNum, wState |
201 | * wState: new state. |
188 | * Output : |
202 | * Output : None. |
189 | * Return : |
203 | * Return : None. |
190 | *******************************************************************************/ |
204 | *******************************************************************************/ |
191 | void SetEPRxStatus(u8 bEpNum, u16 wState) |
205 | void SetEPRxStatus(u8 bEpNum, u16 wState) |
192 | { |
206 | { |
193 | _SetEPRxStatus(bEpNum,wState); |
207 | _SetEPRxStatus(bEpNum, wState); |
- | 208 | } |
|
194 | } |
209 | |
195 | /******************************************************************************* |
210 | /******************************************************************************* |
196 | * Function Name : SetDouBleBuffEPStall |
211 | * Function Name : SetDouBleBuffEPStall. |
197 | * Description : sets the status for Double Buffer Endpoint to STALL |
212 | * Description : sets the status for Double Buffer Endpoint to STALL. |
198 | * Input : bEpNum = endpoint number |
213 | * Input : bEpNum: Endpoint Number. |
199 | bDir = Endpoint direction |
214 | * bDir: Endpoint direction. |
200 | * Output : |
215 | * Output : None. |
201 | * Return : |
216 | * Return : None. |
202 | *******************************************************************************/ |
217 | *******************************************************************************/ |
203 | void SetDouBleBuffEPStall(u8 bEpNum,u8 bDir) |
218 | void SetDouBleBuffEPStall(u8 bEpNum, u8 bDir) |
204 | { |
219 | { |
205 | u16 Endpoint_DTOG_Status; |
220 | u16 Endpoint_DTOG_Status; |
206 | Endpoint_DTOG_Status = GetENDPOINT(bEpNum); |
221 | Endpoint_DTOG_Status = GetENDPOINT(bEpNum); |
207 | if(bDir== EP_DBUF_OUT) |
222 | if (bDir == EP_DBUF_OUT) |
208 | { /* OUT double buffered endpoint */ |
223 | { /* OUT double buffered endpoint */ |
209 | _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPRX_DTOG1); |
224 | _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPRX_DTOG1); |
210 | } |
225 | } |
211 | else if(bDir == EP_DBUF_IN) |
226 | else if (bDir == EP_DBUF_IN) |
212 | { /* IN double buffered endpoint */ |
227 | { /* IN double buffered endpoint */ |
213 | _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPTX_DTOG1); |
228 | _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPTX_DTOG1); |
214 | } |
229 | } |
- | 230 | } |
|
215 | } |
231 | |
216 | /******************************************************************************* |
232 | /******************************************************************************* |
217 | * Function Name : GetEPTxStatus |
233 | * Function Name : GetEPTxStatus. |
218 | * Description : |
234 | * Description : Returns the endpoint Tx status. |
219 | * Input : bEpNum |
235 | * Input : bEpNum: Endpoint Number. |
220 | * Output : |
236 | * Output : None. |
221 | * Return : Endpoint TX Status |
237 | * Return : Endpoint TX Status. |
222 | *******************************************************************************/ |
238 | *******************************************************************************/ |
223 | u16 GetEPTxStatus(u8 bEpNum) |
239 | u16 GetEPTxStatus(u8 bEpNum) |
224 | { |
240 | { |
225 | return(_GetEPTxStatus(bEpNum)); |
241 | return(_GetEPTxStatus(bEpNum)); |
- | 242 | } |
|
226 | } |
243 | |
227 | /******************************************************************************* |
244 | /******************************************************************************* |
228 | * Function Name : GetEPRxStatus |
245 | * Function Name : GetEPRxStatus. |
229 | * Description : |
246 | * Description : Returns the endpoint Rx status. |
230 | * Input : bEpNum |
247 | * Input : bEpNum: Endpoint Number. |
231 | * Output : |
248 | * Output : None. |
232 | * Return : Endpoint RX Status |
249 | * Return : Endpoint RX Status. |
233 | *******************************************************************************/ |
250 | *******************************************************************************/ |
234 | u16 GetEPRxStatus(u8 bEpNum) |
251 | u16 GetEPRxStatus(u8 bEpNum) |
235 | { |
252 | { |
236 | return(_GetEPRxStatus(bEpNum)); |
253 | return(_GetEPRxStatus(bEpNum)); |
- | 254 | } |
|
237 | } |
255 | |
238 | /******************************************************************************* |
256 | /******************************************************************************* |
239 | * Function Name : SetEPTxValid |
257 | * Function Name : SetEPTxValid. |
240 | * Description : |
258 | * Description : Valid the endpoint Tx Status. |
241 | * Input : bEpNum |
259 | * Input : bEpNum: Endpoint Number. |
242 | * Output : |
260 | * Output : None. |
243 | * Return : |
261 | * Return : None. |
244 | *******************************************************************************/ |
262 | *******************************************************************************/ |
245 | void SetEPTxValid(u8 bEpNum) |
263 | void SetEPTxValid(u8 bEpNum) |
246 | { |
264 | { |
247 | _SetEPTxStatus(bEpNum, EP_TX_VALID); |
265 | _SetEPTxStatus(bEpNum, EP_TX_VALID); |
- | 266 | } |
|
248 | } |
267 | |
249 | /******************************************************************************* |
268 | /******************************************************************************* |
250 | * Function Name : SetEPRxValid |
269 | * Function Name : SetEPRxValid. |
251 | * Description : |
270 | * Description : Valid the endpoint Rx Status. |
252 | * Input : bEpNum |
271 | * Input : bEpNum: Endpoint Number. |
253 | * Output : |
272 | * Output : None. |
254 | * Return : |
273 | * Return : None. |
255 | *******************************************************************************/ |
274 | *******************************************************************************/ |
256 | void SetEPRxValid(u8 bEpNum) |
275 | void SetEPRxValid(u8 bEpNum) |
257 | { |
276 | { |
258 | _SetEPRxStatus(bEpNum, EP_RX_VALID); |
277 | _SetEPRxStatus(bEpNum, EP_RX_VALID); |
- | 278 | } |
|
259 | } |
279 | |
260 | /******************************************************************************* |
280 | /******************************************************************************* |
261 | * Function Name : SetEP_KIND |
281 | * Function Name : SetEP_KIND. |
262 | * Description : |
282 | * Description : Clear the EP_KIND bit. |
263 | * Input : bEpNum |
283 | * Input : bEpNum: Endpoint Number. |
264 | * Output : |
284 | * Output : None. |
265 | * Return : |
285 | * Return : None. |
266 | *******************************************************************************/ |
286 | *******************************************************************************/ |
267 | void SetEP_KIND(u8 bEpNum) |
287 | void SetEP_KIND(u8 bEpNum) |
268 | { |
288 | { |
269 | _SetEP_KIND(bEpNum); |
289 | _SetEP_KIND(bEpNum); |
- | 290 | } |
|
270 | } |
291 | |
271 | /******************************************************************************* |
292 | /******************************************************************************* |
272 | * Function Name : ClearEP_KIND |
293 | * Function Name : ClearEP_KIND. |
273 | * Description : |
294 | * Description : set the EP_KIND bit. |
274 | * Input : bEpNum |
295 | * Input : bEpNum: Endpoint Number. |
275 | * Output : |
296 | * Output : None. |
276 | * Return : |
297 | * Return : None. |
277 | *******************************************************************************/ |
298 | *******************************************************************************/ |
278 | void ClearEP_KIND(u8 bEpNum) |
299 | void ClearEP_KIND(u8 bEpNum) |
279 | { |
300 | { |
280 | _ClearEP_KIND(bEpNum); |
301 | _ClearEP_KIND(bEpNum); |
- | 302 | } |
|
281 | } |
303 | |
282 | /******************************************************************************* |
304 | /******************************************************************************* |
283 | * Function Name : Clear_Status_Out |
305 | * Function Name : Clear_Status_Out. |
284 | * Description : Clear the Status Out of the related Endpoint |
306 | * Description : Clear the Status Out of the related Endpoint. |
285 | * Input : bEpNum |
307 | * Input : bEpNum: Endpoint Number. |
286 | * Output : |
308 | * Output : None. |
287 | * Return : |
309 | * Return : None. |
288 | *******************************************************************************/ |
310 | *******************************************************************************/ |
289 | void Clear_Status_Out(u8 bEpNum) |
311 | void Clear_Status_Out(u8 bEpNum) |
290 | { |
312 | { |
291 | _ClearEP_KIND(bEpNum); |
313 | _ClearEP_KIND(bEpNum); |
- | 314 | } |
|
292 | } |
315 | |
293 | /******************************************************************************* |
316 | /******************************************************************************* |
294 | * Function Name : Set_Status_Out |
317 | * Function Name : Set_Status_Out. |
295 | * Description : Set the Status Out of the related Endpoint |
318 | * Description : Set the Status Out of the related Endpoint. |
296 | * Input : bEpNum |
319 | * Input : bEpNum: Endpoint Number. |
297 | * Output : |
320 | * Output : None. |
298 | * Return : |
321 | * Return : None. |
299 | *******************************************************************************/ |
322 | *******************************************************************************/ |
300 | void Set_Status_Out(u8 bEpNum) |
323 | void Set_Status_Out(u8 bEpNum) |
301 | { |
324 | { |
302 | _SetEP_KIND(bEpNum); |
325 | _SetEP_KIND(bEpNum); |
- | 326 | } |
|
303 | } |
327 | |
304 | /******************************************************************************* |
328 | /******************************************************************************* |
305 | * Function Name : SetEPDoubleBuff |
329 | * Function Name : SetEPDoubleBuff. |
306 | * Description : |
330 | * Description : Enable the double buffer feature for the endpoint. |
307 | * Input : bEpNum |
331 | * Input : bEpNum: Endpoint Number. |
308 | * Output : |
332 | * Output : None. |
309 | * Return : |
333 | * Return : None. |
310 | *******************************************************************************/ |
334 | *******************************************************************************/ |
311 | void SetEPDoubleBuff(u8 bEpNum) |
335 | void SetEPDoubleBuff(u8 bEpNum) |
312 | { |
336 | { |
313 | _SetEP_KIND(bEpNum); |
337 | _SetEP_KIND(bEpNum); |
- | 338 | } |
|
314 | } |
339 | |
315 | /******************************************************************************* |
340 | /******************************************************************************* |
316 | * Function Name : ClearEPDoubleBuff |
341 | * Function Name : ClearEPDoubleBuff. |
317 | * Description : |
342 | * Description : Disable the double buffer feature for the endpoint. |
318 | * Input : bEpNum |
343 | * Input : bEpNum: Endpoint Number. |
319 | * Output : |
344 | * Output : None. |
320 | * Return : |
345 | * Return : None. |
321 | *******************************************************************************/ |
346 | *******************************************************************************/ |
322 | void ClearEPDoubleBuff(u8 bEpNum) |
347 | void ClearEPDoubleBuff(u8 bEpNum) |
323 | { |
348 | { |
324 | _ClearEP_KIND(bEpNum); |
349 | _ClearEP_KIND(bEpNum); |
- | 350 | } |
|
325 | } |
351 | |
326 | /******************************************************************************* |
352 | /******************************************************************************* |
327 | * Function Name : GetTxStallStatus |
353 | * Function Name : GetTxStallStatus |
328 | * Description : |
354 | * Description : Returns the Stall status of the Tx endpoint. |
329 | * Input : bEpNum |
355 | * Input : bEpNum: Endpoint Number. |
330 | * Output : |
356 | * Output : None. |
331 | * Return : |
357 | * Return : Tx Stall status. |
332 | *******************************************************************************/ |
358 | *******************************************************************************/ |
333 | u16 GetTxStallStatus(u8 bEpNum) |
359 | u16 GetTxStallStatus(u8 bEpNum) |
334 | { |
360 | { |
335 | return(_GetTxStallStatus(bEpNum)); |
361 | return(_GetTxStallStatus(bEpNum)); |
- | 362 | } |
|
336 | } |
363 | |
337 | /******************************************************************************* |
364 | /******************************************************************************* |
338 | * Function Name : GetRxStallStatus |
365 | * Function Name : GetRxStallStatus |
339 | * Description : |
366 | * Description : Returns the Stall status of the Rx endpoint. |
340 | * Input : bEpNum |
367 | * Input : bEpNum: Endpoint Number. |
341 | * Output : |
368 | * Output : None. |
342 | * Return : |
369 | * Return : Rx Stall status. |
343 | *******************************************************************************/ |
370 | *******************************************************************************/ |
344 | u16 GetRxStallStatus(u8 bEpNum) |
371 | u16 GetRxStallStatus(u8 bEpNum) |
345 | { |
372 | { |
346 | return(_GetRxStallStatus(bEpNum)); |
373 | return(_GetRxStallStatus(bEpNum)); |
- | 374 | } |
|
347 | } |
375 | |
348 | /******************************************************************************* |
376 | /******************************************************************************* |
349 | * Function Name : ClearEP_CTR_RX |
377 | * Function Name : ClearEP_CTR_RX |
350 | * Description : |
378 | * Description : Clear the CTR_RX bit. |
351 | * Input : bEpNum |
379 | * Input : bEpNum: Endpoint Number. |
352 | * Output : |
380 | * Output : None. |
353 | * Return : |
381 | * Return : None. |
354 | *******************************************************************************/ |
382 | *******************************************************************************/ |
355 | void ClearEP_CTR_RX(u8 bEpNum) |
383 | void ClearEP_CTR_RX(u8 bEpNum) |
356 | { |
384 | { |
357 | _ClearEP_CTR_RX(bEpNum); |
385 | _ClearEP_CTR_RX(bEpNum); |
- | 386 | } |
|
358 | } |
387 | |
359 | /******************************************************************************* |
388 | /******************************************************************************* |
360 | * Function Name : ClearEP_CTR_TX |
389 | * Function Name : ClearEP_CTR_TX |
361 | * Description : |
390 | * Description : Clear the CTR_TX bit. |
362 | * Input : bEpNum |
391 | * Input : bEpNum: Endpoint Number. |
363 | * Output : |
392 | * Output : None. |
364 | * Return : |
393 | * Return : None. |
365 | *******************************************************************************/ |
394 | *******************************************************************************/ |
366 | void ClearEP_CTR_TX(u8 bEpNum) |
395 | void ClearEP_CTR_TX(u8 bEpNum) |
367 | { |
396 | { |
368 | _ClearEP_CTR_TX(bEpNum); |
397 | _ClearEP_CTR_TX(bEpNum); |
- | 398 | } |
|
369 | } |
399 | |
370 | /******************************************************************************* |
400 | /******************************************************************************* |
371 | * Function Name : ToggleDTOG_RX |
401 | * Function Name : ToggleDTOG_RX |
372 | * Description : |
402 | * Description : Toggle the DTOG_RX bit. |
373 | * Input : bEpNum |
403 | * Input : bEpNum: Endpoint Number. |
374 | * Output : |
404 | * Output : None. |
375 | * Return : |
405 | * Return : None. |
376 | *******************************************************************************/ |
406 | *******************************************************************************/ |
377 | void ToggleDTOG_RX(u8 bEpNum) |
407 | void ToggleDTOG_RX(u8 bEpNum) |
378 | { |
408 | { |
379 | _ToggleDTOG_RX(bEpNum); |
409 | _ToggleDTOG_RX(bEpNum); |
- | 410 | } |
|
380 | } |
411 | |
381 | /******************************************************************************* |
412 | /******************************************************************************* |
382 | * Function Name : ToggleDTOG_TX |
413 | * Function Name : ToggleDTOG_TX |
383 | * Description : |
414 | * Description : Toggle the DTOG_TX bit. |
384 | * Input : bEpNum |
415 | * Input : bEpNum: Endpoint Number. |
385 | * Output : |
416 | * Output : None. |
386 | * Return : |
417 | * Return : None. |
387 | *******************************************************************************/ |
418 | *******************************************************************************/ |
388 | void ToggleDTOG_TX(u8 bEpNum) |
419 | void ToggleDTOG_TX(u8 bEpNum) |
389 | { |
420 | { |
390 | _ToggleDTOG_TX(bEpNum); |
421 | _ToggleDTOG_TX(bEpNum); |
- | 422 | } |
|
391 | } |
423 | |
392 | /******************************************************************************* |
424 | /******************************************************************************* |
393 | * Function Name : ClearDTOG_RX |
425 | * Function Name : ClearDTOG_RX. |
394 | * Description : |
426 | * Description : Clear the DTOG_RX bit. |
395 | * Input : bEpNum |
427 | * Input : bEpNum: Endpoint Number. |
396 | * Output : |
428 | * Output : None. |
397 | * Return : |
429 | * Return : None. |
398 | *******************************************************************************/ |
430 | *******************************************************************************/ |
399 | void ClearDTOG_RX(u8 bEpNum) |
431 | void ClearDTOG_RX(u8 bEpNum) |
400 | { |
432 | { |
401 | _ClearDTOG_RX(bEpNum); |
433 | _ClearDTOG_RX(bEpNum); |
- | 434 | } |
|
402 | } |
435 | |
403 | /******************************************************************************* |
436 | /******************************************************************************* |
404 | * Function Name : ClearDTOG_TX |
437 | * Function Name : ClearDTOG_TX. |
405 | * Description : |
438 | * Description : Clear the DTOG_TX bit. |
406 | * Input : bEpNum |
439 | * Input : bEpNum: Endpoint Number. |
407 | * Output : |
440 | * Output : None. |
408 | * Return : |
441 | * Return : None. |
409 | *******************************************************************************/ |
442 | *******************************************************************************/ |
410 | void ClearDTOG_TX(u8 bEpNum) |
443 | void ClearDTOG_TX(u8 bEpNum) |
411 | { |
444 | { |
412 | _ClearDTOG_TX(bEpNum); |
445 | _ClearDTOG_TX(bEpNum); |
- | 446 | } |
|
413 | } |
447 | |
414 | /******************************************************************************* |
448 | /******************************************************************************* |
415 | * Function Name : SetEPAddress |
449 | * Function Name : SetEPAddress |
416 | * Description : |
450 | * Description : Set the endpoint address. |
- | 451 | * Input : bEpNum: Endpoint Number. |
|
417 | * Input : bEpNum, bAddr |
452 | * bAddr: New endpoint address. |
418 | * Output : |
453 | * Output : None. |
419 | * Return : |
454 | * Return : None. |
420 | *******************************************************************************/ |
455 | *******************************************************************************/ |
421 | void SetEPAddress(u8 bEpNum,u8 bAddr) |
456 | void SetEPAddress(u8 bEpNum, u8 bAddr) |
422 | { |
457 | { |
423 | _SetEPAddress(bEpNum,bAddr); |
458 | _SetEPAddress(bEpNum, bAddr); |
- | 459 | } |
|
424 | } |
460 | |
425 | /******************************************************************************* |
461 | /******************************************************************************* |
426 | * Function Name : GetEPAddress |
462 | * Function Name : GetEPAddress |
427 | * Description : |
463 | * Description : Get the endpoint address. |
428 | * Input : bEpNum |
464 | * Input : bEpNum: Endpoint Number. |
429 | * Output : |
465 | * Output : None. |
430 | * Return : |
466 | * Return : Endpoint address. |
431 | *******************************************************************************/ |
467 | *******************************************************************************/ |
432 | u8 GetEPAddress(u8 bEpNum) |
468 | u8 GetEPAddress(u8 bEpNum) |
433 | { |
469 | { |
434 | return(_GetEPAddress(bEpNum)); |
470 | return(_GetEPAddress(bEpNum)); |
- | 471 | } |
|
435 | } |
472 | |
436 | /******************************************************************************* |
473 | /******************************************************************************* |
437 | * Function Name : SetEPTxAddr |
474 | * Function Name : SetEPTxAddr |
438 | * Description : |
475 | * Description : Set the endpoint Tx buffer address. |
- | 476 | * Input : bEpNum: Endpoint Number. |
|
439 | * Input : bEpNum, wAddr |
477 | * wAddr: new address. |
440 | * Output : |
478 | * Output : None. |
441 | * Return : |
479 | * Return : None. |
442 | *******************************************************************************/ |
480 | *******************************************************************************/ |
443 | void SetEPTxAddr(u8 bEpNum, u16 wAddr) |
481 | void SetEPTxAddr(u8 bEpNum, u16 wAddr) |
444 | { |
482 | { |
445 | _SetEPTxAddr(bEpNum,wAddr); |
483 | _SetEPTxAddr(bEpNum, wAddr); |
- | 484 | } |
|
446 | } |
485 | |
447 | /******************************************************************************* |
486 | /******************************************************************************* |
448 | * Function Name : SetEPRxAddr |
487 | * Function Name : SetEPRxAddr |
449 | * Description : |
488 | * Description : Set the endpoint Rx buffer address. |
- | 489 | * Input : bEpNum: Endpoint Number. |
|
450 | * Input : bEpNum, wAddr |
490 | * wAddr: new address. |
451 | * Output : |
491 | * Output : None. |
452 | * Return : |
492 | * Return : None. |
453 | *******************************************************************************/ |
493 | *******************************************************************************/ |
454 | void SetEPRxAddr(u8 bEpNum, u16 wAddr) |
494 | void SetEPRxAddr(u8 bEpNum, u16 wAddr) |
455 | { |
495 | { |
456 | _SetEPRxAddr(bEpNum,wAddr); |
496 | _SetEPRxAddr(bEpNum, wAddr); |
- | 497 | } |
|
457 | } |
498 | |
458 | /******************************************************************************* |
499 | /******************************************************************************* |
459 | * Function Name : GetEPTxAddr |
500 | * Function Name : GetEPTxAddr |
460 | * Description : |
501 | * Description : Returns the endpoint Tx buffer address. |
461 | * Input : bEpNum |
502 | * Input : bEpNum: Endpoint Number. |
462 | * Output : |
503 | * Output : None. |
463 | * Return : |
504 | * Return : Rx buffer address. |
464 | *******************************************************************************/ |
505 | *******************************************************************************/ |
465 | u16 GetEPTxAddr(u8 bEpNum) |
506 | u16 GetEPTxAddr(u8 bEpNum) |
466 | { |
507 | { |
467 | return(_GetEPTxAddr(bEpNum)); |
508 | return(_GetEPTxAddr(bEpNum)); |
- | 509 | } |
|
468 | } |
510 | |
469 | /******************************************************************************* |
511 | /******************************************************************************* |
470 | * Function Name : GetEPRxAddr |
512 | * Function Name : GetEPRxAddr. |
471 | * Description : |
513 | * Description : Returns the endpoint Rx buffer address. |
472 | * Input : bEpNum |
514 | * Input : bEpNum: Endpoint Number. |
473 | * Output : |
515 | * Output : None. |
474 | * Return : |
516 | * Return : Rx buffer address. |
475 | *******************************************************************************/ |
517 | *******************************************************************************/ |
476 | u16 GetEPRxAddr(u8 bEpNum) |
518 | u16 GetEPRxAddr(u8 bEpNum) |
477 | { |
519 | { |
478 | return(_GetEPRxAddr(bEpNum)); |
520 | return(_GetEPRxAddr(bEpNum)); |
- | 521 | } |
|
479 | } |
522 | |
480 | /******************************************************************************* |
523 | /******************************************************************************* |
481 | * Function Name : SetEPTxCount |
524 | * Function Name : SetEPTxCount. |
482 | * Description : |
525 | * Description : Set the Tx count. |
- | 526 | * Input : bEpNum: Endpoint Number. |
|
483 | * Input : bEpNum, wCount |
527 | * wCount: new count value. |
484 | * Output : |
528 | * Output : None. |
485 | * Return : |
529 | * Return : None. |
486 | *******************************************************************************/ |
530 | *******************************************************************************/ |
487 | void SetEPTxCount(u8 bEpNum, u16 wCount) |
531 | void SetEPTxCount(u8 bEpNum, u16 wCount) |
488 | { |
532 | { |
489 | _SetEPTxCount(bEpNum,wCount); |
533 | _SetEPTxCount(bEpNum, wCount); |
- | 534 | } |
|
490 | } |
535 | |
491 | /******************************************************************************* |
536 | /******************************************************************************* |
492 | * Function Name : SetEPCountRxReg |
537 | * Function Name : SetEPCountRxReg. |
493 | * Description : |
538 | * Description : Set the Count Rx Register value. |
- | 539 | * Input : *pdwReg: point to the register. |
|
494 | * Input : *pdwReg, wCount |
540 | * wCount: the new register value. |
495 | * Output : |
541 | * Output : None. |
496 | * Return : |
542 | * Return : None. |
497 | *******************************************************************************/ |
543 | *******************************************************************************/ |
498 | #ifdef STR7xx |
544 | #ifdef STR7xx |
499 | void SetEPCountRxReg(u32 *pdwReg, u16 wCount) |
545 | void SetEPCountRxReg(u32 *pdwReg, u16 wCount) |
500 | { |
546 | { |
501 | _SetEPCountRxReg(dwReg, wCount); |
547 | _SetEPCountRxReg(dwReg, wCount); |
502 | } |
548 | } |
- | 549 | #endif |
|
503 | #endif |
550 | |
504 | /******************************************************************************* |
551 | /******************************************************************************* |
505 | * Function Name : SetEPRxCount |
552 | * Function Name : SetEPRxCount. |
506 | * Description : |
553 | * Description : Set the Rx count. |
- | 554 | * Input : bEpNum: Endpoint Number. |
|
507 | * Input : bEpNum, wCount |
555 | * wCount: the new count value. |
508 | * Output : |
556 | * Output : None. |
509 | * Return : |
557 | * Return : None. |
510 | *******************************************************************************/ |
558 | *******************************************************************************/ |
511 | void SetEPRxCount(u8 bEpNum, u16 wCount) |
559 | void SetEPRxCount(u8 bEpNum, u16 wCount) |
512 | { |
560 | { |
513 | _SetEPRxCount(bEpNum,wCount); |
561 | _SetEPRxCount(bEpNum, wCount); |
- | 562 | } |
|
514 | } |
563 | |
515 | /******************************************************************************* |
564 | /******************************************************************************* |
516 | * Function Name : GetEPTxCount |
565 | * Function Name : GetEPTxCount. |
517 | * Description : |
566 | * Description : Get the Tx count. |
518 | * Input : bEpNum |
567 | * Input : bEpNum: Endpoint Number. |
519 | * Output : |
568 | * Output : None. |
520 | * Return : |
569 | * Return : Tx count value. |
521 | *******************************************************************************/ |
570 | *******************************************************************************/ |
522 | u16 GetEPTxCount(u8 bEpNum) |
571 | u16 GetEPTxCount(u8 bEpNum) |
523 | { |
572 | { |
524 | return(_GetEPTxCount(bEpNum)); |
573 | return(_GetEPTxCount(bEpNum)); |
- | 574 | } |
|
525 | } |
575 | |
526 | /******************************************************************************* |
576 | /******************************************************************************* |
527 | * Function Name : GetEPRxCount |
577 | * Function Name : GetEPRxCount. |
528 | * Description : |
578 | * Description : Get the Rx count. |
529 | * Input : bEpNum |
579 | * Input : bEpNum: Endpoint Number. |
530 | * Output : |
580 | * Output : None. |
531 | * Return : |
581 | * Return : Rx count value. |
532 | *******************************************************************************/ |
582 | *******************************************************************************/ |
533 | u16 GetEPRxCount(u8 bEpNum) |
583 | u16 GetEPRxCount(u8 bEpNum) |
534 | { |
584 | { |
535 | return(_GetEPRxCount(bEpNum)); |
585 | return(_GetEPRxCount(bEpNum)); |
- | 586 | } |
|
536 | } |
587 | |
537 | /******************************************************************************* |
588 | /******************************************************************************* |
538 | * Function Name : SetEPDblBuffAddr |
589 | * Function Name : SetEPDblBuffAddr. |
539 | * Description : |
590 | * Description : Set the addresses of the buffer 0 and 1. |
- | 591 | * Input : bEpNum: Endpoint Number. |
|
- | 592 | * wBuf0Addr: new address of buffer 0. |
|
540 | * Input : bEpNum, wBuf0Addr, wBuf1Addr |
593 | * wBuf1Addr: new address of buffer 1. |
541 | * Output : |
594 | * Output : None. |
542 | * Return : |
595 | * Return : None. |
543 | *******************************************************************************/ |
596 | *******************************************************************************/ |
544 | void SetEPDblBuffAddr(u8 bEpNum, u16 wBuf0Addr, u16 wBuf1Addr) |
597 | void SetEPDblBuffAddr(u8 bEpNum, u16 wBuf0Addr, u16 wBuf1Addr) |
545 | { |
598 | { |
546 | _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr); |
599 | _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr); |
- | 600 | } |
|
547 | } |
601 | |
548 | /******************************************************************************* |
602 | /******************************************************************************* |
549 | * Function Name : SetEPDblBuf0Addr |
603 | * Function Name : SetEPDblBuf0Addr. |
550 | * Description : |
604 | * Description : Set the Buffer 1 address. |
- | 605 | * Input : bEpNum: Endpoint Number. |
|
551 | * Input : bEpNum, wBuf0Addr |
606 | * wBuf0Addr: new address. |
552 | * Output : |
607 | * Output : None. |
553 | * Return : |
608 | * Return : None. |
554 | *******************************************************************************/ |
609 | *******************************************************************************/ |
555 | void SetEPDblBuf0Addr(u8 bEpNum,u16 wBuf0Addr) |
610 | void SetEPDblBuf0Addr(u8 bEpNum, u16 wBuf0Addr) |
556 | { |
611 | { |
557 | _SetEPDblBuf0Addr(bEpNum, wBuf0Addr); |
612 | _SetEPDblBuf0Addr(bEpNum, wBuf0Addr); |
- | 613 | } |
|
558 | } |
614 | |
559 | /******************************************************************************* |
615 | /******************************************************************************* |
560 | * Function Name : SetEPDblBuf1Addr |
616 | * Function Name : SetEPDblBuf1Addr. |
561 | * Description : |
617 | * Description : Set the Buffer 1 address. |
- | 618 | * Input : bEpNum: Endpoint Number. |
|
562 | * Input : bEpNum, wBuf1Addr |
619 | * wBuf1Addr: new address. |
563 | * Output : |
620 | * Output : None. |
564 | * Return : |
621 | * Return : None. |
565 | *******************************************************************************/ |
622 | *******************************************************************************/ |
566 | void SetEPDblBuf1Addr(u8 bEpNum,u16 wBuf1Addr) |
623 | void SetEPDblBuf1Addr(u8 bEpNum, u16 wBuf1Addr) |
567 | { |
624 | { |
568 | _SetEPDblBuf1Addr(bEpNum, wBuf1Addr); |
625 | _SetEPDblBuf1Addr(bEpNum, wBuf1Addr); |
- | 626 | } |
|
569 | } |
627 | |
570 | /******************************************************************************* |
628 | /******************************************************************************* |
571 | * Function Name : GetEPDblBuf0Addr |
629 | * Function Name : GetEPDblBuf0Addr. |
572 | * Description : |
630 | * Description : Returns the address of the Buffer 0. |
573 | * Input : bEpNum |
631 | * Input : bEpNum: Endpoint Number. |
574 | * Output : |
632 | * Output : None. |
575 | * Return : |
633 | * Return : None. |
576 | *******************************************************************************/ |
634 | *******************************************************************************/ |
577 | u16 GetEPDblBuf0Addr(u8 bEpNum) |
635 | u16 GetEPDblBuf0Addr(u8 bEpNum) |
578 | { |
636 | { |
579 | return(_GetEPDblBuf0Addr(bEpNum)); |
637 | return(_GetEPDblBuf0Addr(bEpNum)); |
- | 638 | } |
|
580 | } |
639 | |
581 | /******************************************************************************* |
640 | /******************************************************************************* |
582 | * Function Name : GetEPDblBuf1Addr |
641 | * Function Name : GetEPDblBuf1Addr |
583 | * Description : |
642 | * Description : Returns the address of the Buffer 1. |
584 | * Input : bEpNum |
643 | * Input : bEpNum: Endpoint Number. |
585 | * Output : |
644 | * Output : None. |
586 | * Return : |
645 | * Return : Address of the Buffer 1. |
587 | *******************************************************************************/ |
646 | *******************************************************************************/ |
588 | u16 GetEPDblBuf1Addr(u8 bEpNum) |
647 | u16 GetEPDblBuf1Addr(u8 bEpNum) |
589 | { |
648 | { |
590 | return(_GetEPDblBuf1Addr(bEpNum)); |
649 | return(_GetEPDblBuf1Addr(bEpNum)); |
- | 650 | } |
|
591 | } |
651 | |
592 | /******************************************************************************* |
652 | /******************************************************************************* |
593 | * Function Name : SetEPDblBuffCount |
653 | * Function Name : SetEPDblBuffCount. |
594 | * Description : |
654 | * Description : Set the number of bytes for a double Buffer endpoint. |
595 | * Input : bEpNum,bDir, wCount |
655 | * Input : bEpNum,bDir, wCount. |
596 | * Output : |
656 | * Output : None. |
597 | * Return : |
657 | * Return : None. |
598 | *******************************************************************************/ |
658 | *******************************************************************************/ |
599 | void SetEPDblBuffCount(u8 bEpNum, u8 bDir, u16 wCount) |
659 | void SetEPDblBuffCount(u8 bEpNum, u8 bDir, u16 wCount) |
600 | { |
660 | { |
601 | #ifdef STR7xx /*STR7xx family */ |
661 | #ifdef STR7xx /*STR7xx family */ |
602 | _SetEPDblBuffCount(bEpNum, bDir, wCount); |
662 | _SetEPDblBuffCount(bEpNum, bDir, wCount); |
603 | #endif |
663 | #endif |
604 | 664 | ||
605 | #ifdef STR91x /*STR91x family*/ |
665 | #ifdef STR91x /*STR91x family*/ |
606 | SetEPDblBuf0Count(bEpNum, bDir,wCount); |
666 | SetEPDblBuf0Count(bEpNum, bDir, wCount); |
607 | SetEPDblBuf1Count(bEpNum, bDir,wCount); |
667 | SetEPDblBuf1Count(bEpNum, bDir, wCount); |
608 | #endif |
668 | #endif |
- | 669 | } |
|
609 | } |
670 | |
610 | /******************************************************************************* |
671 | /******************************************************************************* |
- | 672 | * Function Name : SetEPDblBuf0Count. |
|
611 | * Function Name : SetEPDblBuf0Count |
673 | * Description : Set the number of bytes in the buffer 0 of a double Buffer |
612 | * Description : |
674 | * endpoint. |
613 | * Input : bEpNum, bDir, wCount |
675 | * Input : bEpNum, bDir, wCount. |
614 | * Output : |
676 | * Output : None. |
615 | * Return : |
677 | * Return : None. |
616 | *******************************************************************************/ |
678 | *******************************************************************************/ |
617 | void SetEPDblBuf0Count(u8 bEpNum, u8 bDir,u16 wCount) |
679 | void SetEPDblBuf0Count(u8 bEpNum, u8 bDir, u16 wCount) |
618 | { |
680 | { |
619 | #ifdef STR7xx /*STR7xx family */ |
681 | #ifdef STR7xx /*STR7xx family */ |
620 | _SetEPDblBuf0Count(bEpNum,bDir,wCount); |
682 | _SetEPDblBuf0Count(bEpNum, bDir, wCount); |
621 | #endif |
683 | #endif |
622 | 684 | ||
623 | #ifdef STR91x /*STR91x family*/ |
685 | #ifdef STR91x /*STR91x family*/ |
624 | u32 BLsize=0; |
686 | u32 BLsize = 0; |
625 | u32 Blocks; |
687 | u32 Blocks; |
- | 688 | if (bDir == EP_DBUF_IN) |
|
626 | if(bDir == EP_DBUF_IN) |
689 | { |
627 | /* IN double bufferd endpoint */ |
690 | /* IN double bufferd endpoint */ |
- | 691 | SetEPTxCount(bEpNum, wCount); |
|
628 | SetEPTxCount(bEpNum,wCount); |
692 | } |
629 | else if(bDir == EP_DBUF_OUT) |
693 | else if (bDir == EP_DBUF_OUT) |
630 | { |
694 | { |
631 | /* OUT double bufferd endpoint */ |
695 | /* OUT double bufferd endpoint */ |
- | 696 | ||
- | 697 | if (wCount < 64) |
|
632 | 698 | { |
|
- | 699 | Blocks = wCount >> 1; |
|
633 | if (wCount < 64) Blocks = wCount>>1; |
700 | } |
634 | else |
701 | else |
635 | { |
702 | { |
636 | BLsize = 0x8000; |
703 | BLsize = 0x8000; |
637 | Blocks = wCount>>6; |
704 | Blocks = wCount >> 6; |
638 | } |
705 | } |
639 | *_pEPBufCount(bEpNum) &=~0x8000; |
706 | *_pEPBufCount(bEpNum) &= ~0x8000; |
640 | *_pEPBufCount(bEpNum) |=BLsize; |
707 | *_pEPBufCount(bEpNum) |= BLsize; |
641 | *_pEPBufCount(bEpNum) &=~0x7C00; |
708 | *_pEPBufCount(bEpNum) &= ~0x7C00; |
642 | *_pEPBufCount(bEpNum) |=Blocks<<10; |
709 | *_pEPBufCount(bEpNum) |= Blocks << 10; |
643 | *_pEPBufCount(bEpNum) &=0xFFFFFC00; |
710 | *_pEPBufCount(bEpNum) &= 0xFFFFFC00; |
644 | } |
711 | } |
645 | #endif |
712 | #endif |
- | 713 | } |
|
646 | } |
714 | |
647 | /******************************************************************************* |
715 | /******************************************************************************* |
- | 716 | * Function Name : SetEPDblBuf1Count. |
|
648 | * Function Name : SetEPDblBuf1Count |
717 | * Description : Set the number of bytes in the buffer 0 of a double Buffer |
649 | * Description : |
718 | * endpoint. |
650 | * Input : bEpNum, bDir, wCount |
719 | * Input : bEpNum, bDir, wCount. |
651 | * Output : |
720 | * Output : None. |
652 | * Return : |
721 | * Return : None. |
653 | *******************************************************************************/ |
722 | *******************************************************************************/ |
654 | void SetEPDblBuf1Count(u8 bEpNum, u8 bDir,u16 wCount) |
723 | void SetEPDblBuf1Count(u8 bEpNum, u8 bDir, u16 wCount) |
655 | { |
724 | { |
656 | #ifdef STR7xx /*STR7xx family */ |
725 | #ifdef STR7xx /*STR7xx family */ |
657 | _SetEPDblBuf1Count(bEpNum,bDir,wCount); |
726 | _SetEPDblBuf1Count(bEpNum, bDir, wCount); |
658 | #endif |
727 | #endif |
659 | 728 | ||
660 | #ifdef STR91x /*STR91x family*/ |
729 | #ifdef STR91x /*STR91x family*/ |
661 | if(bDir == EP_DBUF_IN) |
730 | if (bDir == EP_DBUF_IN) |
662 | /* IN double buffered endpoint */ |
731 | /* IN double buffered endpoint */ |
663 | { |
732 | { |
664 | *_pEPBufCount(bEpNum)&= 0x000FFFF; |
733 | *_pEPBufCount(bEpNum) &= 0x000FFFF; |
665 | *_pEPBufCount(bEpNum)|=(wCount<<16); |
734 | *_pEPBufCount(bEpNum) |= (wCount << 16); |
666 | } |
735 | } |
- | 736 | else if (bDir == EP_DBUF_OUT) |
|
667 | else if(bDir == EP_DBUF_OUT) |
737 | { |
668 | /* OUT double buffered endpoint */ |
738 | /* OUT double buffered endpoint */ |
- | 739 | _SetEPRxCount(bEpNum, wCount); |
|
669 | _SetEPRxCount(bEpNum, wCount); |
740 | } |
670 | #endif |
741 | #endif |
- | 742 | } |
|
671 | } |
743 | |
672 | /******************************************************************************* |
744 | /******************************************************************************* |
- | 745 | * Function Name : GetEPDblBuf0Count. |
|
673 | * Function Name : GetEPDblBuf0Count |
746 | * Description : Returns the number of byte received in the buffer 0 of a |
674 | * Description : |
747 | * double Buffer endpoint. |
675 | * Input : bEpNum |
748 | * Input : bEpNum: Endpoint Number. |
676 | * Output : |
749 | * Output : None. |
677 | * Return : |
750 | * Return : Endpoint Buffer 0 count. |
678 | *******************************************************************************/ |
751 | *******************************************************************************/ |
679 | u16 GetEPDblBuf0Count(u8 bEpNum) |
752 | u16 GetEPDblBuf0Count(u8 bEpNum) |
680 | { |
753 | { |
681 | return(_GetEPDblBuf0Count(bEpNum)); |
754 | return(_GetEPDblBuf0Count(bEpNum)); |
- | 755 | } |
|
682 | } |
756 | |
683 | /******************************************************************************* |
757 | /******************************************************************************* |
- | 758 | * Function Name : GetEPDblBuf1Count |
|
684 | * Function Name : GetEPDblBuf1Count |
759 | * Description : Returns the number of data received in the buffer 1 of a |
685 | * Description : |
760 | * double Buffer endpoint. |
686 | * Input : bEpNum |
761 | * Input : bEpNum: Endpoint Number. |
687 | * Output : |
762 | * Output : None. |
688 | * Return : |
763 | * Return : Endpoint Buffer 1 count. |
689 | *******************************************************************************/ |
764 | *******************************************************************************/ |
690 | u16 GetEPDblBuf1Count(u8 bEpNum) |
765 | u16 GetEPDblBuf1Count(u8 bEpNum) |
691 | { |
766 | { |
692 | return(_GetEPDblBuf1Count(bEpNum)); |
767 | return(_GetEPDblBuf1Count(bEpNum)); |
693 | } |
768 | } |
- | 769 | #ifdef STR7xx /*STR7xx family */ |
|
694 | #ifdef STR7xx /*STR7xx family */ |
770 | |
695 | /******************************************************************************* |
771 | /******************************************************************************* |
696 | * Function Name : GetEPDblBufDir |
772 | * Function Name : GetEPDblBufDir. |
- | 773 | * Description : gets direction of the double buffered endpoint. |
|
697 | * Description : gets direction of the double buffered endpoint |
774 | * Input : bEpNum: Endpoint Number. |
698 | * Input : bEpNum |
775 | * Output : None. |
699 | * Output : EP_DBUF_OUT, EP_DBUF_IN, |
776 | * Return : EP_DBUF_OUT, EP_DBUF_IN, |
700 | EP_DBUF_ERR if the endpoint counter not yet programmed |
- | |
701 | * Return : |
777 | * EP_DBUF_ERR if the endpoint counter not yet programmed. |
702 | *******************************************************************************/ |
778 | *******************************************************************************/ |
- | 779 | EP_DBUF_DIR GetEPDblBufDir(u8 bEpNum) |
|
703 | EP_DBUF_DIR GetEPDblBufDir(u8 bEpNum) { |
780 | { |
- | 781 | if ((u16)(*_pEPRxCount(bEpNum) & 0xFC00) != 0) |
|
704 | if((u16)(*_pEPRxCount(bEpNum) & 0xFC00) != 0) |
782 | { |
- | 783 | return(EP_DBUF_OUT); |
|
705 | return(EP_DBUF_OUT); |
784 | } |
- | 785 | else if (((u16)(*_pEPTxCount(bEpNum)) & 0x03FF) != 0) |
|
706 | else if(((u16)(*_pEPTxCount(bEpNum)) & 0x03FF) != 0) |
786 | { |
- | 787 | return(EP_DBUF_IN); |
|
707 | return(EP_DBUF_IN); |
788 | } |
- | 789 | else |
|
708 | else |
790 | { |
- | 791 | return(EP_DBUF_ERR); |
|
709 | return(EP_DBUF_ERR); |
792 | } |
710 | } |
793 | } |
- | 794 | #endif |
|
711 | #endif |
795 | |
712 | /******************************************************************************* |
796 | /******************************************************************************* |
713 | * Function Name : FreeUserBuffer |
797 | * Function Name : FreeUserBuffer. |
714 | * Description : free buffer used from the application realising it to the line |
798 | * Description : free buffer used from the application realizing it to the |
- | 799 | * line toggles bit SW_BUF in the double buffered endpoint |
|
715 | toggles bit SW_BUF in the double buffered endpoint register |
800 | * register. |
716 | * Input : bEpNum, bDir |
801 | * Input : bEpNum, bDir. |
717 | * Output : |
802 | * Output : None. |
718 | * Return : |
803 | * Return : None. |
719 | *******************************************************************************/ |
804 | *******************************************************************************/ |
720 | void FreeUserBuffer(u8 bEpNum, u8 bDir) |
805 | void FreeUserBuffer(u8 bEpNum, u8 bDir) |
721 | { |
806 | { |
722 | if(bDir== EP_DBUF_OUT) |
807 | if (bDir == EP_DBUF_OUT) |
723 | { /* OUT double buffered endpoint */ |
808 | { /* OUT double buffered endpoint */ |
724 | _ToggleDTOG_TX(bEpNum); |
809 | _ToggleDTOG_TX(bEpNum); |
725 | } |
810 | } |
726 | else if(bDir == EP_DBUF_IN) |
811 | else if (bDir == EP_DBUF_IN) |
727 | { /* IN double buffered endpoint */ |
812 | { /* IN double buffered endpoint */ |
728 | _ToggleDTOG_RX(bEpNum); |
813 | _ToggleDTOG_RX(bEpNum); |
729 | } |
814 | } |
Line 730... | Line 815... | ||
730 | } |
815 | } |
731 | 816 | ||
732 | /******************************************************************************* |
817 | /******************************************************************************* |
733 | * Function Name : ToWord |
818 | * Function Name : ToWord |
734 | * Description : |
819 | * Description : merge two byte in a word. |
735 | * Input : bh, bl |
820 | * Input : bh: byte high, bl: bytes low. |
736 | * Output : |
821 | * Output : None. |
737 | * Return : |
822 | * Return : resulted word. |
738 | *******************************************************************************/ |
823 | *******************************************************************************/ |
739 | u16 ToWord(u8 bh, u8 bl) |
824 | u16 ToWord(u8 bh, u8 bl) |
740 | { |
825 | { |
741 | u16 wRet; |
826 | u16 wRet; |
742 | wRet = (u16)bl | ((u16)bh << 8); |
827 | wRet = (u16)bl | ((u16)bh << 8); |
- | 828 | return(wRet); |
|
743 | return(wRet); |
829 | } |
744 | } |
830 | |
745 | /******************************************************************************* |
831 | /******************************************************************************* |
746 | * Function Name : ByteSwap |
832 | * Function Name : ByteSwap |
747 | * Description : |
833 | * Description : Swap two byte in a word. |
748 | * Input : wSwW |
834 | * Input : wSwW: word to Swap. |
749 | * Output : |
835 | * Output : None. |
750 | * Return : |
836 | * Return : resulted word. |
751 | *******************************************************************************/ |
837 | *******************************************************************************/ |
752 | u16 ByteSwap(u16 wSwW) |
838 | u16 ByteSwap(u16 wSwW) |
753 | { |
839 | { |
754 | u8 bTemp; |
840 | u8 bTemp; |
755 | u16 wRet; |
841 | u16 wRet; |
756 | bTemp = (u8)(wSwW & 0xff); |
842 | bTemp = (u8)(wSwW & 0xff); |
757 | wRet = (wSwW >> 8) | ((u16)bTemp << 8); |
843 | wRet = (wSwW >> 8) | ((u16)bTemp << 8); |
Line 758... | Line 844... | ||
758 | return(wRet); |
844 | return(wRet); |
759 | } |
845 | } |
760 | 846 | ||
761 | /* DMA Functions only for STR91x */ |
847 | /* DMA Functions only for STR91x */ |
762 | #ifdef STR91x /*str91x family*/ |
848 | #ifdef STR91x /*str91x family*/ |
763 | /******************************************************************************* |
849 | /******************************************************************************* |
764 | * Function Name : SetDMAburstTxSize |
850 | * Function Name : SetDMAburstTxSize. |
765 | * Description : Configure the Burst Size for a Tx Endpoint |
851 | * Description : Configure the Burst Size for a Tx Endpoint. |
766 | * Input : DestBsize: Destination Burst Size |
852 | * Input : DestBsize: Destination Burst Size. |
767 | * Output : None |
853 | * Output : None. |
768 | * Return : None |
854 | * Return : None. |
769 | *******************************************************************************/ |
855 | *******************************************************************************/ |
770 | void SetDMABurstTxSize(u8 DestBsize) |
856 | void SetDMABurstTxSize(u8 DestBsize) |
771 | { |
857 | { |
Line 772... | Line 858... | ||
772 | *DMABSIZE &=~0xEF; |
858 | *DMABSIZE &= ~0xEF; |
773 | *DMABSIZE = (DestBsize<<4); |
859 | *DMABSIZE = (DestBsize << 4); |
774 | } |
860 | } |
775 | 861 | ||
776 | /******************************************************************************* |
862 | /******************************************************************************* |
777 | * Function Name : SetDMABurstRxSize |
863 | * Function Name : SetDMABurstRxSize. |
778 | * Description : Configure the Burst Size for a Rx Endpoint |
864 | * Description : Configure the Burst Size for a Rx Endpoint. |
779 | * Input : SrcBsize: Source Burst |
865 | * Input : SrcBsize: Source Burst. |
780 | * Output : None |
866 | * Output : None. |
781 | * Return : None |
867 | * Return : None. |
782 | *******************************************************************************/ |
868 | *******************************************************************************/ |
783 | void SetDMABurstRxSize(u8 SrcBsize) |
869 | void SetDMABurstRxSize(u8 SrcBsize) |
Line 784... | Line 870... | ||
784 | { |
870 | { |
785 | *DMABSIZE &=~0x7; |
871 | *DMABSIZE &= ~0x7; |
786 | *DMABSIZE = SrcBsize; |
872 | *DMABSIZE = SrcBsize; |
787 | } |
873 | } |
788 | 874 | ||
789 | /******************************************************************************* |
875 | /******************************************************************************* |
790 | * Function Name : DMAUnlinkedModeTxConfig |
876 | * Function Name : DMAUnlinkedModeTxConfig. |
791 | * Description : Configure a Tx Endpoint to trigger TX Unlinked DMA request |
877 | * Description : Configure a Tx Endpoint to trigger TX Unlinked DMA request. |
792 | * Note : Up to three endpoints could be configured to trigger DMA |
878 | * Note : Up to three endpoints could be configured to trigger DMA |
793 | request, an index[0:2] must be associated to an endpoint |
879 | request, an index[0:2] must be associated to an endpoint. |
794 | * Input : -bEpNum: endpoint number[0:9] |
880 | * Input : -bEpNum: endpoint number[0:9]. |
795 | * -index: 0,1 or 2 |
881 | * -index: 0,1 or 2. |
796 | * Output : None |
882 | * Output : None. |
797 | * Return : None |
883 | * Return : None. |
798 | *******************************************************************************/ |
884 | *******************************************************************************/ |
Line 799... | Line 885... | ||
799 | void DMAUnlinkedModeTxConfig(u8 bEpNum ,u8 index) |
885 | void DMAUnlinkedModeTxConfig(u8 bEpNum , u8 index) |
800 | { |
886 | { |
801 | *DMACR2 &=~(0x0F<<(4*index)); |
887 | *DMACR2 &= ~(0x0F << (4 * index)); |
802 | *DMACR2 |=bEpNum<<(4*index); |
888 | *DMACR2 |= bEpNum << (4 * index); |
803 | } |
889 | } |
804 | 890 | ||
805 | /******************************************************************************* |
891 | /******************************************************************************* |
806 | * Function Name : DMAUnlinkedModeTxEnable |
892 | * Function Name : DMAUnlinkedModeTxEnable. |
807 | * Description : Enable a Tx endpoint to trigger Tx DMA request |
893 | * Description : Enable a Tx endpoint to trigger Tx DMA request. |
808 | * Input : -index :0,1 or 2 = index associated to endpoint in function |
894 | * Input : -index :0,1 or 2 = index associated to endpoint in function |
809 | * "DMAUnlinkedModeTxConfig" |
895 | * "DMAUnlinkedModeTxConfig". |
810 | * Output : None |
896 | * Output : None. |
811 | * Return : None |
897 | * Return : None. |
812 | *******************************************************************************/ |
898 | *******************************************************************************/ |
813 | void DMAUnlinkedModeTxEnable(u8 index) |
899 | void DMAUnlinkedModeTxEnable(u8 index) |
814 | { |
900 | { |
815 | *DMACR3 &=~0x01; /*DMA Tx linked mode disabled*/ |
901 | *DMACR3 &= ~0x01; /*DMA Tx linked mode disabled*/ |
816 | *DMACR2 &=~0x3000; |
902 | *DMACR2 &= ~0x3000; |
817 | *DMACR2 |=(index+1)<<12; |
903 | *DMACR2 |= (index + 1) << 12; |
818 | } |
904 | } |
819 | 905 | ||
820 | /******************************************************************************* |
906 | /******************************************************************************* |
821 | * Function Name : DMAUnlinkedModeTxDisable |
907 | * Function Name : DMAUnlinkedModeTxDisable. |
822 | * Description : Enable a Tx endpoint to trigger Tx DMA request |
908 | * Description : Enable a Tx endpoint to trigger Tx DMA request. |
823 | * Input : index :0,1 or 2 = index associated to endpoint in function |
909 | * Input : index :0,1 or 2 = index associated to endpoint in function |
824 | * "DMAUnlinkedModeTxConfig" |
910 | * "DMAUnlinkedModeTxConfig". |
825 | * Output : None |
911 | * Output : None. |
Line 826... | Line 912... | ||
826 | * Return : None |
912 | * Return : None. |
827 | *******************************************************************************/ |
913 | *******************************************************************************/ |
828 | void DMAUnlinkedModeTxDisable(u8 index) |
914 | void DMAUnlinkedModeTxDisable(u8 index) |
829 | { |
915 | { |
830 | *DMACR2 &=~0x3000; |
916 | *DMACR2 &= ~0x3000; |
831 | } |
917 | } |
832 | 918 | ||
833 | /******************************************************************************* |
919 | /******************************************************************************* |
834 | * Function Name : DMAUnlinkedModeRxEnable |
920 | * Function Name : DMAUnlinkedModeRxEnable. |
835 | * Description : Enable a Rx Endpoint to trigger Rx DMA |
921 | * Description : Enable a Rx Endpoint to trigger Rx DMA. |
836 | * Input : bEpNum: endpoint number[0:9] |
922 | * Input : bEpNum: endpoint number[0:9]. |
837 | * Output : None |
923 | * Output : None. |
Line 838... | Line 924... | ||
838 | * Return : None |
924 | * Return : None. |
839 | *******************************************************************************/ |
925 | *******************************************************************************/ |
840 | void DMAUnlinkedModeRxEnable(u8 bEpNum) |
926 | void DMAUnlinkedModeRxEnable(u8 bEpNum) |
841 | { |
927 | { |
842 | *DMACR3 &=~0x80; /*DMA Rx linked mode disabled*/ |
928 | *DMACR3 &= ~0x80; /*DMA Rx linked mode disabled*/ |
843 | *DMACR1 |=(0x1<<bEpNum); |
929 | *DMACR1 |= (0x1 << bEpNum); |
844 | } |
930 | } |
845 | 931 | ||
846 | /******************************************************************************* |
932 | /******************************************************************************* |
847 | * Function Name : DMAUnlinkedModeRxDisable |
933 | * Function Name : DMAUnlinkedModeRxDisable. |
848 | * Description : Disable a Rx Endpoint to trigger Rx DMA |
934 | * Description : Disable a Rx Endpoint to trigger Rx DMA. |
Line 849... | Line 935... | ||
849 | * Input : bEpNum: endpoint number[0:9] |
935 | * Input : bEpNum: endpoint number[0:9]. |
850 | * Output : None |
936 | * Output : None. |
851 | * Return : None |
937 | * Return : None. |
852 | *******************************************************************************/ |
938 | *******************************************************************************/ |
853 | void DMAUnlinkedModeRxDisable(u8 bEpNum) |
939 | void DMAUnlinkedModeRxDisable(u8 bEpNum) |
854 | { |
940 | { |
855 | *DMACR1 &=~(0x1<<bEpNum); |
941 | *DMACR1 &= ~(0x1 << bEpNum); |
856 | } |
942 | } |
857 | 943 | ||
858 | /******************************************************************************* |
944 | /******************************************************************************* |
859 | * Function Name : DMALinkedModeRxConfig |
945 | * Function Name : DMALinkedModeRxConfig. |
860 | * Description : Configure a Rx endpoint to trigger DMA linked request |
946 | * Description : Configure a Rx endpoint to trigger DMA linked request. |
Line 861... | Line 947... | ||
861 | * Input : bEpNum: endpoint number[0:9] |
947 | * Input : bEpNum: endpoint number[0:9]. |
862 | * Output : None |
948 | * Output : None. |
863 | * Return : None |
949 | * Return : None. |
864 | *******************************************************************************/ |
950 | *******************************************************************************/ |
865 | void DMALinkedModeRxConfig(u8 bEpNum) |
951 | void DMALinkedModeRxConfig(u8 bEpNum) |
866 | { |
952 | { |
867 | *DMACR3 &=~0x1E00; |
953 | *DMACR3 &= ~0x1E00; |
868 | *DMACR3 |=bEpNum<<9; |
954 | *DMACR3 |= bEpNum << 9; |
869 | } |
955 | } |
870 | 956 | ||
871 | /******************************************************************************* |
957 | /******************************************************************************* |
872 | * Function Name : DMALinkedModeTxConfig |
958 | * Function Name : DMALinkedModeTxConfig. |
Line 873... | Line 959... | ||
873 | * Description : Configure a Tx endpoint to trigger DMA linked request |
959 | * Description : Configure a Tx endpoint to trigger DMA linked request. |
874 | * Input : bEpNum: endpoint number[0:9] |
960 | * Input : bEpNum: endpoint number[0:9]. |
875 | * Output : None |
961 | * Output : None. |
876 | * Return : None |
962 | * Return : None. |
877 | *******************************************************************************/ |
963 | *******************************************************************************/ |
878 | void DMALinkedModeTxConfig(u8 bEpNum) |
964 | void DMALinkedModeTxConfig(u8 bEpNum) |
879 | { |
965 | { |
880 | *DMACR3 &=~0x1E; |
966 | *DMACR3 &= ~0x1E; |
881 | *DMACR3 |=bEpNum<<1; |
967 | *DMACR3 |= bEpNum << 1; |
882 | } |
968 | } |
883 | 969 | ||
884 | /******************************************************************************* |
970 | /******************************************************************************* |
Line 885... | Line 971... | ||
885 | * Function Name : DMALinkedModeRxEnable |
971 | * Function Name : DMALinkedModeRxEnable. |
886 | * Description : Enable the DMA Linked Rx mode |
972 | * Description : Enable the DMA Linked Rx mode. |
887 | * Input : None |
973 | * Input : None. |
888 | * Output : None |
974 | * Output : None. |
889 | * Return : None |
975 | * Return : None. |
890 | *******************************************************************************/ |
976 | *******************************************************************************/ |
891 | void DMALinkedModeRxEnable(void) |
977 | void DMALinkedModeRxEnable(void) |
892 | { |
978 | { |
893 | *DMACR3 |=0x100; |
979 | *DMACR3 |= 0x100; |
894 | *DMACR3 |=0x2000; |
980 | *DMACR3 |= 0x2000; |
895 | } |
981 | } |
896 | 982 | ||
897 | /******************************************************************************* |
983 | /******************************************************************************* |
898 | * Function Name : DMALinkedModeTxEnable |
984 | * Function Name : DMALinkedModeTxEnable. |
899 | * Description : Enable the DMA Linked Tx mode |
985 | * Description : Enable the DMA Linked Tx mode. |
900 | * Input : None |
986 | * Input : None. |
901 | * Output : None |
987 | * Output : None. |
902 | * Return : None |
988 | * Return : None. |
903 | *******************************************************************************/ |
989 | *******************************************************************************/ |
904 | void DMALinkedModeTxEnable(void) |
990 | void DMALinkedModeTxEnable(void) |
905 | { |
991 | { |
906 | *DMACR3 |=0x1; |
992 | *DMACR3 |= 0x1; |
907 | *DMACR3 |=0x20; |
993 | *DMACR3 |= 0x20; |
908 | } |
994 | } |
Line 909... | Line 995... | ||
909 | /******************************************************************************* |
995 | /******************************************************************************* |
910 | * Function Name : DMALinkedModeRxDisable |
996 | * Function Name : DMALinkedModeRxDisable. |
911 | * Description : Disable the DMA Linked Rx mode |
997 | * Description : Disable the DMA Linked Rx mode. |
912 | * Input : None |
998 | * Input : None. |
913 | * Output : None |
999 | * Output : None. |
914 | * Return : None |
1000 | * Return : None. |
915 | *******************************************************************************/ |
1001 | *******************************************************************************/ |
916 | void DMALinkedModeRxDisable(void) |
1002 | void DMALinkedModeRxDisable(void) |
917 | { |
1003 | { |
918 | *DMACR3 &=~0x100; |
1004 | *DMACR3 &= ~0x100; |
919 | *DMACR3 &=~0x2000; |
1005 | *DMACR3 &= ~0x2000; |
920 | } |
1006 | } |
921 | 1007 | ||
922 | /******************************************************************************* |
1008 | /******************************************************************************* |
923 | * Function Name : DMALinkedModeTxDisable |
1009 | * Function Name : DMALinkedModeTxDisable. |
924 | * Description : Disable the DMA Linked Tx mode |
1010 | * Description : Disable the DMA Linked Tx mode. |
925 | * Input : None |
1011 | * Input : None. |
926 | * Output : None |
1012 | * Output : None. |
927 | * Return : None |
1013 | * Return : None. |
928 | *******************************************************************************/ |
1014 | *******************************************************************************/ |
929 | void DMALinkedModeTxDisable(void) |
1015 | void DMALinkedModeTxDisable(void) |
930 | { |
1016 | { |
931 | *DMACR3 &=~0x1; |
1017 | *DMACR3 &= ~0x1; |
Line 932... | Line 1018... | ||
932 | *DMACR3 &=~0x20; |
1018 | *DMACR3 &= ~0x20; |
933 | } |
1019 | } |
934 | /******************************************************************************* |
1020 | /******************************************************************************* |
935 | * Function Name : USB_DMASynchEnable |
1021 | * Function Name : USB_DMASynchEnable. |
936 | * Description : Enable the Synchronization Logic |
1022 | * Description : Enable the Synchronization Logic. |
937 | * Input : TRUE or FALSE |
1023 | * Input : TRUE or FALSE. |
938 | * Output : None |
1024 | * Output : None. |
939 | * Return : None |
1025 | * Return : None. |
940 | *******************************************************************************/ |
1026 | *******************************************************************************/ |
941 | void DMASynchEnable(void) |
1027 | void DMASynchEnable(void) |
942 | { |
1028 | { |
Line 943... | Line 1029... | ||
943 | *DMACR3 |=0x40; |
1029 | *DMACR3 |= 0x40; |
944 | } |
1030 | } |
945 | 1031 | ||
946 | /******************************************************************************* |
1032 | /******************************************************************************* |
947 | * Function Name : USB_DMASynchDisable |
1033 | * Function Name : USB_DMASynchDisable. |
948 | * Description : Disable the Synchronization Logic |
1034 | * Description : Disable the Synchronization Logic. |
949 | * Input : TRUE or FALSE |
1035 | * Input : TRUE or FALSE. |
950 | * Output : None |
1036 | * Output : None. |
951 | * Return : None |
1037 | * Return : None. |
952 | *******************************************************************************/ |
1038 | *******************************************************************************/ |
953 | void DMASynchDisable(void) |
1039 | void DMASynchDisable(void) |
954 | { |
1040 | { |
Line 955... | Line 1041... | ||
955 | *DMACR3 &=~0x40; |
1041 | *DMACR3 &= ~0x40; |
956 | } |
1042 | } |
957 | 1043 | ||
958 | /******************************************************************************* |
1044 | /******************************************************************************* |
959 | * Function Name : SetDMALLITxLength |
1045 | * Function Name : SetDMALLITxLength. |
960 | * Description : Set the DMA LLI Tx length |
1046 | * Description : Set the DMA LLI Tx length. |
961 | * Input : length |
1047 | * Input : length. |
962 | * Output : None |
1048 | * Output : None. |
963 | * Return : None |
1049 | * Return : None. |
964 | *******************************************************************************/ |
1050 | *******************************************************************************/ |
965 | void SetDMALLITxLength(u8 length) |
1051 | void SetDMALLITxLength(u8 length) |
966 | { |
1052 | { |
Line 967... | Line 1053... | ||
967 | *DMALLI &=~0xFF; |
1053 | *DMALLI &= ~0xFF; |
968 | *DMALLI |= length; |
1054 | *DMALLI |= length; |
969 | } |
1055 | } |
970 | 1056 | ||
971 | /******************************************************************************* |
1057 | /******************************************************************************* |
972 | * Function Name : SetDMALLIRxLength |
1058 | * Function Name : SetDMALLIRxLength. |
973 | * Description : Set the DMA LLI Rx length |
1059 | * Description : Set the DMA LLI Rx length. |
974 | * Input : length |
1060 | * Input : length. |
975 | * Output : None |
1061 | * Output : None. |
976 | * Return : None |
1062 | * Return : None. |
977 | *******************************************************************************/ |
1063 | *******************************************************************************/ |
978 | void SetDMALLIRxLength(u8 length ) |
1064 | void SetDMALLIRxLength(u8 length ) |
Line 979... | Line 1065... | ||
979 | { |
1065 | { |
980 | *DMALLI &=~0xFF00; |
1066 | *DMALLI &= ~0xFF00; |
981 | *DMALLI |= length<<8; |
1067 | *DMALLI |= length << 8; |
982 | } |
1068 | } |
983 | 1069 | ||
984 | /******************************************************************************* |
1070 | /******************************************************************************* |
985 | * Function Name : SetDMALLIRxPacketNum |
1071 | * Function Name : SetDMALLIRxPacketNum. |
986 | * Description : Set the LLI_RX_NPACKETS field in register USB_DMABSIZE register |
1072 | * Description : Set the LLI_RX_NPACKETS field in USB_DMABSIZE register. |
987 | * Input : None |
1073 | * Input : None. |
988 | * Output : None |
1074 | * Output : None. |
989 | * Return : None |
1075 | * Return : None. |
990 | *******************************************************************************/ |
1076 | *******************************************************************************/ |
991 | void SetDMALLIRxPacketNum(u8 PacketNum) |
1077 | void SetDMALLIRxPacketNum(u8 PacketNum) |