This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

ns/dp83902a (NE2000) driver: endianness


(Context: I am porting a driver for the ASIX AX88796B Ethernet chip that is an NE2000-compatible; it is used on our new board, see http://www.rfidguardian.org)

If I read the NS DP83902A datasheet correctly, that chip is little-endian. It appears to me, however, that the driver was developed on a big-endian platform: it byteswaps all 16bit accesses.

Some varieties of NE2000-derived drivers already swap bytes again to fix this endianness issue. In 2003, Mikael Starvik also reported that the endianness was wrong for him (http://sourceware.org/ml/ecos-discuss/2003-03/msg00356.html).

I think the correct approach is to use the CPU's endianness macros, and byteswap only when the CPU is big-endian.

Shall I change the driver this way and send in a patch? Which derived Ethernet drivers are candidates to be broken by such a change?

Rutger Hofman
VU Amsterdam


-- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]