STM32F10,L1 en F3 USB Full Speed Device bibliotheek  1.0
ST Microelectronics USB Full Speed Device bibliotheek documentatie
 All Data Structures Files
usb_regs.h File Reference

Interface prototype functions to USB cell registers. More...

Go to the source code of this file.

Macros

#define RegBase   (0x40005C00L) /* USB_IP Peripheral Registers base address */
 
#define PMAAddr   (0x40006000L) /* USB_IP Packet Memory Area base address */
 
#define CNTR   ((__IO unsigned *)(RegBase + 0x40))
 
#define ISTR   ((__IO unsigned *)(RegBase + 0x44))
 
#define FNR   ((__IO unsigned *)(RegBase + 0x48))
 
#define DADDR   ((__IO unsigned *)(RegBase + 0x4C))
 
#define BTABLE   ((__IO unsigned *)(RegBase + 0x50))
 
#define EP0REG   ((__IO unsigned *)(RegBase)) /* endpoint 0 register address */
 
#define EP0_OUT   ((uint8_t)0x00)
 
#define EP0_IN   ((uint8_t)0x80)
 
#define EP1_OUT   ((uint8_t)0x01)
 
#define EP1_IN   ((uint8_t)0x81)
 
#define EP2_OUT   ((uint8_t)0x02)
 
#define EP2_IN   ((uint8_t)0x82)
 
#define EP3_OUT   ((uint8_t)0x03)
 
#define EP3_IN   ((uint8_t)0x83)
 
#define EP4_OUT   ((uint8_t)0x04)
 
#define EP4_IN   ((uint8_t)0x84)
 
#define EP5_OUT   ((uint8_t)0x05)
 
#define EP5_IN   ((uint8_t)0x85)
 
#define EP6_OUT   ((uint8_t)0x06)
 
#define EP6_IN   ((uint8_t)0x86)
 
#define EP7_OUT   ((uint8_t)0x07)
 
#define EP7_IN   ((uint8_t)0x87)
 
#define ENDP0   ((uint8_t)0)
 
#define ENDP1   ((uint8_t)1)
 
#define ENDP2   ((uint8_t)2)
 
#define ENDP3   ((uint8_t)3)
 
#define ENDP4   ((uint8_t)4)
 
#define ENDP5   ((uint8_t)5)
 
#define ENDP6   ((uint8_t)6)
 
#define ENDP7   ((uint8_t)7)
 
#define ISTR_CTR   (0x8000) /* Correct TRansfer (clear-only bit) */
 
#define ISTR_DOVR   (0x4000) /* DMA OVeR/underrun (clear-only bit) */
 
#define ISTR_ERR   (0x2000) /* ERRor (clear-only bit) */
 
#define ISTR_WKUP   (0x1000) /* WaKe UP (clear-only bit) */
 
#define ISTR_SUSP   (0x0800) /* SUSPend (clear-only bit) */
 
#define ISTR_RESET   (0x0400) /* RESET (clear-only bit) */
 
#define ISTR_SOF   (0x0200) /* Start Of Frame (clear-only bit) */
 
#define ISTR_ESOF   (0x0100) /* Expected Start Of Frame (clear-only bit) */
 
#define ISTR_DIR   (0x0010) /* DIRection of transaction (read-only bit) */
 
#define ISTR_EP_ID   (0x000F) /* EndPoint IDentifier (read-only bit) */
 
#define CLR_CTR   (~ISTR_CTR) /* clear Correct TRansfer bit */
 
#define CLR_DOVR   (~ISTR_DOVR) /* clear DMA OVeR/underrun bit*/
 
#define CLR_ERR   (~ISTR_ERR) /* clear ERRor bit */
 
#define CLR_WKUP   (~ISTR_WKUP) /* clear WaKe UP bit */
 
#define CLR_SUSP   (~ISTR_SUSP) /* clear SUSPend bit */
 
#define CLR_RESET   (~ISTR_RESET) /* clear RESET bit */
 
