
Dear Vadim Bendebury,
In message CAC3GErEyjcB=Cbhex4X8SQ1QbVvBGCR-=fqd5jb0dmU04kcBbw@mail.gmail.com you wrote:
so, this chip has five different areas (localities) which have the same structure, and are mapped at certain regular offsets inside the chip.
thus the structure describing the chip would be something like
struct locality { u16 field_a; u8 field_b;
insert here:
u8 reserved[3];
u32 field_c; .. u8 padding[<padding size>]; } __packed;
...and omit the "__packed" as this will only cause major PITA rather sooner than later.
And better use "standard" types like uint8_t and uint32_t.
struct tmp_chip { struct locality localities[5]; } __packed;
Again, without the "__packed".
which is very compiler dependent, but probably not the only place in u-boot, so I could live with that if you could.
Actually this is not compiler dependent, if you manyally arrange for correct alignment (and necessary padding), and if you omit any "useful" attributes like about padding.
Yet another inconvenience though is the requirement to be able to trace accesses to the registers. Some of the registers can be accessed in 32 bit mode or 8 bit mode, and this determines how many bytes get
Can you not always use one of the modes only?
What I am getting at is that the code is much better readable as it is now even though it is in violation of the 'use structure to access registers' requirement.
The purpose is to enable the compiler to perform type checking.
Best regards,
Wolfgang Denk