Changes in uspace/lib/usbdev/src/pipes.c [58563585:41df71f9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipes.c
r58563585 r41df71f9 36 36 #include <usb/dev/request.h> 37 37 #include <usb/usb.h> 38 #include <usb _iface.h>38 #include <usbhc_iface.h> 39 39 40 40 #include <assert.h> … … 51 51 assert(pipe != NULL); 52 52 53 if (!pipe->auto_reset_halt || (pipe-> endpoint_no != 0)) {53 if (!pipe->auto_reset_halt || (pipe->desc.endpoint_no != 0)) { 54 54 return; 55 55 } … … 88 88 } 89 89 90 if ((pipe->d irection != USB_DIRECTION_BOTH)91 || (pipe-> transfer_type != USB_TRANSFER_CONTROL)) {90 if ((pipe->desc.direction != USB_DIRECTION_BOTH) 91 || (pipe->desc.transfer_type != USB_TRANSFER_CONTROL)) { 92 92 return EBADF; 93 93 } … … 98 98 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 99 99 size_t act_size = 0; 100 const int rc = usb _read(exch, pipe->endpoint_no, setup_packet, buffer,100 const int rc = usbhc_read(exch, pipe->desc.endpoint_no, setup_packet, buffer, 101 101 buffer_size, &act_size); 102 102 async_exchange_end(exch); … … 142 142 } 143 143 144 if ((pipe->d irection != USB_DIRECTION_BOTH)145 || (pipe-> transfer_type != USB_TRANSFER_CONTROL)) {144 if ((pipe->desc.direction != USB_DIRECTION_BOTH) 145 || (pipe->desc.transfer_type != USB_TRANSFER_CONTROL)) { 146 146 return EBADF; 147 147 } … … 151 151 152 152 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 153 const int rc = usb _write(exch,154 pipe-> endpoint_no, setup_packet, buffer, buffer_size);153 const int rc = usbhc_write(exch, 154 pipe->desc.endpoint_no, setup_packet, buffer, buffer_size); 155 155 async_exchange_end(exch); 156 156 … … 183 183 } 184 184 185 if (pipe->d irection != USB_DIRECTION_IN) {186 return EBADF; 187 } 188 189 if (pipe-> transfer_type == USB_TRANSFER_CONTROL) {185 if (pipe->desc.direction != USB_DIRECTION_IN) { 186 return EBADF; 187 } 188 189 if (pipe->desc.transfer_type == USB_TRANSFER_CONTROL) { 190 190 return EBADF; 191 191 } 192 192 193 193 /* Isochronous transfer are not supported (yet) */ 194 if (pipe-> transfer_type != USB_TRANSFER_INTERRUPT &&195 pipe-> transfer_type != USB_TRANSFER_BULK)194 if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT && 195 pipe->desc.transfer_type != USB_TRANSFER_BULK) 196 196 return ENOTSUP; 197 197 … … 199 199 size_t act_size = 0; 200 200 const int rc = 201 usb _read(exch, pipe->endpoint_no, 0, buffer, size, &act_size);201 usbhc_read(exch, pipe->desc.endpoint_no, 0, buffer, size, &act_size); 202 202 async_exchange_end(exch); 203 203 … … 224 224 } 225 225 226 if (pipe->d irection != USB_DIRECTION_OUT) {227 return EBADF; 228 } 229 230 if (pipe-> transfer_type == USB_TRANSFER_CONTROL) {226 if (pipe->desc.direction != USB_DIRECTION_OUT) { 227 return EBADF; 228 } 229 230 if (pipe->desc.transfer_type == USB_TRANSFER_CONTROL) { 231 231 return EBADF; 232 232 } 233 233 234 234 /* Isochronous transfer are not supported (yet) */ 235 if (pipe-> transfer_type != USB_TRANSFER_INTERRUPT &&236 pipe-> transfer_type != USB_TRANSFER_BULK)235 if (pipe->desc.transfer_type != USB_TRANSFER_INTERRUPT && 236 pipe->desc.transfer_type != USB_TRANSFER_BULK) 237 237 return ENOTSUP; 238 238 239 239 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 240 const int rc = usb _write(exch, pipe->endpoint_no, 0, buffer, size);240 const int rc = usbhc_write(exch, pipe->desc.endpoint_no, 0, buffer, size); 241 241 async_exchange_end(exch); 242 242 return rc; … … 254 254 int usb_pipe_initialize(usb_pipe_t *pipe, usb_endpoint_t endpoint_no, 255 255 usb_transfer_type_t transfer_type, size_t max_packet_size, 256 usb_direction_t direction, unsigned packets, usb_dev_session_t *bus_session) 257 { 258 assert(pipe); 259 260 pipe->endpoint_no = endpoint_no; 261 pipe->transfer_type = transfer_type; 262 pipe->packets = packets; 263 pipe->max_packet_size = max_packet_size; 264 pipe->direction = direction; 256 usb_direction_t direction, unsigned packets, 257 unsigned max_burst, unsigned max_streams, usb_dev_session_t *bus_session) 258 { 259 // FIXME refactor this function 260 assert(pipe); 261 262 pipe->desc.endpoint_no = endpoint_no; 263 pipe->desc.transfer_type = transfer_type; 264 pipe->desc.packets = packets; 265 pipe->desc.max_packet_size = max_packet_size; 266 pipe->desc.direction = direction; 267 pipe->desc.usb3.max_burst = max_burst; 268 pipe->desc.usb3.max_streams = max_streams; 265 269 pipe->auto_reset_halt = false; 266 270 pipe->bus_session = bus_session; … … 280 284 281 285 const int rc = usb_pipe_initialize(pipe, 0, USB_TRANSFER_CONTROL, 282 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, bus_session);286 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH, 1, 0, 0, bus_session); 283 287 284 288 pipe->auto_reset_halt = true; … … 297 301 assert(pipe); 298 302 assert(pipe->bus_session); 303 304 pipe->desc.usb2.polling_interval = interval; 299 305 async_exch_t *exch = async_exchange_begin(pipe->bus_session); 300 306 if (!exch) 301 307 return ENOMEM; 302 const int ret = usb_register_endpoint(exch, pipe->endpoint_no, 303 pipe->transfer_type, pipe->direction, pipe->max_packet_size,304 pipe->packets, interval); 308 309 const int ret = usbhc_register_endpoint(exch, &pipe->desc); 310 305 311 async_exchange_end(exch); 306 312 return ret; … … 319 325 if (!exch) 320 326 return ENOMEM; 321 const int ret = usb_unregister_endpoint(exch, pipe->endpoint_no, 322 pipe->direction); 327 328 const int ret = usbhc_unregister_endpoint(exch, &pipe->desc); 329 323 330 async_exchange_end(exch); 324 331 return ret;
Note:
See TracChangeset
for help on using the changeset viewer.