#define CLR_SOF   (~ISTR_SOF) /* clear Start Of Frame bit */
 
#define CLR_ESOF   (~ISTR_ESOF) /* clear Expected Start Of Frame bit */
 
#define CNTR_CTRM   (0x8000) /* Correct TRansfer Mask */
 
#define CNTR_DOVRM   (0x4000) /* DMA OVeR/underrun Mask */
 
#define CNTR_ERRM   (0x2000) /* ERRor Mask */
 
#define CNTR_WKUPM   (0x1000) /* WaKe UP Mask */
 
#define CNTR_SUSPM   (0x0800) /* SUSPend Mask */
 
#define CNTR_RESETM   (0x0400) /* RESET Mask */
 
#define CNTR_SOFM   (0x0200) /* Start Of Frame Mask */
 
#define CNTR_ESOFM   (0x0100) /* Expected Start Of Frame Mask */
 
#define CNTR_RESUME   (0x0010) /* RESUME request */
 
#define CNTR_FSUSP   (0x0008) /* Force SUSPend */
 
#define CNTR_LPMODE   (0x0004) /* Low-power MODE */
 
#define CNTR_PDWN   (0x0002) /* Power DoWN */
 
#define CNTR_FRES   (0x0001) /* Force USB RESet */
 
#define FNR_RXDP   (0x8000) /* status of D+ data line */
 
#define FNR_RXDM   (0x4000) /* status of D- data line */
 
#define FNR_LCK   (0x2000) /* LoCKed */
 
#define FNR_LSOF   (0x1800) /* Lost SOF */
 
#define FNR_FN   (0x07FF) /* Frame Number */
 
#define DADDR_EF   (0x80)
 
#define DADDR_ADD   (0x7F)
 
#define EP_CTR_RX   (0x8000) /* EndPoint Correct TRansfer RX */
 
#define EP_DTOG_RX   (0x4000) /* EndPoint Data TOGGLE RX */
 
#define EPRX_STAT   (0x3000) /* EndPoint RX STATus bit field */
 
#define EP_SETUP   (0x0800) /* EndPoint SETUP */
 
#define EP_T_FIELD   (0x0600) /* EndPoint TYPE */
 
#define EP_KIND   (0x0100) /* EndPoint KIND */
 
#define EP_CTR_TX   (0x0080) /* EndPoint Correct TRansfer TX */
 
#define EP_DTOG_TX   (0x0040) /* EndPoint Data TOGGLE TX */
 
#define EPTX_STAT   (0x0030) /* EndPoint TX STATus bit field */
 
#define EPADDR_FIELD   (0x000F) /* EndPoint ADDRess FIELD */
 
#define EPREG_MASK   (EP_CTR_RX|EP_SETUP|EP_T_FIELD|EP_KIND|EP_CTR_TX|EPADDR_FIELD)
 
#define EP_TYPE_MASK   (0x0600) /* EndPoint TYPE Mask */
 
#define EP_BULK   (0x0000) /* EndPoint BULK */
 
#define EP_CONTROL   (0x0200) /* EndPoint CONTROL */
 
#define EP_ISOCHRONOUS   (0x0400) /* EndPoint ISOCHRONOUS */
 
#define EP_INTERRUPT   (0x0600) /* EndPoint INTERRUPT */
 
#define EP_T_MASK   (~EP_T_FIELD & EPREG_MASK)
 
#define EPKIND_MASK   (~EP_KIND & EPREG_MASK)
 
#define EP_TX_DIS   (0x0000) /* EndPoint TX DISabled */
 
#define EP_TX_STALL   (0x0010) /* EndPoint TX STALLed */
 
#define EP_TX_NAK   (0x0020) /* EndPoint TX NAKed */
 
#define EP_TX_VALID   (0x0030) /* EndPoint TX VALID */
 
#define EPTX_DTOG1   (0x0010) /* EndPoint TX Data TOGgle bit1 */
 
