/* Set Endpoint Status Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir stat: New Status Return Value: None  */
void EP_Status(U32 EPNum, U32 stat)
/* Set Endpoint Status Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir stat: New Status Return Value: None  */
void EP_Status(U32 EPNum, U32 stat)
{
    U32 num, val;
    num = EPNum & 0x0F;
    val = EPxREG(num);
    if (EPNum & 0x80) {
        EPxREG(num) = EP_VAL_UNCHANGED(val) | ((val ^ stat) & EP_STAT_TX);
    } else {
        EPxREG(num) = EP_VAL_UNCHANGED(val) | ((val ^ stat) & EP_STAT_RX);
    }
}