Changeset db51a6a6 in mainline
- Timestamp:
- 2018-01-22T12:20:14Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 998773d
- Parents:
- b3c39690
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-22 12:18:02)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-22 12:20:14)
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
abi/include/abi/ipc/ipc.h
rb3c39690 rdb51a6a6 36 36 #define ABI_IPC_IPC_H_ 37 37 38 /** Length of data being transfer ed with IPC call38 /** Length of data being transferred with IPC call 39 39 * 40 40 * The uspace may not be able to utilize full length -
uspace/drv/bus/usb/ehci/ehci_batch.c
rb3c39690 rdb51a6a6 179 179 180 180 /* Assume all data got through */ 181 ehci_batch->base.transfer ed_size = ehci_batch->base.buffer_size;181 ehci_batch->base.transferred_size = ehci_batch->base.buffer_size; 182 182 183 183 /* Check all TDs */ … … 202 202 * we leave the very last(unused) TD behind. 203 203 */ 204 ehci_batch->base.transfer ed_size204 ehci_batch->base.transferred_size 205 205 -= td_remain_size(&ehci_batch->tds[i]); 206 206 } else { … … 215 215 } 216 216 217 assert(ehci_batch->base.transfer ed_size <= ehci_batch->base.buffer_size);217 assert(ehci_batch->base.transferred_size <= ehci_batch->base.buffer_size); 218 218 219 219 if (ehci_batch->base.dir == USB_DIRECTION_IN) 220 220 memcpy(ehci_batch->base.buffer, 221 221 ehci_batch->data_buffer, 222 ehci_batch->base.transfer ed_size);222 ehci_batch->base.transferred_size); 223 223 224 224 /* Clear TD pointers */ -
uspace/drv/bus/usb/ehci/ehci_bus.c
rb3c39690 rdb51a6a6 148 148 if (batch) { 149 149 batch->error = EINTR; 150 batch->transfer ed_size = 0;150 batch->transferred_size = 0; 151 151 usb_transfer_batch_finish(batch); 152 152 } -
uspace/drv/bus/usb/ehci/ehci_rh.c
rb3c39690 rdb51a6a6 146 146 batch->error = virthub_base_request(&instance->base, batch->target, 147 147 batch->dir, (void*) batch->setup.buffer, 148 batch->buffer, batch->buffer_size, &batch->transfer ed_size);148 batch->buffer, batch->buffer_size, &batch->transferred_size); 149 149 if (batch->error == ENAK) { 150 150 usb_log_debug("RH(%p): BATCH(%p) adding as unfinished", … … 180 180 batch->error = virthub_base_request(&instance->base, batch->target, 181 181 batch->dir, (void*) batch->setup.buffer, 182 batch->buffer, batch->buffer_size, &batch->transfer ed_size);182 batch->buffer, batch->buffer_size, &batch->transferred_size); 183 183 usb_transfer_batch_finish(batch); 184 184 } -
uspace/drv/bus/usb/ohci/ohci_batch.c
rb3c39690 rdb51a6a6 187 187 188 188 /* Assume all data got through */ 189 ohci_batch->base.transfer ed_size = ohci_batch->base.buffer_size;189 ohci_batch->base.transferred_size = ohci_batch->base.buffer_size; 190 190 191 191 /* Assume we will leave the last(unused) TD behind */ … … 213 213 * we leave the very last(unused) TD behind. 214 214 */ 215 ohci_batch->base.transfer ed_size215 ohci_batch->base.transferred_size 216 216 -= td_remain_size(ohci_batch->tds[i]); 217 217 } else { … … 244 244 } 245 245 } 246 assert(ohci_batch->base.transfer ed_size <=246 assert(ohci_batch->base.transferred_size <= 247 247 ohci_batch->base.buffer_size); 248 248 … … 254 254 memcpy(ohci_batch->base.buffer, 255 255 ohci_batch->device_buffer + setup_size, 256 ohci_batch->base.transfer ed_size);256 ohci_batch->base.transferred_size); 257 257 258 258 /* Store the remaining TD */ -
uspace/drv/bus/usb/ohci/ohci_bus.c
rb3c39690 rdb51a6a6 152 152 if (batch) { 153 153 batch->error = EINTR; 154 batch->transfer ed_size = 0;154 batch->transferred_size = 0; 155 155 usb_transfer_batch_finish(batch); 156 156 } -
uspace/drv/bus/usb/ohci/ohci_rh.c
rb3c39690 rdb51a6a6 180 180 batch->error = virthub_base_request(&instance->base, batch->target, 181 181 batch->dir, &batch->setup.packet, 182 batch->buffer, batch->buffer_size, &batch->transfer ed_size);182 batch->buffer, batch->buffer_size, &batch->transferred_size); 183 183 if (batch->error == ENAK) { 184 184 /* This is safe because only status change interrupt transfers … … 208 208 batch->error = virthub_base_request(&instance->base, batch->target, 209 209 batch->dir, &batch->setup.packet, 210 batch->buffer, batch->buffer_size, &batch->transfer ed_size);210 batch->buffer, batch->buffer_size, &batch->transferred_size); 211 211 usb_transfer_batch_finish(batch); 212 212 } -
uspace/drv/bus/usb/uhci/hc.c
rb3c39690 rdb51a6a6 362 362 async_usleep(2000); 363 363 batch->base.error = EINTR; 364 batch->base.transfer ed_size = 0;364 batch->base.transferred_size = 0; 365 365 usb_transfer_batch_finish(&batch->base); 366 366 } -
uspace/drv/bus/usb/uhci/uhci_batch.c
rb3c39690 rdb51a6a6 163 163 uhci_batch, USB_TRANSFER_BATCH_ARGS(*batch), 164 164 uhci_batch->td_count); 165 batch->transfer ed_size = 0;165 batch->transferred_size = 0; 166 166 167 167 uhci_endpoint_t *uhci_ep = (uhci_endpoint_t *) batch->ep; … … 185 185 } 186 186 187 batch->transfer ed_size187 batch->transferred_size 188 188 += td_act_size(&uhci_batch->tds[i]); 189 189 if (td_is_short(&uhci_batch->tds[i])) … … 191 191 } 192 192 substract_ret: 193 if (batch->transfer ed_size > 0 && batch->ep->transfer_type == USB_TRANSFER_CONTROL) {194 assert(batch->transfer ed_size >= USB_SETUP_PACKET_SIZE);195 batch->transfer ed_size -= USB_SETUP_PACKET_SIZE;193 if (batch->transferred_size > 0 && batch->ep->transfer_type == USB_TRANSFER_CONTROL) { 194 assert(batch->transferred_size >= USB_SETUP_PACKET_SIZE); 195 batch->transferred_size -= USB_SETUP_PACKET_SIZE; 196 196 } 197 197 198 198 if (batch->dir == USB_DIRECTION_IN) { 199 assert(batch->transfer ed_size <= batch->buffer_size);199 assert(batch->transferred_size <= batch->buffer_size); 200 200 memcpy(batch->buffer, 201 201 uhci_transfer_batch_data_buffer(uhci_batch), 202 batch->transfer ed_size);202 batch->transferred_size); 203 203 } 204 204 -
uspace/drv/bus/usb/uhci/uhci_rh.c
rb3c39690 rdb51a6a6 107 107 batch->error = virthub_base_request(&instance->base, batch->target, 108 108 batch->dir, (void*) batch->setup.buffer, 109 batch->buffer, batch->buffer_size, &batch->transfer ed_size);109 batch->buffer, batch->buffer_size, &batch->transferred_size); 110 110 if (batch->error == ENAK) 111 111 async_usleep(instance->base.endpoint_descriptor.poll_interval * 1000); -
uspace/drv/bus/usb/vhc/transfer.c
rb3c39690 rdb51a6a6 151 151 assert(transfer); 152 152 transfer->batch.error = outcome; 153 transfer->batch.transfer ed_size = data_transfer_size;153 transfer->batch.transferred_size = data_transfer_size; 154 154 usb_transfer_batch_finish(&transfer->batch); 155 155 } -
uspace/drv/bus/usb/xhci/endpoint.c
rb3c39690 rdb51a6a6 209 209 if (batch) { 210 210 batch->error = EINTR; 211 batch->transfer ed_size = 0;211 batch->transferred_size = 0; 212 212 usb_transfer_batch_finish(batch); 213 213 } -
uspace/drv/bus/usb/xhci/isoch.c
rb3c39690 rdb51a6a6 483 483 484 484 /* Withdraw results from previous transfers. */ 485 transfer->batch.transfer ed_size = 0;485 transfer->batch.transferred_size = 0; 486 486 xhci_isoch_transfer_t *res = &isoch->transfers[isoch->dequeue]; 487 487 while (res->state == ISOCH_COMPLETE) { … … 489 489 490 490 res->state = ISOCH_EMPTY; 491 transfer->batch.transfer ed_size += res->size;491 transfer->batch.transferred_size += res->size; 492 492 transfer->batch.error = res->error; 493 493 if (res->error) … … 555 555 if (!it->error) { 556 556 memcpy(transfer->batch.buffer, it->data.virt, it->size); 557 transfer->batch.transfer ed_size = it->size;557 transfer->batch.transferred_size = it->size; 558 558 transfer->batch.error = it->error; 559 559 } -
uspace/drv/bus/usb/xhci/transfers.c
rb3c39690 rdb51a6a6 340 340 case XHCI_TRBC_SUCCESS: 341 341 batch->error = EOK; 342 batch->transfer ed_size = batch->buffer_size - TRB_TRANSFER_LENGTH(*trb);342 batch->transferred_size = batch->buffer_size - TRB_TRANSFER_LENGTH(*trb); 343 343 break; 344 344 … … 346 346 usb_log_warning("Transfer ended with data buffer error."); 347 347 batch->error = EAGAIN; 348 batch->transfer ed_size = 0;348 batch->transferred_size = 0; 349 349 break; 350 350 … … 352 352 usb_log_warning("Babble detected during the transfer."); 353 353 batch->error = EAGAIN; 354 batch->transfer ed_size = 0;354 batch->transferred_size = 0; 355 355 break; 356 356 … … 358 358 usb_log_warning("USB Transaction error."); 359 359 batch->error = ESTALL; 360 batch->transfer ed_size = 0;360 batch->transferred_size = 0; 361 361 break; 362 362 … … 364 364 usb_log_error("Invalid transfer parameters."); 365 365 batch->error = EINVAL; 366 batch->transfer ed_size = 0;366 batch->transferred_size = 0; 367 367 break; 368 368 … … 370 370 usb_log_warning("Stall condition detected."); 371 371 batch->error = ESTALL; 372 batch->transfer ed_size = 0;372 batch->transferred_size = 0; 373 373 break; 374 374 … … 376 376 usb_log_error("Split transcation error detected."); 377 377 batch->error = EAGAIN; 378 batch->transfer ed_size = 0;378 batch->transferred_size = 0; 379 379 break; 380 380 … … 386 386 if (batch->dir == USB_DIRECTION_IN) { 387 387 assert(batch->buffer); 388 assert(batch->transfer ed_size <= batch->buffer_size);389 memcpy(batch->buffer, transfer->hc_buffer.virt, batch->transfer ed_size);388 assert(batch->transferred_size <= batch->buffer_size); 389 memcpy(batch->buffer, transfer->hc_buffer.virt, batch->transferred_size); 390 390 } 391 391 -
uspace/lib/drv/generic/remote_usbhc.c
rb3c39690 rdb51a6a6 433 433 } 434 434 435 static int callback_out(void *arg, int error, size_t transfer ed_size)435 static int callback_out(void *arg, int error, size_t transferred_size) 436 436 { 437 437 async_transaction_t *trans = arg; … … 444 444 } 445 445 446 static int callback_in(void *arg, int error, size_t transfer ed_size)446 static int callback_in(void *arg, int error, size_t transferred_size) 447 447 { 448 448 async_transaction_t *trans = arg; … … 451 451 if (error == EOK) { 452 452 error = async_data_read_finalize(trans->data_caller, 453 trans->buffer, transfer ed_size);453 trans->buffer, transferred_size); 454 454 } else { 455 455 async_answer_0(trans->data_caller, EINTR); -
uspace/lib/usbdev/src/pipes.c
rb3c39690 rdb51a6a6 69 69 * @param[out] data_buffer Buffer for incoming data. 70 70 * @param[in] data_buffer_size Size of the buffer for incoming data (in bytes). 71 * @param[out] data_transfer ed_size Number of bytes that were actually72 * transfer ed during the DATA stage.71 * @param[out] data_transferred_size Number of bytes that were actually 72 * transferred during the DATA stage. 73 73 * @return Error code. 74 74 */ 75 75 int usb_pipe_control_read(usb_pipe_t *pipe, 76 76 const void *setup_buffer, size_t setup_buffer_size, 77 void *buffer, size_t buffer_size, size_t *transfer ed_size)77 void *buffer, size_t buffer_size, size_t *transferred_size) 78 78 { 79 79 assert(pipe); … … 105 105 } 106 106 107 if (rc == EOK && transfer ed_size != NULL) {108 *transfer ed_size = act_size;107 if (rc == EOK && transferred_size != NULL) { 108 *transferred_size = act_size; 109 109 } 110 110 … … 166 166 * @param[out] buffer Buffer where to store the data. 167 167 * @param[in] size Size of the buffer (in bytes). 168 * @param[out] size_transfer ed Number of bytes that were actually transfered.168 * @param[out] size_transferred Number of bytes that were actually transferred. 169 169 * @return Error code. 170 170 */ 171 171 int usb_pipe_read(usb_pipe_t *pipe, 172 void *buffer, size_t size, size_t *size_transfer ed)172 void *buffer, size_t size, size_t *size_transferred) 173 173 { 174 174 assert(pipe); … … 200 200 async_exchange_end(exch); 201 201 202 if (rc == EOK && size_transfer ed != NULL) {203 *size_transfer ed = act_size;202 if (rc == EOK && size_transferred != NULL) { 203 *size_transferred = act_size; 204 204 } 205 205 -
uspace/lib/usbdev/src/request.c
rb3c39690 rdb51a6a6 118 118 * @param data_size Size of the @p data buffer 119 119 * (in native endianness). 120 * @param actual_data_size Actual size of transfer ed data120 * @param actual_data_size Actual size of transferred data 121 121 * (in native endianness). 122 122 * … … 183 183 184 184 uint16_t status_usb_endianess; 185 size_t data_transfer ed_size;185 size_t data_transferred_size; 186 186 int rc = usb_control_request_get(pipe, USB_REQUEST_TYPE_STANDARD, 187 187 recipient, USB_DEVREQ_GET_STATUS, 0, uint16_host2usb(index), 188 &status_usb_endianess, 2, &data_transfer ed_size);189 if (rc != EOK) { 190 return rc; 191 } 192 if (data_transfer ed_size != 2) {188 &status_usb_endianess, 2, &data_transferred_size); 189 if (rc != EOK) { 190 return rc; 191 } 192 if (data_transferred_size != 2) { 193 193 return ELIMIT; 194 194 } … … 314 314 */ 315 315 uint8_t tmp_buffer; 316 size_t bytes_transfer ed;316 size_t bytes_transferred; 317 317 rc = usb_request_get_descriptor(pipe, request_type, recipient, 318 318 descriptor_type, descriptor_index, language, 319 &tmp_buffer, sizeof(tmp_buffer), &bytes_transfer ed);320 if (rc != EOK) { 321 return rc; 322 } 323 if (bytes_transfer ed != 1) {319 &tmp_buffer, sizeof(tmp_buffer), &bytes_transferred); 320 if (rc != EOK) { 321 return rc; 322 } 323 if (bytes_transferred != 1) { 324 324 return ELIMIT; 325 325 } … … 340 340 rc = usb_request_get_descriptor(pipe, request_type, recipient, 341 341 descriptor_type, descriptor_index, language, 342 buffer, size, &bytes_transfer ed);342 buffer, size, &bytes_transferred); 343 343 if (rc != EOK) { 344 344 free(buffer); 345 345 return rc; 346 346 } 347 if (bytes_transfer ed != size) {347 if (bytes_transferred != size) { 348 348 free(buffer); 349 349 return ELIMIT; -
uspace/lib/usbhost/include/usb/host/usb_transfer_batch.h
rb3c39690 rdb51a6a6 80 80 size_t buffer_size; 81 81 /** Actually used portion of the buffer */ 82 size_t transfer ed_size;82 size_t transferred_size; 83 83 84 84 /** Indicates success/failure of the communication */ -
uspace/lib/usbhost/src/bus.c
rb3c39690 rdb51a6a6 572 572 unsigned done; 573 573 574 size_t transfer ed_size;574 size_t transferred_size; 575 575 int error; 576 576 } sync_data_t; … … 579 579 * Callback for finishing the transfer. Wake the issuing thread. 580 580 */ 581 static int sync_transfer_complete(void *arg, int error, size_t transfer ed_size)581 static int sync_transfer_complete(void *arg, int error, size_t transferred_size) 582 582 { 583 583 sync_data_t *d = arg; 584 584 assert(d); 585 d->transfer ed_size = transfered_size;585 d->transferred_size = transferred_size; 586 586 d->error = error; 587 587 fibril_mutex_lock(&d->done_mtx); … … 624 624 625 625 return (sd.error == EOK) 626 ? (ssize_t) sd.transfer ed_size626 ? (ssize_t) sd.transferred_size 627 627 : (ssize_t) sd.error; 628 628 } -
uspace/lib/usbhost/src/usb_transfer_batch.c
rb3c39690 rdb51a6a6 118 118 119 119 if (batch->on_complete) { 120 const int err = batch->on_complete(batch->on_complete_data, batch->error, batch->transfer ed_size);120 const int err = batch->on_complete(batch->on_complete_data, batch->error, batch->transferred_size); 121 121 if (err) 122 122 usb_log_warning("batch %p failed to complete: %s", -
uspace/lib/usbvirt/src/ipc_hc.c
rb3c39690 rdb51a6a6 50 50 * @param data_buffer Data buffer (DATA stage of control transfer). 51 51 * @param data_buffer_size Size of data buffer in bytes. 52 * @param data_transfer ed_size Number of actually transferred bytes.52 * @param data_transferred_size Number of actually transferred bytes. 53 53 * 54 54 * @return Error code. … … 57 57 int usbvirt_ipc_send_control_read(async_sess_t *sess, void *setup_buffer, 58 58 size_t setup_buffer_size, void *data_buffer, size_t data_buffer_size, 59 size_t *data_transfer ed_size)59 size_t *data_transferred_size) 60 60 { 61 61 if (!sess) … … 111 111 return (int) opening_request_rc; 112 112 113 if (data_transfer ed_size != NULL)114 *data_transfer ed_size = IPC_GET_ARG2(data_request_call);113 if (data_transferred_size != NULL) 114 *data_transferred_size = IPC_GET_ARG2(data_request_call); 115 115 116 116 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.