STM32L443xx HAL User Manual
Defines
PCD Private Macros
PCD

Defines

#define PCD_MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define PCD_MAX(a, b)   (((a) > (b)) ? (a) : (b))
#define USB_CNTRX_NBLK_MSK   (0x1FU << 10)
#define USB_CNTRX_BLSIZE   (0x1U << 15)
#define PCD_SET_ENDPOINT(USBx, bEpNum, wRegValue)
#define PCD_GET_ENDPOINT(USBx, bEpNum)   (*(__IO uint16_t *)(&(USBx)->EP0R + ((bEpNum) * 2U)))
#define USB_EP0StartXfer   USB_EPStartXfer
#define PCD_SET_EPTYPE(USBx, bEpNum, wType)
 sets the type in the endpoint register(bits EP_TYPE[1:0])
#define PCD_GET_EPTYPE(USBx, bEpNum)   (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_FIELD)
 gets the type in the endpoint register(bits EP_TYPE[1:0])
#define PCD_FREE_USER_BUFFER(USBx, bEpNum, bDir)
 free buffer used from the application realizing it to the line toggles bit SW_BUF in the double buffered endpoint register
#define PCD_SET_EP_TX_STATUS(USBx, bEpNum, wState)
 sets the status for tx transfer (bits STAT_TX[1:0]).
#define PCD_SET_EP_RX_STATUS(USBx, bEpNum, wState)
 sets the status for rx transfer (bits STAT_TX[1:0])
#define PCD_SET_EP_TXRX_STATUS(USBx, bEpNum, wStaterx, wStatetx)
 sets the status for rx & tx (bits STAT_TX[1:0] & STAT_RX[1:0])
#define PCD_GET_EP_TX_STATUS(USBx, bEpNum)   ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_STAT)
 gets the status for tx/rx transfer (bits STAT_TX[1:0] /STAT_RX[1:0])
#define PCD_GET_EP_RX_STATUS(USBx, bEpNum)   ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_STAT)
#define PCD_SET_EP_TX_VALID(USBx, bEpNum)   (PCD_SET_EP_TX_STATUS((USBx), (bEpNum), USB_EP_TX_VALID))
 sets directly the VALID tx/rx-status into the endpoint register
#define PCD_SET_EP_RX_VALID(USBx, bEpNum)   (PCD_SET_EP_RX_STATUS((USBx), (bEpNum), USB_EP_RX_VALID))
#define PCD_GET_EP_TX_STALL_STATUS(USBx, bEpNum)   (PCD_GET_EP_TX_STATUS((USBx), (bEpNum)) == USB_EP_TX_STALL)
 checks stall condition in an endpoint.
#define PCD_GET_EP_RX_STALL_STATUS(USBx, bEpNum)   (PCD_GET_EP_RX_STATUS((USBx), (bEpNum)) == USB_EP_RX_STALL)
#define PCD_SET_EP_KIND(USBx, bEpNum)
 set & clear EP_KIND bit.
#define PCD_CLEAR_EP_KIND(USBx, bEpNum)
#define PCD_SET_OUT_STATUS(USBx, bEpNum)   PCD_SET_EP_KIND((USBx), (bEpNum))
 Sets/clears directly STATUS_OUT bit in the endpoint register.
#define PCD_CLEAR_OUT_STATUS(USBx, bEpNum)   PCD_CLEAR_EP_KIND((USBx), (bEpNum))
#define PCD_SET_BULK_EP_DBUF(USBx, bEpNum)   PCD_SET_EP_KIND((USBx), (bEpNum))
 Sets/clears directly EP_KIND bit in the endpoint register.
#define PCD_CLEAR_BULK_EP_DBUF(USBx, bEpNum)   PCD_CLEAR_EP_KIND((USBx), (bEpNum))
#define PCD_CLEAR_RX_EP_CTR(USBx, bEpNum)
 Clears bit CTR_RX / CTR_TX in the endpoint register.
#define PCD_CLEAR_TX_EP_CTR(USBx, bEpNum)
#define PCD_RX_DTOG(USBx, bEpNum)
 Toggles DTOG_RX / DTOG_TX bit in the endpoint register.
