From f8fbc0930bd17b263ca702c0beb9f83af4429d0a Mon Sep 17 00:00:00 2001 From: Jeremiah McCarthy Date: Tue, 16 Feb 2021 10:40:06 -0500 Subject: 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. --- src/host/ohci/ohci.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/host/ohci') diff --git a/src/host/ohci/ohci.h b/src/host/ohci/ohci.h index bfcdaf9a3..76d6fff61 100644 --- a/src/host/ohci/ohci.h +++ b/src/host/ohci/ohci.h @@ -1,4 +1,4 @@ -/* +/* * The MIT License (MIT) * * Copyright (c) 2019 Ha Thach (tinyusb.org) @@ -208,7 +208,11 @@ typedef volatile struct uint32_t interrupt_routing : 1; uint32_t remote_wakeup_connected : 1; uint32_t remote_wakeup_enale : 1; - uint32_t : 0; +#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT + uint32_t unused : 21; +#else + uint32_t : 0; +#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */ }control_bit; }; @@ -276,7 +280,11 @@ typedef volatile struct uint32_t port_suspend_status_change : 1; uint32_t port_over_current_indicator_change : 1; uint32_t port_reset_status_change : 1; +#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT + uint32_t unused : 11; +#else uint32_t : 0; +#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */ }rhport_status_bit[2]; }; }ohci_registers_t; -- cgit v1.3.1