BCM1250/BCM1125/BCM1125H
User Manual
10/21/02
B r o a d c o m C o r p o r a t i o n
Page
178
Section 7: DMA
Document
1250_1125-UM100CB-R
CRC
AND
C
HECKSUM
G
ENERATORS
In parts with system revision indicating PERIPH_REV3 or greater the Data Mover includes a programmable
CRC generator and a checksum engine that computes the ones-complement checksum used by the TCP and
UDP protocols. These can be used as part of a data copy or with the prefetch (null destination) parameter to
read the data and generate the result without a copy. Each of the four channels has its own register to store
the current state information for the CRC and checksum in progress in that channel, allowing the channels to
be operated independently and with arbitrary interleave.
The CRC and Checksum operations are only supported when the addresses increment, the results of enabling
CRC or checksum with a decrementing source or destination address are UNDEFINED.
The basic operation is the same for both CRC and checksum. The generator is controlled by the data mover
descriptors and a single CRC or checksum computation may be split over multiple descriptors (there can even
be unrelated moves that do not use the generators mixed in). For both generators each descriptor includes an
enable flag, a reset flag and an append flag. If the enable flag is set then the function is enabled for this move.
When the engine is enabled if the reset flag is set then the partial result is set to the initial value before the
move is started and if the append flag is set the final result is written to the destination address after the move
has completed. In all cases the software readable partial result register is updated at the end of the move. The
partial result register may be saved by software if a computation is interrupted and can be written to restore
the result before the computation is resumed (this requires control of the DMA channel and in many cases can
be avoided since a different computation can be performed in other channels). The data in the partial result
register is only valid when the channel is not currently computing a checksum or CRC, and the register should
only be written when the channel is not computing.
If the data mover channel is disabled then the CRC and checksum partial result registers will contain valid data
when the active bit becomes clear, and the computation may be resumed when the channel is enabled again.
If the channel is aborted then the partial result registers and the results of any in-progress generation become
UNPREDICTABLE and it is not possible to resume the computation.
Checksum Generation
If the checksum is enabled then for every 16 bits in the move the data is added to the partial sum using the
TCP/UDP ones-complement maths. The value that the sum should be initialized to at the start of a computation
must be set in the tcpcs_init field, in most cases this will be zero. At the start of moves that have the reset flag
set the current sum is set from this initial value. At the start of any move with the checksum enabled that does
not have the reset flag set the current sum is updated from the partial sum register for that channel.
At the end of any move that has the checksum enabled the partial sum register associated with a channel is
updated. If there is a byte left over and the append bit is set then the final byte and a byte of zeros is added to
the partial sum before the result is appended. If there is a byte left over and the append bit is not set then the
byte is included in the sum and a flag set to ensure the first byte of the next description is used to complete the
16-bit sum.
When the sum is appended it behaves just as if the move were two bytes longer, and any partial cache line is
merged with a read-modify-write cycle if cacheable. If the prefetch bit is set then no regular data is moved and
just the checksum is written to the destination (again with a read-modify-write merge if required).