Changeset 06c552c in mainline for uspace/drv/ohci/batch.c
- 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
- File:
-
- 1 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 }
Note:
See TracChangeset
for help on using the changeset viewer.