#define PCD_TX_DTOG(USBx, bEpNum)
#define PCD_CLEAR_RX_DTOG(USBx, bEpNum)
 Clears DTOG_RX / DTOG_TX bit in the endpoint register.
#define PCD_CLEAR_TX_DTOG(USBx, bEpNum)
#define PCD_SET_EP_ADDRESS(USBx, bEpNum, bAddr)
 Sets address in an endpoint register.
#define PCD_GET_EP_ADDRESS(USBx, bEpNum)   ((uint8_t)(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPADDR_FIELD))
 Gets address in an endpoint register.
#define PCD_EP_TX_CNT(USBx, bEpNum)
#define PCD_EP_RX_CNT(USBx, bEpNum)
#define PCD_SET_EP_TX_ADDRESS(USBx, bEpNum, wAddr)
 sets address of the tx/rx buffer.
#define PCD_SET_EP_RX_ADDRESS(USBx, bEpNum, wAddr)
#define PCD_GET_EP_TX_ADDRESS(USBx, bEpNum)   ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum)))
 Gets address of the tx/rx buffer.
#define PCD_GET_EP_RX_ADDRESS(USBx, bEpNum)   ((uint16_t)*PCD_EP_RX_ADDRESS((USBx), (bEpNum)))
#define PCD_CALC_BLK32(pdwReg, wCount, wNBlocks)
 Sets counter of rx buffer with no.
#define PCD_CALC_BLK2(pdwReg, wCount, wNBlocks)
#define PCD_SET_EP_CNT_RX_REG(pdwReg, wCount)
#define PCD_SET_EP_RX_DBUF0_CNT(USBx, bEpNum, wCount)
#define PCD_SET_EP_TX_CNT(USBx, bEpNum, wCount)
 sets counter for the tx/rx buffer.
#define PCD_SET_EP_RX_CNT(USBx, bEpNum, wCount)
#define PCD_GET_EP_TX_CNT(USBx, bEpNum)   ((uint32_t)(*PCD_EP_TX_CNT((USBx), (bEpNum))) & 0x3ffU)
 gets counter of the tx buffer.
#define PCD_GET_EP_RX_CNT(USBx, bEpNum)   ((uint32_t)(*PCD_EP_RX_CNT((USBx), (bEpNum))) & 0x3ffU)
#define PCD_SET_EP_DBUF0_ADDR(USBx, bEpNum, wBuf0Addr)
 Sets buffer 0/1 address in a double buffer endpoint.
#define PCD_SET_EP_DBUF1_ADDR(USBx, bEpNum, wBuf1Addr)
#define PCD_SET_EP_DBUF_ADDR(USBx, bEpNum, wBuf0Addr, wBuf1Addr)
 Sets addresses in a double buffer endpoint.
#define PCD_GET_EP_DBUF0_ADDR(USBx, bEpNum)   (PCD_GET_EP_TX_ADDRESS((USBx), (bEpNum)))
 Gets buffer 0/1 address of a double buffer endpoint.
#define PCD_GET_EP_DBUF1_ADDR(USBx, bEpNum)   (PCD_GET_EP_RX_ADDRESS((USBx), (bEpNum)))
#define PCD_SET_EP_DBUF0_CNT(USBx, bEpNum, bDir, wCount)
 Gets buffer 0/1 address of a double buffer endpoint.
#define PCD_SET_EP_DBUF1_CNT(USBx, bEpNum, bDir, wCount)
#define PCD_SET_EP_DBUF_CNT(USBx, bEpNum, bDir, wCount)
#define PCD_GET_EP_DBUF0_CNT(USBx, bEpNum)   (PCD_GET_EP_TX_CNT((USBx), (bEpNum)))
 Gets buffer 0/1 rx/tx counter for double buffering.
#define PCD_GET_EP_DBUF1_CNT(USBx, bEpNum)   (PCD_GET_EP_RX_CNT((USBx), (bEpNum)))

Define Documentation

#define PCD_CALC_BLK2 (   pdwReg,
  wCount,
  wNBlocks 
)
Value:
do { \
    (wNBlocks) = (wCount) >> 1; \
    if (((wCount) & 0x1U) != 0U) \
    { \
      (wNBlocks)++; \
    } \
    *(pdwReg) = (uint16_t)((wNBlocks) << 10); \
  } while(0) /* PCD_CALC_BLK2 */

