Changeset df6ded8 in mainline for uspace/lib/usb/include
- Timestamp:
- 2018-02-28T16:37:50Z (8 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)
- Location:
- uspace/lib/usb/include/usb
- Files:
-
- 2 added
- 4 edited
-
classes/hub.h (modified) (5 diffs)
-
descriptor.h (modified) (11 diffs)
-
dma_buffer.h (added)
-
port.h (added)
-
request.h (modified) (4 diffs)
-
usb.h (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/classes/hub.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2010 Matus Dekanek 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 48 49 USB_HUB_FEATURE_HUB_OVER_CURRENT = 1, 49 50 USB_HUB_FEATURE_PORT_CONNECTION = 0, 50 USB _HUB_FEATURE_PORT_ENABLE = 1,51 USB _HUB_FEATURE_PORT_SUSPEND = 2,51 USB2_HUB_FEATURE_PORT_ENABLE = 1, 52 USB2_HUB_FEATURE_PORT_SUSPEND = 2, 52 53 USB_HUB_FEATURE_PORT_OVER_CURRENT = 3, 53 54 USB_HUB_FEATURE_PORT_RESET = 4, 55 USB3_HUB_FEATURE_PORT_LINK_STATE = 5, 54 56 USB_HUB_FEATURE_PORT_POWER = 8, 55 USB_HUB_FEATURE_PORT_LOW_SPEED = 9, 56 USB_HUB_FEATURE_PORT_HIGH_SPEED = 10, 57 USB2_HUB_FEATURE_PORT_LOW_SPEED = 9, 57 58 USB_HUB_FEATURE_C_PORT_CONNECTION = 16, 58 USB _HUB_FEATURE_C_PORT_ENABLE = 17,59 USB _HUB_FEATURE_C_PORT_SUSPEND = 18,59 USB2_HUB_FEATURE_C_PORT_ENABLE = 17, 60 USB2_HUB_FEATURE_C_PORT_SUSPEND = 18, 60 61 USB_HUB_FEATURE_C_PORT_OVER_CURRENT = 19, 61 62 USB_HUB_FEATURE_C_PORT_RESET = 20, 62 USB_HUB_FEATURE_PORT_TEST = 21, 63 USB_HUB_FEATURE_PORT_INDICATOR = 22 63 USB2_HUB_FEATURE_PORT_TEST = 21, 64 USB2_HUB_FEATURE_PORT_INDICATOR = 22, 65 USB3_HUB_FEATURE_C_PORT_LINK_STATE = 25, 66 USB3_HUB_FEATURE_BH_PORT_RESET = 28, 67 USB3_HUB_FEATURE_C_BH_PORT_RESET = 29, 64 68 /* USB_HUB_FEATURE_ = , */ 65 69 } usb_hub_class_feature_t; 66 70 71 /** 72 * Dword holding port status and changes flags. 73 * 74 * For more information refer to tables 11-15 and 11-16 in 75 * "Universal Serial Bus Specification Revision 1.1" pages 274 and 277 76 * (290 and 293 in pdf) 77 * 78 * Beware that definition of bits changed between USB 2 and 3, 79 * so some fields are prefixed with USB2 or USB3 instead. 80 */ 81 typedef uint32_t usb_port_status_t; 82 83 #define USB_HUB_PORT_STATUS_BIT(bit) (uint32_usb2host(1 << (bit))) 84 #define USB_HUB_PORT_STATUS_CONNECTION USB_HUB_PORT_STATUS_BIT(0) 85 #define USB_HUB_PORT_STATUS_ENABLE USB_HUB_PORT_STATUS_BIT(1) 86 #define USB2_HUB_PORT_STATUS_SUSPEND USB_HUB_PORT_STATUS_BIT(2) 87 #define USB_HUB_PORT_STATUS_OC USB_HUB_PORT_STATUS_BIT(3) 88 #define USB_HUB_PORT_STATUS_RESET USB_HUB_PORT_STATUS_BIT(4) 89 90 #define USB2_HUB_PORT_STATUS_POWER USB_HUB_PORT_STATUS_BIT(8) 91 #define USB2_HUB_PORT_STATUS_LOW_SPEED USB_HUB_PORT_STATUS_BIT(9) 92 #define USB3_HUB_PORT_STATUS_POWER USB_HUB_PORT_STATUS_BIT(9) 93 #define USB2_HUB_PORT_STATUS_HIGH_SPEED USB_HUB_PORT_STATUS_BIT(10) 94 #define USB2_HUB_PORT_STATUS_TEST USB_HUB_PORT_STATUS_BIT(11) 95 #define USB2_HUB_PORT_STATUS_INDICATOR USB_HUB_PORT_STATUS_BIT(12) 96 97 #define USB_HUB_PORT_STATUS_C_CONNECTION USB_HUB_PORT_STATUS_BIT(16) 98 #define USB2_HUB_PORT_STATUS_C_ENABLE USB_HUB_PORT_STATUS_BIT(17) 99 #define USB2_HUB_PORT_STATUS_C_SUSPEND USB_HUB_PORT_STATUS_BIT(18) 100 #define USB_HUB_PORT_STATUS_C_OC USB_HUB_PORT_STATUS_BIT(19) 101 #define USB_HUB_PORT_STATUS_C_RESET USB_HUB_PORT_STATUS_BIT(20) 102 #define USB3_HUB_PORT_STATUS_C_BH_RESET USB_HUB_PORT_STATUS_BIT(21) 103 #define USB3_HUB_PORT_STATUS_C_LINK_STATE USB_HUB_PORT_STATUS_BIT(22) 104 #define USB3_HUB_PORT_STATUS_C_CONFIG_ERROR USB_HUB_PORT_STATUS_BIT(23) 67 105 68 106 /** Header of standard hub descriptor without the "variadic" part. */ … … 71 109 uint8_t length; 72 110 73 /** Descriptor type (0x29 ). */111 /** Descriptor type (0x29 or 0x2a for superspeed hub). */ 74 112 uint8_t descriptor_type; 75 113 … … 116 154 #define HUB_CHAR_OC_PER_PORT_FLAG (1 << 3) 117 155 #define HUB_CHAR_NO_OC_FLAG (1 << 4) 156 157 /* These are invalid for superspeed hub */ 118 158 #define HUB_CHAR_TT_THINK_16 (1 << 5) 119 159 #define HUB_CHAR_TT_THINK_8 (1 << 6) … … 138 178 */ 139 179 uint8_t max_current; 140 } __attribute__ ((packed)) usb_hub_descriptor_header_t;180 } __attribute__((packed)) usb_hub_descriptor_header_t; 141 181 142 182 /** One bit for the device and one bit for every port */ 143 183 #define STATUS_BYTES(ports) ((1 + ports + 7) / 8) 144 184 145 /** @brief usb hub specific request types. 146 * 147 * For more information see Universal Serial Bus Specification Revision 1.1 chapter 11.16.2 185 /** 186 * @brief usb hub specific request types. 148 187 */ 149 188 typedef enum { 150 /** This request resets a value reported in the hub status. */ 151 USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE = 0x20, 152 /** This request resets a value reported in the port status. */ 153 USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE = 0x23, 154 /** This is an optional per-port diagnostic request that returns the bus state value, as sampled at the last EOF2 point. */ 155 USB_HUB_REQ_TYPE_GET_STATE = 0xA3, 156 /** This request returns the hub descriptor. */ 157 USB_HUB_REQ_TYPE_GET_DESCRIPTOR = 0xA0, 158 /** This request returns the current hub status and the states that have changed since the previous acknowledgment. */ 159 USB_HUB_REQ_TYPE_GET_HUB_STATUS = 0xA0, 160 /** This request returns the current port status and the current value of the port status change bits. */ 161 USB_HUB_REQ_TYPE_GET_PORT_STATUS = 0xA3, 162 /** This request overwrites the hub descriptor. */ 163 USB_HUB_REQ_TYPE_SET_DESCRIPTOR = 0x20, 164 /** This request sets a value reported in the hub status. */ 165 USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20, 166 /** This request sets a value reported in the port status. */ 167 USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23 189 /** This request resets a value reported in the hub status. */ 190 USB_HUB_REQ_TYPE_CLEAR_HUB_FEATURE = 0x20, 191 /** This request resets a value reported in the port status. */ 192 USB_HUB_REQ_TYPE_CLEAR_PORT_FEATURE = 0x23, 193 /** 194 * This is an optional per-port diagnostic request that returns the bus 195 * state value, as sampled at the last EOF2 point. 196 */ 197 USB_HUB_REQ_TYPE_GET_STATE = 0xA3, 198 /** This request returns the hub descriptor. */ 199 USB_HUB_REQ_TYPE_GET_DESCRIPTOR = 0xA0, 200 /** 201 * This request returns the current hub status and the states that have 202 * changed since the previous acknowledgment. 203 */ 204 USB_HUB_REQ_TYPE_GET_HUB_STATUS = 0xA0, 205 /** 206 * This request returns the current port status and the current value of the 207 * port status change bits. 208 */ 209 USB_HUB_REQ_TYPE_GET_PORT_STATUS = 0xA3, 210 /** This request overwrites the hub descriptor. */ 211 USB_HUB_REQ_TYPE_SET_DESCRIPTOR = 0x20, 212 /** This request sets a value reported in the hub status. */ 213 USB_HUB_REQ_TYPE_SET_HUB_FEATURE = 0x20, 214 /** 215 * This request sets the value that the hub uses to determine the index 216 * into the Route String Index for the hub. 217 */ 218 USB_HUB_REQ_TYPE_SET_HUB_DEPTH = 0x20, 219 /** This request sets a value reported in the port status. */ 220 USB_HUB_REQ_TYPE_SET_PORT_FEATURE = 0x23, 168 221 } usb_hub_bm_request_type_t; 169 222 170 /** @brief hub class request codes*/ 171 /// \TODO these are duplicit to standart descriptors 223 /** 224 * @brief hub class request codes 225 */ 172 226 typedef enum { 173 /** */ 174 USB_HUB_REQUEST_GET_STATUS = 0, 175 /** */ 176 USB_HUB_REQUEST_CLEAR_FEATURE = 1, 177 /** USB 1.0 only */ 178 USB_HUB_REQUEST_GET_STATE = 2, 179 /** */ 180 USB_HUB_REQUEST_SET_FEATURE = 3, 181 /** */ 182 USB_HUB_REQUEST_GET_DESCRIPTOR = 6, 183 /** */ 184 USB_HUB_REQUEST_SET_DESCRIPTOR = 7, 185 /** */ 186 USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8, 187 /** */ 188 USB_HUB_REQUEST_RESET_TT = 9, 189 /** */ 190 USB_HUB_GET_TT_STATE = 10, 191 /** */ 192 USB_HUB_STOP_TT = 11, 227 USB_HUB_REQUEST_GET_STATUS = 0, 228 USB_HUB_REQUEST_CLEAR_FEATURE = 1, 229 /** USB 1.0 only */ 230 USB_HUB_REQUEST_GET_STATE = 2, 231 USB_HUB_REQUEST_SET_FEATURE = 3, 232 USB_HUB_REQUEST_GET_DESCRIPTOR = 6, 233 USB_HUB_REQUEST_SET_DESCRIPTOR = 7, 234 USB_HUB_REQUEST_CLEAR_TT_BUFFER = 8, 235 USB_HUB_REQUEST_RESET_TT = 9, 236 USB_HUB_GET_TT_STATE = 10, 237 USB_HUB_STOP_TT = 11, 238 /** USB 3+ only */ 239 USB_HUB_REQUEST_SET_HUB_DEPTH = 12, 193 240 } usb_hub_request_t; 194 241 195 242 /** 196 * Maximum size of usb hub descriptor in bytes243 * Maximum size of usb hub descriptor in bytes 197 244 */ 198 245 /* 7 (basic size) + 2*32 (port bitmasks) */ -
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__ ((packed)) usb_standard_device_descriptor_t;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__ ((packed)) usb_standard_device_qualifier_descriptor_t;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__ ((packed)) usb_standard_configuration_descriptor_t;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__ ((packed)) usb_standard_interface_descriptor_t;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__ ((packed)) usb_standard_hid_class_descriptor_info_t;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__ ((packed)) usb_standard_hid_descriptor_t;298 } __attribute__((packed)) usb_standard_hid_descriptor_t; 260 299 261 300 #endif -
uspace/lib/usb/include/usb/request.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2012 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 71 72 #define USB_ENDPOINT_STATUS_HALTED ((uint16_t)(1 << 0)) 72 73 74 /** Size of the USB setup packet */ 75 #define USB_SETUP_PACKET_SIZE 8 76 73 77 /** Device request setup packet. 74 78 * The setup packet describes the request. … … 82 86 #define SETUP_REQUEST_TYPE_DEVICE_TO_HOST (1 << 7) 83 87 #define SETUP_REQUEST_TYPE_HOST_TO_DEVICE (0 << 7) 88 #define SETUP_REQUEST_TYPE_IS_DEVICE_TO_HOST(rt) ((rt) & (1 << 7)) 84 89 #define SETUP_REQUEST_TYPE_GET_TYPE(rt) ((rt >> 5) & 0x3) 85 90 #define SETUP_REQUEST_TYPE_GET_RECIPIENT(rec) (rec & 0x1f) … … 108 113 } __attribute__ ((packed)) usb_device_request_setup_packet_t; 109 114 110 static_assert(sizeof(usb_device_request_setup_packet_t) == 8);115 static_assert(sizeof(usb_device_request_setup_packet_t) == USB_SETUP_PACKET_SIZE); 111 116 112 int usb_request_needs_toggle_reset( 113 const usb_device_request_setup_packet_t *request); 117 #define GET_DEVICE_DESC(size) \ 118 { \ 119 .request_type = SETUP_REQUEST_TYPE_DEVICE_TO_HOST \ 120 | (USB_REQUEST_TYPE_STANDARD << 5) \ 121 | USB_REQUEST_RECIPIENT_DEVICE, \ 122 .request = USB_DEVREQ_GET_DESCRIPTOR, \ 123 .value = uint16_host2usb(USB_DESCTYPE_DEVICE << 8), \ 124 .index = uint16_host2usb(0), \ 125 .length = uint16_host2usb(size), \ 126 }; 127 128 #define SET_ADDRESS(address) \ 129 { \ 130 .request_type = SETUP_REQUEST_TYPE_HOST_TO_DEVICE \ 131 | (USB_REQUEST_TYPE_STANDARD << 5) \ 132 | USB_REQUEST_RECIPIENT_DEVICE, \ 133 .request = USB_DEVREQ_SET_ADDRESS, \ 134 .value = uint16_host2usb(address), \ 135 .index = uint16_host2usb(0), \ 136 .length = uint16_host2usb(0), \ 137 }; 138 139 #define CTRL_PIPE_MIN_PACKET_SIZE 8 114 140 115 141 #endif -
uspace/lib/usb/include/usb/usb.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2010 Vojtech Horky 3 * Copyright (c) 2018 Ondrej Hlavaty, Michal Staruch 3 4 * All rights reserved. 4 5 * … … 39 40 #include <stdint.h> 40 41 #include <types/common.h> 41 #include <usb _iface.h>42 #include <usbhc_iface.h> 42 43 43 44 /** Convert 16bit value from native (host) endianness to USB endianness. */ … … 53 54 #define uint32_usb2host(n) uint32_t_le2host((n)) 54 55 55 const char * usb_str_transfer_type(usb_transfer_type_tt);56 const char * usb_str_transfer_type_short(usb_transfer_type_tt);56 const char *usb_str_transfer_type(usb_transfer_type_t); 57 const char *usb_str_transfer_type_short(usb_transfer_type_t); 57 58 58 59 const char *usb_str_direction(usb_direction_t); … … 61 62 { 62 63 return (s == USB_SPEED_FULL) || (s == USB_SPEED_LOW); 64 } 65 66 static inline bool usb_speed_is_valid(const usb_speed_t s) 67 { 68 return (s >= USB_SPEED_LOW) && (s < USB_SPEED_MAX); 63 69 } 64 70 … … 97 103 static inline bool usb_address_is_valid(usb_address_t a) 98 104 { 99 return (a >= USB_ADDRESS_DEFAULT) && (a <= USB11_ADDRESS_MAX);105 return a <= USB11_ADDRESS_MAX; 100 106 } 101 107 … … 103 109 #define USB_ENDPOINT_DEFAULT_CONTROL 0 104 110 105 /** Maximum endpoint number in USB 1.1. */ 106 #define USB11_ENDPOINT_MAX 16 111 /** Maximum endpoint number in USB */ 112 #define USB_ENDPOINT_MAX 16 113 114 /** There might be two directions for every endpoint number (except 0) */ 115 #define USB_ENDPOINT_COUNT (2 * USB_ENDPOINT_MAX) 107 116 108 117 /** Check USB endpoint for allowed values. … … 115 124 static inline bool usb_endpoint_is_valid(usb_endpoint_t ep) 116 125 { 117 return (ep >= USB_ENDPOINT_DEFAULT_CONTROL) && 118 (ep < USB11_ENDPOINT_MAX); 126 return ep < USB_ENDPOINT_MAX; 119 127 } 120 128 121 /** Check USB target for allowed values (address and endpoint). 129 /** 130 * Check USB target for allowed values (address, endpoint, stream). 122 131 * 123 132 * @param target. 124 133 * @return True, if values are wihtin limits, false otherwise. 125 134 */ 126 static inline bool usb_target_is_valid( usb_target_ttarget)135 static inline bool usb_target_is_valid(const usb_target_t *target) 127 136 { 128 return usb_address_is_valid(target.address) && 129 usb_endpoint_is_valid(target.endpoint); 137 return usb_address_is_valid(target->address) && 138 usb_endpoint_is_valid(target->endpoint); 139 140 // A 16-bit Stream ID is always valid. 130 141 } 131 142 … … 136 147 * @return Whether @p a and @p b points to the same pipe on the same device. 137 148 */ 138 static inline intusb_target_same(usb_target_t a, usb_target_t b)149 static inline bool usb_target_same(usb_target_t a, usb_target_t b) 139 150 { 140 return (a.address == b.address) 141 && (a.endpoint == b.endpoint); 151 return (a.address == b.address) && (a.endpoint == b.endpoint); 142 152 } 143 144 /** General handle type.145 * Used by various USB functions as opaque handle.146 */147 typedef sysarg_t usb_handle_t;148 153 149 154 /** USB packet identifier. */ … … 161 166 USB_PID_SETUP = _MAKE_PID(3, 1), 162 167 163 USB_PID_DATA0 = _MAKE_PID(0 ,3),164 USB_PID_DATA1 = _MAKE_PID(2 ,3),168 USB_PID_DATA0 = _MAKE_PID(0, 3), 169 USB_PID_DATA1 = _MAKE_PID(2, 3), 165 170 166 USB_PID_ACK = _MAKE_PID(0 ,2),167 USB_PID_NAK = _MAKE_PID(2 ,2),168 USB_PID_STALL = _MAKE_PID(3 ,2),171 USB_PID_ACK = _MAKE_PID(0, 2), 172 USB_PID_NAK = _MAKE_PID(2, 2), 173 USB_PID_STALL = _MAKE_PID(3, 2), 169 174 170 USB_PID_PRE = _MAKE_PID(3 ,0),175 USB_PID_PRE = _MAKE_PID(3, 0), 171 176 /* USB_PID_ = _MAKE_PID( ,), */ 172 177 #undef _MAKE_PID
Note:
See TracChangeset
for help on using the changeset viewer.
