Other Parts Discussed in Thread: OMAPL138
Hello,
I am using a bit field structure to read/write a 16-bit device on the EMIF bus on an OMAPL138. This device prohibits byte access to its registers. In other words, all reads and writes to the registers of this device must be 16-bit access on even addresses.
For reasons of code readability and maintenance, I wish to use I bit field struct to access these registers. An example of such a struct is as follows:
typedef struct S_RT_ADC_CONFIG
{
unsigned short SOURCE : 2; /* b0:b1 */
unsigned short SCALE : 2; /* b2:b3 */
unsigned short ADC0_PRESENCE : 1; /* b4 */
unsigned short ADC1_PRESENCE : 1; /* b5 */
unsigned short ADC2_PRESENCE : 1; /* b6 */
unsigned short ADC3_PRESENCE : 1; /* b7 */
unsigned short BITS : 2; /* b8:b9 */
unsigned short EN : 1; /* b10 */
unsigned short UNUSED : 5; /* b11:b15 */
} S_RT_ADC_CONFIG;
Once compiled, the assembly to access these fields result in 8-bit accesses to the hardware register. Is there anyway I can ensure that any and all accesses using this strucuture definition is done using 16-bit accesses only?
Thanks,
Matt