|
|
Subscribe / Log in / New account

Big-endian I/O memory

The kernel provides a set of functions for working easily with I/O memory. Those functions assume that the memory is stored in little-endian byte order. This assumption is usually valid - PCI peripherals, for example, are supposed to always use that ordering. There are devices out there, however, which export big-endian I/O memory. Dealing with these devices has required implementing special-purpose code in the drivers.

One of the few significant changes merged after 2.6.12-rc2 is a new set of I/O memory functions for working with big-endian devices. These functions are:

    unsigned int ioread16be(void __iomem *addr);
    unsigned int ioread32be(void __iomem *addr)
    void iowrite16be (u16 datum, void __iomem *addr);
    viod iowrite32be (u32 datum, void __iomem *addr);

These functions will handle the necessary byte swapping (or lack thereof) to present properly-ordered values on the host architecture. They are exported to modules.

Index entries for this article
KernelI/O memory


to post comments

Big-endian I/O memory

Posted Apr 22, 2005 15:59 UTC (Fri) by scarabaeus (guest, #7142) [Link]

>  void iowrite16be (u16 datum, void __iomem *addr);
>  viod iowrite32be (u32 datum, void __iomem *addr);
    ^^

> These functions will handle the necessary byte swapping (or lack thereof) to present properly-ordered values on the host architecture.

Hmmm - looks like you took "byte-swapping" a little too literally there! ;-)


Copyright © 2005, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds