Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/pipesinit.c

    r25971d2 rdc04868  
    320320}
    321321
     322/** Initialize USB endpoint pipe.
     323 *
     324 * @param pipe Endpoint pipe to be initialized.
     325 * @param connection Connection to the USB device backing this pipe (the wire).
     326 * @param endpoint_no Endpoint number (in USB 1.1 in range 0 to 15).
     327 * @param transfer_type Transfer type (e.g. interrupt or bulk).
     328 * @param max_packet_size Maximum packet size in bytes.
     329 * @param direction Endpoint direction (in/out).
     330 * @return Error code.
     331 */
     332int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *pipe,
     333    usb_device_connection_t *connection, usb_endpoint_t endpoint_no,
     334    usb_transfer_type_t transfer_type, size_t max_packet_size,
     335    usb_direction_t direction)
     336{
     337        assert(pipe);
     338        assert(connection);
     339
     340        pipe->wire = connection;
     341        pipe->hc_phone = -1;
     342        pipe->endpoint_no = endpoint_no;
     343        pipe->transfer_type = transfer_type;
     344        pipe->max_packet_size = max_packet_size;
     345        pipe->direction = direction;
     346
     347        return EOK;
     348}
     349
     350
     351/** Initialize USB endpoint pipe as the default zero control pipe.
     352 *
     353 * @param pipe Endpoint pipe to be initialized.
     354 * @param connection Connection to the USB device backing this pipe (the wire).
     355 * @return Error code.
     356 */
     357int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *pipe,
     358    usb_device_connection_t *connection)
     359{
     360        assert(pipe);
     361        assert(connection);
     362
     363        int rc = usb_endpoint_pipe_initialize(pipe, connection,
     364            0, USB_TRANSFER_CONTROL, 8, USB_DIRECTION_BOTH);
     365
     366        return rc;
     367}
     368
    322369/**
    323370 * @}
Note: See TracChangeset for help on using the changeset viewer.