Definition at line 866 of file stm32l4xx_hal_pcd.h.

#define PCD_CALC_BLK32 (   pdwReg,
  wCount,
  wNBlocks 
)
Value:
do { \
    (wNBlocks) = (wCount) >> 5; \
    if (((wCount) & 0x1fU) == 0U) \
    { \
      (wNBlocks)--; \
    } \
    *(pdwReg) = (uint16_t)(((wNBlocks) << 10) | USB_CNTRX_BLSIZE); \
  } while(0) /* PCD_CALC_BLK32 */

Sets counter of rx buffer with no.

of blocks.

Parameters:
pdwRegRegister pointer
wCountCounter.
wNBlocksno. of Blocks.
Return values:
None

Definition at line 856 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_BULK_EP_DBUF (   USBx,
  bEpNum 
)    PCD_CLEAR_EP_KIND((USBx), (bEpNum))

Definition at line 703 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_EP_KIND (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPKIND_MASK; \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \
  } while(0) /* PCD_CLEAR_EP_KIND */

Definition at line 678 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_OUT_STATUS (   USBx,
  bEpNum 
)    PCD_CLEAR_EP_KIND((USBx), (bEpNum))

Definition at line 694 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_RX_DTOG (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)); \
    \
    if ((_wRegVal & USB_EP_DTOG_RX) != 0U)\
    { \
      PCD_RX_DTOG((USBx), (bEpNum)); \
    } \
  } while(0) /* PCD_CLEAR_RX_DTOG */

Clears DTOG_RX / DTOG_TX bit in the endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 758 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_RX_EP_CTR (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (0x7FFFU & USB_EPREG_MASK); \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_TX)); \
  } while(0) /* PCD_CLEAR_RX_EP_CTR */

Clears bit CTR_RX / CTR_TX in the endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 711 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_CLEAR_TX_DTOG (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)); \
    \
    if ((_wRegVal & USB_EP_DTOG_TX) != 0U)\
    { \
      PCD_TX_DTOG((USBx), (bEpNum)); \
    } \
  } while(0) /* PCD_CLEAR_TX_DTOG */

Definition at line 770 of file stm32l4xx_hal_pcd.h.

#define PCD_CLEAR_TX_EP_CTR (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (0xFF7FU & USB_EPREG_MASK); \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX)); \
  } while(0) /* PCD_CLEAR_TX_EP_CTR */

Definition at line 720 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_EP_RX_CNT (   USBx,
  bEpNum 
)
Value:
((uint16_t *)((((uint32_t)(USBx)->BTABLE\
                                                    + ((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U)))

Definition at line 809 of file stm32l4xx_hal_pcd.h.

#define PCD_EP_TX_CNT (   USBx,
  bEpNum 
)
Value:
((uint16_t *)((((uint32_t)(USBx)->BTABLE\
                                                    + ((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U)))

Definition at line 806 of file stm32l4xx_hal_pcd.h.

#define PCD_FREE_USER_BUFFER (   USBx,
  bEpNum,
  bDir 
)
Value:
do { \
    if ((bDir) == 0U) \
    { \
      /* OUT double buffered endpoint */ \
      PCD_TX_DTOG((USBx), (bEpNum)); \
    } \
    else if ((bDir) == 1U) \
    { \
      /* IN double buffered endpoint */ \
      PCD_RX_DTOG((USBx), (bEpNum)); \
    } \
  } while(0)

free buffer used from the application realizing it to the line toggles bit SW_BUF in the double buffered endpoint register

Parameters:
USBxUSB device.
bEpNum,bDir
Return values:
None

Definition at line 534 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Receive(), HAL_PCD_EP_DB_Transmit(), and PCD_EP_ISR_Handler().

#define PCD_GET_ENDPOINT (   USBx,
  bEpNum 
)    (*(__IO uint16_t *)(&(USBx)->EP0R + ((bEpNum) * 2U)))

Definition at line 503 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_GET_EP_ADDRESS (   USBx,
  bEpNum 
)    ((uint8_t)(PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPADDR_FIELD))

Gets address in an endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 804 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_DBUF0_ADDR (   USBx,
  bEpNum 
)    (PCD_GET_EP_TX_ADDRESS((USBx), (bEpNum)))

Gets buffer 0/1 address of a double buffer endpoint.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 981 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_DBUF0_CNT (   USBx,
  bEpNum 
)    (PCD_GET_EP_TX_CNT((USBx), (bEpNum)))

Gets buffer 0/1 rx/tx counter for double buffering.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 1044 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Receive(), HAL_PCD_EP_DB_Transmit(), and PCD_EP_ISR_Handler().

#define PCD_GET_EP_DBUF1_ADDR (   USBx,
  bEpNum 
)    (PCD_GET_EP_RX_ADDRESS((USBx), (bEpNum)))

Definition at line 982 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_DBUF1_CNT (   USBx,
  bEpNum 
)    (PCD_GET_EP_RX_CNT((USBx), (bEpNum)))
#define PCD_GET_EP_RX_ADDRESS (   USBx,
  bEpNum 
)    ((uint16_t)*PCD_EP_RX_ADDRESS((USBx), (bEpNum)))

Definition at line 847 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_RX_CNT (   USBx,
  bEpNum 
)    ((uint32_t)(*PCD_EP_RX_CNT((USBx), (bEpNum))) & 0x3ffU)

Definition at line 942 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_GET_EP_RX_STALL_STATUS (   USBx,
  bEpNum 
)    (PCD_GET_EP_RX_STATUS((USBx), (bEpNum)) == USB_EP_RX_STALL)

Definition at line 661 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_RX_STATUS (   USBx,
  bEpNum 
)    ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_STAT)

