Skip to content

Commit b0829ed

Browse files
authored
Merge pull request #2586 from hathach/fix-2097
2 parents b15b560 + 1e41b97 commit b0829ed

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/common/tusb_types.h

+10-21
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,8 @@
2424
* This file is part of the TinyUSB stack.
2525
*/
2626

27-
/** \ingroup group_usb_definitions
28-
* \defgroup USBDef_Type USB Types
29-
* @{ */
30-
31-
#ifndef _TUSB_TYPES_H_
32-
#define _TUSB_TYPES_H_
27+
#ifndef TUSB_TYPES_H_
28+
#define TUSB_TYPES_H_
3329

3430
#include <stdbool.h>
3531
#include <stdint.h>
@@ -212,8 +208,8 @@ typedef enum {
212208
} device_capability_type_t;
213209

214210
enum {
215-
TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = TU_BIT(5),
216-
TUSB_DESC_CONFIG_ATT_SELF_POWERED = TU_BIT(6),
211+
TUSB_DESC_CONFIG_ATT_REMOTE_WAKEUP = 1u << 5,
212+
TUSB_DESC_CONFIG_ATT_SELF_POWERED = 1u << 6,
217213
};
218214

219215
#define TUSB_DESC_CONFIG_POWER_MA(x) ((x)/2)
@@ -274,11 +270,11 @@ TU_ATTR_BIT_FIELD_ORDER_BEGIN
274270
typedef struct TU_ATTR_PACKED {
275271
uint8_t bLength ; ///< Size of this descriptor in bytes.
276272
uint8_t bDescriptorType ; ///< DEVICE Descriptor Type.
277-
uint16_t bcdUSB ; ///< BUSB Specification Release Number in Binary-Coded Decimal (i.e., 2.10 is 210H). This field identifies the release of the USB Specification with which the device and its descriptors are compliant.
273+
uint16_t bcdUSB ; ///< BUSB Specification Release Number in Binary-Coded Decimal (i.e., 2.10 is 210H).
278274

279-
uint8_t bDeviceClass ; ///< Class code (assigned by the USB-IF). \li If this field is reset to zero, each interface within a configuration specifies its own class information and the various interfaces operate independently. \li If this field is set to a value between 1 and FEH, the device supports different class specifications on different interfaces and the interfaces may not operate independently. This value identifies the class definition used for the aggregate interfaces. \li If this field is set to FFH, the device class is vendor-specific.
280-
uint8_t bDeviceSubClass ; ///< Subclass code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass field. \li If the bDeviceClass field is reset to zero, this field must also be reset to zero. \li If the bDeviceClass field is not set to FFH, all values are reserved for assignment by the USB-IF.
281-
uint8_t bDeviceProtocol ; ///< Protocol code (assigned by the USB-IF). These codes are qualified by the value of the bDeviceClass and the bDeviceSubClass fields. If a device supports class-specific protocols on a device basis as opposed to an interface basis, this code identifies the protocols that the device uses as defined by the specification of the device class. \li If this field is reset to zero, the device does not use class-specific protocols on a device basis. However, it may use classspecific protocols on an interface basis. \li If this field is set to FFH, the device uses a vendor-specific protocol on a device basis.
275+
uint8_t bDeviceClass ; ///< Class code (assigned by the USB-IF).
276+
uint8_t bDeviceSubClass ; ///< Subclass code (assigned by the USB-IF).
277+
uint8_t bDeviceProtocol ; ///< Protocol code (assigned by the USB-IF).
282278
uint8_t bMaxPacketSize0 ; ///< Maximum packet size for endpoint zero (only 8, 16, 32, or 64 are valid). For HS devices is fixed to 64.
283279

284280
uint16_t idVendor ; ///< Vendor ID (assigned by the USB-IF).
@@ -493,15 +489,10 @@ TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_edpt_addr(uint8_t num, uint8_t di
493489
}
494490

495491
TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_edpt_packet_size(tusb_desc_endpoint_t const* desc_ep) {
496-
return tu_le16toh(desc_ep->wMaxPacketSize) & TU_GENMASK(10, 0);
492+
return tu_le16toh(desc_ep->wMaxPacketSize) & 0x7FF;
497493
}
498494

499495
#if CFG_TUSB_DEBUG
500-
TU_ATTR_ALWAYS_INLINE static inline const char *tu_edpt_dir_str(tusb_dir_t dir) {
501-
tu_static const char *str[] = {"out", "in"};
502-
return str[dir];
503-
}
504-
505496
TU_ATTR_ALWAYS_INLINE static inline const char *tu_edpt_type_str(tusb_xfer_type_t t) {
506497
tu_static const char *str[] = {"control", "isochronous", "bulk", "interrupt"};
507498
return str[t];
@@ -541,6 +532,4 @@ uint8_t const * tu_desc_find3(uint8_t const* desc, uint8_t const* end, uint8_t b
541532
}
542533
#endif
543534

544-
#endif /* _TUSB_TYPES_H_ */
545-
546-
/** @} */
535+
#endif // TUSB_TYPES_H_

0 commit comments

Comments
 (0)