How to mark memory pages as little endian?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

How to mark memory pages as little endian?

跳至解决方案
1,958 次查看
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 项奖励
回复
1 解答
1,730 次查看
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 项奖励
回复
1 回复
1,731 次查看
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 项奖励
回复