This document provides a functional description of the Ethernet Media Access Controller (EMAC) and
physical layer (PHY) device Management Data Input/Output (MDIO) module integrated in the
TMS320DM36x Digital Media System-on-Chip (DMSoC). Included are the features of the EMAC and
MDIO modules, a discussion of their architecture and operation, how these modules connect to the
outside world, and the registers description for each module.
Notational Conventions
This document uses the following conventions.
•Hexadecimal numbers are shown with the suffix h. For example, the following number is 40
hexadecimal (decimal 64): 40h.
•Registers in this document are shown in figures and described in tables.
– Each register figure shows a rectangle divided into fields that represent the fields of the register.
Each field is labeled with its bit name, its beginning and ending bit numbers above, and its
read/write properties below. A legend explains the notation used for the properties.
– Reserved bits in a register figure designate a bit that is used for future device expansion.
Preface
SPRUFI5B–March 2009–Revised December 2010
Read This First
Related Documentation From Texas Instruments
The following documents describe the TMS320DM36x Digital Media System-on-Chip (DMSoC). Copies of
these documents are available on the internet at www.ti.com.
SPRUFG5 — TMS320DM365 Digital Media System-on-Chip (DMSoC) ARM Subsystem Reference
Guide This document describes the ARM Subsystem in the TMS320DM36x Digital Media
System-on-Chip (DMSoC). The ARM subsystem is designed to give the ARM926EJ-S (ARM9)
master control of the device. In general, the ARM is responsible for configuration and control of the
device; including the components of the ARM Subsystem, the peripherals, and the external
memories.
SPRUFG8 — TMS320DM36x Digital Media System-on-Chip (DMSoC) Video Processing Front End
(VPFE) Users Guide This document describes the Video Processing Front End (VPFE) in the
TMS320DM36x Digital Media System-on-Chip (DMSoC).
SPRUFG9 — TMS320DM36x Digital Media System-on-Chip (DMSoC) Video Processing Back End
(VPBE) Users Guide This document describes the Video Processing Back End (VPBE) in the
TMS320DM36x Digital Media System-on-Chip (DMSoC).
SPRUFH0 — TMS320DM36x Digital Media System-on-Chip (DMSoC) 64-bit Timer Users Guide This
document describes the operation of the software-programmable 64-bit timers in the
TMS320DM36x Digital Media System-on-Chip (DMSoC).
SPRUFH1 — TMS320DM36x Digital Media System-on-Chip (DMSoC) Serial Peripheral Interface
(SPI) Users Guide This document describes the serial peripheral interface (SPI) in the
TMS320DM36x Digital Media System-on-Chip (DMSoC). The SPI is a high-speed synchronous
serial input/output port that allows a serial bit stream of programmed length (1 to 16 bits) to be
shifted into and out of the device at a programmed bit-transfer rate. The SPI is normally used for
communication between the DMSoC and external peripherals. Typical applications include an
interface to external I/O or peripheral expansion via devices such as shift registers, display drivers,
Ethernet Media Access Controller (EMAC)/Management
Data Input/Output (MDIO)
1Introduction
This document provides a functional description of the Ethernet Media Access Controller (EMAC) and
physical layer (PHY) device Management Data Input/Output (MDIO) module integrated in the device.
Included are the features of the EMAC and MDIO modules, a discussion of their architecture and
operation, how these modules connect to the outside world, and a description of the registers for each
module.
The EMAC controls the flow of packet data from the system to the PHY. The MDIO module controls PHY
configuration and status monitoring.
Both the EMAC and the MDIO modules interface to the system core through a custom interface that
allows efficient data transmission and reception. This custom interface is referred to as the EMAC control
module and is considered integral to the EMAC/MDIO peripheral.
1.1Purpose of the Peripheral
The EMAC module is used to move data between theDM36x DMSoC and another host connected to the
same network, in compliance with the Ethernet protocol. The EMAC is controlled by the ARM CPU of the
device; control by the DSP CPU is not supported.
1.2Features
The EMAC/MDIO has the following features:
•Synchronous 10/100 Mbps operation
•MII interface to the physical layer device (PHY)
•EMAC acts as DMA master to either internal or external device memory space
•Hardware error handling including CRC
•Eight receive channels with VLAN tag discrimination for receive quality-of-service (QOS) support
•Eight transmit channels with round-robin or fixed priority for transmit quality-of-service (QOS) support
•Ether-Stats and 802.3-Stats RMON statistics gathering
•Transmit CRC generation selectable on a per channel basis
•Broadcast frames selection for reception on a single channel
•Multicast frames selection for reception on a single channel
•Promiscuous receive mode frames selection for reception on a single channel (all frames, all good
frames, short frames, error frames)
•Hardware flow control
•8K-byte local EMAC descriptor memory that allows the peripheral to operate on descriptors without
affecting the CPU. The descriptor memory holds enough information to transfer up to 512 Ethernet
packets without CPU intervention.
•Programmable interrupt logic permits the software driver to restrict the generation of back-to-back
interrupts, which allows more work to be performed in a single call to the interrupt service routine.
•TI Adaptive Performance Optimization for improved half duplex performance
Figure 1 shows the three main functional modules of the EMAC/MDIO peripheral:
•EMAC control module
•EMAC module
•MDIO module
The EMAC control module is the main interface between the device core processor and the EMAC
module and MDIO module. The EMAC control module contains the necessary components to allow the
EMAC to make efficient use of device memory, plus it controls device interrupts. The EMAC control
module incorporates 8K-byte internal RAM to hold EMAC buffer descriptors.
The MDIO module implements the 802.3 serial management interface to interrogate and control up to 32
Ethernet PHYs connected to the device, using a shared two-wire bus. Host software uses the MDIO
module to configure the autonegotiation parameters of each PHY attached to the EMAC, retrieve the
negotiation results, and configure required parameters in the EMAC module for correct operation. The
module is designed to allow almost transparent operation of the MDIO interface, with very little
maintenance from the core processor.
The EMAC module provides an efficient interface between the processor and the networked community.
The EMAC on this device supports 10 Mbits/second and 100 Mbits/second in either half-duplex or
full-duplex mode, with hardware flow control and quality-of-service (QOS) support.
www.ti.com
Figure 1 also shows the main interface between the EMAC control module and the CPU. The following
connections are made to the device core:
•The peripheral bus connection from the EMAC control module allows the EMAC module to read and
write both internal and external memory through the DMA memory transfer controller.
•The EMAC control module, EMAC, and MDIO all have control registers. These registers are
memory-mapped into device memory space via the device configuration bus. Along with these
registers, the control module’s internal RAM is mapped into this same range.
•The EMAC and MDIO interrupts are combined into a single interrupt within the control module. The
interrupt from the control module then goes to the ARM interrupt controller.
14
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The EMAC and MDIO interrupts are combined within the control module, so only the control module
interrupt needs to be monitored by the application software or device driver. The EMAC control module
combines the EMAC and MDIO interrupts and generates 4 separate interrupts to the ARM through the
ARM interrupt controller. See Section 2.17.4 for details of interrupt multiplex logic of the EMAC control
module.
1.4Industry Standard(s) Compliance Statement
The EMAC peripheral conforms to the IEEE 802.3 standard, describing the Carrier Sense Multiple Access
with Collision Detection (CSMA/CD) Access Method and Physical Layer specifications. The IEEE 802.3
standard has also been adopted by ISO/IEC and re-designated as ISO/IEC 8802-3:2000(E).
In difference from this standard, the EMAC peripheral does not use the Transmit Coding Error signal
MTXER. Instead of driving the error pin when an underflow condition occurs on a transmitted frame, the
EMAC intentionally generates an incorrect checksum by inverting the frame CRC, so that the transmitted
frame is detected as an error by the network.
2Architecture
This section discusses the architecture and basic function of the EMAC/MDIO module.
2.1Clock Control
The frequencies for the transmit and receive clocks are fixed by the IEEE 802.3 specification as:
•2.5 MHz at 10 Mbps
•25 MHz at 100 Mbps
Architecture
All EMAC logic is clocked synchronously with the PLL peripheral clock. The MDIO clock can be controlled
through the application software, by programming the divide-down factor in the MDIO control register
(CONTROL).
2.1.1MII Clocking
The transmit and receive clock sources are provided from an external PHY via the EMAC_TX_CLK and
EMAC_RX_CLK pins. These clocks are inputs to the EMAC module and operate at 2.5 MHz in 10 Mbps
mode and at 25 MHz in 100 Mbps mode. For timing purposes, data is transmitted and received with
reference to EMAC_TX_CLK and EMAC_RX_CLK, respectively.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The EMAC peripheral includes internal memory that is used to hold information about the Ethernet
packets received and transmitted. This internal RAM is 2K × 32 bits in size. Data can be written to and
read from the EMAC internal memory by either the EMAC or the CPU. It is used to store buffer descriptors
that are 4-words (16-bytes) deep. This 8K local memory holds enough information to transfer up to 512
Ethernet packets without CPU intervention.
The packet buffer descriptors can also be placed in the internal processor memory (L2), or in EMIF
memory (DDR). There are some tradeoffs in terms of cache performance and throughput when
descriptors are placed in the system memory, versus when they are placed in the EMAC’s internal
memory. Cache performance is improved when the buffer descriptors are placed in internal memory.
However, the EMAC throughput is better when the descriptors are placed in the local EMAC RAM.
2.3Signal Descriptions
The DM36x DMSoC supports the MII interface (for 10/100 Mbps) operation.
Figure 2 shows a device with integrated EMAC and MDIO interfaced via a MII connection. The EMAC
module does not include a transmit error (MTXER) pin. In the case of transmit error, CRC inversion is
used to negate the validity of the transmitted frame.
The individual EMAC and MDIO signals for the MII interface are summarized in Table 1. For more
information, refer to either the IEEE 802.3 standard or ISO/IEC 8802-3:2000(E).
www.ti.com
Figure 2. Ethernet Configuration MII Connections
16
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
EMAC_TX_CLKITransmit clock (EMAC_TX_CLK). The transmit clock is a continuous clock that provides the timing
reference for transmit operations. The EMAC_TXD and EMAC_TX_EN signals are tied to this clock.
The clock is generated by the PHY and is 2.5 MHz at 10 Mbps operation and 25 MHz at 100 Mbps
operation.
EMAC_TXD[3-0]OTransmit data (EMAC_TXD). The transmit data pins are a collection of 4 data signals comprising
4 bits of data. MTDX0 is the least-significant bit (LSB). The signals are synchronized by
EMAC_TX_CLK and valid only when EMAC_TX_EN is asserted.
EMAC_TX_ENOTransmit enable (EMAC_TX_EN). The transmit enable signal indicates that the EMAC_TXD pins are
generating nibble data for use by the PHY. It is driven synchronously to EMAC_TX_CLK.
EMAC_COLICollision detected (EMAC_COL). The EMAC_COL pin is asserted by the PHY when it detects a
collision on the network. It remains asserted while the collision condition persists. This signal is not
necessarily synchronous to EMAC_TX_CLK nor EMAC_RX_CLK. This pin is used in half-duplex
operation only.
EMAC_CRSICarrier sense (EMAC_CRS). The EMAC_CRS pin is asserted by the PHY when the network is not
idle in either transmit or receive. The pin is deasserted when both transmit and receive are idle. This
signal is not necessarily synchronous to EMAC_TX_CLK nor EMAC_RX_CLK. This pin is used in
half-duplex operation only.
EMAC_RX_CLKIReceive clock (EMAC_RX_CLK). The receive clock is a continuous clock that provides the timing
reference for receive operations. The EMAC_RXD, EMAC_RX_DV, and MRXER signals are tied to
this clock. The clock is generated by the PHY and is 2.5 MHz at 10 Mbps operation and 25 MHz at
100 Mbps operation.
EMAC_RXD[3-0]IReceive data (EMAC_RXD). The receive data pins are a collection of 4 data signals comprising
4 bits of data. MRDX0 is the least-significant bit (LSB). The signals are synchronized by
EMAC_RX_CLK and valid only when EMAC_RX_DV is asserted.
EMAC_RX_DVIReceive data valid (EMAC_RX_DV). The receive data valid signal indicates that the EMAC_RXD
pins are generating nibble data for use by the EMAC. It is driven synchronously to EMAC_RX_CLK.
MRXERIReceive error (MRXER). The receive error signal is asserted for one or more EMAC_RX_CLK
periods to indicate that an error was detected in the received frame. This is meaningful only during
data reception when EMAC_RX_DV is active.
MDCLKOManagement data clock (MDCLK). The MDIO data clock is sourced by the MDIO module on the
system. It is used to synchronize MDIO data access operations done on the MDIO pin. The
frequency of this clock is controlled by the CLKDIV bits in the MDIO control register (CONTROL).
MDIOI/OManagement data input output (MDIO). The MDIO pin drives PHY management data into and out of
the PHY by way of an access frame consisting of start of frame, read/write indication, PHY address,
register address, and data bit cycles. The MDIO pin acts as an output for all but the data bit cycles
at which time it is an input for read operations.
2.4Pin Multiplexing
On the DM36x processor, the EMAC pins are multiplexed with other pin functions. For these pins to be
used as EMAC functions, the pin multiplexing registers must be configured appropriately. For specific
information on pin multiplexing, refer to the device-specific data manual and the TMS320DM365 DigitalMedia System-on-Chip (DMSoiC) ARM Subsystem Users Guide (SPRUFG5).
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Ethernet provides an unreliable, connection-less service to a networking application. A brief overview of
the Ethernet protocol is given in the following subsections. For in-depth information on the Carrier Sense
Multiple Access with Collision Detection (CSMA/CD) Access Method, which is the Ethernet’s multiple
access protocol, see the IEEE 802.3 standard document.
2.5.1Ethernet Frame Format
All the Ethernet technologies use the same frame structure. The format of an Ethernet frame is shown in
Figure 3 and described in Table 2. The Ethernet packet, which is the collection of bytes representing the
data portion of a single Ethernet frame on the wire, is shown outlined in bold. The Ethernet frames are of
variable lengths, with no frame smaller than 64 bytes or larger than RXMAXLEN bytes (header, data, and
CRC).
www.ti.com
Figure 3. Ethernet Frame Format
Table 2. Ethernet Frame Description
FieldBytesDescription
Preamble7Preamble. These 7 bytes have a fixed value of 55h and serve to wake up the receiving
SFD1Start of Frame Delimiter. This field with a value of 5Dh immediately follows the preamble
Destination6Destination address. This field contains the Ethernet MAC address of the EMAC port for
Source6Source address. This field contains the MAC address of the Ethernet port that transmits the
Len2Length/Type field. The length field indicates the number of EMAC client data bytes
Data46 toData field. This field carries the datagram containing the upper layer protocol frame, that is,
(RXMAXLEN - 18)IP layer datagram. The maximum transfer unit (MTU) of Ethernet is (RXMAXLEN - 18)
FCS4Frame Check Sequence. A cyclic redundancy check (CRC) is used by the transmit and
EMAC ports and to synchronize their clocks to that of the sender’s clock.
pattern and indicates the start of important data.
which the frame is intended. It may be an individual or multicast (including broadcast)
address. When the destination EMAC port receives an Ethernet frame with a destination
address that does not match any of its MAC physical addresses, and no promiscuous,
multicast or broadcast channel is enabled, it discards the frame.
frame to the Local Area Network.
contained in the subsequent data field of the frame. This field can also be used to identify
the type of data the frame is carrying.
bytes. This means that if the upper layer protocol datagram exceeds (RXMAXLEN - 18)
bytes, then the host has to fragment the datagram and send it in multiple Ethernet packets.
The minimum size of the data field is 46 bytes. This means that if the upper layer datagram
is less then 46 bytes, the data field has to be extended to 46 bytes by appending extra bits
after the data field, but prior to calculating and appending the FCS.
receive algorithms to generate a CRC value for the FCS field. The frame check sequence
covers the 60 to (RXMAXLEN - 4) bytes of the packet data. Note that this 4-byte field may
or may not be included as part of the packet data, depending on how the EMAC is
configured.
18
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
Nodes in an Ethernet Local Area Network are interconnected by a broadcast channel, as a result, when
an EMAC port transmits a frame, all the adapters on the local network receive the frame. Carrier Sense
Multiple Access with Collision Detection (CSMA/CD) algorithms are used when the EMAC operates in
half-duplex mode. When operating in full-duplex mode, there is no contention for use of a shared medium,
since there are exactly two ports on the local network.
Each port runs the CSMA/CD protocol without explicit coordination with the other ports on the Ethernet
network. Within a specific port, the CSMA/CD protocol works as follows:
1. The port obtains data from upper layers protocols at its node, prepares an Ethernet frame, and puts
the frame in a buffer.
2. If the port senses that the medium is idle it starts to transmit the frame. If the port senses that the
transmission medium is busy, it waits until it senses no signal energy (plus an Inter-Packet Gap time)
and then starts to transmit the frame.
3. While transmitting, the port monitors for the presence of signal energy coming from other ports. If the
port transmits the entire frame without detecting signal energy from other Ethernet devices, the port is
done with the frame.
4. If the port detects signal energy from other ports while transmitting, it stops transmitting its frame and
instead transmits a 48-bit jam signal.
5. After transmitting the jam signal the port enters an exponential backoff phase. Specifically, when
transmitting a given frame, after experiencing a number of collisions in a row for the frame, the port
chooses a random value that is dependent on the number of collisions. The port then waits an amount
of time that is multiple of this random value, and returns to step 2.
Architecture
2.6Programming Interface
2.6.1Packet Buffer Descriptors
The buffer descriptor is a central part of the EMAC module and is how the application software describes
Ethernet packets to be sent and empty buffers to be filled with incoming packet data. The basic descriptor
format is shown in Figure 4 and described in Table 3.
For example, consider three packets to be transmitted, Packet A is a single fragment (60 bytes), Packet B
is fragmented over three buffers (1514 bytes total), and Packet C is a single fragment (1514 bytes). The
linked list of descriptors to describe these three packets is shown in Figure 5.
0Next DescriptorThe next descriptor pointer is used to create a single linked list of descriptors. Each descriptor
Pointerdescribes a packet or a packet fragment. When a descriptor points to a single buffer packet
or the first fragment of a packet, the start of packet (SOP) flag is set in the flags field. When a
descriptor points to a single buffer packet or the last fragment of a packet, the end of packet
(EOP) flag is set. When a packet is fragmented, each fragment must have its own descriptor
and appear sequentially in the descriptor linked list.
1Buffer PointerThe buffer pointer refers to the actual memory buffer that contains packet data during
transmit operations, or is an empty buffer ready to receive packet data during receive
operations.
2Buffer OffsetThe buffer offset is the offset from the start of the packet buffer to the first byte of valid data.
This field only has meaning when the buffer descriptor points to a buffer that actually contains
data.
Buffer LengthThe buffer length is the actual number of valid packet data bytes stored in the buffer. If the
buffer is empty and waiting to receive data, this field represents the size of the empty buffer.
3FlagsThe flags field contains more information about the buffer, such as, is it the first fragment in a
packet (SOP), the last fragment in a packet (EOP), or contains an entire contiguous Ethernet
packet (both SOP and EOP). The flags are described in Section 2.6.4 and Section 2.6.5.
Packet LengthThe packet length only has meaning for buffers that both contain data and are the start of a
new packet (SOP). In the case of SOP descriptors, the packet length field contains the length
of the entire Ethernet packet, regardless if it is contained in a single buffer or fragmented over
several buffers.
Figure 5. Typical Descriptor Linked List
20
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
The EMAC module processes descriptors in linked list chains as discussed in Section 2.6.1. The lists
controlled by the EMAC are maintained by the application software through the use of the head descriptor
pointer registers (HDP). Since the EMAC supports eight channels for both transmit and receive, there are
eight head descriptor pointer registers for both. They are:
•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, all 16 head descriptor pointer
registers must be initialized to 0.
The EMAC uses a simple system to determine if a descriptor is currently owned by the EMAC or by the
application software. There is a flag in the buffer descriptor flags called OWNER. When this flag is set, the
packet that is referenced by the descriptor is considered to be owned by the EMAC. Note that ownership
is done on a packet based granularity, not on descriptor granularity, so only SOP descriptors make use of
the OWNER flag. As packets are processed, the EMAC patches the SOP descriptor of the corresponding
packet and clears the OWNER flag. This is an indication that the EMAC has finished processing all
descriptors up to and including the first with the EOP flag set, indicating the end of the packet (note 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 simply 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 to
0. This is the only way the EMAC has of detecting the end of the list. So in the case where only a single
descriptor is added, its “next descriptor” pointer must be initialized to 0.
The HDP 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.
There is a potential race condition where the EMAC may read 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
case is handled by the software application always examining the buffer descriptor flags 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. This is the way the EMAC
indicates to the software application that it believes 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 at that
time submit the new list, or the portion of the appended list that was missed, by writing the new list pointer
to the same HDP that started the process.
This process applies when adding packets to a transmit list, and empty buffers to a receive list.
Architecture
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The EMAC processes descriptors in linked list chains as discussed in Section 2.6.1, using the linked list
queue mechanism discussed in Section 2.6.2.
The EMAC synchronizes descriptor list processing through the use of interrupts to the software
application. The interrupts are controlled by the application using the interrupt masks, global interrupt
enable, and the completion pointer register (CP). The CP is also called the interrupt acknowledge register.
As the EMAC supports eight channels for both transmit and receive, there are eight completion pointer
registers for both. They are:
•TXnCP - Transmit Channel n Completion Pointer (Interrupt Acknowledge) Register
•RXnCP - Receive Channel n Completion Pointer (Interrupt Acknowledge) Register
These registers serve two purposes. When read, they return the pointer to the last descriptor that the
EMAC has processed. When written by the software application, the value represents the last descriptor
processed by the software application. When these two values do not match, the interrupt remains
asserted, after the respective End of interrupt bit is signaled in the EMAC control module.
The system configuration determines whether or not an active interrupt actually interrupts the CPU. In
general, the individual interrupts for different events from the EMAC and MDIO must be enabled in the
EMAC control module, and it also must be mapped in the ARM interrupt controller and enabled as a CPU
interrupt. If the system is configured properly, the interrupt for a specific receive or transmit channel
executes under the previously described conditions when the corresponding interrupt is enabled in the
EMAC using the receive interrupt mask set register (RXINTMASKSET) or the transmit interrupt mask set
register (TXINTMASKSET).
Whether or not the interrupt is enabled, the current state of the receive or transmit channel interrupt can
be examined directly by the software application reading the receive interrupt status (unmasked) register
(RXINTSTATRAW) and transmit interrupt status (unmasked) register (TXINTSTATRAW).
Interrupts are acknowledged when the application software updates the value of TXnCP or RXnCP with a
value that matches the internal value kept by the EMAC. This mechanism ensures that the application
software never misses an EMAC interrupt, since the interrupt and its acknowledgment are tied directly to
the actual buffer descriptors processing.
www.ti.com
22
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
A transmit (TX) buffer descriptor (Figure 6) is a contiguous block of four 32-bit data words aligned on a
32-bit boundary that describes a packet or a packet fragment. Example 1 shows the transmit buffer
descriptor described by a C structure.
Figure 6. Transmit Buffer Descriptor Format
Word 0
310
Next Descriptor Pointer
Word 1
310
Buffer Pointer
Word 2
3116 150
Buffer OffsetBuffer Length
Word 3
3130292827262516
SOPEOPOWNEREOQTDOWNCMPLT PASSCRCReserved
150
Packet Length
Example 1. Transmit Buffer Descriptor in C Structure Format
/*
// EMAC Descriptor
//
// The following is the format of a single buffer descriptor
// on the EMAC.
*/
typedef struct _EMAC_Desc {
struct _EMAC_Desc *pNext;/* Pointer to next descriptor in chain */
Uint8*pBuffer;/* Pointer to data buffer*/
Uint32BufOffLen; /* Buffer Offset(MSW) and Length(LSW)*/
Uint32PktFlgLen; /* Packet Flags(MSW) and Length(LSW)*/
The next descriptor pointer points to the 32-bit word aligned memory address of the next buffer descriptor
in the transmit queue. This pointer is used to create a linked list of buffer descriptors. If the value of this
pointer is zero, then the current buffer is the last buffer in the queue. The software application must set
this value prior to adding the descriptor to the active transmit list. This pointer is not altered by the EMAC.
The value of pNext should never be altered once the descriptor is in an active transmit queue, unless its
current value is NULL. If the pNext pointer is initially NULL, and more packets need to be queued for
transmit, the software application may alter this pointer to point to a newly appended descriptor. The
EMAC will use the new pointer value and proceed to the next descriptor unless the pNext value has
already been read. In this latter case, the transmitter will halt on the transmit channel in question, and the
software application may restart it at that time. The software can detect this case by checking for an end
of queue (EOQ) condition flag on the updated packet descriptor when it is returned by the EMAC.
2.6.4.2Buffer Pointer
The buffer pointer is the byte-aligned memory address of the memory buffer associated with the buffer
descriptor. The software application must set this value prior to adding the descriptor to the active transmit
list. This pointer is not altered by the EMAC.
2.6.4.3Buffer Offset
This 16-bit field indicates how many unused bytes are at the start of the buffer. For example, a value of
0000h indicates that no unused bytes are at the start of the buffer and that valid data begins on the first
byte of the buffer, while a value of 000Fh indicates that the first 15 bytes of the buffer are to be ignored by
the EMAC and that valid buffer data starts on byte 16 of the buffer. The software application must set this
value prior to adding the descriptor to the active transmit list. This field is not altered by the EMAC.
Note that this value is only checked on the first descriptor of a given packet (where the start of packet
(SOP) flag is set). It can not be used to specify the offset of subsequent packet fragments. Also, since the
buffer pointer may point to any byte–aligned address, this field may be entirely superfluous, depending on
the device driver architecture.
The range of legal values for this field is 0 to (Buffer Length – 1).
www.ti.com
2.6.4.4Buffer Length
This 16-bit field indicates how many valid data bytes are in the buffer. On single fragment packets, this
value is also the total length of the packet data to be transmitted. If the buffer offset field is used, the offset
bytes are not counted as part of this length. This length counts only valid data bytes. The software
application must set this value prior to adding the descriptor to the active transmit list. This field is not
altered by the EMAC.
2.6.4.5Packet Length
This 16-bit field specifies the number of data bytes in the entire packet. Any leading buffer offset bytes are
not included. The sum of the buffer length fields of each of the packet’s fragments (if more than one) must
be equal to the packet length. The software application must set this value prior to adding the descriptor to
the active transmit list. This field is not altered by the EMAC. This value is only checked on the first
descriptor of a given packet (where the start of packet (SOP) flag is set).
2.6.4.6Start of Packet (SOP) Flag
When set, this flag indicates that the descriptor points to a packet buffer that is the start of a new packet.
In the case of a single fragment packet, both the SOP and end of packet (EOP) flags are set. Otherwise,
the descriptor pointing to the last packet buffer for the packet sets the EOP flag. This bit is set by the
software application and is not altered by the EMAC.
24
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
When set, this flag indicates that the descriptor points to a packet buffer that is last for a given packet. In
the case of a single fragment packet, both the start of packet (SOP) and EOP flags are set. Otherwise, the
descriptor pointing to the last packet buffer for the packet sets the EOP flag. This bit is set by the software
application and is not altered by the EMAC.
2.6.4.8Ownership (OWNER) Flag
When set, this flag indicates that all the descriptors for the given packet (from SOP to EOP) are currently
owned by the EMAC. This flag is set by the software application on the SOP packet descriptor before
adding the descriptor to the transmit descriptor queue. For a single fragment packet, the SOP, EOP, and
OWNER flags are all set. The OWNER flag is cleared by the EMAC once it is finished with all the
descriptors for the given packet. Note that this flag is valid on SOP descriptors only.
2.6.4.9End of Queue (EOQ) Flag
When set, this flag indicates that the descriptor in question was the last descriptor in the transmit queue
for a given transmit channel, and that the transmitter has halted. This flag is initially cleared by the
software application prior to adding the descriptor to the transmit queue. This bit is set by the EMAC when
the EMAC identifies that a descriptor is the last for a given packet (the EOP flag is set), and there are no
more descriptors in the transmit list (next descriptor pointer is NULL).
The software application can use this bit to detect when the EMAC transmitter for the corresponding
channel has halted. This is useful when the application appends additional packet descriptors to a transmit
queue list that is already owned by the EMAC. Note that this flag is valid on EOP descriptors only.
Architecture
2.6.4.10Teardown Complete (TDOWNCMPLT) Flag
This flag is used when a transmit queue is being torn down, or aborted, instead of allowing it to be
transmitted. This would happen under device driver reset or shutdown conditions. The EMAC sets this bit
in the SOP descriptor of each packet as it is aborted from transmission.
Note that this flag is valid on SOP descriptors only. Also note that only the first packet in an unsent list has
the TDOWNCMPLT flag set. Subsequent descriptors are not even processed by the EMAC.
2.6.4.11Pass CRC (PASSCRC) Flag
This flag is set by the software application in the SOP packet descriptor before it adds the descriptor to the
transmit queue. Setting this bit indicates to the EMAC that the 4 byte Ethernet CRC is already present in
the packet data, and that the EMAC should not generate its own version of the CRC.
When the CRC flag is cleared, the EMAC generates and appends the 4-byte CRC. The buffer length and
packet length fields do not include the CRC bytes. When the CRC flag is set, the 4-byte CRC is supplied
by the software application and is already appended to the end of the packet data. The buffer length and
packet length fields include the CRC bytes, as they are part of the valid packet data. Note that this flag is
valid on SOP descriptors only.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
A receive (RX) buffer descriptor (Figure 7) is a contiguous block of four 32-bit data words aligned on a
32-bit boundary that describes a packet or a packet fragment. Example 2 shows the receive buffer
descriptor described by a C structure.
2.6.5.1Next Descriptor Pointer
This pointer points to the 32–bit word aligned memory address of the next buffer descriptor in the receive
queue. This pointer is used to create a linked list of buffer descriptors. If the value of this pointer is zero,
then the current buffer is the last buffer in the queue. The software application must set this value prior to
adding the descriptor to the active receive list. This pointer is not altered by the EMAC.
The value of pNext should never be altered once the descriptor is in an active receive queue, unless its
current value is NULL. If the pNext pointer is initially NULL, and more empty buffers can be added to the
pool, the software application may alter this pointer to point to a newly appended descriptor. The EMAC
will use the new pointer value and proceed to the next descriptor unless the pNext value has already been
read. In this latter case, the receiver will halt the receive channel in question, and the software application
may restart it at that time. The software can detect this case by checking for an end of queue (EOQ)
condition flag on the updated packet descriptor when it is returned by the EMAC.
2.6.5.2Buffer Pointer
The buffer pointer is the byte-aligned memory address of the memory buffer associated with the buffer
descriptor. The software application must set this value prior to adding the descriptor to the active receive
list. This pointer is not altered by the EMAC.
Example 2. Receive Buffer Descriptor in C Structure Format
/*
// EMAC Descriptor
//
// The following is the format of a single buffer descriptor
// on the EMAC.
*/
typedef struct _EMAC_Desc {
struct _EMAC_Desc *pNext;/* Pointer to next descriptor in chain */
Uint8*pBuffer;/* Pointer to data buffer*/
Uint32BufOffLen; /* Buffer Offset(MSW) and Length(LSW)*/
Uint32PktFlgLen; /* Packet Flags(MSW) and Length(LSW)*/
This 16-bit field must be initialized to zero by the software application before adding the descriptor to a
receive queue.
Whether or not this field is updated depends on the setting of the RXBUFFEROFFSET register. When the
offset register is set to a non-zero value, the received packet is written to the packet buffer at an offset
given by the value of the register, and this value is also written to the buffer offset field of the descriptor.
When a packet is fragmented over multiple buffers because it does not fit in the first buffer supplied, the
buffer offset only applies to the first buffer in the list, which is where the start of packet (SOP) flag is set in
the corresponding buffer descriptor. In other words, the buffer offset field is only updated by the EMAC on
SOP descriptors.
The range of legal values for the BUFFEROFFSET register is 0 to (Buffer Length – 1) for the smallest
value of buffer length for all descriptors in the list.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
•Before the descriptor is first placed on the receive queue by the application software, the buffer length
field is first initialized by the software to have the physical size of the empty data buffer pointed to by
the buffer pointer field.
•After the empty buffer has been processed by the EMAC and filled with received data bytes, the buffer
length field is updated by the EMAC to reflect the actual number of valid data bytes written to the
buffer.
2.6.5.5Packet Length
This 16-bit field specifies the number of data bytes in the entire packet. This value is initialized to zero by
the software application for empty packet buffers. The value is filled in by the EMAC on the first buffer
used for a given packet. This is signified by the EMAC setting a start of packet (SOP) flag. The packet
length is set by the EMAC on all SOP buffer descriptors.
2.6.5.6Start of Packet (SOP) Flag
When set, this flag indicates that the descriptor points to a packet buffer that is the start of a new packet.
In the case of a single fragment packet, both the SOP and end of packet (EOP) flags are set. Otherwise,
the descriptor pointing to the last packet buffer for the packet has the EOP flag set. This flag is initially
cleared by the software application before adding the descriptor to the receive queue. This bit is set by the
EMAC on SOP descriptors.
www.ti.com
2.6.5.7End of Packet (EOP) Flag
When set, this flag indicates that the descriptor points to a packet buffer that is last for a given packet. In
the case of a single fragment packet, both the start of packet (SOP) and EOP flags are set. Otherwise, the
descriptor pointing to the last packet buffer for the packet has the EOP flag set. This flag is initially cleared
by the software application before adding the descriptor to the receive queue. This bit is set by the EMAC
on EOP descriptors.
2.6.5.8Ownership (OWNER) Flag
When set, this flag indicates that the descriptor is currently owned by the EMAC. This flag is set by the
software application before adding the descriptor to the receive descriptor queue. This flag is cleared by
the EMAC once it is finished with a given set of descriptors, associated with a received packet. The flag is
updated by the EMAC on SOP descriptor only. So when the application identifies that the OWNER flag is
cleared on an SOP descriptor, it may assume that all descriptors up to and including the first with the EOP
flag set have been released by the EMAC. (Note that in the case of single buffer packets, the same
descriptor will have both the SOP and EOP flags set.)
2.6.5.9End of Queue (EOQ) Flag
When set, this flag indicates that the descriptor in question was the last descriptor in the receive queue for
a given receive channel, and that the corresponding receiver channel has halted. This flag is initially
cleared by the software application prior to adding the descriptor to the receive queue. This bit is set by
the EMAC when the EMAC identifies that a descriptor is the last for a given packet received (also sets the
EOP flag), and there are no more descriptors in the receive list (next descriptor pointer is NULL).
The software application can use this bit to detect when the EMAC receiver for the corresponding channel
has halted. This is useful when the application appends additional free buffer descriptors to an active
receive queue. Note that this flag is valid on EOP descriptors only.
2.6.5.10Teardown Complete (TDOWNCMPLT) Flag
This flag is used when a receive queue is being torn down, or aborted, instead of being filled with received
data. This would happen under device driver reset or shutdown conditions. The EMAC sets this bit in the
descriptor of the first free buffer when the tear down occurs. No additional queue processing is performed.
28
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
This flag is set by the EMAC in the SOP buffer descriptor if the received packet includes the 4-byte CRC.
This flag should be cleared by the software application before submitting the descriptor to the receive
queue.
2.6.5.12Jabber Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet is a jabber frame and was
not discarded because the RXCEFEN bit was set in the RXMBPENABLE. Jabber frames are frames that
exceed the RXMAXLEN in length, and have CRC, code, or alignment errors.
2.6.5.13Oversize Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet is an oversized frame and
was not discarded because the RXCEFEN bit was set in the RXMBPENABLE.
2.6.5.14Fragment Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet is only a packet fragment
and was not discarded because the RXCEFEN bit was set in the RXMBPENABLE.
2.6.5.15Undersized Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet is undersized and was
not discarded because the RXCSFEN bit was set in the RXMBPENABLE.
Architecture
2.6.5.16Control Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet is an EMAC control frame
and was not discarded because the RXCMFEN bit was set in the RXMBPENABLE.
2.6.5.17Overrun Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet was aborted due to a
receive overrun.
2.6.5.18Code Error (CODEERROR) Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet contained a code error
and was not discarded because the RXCEFEN bit was set in the RXMBPENABLE.
2.6.5.19Alignment Error (ALIGNERROR) Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet contained an alignment
error and was not discarded because the RXCEFEN bit was set in the RXMBPENABLE.
2.6.5.20CRC Error (CRCERROR) Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet contained a CRC error
and was not discarded because the RXCEFEN bit was set in the RXMBPENABLE.
2.6.5.21No Match (NOMATCH) Flag
This flag is set by the EMAC in the SOP buffer descriptor, if the received packet did not pass any of the
EMAC’s address match criteria and was not discarded because the RXCAFEN bit was set in the
RXMBPENABLE. Although the packet is a valid Ethernet data packet, it was only received because the
EMAC is in promiscuous mode.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The basic functions of the EMAC control module (Figure 8) are to interface the EMAC and MDIO modules
to the rest of the system, and to provide for a local memory space to hold EMAC packet buffer descriptors.
Local memory is used to help avoid contention to device memory spaces. Other functions include the bus
arbiter, and interrupt control and pacing logic control.
www.ti.com
Figure 8. EMAC Control Module Block Diagram
2.7.1Internal Memory
2.7.2Bus Arbiter
The EMAC control module includes 8K bytes of internal memory. The internal memory block is essential
for allowing the EMAC to operate more independently of the CPU. It also prevents memory underflow
conditions when the EMAC issues read or write requests to descriptor memory. (Memory accesses to
read or write the actual Ethernet packet data are protected by the EMAC's internal FIFOs).
A descriptor is a 16-byte memory structure that holds information about a single Ethernet packet buffer,
which may contain a full or partial Ethernet packet. Thus with the 8K memory block provided for descriptor
storage, the EMAC module can send and received up to a combined 512 packets before it needs to be
serviced by application or driver software.
The EMAC control module bus arbiter operates transparently to the rest of the system. It is used:
•To arbitrate between the CPU and EMAC buses for access to internal descriptor memory.
•To arbitrate between internal EMAC buses for access to system memory.
30
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The EMAC control module combines multiple interrupt conditions generated by the EMAC and MDIO
modules into four separate interrupt signals that are mapped to a CPU interrupt via the CPU interrupt
controller. The four separate sources of interrupt can be individually enabled for each channel by the
CMRXTHRESHINTEN, CMRXINTEN, CMTXINTEN, and CMMISCINTEN registers.
2.7.3.1Transmit Pulse Interrupt
The EMAC control module receives the eight individual transmit interrupts originating from the EMAC
module, one for each of the eight channels, and combines them into a single transmit pulse interrupt to
the CPU. This transmit pulse interrupt is paced, as described in Section 2.7.4. The eight individual
transmit pending interrupt(s) are selected at the EMAC control module level, by setting one or more bits in
the EMAC control module transmit interrupt enable register (CMTXINTEN). The masked interrupt status
can be read in the EMAC control module transmit interrupt status register (CMTXINTSTAT).
Upon reception of a transmit pulse interrupt, the ISR performs the following:
1. Read CMTXINTSTAT to determine which channel(s) caused the interrupt.
2. Process received packets for the interrupting channel(s).
3. Write the appropriate CPGMAC transmit channel n completion pointer register(s) (TXnCP) with the
address of the last buffer descriptor of the last packet processed by the application software.
4. Write the MAC end of interrupt vector register (MACEOIVECTOR) in the EMAC module with a value of
2h to signal the end of the transmit interrupt processing.
Architecture
2.7.3.2Receive Pulse Interrupt
The EMAC control module receives the eight individual receive interrupts originating from the EMAC
module, one for each of the eight channels, and combines them into a single receive pulse interrupt to the
CPU. This receive pulse interrupt is paced, as described in Section 2.7.4. The eight individual receive
pending interrupt(s) are selected at the EMAC control module level, by setting one or more bits in the
EMAC control module receive interrupt enable register (CMRXINTEN). The masked interrupt status can
be read in the EMAC control module receive interrupt status register (CMRXINTSTAT).
Upon reception of a receive pulse interrupt, the ISR performs the following:
1. Read CMRXINTSTAT to determine which channel(s) caused the interrupt.
2. Process received packets for the interrupting channel(s).
3. Write the appropriate CPGMAC receive channel n completion pointer register(s) (RXnCP) with the
address of the last buffer descriptor of the last packet processed by the application software.
4. Write the MAC end of interrupt vector register (MACEOIVECTOR) in the EMAC module with a value of
1h to signal the end of the receive interrupt processing.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The EMAC control module receives the eight individual receive threshold interrupts originating from the
EMAC module, one for each of the eight channels, and combines them into a single receive threshold
pulse interrupt to the CPU. This receive threshold pulse interrupt is not paced. The eight individual receive
threshold pending interrupt(s) are selected at the EMAC control module level, by setting one or more bits
in the EMAC control module receive threshold interrupt enable register (CMRXTHRESHINTEN). The
masked interrupt status can be read in the EMAC control module receive threshold interrupt status
register (CMRXTHRESHINTSTAT).
Upon reception of a receive threshold pulse interrupt, the ISR performs the following:
1. Read CMRXTHRESHINTSTAT to determine which channel(s) caused the interrupt.
2. Process received packets in order to add more buffers to any channel that is below the threshold
value.
3. Write the appropriate CPGMAC receive channel n completion pointer register(s) (RXnCP) with the
address of the last buffer descriptor of the last packet processed by the application software.
4. Write the MAC end of interrupt vector register (MACEOIVECTOR) in the EMAC module with a value of
0 to signal the end of the receive threshold interrupt processing.
2.7.3.4Miscellaneous Pulse Interrupt
The EMAC control module receives the STATPEND and HOSTPEND interrupts from the EMAC module
and the MDIO_LINKINT and MDIO_USERINT interrupts from the MDIO module. The EMAC control
module combines these four interrupts into a single miscellaneous pulse interrupt to the CPU. This
miscellaneous interrupt is not paced. The four individual interrupts are selected at the EMAC control
module level, by setting one or more bits in the EMAC control module miscellaneous interrupt enable
register (CMMISCINTEN). The masked interrupt status can be read in the EMAC control module
miscellaneous interrupt status register (CMMISCINTSTAT).
Upon reception of a miscellaneous pulse interrupt, the ISR performs the following:
1. Read CMMISCINTSTAT to determine which of the four condition(s) caused the interrupt.
2. Process those interrupts accordingly.
3. Write the MAC end of interrupt vector register (MACEOIVECTOR) in the EMAC module with a value of
3h to signal the end of the miscellaneous interrupt processing.
www.ti.com
2.7.4Interrupt Pacing
The receive and transmit pulse interrupts can be paced. The receive threshold and miscellaneous
interrupts can not be paced. The interrupt pacing feature limits the number of interrupts to the CPU during
a given period of time. For heavily loaded systems in which interrupts can occur at a very high rate, the
performance benefit is significant due to minimizing the overhead associated with servicing each interrupt.
The receive and transmit pulse interrupts contain a separate interrupt pacing sub-blocks. Each sub-block
is disabled by default allowing the selected interrupt inputs to pass-through unaffected.
The interrupt pacing module counts the number of interrupts that occur over a 1 ms interval of time. At the
end of each 1 ms interval, the current number of interrupts is compared with a target number of interrupts
(specified by the associated EMAC control module interrupts per millisecond registers, CMTXINTMAX and
CMRXINTMAX). Based on the results of the comparison, the length of time during which interrupts are
blocked is dynamically adjusted. The 1 ms interval is derived from a 4 ms pulse that is created from a
prescale counter whose value is set in the INTPRESCALE field of the EMAC control module interrupt
control register (CMINTCTRL). This INTPRESCALE value should be written with the number of peripheral
clock periods in 4 ms. The pacing timer determines the interval during which interrupts are blocked and
decrements every 4 ms. It is reloaded each time a zero count is reached. The value loaded into the pacing
timer is calculated by hardware every 1 ms, according to the dynamic algorithm in the hardware.
If the rate of transmit pulse interrupt inputs is much less than the target transmit pulse interrupt rate
specified in CMTXINTMAX, then the interrupts are not blocked to the CPU. If the transmit pulse interrupt
rate is greater than the specified target rate in CMTXINTMAX, the interrupt is paced at the rate specified
in this register, which should be written with a value between 2 and 63 inclusive, indicating the target
number of interrupts per 1 ms going to the CPU. Similarly, the number of receive interrupt pulses to the
CPU is also separately controlled.
32
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The MDIO module is used to manage up to 32 physical layer (PHY) devices connected to the Ethernet
Media Access Controller (EMAC). The DM36x device supports a single PHY being connected to the
EMAC at any given time. The MDIO module is designed to allow almost transparent operation of the
MDIO interface with little maintenance from the CPU.
The MDIO module continuously polls 32 MDIO addresses in order to enumerate all PHY devices in the
system. Once a PHY device has been detected, the MDIO module reads the MDIO PHY link status
register (LINK) to monitor the PHY link state. Link change events are stored in the MDIO module, which
can interrupt the CPU. This storing of the events allows the CPU to poll the link status of the PHY device
without continuously performing MDIO module accesses. However, when the CPU must access the MDIO
module for configuration and negotiation, the MDIO module performs the MDIO read or write operation
independent of the CPU. This independent operation allows the processor to poll for completion or
interrupt the CPU once the operation has completed.
2.8.1MDIO Module Components
The MDIO module (Figure 9) interfaces to the PHY components through two MDIO pins (MDCLK and
MDIO), and to the CPU through the EMAC control module and the configuration bus. The MDIO module
consists of the following logical components:
•MDIO clock generator
•Global PHY detection and link state monitoring
•Active PHY monitoring
•PHY register user access
Architecture
Figure 9. MDIO Module Block Diagram
2.8.1.1MDIO Clock Generator
The MDIO clock generator controls the MDIO clock based on a divide-down of the peripheral clock
(PLL1/6) in the EMAC control module. The MDIO clock is specified to run up to 2.5 MHz, although typical
operation would be 1.0 MHz. Since the peripheral clock frequency is variable (PLL1/6), the application
software or driver controls the divide-down amount.
2.8.1.2Global PHY Detection and Link State Monitoring
The MDIO module continuously polls all 32 MDIO addresses in order to enumerate the PHY devices in the
system. The module tracks whether or not a PHY on a particular address has responded, and whether or
not the PHY currently has a link. Using this information allows the software application to quickly
determine which MDIO address the PHY is using.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Once a PHY candidate has been selected for use, the MDIO module transparently monitors its link state
by reading the MDIO PHY link status register (LINK). Link change events are stored on the MDIO device
and can optionally interrupt the CPU. This allows the system to poll the link status of the PHY device
without continuously performing costly MDIO accesses.
2.8.1.4PHY Register User Access
When the CPU must access MDIO for configuration and negotiation, the PHY access module performs
the actual MDIO read or write operation independent of the CPU. This allows the CPU to poll for
completion or receive an interrupt when the read or write operation has been performed. The user access
registers USERACCESSn allows the software to submit the access requests for the PHY connected to the
device.
2.8.2MDIO Module Operational Overview
The MDIO module implements the 802.3 serial management interface to interrogate and control an
Ethernet PHY, using a shared two-wired bus. It separately performs autodetection and records the current
link status of up to 32 PHYs, polling all 32 MDIO addresses.
Application software uses the MDIO module to configure the autonegotiation parameters of the PHY
attached to the EMAC, retrieve the negotiation results, and configure required parameters in the EMAC.
In this device, the Ethernet PHY attached to the system can be directly controlled and queried. The Media
Independent Interface (MII) address of this PHY device is specified in one of the PHYADRMON bits in the
MDIO user PHY select register (USERPHYSELn). The MDIO module can be programmed to trigger a
CPU interrupt on a PHY link change event, by setting the LINKINTENB bit in USERPHYSELn. Reads and
writes to registers in this PHY device are performed using the MDIO user access register
(USERACCESSn).
The MDIO module powers-up in an idle state until specifically enabled by setting the ENABLE bit in the
MDIO control register (CONTROL). At this time, the MDIO clock divider and preamble mode selection are
also configured. The MDIO preamble is enabled by default, but can be disabled when the connected PHY
does not require it. Once the MDIO module is enabled, the MDIO interface state machine continuously
polls the PHY link status (by reading the generic status register) of all possible 32 PHY addresses and
records the results in the MDIO PHY alive status register (ALIVE) and MDIO PHY link status register
(LINK). The corresponding bit for the connected PHY (0-31) is set in ALIVE, if the PHY responded to the
read request. The corresponding bit is set in LINK, if the PHY responded and also is currently linked. In
addition, any PHY register read transactions initiated by the application software using USERACCESSn
causes ALIVE to be updated.
The USERPHYSELn is used to track the link status of the connected PHY address. A change in the link
status of the PHY being monitored sets the appropriate bit in the MDIO link status change interrupt
registers (LINKINTRAW and LINKINTMASKED), if enabled by the LINKINTENB bit in USERPHYSELn.
While the MDIO module is enabled, the host issues a read or write transaction over the MII management
interface using the DATA, PHYADR, REGADR, and WRITE bits in USERACCESSn. When the application
sets the GO bit in USERACCESSn, the MDIO module begins the transaction without any further
intervention from the CPU. Upon completion, the MDIO module clears the GO bit and sets the
corresponding USERINTRAW bit (0 or 1) in the MDIO user command complete interrupt register
(USERINTRAW) corresponding to USERACCESSn used. The corresponding USERINTMASKED bit (0 or
1) in the MDIO user command complete interrupt register (USERINTMASKED) may also be set,
depending on the mask setting configured in the MDIO user command complete interrupt mask set
register (USERINTMASKSET) and the MDIO user interrupt mask clear register (USERINTMASKCLEAR).
A round-robin arbitration scheme is used to schedule transactions that may be queued using both
USERACCESS0 and USERACCESS1. The application software must check the status of the GO bit in
USERACCESSn before initiating a new transaction, to ensure that the previous transaction has
completed. The application software can use the ACK bit in USERACCESSn to determine the status of a
read transaction.
www.ti.com
34
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The following steps are performed by the application software or device driver to initialize the MDIO
device:
1. Configure the PREAMBLE and CLKDIV bits in the MDIO control register (CONTROL).
2. Enable the MDIO module by setting the ENABLE bit in CONTROL.
3. The MDIO PHY alive status register (ALIVE) can be read in polling fashion until a PHY connected to
the system responded, and the MDIO PHY link status register (LINK) can determine whether this PHY
already has a link.
4. Setup the appropriate PHY addresses in the MDIO user PHY select register (USERPHYSELn), and set
the LINKINTENB bit to enable a link change event interrupt if desirable.
5. If an interrupt on general MDIO register access is desired, set the corresponding bit in the MDIO user
command complete interrupt mask set register (USERINTMASKSET) to use the MDIO user access
register (USERACCESSn). Since only one PHY is used in this device, the application software can use
one USERACCESSn to trigger a completion interrupt; the other USERACCESSn is not setup.
2.8.2.2Writing Data To a PHY Register
The MDIO module includes a user access register (USERACCESSn) to directly access a specified PHY
device. To write a PHY register, perform the following:
1. Check to ensure that the GO bit in the MDIO user access register (USERACCESSn) is cleared.
2. Write to the GO, WRITE, REGADR, PHYADR, and DATA bits in USERACCESSn corresponding to the
PHY and PHY register you want to write.
3. The write operation to the PHY is scheduled and completed by the MDIO module. Completion of the
write operation can be determined by polling the GO bit in USERACCESSn for a 0.
4. Completion of the operation sets the corresponding USERINTRAW bit (0 or 1) in the MDIO user
command complete interrupt register (USERINTRAW) corresponding to USERACCESSn used. If
interrupts have been enabled on this bit using the MDIO user command complete interrupt mask set
register (USERINTMASKSET), then the bit is also set in the MDIO user command complete interrupt
register (USERINTMASKED) and an interrupt is triggered on the CPU.
Architecture
2.8.2.3Reading Data From a PHY Register
The MDIO module includes a user access register (USERACCESSn) to directly access a specified PHY
device. To read a PHY register, perform the following:
1. Check to ensure that the GO bit in the MDIO user access register (USERACCESSn) is cleared.
2. Write to the GO, REGADR, and PHYADR bits in USERACCESSn corresponding to the PHY and PHY
register you want to read.
3. The read data value is available in the DATA bits in USERACCESSn after the module completes the
read operation on the serial bus. Completion of the read operation can be determined by polling the
GO and ACK bits in USERACCESSn. Once the GO bit has cleared, the ACK bit is set on a successful
read.
4. Completion of the operation sets the corresponding USERINTRAW bit (0 or 1) in the MDIO user
command complete interrupt register (USERINTRAW) corresponding to USERACCESSn used. If
interrupts have been enabled on this bit using the MDIO user command complete interrupt mask set
register (USERINTMASKSET), then the bit is also set in the MDIO user command complete interrupt
register (USERINTMASKED) and an interrupt is triggered on the CPU.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The MDIO module uses the MDIO user access register (USERACCESSn) to access the PHY control
registers. Software functions that implement the access process may simply be the following four macros:
www.ti.com
• PHYREG_read( regadr, phyadr )
• PHYREG_write( regadr, phyadr, data )
• PHYREG_wait( )
• PHYREG_waitResults( results )
Note that it is not necessary to wait after a write operation, as long as the status is checked before every
operation to make sure the MDIO hardware is idle. An alternative approach is to call PHYREG_wait() after
every write, and PHYREG_waitResults( ) after every read, then the hardware can be assumed to be idle
when starting a new operation.
The implementation of these macros using the chip support library (CSL) is shown in Example 3
(USERACCESS0 is assumed).
Note that this implementation does not check the ACK bit in USERACCESSn on PHY register reads (does
not follow the procedure outlined in Section 2.8.2.3). Since the MDIO PHY alive status register (ALIVE) is
used to initially select a PHY, it is assumed that the PHY is acknowledging read operations. It is possible
that a PHY could become inactive at a future point in time. An example of this would be a PHY that can
have its MDIO addresses changed while the system is running. It is not very likely, but this condition can
be tested by periodically checking the PHY state in ALIVE.
Start the process of reading a PHY register
Start the process of writing a PHY register
Synchronize operation (make sure read/write is idle)
Wait for read to complete and return data read
This section discusses the architecture and basic function of the EMAC module.
2.9.1EMAC Module Components
The EMAC module (Figure 10) interfaces to the outside world through the Media Independent Interface
(MII) and interfaces to the system core through the EMAC control module. The EMAC consists of the
following logical components:
•The receive path includes: receive DMA engine, receive FIFO, and MAC receiver
•The transmit path includes: transmit DMA engine, transmit FIFO, and MAC transmitter
•Statistics logic
•State RAM
•Interrupt controller
•Control registers and logic
•Clock and reset logic
Figure 10. EMAC Module Block Diagram
Architecture
2.9.1.1Receive DMA Engine
The receive DMA engine is the interface between the receive FIFO and the system core. It interfaces to
the CPU through the bus arbiter in the EMAC control module. This DMA engine is totally independent of
the device DMA.
2.9.1.2Receive FIFO
The receive FIFO consists of 68 cells of 64 bytes each and associated control logic. The FIFO buffers
receive data in preparation for writing into packet buffers in device memory, and also enable receive FIFO
flow control.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The MAC receiver detects and processes incoming network frames, de-frames them, and puts them into
the receive FIFO. The MAC receiver also detects errors and passes statistics to the statistics RAM.
2.9.1.4Receive Address
This sub-module performs address matching and address filtering based on the incoming packet’s
destination address. It contains a 32-by-53 bit two-port RAM, in which up to 32 addresses can be stored to
be either matched or filtered by the EMAC. The RAM may contain multicast packet addresses, but the
associated channel must have the unicast enable bit set, even though it is a multicast address. The
unicast enable bits are used with multicast addresses in the receive address RAM (not the multicast hash
enable bits). Therefore, hash matches can be disabled, but specific multicast addresses can be matched
(or filtered) in the RAM. If a multicast packet hash matches, the packet may still be filtered in the RAM.
Each packet can be sent to only a single channel.
2.9.1.5Transmit DMA Engine
The transmit DMA engine is the interface between the transmit FIFO and the CPU. It interfaces to the
CPU through the bus arbiter in the EMAC control module.
2.9.1.6Transmit FIFO
The transmit FIFO consists of 24 cells of 64 bytes each and associated control logic. This enables a
packet of 1518 bytes (standard Ethernet packet size) to be sent without the possibility of underrun. The
FIFO buffers data in preparation for transmission.
www.ti.com
2.9.1.7MAC Transmitter
The MAC transmitter formats frame data from the transmit FIFO and transmits the data using the
CSMA/CD access protocol. The frame CRC can be automatically appended, if required. The MAC
transmitter also detects transmission errors and passes statistics to the statistics registers.
2.9.1.8Statistics Logic
The Ethernet statistics are counted and stored in the statistics logic RAM. This statistics RAM keeps track
of 36 different Ethernet packet statistics.
2.9.1.9State RAM
State RAM contains the head descriptor pointers and completion pointers registers for both transmit and
receive channels.
2.9.1.10EMAC Interrupt Controller
The interrupt controller contains the interrupt related registers and logic. The 18 raw EMAC interrupts are
input to this submodule and masked module interrupts are output.
2.9.1.11Control Registers and Logic
The EMAC is controlled by a set of memory-mapped registers. The control logic also signals transmit,
receive, and status related interrupts to the CPU through the EMAC control module.
2.9.1.12Clock and Reset Logic
The clock and reset submodule generates all the EMAC clocks and resets. For more details on reset
capabilities, see Section 2.15.1.
38
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
After reset, initialization, and configuration, the application software running on the host may initiate
transmit operations. Transmit operations are initiated by host writes to the appropriate transmit channel
head descriptor pointer contained in the state RAM block. The transmit DMA controller then fetches the
first packet in the packet chain from memory. The DMA controller writes the packet into the transmit FIFO
in bursts of 64-byte cells. When the threshold number of cells, configurable using the TXCELLTHRESH bit
in the FIFO control register (FIFOCONTROL), have been written to the transmit FIFO, or a complete
packet, whichever is smaller, the MAC transmitter then initiates the packet transmission. The SYNC block
transmits the packet over the MII interfaces in accordance with the 802.3 protocol. Transmit statistics are
counted by the statistics block.
Receive operations are initiated by host writes to the appropriate receive channel head descriptor pointer
after host initialization and configuration. The SYNC submodule receives packets and strips off the
Ethernet related protocol. The packet data is input to the MAC receiver, which checks for address match
and processes errors. Accepted packets are then written to the receive FIFO in bursts of 64-byte cells.
The receive DMA controller then writes the packet data to memory. Receive statistics are counted by the
statistics block.
The EMAC module operates independently of the CPU. It is configured and controlled by its register set
mapped into device memory. Information about data packets is communicated by use of 16-byte
descriptors that are placed in an 8K-byte block of RAM in the EMAC control module.
For transmit operations, each 16-byte descriptor describes a packet or packet fragment in the system's
internal or external memory. For receive operations, each 16-byte descriptor represents a free packet
buffer or buffer fragment. On both transmit and receive, an Ethernet packet is allowed to span one or
more memory fragments, represented by one 16-byte descriptor per fragment. In typical operation, there is
only one descriptor per receive buffer, but transmit packets may be fragmented, depending on the
software architecture.
An interrupt is issued to the CPU whenever a transmit or receive operation has completed. However, it is
not necessary for the CPU to service the interrupt while there are additional resources available. In other
words, the EMAC continues to receive Ethernet packets until its receive descriptor list has been
exhausted. On transmit operations, the transmit descriptors need only be serviced to recover their
associated memory buffer. Thus, it is possible to delay servicing of the EMAC interrupt if there are
real-time tasks to perform.
Eight channels are supplied for both transmit and receive operations. On transmit, the eight channels
represent eight independent transmit queues. The EMAC can be configured to treat these channels as an
equal priority "round-robin" queue or as a set of eight fixed-priority queues. On receive, the eight channels
represent eight independent receive queues with packet classification. Packets are classified based on the
destination MAC address. Each of the eight channels is assigned its own MAC address, enabling the
EMAC module to act like eight virtual MAC adapters. Also, specific types of frames can be sent to specific
channels. For example, multicast, broadcast, or other (promiscuous, error, etc.), can each be received on
a specific receive channel queue.
The EMAC keeps track of 36 different statistics, plus keeps the status of each individual packet in its
corresponding packet descriptor.
Architecture
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The following sections discuss the operation of the Media Independent Interface (MII) in 10 Mbps and
100 Mbps mode. An IEEE 802.3 compliant Ethernet MAC controls the interface.
2.10.1Data Reception
2.10.1.1Receive Control
Data received from the PHY is interpreted and output to the EMAC receive FIFO. Interpretation involves
detection and removal of the preamble and start-of-frame delimiter, extraction of the address and frame
length, data handling, error checking and reporting, cyclic redundancy checking (CRC), and statistics
control signal generation. Address detection and frame filtering is performed outside the MII interface.
2.10.1.2Receive Inter-Frame Interval
The 802.3 standard requires an interpacket gap (IPG), which is 24 MII clocks (96 bit times). However, the
EMAC can tolerate a reduced IPG (2 MII clocks or 8 bit times) with a correct preamble and start frame
delimiter. This interval between frames must comprise (in the following order):
1. An Interpacket Gap (IPG).
2. A 7-byte preamble (all bytes 55h).
3. A 1-byte start of frame delimiter (5DH).
2.10.1.3Receive Flow Control
When enabled and triggered, receive flow control is initiated to limit the EMAC from further frame
reception. Two forms of receive flow control are implemented on the device:
•Receive buffer flow control
•Receive FIFO flow control
When enabled and triggered, receive buffer flow control prevents further frame reception based on the
number of free buffers available. Receive buffer flow control issues flow control collisions in half-duplex
mode and IEEE 802.3X pause frames for full-duplex mode. Receive buffer flow control is triggered when
the number of free buffers in any enabled receive channel free buffer count register (RXnFREEBUFFER)
is less than or equal to the receive channel flow control threshold register (RXnFLOWTHRESH) value.
Receive flow control is independent of receive QOS, except that both use the free buffer values.
When enabled and triggered, receive FIFO flow control prevents further frame reception based on the
number of cells currently in the receive FIFO. Receive FIFO flow control may be enabled only in
full-duplex mode (FULLDUPLEX bit is set in the in the MAC control register, MACCONTROL). Receive
flow control prevents reception of frames on the port until all of the triggering conditions clear, at which
time frames may again be received by the port.
Receive FIFO flow control is triggered when the occupancy of the FIFO is greater than or equal to the
RXFIFOFLOWTHRESH value in the FIFO control register (FIFOCONTROL). The RXFIFOFLOWTHRESH
value must be greater than or equal to 1h and less than or equal to 42h (decimal 66). The
RXFIFOFLOWTHRESH reset value is 2h.
Receive flow control is enabled by the RXBUFFERFLOWEN bit and the RXFIFOFLOWEN bit in
MACCONTROL. The FULLDUPLEX bit in MACCONTROL configures the EMAC for collision or
IEEE 802.3X flow control.
www.ti.com
40
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
2.10.1.3.1 Collision-Based Receive Buffer Flow Control
Collision-based receive buffer flow control provides a means of preventing frame reception when the
EMAC is operating in half-duplex mode (the FULLDUPLEX bit is cleared in MACCONTROL). When
receive flow control is enabled and triggered, the EMAC generates collisions for received frames. The jam
sequence transmitted is the 12-byte sequence C3.C3.C3.C3.C3.C3.C3.C3.C3.C3.C3.C3h. The jam
sequence begins no later than approximately as the source address starts to be received. Note that these
forced collisions are not limited to a maximum of 16 consecutive collisions, and are independent of the
normal back-off algorithm.
Receive flow control does not depend on the value of the incoming frame destination address. A collision
is generated for any incoming packet, regardless of the destination address, if any EMAC enabled
channel’s free buffer register value is less than or equal to the channel’s flow threshold value.
2.10.1.3.2 IEEE 802.3x-Based Receive Buffer Flow Control
IEEE 802.3x-based receive buffer flow control provides a means of preventing frame reception when the
EMAC is operating in full-duplex mode (the FULLDUPLEX bit is set in MACCONTROL). When receive
flow control is enabled and triggered, the EMAC transmits a pause frame to request that the sending
station stop transmitting for the period indicated within the transmitted pause frame.
The EMAC transmits a pause frame to the reserved multicast address at the first available opportunity
(immediately if currently idle or following the completion of the frame currently being transmitted). The
pause frame contains the maximum possible value for the pause time (FFFFh). The EMAC counts the
receive pause frame time (decrements FF00h to 0) and retransmits an outgoing pause frame, if the count
reaches 0. When the flow control request is removed, the EMAC transmits a pause frame with a zero
pause time to cancel the pause request.
Note that transmitted pause frames are only a request to the other end station to stop transmitting.
Frames that are received during the pause interval are received normally (provided the receive FIFO is not
full).
Pause frames are transmitted if enabled and triggered, regardless of whether or not the EMAC is
observing the pause time period from an incoming pause frame.
The EMAC transmits pause frames as described below:
•The 48-bit source address (set using the MACSRCADDRLO and MACSRCADDRHI registers).
•The 16-bit length/type field containing the value 88.08h.
•The 16-bit pause opcode equal to 00.01h.
•The 16-bit pause time value of FF.FFh. A pause-quantum is 512 bit-times. Pause frames sent to
cancel a pause request have a pause time value of 00.00h.
•Zero padding to 64-byte data length (EMAC transmits only 64-byte pause frames).
•The 32-bit frame-check sequence (CRC word).
All quantities are hexadecimal and are transmitted most-significant byte first. The least-significant bit (LSB)
is transferred first in each byte.
If the RXBUFFERFLOWEN bit in MACCONTROL is cleared to 0 while the pause time is nonzero, then the
pause time is cleared to 0 and a zero count pause frame is sent.
Architecture
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The EMAC passes data to the PHY from the transmit FIFO (when enabled). Data is synchronized to the
transmit clock rate. Transmission begins when there are TXCELLTHRESH cells of 64 bytes each, or a
complete packet, in the FIFO.
2.10.2.1Transmit Control
A jam sequence is output if a collision is detected on a transmit packet. If the collision was late (after the
first 64 bytes have been transmitted), the collision is ignored. If the collision is not late, the controller will
back off before retrying the frame transmission. When operating in full-duplex mode, the carrier sense
(EMAC_CRS) and collision-sensing (EMAC_COL) modes are disabled.
2.10.2.2CRC Insertion
If the SOP buffer descriptor PASSCRC flag is cleared, the EMAC generates and appends a 32-bit
Ethernet CRC onto the transmitted data. For the EMAC-generated CRC case, a CRC (or placeholder) at
the end of the data is allowed but not required. The buffer byte count value should not include the CRC
bytes, if they are present.
If the SOP buffer descriptor PASSCRC flag is set, then the last four bytes of the transmit data are
transmitted as the frame CRC. The four CRC data bytes should be the last four bytes of the frame and
should be included in the buffer byte count value. The MAC performs no error checking on the outgoing
CRC.
2.10.2.3Adaptive Performance Optimization (APO)
The EMAC incorporates adaptive performance optimization (APO) logic that may be enabled by setting
the TXPACE bit in the MAC control register (MACCONTROL). Transmission pacing to enhance
performance is enabled when the TXPACE bit is set. Adaptive performance pacing introduces delays into
the normal transmission of frames, delaying transmission attempts between stations, reducing the
probability of collisions occurring during heavy traffic (as indicated by frame deferrals and collisions),
thereby, increasing the chance of successful transmission.
When a frame is deferred, suffers a single collision, multiple collisions, or excessive collisions, the pacing
counter is loaded with an initial value of 31. When a frame is transmitted successfully (without
experiencing a deferral, single collision, multiple collision, or excessive collision), the pacing counter is
decremented by 1, down to 0.
With pacing enabled, a new frame is permitted to immediately (after one interpacket gap) attempt
transmission only if the pacing counter is 0. If the pacing counter is nonzero, the frame is delayed by the
pacing delay of approximately four interpacket gap (IPG)delays. APO only affects the IPG preceding the
first attempt at transmitting a frame; APO does not affect the back-off algorithm for retransmitted frames.
www.ti.com
2.10.2.4Interpacket-Gap (IPG) Enforcement
The measurement reference for the IPG of 96 bit times is changed depending on frame traffic conditions.
If a frame is successfully transmitted without collision and EMAC_CRS is deasserted within approximately
48 bit times of EMAC_TX_EN being deasserted, then 96 bit times is measured from EMAC_TX_EN. If the
frame suffered a collision or EMAC_CRS is not deasserted until more than approximately 48 bit times
after EMAC_TX_EN is deasserted, then 96 bit times (approximately, but not less) is measured from
EMAC_CRS.
2.10.2.5Back Off
The EMAC implements the 802.3 binary exponential back-off algorithm.
42
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
Incoming pause frames are acted upon, when enabled, to prevent the EMAC from transmitting any further
frames. Incoming pause frames are only acted upon when the FULLDUPLEX and TXFLOWEN bits in the
MAC control register (MACCONTROL) are set. Pause frames are not acted upon in half-duplex mode.
Pause frame action is taken if enabled, but normally the frame is filtered and not transferred to memory.
MAC control frames are transferred to memory, if the RXCMFEN bit in the receive
multicast/broadcast/promiscuous channel enable register (RXMBPENABLE) is set. The TXFLOWEN and
FULLDUPLEX bits affect whether or not MAC control frames are acted upon, but they have no affect upon
whether or not MAC control frames are transferred to memory or filtered.
Pause frames are a subset of MAC control frames with an opcode field of 0001h. Incoming pause frames
are only acted upon by the EMAC if:
•TXFLOWEN bit is set in MACCONTROL
•The frame’s length is 64 to RXMAXLEN bytes inclusive
•The frame contains no CRC error or align/code errors
The pause time value from valid frames is extracted from the two bytes following the opcode. The pause
time is loaded into the EMAC transmit pause timer and the transmit pause time period begins. If a valid
pause frame is received during the transmit pause time period of a previous transmit pause frame then:
•If the destination address is not equal to the reserved multicast address or any enabled or disabled
unicast address, then the transmit pause timer immediately expires, or
•If the new pause time value is 0, then the transmit pause timer immediately expires, else
•The EMAC transmit pause timer immediately is set to the new pause frame pause time value. (Any
remaining pause time from the previous pause frame is discarded).
If the TXFLOWEN bit in MACCONTROL is cleared, then the pause timer immediately expires.
The EMAC does not start the transmission of a new data frame any sooner than 512 bit-times after a
pause frame with a nonzero pause time has finished being received (EMAC_RX_DV going inactive). No
transmission begins until the pause timer has expired (the EMAC may transmit pause frames in order to
initiate outgoing flow control). Any frame already in transmission when a pause frame is received is
completed and unaffected.
Incoming pause frames consist of:
•A 48-bit destination address equal to one of the following:
– The reserved multicast destination address 01.80.C2.00.00.01h
– Any EMAC 48-bit unicast address. Pause frames are accepted, regardless of whether the channel
is enabled or not.
•The 16-bit length/type field containing the value 88.08h.
•The 48-bit source address of the transmitting device.
•The 16-bit pause opcode equal to 00.01h.
•The 16-bit pause time. A pause-quantum is 512 bit-times.
•Padding to 64-byte data length.
•The 32-bit frame-check sequence (CRC word).
All quantities are hexadecimal and are transmitted most-significant byte first. The least-significant bit (LSB)
is transferred first in each byte.
The padding is required to make up the frame to a minimum of 64 bytes. The standard allows pause
frames longer than 64 bytes to be discarded or interpreted as valid pause frames. The EMAC recognizes
any pause frame between 64 bytes and RXMAXLEN bytes in length.
Architecture
2.10.2.7Speed, Duplex, and Pause Frame Support
The MAC operates at 10 Mbps or 100 Mbps, in half-duplex or full-duplex mode, and with or without pause
frame support as configured by the host.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
To configure the receive DMA for operation the host must:
•Initialize the receive addresses.
•Initialize the receive channel n DMA head descriptor pointer registers (RXnHDP) to 0.
•Write the MAC address hash n registers (MACHASH1 and MACHASH2), if hash matching multicast
addressing is desired.
•If flow control is to be enabled, initialize:
– the receive channel n free buffer count registers (RXnFREEBUFFER)
– the receive channel n flow control threshold register (RXnFLOWTHRESH)
– the receive filter low priority frame threshold register (RXFILTERLOWTHRESH)
•Enable the desired receive interrupts using the receive interrupt mask set register (RXINTMASKSET)
and the receive interrupt mask clear register (RXINTMASKCLEAR).
•Set the appropriate configuration bits in the MAC control register (MACCONTROL).
•Write the receive buffer offset register (RXBUFFEROFFSET) value (typically zero).
•Setup the receive channel(s) buffer descriptors and initialize RXnHDP.
•Enable the receive DMA controller by setting the RXEN bit in the receive control register
(RXCONTROL).
•Configure and enable the receive operation, as desired, in the receive
multicast/broadcast/promiscuous channel enable register (RXMBPENABLE) and by using the receive
unicast set register (RXUNICASTSET) and the receive unicast clear register (RXUNICASTCLEAR).
www.ti.com
2.11.2Receive Channel Enabling
Each of the eight receive channels has an enable bit (RXCHnEN) in the receive unicast enable set
register (RXUNICASTSET) that is controlled using RXUNICASTSET and the receive unicast clear register
(RXUNICASTCLEAR). The RXCHnEN bits determine whether the given channel is enabled (set to 1) to
receive frames with a matching unicast or multicast destination address.
The RXBROADEN bit in the receive multicast/broadcast/promiscuous channel enable register
(RXMBPENABLE) determines if broadcast frames are enabled or filtered. If broadcast frames are
enabled, then they are copied to only a single channel selected by the RXBROADCH field in
RXMBPENABLE.
The RXMULTEN bit in RXMBPENABLE determines if hash matching multicast frames are enabled or
filtered. Incoming multicast addresses (group addresses) are hashed into an index in the hash table. If the
indexed bit is set, the frame hash will match and it will be transferred to the channel selected by the
RXMULTCH field in RXMBPENABLE when multicast frames are enabled. The multicast hash bits are set
in the MAC address hash n registers (MACHASH1 and MACHASH2).
The RXPROMCH bits in RXMBPENABLE select the promiscuous channel to receive frames selected by
the RXCMFEN, RXCSFEN, RXCEFEN, and RXCAFEN bits. These four bits allow reception of MAC
control frames, short frames, error frames, and all frames (promiscuous), respectively.
The address RAM can be configured to set multiple unicast and/or multicast addresses to a given channel
(if the match bit is set in the RAM). Multicast addresses in the RAM are enabled by RXUNICASTSET and
not by the RXMULTEN bit in RXMBPENABLE, the RXMULTEN bit enables the hash multicast match only.
The address RAM takes precedence over the hash match.
If a multicast packet is received that hash matches (multicast packets enabled), but is filtered in the RAM,
then the packet is filtered. If a multicast packet does not hash match, regardless of whether or not hash
matching is enabled, but matches an enabled multicast address in the RAM, then the packet will be
transferred to the associated channel.
44
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The receive address block can store up to 32 addresses to be filtered or matched. Before enabling packet
reception, all the address RAM locations should be initialized, including locations to be unused. The
system software is responsible for adding and removing addresses from the RAM.
A MAC address location in RAM is 53 bits wide and consists of:
•48 bits of the MAC address.
•3 bits for the channel to which a valid address match will be transferred. The channel is a don’t care if
MATCHFILT bit is cleared
•A valid bit
•A match or filter bit
First, write the index into the address RAM in the MACINDEX register to start writing a MAC address.
Then write the upper 32 bits of the MAC address (MACADDRHI register), and then the lower 16 bits of
MAC address with the VALID and MATCHFILT control bits (MACADDRLO). The valid bit should be
cleared for the unused locations in the receive address RAM.
The most common uses for the receive address sub-module are:
•Set EMAC in promiscuous mode, using RXCAFEN and RXPROMCH bits in the RXMBPENABLE
register. Then filter up to 32 individual addresses, which can be both unicast and/or multicast.
•Disable the promiscuous mode (RXCAFEN = 0) and match up to 32 individual addresses, multicast
and/or unicast
Architecture
2.11.4Hardware Receive QOS Support
Hardware receive quality of service (QOS) is supported, when enabled, by the Tag Protocol Identifier
format and the associated Tag Control Information (TCI) format priority field. When the incoming frame
length/type value is equal to 81.00h, the EMAC recognizes the frame as an Ethernet Encoded Tag
Protocol Type. The two octets immediately following the protocol type contain the 16-bit TCI field. Bits
15-13 of the TCI field contain the received frames priority (0 to 7). The received frame is a low-priority
frame, if the priority value is 0 to 3; the received frame is a high-priority frame, if the priority value is 4 to 7.
All frames that have a length/type field value not equal to 81.00h are low-priority frames. Received frames
that contain priority information are determined by the EMAC as:
•A 48-bit (6 bytes) destination address equal to:
– The destination station's individual unicast address.
– The destination station's multicast address (MACHASH1 and MACHASH2).
– The broadcast address of all ones.
•A 48-byte (6 bytes) source address.
•The 16-bit (2 bytes) length/type field containing the value 81.00h.
•The 16-bit (2 bytes) TCI field with the priority field in the upper 3 bits.
•Data bytes
•The 4 bytes CRC.
The receive filter low priority frame threshold register (RXFILTERLOWTHRESH) and the receive channel
n free buffer count registers (RXnFREEBUFFER) are used in conjunction with the priority information to
implement receive hardware QOS. Low-priority frames are filtered if the number of free buffers
(RXnFREEBUFFER) for the frame channel is less than or equal to the filter low threshold
(RXFILTERLOWTHRESH) value. Hardware QOS is enabled by the RXQOSEN bit in the receive
multicast/broadcast/promiscuous channel enable register (RXMBPENABLE).
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The host must track free buffers for each enabled channel (including unicast, multicast, broadcast, and
promiscuous), if receive QOS or receive flow control is used. Disabled channel free buffer values are do
not cares. During initialization, the host should write the number of free buffers for each enabled channel
to the appropriate receive channel n free buffer count registers (RXnFREEBUFFER). The EMAC
decrements the appropriate channel’s free buffer value for each buffer used. When the host reclaims the
frame buffers, the host should write the channel free buffer register with the number of reclaimed buffers
(write to increment). There are a maximum of 65,535 free buffers available. RXnFREEBUFFER only
needs to be updated by the host if receive QOS or flow control is used.
2.11.6Receive Channel Teardown
The host commands a receive channel teardown by writing the channel number to the receive teardown
register (RXTEARDOWN). When a teardown command is issued to an enabled receive channel, the
following occurs:
•Any current frame in reception completes normally.
•The TDOWNCMPLT flag is set in the next buffer descriptor in the chain, if there is one.
•The channel head descriptor pointer is cleared to 0.
•A receive interrupt for the channel is issued to the host.
•The corresponding receive channel n completion pointer register (RXnCP) contains the value
FFFF FFCh.
Channel teardown may be commanded on any channel at any time. The host is informed of the teardown
completion by the set teardown complete (TDOWNCMPLT) buffer descriptor bit. The EMAC does not
clear any channel enables due to a teardown command. A teardown command to an inactive channel
issues an interrupt that software should acknowledge with an FFFF FFFCh acknowledge value to RXnCP
(note that there is no buffer descriptor in this case). Software may read RXnCP to determine if the
interrupt was due to a commanded teardown. The read value is FFFF FFFCh, if the interrupt was due to a
teardown command.
www.ti.com
2.11.7Receive Frame Classification
Received frames are proper (good) frames, if they are between 64 bytes and the value in the receive
maximum length register (RXMAXLEN) bytes in length (inclusive) and contain no code, align, or CRC
errors.
Received frames are long frames, if their frame count exceeds the value in RXMAXLEN. The RXMAXLEN
reset (default) value is 5EEh (1518 in decimal). Long received frames are either oversized or jabber
frames. Long frames with no errors are oversized frames; long frames with CRC, code, or alignment
errors are jabber frames.
Received frames are short frames, if their frame count is less than 64 bytes. Short frames that address
match and contain no errors are undersized frames; short frames with CRC, code, or alignment errors are
fragment frames. If the frame length is less than or equal to 20, then the frame CRC is passed, regardless
of whether the RXPASSCRC bit is set or cleared in the receive multicast/broadcast/promiscuous channel
enable register (RXMBPENABLE).
A received long packet always contains RXMAXLEN number of bytes transferred to memory (if the
RXCEFEN bit is set in RXMBPENABLE), regardless of the value of the RXPASSCRC bit. Following is an
example with RXMAXLEN set to 1518:
•If the frame length is 1518, then the packet is not a long packet and there are 1514 or 1518 bytes
transferred to memory depending on the value of the RXPASSCRC bit.
•If the frame length is 1519, there are 1518 bytes transferred to memory regardless of the
RXPASSCRC bit value. The last three bytes are the first three CRC bytes.
•If the frame length is 1520, there are 1518 bytes transferred to memory regardless of the
RXPASSCRC bit value. The last two bytes are the first two CRC bytes.
•If the frame length is 1521, there are 1518 bytes transferred to memory regardless of the
RXPASSCRC bit value. The last byte is the first CRC byte.
46
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
•If the frame length is 1522, there are 1518 bytes transferred to memory. The last byte is the last data
byte.
2.11.8Promiscuous Receive Mode
When the promiscuous receive mode is enabled by setting the RXCAFEN bit in the receive
multicast/broadcast/promiscuous channel enable register (RXMBPENABLE), nonaddress matching frames
that would normally be filtered are transferred to the promiscuous channel. Address matching frames that
would normally be filtered due to errors are transferred to the address match channel when the RXCAFEN
and RXCEFEN bits in RXMBPENABLE are set. A frame is considered to be an address matching frame
only if it is enabled to be received on a unicast, multicast, or broadcast channel. Frames received to
disabled unicast, multicast, or broadcast channels are considered nonaddress matching.
MAC control frames address match only if the RXCMFEN bit in RXMBPENABLE is set. The RXCEFEN
and RXCSFEN bits in RXMBPENABLE determine whether error frames are transferred to memory or not,
but they do not determine whether error frames are address matching or not. Short frames are a special
type of error frames.
A single channel is selected as the promiscuous channel by the RXPROMCH bit in RXMBPENABLE. The
promiscuous receive mode is enabled by the RXCMFEN, RXCEFEN, RXCSFEN, and RXCAFEN bits in
RXMBPENABLE. Table 4 shows the effects of the promiscuous enable bits. Proper frames are frames
that are between 64 bytes and the value in the receive maximum length register (RXMAXLEN) bytes in
length inclusive and contain no code, align, or CRC errors.
1X110Proper/oversize/jabber/code/align/CRC data and
1X111All address matching frames with and without
2.11.9Receive Overrun
The types of receive overrun are:
•FIFO start of frame overrun (FIFO_SOF)
•FIFO middle of frame overrun (FIFO_MOF)
•DMA start of frame overrun (DMA_SOF)
•DMA middle of frame overrun (DMA_MOF)
The statistics counters used to track these types of receive overrun are:
•Receive start of frame overruns register (RXSOFOVERRUNS)
•Receive middle of frame overruns register (RXMOFOVERRUNS)
•Receive DMA overruns register (RXDMAOVERRUNS)
Start of frame overruns happen when there are no resources available when frame reception begins. Start
of frame overruns increment the appropriate overrun statistic(s) and the frame is filtered.
Middle of frame overruns happen when there are some resources to start the frame reception, but the
resources run out during frame reception. In normal operation, a frame that overruns after starting the
frame reception is filtered and the appropriate statistic(s) are incremented; however, the RXCEFEN bit in
the receive multicast/broadcast/promiscuous channel enable register (RXMBPENABLE) affects overrun
frame treatment. Table 5 shows how the overrun condition is handled for the middle of frame overrun.
control frames transferred to address match
channel. No undersized/fragment frames are
transferred.
errors transferred to the address match channel
Table 5. Middle of Frame Overrun Treatment
Address MatchRXCAFENRXCEFENMiddle of Frame Overrun Treatment
00XOverrun frame filtered.
010Overrun frame filtered.
011As much frame data as possible is transferred to the promiscuous channel
1X0Overrun frame filtered with the appropriate overrun statistic(s) incremented.
1X1As much frame data as possible is transferred to the address match
until overrun. The appropriate overrun statistic(s) is incremented and the
OVERRUN and NOMATCH flags are set in the SOP buffer descriptor. Note
that the RXMAXLEN number of bytes cannot be reached for an overrun to
occur (it would be truncated and be a jabber or oversize).
channel until overrun. The appropriate overrun statistic(s) is incremented
and the OVERRUN flag is set in the SOP buffer descriptor. Note that the
RXMAXLEN number of bytes cannot be reached for an overrun to occur (it
would be truncated).
48
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The transmit DMA is an eight channel interface. Priority between the eight queues may be either fixed or
round-robin as selected by the TXPTYPE bit in the MAC control register (MACCONTROL). If the priority
type is fixed, then channel 7 has the highest priority and channel 0 has the lowest priority. Round-robin
priority proceeds from channel 0 to channel 7.
2.12.1Transmit DMA Host Configuration
To configure the transmit DMA for operation the host must perform:
•Write the MAC source address low bytes register (MACSRCADDRLO) and the MAC source address
high bytes register (MACSRCADDRHI) (used for pause frames on transmit).
•Initialize the transmit channel n DMA head descriptor pointer registers (TXnHDP) to 0.
•Enable the desired transmit interrupts using the transmit interrupt mask set register (TXINTMASKSET)
and the transmit interrupt mask clear register (TXINTMASKCLEAR).
•Set the appropriate configuration bits in the MAC control register (MACCONTROL).
•Setup the transmit channel(s) buffer descriptors in host memory.
•Enable the transmit DMA controller by setting the TXEN bit in the transmit control register
(TXCONTROL).
•Write the appropriate TXnHDP with the pointer to the first descriptor to start transmit operations.
2.12.2Transmit Channel Teardown
The host commands a transmit channel teardown by writing the channel number to the transmit teardown
register (TXTEARDOWN). When a teardown command is issued to an enabled transmit channel, the
following occurs:
•Any frame currently in transmission completes normally.
•The TDOWNCMPLT flag is set in the next SOP buffer descriptor in the chain, if there is one.
•The channel head descriptor pointer is cleared to 0.
•A transmit interrupt is issued to inform the host of the channel teardown.
•The corresponding transmit channel n completion pointer register (TXnCP) contains the value
FFFF FFFCh.
•The host should acknowledge a teardown interrupt with an FFFF FFFCh acknowledge value.
Architecture
Channel teardown may be commanded on any channel at any time. The host is informed of the teardown
completion by the set teardown complete (TDOWNCMPLT) buffer descriptor bit. The EMAC does not
clear any channel enables due to a teardown command. A teardown command to an inactive channel
issues an interrupt that software should acknowledge with an FFFF FFFCh acknowledge value to TXnCP
(note that there is no buffer descriptor in this case). Software may read the interrupt acknowledge location
(TXnCP) to determine if the interrupt was due to a commanded teardown. The read value is FFFF FFFCh,
if the interrupt was due to a teardown command.
2.13 Receive and Transmit Latency
The transmit FIFO contains twenty-four 64-byte cells and the receive FIFO contains sixty-eight 64-byte
cells. The EMAC begins transmission of a packet on the wire after TXCELLTHRESH cells (configurable
through the FIFO control register, FIFOCONTROL) or a complete packet are available in the FIFO.
Transmit underrun cannot occur for packet sizes of TXCELLTHRESH × 64 bytes (or less). For larger
packet sizes, transmit underrun can occur if the memory latency is greater than the time required to
transmit a 64-byte cell on the wire; this is 0.512 ms in 1 Gbit mode, 5.12 ms in 100 Mbps mode, and
51.2 ms in 10 Mbps mode. The memory latency time includes all buffer descriptor reads for the entire cell
data. The EMAC transmit FIFO uses 24 cells; thus, underrun cannot happen for a normal size packet (less
than 1536 packet bytes). Cell transmission can be configured to start only after an entire packet is
contained in the FIFO; for a maximum-size packet, set the TXCELLTHRESH field to the maximum
possible value of 24.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Receive overrun is prevented if the receive memory cell latency is less than the time required to transmit a
64-byte cell on the wire (0.512 ms in 1 Gbps mode, 5.12 ms in 100 Mbps mode, or 51.2ms in 10 Mbps
mode). The latency time includes any required buffer descriptor reads for the cell data.
Latency to descriptor RAM is low because RAM is local to the EMAC, as it is part of the EMAC control
module.
2.14 Transfer Node Priority
The DM36x device contains a chip-level register, master priority register (MSTPRI), that is used to set the
priority of the transfer node used in issuing memory transfer requests to system memory.
Although the EMAC has internal FIFOs to help alleviate memory transfer arbitration problems, the average
transfer rate of data read and written by the EMAC to internal or external processor memory must be at
least that of the Ethernet wire rate. In addition, the internal FIFO system can not withstand a single
memory latency event greater than the time it takes to fill or empty a TXCELLTHRESH number of internal
64-byte FIFO cells.
For 100 Mbps operation, these restrictions translate into the following rules:
•The short-term average, each 64-byte memory read/write request from the EMAC must be serviced in
no more than 5.12 ms.
•Any single latency event in request servicing can be no longer than (5.12 × TXCELLTHRESH) ms.
Bits 0-2 of the second chip-level master priority register (MSTPRI1) are used to set the transfer node
priority within the Switched Central Resource (SCR5) for the EMAC master peripheral.
A value of 000b has the highest priority, while 111b has the lowest priority. The default priority assigned to
the EMAC is 100b. It is important to have a balance between all peripherals. In most cases, the default
priorities will not need adjustment. For more information on the master peripherals priorities, see the
device-specific data manual.
www.ti.com
2.15 Reset Considerations
2.15.1Software Reset Considerations
Peripheral clock and reset control is done through the Power and Sleep Controller (PSC) module included
with the device. For more on how the EMAC, MDIO, and EMAC control module are disabled or placed in
reset at runtime from the registers located in the PSC module, see Section 2.18.
NOTE: For proper operation, both the EMAC and EMAC control module must be reset in the
following sequence. First, the soft reset of the EMAC module should be commanded. After
the reset takes effect (verified by reading back SOFTRESET), the soft reset of the EMAC
control module should be commanded.
Within the peripheral there are two controls to separately reset the EMAC and the EMAC control module.
•The EMAC component of the Ethernet MAC peripheral can be placed in a reset state by writing to the
soft reset register (SOFTRESET). Writing a 1 to the SOFTRESET bit, causes the EMAC logic to be
reset and the register values to be set to their default values. Software reset occurs when the receive
and transmit DMA controllers are in an idle state to avoid locking up the configuration bus; it is the
responsibility of the software to verify that there are no pending frames to be transferred. After writing a
1 to the SOFTRESET bit, it may be polled to determine if the reset has occurred. If a 1 is read, the
reset has not yet occurred; if a 0 is read, then a reset has occurred.
•The EMAC control module software reset register (CMSOFTRESET) is used to place the EMAC
control module logic in soft reset. This resets the control logic, the EMAC registers, as well as, the
EMAC control module 8KB internal memory that may be used for storing the transfer descriptors.
After a software reset operation, all the EMAC registers need to be reinitialized for proper data
transmission.
Unlike the EMAC module, the MDIO and EMAC control modules cannot be placed in reset from a register
inside their memory map.
50
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
When a hardware reset occurs, the EMAC peripheral has its register values reset and all the components
return to their default state. After the hardware reset, the EMAC needs to be initialized before being able
to resume its data transmission, as described in Section 2.16.
A hardware reset is the only means of recovering from the error interrupts (HOSTPEND), which are
triggered by errors in packet buffer descriptors. Before doing a hardware reset, you should inspect the
error codes in the MAC status register (MACSTATUS) that gives information about the type of software
error that needs to be corrected. For detailed information on error interrupts, see Section 2.17.1.5.
2.16 Initialization
2.16.1Enabling the EMAC/MDIO Peripheral
When the device is powered on, the EMAC peripheral is in a disabled state. Before any EMAC specific
initialization can take place, the EMAC needs to be enabled; otherwise, its registers cannot be written and
the reads will all return a value of zero.
The EMAC/MDIO is enabled through the Power and Sleep Controller (PSC) registers. For information on
how to enable the EMAC peripheral from the PSC, see the TMS320DM365 Digital Media System-on-Chip(DMSoC) ARM Subsystem Reference Guide (SPRUFG5) (SPRUFB3).
When first enabled, the EMAC peripheral registers are set to their default values. After enabling the
peripheral, you may proceed with the module specific initialization.
Architecture
2.16.2EMAC Control Module Initialization
The EMAC control module is used for global interrupt enable, and to pace back-to-back interrupts using
an interrupt retrigger count based on the peripheral clock (PLL1/6). There is also an 8K block of RAM local
to the EMAC that is used to hold packet buffer descriptors.
Note that although the EMAC control module and the EMAC module have slightly different functions, in
practice, the type of maintenance performed on the EMAC control module is more commonly conducted
from the EMAC module software (as opposed to the MDIO module).
The initialization of the EMAC control module consists of two parts:
1. Configuration of the interrupt to the CPU.
2. Initialization of the EMAC control module:
•Setting the registers related to interrupt pacing. This applies only to RXPulse and TXPulse
interrupts. By default, interrupts pacing is disabled. If pacing is enabled by programming the EMAC
control module interrupt control register (CMINTCTRL), then the CMTXINTMAX and
CMRXINTMAX registers have to be programmed, to indicate the maximum number of TX_PULSE
and RX_PULSE interrupts per millisecond.
•Initializing the EMAC and MDIO modules.
•Enabling interrupts in the EMAC control module using the EMAC control module interrupt control
registers (CMRXTHRESHINTEN, CMRXINTEN, CMTXINTEN, and CMMISCINTEN).
When using the register-level CSL, the code to perform the actions associated with the second part may
appear as in Example 4.
The process of mapping the EMAC interrupts to one of the CPU’s interrupts is done using the ARM
interrupt controller. Once the interrupt is mapped to a CPU interrupt, general masking and unmasking of
the interrupt (to control reentrancy) should be done at the chip level by manipulating the interrupt enable
mask.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Example 4. EMAC Control Module Initialization Code
Uint32 tmpval ;
/* Disable all the EMAC/MDIO interrupts in the control module */
EmacControlRegs->CONTROL.C_RX_EN = 0;
EmacControlRegs->CONTROL.C_TX_EN = 0;
EmacControlRegs->CONTROL.C_RX_THRESH_EN = 0;
EmacControlRegs->CONTROL.C_MISC_EN = 0;
/* Wait about 100 cycles */
for( I=0; i<5; I++ )
tmpval = ECTL_REGS->EWCTL ;
#ifdef INTT_PACING
/* Set the control related to pacing of TX and RX interrupts */
EmacControlRegs->INTR_COUNT->C_RX_IMAX = 0x4; // 4 RX intt/ms
EmacControlRegs->INTR_COUNT->C_TX_IMAX = 0x4; // 4 TX intt/ms
EmacControlRegs->INT_CONTROL = 0x30000; //bit16,bit17 for enabling TX and Rx intt pacing.
EmacControlRegs->INT_CONTROL |= 0x258; // 600 clocks of 150MHz in 4us time
#endif
/* Initialize MDIO and EMAC Module */
[Discussed later in this document]
/* Enable all the EMAC/MDIO interrupts in the control module */
EmacControlRegs->CONTROL.C_RX_EN = 0xff;
EmacControlRegs->CONTROL.C_TX_EN = 0xff;
EmacControlRegs->CONTROL.C_RX_THRESH_EN = 0xff;
EmacControlRegs->CONTROL.C_MISC_EN = 0xf;
www.ti.com
52
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The MDIO module is used to initially configure and monitor one or more external PHY devices. Other
than initializing the software state machine (details on this state machine can be found in the
IEEE 802.3 standard), all that needs to be done for the MDIO module is to enable the MDIO engine
and to configure the clock divider. To set the clock divider, supply an MDIO clock of 1 MHz. For
example, since the base clock used is the peripheral clock (PLL1/6), for a processor operating at a PLL
frequency of 594 MHz the divider can be set to 99, with slower MDIO clocks for slower peripheral clock
frequencies being perfectly acceptable.
Both the state machine enable and the MDIO clock divider are controlled through the MDIO control
register (CONTROL). If none of the potentially connected PHYs require the access preamble, the
PREAMBLE bit in CONTROL can also be set to speed up PHY register access. The code for this may
appear as in Example 5.
If the MDIO module is to operate on an interrupt basis, the interrupts can be enabled at this time using
the MDIO user command complete interrupt mask set register (USERINTMASKSET) for register access
and the MDIO user PHY select register (USERPHYSELn) if a target PHY is already known.
Once the MDIO state machine has been initialized and enabled, it starts polling all 32 PHY addresses
on the MDIO bus, looking for an active PHY. Since it can take up to 50 ms to read one register, it can
be some time before the MDIO module provides an accurate representation of whether a PHY is
available. Also, a PHY can take up to 3 seconds to negotiate a link. Thus, it is advisable to run the
MDIO software off a time-based event rather than polling.
For more information on PHY control registers, see your PHY device documentation.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The EMAC module is used to send and receive data packets over the network. This is done by
maintaining up to eight transmit and receive descriptor queues. The EMAC module configuration must
also be kept up-to-date based on PHY negotiation results returned from the MDIO module. Most of the
work in developing an application or device driver for Ethernet is programming this module.
The following is the initialization procedure a device driver would follow to get the EMAC to the state
where it is ready to receive and send Ethernet packets. Some of these steps are not necessary when
performed immediately after device reset.
1. If enabled, clear the device interrupt enable in the EMAC control module interrupt control registers
(CMRXTHRESHINTEN, CMRXINTEN, CMTXINTEN, and CMMISCINTEN).
2. Clear the MAC control register (MACCONTROL), receive control register (RXCONTROL), and
transmit control register (TXCONTROL) (not necessary immediately after reset).
3. Initialize all 16 header descriptor pointer registers (RXnHDP and TXnHDP) to 0.
4. Clear all 36 statistics registers by writing 0 (not necessary immediately after reset).
5. Setup the local Ethernet MAC address by programming the MAC index register (MACINDEX), MAC
address high bytes register (MACADDRHI), and MAC address low bytes register (MACADDRLO).
Be sure to program all eight MAC addresses - whether the receive channel is to be enabled or not.
Duplicate the same MAC address across all unused channels. When using more than one receive
channel, start with channel 0 and progress upwards.
6. Initialize the receive channel n free buffer count registers (RXnFREEBUFFER), receive channel n
flow control threshold register (RXnFLOWTHRESH), and receive filter low priority frame threshold
register (RXFILTERLOWTHRESH), if buffer flow control is to be enabled.
7. Most device drivers open with no multicast addresses, so clear the MAC address hash registers
(MACHASH1 and MACHASH2) to 0.
8. Write the receive buffer offset register (RXBUFFEROFFSET) value (typically zero).
9. Initially clear all unicast channels by writing FFh to the receive unicast clear register
(RXUNICASTCLEAR). If unicast is desired, it can be enabled now by writing the receive unicast set
register (RXUNICASTSET). Some drivers will default to unicast on device open while others will not.
10. Setup the receive multicast/broadcast/promiscuous channel enable register (RXMBPENABLE) with
an initial configuration. The configuration is based on the current receive filter settings of the device
driver. Some drivers may enable things like broadcast and multicast packets immediately, while
others may not.
11. Set the appropriate configuration bits in MACCONTROL (do not set the MIIEN bit yet).
12. Clear all unused channel interrupt bits by writing the receive interrupt mask clear register
(RXINTMASKCLEAR) and the transmit interrupt mask clear register (TXINTMASKCLEAR).
13. Enable the receive and transmit channel interrupt bits in the receive interrupt mask set register
(RXINTMASKSET) and the transmit interrupt mask set register (TXINTMASKSET) for the channels
to be used, and enable the HOSTMASK and STATMASK bits using the MAC interrupt mask set
register (MACINTMASKSET).
14. Initialize the receive and transmit descriptor list queues.
15. Prepare receive by writing a pointer to the head of the receive buffer descriptor list to RXnHDP.
16. Enable the receive and transmit DMA controllers by setting the RXEN bit in RXCONTROL and the
TXEN bit in TXCONTROL. Then set the MIIEN bit in MACCONTROL.
17. Enable the device interrupt in the EMAC control module interrupt control registers
(CMRXTHRESHINTEN, CMRXINTEN, CMTXINTEN, and CMMISCINTEN).
www.ti.com
54
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The EMAC module generates the following interrupt events:
•RXTHRESHOLDPENDn: Receive threshold interrupt for receive channels 0 through 7
•RXPENDn: Receive packet completion interrupt for receive channels 0 through 7
•TXPENDn: Transmit packet completion interrupt for transmit channels 0 through 7
•STATPEND: Statistics interrupt
•HOSTPEND: Host error interrupt
•USERINT: MDIO user Interrupt
•LINKINT: MDIO link Interrupt
As shown in Figure 11, the EMAC and MDIO interrupts are multiplexed on four interrupts lines going to
the CPU.
Figure 11. EMAC Control Module Interrupt Logic Diagram
Architecture
2.17.1.1Receive Threshold Interrupts
Each of the eight receive channels have a corresponding receive threshold interrupt
(RX_THRESH_PEND[0:7]). The receive threshold interrupts are level interrupts that remain asserted
until the triggering condition is cleared by the host. Each of the eight threshold interrupts may be
individually enabled by setting the corresponding bit in the receive interrupt mask set register
(RXINTMASKSET) to 1. Each of the eight channel interrupts may be individually disabled by clearing
the corresponding bit in the receive interrupt mask clear register (RXINTMASKCLEAR) to 0. The raw
and masked receive interrupt status may be read from the receive interrupt status (unmasked) register
(RXINTSTATRAW) and the receive interrupt status (masked) register (RXINTSTATMASKED),
respectively. An RX_THRES_PEND[7:0] interrupt bit is asserted when enabled and when the channel’s
associated receive channel n free buffer count register (RXnFREEBUFFER) is less than or equal to the
channel’s associated receive channel n flow control threshold register (RXnFLOWTHRESH). The
receive threshold interrupts use the same free buffer count and threshold logic as does flow control, but
the interrupts are independently enabled from flow control. The threshold interrupts are intended to give
the host an indication that resources are running low for a particular channel(s).
2.17.1.2Transmit Packet Completion Interrupts
The transmit DMA engine has eight channels, with each channel having a corresponding interrupt
(TXPENDn). The transmit interrupts are level interrupts that remain asserted until cleared by the CPU.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Each of the eight transmit channel interrupts may be individually enabled by setting the corresponding
bit in the transmit interrupt mask set register (TXINTMASKSET) to 1. Each of the eight transmit channel
interrupts may be individually disabled by clearing the corresponding bit in the transmit interrupt mask
clear register (TXINTMASKCLEAR) to 0. The raw and masked transmit interrupt status may be read
from the transmit interrupt status (unmasked) register (TXINTSTATRAW) and the transmit interrupt
status (masked) register (TXINTSTATMASKED), respectively.
When the EMAC completes the transmission of a packet, the EMAC issues an interrupt to the CPU by
writing the packet’s last buffer descriptor address to the appropriate channel queue’s transmit
completion pointer located in the state RAM block. The interrupt is generated by the write when
enabled by the interrupt mask, regardless of the value written.
Upon interrupt reception, the CPU processes one or more packets from the buffer chain and then
acknowledges an interrupt by writing the address of the last buffer descriptor processed to the queue’s
associated transmit completion pointer in the transmit DMA state RAM.
The data written by the host (buffer descriptor address of the last processed buffer) is compared to the
data in the register written by the EMAC port (address of last buffer descriptor used by the EMAC). If
the two values are not equal (which means that the EMAC has transmitted more packets than the CPU
has processed interrupts for), the transmit packet completion interrupt signal remains asserted. If the
two values are equal (which means that the host has processed all packets that the EMAC has
transferred), the pending interrupt is cleared. The value that the EMAC is expecting is found by reading
the transmit channel n completion pointer register (TXnCP).
The EMAC write to the completion pointer actually stores the value in the state RAM. The CPU written
value does not actually change the register value. The host written value is compared to the register
content (which was written by the EMAC) and if the two values are equal then the interrupt is removed;
otherwise, the interrupt remains asserted. The host may process multiple packets prior to
acknowledging an interrupt, or the host may acknowledge interrupts for every packet.
www.ti.com
2.17.1.3Receive Packet Completion Interrupts
The receive DMA engine has eight channels, which each channel having a corresponding interrupt
(RXPENDn). The receive interrupts are level interrupts that remain asserted until cleared by the CPU.
Each of the eight receive channel interrupts may be individually enabled by setting the corresponding
bit in the receive interrupt mask set register (RXINTMASKSET) to 1. Each of the eight receive channel
interrupts may be individually disabled by clearing the corresponding bit in the receive interrupt mask
clear register (RXINTMASKCLEAR) to 0. The raw and masked receive interrupt status may be read
from the receive interrupt status (unmasked) register (RXINTSTATRAW) and the receive interrupt
status (masked) register (RXINTSTATMASKED), respectively.
When the EMAC completes a packet reception, the EMAC issues an interrupt to the CPU by writing the
packet's last buffer descriptor address to the appropriate channel queue's receive completion pointer
located in the state RAM block. The interrupt is generated by the write when enabled by the interrupt
mask, regardless of the value written.
Upon interrupt reception, the CPU processes one or more packets from the buffer chain and then
acknowledges one or more interrupt(s) by writing the address of the last buffer descriptor processed to
the queue's associated receive completion pointer in the receive DMA state RAM.
The data written by the host (buffer descriptor address of the last processed buffer) is compared to the
data in the register written by the EMAC (address of last buffer descriptor used by the EMAC). If the
two values are not equal (which means that the EMAC has received more packets than the CPU has
processed interrupts for), the receive packet completion interrupt signal remains asserted. If the two
values are equal (which means that the host has processed all packets that the EMAC has received),
the pending interrupt is de-asserted. The value that the EMAC is expecting is found by reading the
receive channel n completion pointer register (RXnCP).
The EMAC write to the completion pointer actually stores the value in the state RAM. The CPU written
value does not actually change the register value. The host written value is compared to the register
content (which was written by the EMAC) and if the two values are equal then the interrupt is removed;
otherwise, the interrupt remains asserted. The host may process multiple packets prior to
acknowledging an interrupt, or the host may acknowledge interrupts for every packet.
56
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The statistics level interrupt (STATPEND) is issued when any statistics value is greater than or equal to
8000 0000h, if enabled by setting the STATMASK bit in the MAC interrupt mask set register
(MACINTMASKSET) to 1. The statistics interrupt is removed by writing to decrement any statistics
value greater than 8000 0000h. As long as the most-significant bit of any statistics value is set, the
interrupt remains asserted.
2.17.1.5Host Error Interrupt
The host error interrupt (HOSTPEND) is issued, if enabled, under error conditions dealing with the
handling of buffer descriptors, detected during transmit or receive DMA transactions. The failure of the
software application to supply properly formatted buffer descriptors results in this error. The error bit
can only be cleared by resetting the EMAC module in hardware.
The host error interrupt is enabled by setting the HOSTMASK bit in the MAC interrupt mask set register
(MACINTMASKSET) to 1. The host error interrupt is disabled by clearing the appropriate bit in the MAC
interrupt mask clear register (MACINTMASKCLEAR) to 0. The raw and masked host error interrupt
status may be read by reading the MAC interrupt status (unmasked) register (MACINTSTATRAW) and
the MAC interrupt status (masked) register (MACINTSTATMASKED), respectively.
The transmit host error conditions are:
•SOP error
•Ownership bit not set in SOP buffer
•Zero next buffer descriptor pointer with EOP
•Zero buffer pointer
•Zero buffer length
•Packet length error
The receive host error conditions are:
•Ownership bit not set in input buffer
•Zero buffer pointer
Architecture
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
•LINKINT: Serial interface link change interrupt. Indicates a change in the state of the PHY link
•USERINT: Serial interface user command event complete interrupt
2.17.2.1Link Change Interrupt
The MDIO module asserts a link change interrupt (LINKINT) if there is a change in the link state of the
PHY corresponding to the address in the PHYADRMON bit in the MDIO user PHY select register n
(USERPHYSELn), and if the LINKINTENB bit is also set in USERPHYSELn. This interrupt event is also
captured in the LINKINTRAW bit in the MDIO link status change interrupt register (LINKINTRAW).
LINKINTRAW bits 0 and 1 correspond to USERPHYSEL0 and USERPHYSEL1, respectively.
When the interrupt is enabled and generated, the corresponding LINKINTMASKED bit is also set in the
MDIO link status change interrupt register (LINKINTMASKED). The interrupt is cleared by writing back
the same bit to LINKINTMASKED (write to clear).
2.17.2.2User Access Completion Interrupt
When the GO bit in one of the MDIO user access registers (USERACCESSn) transitions from 1 to 0
(indicating completion of a user access) and the corresponding USERINTMASKSET bit in the MDIO
user command complete interrupt mask set register (USERINTMASKSET) corresponding to
USERACCESS0 or USERACCESS1 is set, a user access completion interrupt (USERINT) is asserted.
This interrupt event is also captured in the USERINTRAW bit in the MDIO user command complete
interrupt register (USERINTRAW). USERINTRAW bits 0 and bit 1 correspond to USERACCESS0 and
USERACCESS1, respectively.
When the interrupt is enabled and generated, the corresponding USERINTMASKED bit is also set in
the MDIO user command complete interrupt register (USERINTMASKED). The interrupt is cleared by
writing back the same bit to USERINTMASKED (write to clear).
www.ti.com
2.17.3Proper Interrupt Processing
All the interrupts signaled from the EMAC and MDIO modules are level driven, so if they remain active,
their level remains constant; the CPU core requires edge-triggered interrupts. In order to properly
convert the level-driven interrupt signal to an edge-triggered signal, the application software must make
use of the interrupt control logic contained in the EMAC control module.
Section 2.7.3 discusses the interrupt control contained in the EMAC control module. For safe interrupt
processing, upon entry to the ISR, the software application should disable interrupts using the EMAC
control module interrupt control registers (CMRXTHRESHINTEN, CMRXINTEN, CMTXINTEN, and
CMMISCINTEN), and then reenable them upon leaving the ISR. If any interrupt signals are active at
that time, this creates another rising edge on the interrupt signal going to the CPU interrupt controller,
thus triggering another interrupt. The EMAC control module also implements the optional interrupt
pacing.
2.17.4Interrupt Multiplexing
The EMAC control module combines all the different interrupt signals from both the EMAC and MDIO
modules and generates four separate interrupt signals that are wired to the ARM interrupt controller
(AINTC) as seen in Figure 11. Once this interrupt is generated, the reason for the interrupt can be read
from the MAC input vector register (MACINVECTOR) located in the EMAC memory map.
MACINVECTOR combines the status of the following 28 interrupt signals: TXPENDn, RXPENDn,
RXTHRESHPENDn, STATPEND, HOSTPEND, LINKINT, and USERINT.The four interrupt signals are
multiplexed with the GPIO 8-11 interrupts. For programming the ARM interrupt controller for
demultiplexing the EMAC interrupts please refer to TMS320DM365 Digital Media System-on-Chip(DMSoC) ARM Subsystem Reference Guide (SPRUFG5).
.
58
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
Each of the three main components of the EMAC peripheral can independently be placed in
reduced-power modes to conserve power during periods of low activity. The power management of the
EMAC peripheral is controlled by the processor Power and Sleep Controller (PSC). The PSC acts as a
master controller for power management on behalf of all of the peripherals on the device.
The power conservation modes available for each of the three components of the EMAC/MDIO
peripheral are:
•Idle/Disabled state. This mode stops the clocks going to the peripheral, and prevents all the register
accesses. After reenabling the peripheral from this idle state, all the registers values prior to setting
into the disabled state are restored, and data transmission can proceed. No reinitialization is
required.
•Synchronized reset. This state is similar to the Power-on Reset (POR) state, when the processor is
turned-on; reset to the peripheral is asserted, and clocks to the peripheral are gated after that. The
registers are reset to their default value. When powering-up after a synchronized reset, all the
EMAC submodules need to be reinitialized before any data transmission can happen.
For more information on the use of the processor Power and Sleep Controller (PSC), see the
TMS320DM365 Digital Media System-on-Chip (DMSoC) ARM Subsystem Reference Guide
(SPRUFG5).
2.19 Emulation Considerations
NOTE: For correct operation, the EMAC and EMAC control module must both be suspended.
Thus, the EMCONTROL and CMEMCONTROL registers must be configured alike.
Architecture
EMAC emulation control is implemented for compatibility with other peripherals. The SOFT and FREE
bits in the emulation control register (EMCONTROL) allow EMAC operation to be suspended.
Additionally, emulation control is also implemented in the EMAC control module with the EMAC control
module emulation control register (CMEMCONTROL) to allow the EMAC control module activity to be
suspended.
When the emulation suspend state is entered, the EMAC stops processing receive and transmit frames
at the next frame boundary. Any frame currently in reception or transmission is completed normally
without suspension. For transmission, any complete or partial frame in the transmit cell FIFO is
transmitted. For receive, frames that are detected by the EMAC after the suspend state is entered are
ignored. No statistics are kept for ignored frames.
Table 6 shows how the SOFT and FREE bits affect the operation of the emulation suspend.
Table 6. Emulation Control
SOFTFREEDescription
00Normal operation
10Emulation suspend
X1Normal operation
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
Table 7 lists the memory-mapped registers for the EMAC control module. See the device-specific data
manual for the memory address of these registers.
Table 7. EMAC Control Module Registers
Slave VBUS
AddressAcronymRegister DescriptionSection
0hCMIDVERIdentification and Version RegisterSection 3.1
4hCMSOFTRESETSoftware Reset RegisterSection 3.2
8hCMEMCONTROLEmulation Control RegisterSection 3.3
3.2EMAC Control Module Software Reset Register (CMSOFTRESET)
The software reset register (CMSOFTRESET) is shown in Figure 13 and described in Table 9.
Figure 13. EMAC Control Module Software Reset Register (CMSOFTRESET)
3116
Reserved
R-0
1510
ReservedSOFTRESET
R-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 9. EMAC Control Module Software Reset Register (CMSOFTRESET) Field Descriptions
BitFieldValueDescription
31-1Reserved0Reserved
0SOFTRESETSoftware reset.
0No effect.
1Causes the EMAC control module logic to be reset. Software reset occurs on the clock following the
register bit write.
3.3EMAC Control Module Emulation Control Register (CMEMCONTROL)
The emulation control register (CMEMCONTROL) is shown in Figure 14 and described in Table 10.
Figure 14. EMAC Control Module Emulation Control Register (CMEMCONTROL)
3116
Reserved
R-0
15210
ReservedSOFT FREE
R-0R/W-0 R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 10. EMAC Control Module Emulation Control Register (CMEMCONTROL)
Field Descriptions
BitFieldValue Description
31-2Reserved0Reserved
1SOFTEmulation soft bit. This bit is used in conjunction with FREE bit to determine the emulation suspend
0FREEEmulation free bit. This bit is used in conjunction with SOFT bit to determine the emulation suspend
mode. This bit has no effect if FREE = 1.
0Soft mode is disabled. EMAC control module stops immediately during emulation halt.
1Soft mode is enabled. During emulation halt, EMAC control module stops after completion of current
operation.
mode.
0Free-running mode is disabled. During emulation halt, SOFT bit determines operation of the EMAC
control module.
1Free-running mode is enabled. During emulation halt, the EMAC control module continues to operate.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
3.5EMAC Control Module Receive Threshold Interrupt Enable Register
(CMRXTHRESHINTEN)
The receive threshold interrupt enable register (CMRXTHRESHINTEN) is shown in Figure 16 and
described in Table 12.
Figure 16. EMAC Control Module Receive Threshold Interrupt Enable Register
(CMRXTHRESHINTEN)
3116
Reserved
R-0
15870
ReservedRXTHRESHEN
R-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 12. EMAC Control Module Receive Threshold Interrupt Enable Register
(CMRXTHRESHINTEN) Field Descriptions
BitFieldValueDescription
31-8Reserved0Reserved
7-0RXTHRESHEN[n]Receive threshold interrupt (RXTHRESHPENDn) enable. Each bit controls the corresponding
channel n receive threshold interrupt.
Bit n = 0, channel n receive threshold interrupt (RXTHRESHPENDn) is disabled.
Bit n = 1, channel n receive threshold interrupt (RXTHRESHPENDn) is enabled.
3.6EMAC Control Module Receive Interrupt Enable Register (CMRXINTEN)
The receive interrupt enable register (CMRXINTEN) is shown in Figure 17 and described in Table 13.
Figure 17. EMAC Control Module Receive Interrupt Enable Register (CMRXINTEN)
3116
Reserved
R-0
15870
ReservedRXPULSEEN
R-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 13. EMAC Control Module Receive Interrupt Enable Register (CMRXINTEN)
Field Descriptions
BitFieldValueDescription
31-8Reserved0Reserved
7-0RXPULSEEN[n]Receive interrupt (RXPENDn) enable. Each bit controls the corresponding channel n receive
interrupt.
Bit n = 0, channel n receive interrupt (RXPENDn) is disabled.
Bit n = 1, channel n receive interrupt (RXPENDn) is enabled.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
3.9EMAC Control Module Receive Threshold Interrupt Status Register
(CMRXTHRESHINTSTAT)
The receive threshold interrupt status register (CMRXTHRESHINTSTAT) is shown in Figure 20 and
described in Table 16.
Figure 20. EMAC Control Module Receive Threshold Interrupt Status Register
(CMRXTHRESHINTSTAT)
3116
Reserved
R-0
15870
ReservedRXTHRESHINTTSTAT
R-0R-0
LEGEND: R = Read only; -n = value after reset
Table 16. EMAC Control Module Receive Threshold Interrupt Status Register
(CMRXTHRESHINTSTAT) Field Descriptions
BitFieldValue Description
31-8 Reserved0Reserved
7-0RXTHRESHINTTSTAT[n]Receive threshold interrupt status. Each bit shows the status of the corresponding
channel n receive threshold interrupt.
Bit n = 0, channel n receive threshold interrupt is not pending.
Bit n = 1, channel n receive threshold interrupt is pending.
3.10 EMAC Control Module Receive Interrupt Status Register (CMRXINTSTAT)
The receive interrupt status register (CMRXINTSTAT) is shown in Figure 21and described in Table 17.
Figure 21. EMAC Control Module Receive Interrupt Status Register (CMRXINTSTAT)
3116
Reserved
R-0
15870
ReservedRXPULSEINTTSTAT
R-0R-0
LEGEND: R = Read only; -n = value after reset
Table 17. EMAC Control Module Receive Interrupt Status Register (CMRXINTSTAT)
Field Descriptions
BitFieldValue Description
31-8 Reserved0Reserved
7-0RXPULSEINTTSTAT[n]Receive interrupt status. Each bit shows the status of the corresponding channel n receive
interrupt.
Bit n = 0, channel n receive interrupt is not pending.
Bit n = 1, channel n receive interrupt is pending.
66
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
Table 22 lists the memory-mapped registers for the MDIO module. See the device-specific data manual
for the memory address of these registers.
OffsetAcronymRegister DescriptionSection
0hVERSIONMDIO Version RegisterSection 4.1
4hCONTROLMDIO Control RegisterSection 4.2
8hALIVEPHY Alive Status registerSection 4.3
ChLINKPHY Link Status RegisterSection 4.4
10hLINKINTRAWMDIO Link Status Change Interrupt (Unmasked) RegisterSection 4.5
14hLINKINTMASKEDMDIO Link Status Change Interrupt (Masked) RegisterSection 4.6
20hUSERINTRAWMDIO User Command Complete Interrupt (Unmasked) RegisterSection 4.7
24hUSERINTMASKEDMDIO User Command Complete Interrupt (Masked) RegisterSection 4.8
28hUSERINTMASKSETMDIO User Command Complete Interrupt Mask Set RegisterSection 4.9
2ChUSERINTMASKCLEARMDIO User Command Complete Interrupt Mask Clear RegisterSection 4.10
80hUSERACCESS0MDIO User Access Register 0Section 4.11
84hUSERPHYSEL0MDIO User PHY Select Register 0Section 4.12
88hUSERACCESS1MDIO User Access Register 1Section 4.13
8ChUSERPHYSEL1MDIO User PHY Select Register 1Section 4.14
www.ti.com
Table 22. Management Data Input/Output (MDIO) Registers
4.1MDIO Version Register (VERSION)
The MDIO version register (VERSION) is shown in Figure 26 and described in Table 23.
Figure 26. MDIO Version Register (VERSION)
3116
MODID
R-7h
15870
REVMAJREVMIN
R-1hR-4h
LEGEND: R = Read only; -n = value after reset
Table 23. MDIO Version Register (VERSION) Field Descriptions
BitFieldValueDescription
31-16 MODID0-FFFFhIdentifies type of peripheral.
7hMDIO
15-8REVMAJ0-FFhIdentifies major revision of peripheral.
1hCurrent major revision of peripheral.
7-0REVMIN0-FFhIdentifies minor revision of peripheral.
4hCurrent minor revision of peripheral.
70
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
LEGEND: R/W = R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 24. MDIO Control Register (CONTROL) Field Descriptions
BitFieldValueDescription
31IDLEState machine IDLE status bit
0State machine is not in idle state
1State machine is in idle state
30ENABLEState machine enable control bit. If the MDIO state machine is active at the time
0Disables the MDIO state machine
1Enable the MDIO state machine
29Reserved0Reserved
28-24 HIGHEST_USER_CHANNEL0-1FhHighest user channel that is available in the module. It is currently set to 1. This
23-21 Reserved0Reserved
20PREAMBLEPreamble disable
0Standard MDIO preamble is used
1Disables this device from sending MDIO frame preambles
19FAULTFault indicator. This bit is set to 1 if the MDIO pins fail to read back what the
0No failure
1Physical layer fault; the MDIO state machine is reset
18FAULTENBFault detect enable. This bit has to be set to 1 to enable the physical layer fault
0Disables the physical layer fault detection
1Enables the physical layer fault detection
17-16 Reserved0Reserved
15-0 CLKDIV0-FFFFhClock Divider bits. This field specifies the division ratio between the peripheral
it is disabled, it will complete the current operation before halting and setting the
idle bit.
implies that MDIOUserAccess1 is the highest available user access channel.
device is driving onto them. This indicates a physical layer fault and the module
state machine is reset. Writing a 1 to it clears this bit, writing a 0 has no effect.
detection.
clock and the frequency of MDCLK. MDCLK is disabled when CLKDIV is set to
0. MDCLK frequency = peripheral clock frequency/(CLKDIV + 1).
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The PHY acknowledge status register (ALIVE) is shown in Figure 28 and described in Table 25.
Figure 28. PHY Acknowledge Status Register (ALIVE)
3116
ALIVE
R/W1C-0
150
ALIVE
R/W1C-0
LEGEND: R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 25. PHY Acknowledge Status Register (ALIVE) Field Descriptions
BitFieldValueDescription
31-0ALIVE0-FFFF FFFFhMDIO Alive bits. Each of the 32 bits of this register is set if the most recent access to the PHY with
0The PHY fails to acknowledge the access.
1The most recent access to the PHY with an address corresponding to the register bit number was
address corresponding to the register bit number was acknowledged by the PHY; the bit is reset if
the PHY fails to acknowledge the access. Both the user and polling accesses to a PHY will cause
the corresponding alive bit to be updated. The alive bits are only meant to be used to give an
indication of the presence or not of a PHY with the corresponding address. Writing a 1 to any bit
will clear it, writing a 0 has no effect.
acknowledged by the PHY.
4.4PHY Link Status Register (LINK)
The PHY link status register (LINK) is shown in Figure 29 and described in Table 26.
Figure 29. PHY Link Status Register (LINK)
3116
LINK
R-0
150
LINK
R-0
LEGEND: R = Read only; -n = value after reset
Table 26. PHY Link Status Register (LINK) Field Descriptions
BitFieldValueDescription
31-0LINK0-FFFF FFFFhMDIO Link state bits. This register is updated after a read of the generic status register of a PHY.
0The PHY indicates it does not have a link or fails to acknowledge the read transaction
1The PHY with the corresponding address has a link and the PHY acknowledges the read
The bit is set if the PHY with the corresponding address has link and the PHY acknowledges the
read transaction. The bit is reset if the PHY indicates it does not have link or fails to acknowledge
the read transaction. Writes to the register have no effect.
transaction.
72
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
4.5MDIO Link Status Change Interrupt (Unmasked) Register (LINKINTRAW)
The MDIO link status change interrupt (unmasked) register (LINKINTRAW) is shown in Figure 30 and
described in Table 27.
Figure 30. MDIO Link Status Change Interrupt (Unmasked) Register (LINKINTRAW)
3116
Reserved
R-0
15210
ReservedLINKINTRAW
R-0R/W1C-0
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 27. MDIO Link Status Change Interrupt (Unmasked) Register (LINKINTRAW)
Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1-0LINKINTRAW0-3hMDIO Link change event, raw value. When asserted, a bit indicates that there was an MDIO link
change event (that is, change in the LINK register) corresponding to the PHY address in the
USERPHYSEL register. LINKINTRAW[0] and LINKINTRAW[1] correspond to USERPHYSEL0 and
USERPHYSEL1, respectively. Writing a 1 will clear the event and writing a 0 has no effect.
0No MDIO link change event.
1An MDIO link change event (change in the LINK register) corresponding to the PHY address in
MDIO user PHY select register n (USERPHYSELn).
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
4.6MDIO Link Status Change Interrupt (Masked) Register (LINKINTMASKED)
The MDIO link status change interrupt (masked) register (LINKINTMASKED) is shown in Figure 31 and
described in Table 28.
Figure 31. MDIO Link Status Change Interrupt (Masked) Register (LINKINTMASKED)
3116
Reserved
R-0
15210
ReservedLINKINTMASKED
R-0R/W1C-0
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 28. MDIO Link Status Change Interrupt (Masked) Register (LINKINTMASKED)
Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1-0LINKINTMASKED0-3hMDIO Link change interrupt, masked value. When asserted, a bit indicates that there was an MDIO
link change event (that is, change in the LINK register) corresponding to the PHY address in the
USERPHYSEL register and the corresponding LINKINTENB bit was set. LINKINTMASKED[0] and
LINKINTMASKED[1] correspond to USERPHYSEL0 and USERPHYSEL1, respectively. Writing a 1
will clear the event and writing a 0 has no effect.
0No MDIO link change event.
1An MDIO link change event (change in the LINK register) corresponding to the PHY address in
MDIO user PHY select register n (USERPHYSELn) and the LINKINTENB bit in USERPHYSELn is
set to 1.
74
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
4.7MDIO User Command Complete Interrupt (Unmasked) Register (USERINTRAW)
The MDIO user command complete interrupt (unmasked) register (USERINTRAW) is shown in
Figure 32 and described in Table 29.
Figure 32. MDIO User Command Complete Interrupt (Unmasked) Register (USERINTRAW)
3116
Reserved
R-0
15210
ReservedUSERINTRAW
R-0R/W1C-0
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 29. MDIO User Command Complete Interrupt (Unmasked) Register (USERINTRAW)
Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1-0USERINTRAW0-3hMDIO User command complete event bits. When asserted, a bit indicates that the previously
scheduled PHY read or write command using that particular USERACCESS register has
completed. USERINTRAW[0] and USERINTRAW[1] correspond to USERACCESS0 and
USERACCESS1, respectively. Writing a 1 will clear the event and writing a 0 has no effect.
0No MDIO user command complete event.
1The previously scheduled PHY read or write command using MDIO user access register n
(USERACCESSn) has completed.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
4.8MDIO User Command Complete Interrupt (Masked) Register (USERINTMASKED)
The MDIO user command complete interrupt (masked) register (USERINTMASKED) is shown in
Figure 33 and described in Table 30.
Figure 33. MDIO User Command Complete Interrupt (Masked) Register (USERINTMASKED)
3116
Reserved
R-0
15210
ReservedUSERINTMASKED
R-0R/W1C-0
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 30. MDIO User Command Complete Interrupt (Masked) Register (USERINTMASKED)
Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1-0USERINTMASKED0-3hMasked value of MDIO User command complete interrupt. When asserted, a bit indicates that
the previously scheduled PHY read or write command using that particular USERACCESS
register has completed and the corresponding USERINTMASKSET bit is set to 1.
USERINTMASKED[0] and USERINTMASKED[1] correspond to USERACCESS0 and
USERACCESS1, respectively. Writing a 1 will clear the interrupt and writing a 0 has no effect.
0No MDIO user command complete event.
1The previously scheduled PHY read or write command using MDIO user access register n
(USERACCESSn) has completed and the corresponding bit in USERINTMASKSET is set to 1.
76
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
1-0USERINTMASKCLEAR0-3hMDIO user command complete interrupt mask clear for USERINTMASKED[1:0],
0MDIO user command complete interrupts for the MDIO user access register n
1MDIO user command complete interrupts for the MDIO user access register n
respectively. Setting a bit to 1 will disable further user command complete interrupts
for that particular USERACCESS register. USERINTMASKCLEAR[0] and
USERINTMASKCLEAR[1] correspond to USERACCESS0 and USERACCESS1,
respectively. Writing a 0 to this register has no effect.
(USERACCESSn) are enabled.
(USERACCESSn) are disabled.
78
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The MDIO user access register 0 (USERACCESS0) is shown in Figure 36 and described in Table 33.
Figure 36. MDIO User Access Register 0 (USERACCESS0)
313029282625212016
GOWRITEACKReservedREGADRPHYADR
R/W1S-0R/W-0 R/W-0R-0R/W-0R/W-0
150
DATA
R/W-0
LEGEND: R = Read only; R/W = Read/Write; W1S = Write 1 to set, write of 0 has no effect; -n = value after reset
Table 33. MDIO User Access Register 0 (USERACCESS0) Field Descriptions
BitFieldValueDescription
31GO0-1Go bit. Writing a 1 to this bit causes the MDIO state machine to perform an MDIO access when it
30WRITEWrite enable bit. Setting this bit to 1 causes the MDIO transaction to be a register write; otherwise,
0The user command is a read operation.
1The user command is a write operation.
29ACK0-1Acknowledge bit. This bit is set if the PHY acknowledged the read transaction.
28-26 Reserved0Reserved
25-21 REGADR0-1FhRegister address bits. This field specifies the PHY register to be accessed for this transaction
20-16 PHYADR0-1FhPHY address bits. This field specifies the PHY to be accessed for this transaction.
15-0DATA0-FFFFhUser data bits. These bits specify the data value read from or to be written to the specified PHY
is convenient for it to do so; this is not an instantaneous process. Writing a 0 to this bit has no
effect. This bit is writeable only if the MDIO state machine is enabled. This bit will self clear when
the requested access has been completed. Any writes to the USERACCESS0 register are blocked
when the GO bit is 1.
it is a register read.
register.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
4.12 MDIO User PHY Select Register 0 (USERPHYSEL0)
The MDIO user PHY select register 0 (USERPHYSEL0) is shown in Figure 37 and described in
Table 34.
Figure 37. MDIO User PHY Select Register 0 (USERPHYSEL0)
3116
Reserved
R-0
15876540
ReservedLINKSEL LINKINTENB RsvdPHYADRMON
R-0R/W-0R/W-0R-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 34. MDIO User PHY Select Register 0 (USERPHYSEL0) Field Descriptions
BitFieldValueDescription
31-8Reserved0Reserved
7LINKSELLink status determination select bit. Default value is 0, which implies that the link status is
6LINKINTENBLink change interrupt enable. Set to 1 to enable link change status interrupts for PHY address
5Reserved0Reserved
4-0PHYADRMON0-1FhPHY address whose link status is to be monitored.
determined by the MDIO state machine. This is the only option supported on this device.
0The link status is determined by the MDIO state machine.
1Not supported.
specified in PHYADRMON. Link change interrupts are disabled if this bit is set to 0.
0Link change interrupts are disabled.
1Link change status interrupts for PHY address specified in PHYADDRMON bits are enabled.
80
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
The MDIO user access register 1 (USERACCESS1) is shown in Figure 38 and described in Table 35.
Figure 38. MDIO User Access Register 1 (USERACCESS1)
313029282625212016
GOWRITEACKReservedREGADRPHYADR
R/W1S-0R/W-0 R/W-0R-0R/W-0R/W-0
150
DATA
R/W-0
LEGEND: R = Read only; R/W = Read/Write; W1S = Write 1 to set, write of 0 has no effect; -n = value after reset
Table 35. MDIO User Access Register 1 (USERACCESS1) Field Descriptions
BitFieldValueDescription
31GO0-1Go bit. Writing 1 to this bit causes the MDIO state machine to perform an MDIO access when it is
30WRITEWrite enable bit. Setting this bit to 1 causes the MDIO transaction to be a register write; otherwise,
0The user command is a read operation.
1The user command is a write operation.
29ACK0-1Acknowledge bit. This bit is set if the PHY acknowledged the read transaction.
28-26 Reserved0Reserved
25-21 REGADR0-1FhRegister address bits. This field specifies the PHY register to be accessed for this transaction
20-16 PHYADR0-1FhPHY address bits. This field specifies the PHY to be accessed for this transaction.
15-0DATA0-FFFFhUser data bits. These bits specify the data value read from or to be written to the specified PHY
convenient for it to do so; this is not an instantaneous process. Writing 0 to this bit has no effect.
This bit is writeable only if the MDIO state machine is enabled. This bit will self clear when the
requested access has been completed. Any writes to the USERACCESS0 register are blocked
when the GO bit is 1.
it is a register read.
register.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
4.14 MDIO User PHY Select Register 1 (USERPHYSEL1)
The MDIO user PHY select register 1 (USERPHYSEL1) is shown in Figure 39 and described in
Table 36.
Figure 39. MDIO User PHY Select Register 1 (USERPHYSEL1)
3116
Reserved
R-0
15876540
ReservedLINKSEL LINKINTENB RsvdPHYADRMON
R-0R/W-0R/W-0R-0R/W-0
LEGEND: R/W = Read/Write; R = Read only; -n = value after reset
Table 36. MDIO User PHY Select Register 1 (USERPHYSEL1) Field Descriptions
BitFieldValueDescription
31-8Reserved0Reserved
7LINKSELLink status determination select bit. Default value is 0, which implies that the link status is
6LINKINTENBLink change interrupt enable. Set to 1 to enable link change status interrupts for the PHY address
5Reserved0PHY address whose link status is to be monitored.
4-0PHYADRMON0-1FhPHY address whose link status is to be monitored.
determined by the MDIO state machine. This is the only option supported on this device.
0The link status is determined by the MDIO state machine.
1Not supported.
specified in PHYADRMON. Link change interrupts are disabled if this bit is set to 0.
0Link change interrupts are disabled.
1Link change status interrupts for PHY address specified in PHYADDRMON bits are enabled.
82
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
LEGEND: R = Read only; R/W = Read/Write; W1S = Write 1 to set, write of 0 has no effect; -n = value after reset
Table 46. Transmit Interrupt Mask Set Register (TXINTMASKSET) Field Descriptions
BitFieldValue Description
31-8Reserved0Reserved
7TX7MASK0-1Transmit channel 7 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
6TX6MASK0-1Transmit channel 6 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
5TX5MASK0-1Transmit channel 5 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
4TX4MASK0-1Transmit channel 4 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
3TX3MASK0-1Transmit channel 3 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
2TX2MASK0-1Transmit channel 2 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
1TX1MASK0-1Transmit channel 1 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
0TX0MASK0-1Transmit channel 0 interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
92
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 47. Transmit Interrupt Mask Clear Register (TXINTMASKCLEAR) Field Descriptions
BitFieldValue Description
31-8Reserved0Reserved
7TX7MASK0-1Transmit channel 7 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
6TX6MASK0-1Transmit channel 6 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
5TX5MASK0-1Transmit channel 5 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
4TX4MASK0-1Transmit channel 4 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
3TX3MASK0-1Transmit channel 3 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
2TX2MASK0-1Transmit channel 2 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
1TX1MASK0-1Transmit channel 1 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
0TX0MASK0-1Transmit channel 0 interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
The MAC input vector register (MACINVECTOR) is shown in Figure 50 and described in Table 48.
Figure 50. MAC Input Vector Register (MACINVECTOR)
3128272625242316
ReservedSTATPENDHOSTPENDLINKINTUSERINTTXPEND
R-0R-0R-0R-0R-0R-0
15870
RXTHRESHPENDRXPEND
R-0R-0
LEGEND: R = Read only; -n = value after reset
Table 48. MAC Input Vector Register (MACINVECTOR) Field Descriptions
BitFieldValueDescription
31-28 Reserved0Reserved
27STATPEND0-1EMAC module statistics interrupt (STATPEND) pending status bit.
26HOSTPEND0-1EMAC module host error interrupt (HOSTPEND) pending status bit.
25LINKINT0-1MDIO module link change interrupt (LINKINT) pending status bit.
24USERINT0-1MDIO module user interrupt (USERINT) pending status bit.
23-16 TXPEND0-FFh Transmit channels 0-7 interrupt pending (TXPENDn) status bit. Bit 16 is transmit channel 0.
15-8RXTHRESHPEND0-FFh Receive threshold channels 0-7 interrupt pending (RXTHRESHPENDn) status bit. Bit 8 is
7-0RXPEND0-FFh Receive channels 0-7 interrupt pending (RXPENDn) status bit. Bit 0 is receive channel 0.
receive channel 0.
5.12 MAC End Of Interrupt Vector Register (MACEOIVECTOR)
The MAC end of interrupt vector register (MACEOIVECTOR) is shown in Figure 51 and described in
Table 49.
Figure 51. MAC End Of Interrupt Vector Register (MACEOIVECTOR)
3116
Reserved
R-0
15210
ReservedEOI
R-0R/W-0
LEGEND: R = Read only; R/W = Read/Write; -n = value after reset
Table 49. MAC End Of Interrupt Vector Register (MACEOIVECTOR) Field Descriptions
BitFieldValue Description
31-2Reserved0Reserved
1-0EOI0-3hEnd of interrupt.
0End of interrupt processing for RXTHRESH interrupt.
1hEnd of interrupt processing for RXPULSE interrupt.
2hEnd of interrupt processing for TXPULSE interrupt.
3hEnd of interrupt processing for Miscellaneous interrupt.
94
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
LEGEND: R = Read only; R/W = Read/Write; W1S = Write 1 to set, write of 0 has no effect; -n = value after reset
Table 52. Receive Interrupt Mask Set Register (RXINTMASKSET) Field Descriptions
BitFieldValue Description
31-8Reserved0Reserved
7RX7MASK0-1Receive channel 7 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
6RX6MASK0-1Receive channel 6 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
5RX5MASK0-1Receive channel 5 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
4RX4MASK0-1Receive channel 4 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
3RX3MASK0-1Receive channel 3 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
2RX2MASK0-1Receive channel 2 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
1RX1MASK0-1Receive channel 1 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
0RX0MASK0-1Receive channel 0 mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
SPRUFI5B–March 2009–Revised December 2010Ethernet Media Access Controller (EMAC)/Management Data Input/Output
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 53. Receive Interrupt Mask Clear Register (RXINTMASKCLEAR) Field Descriptions
BitFieldValue Description
31-8Reserved0Reserved
7RX7MASK0-1Receive channel 7 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
6RX6MASK0-1Receive channel 6 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
5RX5MASK0-1Receive channel 5 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
4RX4MASK0-1Receive channel 4 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
3RX3MASK0-1Receive channel 3 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
2RX2MASK0-1Receive channel 2 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
1RX1MASK0-1Receive channel 1 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
0RX0MASK0-1Receive channel 0 mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
98
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)
5.19 MAC Interrupt Mask Set Register (MACINTMASKSET)
The MAC interrupt mask set register (MACINTMASKSET) is shown in Figure 58 and described in
Table 56.
Figure 58. MAC Interrupt Mask Set Register (MACINTMASKSET)
3116
Reserved
R-0
15210
ReservedHOSTMASKSTATMASK
R-0R/W1S-0R/W1S-0
LEGEND: R = Read only; R/W = Read/Write; W1S = Write 1 to set, write of 0 has no effect; -n = value after reset
Table 56. MAC Interrupt Mask Set Register (MACINTMASKSET) Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1HOSTMASK0-1Host error interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
0STATMASK0-1Statistics interrupt mask set bit. Write 1 to enable interrupt, a write of 0 has no effect.
www.ti.com
5.20 MAC Interrupt Mask Clear Register (MACINTMASKCLEAR)
The MAC interrupt mask clear register (MACINTMASKCLEAR) is shown in Figure 59 and described in
Table 57.
Figure 59. MAC Interrupt Mask Clear Register (MACINTMASKCLEAR)
3116
Reserved
R-0
15210
ReservedHOSTMASKSTATMASK
R-0R/W1C-0R/W1C-0
LEGEND: R = Read only; R/W = Read/Write; W1C = Write 1 to clear, write of 0 has no effect; -n = value after reset
Table 57. MAC Interrupt Mask Clear Register (MACINTMASKCLEAR) Field Descriptions
BitFieldValueDescription
31-2Reserved0Reserved
1HOSTMASK0-1Host error interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
0STATMASK0-1Statistics interrupt mask clear bit. Write 1 to disable interrupt, a write of 0 has no effect.
100
Ethernet Media Access Controller (EMAC)/Management Data Input/OutputSPRUFI5B–March 2009–Revised December 2010
(MDIO)