Initial Conditions; Transmit Algorithm; Interrupt Routine; D.3.4 Initial Conditions - Motorola MC68302 User Manual

Integrated multiprotocol processor
Hide thumbs Also See for MC68302:
Table of Contents

Advertisement

MC68302 Applications
Process receive data (PRD) shows the next receive BD that will be processed. To process
a buffer, check for errors, move or use the data, and then mark the BD as available for use.
This is the last pointer to move in the receive process.

D.3.4 Initial Conditions

Initially the BDs should be configured like those shown in Figure D-4. All three transmit point-
ers should point to the first transmit BD in the table, and both receive pointers should point
to the first receive BD. Also, the data length fields of all the BDs should be zero for the pur-
poses of the following algorithm.

D.3.5 Transmit Algorithm

Use the following routine to configure new data to be transmitted.
Execute anytime:
1. Make sure that (NTD -> Ready) = 0. If ready = 1, there is no more room to link in buff-
ers to be transmitted, since there are already eight BDs ahead of the SCC.
2. Make sure that the (NTD -> data length) = 0 to prevent overwriting a buffer that has
not been confirmed.
3. Link in the desired buffer to this BD.
4. Set up the control information in the BD, but do not set the ready bit.
5. Do not allow the confirm transmit process to interrupt the following steps:
a. Set the data length to the exact number of bytes (odd or even) that should be
transmitted from this buffer.
b. Set the ready bit of the BD.
c. Move NTD to point to the next BD. (If the wrap bit is set, point to the first BD.)
6. The confirm process interrupt may now be unmasked.

D.3.6 Interrupt Routine

When an interrupt occurs in the SCC event register perform the following:
1. Read the SCC event register.
2. Clear any unmasked bits that will be dealt with in this interrupt routine (write ones to
those bits). Those events normally include receiving a buffer or frame, transmitting a
buffer, getting a transmit error, and any change in general status conditions such as
carrier detect or clear-to-send.
3. Deal with the general status conditions as desired.
If the interrupt was due to receiving a buffer or frame, perform the following receive process:
1. While (PRD -> Empty) = 0, do the following:
/* Buffer has been filled if Empty = 0*/
a. Check for errors in the BD.
b. The user may or may not want to analyze data in the buffer at this time.
c. Move data out of buffer or change the BD pointer to a new location.
d. Clear out the data length field so that it is zero to start with.
D-10
MC68302 USER'S MANUAL
MOTOROLA

Advertisement

Table of Contents
loading

Table of Contents