Definition at line 643 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_TX_ADDRESS (   USBx,
  bEpNum 
)    ((uint16_t)*PCD_EP_TX_ADDRESS((USBx), (bEpNum)))

Gets address of the tx/rx buffer.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
addressof the buffer.

Definition at line 846 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_TX_CNT (   USBx,
  bEpNum 
)    ((uint32_t)(*PCD_EP_TX_CNT((USBx), (bEpNum))) & 0x3ffU)

gets counter of the tx buffer.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
Countervalue

Definition at line 941 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_GET_EP_TX_STALL_STATUS (   USBx,
  bEpNum 
)    (PCD_GET_EP_TX_STATUS((USBx), (bEpNum)) == USB_EP_TX_STALL)

checks stall condition in an endpoint.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
TRUE= endpoint in stall condition.

Definition at line 660 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EP_TX_STATUS (   USBx,
  bEpNum 
)    ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_STAT)

gets the status for tx/rx transfer (bits STAT_TX[1:0] /STAT_RX[1:0])

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
status

Definition at line 642 of file stm32l4xx_hal_pcd.h.

#define PCD_GET_EPTYPE (   USBx,
  bEpNum 
)    (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EP_T_FIELD)

gets the type in the endpoint register(bits EP_TYPE[1:0])

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
EndpointType

Definition at line 525 of file stm32l4xx_hal_pcd.h.

#define PCD_MAX (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 80 of file stm32l4xx_hal_pcd.c.

#define PCD_MIN (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 79 of file stm32l4xx_hal_pcd.c.

#define PCD_RX_DTOG (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wEPVal; \
    \
    _wEPVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wEPVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_DTOG_RX)); \
  } while(0) /* PCD_RX_DTOG */

Toggles DTOG_RX / DTOG_TX bit in the endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 735 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_BULK_EP_DBUF (   USBx,
  bEpNum 
)    PCD_SET_EP_KIND((USBx), (bEpNum))

Sets/clears directly EP_KIND bit in the endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 702 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_ENDPOINT (   USBx,
  bEpNum,
  wRegValue 
)
Value:
(*(__IO uint16_t *)\
                                                    (&(USBx)->EP0R + ((bEpNum) * 2U)) = (uint16_t)(wRegValue))

Definition at line 499 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_ADDRESS (   USBx,
  bEpNum,
  bAddr 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = (PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK) | (bAddr); \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \
  } while(0) /* PCD_SET_EP_ADDRESS */

Sets address in an endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
bAddrAddress.
Return values:
None

