/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_ClrStallEP(uint32_t EPNum)
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_ClrStallEP(uint32_t EPNum)
{
    if (EPNum & 0x80) {
        EPNum &= 0x7F;
        ENDPTCTRL(EPNum) &= ~(1UL << 16);
        ENDPTCTRL(EPNum) |= (1UL << 22);
        while (ENDPTCTRL(EPNum) & (1UL << 16));
        USBD_ResetEP(EPNum | 0x80);
    } else {
        ENDPTCTRL(EPNum) &= ~(1UL << 0);
        ENDPTCTRL(EPNum) |= (1UL << 6);
    }
}