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.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
* Copyright (c) 2019 Ha Thach (tinyusb.org)
|
||||
@@ -277,7 +277,11 @@ typedef struct TU_ATTR_PACKED
|
||||
struct {
|
||||
uint8_t handle_call : 1; ///< 0 - Device sends/receives call management information only over the Communications Class interface. 1 - Device can send/receive call management information over a Data Class interface.
|
||||
uint8_t send_recv_call : 1; ///< 0 - Device does not handle call management itself. 1 - Device handles call management itself.
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint8_t unused : 6;
|
||||
#else
|
||||
uint8_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
} bmCapabilities;
|
||||
|
||||
uint8_t bDataInterface;
|
||||
@@ -290,7 +294,11 @@ typedef struct TU_ATTR_PACKED
|
||||
uint8_t support_line_request : 1; ///< Device supports the request combination of Set_Line_Coding, Set_Control_Line_State, Get_Line_Coding, and the notification Serial_State.
|
||||
uint8_t support_send_break : 1; ///< Device supports the request Send_Break
|
||||
uint8_t support_notification_network_connection : 1; ///< Device supports the notification Network_Connection.
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint8_t unused : 4;
|
||||
#else
|
||||
uint8_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
}cdc_acm_capability_t;
|
||||
|
||||
TU_VERIFY_STATIC(sizeof(cdc_acm_capability_t) == 1, "mostly problem with compiler");
|
||||
@@ -316,7 +324,11 @@ typedef struct TU_ATTR_PACKED
|
||||
uint8_t require_pulse_setup : 1; ///< Device requires extra Pulse_Setup request during pulse dialing sequence to disengage holding circuit.
|
||||
uint8_t support_aux_request : 1; ///< Device supports the request combination of Set_Aux_Line_State, Ring_Aux_Jack, and notification Aux_Jack_Hook_State.
|
||||
uint8_t support_pulse_request : 1; ///< Device supports the request combination of Pulse_Setup, Send_Pulse, and Set_Pulse_Time.
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint8_t unused : 5;
|
||||
#else
|
||||
uint8_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
} bmCapabilities;
|
||||
}cdc_desc_func_direct_line_management_t;
|
||||
|
||||
@@ -344,7 +356,11 @@ typedef struct TU_ATTR_PACKED
|
||||
uint8_t simple_mode : 1;
|
||||
uint8_t standalone_mode : 1;
|
||||
uint8_t computer_centric_mode : 1;
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint8_t unused : 5;
|
||||
#else
|
||||
uint8_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
} bmCapabilities;
|
||||
}cdc_desc_func_telephone_operational_modes_t;
|
||||
|
||||
@@ -363,7 +379,11 @@ typedef struct TU_ATTR_PACKED
|
||||
uint32_t incoming_distinctive : 1; ///< 0 : Reports only incoming ringing. 1 : Reports incoming distinctive ringing patterns.
|
||||
uint32_t dual_tone_multi_freq : 1; ///< 0 : Cannot report dual tone multi-frequency (DTMF) digits input remotely over the telephone line. 1 : Can report DTMF digits input remotely over the telephone line.
|
||||
uint32_t line_state_change : 1; ///< 0 : Does not support line state change notification. 1 : Does support line state change notification
|
||||
#if CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT
|
||||
uint32_t unused : 26;
|
||||
#else
|
||||
uint32_t : 0;
|
||||
#endif /* CFG_TUSB_ALT_BIT_PACKING_ALIGNMENT */
|
||||
} bmCapabilities;
|
||||
}cdc_desc_func_telephone_call_state_reporting_capabilities_t;
|
||||
|
||||
|
Reference in New Issue
Block a user