Changeset 1a02517 in mainline
- Timestamp:
- 2011-08-25T08:53:14Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 32e093e
- Parents:
- 3afb758
- Location:
- uspace
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/batch.c
r3afb758 r1a02517 93 93 * @param[in] uhci_batch Instance to destroy. 94 94 */ 95 void uhci_transfer_batch_dispose(void *uhci_batch)95 static void uhci_transfer_batch_dispose(void *uhci_batch) 96 96 { 97 97 uhci_transfer_batch_t *instance = uhci_batch; … … 119 119 * Initializes parameters needed for the transfer and callback. 120 120 */ 121 void * uhci_transfer_batch_create(usb_transfer_batch_t *batch)121 int batch_init_private(usb_transfer_batch_t *batch) 122 122 { 123 123 #define CHECK_NULL_DISPOSE_RETURN(ptr, message...) \ … … 127 127 uhci_transfer_batch_dispose(uhci_data); \ 128 128 } \ 129 return NULL; \129 return ENOMEM; \ 130 130 } else (void)0 131 131 … … 164 164 /* Set generic data buffer pointer */ 165 165 batch->data_buffer = setup + batch->setup_size; 166 batch->private_data_dtor = uhci_transfer_batch_dispose; 166 167 batch->private_data = uhci_data; 167 168 usb_log_debug2("Batch %p " USB_TRANSFER_BATCH_FMT … … 171 172 batch_setup[batch->ep->transfer_type][batch->ep->direction](batch); 172 173 173 return uhci_data; 174 } 175 /*----------------------------------------------------------------------------*/ 174 return EOK; 175 } 176 176 /*----------------------------------------------------------------------------*/ 177 177 /** Check batch TDs for activity. -
uspace/drv/bus/usb/uhci/batch.h
r3afb758 r1a02517 39 39 #include "hw_struct/queue_head.h" 40 40 41 void * uhci_transfer_batch_create(usb_transfer_batch_t *batch); 42 void uhci_transfer_batch_dispose(void *uhci_batch); 43 44 bool batch_is_complete(usb_transfer_batch_t *instance); 45 46 qh_t * batch_qh(usb_transfer_batch_t *instance); 41 int batch_init_private(usb_transfer_batch_t *batch); 42 bool batch_is_complete(usb_transfer_batch_t *batch); 43 qh_t * batch_qh(usb_transfer_batch_t *batch); 47 44 #endif 48 45 /** -
uspace/drv/bus/usb/uhci/hc.c
r3afb758 r1a02517 198 198 instance->generic.private_data = instance; 199 199 instance->generic.schedule = hc_schedule; 200 instance->generic.batch_ private_ctor = uhci_transfer_batch_create;201 instance->generic. batch_private_dtor = uhci_transfer_batch_dispose;200 instance->generic.batch_init_hook = batch_init_private; 201 instance->generic.ep_add_hook = NULL; 202 202 #undef CHECK_RET_DEST_FUN_RETURN 203 203 -
uspace/lib/usbhost/include/usb/host/hcd.h
r3afb758 r1a02517 50 50 51 51 int (*schedule)(hcd_t *, usb_transfer_batch_t *); 52 void * (*batch_private_ctor)(usb_transfer_batch_t *);53 void (*batch_private_dtor)(void*);52 int (*batch_init_hook)(usb_transfer_batch_t *); 53 int (*ep_add_hook)(endpoint_t *); 54 54 }; 55 55 /*----------------------------------------------------------------------------*/ -
uspace/lib/usbhost/include/usb/host/usb_endpoint_manager.h
r3afb758 r1a02517 77 77 usb_endpoint_manager_t *instance, usb_target_t target, const uint8_t *data); 78 78 79 /** Wrapper combining allocation and insertion */ 79 80 static inline int usb_endpoint_manager_add_ep(usb_endpoint_manager_t *instance, 80 81 usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction, -
uspace/lib/usbhost/src/iface.c
r3afb758 r1a02517 78 78 } 79 79 80 /* No private data and no private data_dtor, these should be set by 81 * batch_init_hook*/ 80 82 usb_transfer_batch_init(batch, ep, data, NULL, size, setup_data, 81 setup_size, in, out, arg, fun, NULL, hcd->batch_private_dtor); 82 if (hcd->batch_private_ctor) { 83 batch->private_data = hcd->batch_private_ctor(batch); 84 if (!batch->private_data) { 85 ret = ENOMEM; 83 setup_size, in, out, arg, fun, NULL, NULL); 84 if (hcd->batch_init_hook) { 85 ret = hcd->batch_init_hook(batch); 86 if (ret != EOK) 86 87 goto out; 87 }88 88 } else { 89 89 usb_log_warning("Missing batch_private_data constructor!\n"); … … 199 199 max_packet_size, interval); 200 200 201 return usb_endpoint_manager_add_ep(&hcd->ep_manager, address, endpoint, 202 direction, transfer_type, speed, max_packet_size, size); 201 endpoint_t *ep = endpoint_get( 202 address, endpoint, direction, transfer_type, speed, max_packet_size); 203 if (!ep) 204 return ENOMEM; 205 int ret = EOK; 206 if (hcd->ep_add_hook) { 207 ret = hcd->ep_add_hook(ep); 208 } 209 if (ret != EOK) { 210 endpoint_destroy(ep); 211 return ret; 212 } 213 214 ret = usb_endpoint_manager_register_ep(&hcd->ep_manager, ep, size); 215 if (ret != EOK) { 216 endpoint_destroy(ep); 217 } 218 return ret; 203 219 } 204 220 /*----------------------------------------------------------------------------*/
Note:
See TracChangeset
for help on using the changeset viewer.