#define EPTX_DTOG2   (0x0020) /* EndPoint TX Data TOGgle bit2 */
 
#define EPTX_DTOGMASK   (EPTX_STAT|EPREG_MASK)
 
#define EP_RX_DIS   (0x0000) /* EndPoint RX DISabled */
 
#define EP_RX_STALL   (0x1000) /* EndPoint RX STALLed */
 
#define EP_RX_NAK   (0x2000) /* EndPoint RX NAKed */
 
#define EP_RX_VALID   (0x3000) /* EndPoint RX VALID */
 
#define EPRX_DTOG1   (0x1000) /* EndPoint RX Data TOGgle bit1 */
 
#define EPRX_DTOG2   (0x2000) /* EndPoint RX Data TOGgle bit1 */
 
#define EPRX_DTOGMASK   (EPRX_STAT|EPREG_MASK)
 
#define _SetCNTR(wRegValue)   (*CNTR = (uint16_t)wRegValue)
 
#define _SetISTR(wRegValue)   (*ISTR = (uint16_t)wRegValue)
 
#define _SetDADDR(wRegValue)   (*DADDR = (uint16_t)wRegValue)
 
#define _SetBTABLE(wRegValue)   (*BTABLE = (uint16_t)(wRegValue & 0xFFF8))
 
#define _GetCNTR()   ((uint16_t) *CNTR)
 
#define _GetISTR()   ((uint16_t) *ISTR)
 
#define _GetFNR()   ((uint16_t) *FNR)
 
#define _GetDADDR()   ((uint16_t) *DADDR)
 
#define _GetBTABLE()   ((uint16_t) *BTABLE)
 
#define _SetENDPOINT(bEpNum, wRegValue)
 
#define _GetENDPOINT(bEpNum)   ((uint16_t)(*(EP0REG + bEpNum)))
 
#define _SetEPType(bEpNum, wType)
 
#define _GetEPType(bEpNum)   (_GetENDPOINT(bEpNum) & EP_T_FIELD)
 
#define _SetEPTxStatus(bEpNum, wState)
 
#define _SetEPRxStatus(bEpNum, wState)
 
#define _SetEPRxTxStatus(bEpNum, wStaterx, wStatetx)
 
#define _GetEPTxStatus(bEpNum)   ((uint16_t)_GetENDPOINT(bEpNum) & EPTX_STAT)
 
#define _GetEPRxStatus(bEpNum)   ((uint16_t)_GetENDPOINT(bEpNum) & EPRX_STAT)
 
#define _SetEPTxValid(bEpNum)   (_SetEPTxStatus(bEpNum, EP_TX_VALID))
 
#define _SetEPRxValid(bEpNum)   (_SetEPRxStatus(bEpNum, EP_RX_VALID))
 
#define _GetTxStallStatus(bEpNum)
 
#define _GetRxStallStatus(bEpNum)
 
#define _SetEP_KIND(bEpNum)
 
#define _ClearEP_KIND(bEpNum)
 
#define _Set_Status_Out(bEpNum)   _SetEP_KIND(bEpNum)
 
#define _Clear_Status_Out(bEpNum)   _ClearEP_KIND(bEpNum)
 
#define _SetEPDoubleBuff(bEpNum)   _SetEP_KIND(bEpNum)
 
#define _ClearEPDoubleBuff(bEpNum)   _ClearEP_KIND(bEpNum)
 
#define _ClearEP_CTR_RX(bEpNum)
 
#define _ClearEP_CTR_TX(bEpNum)
 
#define _ToggleDTOG_RX(bEpNum)
 
#define _ToggleDTOG_TX(bEpNum)
 
#define _ClearDTOG_RX(bEpNum)
 
#define _ClearDTOG_TX(bEpNum)
 
#define _SetEPAddress(bEpNum, bAddr)
 
#define _GetEPAddress(bEpNum)   ((uint8_t)(_GetENDPOINT(bEpNum) & EPADDR_FIELD))
 
#define _pEPTxAddr(bEpNum)   ((uint32_t *)((_GetBTABLE()+bEpNum*8 )*2 + PMAAddr))
 
#define _pEPTxCount(bEpNum)   ((uint32_t *)((_GetBTABLE()+bEpNum*8+2)*2 + PMAAddr))
 
#define _pEPRxAddr(bEpNum)   ((uint32_t *)((_GetBTABLE()+bEpNum*8+4)*2 + PMAAddr))
 
#define _pEPRxCount(bEpNum)   ((uint32_t *)((_GetBTABLE()+bEpNum*8+6)*2 + PMAAddr))
 
#define _SetEPTxAddr(bEpNum, wAddr)   (*_pEPTxAddr(bEpNum) = ((wAddr >> 1) << 1))
 
#define _SetEPRxAddr(bEpNum, wAddr)   (*_pEPRxAddr(bEpNum) = ((wAddr >> 1) << 1))
 
#define _GetEPTxAddr(bEpNum)   ((uint16_t)*_pEPTxAddr(bEpNum))
 
#define _GetEPRxAddr(bEpNum)   ((uint16_t)*_pEPRxAddr(bEpNum))
 
#define _BlocksOf32(dwReg, wCount, wNBlocks)
 
#define _BlocksOf2(dwReg, wCount, wNBlocks)
 
#define _SetEPCountRxReg(dwReg, wCount)
 
#define _SetEPRxDblBuf0Count(bEpNum, wCount)
 
#define _SetEPTxCount(bEpNum, wCount)   (*_pEPTxCount(bEpNum) = wCount)
 
#define _SetEPRxCount(bEpNum, wCount)
 
#define _GetEPTxCount(bEpNum)   ((uint16_t)(*_pEPTxCount(bEpNum)) & 0x3ff)
 
#define _GetEPRxCount(bEpNum)   ((uint16_t)(*_pEPRxCount(bEpNum)) & 0x3ff)
 
#define _SetEPDblBuf0Addr(bEpNum, wBuf0Addr)   {_SetEPTxAddr(bEpNum, wBuf0Addr);}
 
#define _SetEPDblBuf1Addr(bEpNum, wBuf1Addr)   {_SetEPRxAddr(bEpNum, wBuf1Addr);}
 
#define _SetEPDblBuffAddr(bEpNum, wBuf0Addr, wBuf1Addr)
 
#define _GetEPDblBuf0Addr(bEpNum)   (_GetEPTxAddr(bEpNum))
 
#define _GetEPDblBuf1Addr(bEpNum)   (_GetEPRxAddr(bEpNum))
 
#define _SetEPDblBuf0Count(bEpNum, bDir, wCount)
 
#define _SetEPDblBuf1Count(bEpNum, bDir, wCount)
 
#define _SetEPDblBuffCount(bEpNum, bDir, wCount)
 
#define _GetEPDblBuf0Count(bEpNum)   (_GetEPTxCount(bEpNum))
 
#define _GetEPDblBuf1Count(bEpNum)   (_GetEPRxCount(bEpNum))
 

Typedefs

typedef enum _EP_DBUF_DIR EP_DBUF_DIR
 

Enumerations

enum  _EP_DBUF_DIR { EP_DBUF_ERR, EP_DBUF_OUT, EP_DBUF_IN }
 
enum  EP_BUF_NUM { EP_NOBUF, EP_BUF0, EP_BUF1 }
 

Functions

void SetCNTR (uint16_t)
 
void SetISTR (uint16_t)
 
void SetDADDR (uint16_t)
 
void SetBTABLE (uint16_t)
 
uint16_t GetCNTR (void)
 
uint16_t GetISTR (void)
 
uint16_t GetFNR (void)
 
uint16_t GetDADDR (void)
 
uint16_t GetBTABLE (void)
 
void SetENDPOINT (uint8_t, uint16_t)
 
