source: mainline/uspace/lib/usb/include/usb/dev.h@ 2c202c5

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 2c202c5 was 2c202c5, checked in by Jan Vesely <jano.vesely@…>, 14 years ago

libusb: Add device_connection_t.

  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * Copyright (c) 2011 Jan Vesely
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/** @addtogroup libusb
29 * @{
30 */
31/** @file
32 * Common USB types and functions.
33 */
34#ifndef LIBUSB_DEV_H_
35#define LIBUSB_DEV_H_
36
37#include <devman.h>
38#include <usb/usb.h>
39#include <usb/hc.h>
40
41
42/** Abstraction of a physical connection to the device.
43 * This type is an abstraction of the USB wire that connects the host and
44 * the function (device).
45 */
46typedef struct {
47 /** Connection to the host controller device is connected to. */
48 usb_hc_connection_t *hc_connection;
49 /** Address of the device. */
50 usb_address_t address;
51} usb_device_connection_t;
52
53int usb_device_connection_initialize(usb_device_connection_t *,
54 usb_hc_connection_t *, usb_address_t);
55
56/** Initialize connection to USB device on default address.
57 *
58 * @param dev_connection Device connection structure to be initialized.
59 * @param hc_connection Initialized connection to host controller.
60 * @return Error code.
61 */
62static inline int usb_device_connection_initialize_on_default_address(
63 usb_device_connection_t *connection, usb_hc_connection_t *hc_conn)
64{
65 return usb_device_connection_initialize(connection, hc_conn, 0);
66}
67
68usb_address_t usb_get_address_by_handle(devman_handle_t);
69
70int usb_get_hc_by_handle(devman_handle_t, devman_handle_t *);
71
72int usb_resolve_device_handle(const char *, devman_handle_t *, usb_address_t *,
73 devman_handle_t *);
74#endif
75/**
76 * @}
77 */
Note: See TracBrowser for help on using the repository browser.