Release v2.11.2

This commit is contained in:
slimih
2023-06-14 09:59:01 +01:00
parent bd79085c18
commit 7b5e6886d2
17 changed files with 627 additions and 274 deletions

View File

@@ -377,7 +377,8 @@ typedef struct
{
uint32_t interface;
uint32_t uvc_state;
uint8_t buffer[UVC_TOTAL_BUF_SIZE];
uint32_t uvc_size;
uint8_t *uvc_buffer;
VIDEO_OffsetTypeDef offset;
USBD_VIDEO_ControlTypeDef control;
} USBD_VIDEO_HandleTypeDef;

View File

@@ -498,6 +498,11 @@ static uint8_t USBD_VIDEO_Setup(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *
uint16_t len;
uint8_t *pbuf;
#ifdef USE_USBD_COMPOSITE
/* Get the Endpoints addresses allocated for this class instance */
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
#endif /* USE_USBD_COMPOSITE */
switch (req->bmRequest & USB_REQ_TYPE_MASK)
{
/* Class Requests -------------------------------*/
@@ -643,6 +648,11 @@ static uint8_t USBD_VIDEO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
uint32_t RemainData = 0U;
uint32_t DataOffset = 0U;
#ifdef USE_USBD_COMPOSITE
/* Get the Endpoints addresses allocated for this class instance */
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
#endif /* USE_USBD_COMPOSITE */
/* Check if the Streaming has already been started */
if (hVIDEO->uvc_state == UVC_PLAY_STATUS_STREAMING)
{
@@ -692,9 +702,12 @@ static uint8_t USBD_VIDEO_DataIn(USBD_HandleTypeDef *pdev, uint8_t epnum)
packet[1] = payload_header[1];
}
hVIDEO->uvc_buffer = (uint8_t *)&packet;
hVIDEO->uvc_size = (uint32_t)PcktSze;
/* Transmit the packet on Endpoint */
(void)USBD_LL_Transmit(pdev, (uint8_t)(epnum | 0x80U),
(uint8_t *)&packet, (uint32_t)PcktSze);
hVIDEO->uvc_buffer, hVIDEO->uvc_size);
}
/* Exit with no error code */
@@ -712,11 +725,19 @@ static uint8_t USBD_VIDEO_SOF(USBD_HandleTypeDef *pdev)
USBD_VIDEO_HandleTypeDef *hVIDEO = (USBD_VIDEO_HandleTypeDef *) pdev->pClassDataCmsit[pdev->classId];
uint8_t payload[2] = {0x02U, 0x00U};
#ifdef USE_USBD_COMPOSITE
/* Get the Endpoints addresses allocated for this class instance */
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
#endif /* USE_USBD_COMPOSITE */
/* Check if the Streaming has already been started by SetInterface AltSetting 1 */
if (hVIDEO->uvc_state == UVC_PLAY_STATUS_READY)
{
hVIDEO->uvc_buffer = (uint8_t *)&payload;
hVIDEO->uvc_size = 2U;
/* Transmit the first packet indicating that Streaming is starting */
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, (uint8_t *)payload, 2U);
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, hVIDEO->uvc_buffer, hVIDEO->uvc_size);
/* Enable Streaming state */
hVIDEO->uvc_state = UVC_PLAY_STATUS_STREAMING;
@@ -735,8 +756,17 @@ static uint8_t USBD_VIDEO_SOF(USBD_HandleTypeDef *pdev)
*/
static uint8_t USBD_VIDEO_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
{
UNUSED(pdev);
UNUSED(epnum);
USBD_VIDEO_HandleTypeDef *hVIDEO = (USBD_VIDEO_HandleTypeDef *) pdev->pClassDataCmsit[pdev->classId];
#ifdef USE_USBD_COMPOSITE
/* Get the Endpoints addresses allocated for this class instance */
VIDEOinEpAdd = USBD_CoreGetEPAdd(pdev, USBD_EP_IN, USBD_EP_TYPE_ISOC, (uint8_t)pdev->classId);
#endif /* USE_USBD_COMPOSITE */
if (epnum == (VIDEOinEpAdd & 0xFU))
{
(void)USBD_LL_Transmit(pdev, VIDEOinEpAdd, hVIDEO->uvc_buffer, hVIDEO->uvc_size);
}
return (uint8_t)USBD_OK;
}