beautypg.com

8 append crc, Append crc – Maxim Integrated 78Q8430 Software Driver User Manual

Page 14

background image

78Q8430 Software Driver Development Guidelines

UG_8430_004


The host drop feature must never be used to drop a frame that is 4 bytes or less in size. When a
frame contains 4 bytes or less then the QUE pre-fetch operation loads the entire frame such that it
is no longer at the top of the QUE. In this case it is more efficient to simply read and discard the

entire frame with a single read to the RDR.

Use the following procedure to entirely remove the top frame from the receive QUE:

STEP 1: Inspect the frame size.
If the RPSR Count field indicates that the frame is 4 bytes or less in total size then the host drop
feature is not appropriate. In this case a single read to the RDR is sufficient to remove the frame from
the QUE. If the frame size is 5 bytes or greater then proceed to STEP 2.

STEP 2: Set the FDR Drop Rx Frame bit.

Setting this bit starts the drop circuit causing the receive QUE to purge one entire frame.

STEP 3: Wait for the drop circuit to complete.
It is important that the driver not attempt to read from QUE 0 while the drop circuit is running. The
Drop Rx Frame bit is self clearing. When the drop operation is complete the bit will be clear.


Any frames that are in the QUE before the frame that is to be dropped must be completely removed from
the QUE before this procedure is initiated. In other words, the frame to be dropped must be at the very
top of the QUE.


There must be absolutely no activity on the QUE 0 RDR while the host drop procedure is active.

The host drop circuit does not effect the transmit QUEs. A driver may find that a more efficient use of its
time may be to service a transmit QUE rather than wait idly in a polling loop for the drop circuit to
complete.

3.8 Append

CRC

The transmit circuit has the ability to calculate and append the correct CRC to the end of a transmit frame
on the fly. Using this feature saves the host some compute cycles in not having to calculate the CRC
itself as well as bus cycles in not having to send the CRC with the frame data. The basic transmit
procedure described in Section

3.1

can be modified to use the hardware to append the CRC to

transmitted frames as follows.

STEP 1: Write to QUE 4 PCWR.
Make sure the Append CRC bit is set in the value written to QUE 4 PCWR.

STEP 2: Write to QUE 4 PSZR.
The size written to PSZR should NOT include the CRC because the CRC will not be part of the frame
transferred from the host.

STEP 3: Write the frame data to QUE 4 TDR.
Do not write the CRC bytes as part of the frame data.

STEP 4: Read the transmit status from TPSR.
Reading TPSR reads status words from the top of a 128 word deep FIFO. One status word is added
to the FIFO for each transmitted frame. If the software does not read the status words for transmitted
frames from the FIFO, it eventually fills to capacity at which time any new status words are dropped
while the FIFO retains the oldest ones.

14

Rev.

1.0