I tried to align the structure members, but it seems the MCUXpresso compiler doesn't.
I created two data types based on the original spdif_config_t as below:
typedef struct _spdif_config_t
{
bool isTxAutoSync; /*!< If auto sync mechanism open */
bool isRxAutoSync; /*!< If auto sync mechanism open */
uint8_t DPLLClkSource; /*!< SPDIF DPLL clock source, range from 0~15, meaning is chip-specific */
uint8_t txClkSource; /*!< SPDIF tx clock source, range from 0~7, meaning is chip-specific */
spdif_rxfull_select_t rxFullSelect; /*!< SPDIF rx buffer full select */
spdif_txempty_select_t txFullSelect; /*!< SPDIF tx buffer empty select */
spdif_uchannel_source_t uChannelSrc; /*!< U channel source */
spdif_tx_source_t txSource; /*!< SPDIF tx data source */
spdif_validity_config_t validityConfig; /*!< Validity flag config */
spdif_gain_select_t gain; /*!< Rx receive clock measure gain parameter. */
} spdif_config_t;
typedef struct _spdif_config_t1
{
bool isTxAutoSync; /*!< If auto sync mechanism open */
bool isRxAutoSync; /*!< If auto sync mechanism open */
uint8_t DPLLClkSource; /*!< SPDIF DPLL clock source, range from 0~15, meaning is chip-specific */
uint8_t txClkSource; /*!< SPDIF tx clock source, range from 0~7, meaning is chip-specific */
spdif_rxfull_select_t rxFullSelect; /*!< SPDIF rx buffer full select */
spdif_txempty_select_t txFullSelect; /*!< SPDIF tx buffer empty select */
spdif_uchannel_source_t uChannelSrc; /*!< U channel source */
spdif_tx_source_t txSource; /*!< SPDIF tx data source */
spdif_validity_config_t validityConfig; /*!< Validity flag config */
spdif_gain_select_t gain; /*!< Rx receive clock measure gain parameter. */
} spdif_config_t1_t __attribute__(aligned(4));
#pragma pack(push, 4)
typedef struct _spdif_config_t2
{
bool isTxAutoSync; /*!< If auto sync mechanism open */
bool isRxAutoSync; /*!< If auto sync mechanism open */
uint8_t DPLLClkSource; /*!< SPDIF DPLL clock source, range from 0~15, meaning is chip-specific */
uint8_t txClkSource; /*!< SPDIF tx clock source, range from 0~7, meaning is chip-specific */
spdif_rxfull_select_t rxFullSelect; /*!< SPDIF rx buffer full select */
spdif_txempty_select_t txFullSelect; /*!< SPDIF tx buffer empty select */
spdif_uchannel_source_t uChannelSrc; /*!< U channel source */
spdif_tx_source_t txSource; /*!< SPDIF tx data source */
spdif_validity_config_t validityConfig; /*!< Validity flag config */
spdif_gain_select_t gain; /*!< Rx receive clock measure gain parameter. */
} spdif_config_t2_t;
#pragma pack(pop)
I printed the size using sizeof(spdif_config_t/spdif_config_t1_t/spdif_config_t2_t), all of the sizes 10.
However sizeof(spdif_config_t) should be different from sizeof(spdif_config_t1_t/spdif_config_t2_t) if the alignment works.
Can anybody help with this issue?