Ethernet MAC
UG0331 User Guide Revision 15.0
392
The following table lists the APIs available in TSEMAC firmware drivers for reading status and statistics.
Refer to
G4Main MSS Ethernet MAC driver User's Guide
for more information on the API detailed
description and parameters to the APIs.
Note:
The MSS Ethernet does not support full behavioral simulation models. Refer to
for more information.
11.6
SYSREG Control Register for EMAC
The registers are located in the
SYSREG section and are listed again here for clarity. Refer to the
page 670 for a detailed description of each register and bit.
page 378 shows the control information from the MAC_CR register in the system register.
The following table depicts the MAC_CR Register in the SYSREG block.
MSS_MAC_receive_pkt
The MSS_MAC_receive_pkt() function assigns a buffer to one of the Ethernet
MAC’s receive descriptors. The receive buffer specified as parameter will be
used to receive one single packet. The receive buffer will be handed back to the
application via a call to the receive callback function assigned through a call to
MSS_MAC_set_rx_callback(). The MSS_MAC_receive_pkt() function will need
to be called again pointing to the same buffer if more packets are to be received
into this same buffer after the packet has been processed by the application.
The MSS_MAC_receive_pkt() function is non-blocking. It will return immediately
and does not wait for a packet to be received. The application needs to
implement a receive callback function to be notified that a packet has been
received.
The p_user_data parameter can be optionally used to point to a memory
management data structure managed by the application.
MSS_MAC_set_tx_callback
The MSS_MAC_set_tx_callback() function registers the function that will be
called by the Ethernet MAC driver when a packet has been sent.
MSS_MAC_set_rx_callback
The MSS_MAC_set_rx_callback() function registers the function that will be
called by the Ethernet MAC driver when a packet is received.
Table 330 •
TSEMAC Firmware Drivers for Reading Status and Statistics
API
Description
MSS_MAC_read_stat
The MSS_MAC_read_stat() function reads the transmit and receive statistics
of the Ethernet MAC. This function can be used to read one of 17 receiver
statistics, 20 transmitter statistics and 7 frame type statistics as defined in the
mss_mac_stat_t enumeration.
MSS_MAC_clear_statistics
The MSS_MAC_clear_statistics() function clears all the statistics counter
registers.
MSS_MAC_get_link_status
The MSS_MAC_get_link_status () function retrieves the status of the link from
the Ethernet PHY. It returns the current state of the Ethernet link. The speed
and duplex mode of the link is also returned via the two pointers passed as
parameter if the link is up.
This function also adjusts the Ethernet MAC’s internal configuration if some of
the link characteristics have changed since the previous call to this function.
Table 331 •
MAC_CR Register in SYSREG Block
Register Name
Register Type
Flash Write Protect Reset Source
Description
MAC_CR
RW-P
Register
sysreset_n
MAC configuration register
Table 329 •
TSEMAC Firmware Drivers for Transmit and Receive Operations
(continued)
API
Description