rs232 endianness on PPC
Walter L. Wimer III
walt.wimer at timesys.com
Fri Jul 7 01:31:36 EST 2006
On Sun, 2006-07-02 at 12:10 +0200, Antonio Di Bacco wrote:
> PowerPC is neither byte swapped nor bit swapped.
> When transmitting on a network card the most significant byte is transmitted
> first, and, inside the byte, the most significant bit is sent first.
FYI, the *bit*-order on a network actually depends on the layer 2
network standard that you happen to be communicating over. Ethernet /
IEEE 802.3 is *least significant* bit first on the wire. SLIP and
asynchronous PPP (since they go over RS232) are also least-significant
bit first. IBM Token-Ring / IEEE 802.5 was most-significant bit first
on the wire.
IETF protocols such as IP, TCP, UDP, etc., etc., etc., only specify the
*byte* order, which is most-significant *byte* first.
Generally speaking, a network device driver programmer need only worry
about getting the *byte* order correct. The network interface hardware
generally takes care of the *bit* order. (An exception to this can be
drivers and interface hardware for some low-speed "networks" such as I2C
or Dallas 1-Wire. These may be very primitive and require software
"bit-banging" where the driver software must explicitly shift bits out
of a byte and transmit them one bit at a time. Clearly in these cases,
the driver must transmit the bits in the correct order based on the
appropriate standard (e.g. I2C, Dallas 1-Wire, etc.).)
Cheers,
Walt Wimer
TimeSys Corporation
More information about the Linuxppc-embedded
mailing list