2 transmit and receive descriptor queues – Texas Instruments TMS320C645x DSP User Manual

Page 28

Advertising
background image

www.ti.com

2.5.2

Transmit and Receive Descriptor Queues

EMAC Functional Architecture

The EMAC module processes descriptors in linked list chains (

Section 2.5.1

). The lists controlled by the

EMAC are maintained by the application software via the head descriptor pointer (HDP) registers. Since
the EMAC supports eight channels for both transmit and receive, there are eight head descriptor pointer
registers for both.

They are designated as follows:

TXnHDP: Transmit Channel n DMA Head Descriptor Pointer Register

RXnHDP: Receive Channel n DMA Head Descriptor Pointer Register

After an EMAC reset, and before enabling the EMAC for send or receive, you must initialize all 16 head
descriptor pointer registers to zero.

The EMAC uses a simple system to determine ownership of a descriptor (either the EMAC or the
application software). There is a flag in the descriptor flags field called OWNER. When this flag is set, the
EMAC owns the referenced packet.

Note:

Ownership is assigned on a packet-based granularity, not on descriptor granularity. Thus,
only SOP descriptors make use of the OWNER flag. The EMAC patches the SOP
descriptor of the corresponding packet and clears the OWNER flag as packets are
processed. This means that the EMAC is finished processing all descriptors up to and
including the first with the EOP flag set. This indicates that you have reached the end of
the packet. This may only be one descriptor with both the SOP and EOP flags set.

To add a descriptor or a linked list of descriptors to an EMAC descriptor queue for the first time, the
software application writes the pointer to the descriptor or first descriptor of a list to the corresponding
HDP register. Note that the last descriptor in the list must have its next pointer cleared so that the EMAC
can detect the end of the list. If only a single descriptor is added, its next descriptor pointer must be
initialized to zero.

The HDP register must never be written to a second time while a previous list is active. To add additional
descriptors to a descriptor list already owned by the EMAC, the NULL next pointer of the last descriptor of
the previous list is patched with a pointer to the first descriptor in the new list. The list of new descriptors
to be appended to the existing list must itself be NULL terminated before the pointer patch is performed.

If the EMAC reads the next pointer of a descriptor as NULL in the instant before an application appends
additional descriptors to the list by patching the pointer, this may result in a race condition. Thus, the
software application must always examine the Flags field of all EOP packets, looking for a special flag
called end of queue (EOQ). The EOQ flag is set by the EMAC on the last descriptor of a packet when the
descriptor’s next pointer is NULL, allowing the EMAC to indicate to the software application that it has
reached the end of the list. When the software application sees the EOQ flag set, and there are more
descriptors to process, the application may then submit the new list or missed list portion by writing the
new list pointer to the same HDP register that started the process.

This process applies when adding packets to a transmit list, and empty buffers to a receive list.

Ethernet Media Access Controller (EMAC)/Management Data Input/Output (MDIO)

28

SPRU975B – August 2006

Submit Documentation Feedback

Advertising