Changeset 3bacee1 in mainline for uspace/drv/bus/usb/ohci/ohci_batch.c
- Timestamp:
- 2018-04-12T16:27:17Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cf22f9
- Parents:
- 76d0981d
- git-author:
- Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_batch.c
r76d0981d r3bacee1 48 48 #include "ohci_bus.h" 49 49 50 static void (*const batch_setup[])(ohci_transfer_batch_t *);50 static void (*const batch_setup[])(ohci_transfer_batch_t *); 51 51 52 52 /** Safely destructs ohci_transfer_batch_t structure … … 67 67 * NULL otherwise. 68 68 */ 69 ohci_transfer_batch_t * 69 ohci_transfer_batch_t *ohci_transfer_batch_create(endpoint_t *ep) 70 70 { 71 71 assert(ep); … … 97 97 return ENOTSUP; 98 98 99 ohci_batch->td_count = (usb_batch->size + OHCI_TD_MAX_TRANSFER - 1) 100 /OHCI_TD_MAX_TRANSFER;99 ohci_batch->td_count = (usb_batch->size + OHCI_TD_MAX_TRANSFER - 1) / 100 OHCI_TD_MAX_TRANSFER; 101 101 /* Control transfer need Setup and Status stage */ 102 102 if (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) { … … 110 110 111 111 const size_t td_size = ohci_batch->td_count * sizeof(td_t); 112 const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) 113 ? USB_SETUP_PACKET_SIZE114 :0;112 const size_t setup_size = (usb_batch->ep->transfer_type == USB_TRANSFER_CONTROL) ? 113 USB_SETUP_PACKET_SIZE : 114 0; 115 115 116 116 if (dma_buffer_alloc(&ohci_batch->ohci_dma_buffer, td_size + setup_size)) { … … 190 190 * we leave the very last(unused) TD behind. 191 191 */ 192 usb_batch->transferred_size 193 -=td_remain_size(ohci_batch->tds[i]);192 usb_batch->transferred_size -= 193 td_remain_size(ohci_batch->tds[i]); 194 194 } else { 195 195 usb_log_debug("Batch %p found error TD(%zu):%08x.", … … 289 289 /* Data stage */ 290 290 size_t td_current = 1; 291 const char *buffer = ohci_batch->data_buffer;291 const char *buffer = ohci_batch->data_buffer; 292 292 size_t remain_size = ohci_batch->base.size; 293 293 while (remain_size > 0) { … … 347 347 char *buffer = ohci_batch->data_buffer; 348 348 while (remain_size > 0) { 349 const size_t transfer_size = remain_size > OHCI_TD_MAX_TRANSFER 350 ?OHCI_TD_MAX_TRANSFER : remain_size;349 const size_t transfer_size = remain_size > OHCI_TD_MAX_TRANSFER ? 350 OHCI_TD_MAX_TRANSFER : remain_size; 351 351 352 352 td_init( … … 374 374 375 375 /** Transfer setup table. */ 376 static void (*const batch_setup[])(ohci_transfer_batch_t *) =377 {376 static void (*const batch_setup[])(ohci_transfer_batch_t *) = 377 { 378 378 [USB_TRANSFER_CONTROL] = batch_control, 379 379 [USB_TRANSFER_BULK] = batch_data,
Note:
See TracChangeset
for help on using the changeset viewer.