This function handles PCD Endpoint interrupt request.
2251 while ((hpcd->Instance->ISTR & USB_ISTR_CTR) != 0U)
2253 wIstr = hpcd->Instance->ISTR;
2255 epindex = (uint8_t)(wIstr & USB_ISTR_EP_ID);
2262 if ((wIstr & USB_ISTR_DIR) == 0U)
2268 PCD_CLEAR_TX_EP_CTR(hpcd->Instance, PCD_ENDP0);
2269 ep = &hpcd->IN_ep[0];
2271 ep->
xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->
num);
2275 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 2276 hpcd->DataInStageCallback(hpcd, 0U);
2281 if ((hpcd->USB_Address > 0U) && (ep->
xfer_len == 0U))
2283 hpcd->Instance->DADDR = ((uint16_t)hpcd->USB_Address | USB_DADDR_EF);
2284 hpcd->USB_Address = 0U;
2293 ep = &hpcd->OUT_ep[0];
2294 wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, PCD_ENDP0);
2296 if ((wEPVal & USB_EP_SETUP) != 0U)
2299 ep->
xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->
num);
2301 USB_ReadPMA(hpcd->Instance, (uint8_t *)hpcd->Setup,
2305 PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0);
2308 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 2309 hpcd->SetupStageCallback(hpcd);
2315 else if ((wEPVal & USB_EP_CTR_RX) != 0U)
2317 PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0);
2320 ep->
xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->
num);
2330 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 2331 hpcd->DataOutStageCallback(hpcd, 0U);
2337 PCD_SET_EP_RX_CNT(hpcd->Instance, PCD_ENDP0, ep->
maxpacket);
2338 PCD_SET_EP_RX_STATUS(hpcd->Instance, PCD_ENDP0, USB_EP_RX_VALID);
2347 wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, epindex);
2348 if ((wEPVal & USB_EP_CTR_RX) != 0U)
2351 PCD_CLEAR_RX_EP_CTR(hpcd->Instance, epindex);
2352 ep = &hpcd->OUT_ep[epindex];
2355 if (ep->doublebuffer == 0U)
2357 count = (uint16_t)PCD_GET_EP_RX_CNT(hpcd->Instance, ep->
num);
2365 if ((PCD_GET_ENDPOINT(hpcd->Instance, ep->
num) & USB_EP_DTOG_RX) != 0U)
2368 count = (uint16_t)PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->
num);
2377 count = (uint16_t)PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->
num);
2384 PCD_FreeUserBuffer(hpcd->Instance, ep->
num, 0U);
2390 if ((ep->
xfer_len == 0U) || (count < ep->maxpacket))
2393 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 2394 hpcd->DataOutStageCallback(hpcd, ep->
num);
2406 if ((wEPVal & USB_EP_CTR_TX) != 0U)
2408 ep = &hpcd->IN_ep[epindex];
2411 PCD_CLEAR_TX_EP_CTR(hpcd->Instance, epindex);
2414 ep->
xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->
num);
2421 #if (USE_HAL_PCD_REGISTER_CALLBACKS == 1U) 2422 hpcd->DataInStageCallback(hpcd, ep->
num);
void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
Data OUT stage callback.
void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
Data IN stage callback.
HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
Send an amount of data.
void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
Setup stage callback.
void USB_ReadPMA(USB_TypeDef *USBx, uint8_t *pbUsrBuf, uint16_t wPMABufAddr, uint16_t wNBytes)
Copy a buffer from user memory area to packet memory area (PMA)
HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
Receive an amount of data.