/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_EnableEP(uint32_t EPNum)
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_EnableEP(uint32_t EPNum)
{
    uint32_t *ptr;;
    ptr = GetEpCmdStatPtr(EPNum);
    if (EPNum & USB_IN_MASK) {
        EPNum &= ~USB_IN_MASK;
        *ptr &= ~EP_DISABLED;
        USBHSD->INTSTAT = (1 << EP_IN_IDX(EPNum));
        USBHSD->INTEN  |= (1 << EP_IN_IDX(EPNum));
    }
    else {
        *ptr &= ~EP_DISABLED;
        *ptr |=  EP_BUF_ACTIVE;
        USBHSD->INTSTAT = (1 << EP_OUT_IDX(EPNum));
        USBHSD->INTEN  |= (1 << EP_OUT_IDX(EPNum));
    }
}