summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorJeremiah McCarthy <[email protected]>2021-02-16 10:40:06 -0500
committerJeremiah McCarthy <[email protected]>2021-02-16 10:43:52 -0500
commitf8fbc0930bd17b263ca702c0beb9f83af4429d0a (patch)
treeb47b6a6f41cd8115d4a7d6acf2af4e2872f7a86c /src/common
parent09868434cd9f53394350cce682333ada97f796c3 (diff)
Add alternate bitfield padding option
Adds configuration option CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT, which substitutes bitfield variable " : 0" padding syntax with an unused variable of size equal to the remaining number of bits. This change resolves aligned access issues for some platforms. Default behavior is original if the option is not explicitly enabled.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tusb_types.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/common/tusb_types.h b/src/common/tusb_types.h
index 2b4ceb69c..e57dc26f5 100644
--- a/src/common/tusb_types.h
+++ b/src/common/tusb_types.h
@@ -1,4 +1,4 @@
-/*
+/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org)
@@ -342,7 +342,11 @@ typedef struct TU_ATTR_PACKED
struct TU_ATTR_PACKED {
uint16_t size : 11; ///< Maximum packet size this endpoint is capable of sending or receiving when this configuration is selected. \n For isochronous endpoints, this value is used to reserve the bus time in the schedule, required for the per-(micro)frame data payloads. The pipe may, on an ongoing basis, actually use less bandwidth than that reserved. The device reports, if necessary, the actual bandwidth used via its normal, non-USB defined mechanisms. \n For all endpoints, bits 10..0 specify the maximum packet size (in bytes). \n For high-speed isochronous and interrupt endpoints: \n Bits 12..11 specify the number of additional transaction opportunities per microframe: \n- 00 = None (1 transaction per microframe) \n- 01 = 1 additional (2 per microframe) \n- 10 = 2 additional (3 per microframe) \n- 11 = Reserved \n Bits 15..13 are reserved and must be set to zero.
uint16_t hs_period_mult : 2;
+#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
+ uint16_t unused : 3;
+#else
uint16_t : 0;
+#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
}wMaxPacketSize;
uint8_t bInterval ; ///< Interval for polling endpoint for data transfers. Expressed in frames or microframes depending on the device operating speed (i.e., either 1 millisecond or 125 us units). \n- For full-/high-speed isochronous endpoints, this value must be in the range from 1 to 16. The bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$). \n- For full-/low-speed interrupt endpoints, the value of this field may be from 1 to 255. \n- For high-speed interrupt endpoints, the bInterval value is used as the exponent for a \f$ 2^(bInterval-1) \f$ value; e.g., a bInterval of 4 means a period of 8 (\f$ 2^(4-1) \f$) . This value must be from 1 to 16. \n- For high-speed bulk/control OUT endpoints, the bInterval must specify the maximum NAK rate of the endpoint. A value of 0 indicates the endpoint never NAKs. Other values indicate at most 1 NAK each bInterval number of microframes. This value must be in the range from 0 to 255. \n Refer to Chapter 5 of USB 2.0 specification for more information.