Definition at line 789 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_CNT_RX_REG (   pdwReg,
  wCount 
)
Value:
do { \
    uint32_t wNBlocks; \
    \
    if ((wCount) > 62U) \
    { \
      PCD_CALC_BLK32((pdwReg), (wCount), wNBlocks); \
    } \
    else \
    { \
      if ((wCount) == 0U) \
      { \
        *(pdwReg) &= (uint16_t)~USB_CNTRX_NBLK_MSK; \
        *(pdwReg) |= USB_CNTRX_BLSIZE; \
      } \
      else \
      { \
        PCD_CALC_BLK2((pdwReg), (wCount), wNBlocks); \
      } \
    } \
  } while(0) /* PCD_SET_EP_CNT_RX_REG */

Definition at line 876 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_DBUF0_ADDR (   USBx,
  bEpNum,
  wBuf0Addr 
)
Value:
do { \
    PCD_SET_EP_TX_ADDRESS((USBx), (bEpNum), (wBuf0Addr)); \
  } while(0) /* PCD_SET_EP_DBUF0_ADDR */

Sets buffer 0/1 address in a double buffer endpoint.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wBuf0Addrbuffer 0 address.
Return values:
Countervalue

Definition at line 951 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_DBUF0_CNT (   USBx,
  bEpNum,
  bDir,
  wCount 
)
Value:
do { \
    if ((bDir) == 0U) \
      /* OUT endpoint */ \
    { \
      PCD_SET_EP_RX_DBUF0_CNT((USBx), (bEpNum), (wCount)); \
    } \
    else \
    { \
      if ((bDir) == 1U) \
      { \
        /* IN endpoint */ \
        PCD_SET_EP_TX_CNT((USBx), (bEpNum), (wCount)); \
      } \
    } \
  } while(0) /* SetEPDblBuf0Count*/

Gets buffer 0/1 address of a double buffer endpoint.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
bDirendpoint dir EP_DBUF_OUT = OUT EP_DBUF_IN = IN
wCount,:Counter value
Return values:
None

Definition at line 993 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Transmit(), and PCD_EP_ISR_Handler().

#define PCD_SET_EP_DBUF1_ADDR (   USBx,
  bEpNum,
  wBuf1Addr 
)
Value:
do { \
    PCD_SET_EP_RX_ADDRESS((USBx), (bEpNum), (wBuf1Addr)); \
  } while(0) /* PCD_SET_EP_DBUF1_ADDR */

Definition at line 956 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_DBUF1_CNT (   USBx,
  bEpNum,
  bDir,
  wCount 
)
Value:
do { \
    uint32_t _wBase = (uint32_t)(USBx); \
    __IO uint16_t *_wEPRegVal; \
    \
    if ((bDir) == 0U) \
    { \
      /* OUT endpoint */ \
      PCD_SET_EP_RX_CNT((USBx), (bEpNum), (wCount)); \
    } \
    else \
    { \
      if ((bDir) == 1U) \
      { \
        /* IN endpoint */ \
        _wBase += (uint32_t)(USBx)->BTABLE; \
        _wEPRegVal = (__IO uint16_t *)(_wBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS)); \
        *_wEPRegVal = (uint16_t)(wCount); \
      } \
    } \
  } while(0) /* SetEPDblBuf1Count */

Definition at line 1010 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Transmit(), and PCD_EP_ISR_Handler().

#define PCD_SET_EP_DBUF_ADDR (   USBx,
  bEpNum,
  wBuf0Addr,
  wBuf1Addr 
)
Value:
do { \
    PCD_SET_EP_DBUF0_ADDR((USBx), (bEpNum), (wBuf0Addr)); \
    PCD_SET_EP_DBUF1_ADDR((USBx), (bEpNum), (wBuf1Addr)); \
  } while(0) /* PCD_SET_EP_DBUF_ADDR */

Sets addresses in a double buffer endpoint.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wBuf0Addr,:buffer 0 address.
wBuf1Addr= buffer 1 address.
Return values:
None

Definition at line 969 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_DBUF_CNT (   USBx,
  bEpNum,
  bDir,
  wCount 
)
Value:
do { \
    PCD_SET_EP_DBUF0_CNT((USBx), (bEpNum), (bDir), (wCount)); \
    PCD_SET_EP_DBUF1_CNT((USBx), (bEpNum), (bDir), (wCount)); \
  } while(0) /* PCD_SET_EP_DBUF_CNT */

