Changeset c21e6a5 in mainline for uspace/drv/bus/usb/ohci/ohci_batch.c
- Timestamp:
- 2018-02-05T00:54:08Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- af16ebe
- Parents:
- 65c059f
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-02-05 00:27:40)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-02-05 00:54:08)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/ohci_batch.c
r65c059f rc21e6a5 113 113 : 0; 114 114 115 if (dma_buffer_alloc(&ohci_batch->ohci_dma_buffer, td_size + setup_size + usb_batch->buffer_size)) {115 if (dma_buffer_alloc(&ohci_batch->ohci_dma_buffer, td_size + setup_size)) { 116 116 usb_log_error("Failed to allocate OHCI DMA buffer."); 117 117 return ENOMEM; … … 129 129 memcpy(ohci_batch->setup_buffer, usb_batch->setup.buffer, setup_size); 130 130 131 ohci_batch->data_buffer = ohci_batch->setup_buffer + setup_size; 132 if (usb_batch->dir == USB_DIRECTION_OUT) 133 memcpy(ohci_batch->data_buffer, usb_batch->buffer, usb_batch->buffer_size); 131 ohci_batch->data_buffer = usb_batch->dma_buffer.virt; 134 132 135 133 batch_setup[usb_batch->ep->transfer_type](ohci_batch); … … 151 149 assert(ohci_batch); 152 150 153 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ohci_batch->base.ep); 151 usb_transfer_batch_t *usb_batch = &ohci_batch->base; 152 ohci_endpoint_t *ohci_ep = ohci_endpoint_get(usb_batch->ep); 154 153 assert(ohci_ep); 155 154 156 155 usb_log_debug("Batch %p checking %zu td(s) for completion.", 157 &ohci_batch->base, ohci_batch->td_count);156 ohci_batch, ohci_batch->td_count); 158 157 usb_log_debug2("ED: %08x:%08x:%08x:%08x.", 159 158 ohci_ep->ed->status, ohci_ep->ed->td_head, … … 167 166 168 167 /* Assume all data got through */ 169 ohci_batch->base.transferred_size = ohci_batch->base.buffer_size;168 usb_batch->transferred_size = usb_batch->buffer_size; 170 169 171 170 /* Check all TDs */ … … 176 175 ohci_batch->tds[i]->next, ohci_batch->tds[i]->be); 177 176 178 ohci_batch->base.error = td_error(ohci_batch->tds[i]);179 if ( ohci_batch->base.error == EOK) {177 usb_batch->error = td_error(ohci_batch->tds[i]); 178 if (usb_batch->error == EOK) { 180 179 /* If the TD got all its data through, it will report 181 180 * 0 bytes remain, the sole exception is INPUT with … … 190 189 * we leave the very last(unused) TD behind. 191 190 */ 192 ohci_batch->base.transferred_size191 usb_batch->transferred_size 193 192 -= td_remain_size(ohci_batch->tds[i]); 194 193 } else { 195 194 usb_log_debug("Batch %p found error TD(%zu):%08x.", 196 &ohci_batch->base, i, ohci_batch->tds[i]->status);195 ohci_batch, i, ohci_batch->tds[i]->status); 197 196 198 197 /* ED should be stopped because of errors */ … … 213 212 } 214 213 } 215 assert(ohci_batch->base.transferred_size <= 216 ohci_batch->base.buffer_size); 217 218 if (ohci_batch->base.dir == USB_DIRECTION_IN) 219 memcpy(ohci_batch->base.buffer, 220 ohci_batch->data_buffer, 221 ohci_batch->base.transferred_size); 214 assert(usb_batch->transferred_size <= usb_batch->buffer_size); 222 215 223 216 /* Make sure that we are leaving the right TD behind */
Note:
See TracChangeset
for help on using the changeset viewer.