uint16_t GetENDPOINT (uint8_t)
 
void SetEPType (uint8_t, uint16_t)
 
uint16_t GetEPType (uint8_t)
 
void SetEPTxStatus (uint8_t, uint16_t)
 
void SetEPRxStatus (uint8_t, uint16_t)
 
void SetDouBleBuffEPStall (uint8_t, uint8_t bDir)
 
uint16_t GetEPTxStatus (uint8_t)
 
uint16_t GetEPRxStatus (uint8_t)
 
void SetEPTxValid (uint8_t)
 
void SetEPRxValid (uint8_t)
 
uint16_t GetTxStallStatus (uint8_t)
 
uint16_t GetRxStallStatus (uint8_t)
 
void SetEP_KIND (uint8_t)
 
void ClearEP_KIND (uint8_t)
 
void Set_Status_Out (uint8_t)
 
void Clear_Status_Out (uint8_t)
 
void SetEPDoubleBuff (uint8_t)
 
void ClearEPDoubleBuff (uint8_t)
 
void ClearEP_CTR_RX (uint8_t)
 
void ClearEP_CTR_TX (uint8_t)
 
void ToggleDTOG_RX (uint8_t)
 
void ToggleDTOG_TX (uint8_t)
 
void ClearDTOG_RX (uint8_t)
 
void ClearDTOG_TX (uint8_t)
 
void SetEPAddress (uint8_t, uint8_t)
 
uint8_t GetEPAddress (uint8_t)
 
void SetEPTxAddr (uint8_t, uint16_t)
 
void SetEPRxAddr (uint8_t, uint16_t)
 
uint16_t GetEPTxAddr (uint8_t)
 
uint16_t GetEPRxAddr (uint8_t)
 
void SetEPCountRxReg (uint32_t *, uint16_t)
 
void SetEPTxCount (uint8_t, uint16_t)
 
void SetEPRxCount (uint8_t, uint16_t)
 
uint16_t GetEPTxCount (uint8_t)
 
uint16_t GetEPRxCount (uint8_t)
 
void SetEPDblBuf0Addr (uint8_t, uint16_t)
 
void SetEPDblBuf1Addr (uint8_t, uint16_t)
 
void SetEPDblBuffAddr (uint8_t, uint16_t, uint16_t)
 
uint16_t GetEPDblBuf0Addr (uint8_t)
 
uint16_t GetEPDblBuf1Addr (uint8_t)
 
void SetEPDblBuffCount (uint8_t, uint8_t, uint16_t)
 
void SetEPDblBuf0Count (uint8_t, uint8_t, uint16_t)
 
void SetEPDblBuf1Count (uint8_t, uint8_t, uint16_t)
 
uint16_t GetEPDblBuf0Count (uint8_t)
 
uint16_t GetEPDblBuf1Count (uint8_t)
 
EP_DBUF_DIR GetEPDblBufDir (uint8_t)
 
void FreeUserBuffer (uint8_t bEpNum, uint8_t bDir)
 
uint16_t ToWord (uint8_t, uint8_t)
 
uint16_t ByteSwap (uint16_t)
 

Variables

__IO uint16_t wIstr
 

Detailed Description

Interface prototype functions to USB cell registers.

Author
MCD Application Team
Version
V4.0.0
Date
28-August-2012
Attention

© COPYRIGHT 2012 STMicroelectronics

Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); You may not use this file except in compliance with the License. You may obtain a copy of the License at:

   http://www.st.com/software_license_agreement_liberty_v2

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Macro Definition Documentation

