usb: device_next: Fix Mass Storage on STM32
Mass Storage enumeration failed because udc_stm32_ep_mem_config() was only increasing priv->occupied_mem on endpoint enable, and not decreasing it on endpoint disable. Fix the issue by decreasing priv->occupied_mem on endpoint disable. Signed-off-by: Arne Bohnsack <arne.bohnsack@draeger.com>
This commit is contained in:
parent
06a84bf8e5
commit
38edec68d4
1 changed files with 6 additions and 3 deletions
|
@ -465,14 +465,17 @@ static int udc_stm32_ep_mem_config(const struct device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
words = MIN(ep->mps, cfg->ep_mps) / 4;
|
||||
words = (words <= 64) ? words * 2 : words;
|
||||
|
||||
if (!enable) {
|
||||
if (priv->occupied_mem >= (words * 4)) {
|
||||
priv->occupied_mem -= (words * 4);
|
||||
}
|
||||
HAL_PCDEx_SetTxFiFo(&priv->pcd, USB_EP_GET_IDX(ep->addr), 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
words = MIN(ep->mps, cfg->ep_mps) / 4;
|
||||
words = (words <= 64) ? words * 2 : words;
|
||||
|
||||
if (cfg->dram_size - priv->occupied_mem < words * 4) {
|
||||
LOG_ERR("Unable to allocate FIFO for 0x%02x", ep->addr);
|
||||
return -ENOMEM;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue