another endianness issue...

Benjamin Herrenschmidt benh at kernel.crashing.org
Mon Jun 25 00:50:42 EST 2001


>Is it correct ?
>And where can I find the cpu_to_le32() and le32_to_cpu() declaration or
>a guide on how to use them ?

If you use readl/writel, you don't need to byteswap as it's done for
you by those functions. If you used readb/writeb, then you are reading
bytes, swapping has no meaning.

Also, don't hard code 0x0002, better #define a constant, it makes the
code more readable.

cpu_to_le32/le32_to_cpu() are necessary if you are either not using
readx/writex accessors, or when storing datas in memory that the
controller will read directly (bus master)

Ben.


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list