[Buildroot] endian issue

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Sat May 15 16:33:21 UTC 2010

On Sat, 15 May 2010 17:26:57 +0200
Marcel <korgull at home.nl> wrote:

> If I wish to do that, how do I detect the endianness of a sytem and
> do I need to reformat my data in my drivers for this ? If so, isn't
> that a pure waste of cpu cycles for the sake of reusable code ?
> If I can do this without any speed sacrifice than I will do it, if
> not....than it's simply not an option for this system.

If your driver is in the kernel, tust use the kernel functions
be16_to_cpu(), be32_to_cpu(), etc. They will automatically do the
appropriate conversion depending on the CPU endianess.

Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.

More information about the buildroot mailing list