Changes in uspace/lib/usbhost/src/usb_transfer_batch.c [8d2e251:9d58539] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbhost/src/usb_transfer_batch.c
r8d2e251 r9d58539 32 32 * USB transfer transaction structures (implementation). 33 33 */ 34 #include <errno.h> 35 #include <macros.h> 36 37 #include <usb/usb.h> 38 #include <usb/debug.h> 34 39 35 40 #include <usb/host/usb_transfer_batch.h> 36 #include <usb/debug.h> 37 38 #include <assert.h> 39 #include <errno.h> 40 #include <macros.h> 41 #include <mem.h> 42 #include <stdlib.h> 43 #include <usbhc_iface.h> 41 #include <usb/host/hcd.h> 44 42 45 43 /** Allocate and initialize usb_transfer_batch structure. … … 63 61 usbhc_iface_transfer_in_callback_t func_in, 64 62 usbhc_iface_transfer_out_callback_t func_out, 65 void *arg 63 void *arg, 64 ddf_fun_t *fun, 65 void *private_data, 66 void (*private_data_dtor)(void *) 66 67 ) 67 68 { … … 80 81 instance->buffer_size = buffer_size; 81 82 instance->setup_size = 0; 83 instance->fun = fun; 84 instance->private_data = private_data; 85 instance->private_data_dtor = private_data_dtor; 82 86 instance->transfered_size = 0; 83 87 instance->error = EOK; … … 92 96 return instance; 93 97 } 94 98 /*----------------------------------------------------------------------------*/ 95 99 /** Correctly dispose all used data structures. 96 100 * … … 106 110 endpoint_release(instance->ep); 107 111 } 112 if (instance->private_data) { 113 assert(instance->private_data_dtor); 114 instance->private_data_dtor(instance->private_data); 115 } 108 116 free(instance); 109 117 } 110 118 /*----------------------------------------------------------------------------*/ 111 119 /** Prepare data and call the right callback. 112 120 * … … 125 133 /* NOTE: Only one of these pointers should be set. */ 126 134 if (instance->callback_out) { 127 instance->callback_out(error, instance->arg); 135 /* Check for commands that reset toggle bit */ 136 if (instance->ep->transfer_type == USB_TRANSFER_CONTROL 137 && error == EOK) { 138 const usb_target_t target = 139 {{ instance->ep->address, instance->ep->endpoint }}; 140 reset_ep_if_need(fun_to_hcd(instance->fun), target, 141 instance->setup_buffer); 142 } 143 instance->callback_out(instance->fun, error, instance->arg); 128 144 } 129 145 … … 134 150 memcpy(instance->buffer, data, safe_size); 135 151 } 136 instance->callback_in(error, safe_size, instance->arg); 152 instance->callback_in(instance->fun, error, 153 safe_size, instance->arg); 137 154 } 138 155 }
Note:
See TracChangeset
for help on using the changeset viewer.