void usbevt_suspend () {
/// Call sys_halt() first and mpipe_close() & (mpipe.state = MPIPE_Null) last, 
/// because this guarantees that whatever happens in sys_halt() does not change 
/// the fact that we are certain MPipe must be suspended.  sys_halt() is not a 
/// sure-thing: some devices might have batteries, and the non-MPipe part of 
/// the application might not want or need to halt.
#   if (MPIPE_USB_REMWAKE)
    if (mpipe.state >= MPIPE_Idle) {
        mpipe_close();
        mpipe.state = MPIPE_Null;
        sys_halt(HALT_lowpower);        //should set platform_ext.usb_wakeup ... or not
    }
#   else
    mpipe_close();
    mpipe.state = MPIPE_Null;
#   endif
}
Beispiel #2
0
void mpipe_disconnect(void* port_id) {
    mpipe_close();
    mpipedrv_detach(port_id);
}