/** * Sets the current device configuration */ void usb_svc_configendpoint(HANDLE hnd, const USBGenericDescriptor* ds) { // note: Stall will be performed for the last endpoint used by this handle!! hnd->dst.as_voidptr = (void*)usb_svc_configendpoints_hook; hnd->src.as_cvoidptr = ds; hnd->hcontrol(DCR_HANDLE); }
/** * Sets the current device configuration */ void usb_svc_setconfiguration(HANDLE hnd, unsigned int cfg) { // note: Stall will be performed for the last endpoint used by this handle!! hnd->dst.as_voidptr = (void*)usb_svc_setconfiguration_hook; hnd->src.as_int = cfg; hnd->hcontrol(DCR_HANDLE); }
/** * Sets the current device configuration */ void usb_svc_unhalt(HANDLE hnd, unsigned int eptnum) { // note: Stall will be performed for the last endpoint used by this handle!! hnd->dst.as_voidptr = (void*)usb_svc_unhalt_hook; hnd->src.as_int = eptnum; hnd->hcontrol(DCR_HANDLE); }
/** * Sets the current device configuration */ void usb_svc_setaddress(HANDLE hnd, unsigned int adr) { /* Sends a zero-length packet and then set the device address */ if(hnd->tsk_write(NULL, 0, USB_SETUP_WRITE_TOUT)==RES_OK) { // note: Stall will be performed for the last endpoint used by this handle!! hnd->dst.as_voidptr = (void*)usb_svc_setaddress_hook; hnd->src.as_int = adr; hnd->hcontrol(DCR_HANDLE); } }
static bool ConfigureDacDma(HANDLE dma_hnd, const DMA_DRIVER_MODE* dma_mode) { if(dma_mode->dma_index < INALID_DRV_INDX) { if(dma_hnd->res < RES_CLOSED) { dma_hnd->hcontrol(DCR_CANCEL); dma_hnd->close(); } return dma_hnd->drv_open(dma_mode->dma_index, dma_mode); } return true; }
/** * Causes the given endpoint to acknowledge the next packet it receives * with a STALL handshake */ void usb_svc_stall(HANDLE hnd) { // note: Stall will be performed for the last endpoint used by this handle!! hnd->dst.as_voidptr = (void*)usb_svc_stall_hook; hnd->hcontrol(DCR_HANDLE); }