USB: same class cannot be used on multiple USB ports

This commit is contained in:
Daniel Fekete 2017-05-29 17:55:50 +02:00
parent 31d839ec09
commit 3f348268f4
2 changed files with 4 additions and 6 deletions

View File

@ -523,8 +523,7 @@ static uint8_t USBD_CDC_Init (USBD_HandleTypeDef *pdev,
pdev->pClassData = &staticMemory;
staticMemoryUsed = 1;
} else {
// On the rare ocasion when you want to use CDC on both FS and HS USB
pdev->pClassData = malloc(sizeof(USBD_CDC_HandleTypeDef));
Error_Handler(); // No memory
}
if(pdev->pClassData == NULL)
@ -595,7 +594,7 @@ static uint8_t USBD_CDC_DeInit (USBD_HandleTypeDef *pdev,
((USBD_CDC_ItfTypeDef *)pdev->pUserData)->DeInit();
if (pdev->pClassData != &staticMemory) {
free(pdev->pClassData);
Error_Handler(); // No memory
} else {
staticMemoryUsed = 0;
}

View File

@ -337,8 +337,7 @@ uint8_t USBD_MSC_Init (USBD_HandleTypeDef *pdev,
pdev->pClassData = &staticMemory;
staticMemoryUsed = 1;
} else {
// On the rare ocasion when you want to use CDC on both FS and HS USB
pdev->pClassData = malloc(sizeof(USBD_MSC_BOT_HandleTypeDef));
Error_Handler(); // No memory
}
if(pdev->pClassData == NULL)
@ -381,7 +380,7 @@ uint8_t USBD_MSC_DeInit (USBD_HandleTypeDef *pdev,
if(pdev->pClassData != NULL)
{
if (pdev->pClassData != &staticMemory) {
free(pdev->pClassData);
Error_Handler(); // No memory
} else {
staticMemoryUsed = 0;
}