#define _BlocksOf2 (   dwReg,
  wCount,
  wNBlocks 
)
Value:
{\
wNBlocks = wCount >> 1;\
if((wCount & 0x1) != 0)\
wNBlocks++;\
*pdwReg = (uint32_t)(wNBlocks << 10);\
}/* _BlocksOf2 */
#define _BlocksOf32 (   dwReg,
  wCount,
  wNBlocks 
)
Value:
{\
wNBlocks = wCount >> 5;\
if((wCount & 0x1f) == 0)\
wNBlocks--;\
*pdwReg = (uint32_t)((wNBlocks << 10) | 0x8000);\
}/* _BlocksOf32 */
#define _ClearDTOG_RX (   bEpNum)
Value:
if((_GetENDPOINT(bEpNum) & EP_DTOG_RX) != 0)\
_ToggleDTOG_RX(bEpNum)
#define _ClearDTOG_TX (   bEpNum)
Value:
if((_GetENDPOINT(bEpNum) & EP_DTOG_TX) != 0)\
_ToggleDTOG_TX(bEpNum)
#define _ClearEP_CTR_RX (   bEpNum)
Value:
(_SetENDPOINT(bEpNum,\
_GetENDPOINT(bEpNum) & 0x7FFF & EPREG_MASK))
#define _ClearEP_CTR_TX (   bEpNum)
Value:
(_SetENDPOINT(bEpNum,\
_GetENDPOINT(bEpNum) & 0xFF7F & EPREG_MASK))
#define _ClearEP_KIND (   bEpNum)
Value:
(_SetENDPOINT(bEpNum, \
(EP_CTR_RX|EP_CTR_TX|(_GetENDPOINT(bEpNum) & EPKIND_MASK))))
#define _GetRxStallStatus (   bEpNum)
Value:
(_GetEPRxStatus(bEpNum) \
== EP_RX_STALL)
#define _GetTxStallStatus (   bEpNum)
Value:
(_GetEPTxStatus(bEpNum) \
== EP_TX_STALL)
#define _SetENDPOINT (   bEpNum,
  wRegValue 
)
Value:
(*(EP0REG + bEpNum)= \
(uint16_t)wRegValue)
#define _SetEP_KIND (   bEpNum)
Value:
(_SetENDPOINT(bEpNum, \
(EP_CTR_RX|EP_CTR_TX|((_GetENDPOINT(bEpNum) | EP_KIND) & EPREG_MASK))))
#define _SetEPAddress (   bEpNum,
  bAddr 
)
Value:
_SetENDPOINT(bEpNum,\
EP_CTR_RX|EP_CTR_TX|(_GetENDPOINT(bEpNum) & EPREG_MASK) | bAddr)
#define _SetEPCountRxReg (   dwReg,
  wCount 
)
Value:
{\
uint16_t wNBlocks;\
if(wCount > 62){_BlocksOf32(dwReg,wCount,wNBlocks);}\
else {_BlocksOf2(dwReg,wCount,wNBlocks);}\
}/* _SetEPCountRxReg */
#define _SetEPDblBuf0Count (   bEpNum,
  bDir,
  wCount 
)
Value:
{ \
if(bDir == EP_DBUF_OUT)\
/* OUT endpoint */ \
{_SetEPRxDblBuf0Count(bEpNum,wCount);} \
else if(bDir == EP_DBUF_IN)\
/* IN endpoint */ \
*_pEPTxCount(bEpNum) = (uint32_t)wCount; \
} /* SetEPDblBuf0Count*/
#define _SetEPDblBuf1Count (   bEpNum,
  bDir,
  wCount 
)
Value:
{ \
if(bDir == EP_DBUF_OUT)\
/* OUT endpoint */ \
{_SetEPRxCount(bEpNum,wCount);}\
else if(bDir == EP_DBUF_IN)\
/* IN endpoint */\
*_pEPRxCount(bEpNum) = (uint32_t)wCount; \
} /* SetEPDblBuf1Count */
#define _SetEPDblBuffAddr (   bEpNum,
  wBuf0Addr,
  wBuf1Addr 
)
Value:
{ \
_SetEPDblBuf0Addr(bEpNum, wBuf0Addr);\
_SetEPDblBuf1Addr(bEpNum, wBuf1Addr);\
} /* _SetEPDblBuffAddr */
#define _SetEPDblBuffCount (   bEpNum,
  bDir,
  wCount 
)
Value:
{\
_SetEPDblBuf0Count(bEpNum, bDir, wCount); \
_SetEPDblBuf1Count(bEpNum, bDir, wCount); \
} /* _SetEPDblBuffCount */
#define _SetEPRxCount (   bEpNum,
  wCount 
)
Value:
{\
uint32_t *pdwReg = _pEPRxCount(bEpNum); \
_SetEPCountRxReg(pdwReg, wCount);\
}
#define _SetEPRxDblBuf0Count (   bEpNum,
  wCount 
)
Value:
{\
uint32_t *pdwReg = _pEPTxCount(bEpNum); \
_SetEPCountRxReg(pdwReg, wCount);\
}
#define _SetEPRxStatus (   bEpNum,
  wState 
)
Value:
{\
register uint16_t _wRegVal; \
\
_wRegVal = _GetENDPOINT(bEpNum) & EPRX_DTOGMASK;\
/* toggle first bit ? */ \
if((EPRX_DTOG1 & wState)!= 0) \
_wRegVal ^= EPRX_DTOG1; \
/* toggle second bit ? */ \
if((EPRX_DTOG2 & wState)!= 0) \
_wRegVal ^= EPRX_DTOG2; \
_SetENDPOINT(bEpNum, (_wRegVal | EP_CTR_RX|EP_CTR_TX)); \
} /* _SetEPRxStatus */
#define _SetEPRxTxStatus (   bEpNum,
  wStaterx,
  wStatetx 
)
Value:
{\
register uint32_t _wRegVal; \
\
_wRegVal = _GetENDPOINT(bEpNum) & (EPRX_DTOGMASK |EPTX_STAT) ;\
/* toggle first bit ? */ \
if((EPRX_DTOG1 & wStaterx)!= 0) \
_wRegVal ^= EPRX_DTOG1; \
/* toggle second bit ? */ \
if((EPRX_DTOG2 & wStaterx)!= 0) \
_wRegVal ^= EPRX_DTOG2; \
/* toggle first bit ? */ \
if((EPTX_DTOG1 & wStatetx)!= 0) \
_wRegVal ^= EPTX_DTOG1; \
/* toggle second bit ? */ \
if((EPTX_DTOG2 & wStatetx)!= 0) \
_wRegVal ^= EPTX_DTOG2; \
_SetENDPOINT(bEpNum, _wRegVal | EP_CTR_RX|EP_CTR_TX); \
} /* _SetEPRxTxStatus */
#define _SetEPTxStatus (   bEpNum,
  wState 
)
Value:
{\
register uint16_t _wRegVal; \
_wRegVal = _GetENDPOINT(bEpNum) & EPTX_DTOGMASK;\
/* toggle first bit ? */ \
if((EPTX_DTOG1 & wState)!= 0) \
_wRegVal ^= EPTX_DTOG1; \
/* toggle second bit ? */ \
if((EPTX_DTOG2 & wState)!= 0) \
_wRegVal ^= EPTX_DTOG2; \
_SetENDPOINT(bEpNum, (_wRegVal | EP_CTR_RX|EP_CTR_TX)); \
} /* _SetEPTxStatus */
#define _SetEPType (   bEpNum,
  wType 
)
Value:
(_SetENDPOINT(bEpNum,\
((_GetENDPOINT(bEpNum) & EP_T_MASK) | wType )))
#define _ToggleDTOG_RX (   bEpNum)
Value:
(_SetENDPOINT(bEpNum, \
EP_CTR_RX|EP_CTR_TX|EP_DTOG_RX | (_GetENDPOINT(bEpNum) & EPREG_MASK)))
#define _ToggleDTOG_TX (   bEpNum)
Value:
(_SetENDPOINT(bEpNum, \
EP_CTR_RX|EP_CTR_TX|EP_DTOG_TX | (_GetENDPOINT(bEpNum) & EPREG_MASK)))