[ECOS] ns/dp83902a (NE2000) driver: endianness
Rutger Hofman
rutger@cs.vu.nl
Thu Dec 10 15:26:00 GMT 2009
(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
More information about the Ecos-discuss
mailing list