Changeset 50ba203 in mainline for uspace/lib/usb/include
- Timestamp:
- 2011-02-20T15:46:48Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6bb83c7
- Parents:
- d81ef61c (diff), 0c00dac (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- uspace/lib/usb/include/usb
- Files:
-
- 2 added
- 1 deleted
- 6 edited
- 1 moved
-
addrkeep.h (modified) (1 diff, 1 prop)
-
classes/hid.h (modified) (1 diff)
-
classes/hub.h (modified) (3 diffs)
-
hcdhubd.h (deleted)
-
hub.h (moved) (moved from uspace/lib/usb/include/usb/hcd.h ) (2 diffs)
-
pipes.h (modified) (6 diffs)
-
recognise.h (added)
-
usb.h (modified) (1 diff)
-
usbdevice.h (added)
-
usbdrv.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/addrkeep.h
-
Property mode
changed from
120000to100644
rd81ef61c r50ba203 1 hcd.h 1 /* 2 * Copyright (c) 2010 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 * USB address keeping for host controller drivers. 34 */ 35 #ifndef LIBUSB_ADDRKEEP_H_ 36 #define LIBUSB_ADDRKEEP_H_ 37 38 #include <usb/usb.h> 39 #include <fibril_synch.h> 40 #include <devman.h> 41 42 /** Info about used address. */ 43 typedef struct { 44 /** Linked list member. */ 45 link_t link; 46 /** Address. */ 47 usb_address_t address; 48 /** Corresponding devman handle. */ 49 devman_handle_t devman_handle; 50 } usb_address_keeping_used_t; 51 52 /** Structure for keeping track of free and used USB addresses. */ 53 typedef struct { 54 /** Head of list of used addresses. */ 55 link_t used_addresses; 56 /** Upper bound for USB addresses. */ 57 usb_address_t max_address; 58 /** Mutex protecting used address. */ 59 fibril_mutex_t used_addresses_guard; 60 /** Condition variable for used addresses. */ 61 fibril_condvar_t used_addresses_condvar; 62 63 /** Condition variable mutex for default address. */ 64 fibril_mutex_t default_condvar_guard; 65 /** Condition variable for default address. */ 66 fibril_condvar_t default_condvar; 67 /** Whether is default address available. */ 68 bool default_available; 69 } usb_address_keeping_t; 70 71 void usb_address_keeping_init(usb_address_keeping_t *, usb_address_t); 72 73 void usb_address_keeping_reserve_default(usb_address_keeping_t *); 74 void usb_address_keeping_release_default(usb_address_keeping_t *); 75 76 usb_address_t usb_address_keeping_request(usb_address_keeping_t *); 77 int usb_address_keeping_release(usb_address_keeping_t *, usb_address_t); 78 void usb_address_keeping_devman_bind(usb_address_keeping_t *, usb_address_t, 79 devman_handle_t); 80 usb_address_t usb_address_keeping_find(usb_address_keeping_t *, 81 devman_handle_t); 82 83 #endif 84 /** 85 * @} 86 */ -
Property mode
changed from
-
uspace/lib/usb/include/usb/classes/hid.h
rd81ef61c r50ba203 50 50 USB_HIDREQ_SET_PROTOCOL = 11 51 51 } usb_hid_request_t; 52 53 /** USB/HID subclass constants. */ 54 typedef enum { 55 USB_HID_SUBCLASS_NONE = 0, 56 USB_HID_SUBCLASS_BOOT = 1 57 } usb_hid_subclass_t; 52 58 53 59 /** USB/HID interface protocols. */ -
uspace/lib/usb/include/usb/classes/hub.h
rd81ef61c r50ba203 37 37 38 38 #include <sys/types.h> 39 #include <usb/hcdhubd.h>40 41 39 42 40 /** Hub class feature selector. … … 80 78 /** 81 79 D1...D0: Logical Power Switching Mode 82 00: Ganged power switching (all ports ’power at80 00: Ganged power switching (all ports power at 83 81 once) 84 82 01: Individual port power switching … … 91 89 00: Global Over-current Protection. The hub 92 90 reports over-current as a summation of all 93 ports ’current draw, without a breakdown of91 ports current draw, without a breakdown of 94 92 individual port over-current status. 95 93 01: Individual Port Over-current Protection. The -
uspace/lib/usb/include/usb/hub.h
rd81ef61c r50ba203 1 1 /* 2 * Copyright (c) 201 0Vojtech Horky2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 31 31 */ 32 32 /** @file 33 * @brief HC driver.33 * Functions needed by hub drivers. 34 34 */ 35 #ifndef LIBUSB_H CD_H_36 #define LIBUSB_H CD_H_35 #ifndef LIBUSB_HUB_H_ 36 #define LIBUSB_HUB_H_ 37 37 38 #include <usb/usb.h> 39 #include <fibril_synch.h> 40 #include <devman.h> 38 #include <sys/types.h> 39 #include <usb/usbdevice.h> 41 40 42 /** Info about used address. */ 41 /** Info about device attached to host controller. 42 * 43 * This structure exists only to keep the same signature of 44 * usb_hc_register_device() when more properties of the device 45 * would have to be passed to the host controller. 46 */ 43 47 typedef struct { 44 /** Linked list member. */ 45 link_t link; 46 /** Address. */ 48 /** Device address. */ 47 49 usb_address_t address; 48 /** Corresponding devman handle. */49 devman_handle_t devman_handle;50 } usb_ address_keeping_used_t;50 /** Devman handle of the device. */ 51 devman_handle_t handle; 52 } usb_hc_attached_device_t; 51 53 52 /** Structure for keeping track of free and used USB addresses. */ 53 typedef struct { 54 /** Head of list of used addresses. */ 55 link_t used_addresses; 56 /** Upper bound for USB addresses. */ 57 usb_address_t max_address; 58 /** Mutex protecting used address. */ 59 fibril_mutex_t used_addresses_guard; 60 /** Condition variable for used addresses. */ 61 fibril_condvar_t used_addresses_condvar; 54 int usb_hc_reserve_default_address(usb_hc_connection_t *, bool); 55 int usb_hc_release_default_address(usb_hc_connection_t *); 62 56 63 /** Condition variable mutex for default address. */ 64 fibril_mutex_t default_condvar_guard; 65 /** Condition variable for default address. */ 66 fibril_condvar_t default_condvar; 67 /** Whether is default address available. */ 68 bool default_available; 69 } usb_address_keeping_t; 70 71 void usb_address_keeping_init(usb_address_keeping_t *, usb_address_t); 72 73 void usb_address_keeping_reserve_default(usb_address_keeping_t *); 74 void usb_address_keeping_release_default(usb_address_keeping_t *); 75 76 usb_address_t usb_address_keeping_request(usb_address_keeping_t *); 77 int usb_address_keeping_release(usb_address_keeping_t *, usb_address_t); 78 void usb_address_keeping_devman_bind(usb_address_keeping_t *, usb_address_t, 79 devman_handle_t); 80 usb_address_t usb_address_keeping_find(usb_address_keeping_t *, 81 devman_handle_t); 57 usb_address_t usb_hc_request_address(usb_hc_connection_t *, bool); 58 int usb_hc_register_device(usb_hc_connection_t *, 59 const usb_hc_attached_device_t *); 60 int usb_hc_unregister_device(usb_hc_connection_t *, usb_address_t); 82 61 83 62 #endif -
uspace/lib/usb/include/usb/pipes.h
rd81ef61c r50ba203 31 31 */ 32 32 /** @file 33 * Communication between device drivers and host controller driver.33 * USB pipes representation. 34 34 */ 35 35 #ifndef LIBUSB_PIPES_H_ … … 38 38 #include <sys/types.h> 39 39 #include <usb/usb.h> 40 #include <usb/usbdevice.h> 41 #include <usb/descriptor.h> 40 42 #include <ipc/devman.h> 41 43 #include <driver.h> … … 73 75 usb_direction_t direction; 74 76 77 /** Maximum packet size for the endpoint. */ 78 size_t max_packet_size; 79 75 80 /** Phone to the host controller. 76 81 * Negative when no session is active. … … 80 85 81 86 87 /** Description of endpoint characteristics. */ 88 typedef struct { 89 /** Transfer type (e.g. control or interrupt). */ 90 usb_transfer_type_t transfer_type; 91 /** Transfer direction (to or from a device). */ 92 usb_direction_t direction; 93 /** Interface class this endpoint belongs to (-1 for any). */ 94 int interface_class; 95 /** Interface subclass this endpoint belongs to (-1 for any). */ 96 int interface_subclass; 97 /** Interface protocol this endpoint belongs to (-1 for any). */ 98 int interface_protocol; 99 /** Extra endpoint flags. */ 100 unsigned int flags; 101 } usb_endpoint_description_t; 102 103 /** Mapping of endpoint pipes and endpoint descriptions. */ 104 typedef struct { 105 /** Endpoint pipe. */ 106 usb_endpoint_pipe_t *pipe; 107 /** Endpoint description. */ 108 const usb_endpoint_description_t *description; 109 /** Found descriptor fitting the description. */ 110 usb_standard_endpoint_descriptor_t *descriptor; 111 /** Interface the endpoint belongs to. */ 112 usb_standard_interface_descriptor_t *interface; 113 /** Whether the endpoint was actually found. */ 114 bool present; 115 } usb_endpoint_mapping_t; 116 117 int usb_device_connection_initialize_on_default_address( 118 usb_device_connection_t *, usb_hc_connection_t *); 82 119 int usb_device_connection_initialize_from_device(usb_device_connection_t *, 83 120 device_t *); … … 87 124 int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *, 88 125 usb_device_connection_t *, 89 usb_endpoint_t, usb_transfer_type_t, usb_direction_t);126 usb_endpoint_t, usb_transfer_type_t, size_t, usb_direction_t); 90 127 int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *, 91 128 usb_device_connection_t *); 129 int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 130 size_t, uint8_t *, size_t, usb_device_connection_t *); 92 131 93 132 … … 103 142 void *, size_t); 104 143 105 106 107 int usb_endpoint_pipe_async_read(usb_endpoint_pipe_t *, void *, size_t,108 size_t *, usb_handle_t *);109 int usb_endpoint_pipe_async_write(usb_endpoint_pipe_t *, void *, size_t,110 usb_handle_t *);111 112 int usb_endpoint_pipe_async_control_read(usb_endpoint_pipe_t *, void *, size_t,113 void *, size_t, size_t *, usb_handle_t *);114 int usb_endpoint_pipe_async_control_write(usb_endpoint_pipe_t *, void *, size_t,115 void *, size_t, usb_handle_t *);116 117 int usb_endpoint_pipe_wait_for(usb_endpoint_pipe_t *, usb_handle_t);118 119 144 #endif 120 145 /** -
uspace/lib/usb/include/usb/usb.h
rd81ef61c r50ba203 83 83 } usb_request_recipient_t; 84 84 85 /** USB transaction outcome. */86 typedef enum {87 USB_OUTCOME_OK,88 USB_OUTCOME_CRCERROR,89 USB_OUTCOME_BABBLE90 } usb_transaction_outcome_t;91 92 const char * usb_str_transaction_outcome(usb_transaction_outcome_t o);93 94 85 /** USB address type. 95 86 * Negative values could be used to indicate error. -
uspace/lib/usb/include/usb/usbdrv.h
rd81ef61c r50ba203 106 106 const void *, size_t); 107 107 108 int usb_drv_create_device_match_ids(int, match_id_list_t *, usb_address_t);109 int usb_drv_register_child_in_devman(int, device_t *, usb_address_t,110 devman_handle_t *);111 112 108 113 109 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
