Changeset c804484 in mainline for uspace/lib/usbdev/src/pipesinit.c
- Timestamp:
- 2011-12-12T13:14:09Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3538b0e
- Parents:
- 1561e8b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usbdev/src/pipesinit.c
r1561e8b rc804484 41 41 #include <assert.h> 42 42 43 #define CTRL_PIPE_MIN_PACKET_SIZE 844 43 #define DEV_DESCR_MAX_PACKET_SIZE_OFFSET 7 45 46 44 47 45 #define NESTING(parentname, childname) \ … … 326 324 327 325 return EOK; 328 }329 330 /** Initialize USB endpoint pipe.331 *332 * @param pipe Endpoint pipe to be initialized.333 * @param connection Connection to the USB device backing this pipe (the wire).334 * @param endpoint_no Endpoint number (in USB 1.1 in range 0 to 15).335 * @param transfer_type Transfer type (e.g. interrupt or bulk).336 * @param max_packet_size Maximum packet size in bytes.337 * @param direction Endpoint direction (in/out).338 * @return Error code.339 */340 int usb_pipe_initialize(usb_pipe_t *pipe,341 usb_device_connection_t *connection, usb_endpoint_t endpoint_no,342 usb_transfer_type_t transfer_type, size_t max_packet_size,343 usb_direction_t direction)344 {345 assert(pipe);346 assert(connection);347 348 fibril_mutex_initialize(&pipe->guard);349 pipe->wire = connection;350 pipe->endpoint_no = endpoint_no;351 pipe->transfer_type = transfer_type;352 pipe->max_packet_size = max_packet_size;353 pipe->direction = direction;354 pipe->auto_reset_halt = false;355 356 return EOK;357 }358 359 /** Initialize USB endpoint pipe as the default zero control pipe.360 *361 * @param pipe Endpoint pipe to be initialized.362 * @param connection Connection to the USB device backing this pipe (the wire).363 * @return Error code.364 */365 int usb_pipe_initialize_default_control(usb_pipe_t *pipe,366 usb_device_connection_t *connection)367 {368 assert(pipe);369 assert(connection);370 371 int rc = usb_pipe_initialize(pipe, connection, 0, USB_TRANSFER_CONTROL,372 CTRL_PIPE_MIN_PACKET_SIZE, USB_DIRECTION_BOTH);373 374 pipe->auto_reset_halt = true;375 376 return rc;377 326 } 378 327 … … 428 377 } 429 378 430 /** Register endpoint with the host controller.431 *432 * @param pipe Pipe to be registered.433 * @param interval Polling interval.434 * @return Error code.435 */436 int usb_pipe_register(usb_pipe_t *pipe, unsigned interval)437 {438 assert(pipe);439 assert(pipe->wire);440 441 return usb_device_register_endpoint(pipe->wire,442 pipe->endpoint_no, pipe->transfer_type,443 pipe->direction, pipe->max_packet_size, interval);444 }445 446 /** Revert endpoint registration with the host controller.447 *448 * @param pipe Pipe to be unregistered.449 * @return Error code.450 */451 int usb_pipe_unregister(usb_pipe_t *pipe)452 {453 assert(pipe);454 assert(pipe->wire);455 456 return usb_device_unregister_endpoint(pipe->wire,457 pipe->endpoint_no, pipe->direction);458 }459 460 379 /** 461 380 * @}
Note:
See TracChangeset
for help on using the changeset viewer.