User’s Guide 21020285 D
Chapter 8 Details of Usage
Byte and Word Swapping Page 8 - 3
Byte and Word
Swapping
The RF3880 adapter is flexible enough to allow you to request Byte Swapping,
Word Swapping, or both, during transfers of command structures.
This section will first give you some examples to explain why the swapping
feature is offered to you, then provide a perspective on implementation with
the RF3880 for both Command Structures used by the RF3880 (which the
adapter can swap) and data (which needs special software if swapping is
necessary).
Need for
Swapping
The memory architecture of your system depends on the type of processor you
are using. There are several major manufacturers that each use different
arrangements of bytes, words, and double-words in memory. The two most
common formats are: Intel and Motorola. Their differences are illustrated in
the example below:
Example of Memory Differences
If you were to define the following variables in a program:
char byte[] = “test”;
int word[2] = {0x0102, 0x0304};
double dword = 0xAABBCCDD;
They would appear this way in memory (beginning at location n) for each
respective format:
Essentially the two processors store a string of bytes in the same order.
However, the bytes that make up word and double-word information are stored
in an order opposite to each other:
The RF3880 adapter must correctly access the command structures for either
type of processor.
Throughout this manual, the Parameter and Status Blocks that make up the
command structures are represented double-word wide, in Motorola ordering.
If you have an Intel processor, you will need to translate these displays to your
format. The following example will help explain this.
variable Byte # of memory Intel Order Motorola Order
byte n testtest
word n + 4 02 01040301020304
dword n + 8 DDCCBBAAAABBCCDD
Table 108: Variations in Intel and Motorola Memory
Processor Type
Byte of word or
double-word
Order in memory
Motorola
LSB* stored in highest memory address
MSB* stored in lowest memory address
Intel
LSB stored in lowest memory address
MSB stored in highest memory address
Table 109: Explanation of Memory Storage Differences