/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_ResetEP(uint32_t EPNum)
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None  */
void USBD_ResetEP(uint32_t EPNum)
{
    if (EPNum & 0x80) {
        EPNum &= 0x0F;
        protected_or(&Data1, (1 << ((EPNum * 2) + 1)));
        BD[IDX(EPNum, TX, ODD)].buf_addr = (uint32_t) & (EPBuf[IDX(EPNum, TX, ODD)][0]);
        BD[IDX(EPNum, TX, EVEN)].buf_addr = 0;
    } else {
        protected_and(&Data1, ~(1 << (EPNum * 2)));
        BD[IDX(EPNum, RX, ODD)].bc       = OutEpSize[EPNum];
        BD[IDX(EPNum, RX, ODD)].buf_addr = (uint32_t) & (EPBuf[IDX(EPNum, RX, ODD)][0]);
        BD[IDX(EPNum, RX, ODD)].stat     = BD_OWN_MASK | BD_DTS_MASK;
        BD[IDX(EPNum, RX, EVEN)].stat     = 0;
    }
}