source: mainline/uspace/lib/usb/include/usb/pipes.h@ 23c7f4d

lfn serial ticket/834-toolchain-update topic/fix-logger-deadlock topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 23c7f4d was 23c7f4d, checked in by Vojtech Horky <vojtechhorky@…>, 15 years ago

Rename connection initialization function

  • Property mode set to 100644
File size: 4.0 KB
Line 
1/*
2 * Copyright (c) 2011 Vojtech Horky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup libusb
30 * @{
31 */
32/** @file
33 * Communication between device drivers and host controller driver.
34 */
35#ifndef LIBUSB_PIPES_H_
36#define LIBUSB_PIPES_H_
37
38#include <sys/types.h>
39#include <usb/usb.h>
40#include <ipc/devman.h>
41#include <driver.h>
42
43/**
44 * Abstraction of a physical connection to the device.
45 * This type is an abstraction of the USB wire that connects the host and
46 * the function (device).
47 */
48typedef struct {
49 /** Handle of the host controller device is connected to. */
50 devman_handle_t hc_handle;
51 /** Address of the device. */
52 usb_address_t address;
53} usb_device_connection_t;
54
55/**
56 * Abstraction of a logical connection to USB device endpoint.
57 * It encapsulates endpoint attributes (transfer type etc.) as well
58 * as information about currently running sessions.
59 * This endpoint must be bound with existing usb_device_connection_t
60 * (i.e. the wire to send data over).
61 */
62typedef struct {
63 /** The connection used for sending the data. */
64 usb_device_connection_t *wire;
65
66 /** Endpoint number. */
67 usb_endpoint_t endpoint_no;
68
69 /** Endpoint transfer type. */
70 usb_transfer_type_t transfer_type;
71
72 /** Endpoint direction. */
73 usb_direction_t direction;
74
75 /** Phone to the host controller.
76 * Negative when no session is active.
77 */
78 int hc_phone;
79} usb_endpoint_pipe_t;
80
81
82int usb_device_connection_initialize_from_device(usb_device_connection_t *,
83 device_t *);
84
85int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *,
86 usb_device_connection_t *,
87 usb_endpoint_t, usb_transfer_type_t, usb_direction_t);
88int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *,
89 usb_device_connection_t *);
90
91
92int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *);
93int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *);
94
95int usb_endpoint_pipe_read(usb_endpoint_pipe_t *, void *, size_t, size_t *);
96int usb_endpoint_pipe_write(usb_endpoint_pipe_t *, void *, size_t);
97
98int usb_endpoint_pipe_control_read(usb_endpoint_pipe_t *, void *, size_t,
99 void *, size_t, size_t *);
100int usb_endpoint_pipe_control_write(usb_endpoint_pipe_t *, void *, size_t,
101 void *, size_t);
102
103
104
105int usb_endpoint_pipe_async_read(usb_endpoint_pipe_t *, void *, size_t,
106 size_t *, usb_handle_t *);
107int usb_endpoint_pipe_async_write(usb_endpoint_pipe_t *, void *, size_t,
108 usb_handle_t *);
109
110int usb_endpoint_pipe_async_control_read(usb_endpoint_pipe_t *, void *, size_t,
111 void *, size_t, size_t *, usb_handle_t *);
112int usb_endpoint_pipe_async_control_write(usb_endpoint_pipe_t *, void *, size_t,
113 void *, size_t, usb_handle_t *);
114
115int usb_endpoint_pipe_wait_for(usb_endpoint_pipe_t *, usb_handle_t);
116
117#endif
118/**
119 * @}
120 */
Note: See TracBrowser for help on using the repository browser.