How to write portable device drivers?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Please correct me, if I'm wrong, but that's my understanding.

include/linux/byteorder/generic.h defines macros, which take both the
CPU endianess and the endianess of the peripherial device you want to
access into account.

e.g. cpu_to_le32  will no matter what's the endianess of the CPU write
to a little endian 32 address (do the swapping or not)

but there are also in lib/iomap.c macros like iowrite32, which don't
seem to take the CPU endianess into account

Now looking e.g. at drivers/net/e100.c both kind of macros are used.

e.g. ioread32 and also cpu_to_le32

The iowritexxx macros seem to boil down to outxx macros and it looks
like iomap needs to be called before - maybe the endianess of the CPU is
taken into account there, if so it's not obvious to me;)

I'm a bit confused since we seem to have I/O ports and I/O memory.

Can you please elaborate a bit when to use what and what happens with
the CPU endianess in case of ioread/write macros?

My goal is to understand how to write portable drivers which can be used
with all kinds of funny CPU / peripheral endianess combinations.

Regards,

Robert

..."Everything should be built top-down, except the first time."

My public pgp key is available at:
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x90320BF1




_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux