Changeset f9d0a86 in mainline for uspace/lib/usb/include/usb/usb.h
- Timestamp:
- 2017-11-14T12:24:42Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6cad776
- Parents:
- 887c9de (diff), d2d142a (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. - git-author:
- Aearsis <Hlavaty.Ondrej@…> (2017-11-14 01:04:19)
- git-committer:
- Aearsis <Hlavaty.Ondrej@…> (2017-11-14 12:24:42)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/usb.h
r887c9de rf9d0a86 39 39 #include <stdint.h> 40 40 #include <types/common.h> 41 #include <usb_iface.h> 41 42 42 43 /** Convert 16bit value from native (host) endianness to USB endianness. */ … … 52 53 #define uint32_usb2host(n) uint32_t_le2host((n)) 53 54 54 55 /** USB transfer type. */56 typedef enum {57 USB_TRANSFER_CONTROL = 0,58 USB_TRANSFER_ISOCHRONOUS = 1,59 USB_TRANSFER_BULK = 2,60 USB_TRANSFER_INTERRUPT = 361 } usb_transfer_type_t;62 63 55 const char * usb_str_transfer_type(usb_transfer_type_t t); 64 56 const char * usb_str_transfer_type_short(usb_transfer_type_t t); 65 57 66 /** USB data transfer direction. */67 typedef enum {68 USB_DIRECTION_IN,69 USB_DIRECTION_OUT,70 USB_DIRECTION_BOTH71 } usb_direction_t;72 73 58 const char *usb_str_direction(usb_direction_t); 74 75 /** USB speeds. */76 typedef enum {77 /** USB 1.1 low speed (1.5Mbits/s). */78 USB_SPEED_LOW,79 /** USB 1.1 full speed (12Mbits/s). */80 USB_SPEED_FULL,81 /** USB 2.0 high speed (480Mbits/s). */82 USB_SPEED_HIGH,83 /** USB 3.0 super speed (5Gbits/s). */84 USB_SPEED_SUPER,85 /** Psuedo-speed serving as a boundary. */86 USB_SPEED_MAX87 } usb_speed_t;88 59 89 60 static inline bool usb_speed_is_11(const usb_speed_t s) … … 110 81 } usb_request_recipient_t; 111 82 112 /** USB address type.113 * Negative values could be used to indicate error.114 */115 typedef int16_t usb_address_t;116 117 typedef struct {118 usb_address_t address;119 unsigned port;120 } usb_tt_address_t;121 122 83 /** Default USB address. */ 123 84 #define USB_ADDRESS_DEFAULT 0 … … 139 100 } 140 101 141 /** USB endpoint number type.142 * Negative values could be used to indicate error.143 */144 typedef int16_t usb_endpoint_t;145 146 102 /** Default control endpoint */ 147 103 #define USB_ENDPOINT_DEFAULT_CONTROL 0 … … 162 118 (ep < USB11_ENDPOINT_MAX); 163 119 } 164 165 166 /** USB complete address type.167 * Pair address + endpoint is identification of transaction recipient.168 */169 typedef union {170 struct {171 usb_address_t address;172 usb_endpoint_t endpoint;173 } __attribute__((packed));174 uint32_t packed;175 } usb_target_t;176 177 /** Description of usb endpoint.178 */179 typedef struct {180 /** Endpoint number. */181 usb_endpoint_t endpoint_no;182 183 /** Endpoint transfer type. */184 usb_transfer_type_t transfer_type;185 186 /** Endpoint direction. */187 usb_direction_t direction;188 189 /** Maximum packet size for the endpoint. */190 size_t max_packet_size;191 192 /** Number of packets per frame/uframe.193 * Only valid for HS INT and ISO transfers. All others should set to 1*/194 unsigned packets;195 196 struct {197 unsigned polling_interval;198 } usb2;199 200 struct {201 unsigned max_burst;202 unsigned max_streams;203 } usb3;204 } usb_endpoint_desc_t;205 120 206 121 /** Check USB target for allowed values (address and endpoint).
Note:
See TracChangeset
for help on using the changeset viewer.