Rev 1 | Go to most recent revision | Show entire file | Regard 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.h |
2 | * File Name : usb_regs.h |
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 prototype functions to USB cell registers |
6 | * Description : Interface prototype 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. |
18 | *******************************************************************************/ |
14 | *******************************************************************************/ |
- | 15 | ||
19 | /* Define to prevent recursive inclusion -------------------------------------*/ |
16 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | #ifndef __USB_REGS_H |
17 | #ifndef __USB_REGS_H |
21 | #define __USB_REGS_H |
18 | #define __USB_REGS_H |
- | 19 | ||
22 | /* Includes ------------------------------------------------------------------*/ |
20 | /* Includes ------------------------------------------------------------------*/ |
23 | /* Exported types ------------------------------------------------------------*/ |
21 | /* Exported types ------------------------------------------------------------*/ |
Line 24... | Line 22... | ||
24 | 22 | ||
25 | typedef enum _EP_DBUF_DIR{ /* double buffered endpoint direction */ |
23 | typedef enum _EP_DBUF_DIR{ /* double buffered endpoint direction */ |
Line 62... | Line 60... | ||
62 | #define PMAAddr (0x70000000L) /* USB_IP Packet Memory Area base address */ |
60 | #define PMAAddr (0x70000000L) /* USB_IP Packet Memory Area base address */ |
63 | #endif |
61 | #endif |
64 | #endif |
62 | #endif |
Line 65... | Line 63... | ||
65 | 63 | ||
- | 64 | /* General registers */ |
|
66 | /* General registers */ |
65 | /* Control register */ |
- | 66 | #define CNTR ((volatile unsigned *)(RegBase + 0x40)) |
|
67 | #define CNTR ((volatile unsigned *)(RegBase + 0x40)) /* Control register */ |
67 | /* Interrupt status register */ |
- | 68 | #define ISTR ((volatile unsigned *)(RegBase + 0x44)) |
|
68 | #define ISTR ((volatile unsigned *)(RegBase + 0x44)) /* Interrupt status register */ |
69 | /* Frame number register */ |
- | 70 | #define FNR ((volatile unsigned *)(RegBase + 0x48)) |
|
69 | #define FNR ((volatile unsigned *)(RegBase + 0x48)) /* Frame number register */ |
71 | /* Device address register */ |
- | 72 | #define DADDR ((volatile unsigned *)(RegBase + 0x4C)) |
|
70 | #define DADDR ((volatile unsigned *)(RegBase + 0x4C)) /* Device address register */ |
73 | /* Buffer Table address register */ |
Line 71... | Line 74... | ||
71 | #define BTABLE ((volatile unsigned *)(RegBase + 0x50)) /* Buffer Table address register */ |
74 | #define BTABLE ((volatile unsigned *)(RegBase + 0x50)) |
72 | - | ||
- | 75 | ||
73 | #ifdef STR91x /*STR91x family DMA registers*/ |
76 | #ifdef STR91x /*STR91x family DMA registers*/ |
- | 77 | /* DMA control register 1 */ |
|
74 | 78 | #define DMACR1 ((volatile unsigned *)(RegBase + 0x54)) |
|
- | 79 | /* DMA control register 2 */ |
|
75 | #define DMACR1 ((volatile unsigned *)(RegBase + 0x54)) /* DMA control register 1 */ |
80 | #define DMACR2 ((volatile unsigned *)(RegBase + 0x58)) |
- | 81 | /* DMA control register 3 */ |
|
76 | #define DMACR2 ((volatile unsigned *)(RegBase + 0x58)) /* DMA control register 2 */ |
82 | #define DMACR3 ((volatile unsigned *)(RegBase + 0x5C)) |
- | 83 | /* DMA burst size register */ |
|
77 | #define DMACR3 ((volatile unsigned *)(RegBase + 0x5C)) /* DMA control register 3 */ |
84 | #define DMABSIZE ((volatile unsigned *)(RegBase + 0x60)) |
Line 78... | Line 85... | ||
78 | #define DMABSIZE ((volatile unsigned *)(RegBase + 0x60))/* DMA burst size register */ |
85 | /* DMA LLI register */ |
Line 79... | Line 86... | ||
79 | #define DMALLI ((volatile unsigned *)(RegBase + 0x64)) /* DMA LLI register */ |
86 | #define DMALLI ((volatile unsigned *)(RegBase + 0x64)) |
- | 87 | ||
80 | 88 | #endif |
|
81 | #endif |
89 | |
82 | 90 | /* Endpoint registers */ |
|
83 | /* Endpoint registers */ |
91 | /* endpoint 0 register address */ |
84 | #define EP0REG ((volatile unsigned *)(RegBase)) /* endpoint 0 register address */ |
92 | #define EP0REG ((volatile unsigned *)(RegBase)) |
85 | /* endpoints enumeration */ |
93 | /* endpoints enumeration */ |
Line 98... | Line 106... | ||
98 | #define ENDP12 ((u8)12) |
106 | #define ENDP12 ((u8)12) |
99 | #define ENDP13 ((u8)13) |
107 | #define ENDP13 ((u8)13) |
100 | #define ENDP14 ((u8)14) |
108 | #define ENDP14 ((u8)14) |
101 | #define ENDP15 ((u8)15) |
109 | #define ENDP15 ((u8)15) |
Line 102... | Line 110... | ||
102 | 110 | ||
103 | /*******************************************************************************/ |
111 | /******************************************************************************/ |
104 | /* ISTR interrupt events */ |
112 | /* ISTR interrupt events */ |
105 | /*******************************************************************************/ |
113 | /******************************************************************************/ |
106 | #define ISTR_CTR (0x8000) /* Correct TRansfer (clear-only bit) */ |
114 | #define ISTR_CTR (0x8000) /* Correct TRansfer (clear-only bit) */ |
107 | #define ISTR_DOVR (0x4000) /* DMA OVeR/underrun (clear-only bit) */ |
115 | #define ISTR_DOVR (0x4000) /* DMA OVeR/underrun (clear-only bit) */ |
108 | #define ISTR_ERR (0x2000) /* ERRor (clear-only bit) */ |
116 | #define ISTR_ERR (0x2000) /* ERRor (clear-only bit) */ |
109 | #define ISTR_WKUP (0x1000) /* WaKe UP (clear-only bit) */ |
117 | #define ISTR_WKUP (0x1000) /* WaKe UP (clear-only bit) */ |
Line 130... | Line 138... | ||
130 | 138 | ||
131 | #ifdef STR91x /*STR91x family*/ |
139 | #ifdef STR91x /*STR91x family*/ |
132 | #define CLR_SZDPR (~ISTR_SZDPR)/* clear SZDPR bit */ |
140 | #define CLR_SZDPR (~ISTR_SZDPR) /* clear SZDPR bit */ |
Line 133... | Line 141... | ||
133 | #endif |
141 | #endif |
134 | 142 | ||
135 | /*******************************************************************************/ |
143 | /******************************************************************************/ |
136 | /* CNTR control register bits definitions */ |
144 | /* CNTR control register bits definitions */ |
137 | /*******************************************************************************/ |
145 | /******************************************************************************/ |
138 | #define CNTR_CTRM (0x8000) /* Correct TRansfer Mask */ |
146 | #define CNTR_CTRM (0x8000) /* Correct TRansfer Mask */ |
139 | #define CNTR_DOVRM (0x4000) /* DMA OVeR/underrun Mask */ |
147 | #define CNTR_DOVRM (0x4000) /* DMA OVeR/underrun Mask */ |
140 | #define CNTR_ERRM (0x2000) /* ERRor Mask */ |
148 | #define CNTR_ERRM (0x2000) /* ERRor Mask */ |
Line 152... | Line 160... | ||
152 | #define CNTR_FSUSP (0x0008) /* Force SUSPend */ |
160 | #define CNTR_FSUSP (0x0008) /* Force SUSPend */ |
153 | #define CNTR_LPMODE (0x0004) /* Low-power MODE */ |
161 | #define CNTR_LPMODE (0x0004) /* Low-power MODE */ |
154 | #define CNTR_PDWN (0x0002) /* Power DoWN */ |
162 | #define CNTR_PDWN (0x0002) /* Power DoWN */ |
155 | #define CNTR_FRES (0x0001) /* Force USB RESet */ |
163 | #define CNTR_FRES (0x0001) /* Force USB RESet */ |
Line 156... | Line 164... | ||
156 | 164 | ||
157 | /*******************************************************************************/ |
165 | /******************************************************************************/ |
158 | /* FNR Frame Number Register bit definitions */ |
166 | /* FNR Frame Number Register bit definitions */ |
159 | /*******************************************************************************/ |
167 | /******************************************************************************/ |
160 | #define FNR_RXDP (0x8000) /* status of D+ data line */ |
168 | #define FNR_RXDP (0x8000) /* status of D+ data line */ |
161 | #define FNR_RXDM (0x4000) /* status of D- data line */ |
169 | #define FNR_RXDM (0x4000) /* status of D- data line */ |
162 | #define FNR_LCK (0x2000) /* LoCKed */ |
170 | #define FNR_LCK (0x2000) /* LoCKed */ |
163 | #define FNR_LSOF (0x1800) /* Lost SOF */ |
171 | #define FNR_LSOF (0x1800) /* Lost SOF */ |
164 | #define FNR_FN (0x07FF) /* Frame Number */ |
172 | #define FNR_FN (0x07FF) /* Frame Number */ |
165 | /*******************************************************************************/ |
173 | /******************************************************************************/ |
166 | /* DADDR Device ADDRess bit definitions */ |
174 | /* DADDR Device ADDRess bit definitions */ |
167 | /*******************************************************************************/ |
175 | /******************************************************************************/ |
168 | #define DADDR_EF (0x80) |
176 | #define DADDR_EF (0x80) |
- | 177 | #define DADDR_ADD (0x7F) |
|
169 | #define DADDR_ADD (0x7F) |
178 | |
170 | /*===============================================================================*/ |
179 | /******************************************************************************/ |
171 | /* Endpoint register */ |
- | |
172 | /*===============================================================================*/ |
- | |
173 | /* bit positions */ |
180 | /* Endpoint register */ |
174 | #define EP_CTR_RX (0x8000) /* EndPoint Correct TRansfer RX */ |
181 | #define EP_CTR_RX (0x8000) /* EndPoint Correct TRansfer RX */ |
175 | #define EP_DTOG_RX (0x4000) /* EndPoint Data TOGGLE RX */ |
182 | #define EP_DTOG_RX (0x4000) /* EndPoint Data TOGGLE RX */ |
176 | #define EPRX_STAT (0x3000) /* EndPoint RX STATus bit field */ |
183 | #define EPRX_STAT (0x3000) /* EndPoint RX STATus bit field */ |
177 | #define EP_SETUP (0x0800) /* EndPoint SETUP */ |
184 | #define EP_SETUP (0x0800) /* EndPoint SETUP */ |
Line 181... | Line 188... | ||
181 | #define EP_DTOG_TX (0x0040) /* EndPoint Data TOGGLE TX */ |
188 | #define EP_DTOG_TX (0x0040) /* EndPoint Data TOGGLE TX */ |
182 | #define EPTX_STAT (0x0030) /* EndPoint TX STATus bit field */ |
189 | #define EPTX_STAT (0x0030) /* EndPoint TX STATus bit field */ |
183 | #define EPADDR_FIELD (0x000F) /* EndPoint ADDRess FIELD */ |
190 | #define EPADDR_FIELD (0x000F) /* EndPoint ADDRess FIELD */ |
Line 184... | Line 191... | ||
184 | 191 | ||
185 | /* EndPoint REGister MASK (no toggle fields) */ |
192 | /* EndPoint REGister MASK (no toggle fields) */ |
- | 193 | #define EPREG_MASK (EP_CTR_RX | EP_SETUP | EP_T_FIELD | EP_KIND |\ |
|
Line 186... | Line 194... | ||
186 | #define EPREG_MASK (EP_CTR_RX|EP_SETUP|EP_T_FIELD|EP_KIND|EP_CTR_TX|EPADDR_FIELD) |
194 | EP_CTR_TX |EPADDR_FIELD) |
187 | 195 | ||
188 | /* EP_TYPE[1:0] EndPoint TYPE */ |
196 | /* EP_TYPE[1:0] EndPoint TYPE */ |
189 | #define EP_TYPE_MASK (0x0600) /* EndPoint TYPE Mask */ |
197 | #define EP_TYPE_MASK (0x0600) /* EndPoint TYPE Mask */ |
Line 213... | Line 221... | ||
213 | #define EP_RX_VALID (0x3000) /* EndPoint RX VALID */ |
221 | #define EP_RX_VALID (0x3000) /* EndPoint RX VALID */ |
214 | #define EPRX_DTOG1 (0x1000) /* EndPoint RX Data TOGgle bit1 */ |
222 | #define EPRX_DTOG1 (0x1000) /* EndPoint RX Data TOGgle bit1 */ |
215 | #define EPRX_DTOG2 (0x2000) /* EndPoint RX Data TOGgle bit1 */ |
223 | #define EPRX_DTOG2 (0x2000) /* EndPoint RX Data TOGgle bit1 */ |
216 | #define EPRX_DTOGMASK (EPRX_STAT|EPREG_MASK) |
224 | #define EPRX_DTOGMASK (EPRX_STAT|EPREG_MASK) |
Line 217... | Line 225... | ||
217 | 225 | ||
218 | /* Exported macro ------------------------------------------------------------*/ |
- | |
- | 226 | /* Exported macro */ |
|
219 | /*----------------------------------------------------------------*/ |
227 | |
220 | /* SetCNTR */ |
- | |
221 | /*----------------------------------------------------------------*/ |
228 | /* SetCNTR */ |
222 | #define _SetCNTR(wRegValue) (*CNTR = (u16)wRegValue) |
- | |
- | 229 | #define _SetCNTR(wRegValue) (*CNTR = (u16)wRegValue) |
|
223 | /*----------------------------------------------------------------*/ |
230 | |
224 | /* SetISTR */ |
- | |
225 | /*----------------------------------------------------------------*/ |
231 | /* SetISTR */ |
226 | #define _SetISTR(wRegValue) (*ISTR = (u16)wRegValue) |
- | |
- | 232 | #define _SetISTR(wRegValue) (*ISTR = (u16)wRegValue) |
|
227 | /*----------------------------------------------------------------*/ |
233 | |
228 | /* SetDADDR */ |
- | |
229 | /*----------------------------------------------------------------*/ |
234 | /* SetDADDR */ |
230 | #define _SetDADDR(wRegValue) (*DADDR = (u16)wRegValue) |
- | |
- | 235 | #define _SetDADDR(wRegValue) (*DADDR = (u16)wRegValue) |
|
231 | /*----------------------------------------------------------------*/ |
236 | |
232 | /* SetBTABLE */ |
- | |
233 | /*----------------------------------------------------------------*/ |
237 | /* SetBTABLE */ |
234 | #define _SetBTABLE(wRegValue)(*BTABLE = (u16)(wRegValue & 0xFFF8)) |
- | |
- | 238 | #define _SetBTABLE(wRegValue)(*BTABLE = (u16)(wRegValue & 0xFFF8)) |
|
235 | /*----------------------------------------------------------------*/ |
239 | |
236 | /* GetCNTR */ |
- | |
237 | /*----------------------------------------------------------------*/ |
240 | /* GetCNTR */ |
238 | #define _GetCNTR() ((u16) *CNTR) |
- | |
- | 241 | #define _GetCNTR() ((u16) *CNTR) |
|
239 | /*----------------------------------------------------------------*/ |
242 | |
240 | /* GetISTR */ |
- | |
241 | /*----------------------------------------------------------------*/ |
243 | /* GetISTR */ |
242 | #define _GetISTR() ((u16) *ISTR) |
- | |
- | 244 | #define _GetISTR() ((u16) *ISTR) |
|
243 | /*----------------------------------------------------------------*/ |
245 | |
244 | /* GetFNR */ |
- | |
245 | /*----------------------------------------------------------------*/ |
246 | /* GetFNR */ |
246 | #define _GetFNR() ((u16) *FNR) |
- | |
- | 247 | #define _GetFNR() ((u16) *FNR) |
|
247 | /*----------------------------------------------------------------*/ |
248 | |
248 | /* GetDADDR */ |
- | |
249 | /*----------------------------------------------------------------*/ |
249 | /* GetDADDR */ |
250 | #define _GetDADDR() ((u16) *DADDR) |
- | |
- | 250 | #define _GetDADDR() ((u16) *DADDR) |
|
251 | /*----------------------------------------------------------------*/ |
251 | |
252 | /* GetBTABLE */ |
- | |
253 | /*----------------------------------------------------------------*/ |
252 | /* GetBTABLE */ |
254 | #define _GetBTABLE() ((u16) *BTABLE) |
- | |
- | 253 | #define _GetBTABLE() ((u16) *BTABLE) |
|
255 | /*----------------------------------------------------------------*/ |
254 | |
256 | /* SetENDPOINT */ |
- | |
257 | /*----------------------------------------------------------------*/ |
255 | /* SetENDPOINT */ |
258 | #define _SetENDPOINT(bEpNum,wRegValue) (*(EP0REG + bEpNum)= \ |
256 | #define _SetENDPOINT(bEpNum,wRegValue) (*(EP0REG + bEpNum)= \ |
259 | (u16)wRegValue) |
- | |
- | 257 | (u16)wRegValue) |
|
260 | /*----------------------------------------------------------------*/ |
258 | |
261 | /* GetENDPOINT */ |
- | |
262 | /*----------------------------------------------------------------*/ |
259 | /* GetENDPOINT */ |
263 | #define _GetENDPOINT(bEpNum) ((u16)(*(EP0REG + bEpNum))) |
260 | #define _GetENDPOINT(bEpNum) ((u16)(*(EP0REG + bEpNum))) |
264 | /*----------------------------------------------------------------*/ |
261 | /******************************************************************************* |
265 | /* SetEPType */ |
262 | * Macro Name : SetEPType |
266 | /* sets the type in the endpoint register(bits EP_TYPE[1:0]) */ |
263 | * Description : sets the type in the endpoint register(bits EP_TYPE[1:0]) |
- | 264 | * Input : bEpNum: Endpoint Number. |
|
267 | /* IN : bEpNum = endpoint number */ |
265 | * wType |
268 | /* wType = type definition */ |
266 | * Output : None. |
269 | /* OUT: none */ |
267 | * Return : None. |
270 | /*----------------------------------------------------------------*/ |
268 | *******************************************************************************/ |
271 | #define _SetEPType(bEpNum,wType) (_SetENDPOINT(bEpNum,\ |
269 | #define _SetEPType(bEpNum,wType) (_SetENDPOINT(bEpNum,\ |
- | 270 | ((_GetENDPOINT(bEpNum) & EP_T_MASK) | wType))) |
|
272 | ((_GetENDPOINT(bEpNum) & EP_T_MASK) | wType))) |
271 | |
273 | /*----------------------------------------------------------------*/ |
272 | /******************************************************************************* |
274 | /* GetEPType */ |
273 | * Macro Name : GetEPType |
275 | /* gets the type in the endpoint register(bits EP_TYPE[1:0]) */ |
274 | * Description : gets the type in the endpoint register(bits EP_TYPE[1:0]) |
276 | /* IN : bEpNum = endpoint number */ |
275 | * Input : bEpNum: Endpoint Number. |
- | 276 | * Output : None. |
|
277 | /* OUT: type definition */ |
277 | * Return : Endpoint Type |
278 | /*----------------------------------------------------------------*/ |
278 | *******************************************************************************/ |
- | 279 | #define _GetEPType(bEpNum) (_GetENDPOINT(bEpNum) & EP_T_FIELD) |
|
279 | #define _GetEPType(bEpNum) (_GetENDPOINT(bEpNum) & EP_T_FIELD) |
280 | |
280 | /*----------------------------------------------------------------*/ |
281 | /******************************************************************************* |
281 | /* SetEPTxStatus */ |
282 | * Macro Name : SetEPTxStatus |
282 | /* sets the status for tx transfer (bits STAT_TX[1:0]) */ |
283 | * Description : sets the status for tx transfer (bits STAT_TX[1:0]). |
283 | /* IN : bEpNum = endpoint number */ |
284 | * Input : bEpNum: Endpoint Number. |
284 | /* wState = new state */ |
285 | * wState: new state |
- | 286 | * Output : None. |
|
285 | /* OUT: none */ |
287 | * Return : None. |
286 | /*----------------------------------------------------------------*/ |
288 | *******************************************************************************/ |
287 | #define _SetEPTxStatus(bEpNum,wState) {\ |
289 | #define _SetEPTxStatus(bEpNum,wState) {\ |
288 | register u16 _wRegVal; \ |
290 | register u16 _wRegVal; \ |
289 | _wRegVal = _GetENDPOINT(bEpNum) & EPTX_DTOGMASK;\ |
291 | _wRegVal = _GetENDPOINT(bEpNum) & EPTX_DTOGMASK;\ |
290 | /* toggle first bit ? */ \ |
292 | /* toggle first bit ? */ \ |
Line 294... | Line 296... | ||
294 | if((EPTX_DTOG2 & wState)!= 0) \ |
296 | if((EPTX_DTOG2 & wState)!= 0) \ |
295 | _wRegVal ^= EPTX_DTOG2; \ |
297 | _wRegVal ^= EPTX_DTOG2; \ |
296 | _SetENDPOINT(bEpNum, _wRegVal); \ |
298 | _SetENDPOINT(bEpNum, _wRegVal); \ |
297 | } /* _SetEPTxStatus */ |
299 | } /* _SetEPTxStatus */ |
Line 298... | Line 300... | ||
298 | 300 | ||
299 | /*----------------------------------------------------------------*/ |
301 | /******************************************************************************* |
300 | /* SetEPRxStatus */ |
302 | * Macro Name : SetEPRxStatus |
301 | /* sets the status for rx transfer (bits STAT_TX[1:0]) */ |
303 | * Description : sets the status for rx transfer (bits STAT_TX[1:0]) |
302 | /* IN : bEpNum = endpoint number */ |
304 | * Input : bEpNum: Endpoint Number. |
303 | /* wState = new state */ |
305 | * wState: new state. |
- | 306 | * Output : None. |
|
304 | /* OUT: none */ |
307 | * Return : None. |
305 | /*----------------------------------------------------------------*/ |
308 | *******************************************************************************/ |
306 | #define _SetEPRxStatus(bEpNum,wState) {\ |
309 | #define _SetEPRxStatus(bEpNum,wState) {\ |
307 | register u16 _wRegVal; \ |
310 | register u16 _wRegVal; \ |
308 | \ |
311 | \ |
309 | _wRegVal = _GetENDPOINT(bEpNum) & EPRX_DTOGMASK;\ |
312 | _wRegVal = _GetENDPOINT(bEpNum) & EPRX_DTOGMASK;\ |
Line 313... | Line 316... | ||
313 | /* toggle second bit ? */ \ |
316 | /* toggle second bit ? */ \ |
314 | if((EPRX_DTOG2 & wState)!= 0) \ |
317 | if((EPRX_DTOG2 & wState)!= 0) \ |
315 | _wRegVal ^= EPRX_DTOG2; \ |
318 | _wRegVal ^= EPRX_DTOG2; \ |
316 | _SetENDPOINT(bEpNum, _wRegVal); \ |
319 | _SetENDPOINT(bEpNum, _wRegVal); \ |
317 | } /* _SetEPRxStatus */ |
320 | } /* _SetEPRxStatus */ |
- | 321 | ||
318 | /*----------------------------------------------------------------*/ |
322 | /******************************************************************************* |
319 | /* GetEPTxStatus / GetEPRxStatus */ |
323 | * Macro Name : GetEPTxStatus / GetEPRxStatus |
320 | /* gets the status for tx/rx transfer (bits STAT_TX[1:0]/STAT_RX[1:0]) */ |
324 | * Description : gets the status for tx/rx transfer (bits STAT_TX[1:0] |
- | 325 | * /STAT_RX[1:0]) |
|
321 | /* IN : bEpNum = endpoint number */ |
326 | * Input : bEpNum: Endpoint Number. |
- | 327 | * Output : None. |
|
322 | /* OUT: u16 status */ |
328 | * Return : status . |
323 | /*----------------------------------------------------------------*/ |
329 | *******************************************************************************/ |
324 | #define _GetEPTxStatus(bEpNum) ((u16)_GetENDPOINT(bEpNum) & EPTX_STAT) |
330 | #define _GetEPTxStatus(bEpNum) ((u16)_GetENDPOINT(bEpNum) & EPTX_STAT) |
325 | #define _GetEPRxStatus(bEpNum) ((u16)_GetENDPOINT(bEpNum) & EPRX_STAT) |
331 | #define _GetEPRxStatus(bEpNum) ((u16)_GetENDPOINT(bEpNum) & EPRX_STAT) |
- | 332 | ||
326 | /*----------------------------------------------------------------*/ |
333 | /******************************************************************************* |
327 | /* SetEPTxValid / SetEPRxValid */ |
334 | * Macro Name : SetEPTxValid / SetEPRxValid |
328 | /* sets directly the VALID tx/rx-status into the enpoint register */ |
335 | * Description : sets directly the VALID tx/rx-status into the enpoint register |
329 | /* IN : bEpNum = endpoint number */ |
336 | * Input : bEpNum: Endpoint Number. |
330 | /* OUT: none */ |
337 | * Output : None. |
- | 338 | * Return : None. |
|
331 | /*----------------------------------------------------------------*/ |
339 | *******************************************************************************/ |
332 | #define _SetEPTxValid(bEpNum) (_SetEPTxStatus(bEpNum, EP_TX_VALID)) |
340 | #define _SetEPTxValid(bEpNum) (_SetEPTxStatus(bEpNum, EP_TX_VALID)) |
333 | #define _SetEPRxValid(bEpNum) (_SetEPRxStatus(bEpNum, EP_RX_VALID)) |
341 | #define _SetEPRxValid(bEpNum) (_SetEPRxStatus(bEpNum, EP_RX_VALID)) |
- | 342 | ||
334 | /*----------------------------------------------------------------*/ |
343 | /******************************************************************************* |
335 | /* GetTxStallStatus / GetRxStallStatus */ |
344 | * Macro Name : GetTxStallStatus / GetRxStallStatus. |
336 | /* checks stall condition in an endpoint */ |
345 | * Description : checks stall condition in an endpoint. |
337 | /* IN : bEpNum = endpoint number */ |
346 | * Input : bEpNum: Endpoint Number. |
- | 347 | * Output : None. |
|
338 | /* OUT: TRUE = endpoint in stall condition */ |
348 | * Return : TRUE = endpoint in stall condition. |
339 | /*----------------------------------------------------------------*/ |
349 | *******************************************************************************/ |
340 | #define _GetTxStallStatus(bEpNum) (_GetEPTxStatus(bEpNum) \ |
350 | #define _GetTxStallStatus(bEpNum) (_GetEPTxStatus(bEpNum) \ |
341 | == EP_TX_STALL) |
351 | == EP_TX_STALL) |
342 | #define _GetRxStallStatus(bEpNum) (_GetEPRxStatus(bEpNum) \ |
352 | #define _GetRxStallStatus(bEpNum) (_GetEPRxStatus(bEpNum) \ |
343 | == EP_RX_STALL) |
353 | == EP_RX_STALL) |
344 | /*----------------------------------------------------------------*/ |
354 | /******************************************************************************* |
345 | /* SetEP_KIND / ClearEP_KIND */ |
355 | * Macro Name : SetEP_KIND / ClearEP_KIND. |
- | 356 | * Description : set & clear EP_KIND bit. |
|
346 | /* IN : bEpNum = endpoint number */ |
357 | * Input : bEpNum: Endpoint Number. |
347 | /* OUT: none */ |
358 | * Output : None. |
- | 359 | * Return : None. |
|
348 | /*----------------------------------------------------------------*/ |
360 | *******************************************************************************/ |
349 | #define _SetEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \ |
361 | #define _SetEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \ |
350 | (_GetENDPOINT(bEpNum) | EP_KIND) & EPREG_MASK)) |
362 | (_GetENDPOINT(bEpNum) | EP_KIND) & EPREG_MASK)) |
351 | #define _ClearEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \ |
363 | #define _ClearEP_KIND(bEpNum) (_SetENDPOINT(bEpNum, \ |
352 | (_GetENDPOINT(bEpNum) & EPKIND_MASK))) |
364 | (_GetENDPOINT(bEpNum) & EPKIND_MASK))) |
- | 365 | ||
353 | /*----------------------------------------------------------------*/ |
366 | /******************************************************************************* |
354 | /* Set_Status_Out / Clear_Status_Out */ |
367 | * Macro Name : Set_Status_Out / Clear_Status_Out. |
355 | /* sets/clears directly STATUS_OUT bit in the endpoint register */ |
368 | * Description : Sets/clears directly STATUS_OUT bit in the endpoint register. |
356 | /* to be used only during control transfers */ |
369 | * Input : bEpNum: Endpoint Number. |
357 | /* IN : bEpNum = endpoint number */ |
370 | * Output : None. |
358 | /* OUT: none */ |
371 | * Return : None. |
359 | /*----------------------------------------------------------------*/ |
372 | *******************************************************************************/ |
360 | #define _Set_Status_Out(bEpNum) _SetEP_KIND(bEpNum) |
373 | #define _Set_Status_Out(bEpNum) _SetEP_KIND(bEpNum) |
361 | #define _Clear_Status_Out(bEpNum) _ClearEP_KIND(bEpNum) |
374 | #define _Clear_Status_Out(bEpNum) _ClearEP_KIND(bEpNum) |
- | 375 | ||
362 | /*----------------------------------------------------------------*/ |
376 | /******************************************************************************* |
363 | /* SetEPDoubleBuff / ClearEPDoubleBuff */ |
377 | * Macro Name : SetEPDoubleBuff / ClearEPDoubleBuff. |
364 | /* sets/clears directly EP_KIND bit in the endpoint register */ |
378 | * Description : Sets/clears directly EP_KIND bit in the endpoint register. |
365 | /* IN : bEpNum = endpoint number */ |
379 | * Input : bEpNum: Endpoint Number. |
366 | /* OUT: none */ |
380 | * Output : None. |
- | 381 | * Return : None. |
|
367 | /*----------------------------------------------------------------*/ |
382 | *******************************************************************************/ |
368 | #define _SetEPDoubleBuff(bEpNum) _SetEP_KIND(bEpNum) |
383 | #define _SetEPDoubleBuff(bEpNum) _SetEP_KIND(bEpNum) |
369 | #define _ClearEPDoubleBuff(bEpNum) _ClearEP_KIND(bEpNum) |
384 | #define _ClearEPDoubleBuff(bEpNum) _ClearEP_KIND(bEpNum) |
- | 385 | ||
370 | /*----------------------------------------------------------------*/ |
386 | /******************************************************************************* |
371 | /* ClearEP_CTR_RX / ClearEP_CTR_TX */ |
387 | * Macro Name : ClearEP_CTR_RX / ClearEP_CTR_TX. |
372 | /* clears bit CTR_RX / CTR_TX in the endpoint register */ |
388 | * Description : Clears bit CTR_RX / CTR_TX in the endpoint register. |
373 | /* IN : bEpNum = endpoint number */ |
389 | * Input : bEpNum: Endpoint Number. |
374 | /* OUT: none */ |
390 | * Output : None. |
- | 391 | * Return : None. |
|
375 | /*----------------------------------------------------------------*/ |
392 | *******************************************************************************/ |
376 | #define _ClearEP_CTR_RX(bEpNum) (_SetENDPOINT(bEpNum,\ |
393 | #define _ClearEP_CTR_RX(bEpNum) (_SetENDPOINT(bEpNum,\ |
377 | _GetENDPOINT(bEpNum) & 0x7FFF & EPREG_MASK)) |
394 | _GetENDPOINT(bEpNum) & 0x7FFF & EPREG_MASK)) |
378 | #define _ClearEP_CTR_TX(bEpNum) (_SetENDPOINT(bEpNum,\ |
395 | #define _ClearEP_CTR_TX(bEpNum) (_SetENDPOINT(bEpNum,\ |
379 | _GetENDPOINT(bEpNum) & 0xFF7F & EPREG_MASK)) |
396 | _GetENDPOINT(bEpNum) & 0xFF7F & EPREG_MASK)) |
- | 397 | ||
380 | /*----------------------------------------------------------------*/ |
398 | /******************************************************************************* |
381 | /* ToggleDTOG_RX / ToggleDTOG_TX */ |
399 | * Macro Name : ToggleDTOG_RX / ToggleDTOG_TX . |
382 | /* toggles DTOG_RX / DTOG_TX bit in the endpoint register */ |
400 | * Description : Toggles DTOG_RX / DTOG_TX bit in the endpoint register. |
383 | /* IN : bEpNum = endpoint number */ |
401 | * Input : bEpNum: Endpoint Number. |
384 | /* OUT: none */ |
402 | * Output : None. |
- | 403 | * Return : None. |
|
385 | /*----------------------------------------------------------------*/ |
404 | *******************************************************************************/ |
386 | #define _ToggleDTOG_RX(bEpNum) (_SetENDPOINT(bEpNum, \ |
405 | #define _ToggleDTOG_RX(bEpNum) (_SetENDPOINT(bEpNum, \ |
387 | EP_DTOG_RX | _GetENDPOINT(bEpNum) & EPREG_MASK)) |
406 | EP_DTOG_RX | _GetENDPOINT(bEpNum) & EPREG_MASK)) |
388 | #define _ToggleDTOG_TX(bEpNum) (_SetENDPOINT(bEpNum, \ |
407 | #define _ToggleDTOG_TX(bEpNum) (_SetENDPOINT(bEpNum, \ |
389 | EP_DTOG_TX | _GetENDPOINT(bEpNum) & EPREG_MASK)) |
408 | EP_DTOG_TX | _GetENDPOINT(bEpNum) & EPREG_MASK)) |
- | 409 | ||
390 | /*----------------------------------------------------------------*/ |
410 | /******************************************************************************* |
391 | /* ClearDTOG_RX / ClearDTOG_TX */ |
411 | * Macro Name : ClearDTOG_RX / ClearDTOG_TX. |
- | 412 | * Description : Clears DTOG_RX / DTOG_TX bit in the endpoint register. |
|
392 | /* IN : bEpNum = endpoint number */ |
413 | * Input : bEpNum: Endpoint Number. |
393 | /* OUT: none */ |
414 | * Output : None. |
- | 415 | * Return : None. |
|
394 | /*----------------------------------------------------------------*/ |
416 | *******************************************************************************/ |
395 | #define _ClearDTOG_RX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_RX) != 0)\ |
417 | #define _ClearDTOG_RX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_RX) != 0)\ |
396 | _ToggleDTOG_RX(bEpNum) |
418 | _ToggleDTOG_RX(bEpNum) |
397 | #define _ClearDTOG_TX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_TX) != 0)\ |
419 | #define _ClearDTOG_TX(bEpNum) if((_GetENDPOINT(bEpNum) & EP_DTOG_TX) != 0)\ |
398 | _ToggleDTOG_TX(bEpNum) |
420 | _ToggleDTOG_TX(bEpNum) |
399 | /*----------------------------------------------------------------*/ |
421 | /******************************************************************************* |
400 | /* SetEPAddress */ |
422 | * Macro Name : SetEPAddress. |
401 | /* sets address in an endpoint register */ |
423 | * Description : Sets address in an endpoint register. |
402 | /* IN : bEpNum = endpoint number */ |
424 | * Input : bEpNum: Endpoint Number. |
- | 425 | * bAddr: Address. |
|
403 | /* bAddr = address */ |
426 | * Output : None. |
404 | /* OUT: none */ |
427 | * Return : None. |
405 | /*----------------------------------------------------------------*/ |
428 | *******************************************************************************/ |
Line 406... | Line 429... | ||
406 | 429 | ||
407 | #define _SetEPAddress(bEpNum,bAddr) _SetENDPOINT(bEpNum,\ |
430 | #define _SetEPAddress(bEpNum,bAddr) _SetENDPOINT(bEpNum,\ |
408 | _GetENDPOINT(bEpNum) & EPREG_MASK | bAddr) |
431 | _GetENDPOINT(bEpNum) & EPREG_MASK | bAddr) |
409 | /*----------------------------------------------------------------*/ |
432 | /******************************************************************************* |
- | 433 | * Macro Name : GetEPAddress. |
|
410 | /* GetEPAddress */ |
434 | * Description : Gets address in an endpoint register. |
411 | /* IN : bEpNum = endpoint number */ |
435 | * Input : bEpNum: Endpoint Number. |
- | 436 | * Output : None. |
|
412 | /* OUT: none */ |
437 | * Return : None. |
413 | /*----------------------------------------------------------------*/ |
438 | *******************************************************************************/ |
414 | #define _GetEPAddress(bEpNum) ((u8)(_GetENDPOINT(bEpNum) & EPADDR_FIELD)) |
- | |
- | 439 | #define _GetEPAddress(bEpNum) ((u8)(_GetENDPOINT(bEpNum) & EPADDR_FIELD)) |
|
415 | /*----------------------------------------------------------------*/ |
440 | |
416 | #ifdef STR7xx /*STR7xx family*/ |
441 | #ifdef STR7xx /*STR7xx family*/ |
417 | #define _pEPTxAddr(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8 )*2 + PMAAddr)) |
442 | #define _pEPTxAddr(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8 )*2 + PMAAddr)) |
418 | #define _pEPTxCount(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8+2)*2 + PMAAddr)) |
443 | #define _pEPTxCount(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8+2)*2 + PMAAddr)) |
419 | #define _pEPRxAddr(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8+4)*2 + PMAAddr)) |
444 | #define _pEPRxAddr(bEpNum) ((u32 *)((_GetBTABLE()+bEpNum*8+4)*2 + PMAAddr)) |
Line 423... | Line 448... | ||
423 | #ifdef STR91x /*STR91x family*/ |
448 | #ifdef STR91x /*STR91x family*/ |
424 | /* Pointers on endpoint(bEpNum) Count & Addr registers on PMA */ |
449 | /* Pointers on endpoint(bEpNum) Count & Addr registers on PMA */ |
425 | #define _pEPBufCount(bEpNum) ((u32 *)(_GetBTABLE()+bEpNum*8 + 4 + PMAAddr)) |
450 | #define _pEPBufCount(bEpNum) ((u32 *)(_GetBTABLE()+bEpNum*8 + 4 + PMAAddr)) |
426 | #define _pEPBufAddr(bEpNum) ((u32 *)(_GetBTABLE()+bEpNum*8 + PMAAddr)) |
451 | #define _pEPBufAddr(bEpNum) ((u32 *)(_GetBTABLE()+bEpNum*8 + PMAAddr)) |
427 | #endif |
452 | #endif |
428 | /*----------------------------------------------------------------*/ |
453 | /******************************************************************************* |
429 | /* SetEPTxAddr / SetEPRxAddr */ |
454 | * Macro Name : SetEPTxAddr / SetEPRxAddr. |
430 | /* sets address of the tx/rx buffer */ |
455 | * Description : sets address of the tx/rx buffer. |
431 | /* IN : bEpNum = endpoint number */ |
456 | * Input : bEpNum: Endpoint Number. |
432 | /* wAddr = address to be set ( must be word aligned ) */ |
457 | * wAddr: address to be set (must be word aligned). |
433 | /* OUT: none */ |
458 | * Output : None. |
- | 459 | * Return : None. |
|
434 | /*----------------------------------------------------------------*/ |
460 | *******************************************************************************/ |
435 | - | ||
436 | #ifdef STR7xx /*STR7xx family*/ |
461 | #ifdef STR7xx /*STR7xx family*/ |
437 | #define _SetEPTxAddr(bEpNum,wAddr) (*_pEPTxAddr(bEpNum) = ((wAddr >> 1) << 1)) |
462 | #define _SetEPTxAddr(bEpNum,wAddr) (*_pEPTxAddr(bEpNum) = ((wAddr >> 1) << 1)) |
438 | #define _SetEPRxAddr(bEpNum,wAddr) (*_pEPRxAddr(bEpNum) = ((wAddr >> 1) << 1)) |
463 | #define _SetEPRxAddr(bEpNum,wAddr) (*_pEPRxAddr(bEpNum) = ((wAddr >> 1) << 1)) |
439 | #endif |
464 | #endif |
Line 447... | Line 472... | ||
447 | *_pEPBufAddr(bEpNum) &=0x0000FFFF;\ |
472 | *_pEPBufAddr(bEpNum) &=0x0000FFFF;\ |
448 | *_pEPBufAddr(bEpNum) |=((wAddr<<16)&0xFFFC0000);\ |
473 | *_pEPBufAddr(bEpNum) |=((wAddr<<16)&0xFFFC0000);\ |
449 | } |
474 | } |
450 | #endif |
475 | #endif |
Line 451... | Line 476... | ||
451 | 476 | ||
452 | /*----------------------------------------------------------------*/ |
477 | /******************************************************************************* |
453 | /* GetEPTxAddr / GetEPRxAddr */ |
478 | * Macro Name : GetEPTxAddr / GetEPRxAddr. |
454 | /* gets address of the tx/rx buffer */ |
479 | * Description : Gets address of the tx/rx buffer. |
455 | /* IN : bEpNum = endpoint number */ |
480 | * Input : bEpNum: Endpoint Number. |
456 | /* IN : */ |
481 | * Output : None. |
457 | /* OUT: address of the buffer */ |
482 | * Return : address of the buffer. |
458 | /*----------------------------------------------------------------*/ |
- | |
459 | 483 | *******************************************************************************/ |
|
460 | #ifdef STR7xx /*STR7xx family*/ |
484 | #ifdef STR7xx /*STR7xx family*/ |
461 | #define _GetEPTxAddr(bEpNum) ((u16)*_pEPTxAddr(bEpNum)) |
485 | #define _GetEPTxAddr(bEpNum) ((u16)*_pEPTxAddr(bEpNum)) |
462 | #define _GetEPRxAddr(bEpNum) ((u16)*_pEPRxAddr(bEpNum)) |
486 | #define _GetEPRxAddr(bEpNum) ((u16)*_pEPRxAddr(bEpNum)) |
Line 463... | Line 487... | ||
463 | #endif |
487 | #endif |
464 | 488 | ||
465 | #ifdef STR91x /*STR91x family*/ |
489 | #ifdef STR91x /*STR91x family*/ |
466 | #define _GetEPTxAddr(bEpNum) ((u16)(*_pEPBufAddr(bEpNum) &0x0000FFFF)) |
490 | #define _GetEPTxAddr(bEpNum) ((u16)(*_pEPBufAddr(bEpNum) &0x0000FFFF)) |
467 | #define _GetEPRxAddr(bEpNum) ((u16)((*_pEPBufAddr(bEpNum)&0xFFFF0000)>>16)) |
491 | #define _GetEPRxAddr(bEpNum) ((u16)((*_pEPBufAddr(bEpNum)&0xFFFF0000)>>16)) |
468 | #endif |
492 | #endif |
469 | /*----------------------------------------------------------------*/ |
493 | /******************************************************************************* |
470 | /* SetEPCountRxReg */ |
494 | * Macro Name : SetEPCountRxReg. |
471 | /* sets counter of rx buffer with no. of blocks */ |
495 | * Description : Sets counter of rx buffer with no. of blocks. |
472 | /* IN : pdwReg = pointer to counter */ |
496 | * Input : pdwReg: pointer to counter. |
- | 497 | * wCount: Counter. |
|
473 | /* wCount = counter */ |
498 | * Output : None. |
474 | /* OUT: none */ |
- | |
475 | /*----------------------------------------------------------------*/ |
499 | * Return : None. |
476 | 500 | *******************************************************************************/ |
|
477 | #ifdef STR7xx /*STR7xx family*/ |
501 | #ifdef STR7xx /*STR7xx family*/ |
478 | #define _BlocksOf32(dwReg,wCount,wNBlocks) {\ |
502 | #define _BlocksOf32(dwReg,wCount,wNBlocks) {\ |
479 | wNBlocks = wCount >> 5;\ |
503 | wNBlocks = wCount >> 5;\ |
Line 493... | Line 517... | ||
493 | u16 wNBlocks;\ |
517 | u16 wNBlocks;\ |
494 | if(wCount > 62){_BlocksOf32(dwReg,wCount,wNBlocks);}\ |
518 | if(wCount > 62){_BlocksOf32(dwReg,wCount,wNBlocks);}\ |
495 | else {_BlocksOf2(dwReg,wCount,wNBlocks);}\ |
519 | else {_BlocksOf2(dwReg,wCount,wNBlocks);}\ |
496 | }/* _SetEPCountRxReg */ |
520 | }/* _SetEPCountRxReg */ |
Line 497... | Line -... | ||
497 | - | ||
498 | - | ||
499 | 521 | ||
500 | #define _SetEPRxDblBuf0Count(bEpNum,wCount) {\ |
522 | #define _SetEPRxDblBuf0Count(bEpNum,wCount) {\ |
501 | u32 *pdwReg = _pEPTxCount(bEpNum); \ |
523 | u32 *pdwReg = _pEPTxCount(bEpNum); \ |
502 | _SetEPCountRxReg(pdwReg, wCount);\ |
524 | _SetEPCountRxReg(pdwReg, wCount);\ |
503 | } |
525 | } |
504 | #endif |
526 | #endif |
505 | /*----------------------------------------------------------------*/ |
527 | /******************************************************************************* |
506 | /* SetEPTxCount / SetEPRxCount */ |
528 | * Macro Name : SetEPTxCount / SetEPRxCount. |
507 | /* sets counter for the tx/rx buffer */ |
529 | * Description : sets counter for the tx/rx buffer. |
508 | /* IN : bEpNum = endpoint number */ |
530 | * Input : bEpNum: endpoint number. |
509 | /* wCount = counter value */ |
531 | * wCount: Counter value. |
- | 532 | * Output : None. |
|
510 | /* OUT: none */ |
533 | * Return : None. |
Line 511... | Line 534... | ||
511 | /*----------------------------------------------------------------*/ |
534 | *******************************************************************************/ |
512 | 535 | ||
513 | #ifdef STR7xx /*STR7xx family*/ |
536 | #ifdef STR7xx /*STR7xx family*/ |
514 | #define _SetEPTxCount(bEpNum,wCount) (*_pEPTxCount(bEpNum) = wCount) |
537 | #define _SetEPTxCount(bEpNum,wCount) (*_pEPTxCount(bEpNum) = wCount) |
Line 538... | Line 561... | ||
538 | *_pEPBufCount(bEpNum) &=0x83FFFFFF;\ |
561 | *_pEPBufCount(bEpNum) &=0x83FFFFFF;\ |
539 | *_pEPBufCount(bEpNum) |=Blocks<<26;\ |
562 | *_pEPBufCount(bEpNum) |=Blocks<<26;\ |
540 | *_pEPBufCount(bEpNum) &=0xFC00FFFF;\ |
563 | *_pEPBufCount(bEpNum) &=0xFC00FFFF;\ |
541 | } |
564 | } |
542 | #endif |
565 | #endif |
543 | /*----------------------------------------------------------------*/ |
566 | /******************************************************************************* |
544 | /* GetEPTxCount / GetEPRxCount */ |
567 | * Macro Name : GetEPTxCount / GetEPRxCount. |
545 | /* gets counter of the tx buffer */ |
568 | * Description : gets counter of the tx buffer. |
546 | /* IN : bEpNum = endpoint number */ |
569 | * Input : bEpNum: endpoint number. |
- | 570 | * Output : None. |
|
547 | /* OUT: counter value */ |
571 | * Return : Counter value. |
548 | /*----------------------------------------------------------------*/ |
572 | *******************************************************************************/ |
549 | #ifdef STR7xx /*STR7xx family*/ |
573 | #ifdef STR7xx /*STR7xx family*/ |
550 | #define _GetEPTxCount(bEpNum)((u16)(*_pEPTxCount(bEpNum)) & 0x3ff) |
574 | #define _GetEPTxCount(bEpNum)((u16)(*_pEPTxCount(bEpNum)) & 0x3ff) |
551 | #define _GetEPRxCount(bEpNum)((u16)(*_pEPRxCount(bEpNum)) & 0x3ff) |
575 | #define _GetEPRxCount(bEpNum)((u16)(*_pEPRxCount(bEpNum)) & 0x3ff) |
552 | #endif |
576 | #endif |
Line 553... | Line 577... | ||
553 | 577 | ||
554 | #ifdef STR91x /*STR91x family*/ |
578 | #ifdef STR91x /*STR91x family*/ |
555 | #define _GetEPTxCount(bEpNum) (u16)(*_pEPBufCount(bEpNum)&0x3FF) |
579 | #define _GetEPTxCount(bEpNum) (u16)(*_pEPBufCount(bEpNum)&0x3FF) |
556 | #define _GetEPRxCount(bEpNum) (u16)((*_pEPBufCount(bEpNum)&0x3FF0000)>>16) |
580 | #define _GetEPRxCount(bEpNum) (u16)((*_pEPBufCount(bEpNum)&0x3FF0000)>>16) |
- | 581 | #endif |
|
557 | #endif |
582 | |
558 | /*----------------------------------------------------------------*/ |
583 | /******************************************************************************* |
559 | /* SetEPDblBuf0Addr / SetEPDblBuf1Addr */ |
584 | * Macro Name : SetEPDblBuf0Addr / SetEPDblBuf1Addr. |
560 | /* sets buffer 0/1 address in a double buffer endpoint */ |
585 | * Description : Sets buffer 0/1 address in a double buffer endpoint. |
561 | /* IN : bEpNum = endpoint number */ |
586 | * Input : bEpNum: endpoint number. |
562 | /* wBuf0Addr = buffer 0 address */ |
587 | * : wBuf0Addr: buffer 0 address. |
- | 588 | * Output : None. |
|
563 | /* OUT: none */ |
589 | * Return : None. |
564 | /*----------------------------------------------------------------*/ |
590 | *******************************************************************************/ |
565 | #define _SetEPDblBuf0Addr(bEpNum,wBuf0Addr) {_SetEPTxAddr(bEpNum, wBuf0Addr);} |
591 | #define _SetEPDblBuf0Addr(bEpNum,wBuf0Addr) {_SetEPTxAddr(bEpNum, wBuf0Addr);} |
Line 566... | Line 592... | ||
566 | #define _SetEPDblBuf1Addr(bEpNum,wBuf1Addr) {_SetEPRxAddr(bEpNum, wBuf1Addr);} |
592 | #define _SetEPDblBuf1Addr(bEpNum,wBuf1Addr) {_SetEPRxAddr(bEpNum, wBuf1Addr);} |
567 | 593 | ||
568 | /*----------------------------------------------------------------*/ |
594 | /******************************************************************************* |
569 | /* SetEPDblBuffAddr */ |
595 | * Macro Name : SetEPDblBuffAddr. |
570 | /* sets addresses in a double buffer endpoint */ |
596 | * Description : Sets addresses in a double buffer endpoint. |
571 | /* IN : bEpNum = endpoint number */ |
597 | * Input : bEpNum: endpoint number. |
572 | /* wBuf0Addr = buffer 0 address */ |
598 | * : wBuf0Addr: buffer 0 address. |
- | 599 | * : wBuf1Addr = buffer 1 address. |
|
573 | /* wBuf1Addr = buffer 1 address */ |
600 | * Output : None. |
574 | /* OUT: none */ |
601 | * Return : None. |
575 | /*----------------------------------------------------------------*/ |
602 | *******************************************************************************/ |
576 | #define _SetEPDblBuffAddr(bEpNum,wBuf0Addr,wBuf1Addr) { \ |
603 | #define _SetEPDblBuffAddr(bEpNum,wBuf0Addr,wBuf1Addr) { \ |
577 | _SetEPDblBuf0Addr(bEpNum, wBuf0Addr);\ |
604 | _SetEPDblBuf0Addr(bEpNum, wBuf0Addr);\ |
- | 605 | _SetEPDblBuf1Addr(bEpNum, wBuf1Addr);\ |
|
578 | _SetEPDblBuf1Addr(bEpNum, wBuf1Addr);\ |
606 | } /* _SetEPDblBuffAddr */ |
579 | } /* _SetEPDblBuffAddr */ |
607 | |
580 | /*----------------------------------------------------------------*/ |
608 | /******************************************************************************* |
581 | /* GetEPDblBuf0Addr / GetEPDblBuf1Addr */ |
609 | * Macro Name : GetEPDblBuf0Addr / GetEPDblBuf1Addr. |
582 | /* gets buffer 0/1 address of a double buffer endpoint */ |
610 | * Description : Gets buffer 0/1 address of a double buffer endpoint. |
- | 611 | * Input : bEpNum: endpoint number. |
|
583 | /* IN : bEpNum = endpoint number */ |
612 | * Output : None. |
584 | /* OUT: none */ |
613 | * Return : None. |
585 | /*----------------------------------------------------------------*/ |
614 | *******************************************************************************/ |
586 | #define _GetEPDblBuf0Addr(bEpNum) (_GetEPTxAddr(bEpNum)) |
- | |
587 | #define _GetEPDblBuf1Addr(bEpNum) (_GetEPRxAddr(bEpNum)) |
- | |
588 | /*----------------------------------------------------------------*/ |
- | |
589 | /* SetEPDblBuffCount / SetEPDblBuf0Count / SetEPDblBuf1Count */ |
- | |
590 | /* sets both buffers or buff0 or buff1 counter for double buffering */ |
- | |
591 | /* IN : bEpNum = endpoint number */ |
- | |
592 | /* bDir = endpoint dir EP_DBUF_OUT = OUT */ |
- | |
593 | /* EP_DBUF_IN = IN */ |
- | |
594 | /* wCount = counter value */ |
- | |
Line -... | Line 615... | ||
- | 615 | #define _GetEPDblBuf0Addr(bEpNum) (_GetEPTxAddr(bEpNum)) |
|
- | 616 | #define _GetEPDblBuf1Addr(bEpNum) (_GetEPRxAddr(bEpNum)) |
|
- | 617 | ||
- | 618 | /******************************************************************************* |
|
- | 619 | * Macro Name : SetEPDblBuffCount / SetEPDblBuf0Count / SetEPDblBuf1Count. |
|
- | 620 | * Description : Gets buffer 0/1 address of a double buffer endpoint. |
|
- | 621 | * Input : bEpNum: endpoint number. |
|
- | 622 | * : bDir: endpoint dir EP_DBUF_OUT = OUT |
|
- | 623 | * EP_DBUF_IN = IN |
|
- | 624 | * : wCount: Counter value |
|
595 | /* OUT: none */ |
625 | * Output : None. |
Line 596... | Line 626... | ||
596 | /*----------------------------------------------------------------*/ |
626 | * Return : None. |
597 | 627 | *******************************************************************************/ |
|
598 | #ifdef STR7xx /*STR7xx family*/ |
628 | #ifdef STR7xx /*STR7xx family*/ |
Line 618... | Line 648... | ||
618 | #define _SetEPDblBuffCount(bEpNum, bDir, wCount) {\ |
648 | #define _SetEPDblBuffCount(bEpNum, bDir, wCount) {\ |
619 | _SetEPDblBuf0Count(bEpNum, bDir, wCount); \ |
649 | _SetEPDblBuf0Count(bEpNum, bDir, wCount); \ |
620 | _SetEPDblBuf1Count(bEpNum, bDir, wCount); \ |
650 | _SetEPDblBuf1Count(bEpNum, bDir, wCount); \ |
621 | } /* _SetEPDblBuffCount */ |
651 | } /* _SetEPDblBuffCount */ |
622 | #endif |
652 | #endif |
- | 653 | ||
623 | /*----------------------------------------------------------------*/ |
654 | /******************************************************************************* |
624 | /* GetEPDblBuf0Count / GetEPDblBuf1Count */ |
655 | * Macro Name : GetEPDblBuf0Count / GetEPDblBuf1Count. |
625 | /* gets buffer 0/1 rx/tx counter for double buffering */ |
656 | * Description : Gets buffer 0/1 rx/tx counter for double buffering. |
626 | /* IN : bEpNum = endpoint number */ |
657 | * Input : bEpNum: endpoint number. |
627 | /* OUT: none */ |
658 | * Output : None. |
- | 659 | * Return : None. |
|
628 | /*----------------------------------------------------------------*/ |
660 | *******************************************************************************/ |
629 | #define _GetEPDblBuf0Count(bEpNum) (_GetEPTxCount(bEpNum)) |
661 | #define _GetEPDblBuf0Count(bEpNum) (_GetEPTxCount(bEpNum)) |
630 | #define _GetEPDblBuf1Count(bEpNum) (_GetEPRxCount(bEpNum)) |
662 | #define _GetEPDblBuf1Count(bEpNum) (_GetEPRxCount(bEpNum)) |
Line 631... | Line -... | ||
631 | - | ||
632 | 663 | ||
633 | /* External variables --------------------------------------------------------*/ |
664 | /* External variables --------------------------------------------------------*/ |
Line 634... | Line 665... | ||
634 | extern volatile u16 wIstr; /* ISTR register last read value */ |
665 | extern volatile u16 wIstr; /* ISTR register last read value */ |
635 | 666 | ||
Line 719... | Line 750... | ||
719 | #endif /* End of STR91x family*/ |
750 | #endif /* End of STR91x family*/ |
Line 720... | Line 751... | ||
720 | 751 | ||
Line 721... | Line 752... | ||
721 | #endif /* __USB_REGS_H */ |
752 | #endif /* __USB_REGS_H */ |