Changeset 1d758fc in mainline for uspace/lib/drv
- Timestamp:
- 2018-02-12T10:11:47Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5fe3f954
- Parents:
- 2f762a7
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-02-05 03:28:50)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-02-12 10:11:47)
- Location:
- uspace/lib/drv
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/drv/generic/remote_usbhc.c
r2f762a7 r1d758fc 210 210 ? AS_AREA_WRITE : AS_AREA_READ; 211 211 212 const errno_t ret = async_share_out_start(exch, req->b ase, flags);212 const errno_t ret = async_share_out_start(exch, req->buffer.virt, flags); 213 213 if (ret != EOK) { 214 214 async_forget(opening_request); … … 374 374 return; 375 375 } 376 if (trans->request.b ase!= NULL) {377 as_area_destroy(trans->request.b ase);376 if (trans->request.buffer.virt != NULL) { 377 as_area_destroy(trans->request.buffer.virt); 378 378 } 379 379 … … 422 422 } 423 423 424 if ((err = async_share_out_finalize(data_callid, &trans->request.b ase)))424 if ((err = async_share_out_finalize(data_callid, &trans->request.buffer.virt))) 425 425 return err; 426 426 427 427 /* 428 * As we're going to check the mapping, we must make sure the memory is 429 * actually mapped. We must do it right now, because the area might be 430 * read-only or write-only, and we may be unsure later. 428 * As we're going to get physical addresses of the mapping, we must make 429 * sure the memory is actually mapped. We must do it right now, because 430 * the area might be read-only or write-only, and we may be unsure 431 * later. 431 432 */ 432 433 if (flags & AS_AREA_READ) { 433 434 char foo = 0; 434 volatile const char *buf = trans->request.b ase+ trans->request.offset;435 volatile const char *buf = trans->request.buffer.virt + trans->request.offset; 435 436 for (size_t i = 0; i < size; i += PAGE_SIZE) 436 437 foo += buf[i]; 437 438 } else { 438 volatile char *buf = trans->request.b ase+ trans->request.offset;439 volatile char *buf = trans->request.buffer.virt + trans->request.offset; 439 440 for (size_t i = 0; i < size; i += PAGE_SIZE) 440 441 buf[i] = 0xff; … … 482 483 } else { 483 484 /* The value was valid on the other side, for us, its garbage. */ 484 trans->request.b ase= NULL;485 trans->request.buffer.virt = NULL; 485 486 } 486 487 -
uspace/lib/drv/include/usbhc_iface.h
r2f762a7 r1d758fc 104 104 105 105 // FIXME: DMA buffers shall be part of libdrv anyway. 106 typedef unsigned dma_policy_t; 106 typedef uintptr_t dma_policy_t; 107 108 typedef struct dma_buffer { 109 void *virt; 110 dma_policy_t policy; 111 } dma_buffer_t; 107 112 108 113 typedef struct usb_pipe_desc { … … 134 139 135 140 /** 136 * Base address of the buffer to share. Must be at least offset + size 137 * large. Is patched after being transmitted over IPC, so the pointer is 138 * still valid. 139 * 140 * Note that offset might be actually more than PAGE_SIZE. 141 * The DMA buffer to share. Must be at least offset + size large. Is 142 * patched after being transmitted over IPC, so the pointer is still 143 * valid. 141 144 */ 142 void *base;145 dma_buffer_t buffer; 143 146 size_t offset; /**< Offset to the buffer */ 144 147 size_t size; /**< Requested size. */ 145 dma_policy_t buffer_policy; /**< Properties of the buffer. */146 148 } usbhc_iface_transfer_request_t; 147 149
Note:
See TracChangeset
for help on using the changeset viewer.