Help with cross-endian bitfields?
jlquinn at us.ibm.com
jlquinn at us.ibm.com
Sat May 6 06:47:43 EST 2000
The data is read from the device as a complete byte, so that aspect is OK.
However, the byte contains multiple pieces of information that can be
conveniently accessed using bitfields. It's less convenient to write
macros that mask and shift the appropriate piece, although it will be
obviously portable.
Jerry
Dan Malek <dan at netx4.com>@lists.linuxppc.org on 05/05/2000 04:05:52 PM
jlquinn at us.ibm.com wrote:
> Hi, all. I'm working on getting the Advansys driver working and what
> appears to be the final stumbling block is a difference in the layout of
> bitfields between little-endian and big-endian systems.
IMHO, bit fields are not normally a good thing to be using if this is
describing a real device register. The compiler is able to read/write
in ways that may not be proper for hardware access. For device registers
and when this is a data structure in memory, the cross-platform method
of using macros for reading writing 16- and 32-bit values and then 'C'
operators for testing/setting bits has worked pretty well in the past.....
-- Dan
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev
mailing list