Changeset 70fb822 in mainline
- Timestamp:
- 2011-08-31T18:21:48Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f18d82f0
- Parents:
- ff6dd73
- Location:
- uspace
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci_batch.c
rff6dd73 r70fb822 76 76 if (uhci_batch->usb_batch->callback_in) 77 77 usb_transfer_batch_call_in(uhci_batch->usb_batch); 78 usb_transfer_batch_finish(uhci_batch->usb_batch);79 78 uhci_transfer_batch_dispose(uhci_batch); 80 79 } -
uspace/lib/usbhost/include/usb/host/batch.h
rff6dd73 r70fb822 75 75 76 76 77 void usb_transfer_batch_init( 78 usb_transfer_batch_t *instance, 77 usb_transfer_batch_t * usb_transfer_batch_get( 79 78 endpoint_t *ep, 80 79 char *buffer, -
uspace/lib/usbhost/src/batch.c
rff6dd73 r70fb822 40 40 #include <usb/host/hcd.h> 41 41 42 void usb_transfer_batch_init( 43 usb_transfer_batch_t *instance, 42 usb_transfer_batch_t * usb_transfer_batch_get( 44 43 endpoint_t *ep, 45 44 char *buffer, … … 53 52 ddf_fun_t *fun, 54 53 void *private_data, 55 void (*private_data_dtor)(void * p_data)54 void (*private_data_dtor)(void *) 56 55 ) 57 56 { 58 assert(instance); 59 link_initialize(&instance->link); 60 instance->ep = ep; 61 instance->callback_in = func_in; 62 instance->callback_out = func_out; 63 instance->arg = arg; 64 instance->buffer = buffer; 65 instance->data_buffer = data_buffer; 66 instance->buffer_size = buffer_size; 67 instance->setup_buffer = setup_buffer; 68 instance->setup_size = setup_size; 69 instance->fun = fun; 70 instance->private_data = private_data; 71 instance->private_data_dtor = private_data_dtor; 72 instance->transfered_size = 0; 73 instance->next_step = NULL; 74 instance->error = EOK; 75 if (instance->ep) 76 endpoint_use(instance->ep); 57 usb_transfer_batch_t *instance = malloc(sizeof(usb_transfer_batch_t)); 58 if (instance) { 59 link_initialize(&instance->link); 60 instance->ep = ep; 61 instance->callback_in = func_in; 62 instance->callback_out = func_out; 63 instance->arg = arg; 64 instance->buffer = buffer; 65 instance->data_buffer = data_buffer; 66 instance->buffer_size = buffer_size; 67 instance->setup_buffer = setup_buffer; 68 instance->setup_size = setup_size; 69 instance->fun = fun; 70 instance->private_data = private_data; 71 instance->private_data_dtor = private_data_dtor; 72 instance->transfered_size = 0; 73 instance->next_step = NULL; 74 instance->error = EOK; 75 if (instance->ep) 76 endpoint_use(instance->ep); 77 } 78 return instance; 77 79 } 78 80 /*----------------------------------------------------------------------------*/ … … 85 87 { 86 88 assert(instance); 87 if (instance->ep)88 endpoint_release(instance->ep);89 89 if (instance->next_step) 90 90 instance->next_step(instance); … … 150 150 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT " disposing.\n", 151 151 instance, USB_TRANSFER_BATCH_ARGS(*instance)); 152 if (instance->ep) { 153 endpoint_release(instance->ep); 154 } 152 155 if (instance->private_data) { 153 156 assert(instance->private_data_dtor); -
uspace/lib/usbhost/src/iface.c
rff6dd73 r70fb822 71 71 return ENOSPC; 72 72 } 73 usb_transfer_batch_t *batch = malloc(sizeof(usb_transfer_batch_t)); 73 if (!hcd->schedule) { 74 usb_log_error("HCD does not implement scheduler.\n"); 75 return ENOTSUP; 76 } 77 78 /* No private data and no private data dtor */ 79 usb_transfer_batch_t *batch = 80 usb_transfer_batch_get(ep, data, NULL, size, setup_data, 81 setup_size, in, out, arg, fun, NULL, NULL); 74 82 if (!batch) { 75 ret = ENOMEM; 76 goto out; 77 78 } 79 80 /* No private data and no private data dtor, these will be set later */ 81 usb_transfer_batch_init(batch, ep, data, NULL, size, setup_data, 82 setup_size, in, out, arg, fun, NULL, NULL); 83 84 if (hcd->schedule) { 85 ret = hcd->schedule(hcd, batch); 86 } else { 87 usb_log_error("HCD does not implement scheduler.\n"); 88 ret = ENOTSUP; 89 } 90 out: 83 return ENOMEM; 84 } 85 86 ret = hcd->schedule(hcd, batch); 91 87 if (ret != EOK) 92 88 usb_transfer_batch_dispose(batch);
Note:
See TracChangeset
for help on using the changeset viewer.