Sergey Pastor / grbl1
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers usb_regs.c Source File

usb_regs.c

00001 /******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
00002 * File Name          : usb_regs.c
00003 * Author             : MCD Application Team
00004 * Version            : V3.2.1
00005 * Date               : 07/05/2010
00006 * Description        : Interface functions to USB cell registers
00007 ********************************************************************************
00008 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00009 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
00010 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
00011 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
00012 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
00013 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00014 *******************************************************************************/
00015 #ifndef STM32F10X_CL
00016 
00017 /* Includes ------------------------------------------------------------------*/
00018 #include "usb_lib.h"
00019 
00020 /* Private typedef -----------------------------------------------------------*/
00021 /* Private define ------------------------------------------------------------*/
00022 /* Private macro -------------------------------------------------------------*/
00023 /* Private variables ---------------------------------------------------------*/
00024 /* Extern variables ----------------------------------------------------------*/
00025 /* Private function prototypes -----------------------------------------------*/
00026 /* Private functions ---------------------------------------------------------*/
00027 
00028 /*******************************************************************************
00029 * Function Name  : SetCNTR.
00030 * Description    : Set the CNTR register value.
00031 * Input          : wRegValue: new register value.
00032 * Output         : None.
00033 * Return         : None.
00034 *******************************************************************************/
00035 void SetCNTR(uint16_t wRegValue)
00036 {
00037   _SetCNTR(wRegValue);
00038 }
00039 
00040 /*******************************************************************************
00041 * Function Name  : GetCNTR.
00042 * Description    : returns the CNTR register value.
00043 * Input          : None.
00044 * Output         : None.
00045 * Return         : CNTR register Value.
00046 *******************************************************************************/
00047 uint16_t GetCNTR(void)
00048 {
00049   return(_GetCNTR());
00050 }
00051 
00052 /*******************************************************************************
00053 * Function Name  : SetISTR.
00054 * Description    : Set the ISTR register value.
00055 * Input          : wRegValue: new register value.
00056 * Output         : None.
00057 * Return         : None.
00058 *******************************************************************************/
00059 void SetISTR(uint16_t wRegValue)
00060 {
00061   _SetISTR(wRegValue);
00062 }
00063 
00064 /*******************************************************************************
00065 * Function Name  : GetISTR
00066 * Description    : Returns the ISTR register value.
00067 * Input          : None.
00068 * Output         : None.
00069 * Return         : ISTR register Value
00070 *******************************************************************************/
00071 uint16_t GetISTR(void)
00072 {
00073   return(_GetISTR());
00074 }
00075 
00076 /*******************************************************************************
00077 * Function Name  : GetFNR
00078 * Description    : Returns the FNR register value.
00079 * Input          : None.
00080 * Output         : None.
00081 * Return         : FNR register Value
00082 *******************************************************************************/
00083 uint16_t GetFNR(void)
00084 {
00085   return(_GetFNR());
00086 }
00087 
00088 /*******************************************************************************
00089 * Function Name  : SetDADDR
00090 * Description    : Set the DADDR register value.
00091 * Input          : wRegValue: new register value.
00092 * Output         : None.
00093 * Return         : None.
00094 *******************************************************************************/
00095 void SetDADDR(uint16_t wRegValue)
00096 {
00097   _SetDADDR(wRegValue);
00098 }
00099 
00100 /*******************************************************************************
00101 * Function Name  : GetDADDR
00102 * Description    : Returns the DADDR register value.
00103 * Input          : None.
00104 * Output         : None.
00105 * Return         : DADDR register Value
00106 *******************************************************************************/
00107 uint16_t GetDADDR(void)
00108 {
00109   return(_GetDADDR());
00110 }
00111 
00112 /*******************************************************************************
00113 * Function Name  : SetBTABLE
00114 * Description    : Set the BTABLE.
00115 * Input          : wRegValue: New register value.
00116 * Output         : None.
00117 * Return         : None.
00118 *******************************************************************************/
00119 void SetBTABLE(uint16_t wRegValue)
00120 {
00121   _SetBTABLE(wRegValue);
00122 }
00123 
00124 /*******************************************************************************
00125 * Function Name  : GetBTABLE.
00126 * Description    : Returns the BTABLE register value.
00127 * Input          : None. 
00128 * Output         : None.
00129 * Return         : BTABLE address.
00130 *******************************************************************************/
00131 uint16_t GetBTABLE(void)
00132 {
00133   return(_GetBTABLE());
00134 }
00135 
00136 /*******************************************************************************
00137 * Function Name  : SetENDPOINT
00138 * Description    : Setthe Endpoint register value.
00139 * Input          : bEpNum: Endpoint Number. 
00140 *                  wRegValue.
00141 * Output         : None.
00142 * Return         : None.
00143 *******************************************************************************/
00144 void SetENDPOINT(uint8_t bEpNum, uint16_t wRegValue)
00145 {
00146   _SetENDPOINT(bEpNum, wRegValue);
00147 }
00148 
00149 /*******************************************************************************
00150 * Function Name  : GetENDPOINT
00151 * Description    : Return the Endpoint register value.
00152 * Input          : bEpNum: Endpoint Number. 
00153 * Output         : None.
00154 * Return         : Endpoint register value.
00155 *******************************************************************************/
00156 uint16_t GetENDPOINT(uint8_t bEpNum)
00157 {
00158   return(_GetENDPOINT(bEpNum));
00159 }
00160 
00161 /*******************************************************************************
00162 * Function Name  : SetEPType
00163 * Description    : sets the type in the endpoint register.
00164 * Input          : bEpNum: Endpoint Number. 
00165 *                  wType: type definition.
00166 * Output         : None.
00167 * Return         : None.
00168 *******************************************************************************/
00169 void SetEPType(uint8_t bEpNum, uint16_t wType)
00170 {
00171   _SetEPType(bEpNum, wType);
00172 }
00173 
00174 /*******************************************************************************
00175 * Function Name  : GetEPType
00176 * Description    : Returns the endpoint type.
00177 * Input          : bEpNum: Endpoint Number. 
00178 * Output         : None.
00179 * Return         : Endpoint Type
00180 *******************************************************************************/
00181 uint16_t GetEPType(uint8_t bEpNum)
00182 {
00183   return(_GetEPType(bEpNum));
00184 }
00185 
00186 /*******************************************************************************
00187 * Function Name  : SetEPTxStatus
00188 * Description    : Set the status of Tx endpoint.
00189 * Input          : bEpNum: Endpoint Number. 
00190 *                  wState: new state.
00191 * Output         : None.
00192 * Return         : None.
00193 *******************************************************************************/
00194 void SetEPTxStatus(uint8_t bEpNum, uint16_t wState)
00195 {
00196   _SetEPTxStatus(bEpNum, wState);
00197 }
00198 
00199 /*******************************************************************************
00200 * Function Name  : SetEPRxStatus
00201 * Description    : Set the status of Rx endpoint.
00202 * Input          : bEpNum: Endpoint Number. 
00203 *                  wState: new state.
00204 * Output         : None.
00205 * Return         : None.
00206 *******************************************************************************/
00207 void SetEPRxStatus(uint8_t bEpNum, uint16_t wState)
00208 {
00209   _SetEPRxStatus(bEpNum, wState);
00210 }
00211 
00212 /*******************************************************************************
00213 * Function Name  : SetDouBleBuffEPStall
00214 * Description    : sets the status for Double Buffer Endpoint to STALL
00215 * Input          : bEpNum: Endpoint Number. 
00216 *                  bDir: Endpoint direction.
00217 * Output         : None.
00218 * Return         : None.
00219 *******************************************************************************/
00220 void SetDouBleBuffEPStall(uint8_t bEpNum, uint8_t bDir)
00221 {
00222   uint16_t Endpoint_DTOG_Status;
00223   Endpoint_DTOG_Status = GetENDPOINT(bEpNum);
00224   if (bDir == EP_DBUF_OUT)
00225   { /* OUT double buffered endpoint */
00226     _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPRX_DTOG1);
00227   }
00228   else if (bDir == EP_DBUF_IN)
00229   { /* IN double buffered endpoint */
00230     _SetENDPOINT(bEpNum, Endpoint_DTOG_Status & ~EPTX_DTOG1);
00231   }
00232 }
00233 
00234 /*******************************************************************************
00235 * Function Name  : GetEPTxStatus
00236 * Description    : Returns the endpoint Tx status.
00237 * Input          : bEpNum: Endpoint Number. 
00238 * Output         : None.
00239 * Return         : Endpoint TX Status
00240 *******************************************************************************/
00241 uint16_t GetEPTxStatus(uint8_t bEpNum)
00242 {
00243   return(_GetEPTxStatus(bEpNum));
00244 }
00245 
00246 /*******************************************************************************
00247 * Function Name  : GetEPRxStatus
00248 * Description    : Returns the endpoint Rx status.
00249 * Input          : bEpNum: Endpoint Number. 
00250 * Output         : None.
00251 * Return         : Endpoint RX Status
00252 *******************************************************************************/
00253 uint16_t GetEPRxStatus(uint8_t bEpNum)
00254 {
00255   return(_GetEPRxStatus(bEpNum));
00256 }
00257 
00258 /*******************************************************************************
00259 * Function Name  : SetEPTxValid
00260 * Description    : Valid the endpoint Tx Status.
00261 * Input          : bEpNum: Endpoint Number.  
00262 * Output         : None.
00263 * Return         : None.
00264 *******************************************************************************/
00265 void SetEPTxValid(uint8_t bEpNum)
00266 {
00267   _SetEPTxStatus(bEpNum, EP_TX_VALID);
00268 }
00269 
00270 /*******************************************************************************
00271 * Function Name  : SetEPRxValid
00272 * Description    : Valid the endpoint Rx Status.
00273 * Input          : bEpNum: Endpoint Number. 
00274 * Output         : None.
00275 * Return         : None.
00276 *******************************************************************************/
00277 void SetEPRxValid(uint8_t bEpNum)
00278 {
00279   _SetEPRxStatus(bEpNum, EP_RX_VALID);
00280 }
00281 
00282 /*******************************************************************************
00283 * Function Name  : SetEP_KIND
00284 * Description    : Clear the EP_KIND bit.
00285 * Input          : bEpNum: Endpoint Number. 
00286 * Output         : None.
00287 * Return         : None.
00288 *******************************************************************************/
00289 void SetEP_KIND(uint8_t bEpNum)
00290 {
00291   _SetEP_KIND(bEpNum);
00292 }
00293 
00294 /*******************************************************************************
00295 * Function Name  : ClearEP_KIND
00296 * Description    : set the  EP_KIND bit.
00297 * Input          : bEpNum: Endpoint Number. 
00298 * Output         : None.
00299 * Return         : None.
00300 *******************************************************************************/
00301 void ClearEP_KIND(uint8_t bEpNum)
00302 {
00303   _ClearEP_KIND(bEpNum);
00304 }
00305 /*******************************************************************************
00306 * Function Name  : Clear_Status_Out
00307 * Description    : Clear the Status Out of the related Endpoint
00308 * Input          : bEpNum: Endpoint Number. 
00309 * Output         : None.
00310 * Return         : None.
00311 *******************************************************************************/
00312 void Clear_Status_Out(uint8_t bEpNum)
00313 {
00314   _ClearEP_KIND(bEpNum);
00315 }
00316 /*******************************************************************************
00317 * Function Name  : Set_Status_Out
00318 * Description    : Set the Status Out of the related Endpoint
00319 * Input          : bEpNum: Endpoint Number. 
00320 * Output         : None.
00321 * Return         : None.
00322 *******************************************************************************/
00323 void Set_Status_Out(uint8_t bEpNum)
00324 {
00325   _SetEP_KIND(bEpNum);
00326 }
00327 /*******************************************************************************
00328 * Function Name  : SetEPDoubleBuff
00329 * Description    : Enable the double buffer feature for the endpoint. 
00330 * Input          : bEpNum: Endpoint Number. 
00331 * Output         : None.
00332 * Return         : None.
00333 *******************************************************************************/
00334 void SetEPDoubleBuff(uint8_t bEpNum)
00335 {
00336   _SetEP_KIND(bEpNum);
00337 }
00338 /*******************************************************************************
00339 * Function Name  : ClearEPDoubleBuff
00340 * Description    : Disable the double buffer feature for the endpoint. 
00341 * Input          : bEpNum: Endpoint Number. 
00342 * Output         : None.
00343 * Return         : None.
00344 *******************************************************************************/
00345 void ClearEPDoubleBuff(uint8_t bEpNum)
00346 {
00347   _ClearEP_KIND(bEpNum);
00348 }
00349 /*******************************************************************************
00350 * Function Name  : GetTxStallStatus
00351 * Description    : Returns the Stall status of the Tx endpoint.
00352 * Input          : bEpNum: Endpoint Number. 
00353 * Output         : None.
00354 * Return         : Tx Stall status.
00355 *******************************************************************************/
00356 uint16_t GetTxStallStatus(uint8_t bEpNum)
00357 {
00358   return(_GetTxStallStatus(bEpNum));
00359 }
00360 /*******************************************************************************
00361 * Function Name  : GetRxStallStatus
00362 * Description    : Returns the Stall status of the Rx endpoint. 
00363 * Input          : bEpNum: Endpoint Number. 
00364 * Output         : None.
00365 * Return         : Rx Stall status.
00366 *******************************************************************************/
00367 uint16_t GetRxStallStatus(uint8_t bEpNum)
00368 {
00369   return(_GetRxStallStatus(bEpNum));
00370 }
00371 /*******************************************************************************
00372 * Function Name  : ClearEP_CTR_RX
00373 * Description    : Clear the CTR_RX bit.
00374 * Input          : bEpNum: Endpoint Number. 
00375 * Output         : None.
00376 * Return         : None.
00377 *******************************************************************************/
00378 void ClearEP_CTR_RX(uint8_t bEpNum)
00379 {
00380   _ClearEP_CTR_RX(bEpNum);
00381 }
00382 /*******************************************************************************
00383 * Function Name  : ClearEP_CTR_TX
00384 * Description    : Clear the CTR_TX bit.
00385 * Input          : bEpNum: Endpoint Number. 
00386 * Output         : None.
00387 * Return         : None.
00388 *******************************************************************************/
00389 void ClearEP_CTR_TX(uint8_t bEpNum)
00390 {
00391   _ClearEP_CTR_TX(bEpNum);
00392 }
00393 /*******************************************************************************
00394 * Function Name  : ToggleDTOG_RX
00395 * Description    : Toggle the DTOG_RX bit.
00396 * Input          : bEpNum: Endpoint Number. 
00397 * Output         : None.
00398 * Return         : None.
00399 *******************************************************************************/
00400 void ToggleDTOG_RX(uint8_t bEpNum)
00401 {
00402   _ToggleDTOG_RX(bEpNum);
00403 }
00404 /*******************************************************************************
00405 * Function Name  : ToggleDTOG_TX
00406 * Description    : Toggle the DTOG_TX bit.
00407 * Input          : bEpNum: Endpoint Number. 
00408 * Output         : None.
00409 * Return         : None.
00410 *******************************************************************************/
00411 void ToggleDTOG_TX(uint8_t bEpNum)
00412 {
00413   _ToggleDTOG_TX(bEpNum);
00414 }
00415 /*******************************************************************************
00416 * Function Name  : ClearDTOG_RX.
00417 * Description    : Clear the DTOG_RX bit.
00418 * Input          : bEpNum: Endpoint Number. 
00419 * Output         : None.
00420 * Return         : None.
00421 *******************************************************************************/
00422 void ClearDTOG_RX(uint8_t bEpNum)
00423 {
00424   _ClearDTOG_RX(bEpNum);
00425 }
00426 /*******************************************************************************
00427 * Function Name  : ClearDTOG_TX.
00428 * Description    : Clear the DTOG_TX bit.
00429 * Input          : bEpNum: Endpoint Number. 
00430 * Output         : None.
00431 * Return         : None.
00432 *******************************************************************************/
00433 void ClearDTOG_TX(uint8_t bEpNum)
00434 {
00435   _ClearDTOG_TX(bEpNum);
00436 }
00437 /*******************************************************************************
00438 * Function Name  : SetEPAddress
00439 * Description    : Set the endpoint address.
00440 * Input          : bEpNum: Endpoint Number.
00441 *                  bAddr: New endpoint address.
00442 * Output         : None.
00443 * Return         : None.
00444 *******************************************************************************/
00445 void SetEPAddress(uint8_t bEpNum, uint8_t bAddr)
00446 {
00447   _SetEPAddress(bEpNum, bAddr);
00448 }
00449 /*******************************************************************************
00450 * Function Name  : GetEPAddress
00451 * Description    : Get the endpoint address.
00452 * Input          : bEpNum: Endpoint Number. 
00453 * Output         : None.
00454 * Return         : Endpoint address.
00455 *******************************************************************************/
00456 uint8_t GetEPAddress(uint8_t bEpNum)
00457 {
00458   return(_GetEPAddress(bEpNum));
00459 }
00460 /*******************************************************************************
00461 * Function Name  : SetEPTxAddr
00462 * Description    : Set the endpoint Tx buffer address.
00463 * Input          : bEpNum: Endpoint Number.
00464 *                  wAddr: new address. 
00465 * Output         : None.
00466 * Return         : None.
00467 *******************************************************************************/
00468 void SetEPTxAddr(uint8_t bEpNum, uint16_t wAddr)
00469 {
00470   _SetEPTxAddr(bEpNum, wAddr);
00471 }
00472 /*******************************************************************************
00473 * Function Name  : SetEPRxAddr
00474 * Description    : Set the endpoint Rx buffer address.
00475 * Input          : bEpNum: Endpoint Number.
00476 *                  wAddr: new address.
00477 * Output         : None.
00478 * Return         : None.
00479 *******************************************************************************/
00480 void SetEPRxAddr(uint8_t bEpNum, uint16_t wAddr)
00481 {
00482   _SetEPRxAddr(bEpNum, wAddr);
00483 }
00484 /*******************************************************************************
00485 * Function Name  : GetEPTxAddr
00486 * Description    : Returns the endpoint Tx buffer address.
00487 * Input          : bEpNum: Endpoint Number. 
00488 * Output         : None.
00489 * Return         : Rx buffer address. 
00490 *******************************************************************************/
00491 uint16_t GetEPTxAddr(uint8_t bEpNum)
00492 {
00493   return(_GetEPTxAddr(bEpNum));
00494 }
00495 /*******************************************************************************
00496 * Function Name  : GetEPRxAddr.
00497 * Description    : Returns the endpoint Rx buffer address.
00498 * Input          : bEpNum: Endpoint Number. 
00499 * Output         : None.
00500 * Return         : Rx buffer address.
00501 *******************************************************************************/
00502 uint16_t GetEPRxAddr(uint8_t bEpNum)
00503 {
00504   return(_GetEPRxAddr(bEpNum));
00505 }
00506 /*******************************************************************************
00507 * Function Name  : SetEPTxCount.
00508 * Description    : Set the Tx count.
00509 * Input          : bEpNum: Endpoint Number.
00510 *                  wCount: new count value.
00511 * Output         : None.
00512 * Return         : None.
00513 *******************************************************************************/
00514 void SetEPTxCount(uint8_t bEpNum, uint16_t wCount)
00515 {
00516   _SetEPTxCount(bEpNum, wCount);
00517 }
00518 /*******************************************************************************
00519 * Function Name  : SetEPCountRxReg.
00520 * Description    : Set the Count Rx Register value.
00521 * Input          : *pdwReg: point to the register.
00522 *                  wCount: the new register value.
00523 * Output         : None.
00524 * Return         : None.
00525 *******************************************************************************/
00526 void SetEPCountRxReg(uint32_t *pdwReg, uint16_t wCount)
00527 {
00528   _SetEPCountRxReg(dwReg, wCount);
00529 }
00530 /*******************************************************************************
00531 * Function Name  : SetEPRxCount
00532 * Description    : Set the Rx count.
00533 * Input          : bEpNum: Endpoint Number. 
00534 *                  wCount: the new count value.
00535 * Output         : None.
00536 * Return         : None.
00537 *******************************************************************************/
00538 void SetEPRxCount(uint8_t bEpNum, uint16_t wCount)
00539 {
00540   _SetEPRxCount(bEpNum, wCount);
00541 }
00542 /*******************************************************************************
00543 * Function Name  : GetEPTxCount
00544 * Description    : Get the Tx count.
00545 * Input          : bEpNum: Endpoint Number. 
00546 * Output         : None
00547 * Return         : Tx count value.
00548 *******************************************************************************/
00549 uint16_t GetEPTxCount(uint8_t bEpNum)
00550 {
00551   return(_GetEPTxCount(bEpNum));
00552 }
00553 /*******************************************************************************
00554 * Function Name  : GetEPRxCount
00555 * Description    : Get the Rx count.
00556 * Input          : bEpNum: Endpoint Number. 
00557 * Output         : None.
00558 * Return         : Rx count value.
00559 *******************************************************************************/
00560 uint16_t GetEPRxCount(uint8_t bEpNum)
00561 {
00562   return(_GetEPRxCount(bEpNum));
00563 }
00564 /*******************************************************************************
00565 * Function Name  : SetEPDblBuffAddr
00566 * Description    : Set the addresses of the buffer 0 and 1.
00567 * Input          : bEpNum: Endpoint Number.  
00568 *                  wBuf0Addr: new address of buffer 0. 
00569 *                  wBuf1Addr: new address of buffer 1.
00570 * Output         : None.
00571 * Return         : None.
00572 *******************************************************************************/
00573 void SetEPDblBuffAddr(uint8_t bEpNum, uint16_t wBuf0Addr, uint16_t wBuf1Addr)
00574 {
00575   _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr);
00576 }
00577 /*******************************************************************************
00578 * Function Name  : SetEPDblBuf0Addr
00579 * Description    : Set the Buffer 1 address.
00580 * Input          : bEpNum: Endpoint Number
00581 *                  wBuf0Addr: new address.
00582 * Output         : None.
00583 * Return         : None.
00584 *******************************************************************************/
00585 void SetEPDblBuf0Addr(uint8_t bEpNum, uint16_t wBuf0Addr)
00586 {
00587   _SetEPDblBuf0Addr(bEpNum, wBuf0Addr);
00588 }
00589 /*******************************************************************************
00590 * Function Name  : SetEPDblBuf1Addr
00591 * Description    : Set the Buffer 1 address.
00592 * Input          : bEpNum: Endpoint Number
00593 *                  wBuf1Addr: new address.
00594 * Output         : None.
00595 * Return         : None.
00596 *******************************************************************************/
00597 void SetEPDblBuf1Addr(uint8_t bEpNum, uint16_t wBuf1Addr)
00598 {
00599   _SetEPDblBuf1Addr(bEpNum, wBuf1Addr);
00600 }
00601 /*******************************************************************************
00602 * Function Name  : GetEPDblBuf0Addr
00603 * Description    : Returns the address of the Buffer 0.
00604 * Input          : bEpNum: Endpoint Number.
00605 * Output         : None.
00606 * Return         : None.
00607 *******************************************************************************/
00608 uint16_t GetEPDblBuf0Addr(uint8_t bEpNum)
00609 {
00610   return(_GetEPDblBuf0Addr(bEpNum));
00611 }
00612 /*******************************************************************************
00613 * Function Name  : GetEPDblBuf1Addr
00614 * Description    : Returns the address of the Buffer 1.
00615 * Input          : bEpNum: Endpoint Number.
00616 * Output         : None.
00617 * Return         : Address of the Buffer 1.
00618 *******************************************************************************/
00619 uint16_t GetEPDblBuf1Addr(uint8_t bEpNum)
00620 {
00621   return(_GetEPDblBuf1Addr(bEpNum));
00622 }
00623 /*******************************************************************************
00624 * Function Name  : SetEPDblBuffCount
00625 * Description    : Set the number of bytes for a double Buffer 
00626 *                  endpoint.
00627 * Input          : bEpNum,bDir, wCount
00628 * Output         : None.
00629 * Return         : None.
00630 *******************************************************************************/
00631 void SetEPDblBuffCount(uint8_t bEpNum, uint8_t bDir, uint16_t wCount)
00632 {
00633   _SetEPDblBuffCount(bEpNum, bDir, wCount);
00634 }
00635 /*******************************************************************************
00636 * Function Name  : SetEPDblBuf0Count
00637 * Description    : Set the number of bytes in the buffer 0 of a double Buffer 
00638 *                  endpoint.
00639 * Input          : bEpNum, bDir,  wCount
00640 * Output         : None.
00641 * Return         : None.
00642 *******************************************************************************/
00643 void SetEPDblBuf0Count(uint8_t bEpNum, uint8_t bDir, uint16_t wCount)
00644 {
00645   _SetEPDblBuf0Count(bEpNum, bDir, wCount);
00646 }
00647 /*******************************************************************************
00648 * Function Name  : SetEPDblBuf1Count
00649 * Description    : Set the number of bytes in the buffer 0 of a double Buffer 
00650 *                  endpoint.
00651 * Input          : bEpNum,  bDir,  wCount
00652 * Output         : None.
00653 * Return         : None.
00654 *******************************************************************************/
00655 void SetEPDblBuf1Count(uint8_t bEpNum, uint8_t bDir, uint16_t wCount)
00656 {
00657   _SetEPDblBuf1Count(bEpNum, bDir, wCount);
00658 }
00659 /*******************************************************************************
00660 * Function Name  : GetEPDblBuf0Count
00661 * Description    : Returns the number of byte received in the buffer 0 of a double
00662 *                  Buffer endpoint.
00663 * Input          : bEpNum: Endpoint Number.
00664 * Output         : None.
00665 * Return         : Endpoint Buffer 0 count
00666 *******************************************************************************/
00667 uint16_t GetEPDblBuf0Count(uint8_t bEpNum)
00668 {
00669   return(_GetEPDblBuf0Count(bEpNum));
00670 }
00671 /*******************************************************************************
00672 * Function Name  : GetEPDblBuf1Count
00673 * Description    : Returns the number of data received in the buffer 1 of a double
00674 *                  Buffer endpoint.
00675 * Input          : bEpNum: Endpoint Number.
00676 * Output         : None.
00677 * Return         : Endpoint Buffer 1 count.
00678 *******************************************************************************/
00679 uint16_t GetEPDblBuf1Count(uint8_t bEpNum)
00680 {
00681   return(_GetEPDblBuf1Count(bEpNum));
00682 }
00683 /*******************************************************************************
00684 * Function Name  : GetEPDblBufDir
00685 * Description    : gets direction of the double buffered endpoint
00686 * Input          : bEpNum: Endpoint Number. 
00687 * Output         : None.
00688 * Return         : EP_DBUF_OUT, EP_DBUF_IN,
00689 *                  EP_DBUF_ERR if the endpoint counter not yet programmed.
00690 *******************************************************************************/
00691 EP_DBUF_DIR GetEPDblBufDir(uint8_t bEpNum)
00692 {
00693   if ((uint16_t)(*_pEPRxCount(bEpNum) & 0xFC00) != 0)
00694     return(EP_DBUF_OUT);
00695   else if (((uint16_t)(*_pEPTxCount(bEpNum)) & 0x03FF) != 0)
00696     return(EP_DBUF_IN);
00697   else
00698     return(EP_DBUF_ERR);
00699 }
00700 /*******************************************************************************
00701 * Function Name  : FreeUserBuffer
00702 * Description    : free buffer used from the application realizing it to the line
00703                    toggles bit SW_BUF in the double buffered endpoint register
00704 * Input          : bEpNum, bDir
00705 * Output         : None.
00706 * Return         : None.
00707 *******************************************************************************/
00708 void FreeUserBuffer(uint8_t bEpNum, uint8_t bDir)
00709 {
00710   if (bDir == EP_DBUF_OUT)
00711   { /* OUT double buffered endpoint */
00712     _ToggleDTOG_TX(bEpNum);
00713   }
00714   else if (bDir == EP_DBUF_IN)
00715   { /* IN double buffered endpoint */
00716     _ToggleDTOG_RX(bEpNum);
00717   }
00718 }
00719 
00720 /*******************************************************************************
00721 * Function Name  : ToWord
00722 * Description    : merge two byte in a word.
00723 * Input          : bh: byte high, bl: bytes low.
00724 * Output         : None.
00725 * Return         : resulted word.
00726 *******************************************************************************/
00727 uint16_t ToWord(uint8_t bh, uint8_t bl)
00728 {
00729   uint16_t wRet;
00730   wRet = (uint16_t)bl | ((uint16_t)bh << 8);
00731   return(wRet);
00732 }
00733 /*******************************************************************************
00734 * Function Name  : ByteSwap
00735 * Description    : Swap two byte in a word.
00736 * Input          : wSwW: word to Swap.
00737 * Output         : None.
00738 * Return         : resulted word.
00739 *******************************************************************************/
00740 uint16_t ByteSwap(uint16_t wSwW)
00741 {
00742   uint8_t bTemp;
00743   uint16_t wRet;
00744   bTemp = (uint8_t)(wSwW & 0xff);
00745   wRet =  (wSwW >> 8) | ((uint16_t)bTemp << 8);
00746   return(wRet);
00747 }
00748 
00749 #endif /* STM32F10X_CL */
00750 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/