Definition at line 1032 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_KIND (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_KIND)); \
  } while(0) /* PCD_SET_EP_KIND */

set & clear EP_KIND bit.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 669 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_RX_ADDRESS (   USBx,
  bEpNum,
  wAddr 
)
Value:
do { \
    __IO uint16_t *_wRegVal; \
    uint32_t _wRegBase = (uint32_t)USBx; \
    \
    _wRegBase += (uint32_t)(USBx)->BTABLE; \
    _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 4U) * PMA_ACCESS)); \
    *_wRegVal = ((wAddr) >> 1) << 1; \
  } while(0) /* PCD_SET_EP_RX_ADDRESS */

Definition at line 830 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_RX_CNT (   USBx,
  bEpNum,
  wCount 
)
Value:
do { \
    uint32_t _wRegBase = (uint32_t)(USBx); \
    __IO uint16_t *_wRegVal; \
    \
    _wRegBase += (uint32_t)(USBx)->BTABLE; \
    _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS)); \
    PCD_SET_EP_CNT_RX_REG(_wRegVal, (wCount)); \
  } while(0)

Definition at line 925 of file stm32l4xx_hal_pcd.h.

Referenced by PCD_EP_ISR_Handler().

#define PCD_SET_EP_RX_DBUF0_CNT (   USBx,
  bEpNum,
  wCount 
)
Value:
do { \
    uint32_t _wRegBase = (uint32_t)(USBx); \
    __IO uint16_t *pdwReg; \
    \
    _wRegBase += (uint32_t)(USBx)->BTABLE; \
    pdwReg = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS)); \
    PCD_SET_EP_CNT_RX_REG(pdwReg, (wCount)); \
  } while(0)

Definition at line 898 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_RX_STATUS (   USBx,
  bEpNum,
  wState 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_DTOGMASK; \
    /* toggle first bit ? */ \
    if ((USB_EPRX_DTOG1 & (wState))!= 0U) \
    { \
      _wRegVal ^= USB_EPRX_DTOG1; \
    } \
    /* toggle second bit ? */ \
    if ((USB_EPRX_DTOG2 & (wState))!= 0U) \
    { \
      _wRegVal ^= USB_EPRX_DTOG2; \
    } \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \
  } while(0) /* PCD_SET_EP_RX_STATUS */

sets the status for rx transfer (bits STAT_TX[1:0])

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wStatenew state
Return values:
None

Definition at line 580 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Receive(), and PCD_EP_ISR_Handler().

#define PCD_SET_EP_RX_VALID (   USBx,
  bEpNum 
)    (PCD_SET_EP_RX_STATUS((USBx), (bEpNum), USB_EP_RX_VALID))

Definition at line 652 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_TX_ADDRESS (   USBx,
  bEpNum,
  wAddr 
)
Value:
do { \
    __IO uint16_t *_wRegVal; \
    uint32_t _wRegBase = (uint32_t)USBx; \
    \
    _wRegBase += (uint32_t)(USBx)->BTABLE; \
    _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + (((uint32_t)(bEpNum) * 8U) * PMA_ACCESS)); \
    *_wRegVal = ((wAddr) >> 1) << 1; \
  } while(0) /* PCD_SET_EP_TX_ADDRESS */

sets address of the tx/rx buffer.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wAddraddress to be set (must be word aligned).
Return values:
None

