Changeset df6ded8 in mainline for uspace/lib/usb/include/usb/descriptor.h
- Timestamp:
- 2018-02-28T16:37:50Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (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:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/descriptor.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2010 Vojtech Horky 3 * Copyright (c) 2018 Michal Staruch, Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 49 50 USB_DESCTYPE_OTHER_SPEED_CONFIGURATION = 7, 50 51 USB_DESCTYPE_INTERFACE_POWER = 8, 52 /* USB 3.0 types */ 53 USB_DESCTYPE_OTG = 9, 54 USB_DESCTYPE_DEBUG = 0xa, 55 USB_DESCTYPE_IFACE_ASSOC = 0xb, 56 USB_DESCTYPE_BOS = 0xf, 57 USB_DESCTYPE_DEVICE_CAP = 0x10, 51 58 /* Class specific */ 52 59 USB_DESCTYPE_HID = 0x21, … … 54 61 USB_DESCTYPE_HID_PHYSICAL = 0x23, 55 62 USB_DESCTYPE_HUB = 0x29, 63 USB_DESCTYPE_SSPEED_HUB = 0x2a, 64 USB_DESCTYPE_SSPEED_EP_COMPANION = 0x30 56 65 /* USB_DESCTYPE_ = */ 57 66 } usb_descriptor_type_t; … … 92 101 /** Number of possible configurations. */ 93 102 uint8_t configuration_count; 94 } __attribute__ 103 } __attribute__((packed)) usb_standard_device_descriptor_t; 95 104 96 105 /** USB device qualifier decriptor is basically a cut down version of the device … … 120 129 uint8_t configuration_count; 121 130 uint8_t reserved; 122 } __attribute__ 131 } __attribute__((packed)) usb_standard_device_qualifier_descriptor_t; 123 132 124 133 /** Standard USB configuration descriptor. … … 147 156 */ 148 157 uint8_t max_power; 149 } __attribute__ 158 } __attribute__((packed)) usb_standard_configuration_descriptor_t; 150 159 151 160 /** USB Other Speed Configuration descriptor shows values that would change … … 182 191 /** String descriptor describing this interface. */ 183 192 uint8_t str_interface; 184 } __attribute__ 193 } __attribute__((packed)) usb_standard_interface_descriptor_t; 185 194 186 195 /** Standard USB endpoint descriptor. … … 193 202 /** Endpoint address together with data flow direction. */ 194 203 uint8_t endpoint_address; 204 #define USB_ED_GET_EP(ed) ((ed).endpoint_address & 0xf) 205 #define USB_ED_GET_DIR(ed) (!(((ed).endpoint_address >> 7) & 0x1)) 206 195 207 /** Endpoint attributes. 196 208 * Includes transfer type (usb_transfer_type_t). 197 209 */ 198 210 uint8_t attributes; 211 #define USB_ED_GET_TRANSFER_TYPE(ed) ((ed).attributes & 0x3) 199 212 /** Maximum packet size. 200 213 * Lower 10 bits represent the actuall size … … 202 215 * HS INT and ISO transfers. */ 203 216 uint16_t max_packet_size; 204 205 #define ED_MPS_PACKET_SIZE_MASK 0x3ff 206 #define ED_MPS_PACKET_SIZE_GET(value) \ 207 ((value) & ED_MPS_PACKET_SIZE_MASK) 208 #define ED_MPS_TRANS_OPPORTUNITIES_GET(value) \ 209 ((((value) >> 10) & 0x3) + 1) 210 211 /** Polling interval in milliseconds. 212 * Ignored for bulk and control endpoints. 213 * Isochronous endpoints must use value 1. 214 * Interrupt endpoints any value from 1 to 255. 217 #define USB_ED_GET_MPS(ed) \ 218 (uint16_usb2host((ed).max_packet_size) & 0x7ff) 219 #define USB_ED_GET_ADD_OPPS(ed) \ 220 ((uint16_usb2host((ed).max_packet_size) >> 11) & 0x3) 221 /** Polling interval. Different semantics for various (speed, type) 222 * pairs. 215 223 */ 216 224 uint8_t poll_interval; 217 } __attribute__ ((packed)) usb_standard_endpoint_descriptor_t; 225 } __attribute__((packed)) usb_standard_endpoint_descriptor_t; 226 227 /** Superspeed USB endpoint companion descriptor. 228 * See USB 3 specification, section 9.6.7. 229 */ 230 typedef struct { 231 /** Size of this descriptor in bytes */ 232 uint8_t length; 233 /** Descriptor type (USB_DESCTYPE_SSPEED_EP_COMPANION). */ 234 uint8_t descriptor_type; 235 /** The maximum number of packets the endpoint can send 236 * or receive as part of a burst. Valid values are from 0 to 15. 237 * The endpoint can only burst max_burst + 1 packets at a time. 238 */ 239 uint8_t max_burst; 240 /** Valid only for bulk and isochronous endpoints. 241 * For bulk endpoints, this field contains the amount of streams 242 * supported by the endpoint. 243 * For isochronous endpoints, this field contains maximum 244 * number of packets supported within a service interval. 245 * Warning: the values returned by macros may not make any sense 246 * for specific endpoint types. 247 */ 248 uint8_t attributes; 249 #define USB_SSC_MAX_STREAMS(sscd) ((sscd).attributes & 0x1f) 250 #define USB_SSC_MULT(sscd) ((sscd).attributes & 0x3) 251 /** The total number of bytes this endpoint will transfer 252 * every service interval (SI). 253 * This field is only valid for periodic endpoints. 254 */ 255 uint16_t bytes_per_interval; 256 } __attribute__((packed)) usb_superspeed_endpoint_companion_descriptor_t; 218 257 219 258 /** Part of standard USB HID descriptor specifying one class descriptor. … … 226 265 /** Length of class-specific descriptor in bytes. */ 227 266 uint16_t length; 228 } __attribute__ 267 } __attribute__((packed)) usb_standard_hid_class_descriptor_info_t; 229 268 230 269 /** Standard USB HID descriptor. … … 257 296 /** First mandatory class descriptor (Report) info. */ 258 297 usb_standard_hid_class_descriptor_info_t report_desc_info; 259 } __attribute__ 298 } __attribute__((packed)) usb_standard_hid_descriptor_t; 260 299 261 300 #endif
Note:
See TracChangeset
for help on using the changeset viewer.