Changeset 18b6a88 in mainline for uspace/drv/bus/usb/uhci/uhci_batch.c
- Timestamp:
- 2018-04-15T09:35:04Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c1f44ca
- Parents:
- 8ebe212
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci_batch.c
r8ebe212 r18b6a88 53 53 54 54 /** Transfer batch setup table. */ 55 static void (*const batch_setup[])(uhci_transfer_batch_t *);55 static void (*const batch_setup[])(uhci_transfer_batch_t *); 56 56 57 57 /** Destroys uhci_transfer_batch_t structure. … … 72 72 * NULL otherwise. 73 73 */ 74 uhci_transfer_batch_t * 74 uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *ep) 75 75 { 76 76 uhci_transfer_batch_t *uhci_batch = … … 99 99 usb_transfer_batch_t *usb_batch = &uhci_batch->base; 100 100 101 uhci_batch->td_count = (usb_batch->size + usb_batch->ep->max_packet_size - 1) 102 /usb_batch->ep->max_packet_size;101 uhci_batch->td_count = (usb_batch->size + usb_batch->ep->max_packet_size - 1) / 102 usb_batch->ep->max_packet_size; 103 103 104 104 if (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) { … … 106 106 } 107 107 108 const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) 109 ? USB_SETUP_PACKET_SIZE110 :0;111 112 const size_t total_size = (sizeof(td_t) * uhci_batch->td_count) 113 +sizeof(qh_t) + setup_size;108 const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) ? 109 USB_SETUP_PACKET_SIZE : 110 0; 111 112 const size_t total_size = (sizeof(td_t) * uhci_batch->td_count) + 113 sizeof(qh_t) + setup_size; 114 114 115 115 if (dma_buffer_alloc(&uhci_batch->uhci_dma_buffer, total_size)) { … … 162 162 uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) batch->ep; 163 163 164 for (size_t i = 0; i < uhci_batch->td_count; ++i) {164 for (size_t i = 0; i < uhci_batch->td_count; ++i) { 165 165 if (td_is_active(&uhci_batch->tds[i])) { 166 166 return false; … … 180 180 } 181 181 182 batch->transferred_size 183 +=td_act_size(&uhci_batch->tds[i]);182 batch->transferred_size += 183 td_act_size(&uhci_batch->tds[i]); 184 184 if (td_is_short(&uhci_batch->tds[i])) 185 185 goto substract_ret; … … 235 235 const size_t packet_size = min(remain_size, mps); 236 236 237 const td_t *next_td = (td + 1 < uhci_batch->td_count) 238 ?&uhci_batch->tds[td + 1] : NULL;237 const td_t *next_td = (td + 1 < uhci_batch->td_count) ? 238 &uhci_batch->tds[td + 1] : NULL; 239 239 240 240 assert(td < uhci_batch->td_count); … … 328 328 } 329 329 330 static void (*const batch_setup[])(uhci_transfer_batch_t *) =331 {330 static void (*const batch_setup[])(uhci_transfer_batch_t *) = 331 { 332 332 [USB_TRANSFER_CONTROL] = batch_control, 333 333 [USB_TRANSFER_BULK] = batch_data,
Note:
See TracChangeset
for help on using the changeset viewer.