Changeset 06c552c in mainline
- Timestamp:
- 2011-04-08T20:54:52Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 96b8f322
- Parents:
- 344925c
- Location:
- uspace/drv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/batch.c
r344925c r06c552c 40 40 #include "batch.h" 41 41 #include "utils/malloc32.h" 42 #include "hw_struct/endpoint_descriptor.h" 43 #include "hw_struct/transfer_descriptor.h" 44 45 #define OHCI_MAX_TRANSFER (8 * 1024) /* OHCI TDs can handle up to 8KB buffers */ 46 47 typedef struct ohci_batch { 48 ed_t *ed; 49 td_t *tds; 50 size_t td_count; 51 } ohci_batch_t; 42 52 43 53 static void batch_call_in_and_dispose(usb_transfer_batch_t *instance); … … 68 78 func_in, func_out, arg, fun, ep, NULL); 69 79 80 ohci_batch_t *data = malloc(sizeof(ohci_batch_t)); 81 CHECK_NULL_DISPOSE_RETURN(data, "Failed to allocate batch data.\n"); 82 bzero(data, sizeof(ohci_batch_t)); 83 instance->private_data = data; 84 85 data->td_count = 86 (buffer_size + OHCI_MAX_TRANSFER - 1) / OHCI_MAX_TRANSFER; 87 if (ep->transfer_type == USB_TRANSFER_CONTROL) { 88 data->td_count += 2; 89 } 90 91 data->tds = malloc32(sizeof(td_t) * data->td_count); 92 CHECK_NULL_DISPOSE_RETURN(data->tds, 93 "Failed to allocate transfer descriptors.\n"); 94 bzero(data->tds, sizeof(td_t) * data->td_count); 95 96 data->ed = malloc32(sizeof(ed_t)); 97 CHECK_NULL_DISPOSE_RETURN(data->ed, 98 "Failed to allocate endpoint descriptor.\n"); 99 70 100 if (buffer_size > 0) { 71 101 instance->transport_buffer = malloc32(buffer_size); … … 81 111 } 82 112 83 84 113 return instance; 85 114 } -
uspace/drv/uhci-hcd/batch.c
r344925c r06c552c 103 103 usb_target_t target = 104 104 { .address = ep->address, .endpoint = ep->endpoint }; 105 usb_transfer_batch_init(instance, target, 106 ep->transfer_type, ep->speed, ep->max_packet_size, 107 buffer, NULL, buffer_size, NULL, setup_size, func_in, 108 func_out, arg, fun, ep, NULL); 105 usb_transfer_batch_init(instance, target, ep->transfer_type, ep->speed, 106 ep->max_packet_size, buffer, NULL, buffer_size, NULL, setup_size, 107 func_in, func_out, arg, fun, ep, NULL); 109 108 110 109 111 110 uhci_batch_t *data = malloc(sizeof(uhci_batch_t)); 112 CHECK_NULL_DISPOSE_RETURN(instance, 113 "Failed to allocate batch instance.\n"); 111 CHECK_NULL_DISPOSE_RETURN(data, "Failed to allocate batch data.\n"); 114 112 bzero(data, sizeof(uhci_batch_t)); 115 113 instance->private_data = data;
Note:
See TracChangeset
for help on using the changeset viewer.