Definition at line 820 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_TX_CNT (   USBx,
  bEpNum,
  wCount 
)
Value:
do { \
    uint32_t _wRegBase = (uint32_t)(USBx); \
    __IO uint16_t *_wRegVal; \
    \
    _wRegBase += (uint32_t)(USBx)->BTABLE; \
    _wRegVal = (__IO uint16_t *)(_wRegBase + 0x400U + ((((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS)); \
    *_wRegVal = (uint16_t)(wCount); \
  } while(0)

sets counter for the tx/rx buffer.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wCountCounter value.
Return values:
None

Definition at line 915 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_TX_STATUS (   USBx,
  bEpNum,
  wState 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPTX_DTOGMASK; \
    /* toggle first bit ? */ \
    if ((USB_EPTX_DTOG1 & (wState))!= 0U) \
    { \
      _wRegVal ^= USB_EPTX_DTOG1; \
    } \
    /* toggle second bit ?  */ \
    if ((USB_EPTX_DTOG2 & (wState))!= 0U) \
    { \
      _wRegVal ^= USB_EPTX_DTOG2; \
    } \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \
  } while(0) /* PCD_SET_EP_TX_STATUS */

sets the status for tx transfer (bits STAT_TX[1:0]).

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wStatenew state
Return values:
None

Definition at line 555 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_DB_Transmit().

#define PCD_SET_EP_TX_VALID (   USBx,
  bEpNum 
)    (PCD_SET_EP_TX_STATUS((USBx), (bEpNum), USB_EP_TX_VALID))

sets directly the VALID tx/rx-status into the endpoint register

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 651 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EP_TXRX_STATUS (   USBx,
  bEpNum,
  wStaterx,
  wStatetx 
)
Value:
do { \
    uint16_t _wRegVal; \
    \
    _wRegVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & (USB_EPRX_DTOGMASK | USB_EPTX_STAT); \
    /* toggle first bit ? */ \
    if ((USB_EPRX_DTOG1 & (wStaterx))!= 0U) \
    { \
      _wRegVal ^= USB_EPRX_DTOG1; \
    } \
    /* toggle second bit ? */ \
    if ((USB_EPRX_DTOG2 & (wStaterx))!= 0U) \
    { \
      _wRegVal ^= USB_EPRX_DTOG2; \
    } \
    /* toggle first bit ? */ \
    if ((USB_EPTX_DTOG1 & (wStatetx))!= 0U) \
    { \
      _wRegVal ^= USB_EPTX_DTOG1; \
    } \
    /* toggle second bit ?  */ \
    if ((USB_EPTX_DTOG2 & (wStatetx))!= 0U) \
    { \
      _wRegVal ^= USB_EPTX_DTOG2; \
    } \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wRegVal | USB_EP_CTR_RX | USB_EP_CTR_TX)); \
  } while(0) /* PCD_SET_EP_TXRX_STATUS */

sets the status for rx & tx (bits STAT_TX[1:0] & STAT_RX[1:0])

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wStaterxnew state.
wStatetxnew state.
Return values:
None

Definition at line 606 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_EPTYPE (   USBx,
  bEpNum,
  wType 
)
Value:
(PCD_SET_ENDPOINT((USBx), (bEpNum), ((PCD_GET_ENDPOINT((USBx), (bEpNum))\
                                                              & USB_EP_T_MASK) | (wType) | USB_EP_CTR_TX | USB_EP_CTR_RX)))

sets the type in the endpoint register(bits EP_TYPE[1:0])

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
wTypeEndpoint Type.
Return values:
None

Definition at line 515 of file stm32l4xx_hal_pcd.h.

#define PCD_SET_OUT_STATUS (   USBx,
  bEpNum 
)    PCD_SET_EP_KIND((USBx), (bEpNum))

Sets/clears directly STATUS_OUT bit in the endpoint register.

Parameters:
USBxUSB peripheral instance register address.
bEpNumEndpoint Number.
Return values:
None

Definition at line 693 of file stm32l4xx_hal_pcd.h.

#define PCD_TX_DTOG (   USBx,
  bEpNum 
)
Value:
do { \
    uint16_t _wEPVal; \
    \
    _wEPVal = PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPREG_MASK; \
    \
    PCD_SET_ENDPOINT((USBx), (bEpNum), (_wEPVal | USB_EP_CTR_RX | USB_EP_CTR_TX | USB_EP_DTOG_TX)); \
  } while(0) /* PCD_TX_DTOG */

Definition at line 744 of file stm32l4xx_hal_pcd.h.

#define USB_CNTRX_BLSIZE   (0x1U << 15)

Definition at line 496 of file stm32l4xx_hal_pcd.h.

#define USB_CNTRX_NBLK_MSK   (0x1FU << 10)

Definition at line 495 of file stm32l4xx_hal_pcd.h.

#define USB_EP0StartXfer   USB_EPStartXfer

Definition at line 506 of file stm32l4xx_hal_pcd.h.

Referenced by HAL_PCD_EP_Receive(), and HAL_PCD_EP_Transmit().