How to mark memory pages as little endian?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to mark memory pages as little endian?

Jump to solution
1,488 Views
pete1
Contributor I

I am working with a P3041 processor.  We have a PCI board that DMA data in little endian format. What Linux function can I call to set these pages to be accessed in little endian format?  I know the MAS2 register has a bit for this.  Does Linux have support to set this bit?

Thanks.

0 Kudos
Reply
1 Solution
1,260 Views
scottwood
NXP Employee
NXP Employee

Linux does not support this.  You can use byte-swapping instructions (e.g. lwbrx, stwbrx).

If this is a kernel driver, use swapping functions like cpu_to_be32() and be32_to_cpu().  If it's a powerpc-specific kernel driver, functions such as ld_le32() and st_le32() are available to use the byte-swapping instructions, but these do not appear to be supported on any other architecture.

View solution in original post

0 Kudos
Reply
1 Reply
1,261 Views
scottwood
NXP Employee
NXP Employee

Linux does not support this.  You can use byte-swapping instructions (e.g. lwbrx, stwbrx).

If this is a kernel driver, use swapping functions like cpu_to_be32() and be32_to_cpu().  If it's a powerpc-specific kernel driver, functions such as ld_le32() and st_le32() are available to use the byte-swapping instructions, but these do not appear to be supported on any other architecture.

0 Kudos
Reply