Changeset 2cc6e97 in mainline for uspace/lib/usb/src/host/batch.c
- Timestamp:
- 2011-04-12T14:07:02Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3d932af6
- Parents:
- 910ca3f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/host/batch.c
r910ca3f r2cc6e97 39 39 #include <usb/host/batch.h> 40 40 41 void usb_transfer_batch_call_in(usb_transfer_batch_t *instance); 42 void usb_transfer_batch_call_out(usb_transfer_batch_t *instance); 43 41 44 void usb_transfer_batch_init( 42 45 usb_transfer_batch_t *instance, 43 46 endpoint_t *ep, 44 47 char *buffer, 45 48 char *data_buffer, … … 51 54 void *arg, 52 55 ddf_fun_t *fun, 53 void *private_data 56 void *private_data, 57 void (*private_data_dtor)(void *p_data) 54 58 ) 55 59 { … … 67 71 instance->fun = fun; 68 72 instance->private_data = private_data; 73 instance->private_data_dtor = private_data_dtor; 69 74 instance->transfered_size = 0; 70 75 instance->next_step = NULL; 71 76 instance->error = EOK; 72 77 endpoint_use(instance->ep); 78 } 79 /*----------------------------------------------------------------------------*/ 80 /** Helper function, calls callback and correctly destroys batch structure. 81 * 82 * @param[in] instance Batch structure to use. 83 */ 84 void usb_transfer_batch_call_in_and_dispose(usb_transfer_batch_t *instance) 85 { 86 assert(instance); 87 usb_transfer_batch_call_in(instance); 88 usb_transfer_batch_dispose(instance); 89 } 90 /*----------------------------------------------------------------------------*/ 91 /** Helper function calls callback and correctly destroys batch structure. 92 * 93 * @param[in] instance Batch structure to use. 94 */ 95 void usb_transfer_batch_call_out_and_dispose(usb_transfer_batch_t *instance) 96 { 97 assert(instance); 98 usb_transfer_batch_call_out(instance); 99 usb_transfer_batch_dispose(instance); 73 100 } 74 101 /*----------------------------------------------------------------------------*/ … … 129 156 instance->error, instance->arg); 130 157 } 158 /*----------------------------------------------------------------------------*/ 159 /** Correctly dispose all used data structures. 160 * 161 * @param[in] instance Batch structure to use. 162 */ 163 void usb_transfer_batch_dispose(usb_transfer_batch_t *instance) 164 { 165 assert(instance); 166 usb_log_debug("Batch(%p) disposing.\n", instance); 167 if (instance->private_data) { 168 assert(instance->private_data_dtor); 169 instance->private_data_dtor(instance->private_data); 170 } 171 free(instance); 172 } 131 173 /** 132 174 * @}
Note:
See TracChangeset
for help on using the changeset viewer.