Changeset 92574f4 in mainline for uspace/lib/usb/include
- Timestamp:
- 2011-02-24T12:03:27Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e7b7ebd5
- Parents:
- 4837092 (diff), a80849c (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:
-
- 4 added
- 3 deleted
- 8 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/addrkeep.h
r4837092 r92574f4 31 31 */ 32 32 /** @file 33 * @brief HC driver.33 * USB address keeping for host controller drivers. 34 34 */ 35 #ifndef LIBUSB_ HCD_H_36 #define LIBUSB_ HCD_H_35 #ifndef LIBUSB_ADDRKEEP_H_ 36 #define LIBUSB_ADDRKEEP_H_ 37 37 38 38 #include <usb/usb.h> -
uspace/lib/usb/include/usb/classes/hid.h
r4837092 r92574f4 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
r4837092 r92574f4 1 1 /* 2 * Copyright (c) 2010 Vojtech Horky2 * Copyright (c) 2010 Matus Dekanek 3 3 * All rights reserved. 4 4 * … … 33 33 * @brief USB hub related structures. 34 34 */ 35 #ifndef LIBUSB_ HUB_H_36 #define LIBUSB_ HUB_H_35 #ifndef LIBUSB_CLASS_HUB_H_ 36 #define LIBUSB_CLASS_HUB_H_ 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/descriptor.h
r4837092 r92574f4 36 36 #define LIBUSB_DESCRIPTOR_H_ 37 37 38 #include <ipc/ipc.h>39 38 #include <async.h> 40 39 -
uspace/lib/usb/include/usb/dp.h
r4837092 r92574f4 45 45 } usb_dp_descriptor_nesting_t; 46 46 47 extern usb_dp_descriptor_nesting_t usb_dp_standard_descriptor_nesting[]; 48 47 49 typedef struct { 48 50 usb_dp_descriptor_nesting_t *nesting; -
uspace/lib/usb/include/usb/pipes.h
r4837092 r92574f4 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 #include <d river.h>43 #include <ddf/driver.h> 42 44 43 45 /** … … 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 /** Interface number the endpoint must belong to (-1 for any). */ 110 const int interface_no; 111 /** Found descriptor fitting the description. */ 112 usb_standard_endpoint_descriptor_t *descriptor; 113 /** Interface the endpoint belongs to. */ 114 usb_standard_interface_descriptor_t *interface; 115 /** Whether the endpoint was actually found. */ 116 bool present; 117 } usb_endpoint_mapping_t; 118 119 int usb_device_connection_initialize_on_default_address( 120 usb_device_connection_t *, usb_hc_connection_t *); 82 121 int usb_device_connection_initialize_from_device(usb_device_connection_t *, 83 d evice_t *);122 ddf_dev_t *); 84 123 int usb_device_connection_initialize(usb_device_connection_t *, 85 124 devman_handle_t, usb_address_t); 86 125 126 int usb_device_get_assigned_interface(ddf_dev_t *); 127 87 128 int usb_endpoint_pipe_initialize(usb_endpoint_pipe_t *, 88 129 usb_device_connection_t *, 89 usb_endpoint_t, usb_transfer_type_t, usb_direction_t);130 usb_endpoint_t, usb_transfer_type_t, size_t, usb_direction_t); 90 131 int usb_endpoint_pipe_initialize_default_control(usb_endpoint_pipe_t *, 91 132 usb_device_connection_t *); 133 int usb_endpoint_pipe_initialize_from_configuration(usb_endpoint_mapping_t *, 134 size_t, uint8_t *, size_t, usb_device_connection_t *); 92 135 93 136 94 137 int usb_endpoint_pipe_start_session(usb_endpoint_pipe_t *); 95 138 int usb_endpoint_pipe_end_session(usb_endpoint_pipe_t *); 139 bool usb_endpoint_pipe_is_session_started(usb_endpoint_pipe_t *); 96 140 97 141 int usb_endpoint_pipe_read(usb_endpoint_pipe_t *, void *, size_t, size_t *); … … 103 147 void *, size_t); 104 148 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 149 #endif 120 150 /** -
uspace/lib/usb/include/usb/request.h
r4837092 r92574f4 37 37 38 38 #include <sys/types.h> 39 #include <l18n/langs.h> 39 40 #include <usb/usb.h> 40 41 #include <usb/pipes.h> 41 42 #include <usb/descriptor.h> 43 44 /** Standard device request. */ 45 typedef enum { 46 USB_DEVREQ_GET_STATUS = 0, 47 USB_DEVREQ_CLEAR_FEATURE = 1, 48 USB_DEVREQ_SET_FEATURE = 3, 49 USB_DEVREQ_SET_ADDRESS = 5, 50 USB_DEVREQ_GET_DESCRIPTOR = 6, 51 USB_DEVREQ_SET_DESCRIPTOR = 7, 52 USB_DEVREQ_GET_CONFIGURATION = 8, 53 USB_DEVREQ_SET_CONFIGURATION = 9, 54 USB_DEVREQ_GET_INTERFACE = 10, 55 USB_DEVREQ_SET_INTERFACE = 11, 56 USB_DEVREQ_SYNCH_FRAME = 12, 57 USB_DEVREQ_LAST_STD 58 } usb_stddevreq_t; 59 60 /** Device request setup packet. 61 * The setup packet describes the request. 62 */ 63 typedef struct { 64 /** Request type. 65 * The type combines transfer direction, request type and 66 * intended recipient. 67 */ 68 uint8_t request_type; 69 /** Request identification. */ 70 uint8_t request; 71 /** Main parameter to the request. */ 72 union { 73 uint16_t value; 74 /* FIXME: add #ifdefs according to host endianess */ 75 struct { 76 uint8_t value_low; 77 uint8_t value_high; 78 }; 79 }; 80 /** Auxiliary parameter to the request. 81 * Typically, it is offset to something. 82 */ 83 uint16_t index; 84 /** Length of extra data. */ 85 uint16_t length; 86 } __attribute__ ((packed)) usb_device_request_setup_packet_t; 42 87 43 88 int usb_control_request_set(usb_endpoint_pipe_t *, … … 52 97 int usb_request_get_descriptor(usb_endpoint_pipe_t *, usb_request_type_t, 53 98 uint8_t, uint8_t, uint16_t, void *, size_t, size_t *); 99 int usb_request_get_descriptor_alloc(usb_endpoint_pipe_t *, usb_request_type_t, 100 uint8_t, uint8_t, uint16_t, void **, size_t *); 54 101 int usb_request_get_device_descriptor(usb_endpoint_pipe_t *, 55 102 usb_standard_device_descriptor_t *); … … 60 107 int usb_request_set_configuration(usb_endpoint_pipe_t *, uint8_t); 61 108 109 int usb_request_get_supported_languages(usb_endpoint_pipe_t *, 110 l18_win_locales_t **, size_t *); 111 int usb_request_get_string(usb_endpoint_pipe_t *, size_t, l18_win_locales_t, 112 char **); 113 62 114 #endif 63 115 /** -
uspace/lib/usb/include/usb/usb.h
r4837092 r92574f4 38 38 #include <sys/types.h> 39 39 #include <byteorder.h> 40 #include <ipc/ipc.h>41 40 42 41 /** Convert 16bit value from native (host) endianness to USB endianness. */ … … 70 69 } usb_direction_t; 71 70 71 /** USB speeds. */ 72 typedef enum { 73 /** USB 1.1 low speed (1.5Mbits/s). */ 74 USB_SPEED_LOW, 75 /** USB 1.1 full speed (12Mbits/s). */ 76 USB_SPEED_FULL, 77 /** USB 2.0 high speed (480Mbits/s). */ 78 USB_SPEED_HIGH 79 } usb_speed_t; 80 72 81 /** USB request type target. */ 73 82 typedef enum { … … 83 92 USB_REQUEST_RECIPIENT_ENDPOINT = 2 84 93 } usb_request_recipient_t; 85 86 /** USB transaction outcome. */87 typedef enum {88 USB_OUTCOME_OK,89 USB_OUTCOME_CRCERROR,90 USB_OUTCOME_BABBLE91 } usb_transaction_outcome_t;92 93 const char * usb_str_transaction_outcome(usb_transaction_outcome_t o);94 94 95 95 /** USB address type. -
uspace/lib/usb/include/usb/usbmem.h
r4837092 r92574f4 1 1 /* 2 * Copyright (c) 201 0Matus Dekanek2 * Copyright (c) 2011 Matus Dekanek 3 3 * All rights reserved. 4 4 * … … 35 35 * @{ 36 36 */ 37 /** @file definitions of special memory management, used mostly in usb stack37 /** @file definitions of memory management with address translation, used mostly in usb stack 38 38 * 39 39 * USB HCD needs traslation between physical and virtual addresses. These … … 59 59 60 60 extern void * mman_malloc( 61 62 63 61 size_t size, 62 size_t alignment, 63 unsigned long max_physical_address); 64 64 65 65 extern void * mman_getVA(void * addr);
Note:
See TracChangeset
for help on using the changeset viewer.