Changeset 1d758fc in mainline for uspace/lib/usbdev/src/pipes.c
- 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipes.c
r2f762a7 r1d758fc 83 83 84 84 /* Only control writes make sense without buffer */ 85 if ((t->dir != USB_DIRECTION_OUT || !t->is_control) 86 && (t->req.base == NULL || t->req.size == 0)) 85 if ((t->dir != USB_DIRECTION_OUT || !t->is_control) && t->req.size == 0) 87 86 return EINVAL; 88 87 89 88 /* Nonzero size requires buffer */ 90 if ( t->req.base == NULL&& t->req.size != 0)89 if (!dma_buffer_is_set(&t->req.buffer) && t->req.size != 0) 91 90 return EINVAL; 92 91 … … 119 118 /** 120 119 * Setup the transfer request inside transfer according to dma buffer provided. 120 * 121 * TODO: The buffer could have been allocated as a more strict one. Currently, 122 * we assume that the policy is just the requested one. 121 123 */ 122 124 static void setup_dma_buffer(transfer_t *t, void *base, void *ptr, size_t size) 123 125 { 124 t->req.base = base; 126 t->req.buffer.virt = base; 127 t->req.buffer.policy = t->pipe->desc.transfer_buffer_policy; 125 128 t->req.offset = ptr - base; 126 129 t->req.size = size; 127 t->req.buffer_policy = t->pipe->desc.transfer_buffer_policy;128 130 } 129 131 … … 133 135 static errno_t transfer_wrap_dma(transfer_t *t, void *buf, size_t size) 134 136 { 137 if (size == 0) { 138 setup_dma_buffer(t, NULL, NULL, 0); 139 return transfer_common(t); 140 } 141 135 142 void *dma_buf = usb_pipe_alloc_buffer(t->pipe, size); 136 143 setup_dma_buffer(t, dma_buf, dma_buf, size); … … 364 371 .direction = USB_DIRECTION_BOTH, 365 372 .max_transfer_size = CTRL_PIPE_MIN_PACKET_SIZE, 373 .transfer_buffer_policy = DMA_POLICY_STRICT, 366 374 }; 367 375
Note:
See TracChangeset
for help on using the changeset viewer.