source: mainline/uspace/lib/usbdev/include/usb/dev/device.h@ 34b2f54d

Last change on this file since 34b2f54d was d7f7a4a, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Replace some license headers with SPDX identifier

Headers are replaced using tools/transorm-copyright.sh only
when it can be matched verbatim with the license header used
throughout most of the codebase.

  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * SPDX-FileCopyrightText: 2011 Vojtech Horky
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/** @addtogroup libusbdev
8 * @{
9 */
10/** @file
11 * USB device driver framework.
12 */
13
14#ifndef LIBUSBDEV_DEVICE_H_
15#define LIBUSBDEV_DEVICE_H_
16
17#include <ddf/driver.h>
18#include <usb/usb.h>
19#include <usb/descriptor.h>
20#include <usb/dev/alternate_ifaces.h>
21#include <usb/dev/pipes.h>
22#include <usbhc_iface.h>
23
24#include <assert.h>
25#include <async.h>
26
27/** Some useful descriptors for USB device. */
28typedef struct {
29 /** Standard device descriptor. */
30 usb_standard_device_descriptor_t device;
31 /** Full configuration descriptor of current configuration. */
32 void *full_config;
33 size_t full_config_size;
34} usb_device_descriptors_t;
35
36typedef struct usb_device usb_device_t;
37
38/* DDF parts */
39errno_t usb_device_create_ddf(ddf_dev_t *,
40 const usb_endpoint_description_t **, const char **);
41void usb_device_destroy_ddf(ddf_dev_t *);
42
43static inline usb_device_t *usb_device_get(ddf_dev_t *dev)
44{
45 assert(dev);
46 return ddf_dev_data_get(dev);
47}
48
49usb_device_t *usb_device_create(devman_handle_t);
50void usb_device_destroy(usb_device_t *);
51
52const char *usb_device_get_name(usb_device_t *);
53ddf_fun_t *usb_device_ddf_fun_create(usb_device_t *, fun_type_t, const char *);
54
55async_exch_t *usb_device_bus_exchange_begin(usb_device_t *);
56void usb_device_bus_exchange_end(async_exch_t *);
57
58errno_t usb_device_select_interface(usb_device_t *, uint8_t,
59 const usb_endpoint_description_t **);
60
61errno_t usb_device_create_pipes(usb_device_t *usb_dev,
62 const usb_endpoint_description_t **endpoints);
63void usb_device_destroy_pipes(usb_device_t *);
64
65usb_pipe_t *usb_device_get_default_pipe(usb_device_t *);
66usb_endpoint_mapping_t *usb_device_get_mapped_ep_desc(usb_device_t *,
67 const usb_endpoint_description_t *);
68int usb_device_unmap_ep(usb_endpoint_mapping_t *);
69
70usb_address_t usb_device_get_address(const usb_device_t *);
71usb_speed_t usb_device_get_depth(const usb_device_t *);
72usb_speed_t usb_device_get_speed(const usb_device_t *);
73int usb_device_get_iface_number(const usb_device_t *);
74devman_handle_t usb_device_get_devman_handle(const usb_device_t *);
75
76const usb_device_descriptors_t *usb_device_descriptors(usb_device_t *);
77
78const usb_alternate_interfaces_t *usb_device_get_alternative_ifaces(
79 usb_device_t *);
80
81void *usb_device_data_alloc(usb_device_t *, size_t);
82void *usb_device_data_get(usb_device_t *);
83
84#endif
85/**
86 * @}
87 */
Note: See TracBrowser for help on using the repository browser.