STM32F103xB HAL User Manual
|
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_FreeUserBuffer(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_EP_DBUF(USBx, bEpNum) PCD_SET_EP_KIND((USBx), (bEpNum)) |
Sets/clears directly EP_KIND bit in the endpoint register. | |
#define | PCD_CLEAR_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 PCD_CALC_BLK2 | ( | pdwReg, | |
wCount, | |||
wNBlocks | |||
) |
do { \ (wNBlocks) = (wCount) >> 1; \ if (((wCount) & 0x1U) != 0U) \ { \ (wNBlocks)++; \ } \ *(pdwReg) = (uint16_t)((wNBlocks) << 10); \ } while(0) /* PCD_CALC_BLK2 */
Definition at line 867 of file stm32f1xx_hal_pcd.h.
#define PCD_CALC_BLK32 | ( | pdwReg, | |
wCount, | |||
wNBlocks | |||
) |
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.
pdwReg | Register pointer |
wCount | Counter. |
wNBlocks | no. of Blocks. |
None |
Definition at line 857 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_EP_DBUF | ( | USBx, | |
bEpNum | |||
) | PCD_CLEAR_EP_KIND((USBx), (bEpNum)) |
Definition at line 704 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_EP_KIND | ( | USBx, | |
bEpNum | |||
) |
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 679 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_OUT_STATUS | ( | USBx, | |
bEpNum | |||
) | PCD_CLEAR_EP_KIND((USBx), (bEpNum)) |
Definition at line 695 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_RX_DTOG | ( | USBx, | |
bEpNum | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 759 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_RX_EP_CTR | ( | USBx, | |
bEpNum | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 712 of file stm32f1xx_hal_pcd.h.
Referenced by PCD_EP_ISR_Handler().
#define PCD_CLEAR_TX_DTOG | ( | USBx, | |
bEpNum | |||
) |
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 771 of file stm32f1xx_hal_pcd.h.
#define PCD_CLEAR_TX_EP_CTR | ( | USBx, | |
bEpNum | |||
) |
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 721 of file stm32f1xx_hal_pcd.h.
Referenced by PCD_EP_ISR_Handler().
#define PCD_EP_RX_CNT | ( | USBx, | |
bEpNum | |||
) |
((uint16_t *)((((uint32_t)(USBx)->BTABLE\ + ((uint32_t)(bEpNum) * 8U) + 6U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U)))
Definition at line 810 of file stm32f1xx_hal_pcd.h.
#define PCD_EP_TX_CNT | ( | USBx, | |
bEpNum | |||
) |
((uint16_t *)((((uint32_t)(USBx)->BTABLE\ + ((uint32_t)(bEpNum) * 8U) + 2U) * PMA_ACCESS) + ((uint32_t)(USBx) + 0x400U)))
Definition at line 807 of file stm32f1xx_hal_pcd.h.
#define PCD_FreeUserBuffer | ( | USBx, | |
bEpNum, | |||
bDir | |||
) |
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
USBx | USB device. |
bEpNum,bDir |
None |
Definition at line 535 of file stm32f1xx_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 504 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_IRQHandler(), and 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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 805 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 978 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 1041 of file stm32f1xx_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 979 of file stm32f1xx_hal_pcd.h.
#define PCD_GET_EP_DBUF1_CNT | ( | USBx, | |
bEpNum | |||
) | (PCD_GET_EP_RX_CNT((USBx), (bEpNum))) |
Definition at line 1042 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_EP_DB_Receive(), HAL_PCD_EP_DB_Transmit(), and PCD_EP_ISR_Handler().
#define PCD_GET_EP_RX_ADDRESS | ( | USBx, | |
bEpNum | |||
) | ((uint16_t)*PCD_EP_RX_ADDRESS((USBx), (bEpNum))) |
Definition at line 848 of file stm32f1xx_hal_pcd.h.
#define PCD_GET_EP_RX_CNT | ( | USBx, | |
bEpNum | |||
) | ((uint32_t)(*PCD_EP_RX_CNT((USBx), (bEpNum))) & 0x3ffU) |
Definition at line 939 of file stm32f1xx_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 662 of file stm32f1xx_hal_pcd.h.
#define PCD_GET_EP_RX_STATUS | ( | USBx, | |
bEpNum | |||
) | ((uint16_t)PCD_GET_ENDPOINT((USBx), (bEpNum)) & USB_EPRX_STAT) |
Definition at line 644 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
address | of the buffer. |
Definition at line 847 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
Counter | value |
Definition at line 938 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
TRUE | = endpoint in stall condition. |
Definition at line 661 of file stm32f1xx_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])
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
status |
Definition at line 643 of file stm32f1xx_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])
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
Endpoint | Type |
Definition at line 526 of file stm32f1xx_hal_pcd.h.
#define PCD_MAX | ( | a, | |
b | |||
) | (((a) > (b)) ? (a) : (b)) |
Definition at line 80 of file stm32f1xx_hal_pcd.c.
#define PCD_MIN | ( | a, | |
b | |||
) | (((a) < (b)) ? (a) : (b)) |
Definition at line 79 of file stm32f1xx_hal_pcd.c.
#define PCD_RX_DTOG | ( | USBx, | |
bEpNum | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 736 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_ENDPOINT | ( | USBx, | |
bEpNum, | |||
wRegValue | |||
) |
(*(__IO uint16_t *)\ (&(USBx)->EP0R + ((bEpNum) * 2U)) = (uint16_t)(wRegValue))
Definition at line 500 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_IRQHandler().
#define PCD_SET_EP_ADDRESS | ( | USBx, | |
bEpNum, | |||
bAddr | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
bAddr | Address. |
None |
Definition at line 790 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_CNT_RX_REG | ( | pdwReg, | |
wCount | |||
) |
do { \ uint32_t wNBlocks; \ if ((wCount) == 0U) \ { \ *(pdwReg) &= (uint16_t)~USB_CNTRX_NBLK_MSK; \ *(pdwReg) |= USB_CNTRX_BLSIZE; \ } \ else if((wCount) <= 62U) \ { \ PCD_CALC_BLK2((pdwReg), (wCount), wNBlocks); \ } \ else \ { \ PCD_CALC_BLK32((pdwReg), (wCount), wNBlocks); \ } \ } while(0) /* PCD_SET_EP_CNT_RX_REG */
Definition at line 877 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_DBUF | ( | USBx, | |
bEpNum | |||
) | PCD_SET_EP_KIND((USBx), (bEpNum)) |
Sets/clears directly EP_KIND bit in the endpoint register.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 703 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_DBUF0_ADDR | ( | USBx, | |
bEpNum, | |||
wBuf0Addr | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wBuf0Addr | buffer 0 address. |
Counter | value |
Definition at line 948 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_DBUF0_CNT | ( | USBx, | |
bEpNum, | |||
bDir, | |||
wCount | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
bDir | endpoint dir EP_DBUF_OUT = OUT EP_DBUF_IN = IN |
wCount,: | Counter value |
None |
Definition at line 990 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_EP_DB_Transmit().
#define PCD_SET_EP_DBUF1_ADDR | ( | USBx, | |
bEpNum, | |||
wBuf1Addr | |||
) |
do { \ PCD_SET_EP_RX_ADDRESS((USBx), (bEpNum), (wBuf1Addr)); \ } while(0) /* PCD_SET_EP_DBUF1_ADDR */
Definition at line 953 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_DBUF1_CNT | ( | USBx, | |
bEpNum, | |||
bDir, | |||
wCount | |||
) |
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 1007 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_EP_DB_Transmit().
#define PCD_SET_EP_DBUF_ADDR | ( | USBx, | |
bEpNum, | |||
wBuf0Addr, | |||
wBuf1Addr | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wBuf0Addr,: | buffer 0 address. |
wBuf1Addr | = buffer 1 address. |
None |
Definition at line 966 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_DBUF_CNT | ( | USBx, | |
bEpNum, | |||
bDir, | |||
wCount | |||
) |
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 1029 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_KIND | ( | USBx, | |
bEpNum | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 670 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_RX_ADDRESS | ( | USBx, | |
bEpNum, | |||
wAddr | |||
) |
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 831 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_RX_CNT | ( | USBx, | |
bEpNum, | |||
wCount | |||
) |
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 922 of file stm32f1xx_hal_pcd.h.
Referenced by PCD_EP_ISR_Handler().
#define PCD_SET_EP_RX_DBUF0_CNT | ( | USBx, | |
bEpNum, | |||
wCount | |||
) |
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 895 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_RX_STATUS | ( | USBx, | |
bEpNum, | |||
wState | |||
) |
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])
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wState | new state |
None |
Definition at line 581 of file stm32f1xx_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 653 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_TX_ADDRESS | ( | USBx, | |
bEpNum, | |||
wAddr | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wAddr | address to be set (must be word aligned). |
None |
Definition at line 821 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_TX_CNT | ( | USBx, | |
bEpNum, | |||
wCount | |||
) |
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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wCount | Counter value. |
None |
Definition at line 912 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_TX_STATUS | ( | USBx, | |
bEpNum, | |||
wState | |||
) |
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]).
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wState | new state |
None |
Definition at line 556 of file stm32f1xx_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
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 652 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EP_TXRX_STATUS | ( | USBx, | |
bEpNum, | |||
wStaterx, | |||
wStatetx | |||
) |
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])
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wStaterx | new state. |
wStatetx | new state. |
None |
Definition at line 607 of file stm32f1xx_hal_pcd.h.
#define PCD_SET_EPTYPE | ( | USBx, | |
bEpNum, | |||
wType | |||
) |
(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])
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
wType | Endpoint Type. |
None |
Definition at line 516 of file stm32f1xx_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.
USBx | USB peripheral instance register address. |
bEpNum | Endpoint Number. |
None |
Definition at line 694 of file stm32f1xx_hal_pcd.h.
#define PCD_TX_DTOG | ( | USBx, | |
bEpNum | |||
) |
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 745 of file stm32f1xx_hal_pcd.h.
#define USB_CNTRX_BLSIZE (0x1U << 15) |
Definition at line 497 of file stm32f1xx_hal_pcd.h.
#define USB_CNTRX_NBLK_MSK (0x1FU << 10) |
Definition at line 496 of file stm32f1xx_hal_pcd.h.
#define USB_EP0StartXfer USB_EPStartXfer |
Definition at line 507 of file stm32f1xx_hal_pcd.h.
Referenced by HAL_PCD_EP_Receive(), and HAL_PCD_EP_Transmit().