Software Drivers
xlltemac.h File Reference
Detailed Description
The Xilinx Tri-Mode Ethernet driver component. This driver supports the Virtex-5(TM) and Virtex-4(TM) 10/100/1000 MAC (TEMAC).
For a full description of TEMAC features, please see the hardware spec. This driver supports the following features:
- Memory mapped access to host interface registers
- Virtual memory support
- Unicast, broadcast, and multicast receive address filtering
- Full duplex operation (half duplex not supported)
- Automatic source address insertion or overwrite (programmable)
- Automatic PAD & FCS insertion and stripping (programmable)
- Flow control
- VLAN frame support
- Pause frame support
- Jumbo frame support
- Checksum offload
- Extended multicast addresses to 2**23.
- Extended VLAN translation, tagging and stripping supports.
Driver Description
The device driver enables higher layer software (e.g., an application) to configure a TEMAC channel. It is intended that this driver be used in cooperation with another driver (FIFO or DMA) for data communication. This device driver can support multiple devices even when those devices have significantly different configurations.
Initialization & Configuration
The XLlTemac_Config structure can be used by the driver to configure itself. This configuration structure is typically created by the tool-chain based on hardware build properties, although, other methods are allowed and currently used in some systems.
To support multiple runtime loading and initialization strategies employed by various operating systems, the driver instance can be initialized using the XLlTemac_CfgInitialze() routine.
Interrupts and Asynchronous Callbacks
The driver has no dependencies on the interrupt controller. It provides no interrupt handlers. The application/OS software should set up its own interrupt handlers if required.
Device Reset
When a TEMAC channel is connected up to a FIFO or DMA core in hardware, errors may be reported on one of those cores (FIFO or DMA) such that it can be determined that the TEMAC channel needs to be reset. If a reset is performed, the calling code should also reconfigure and reapply the proper settings in the TEMAC channel.
When a TEMAC channel reset is required, XLlTemac_Reset() should be utilized.
Virtual Memory
This driver may be used in systems with virtual memory support by passing the appropriate value for the EffectiveAddress parameter to the XLlTemac_CfgInitialize() routine.
Transfering Data
The TEMAC core by itself is not cabable of transmitting or receiving data in any meaninful way. Instead one or both TEMAC channels need to be connected to a FIFO or DMA core in hardware.
This TEMAC driver is modeled in a similar fashion where the application code or O/S adapter driver needs to make use of a separte FIFO or DMA driver in connection with this driver to establish meaningful communication over ethernet.
Checksum Offloading
If configured, the device can compute a 16-bit checksum from frame data. In most circumstances this can lead to a substantial gain in throughput.
The checksum offload settings for each frame sent or recieved are transmitted through the LocalLink interface in hardware. What this means is that the checksum offload feature is indirectly controlled in the TEMAC channel through the driver for the FIFO or DMA core connected to the TEMAC channel.
Refer to the documentation for the FIFO or DMA driver used for data communication on how to set the values for the relevant LocalLink header words.
Since this hardware implementation is general purpose in nature system software must perform pre and post frame processing to obtain the desired results for the types of packets being transferred. Most of the time this will be TCP/IP traffic.
TCP/IP and UDP/IP frames contain separate checksums for the IP header and UDP/TCP header+data. With this hardware implementation, the IP header checksum cannot be offloaded. Many stacks that support offloading will compute the IP header if required and use hardware to compute the UDP/TCP header+data checksum. There are other complications concerning the IP pseudo header that must be taken into consideration. Readers should consult a TCP/IP design reference for more details.
There are certain device options that will affect the checksum calculation performed by hardware for Tx:
- FCS insertion disabled (XTE_FCS_INSERT_OPTION): software is required to calculate and insert the FCS value at the end of the frame, but the checksum must be known ahead of time prior to calculating the FCS. Therefore checksum offloading cannot be used in this situation.
And for Rx:
- FCS/PAD stripping disabled (XTE_FCS_STRIP_OPTION): The 4 byte FCS at the end of frame will be included in the hardware calculated checksum. software must subtract out this data.
- FCS/PAD stripping disabled (XTE_FCS_STRIP_OPTION): For frames smaller than 64 bytes, padding will be included in the hardware calculated checksum. software must subtract out this data. It may be better to allow the TCP/IP stack verify checksums for this type of packet.
- VLAN enabled (XTE_VLAN_OPTION): The 4 extra bytes in the Ethernet header affect the hardware calculated checksum. software must subtract out the 1st two 16-bit words starting at the 15th byte.
Transmit Checksum Offloading
For transmit, the software can specify where in the frame the checksum calculation is to start, where the result should be inserted, and a seed value. The checksum is calculated from the start point through the end of frame.
The checsum offloading settings are sent in the transmit LocalLink header words. The relevant LocalLink header words are described in brief below. Refer to the XPS_LL_TEMAC v2.00a hardware specification for more details.
LocalLink header word 3:
Bits 31 (MSB): Transmit Checksum Enable: 1 - enabled, 0 - disabled
Bits 0-30 (LSB): Reserved
LocalLink header word 4:
Bits 16-31 (MSB): Transmit Checksum Insertion Point: Frame offset where the
computed checksum value is stored, which should be in the
TCP or UDP header
Bits 0-15 (LSB): Transmit Checksum Calculation Starting Point: Offset
in the frame where checksum calculation should begin
LocalLink header word 5:
Bits 16-31 (MSB): Transmit Checksum Calculation Initial Value: Checksum
seed value
Bits 0-15 (LSB): Reserved
Receive Checksum Offloading
For Receive, the 15th byte to end of frame is checksummed. This range of bytes is the entire Ethernet payload (for non-VLAN frames).
The checsum offloading information is sent in the receive LocalLink header words. The relevant LocalLink header words are described in brief below. Refer to the XPS_LL_TEMAC v2.00a hardware specification for more details.
LocalLink header word 6:
Bits 16-31 (MSB): Receive Raw Checksum: Computed checksum value
Bits 0-15 (LSB): Type Length VLAN TPID: valid when extended VLAN options
are enabled.
Extended multicast
(XTE_EXT_MULTICAST_OPTION): Allow and perform address filtering more than 4 multicast addresses. Hardware requires to enable promiscuous mode (XTE_PROMISCUOUS_OPTION) and disable legacy multicast mode (XTE_MULTICAST_OPTION) for this feature to work. However, these two modes are still supported with v2.00a hardware.
Extended VLAN
TX/RX VLAN stripping
(XTE_EXT_[T|R]XVLAN_STRP_OPTION) handles transmit/receive one VLAN tag stripping in ethernet frames. To enable this option, hardware requires to build with this feature and enable (XTE_FCS_INSERT_OPTION), (XTE_FCS_STRP_OPTION) and disable (XTE_VLAN_OPTION). Supprts three modes, -XTE_VSTRP_NONE : no stripping -XTE_VSTRP_ALL : strip one tag from all frames -XTE_VSTRP_SELECT : strip one tag from selected frames
TX/RX VLAN translation
(XTE_EXT_[T|R]XVLAN_TRAN_OPTION) handles transmit/receive one VLAN tag translation in ethernet frames. To enable this option, hardware requires to build with this feature and enable (XTE_FCS_INSERT_OPTION), (XTE_FCS_STRP_OPTION), and disable (XTE_VLAN_OPTION).
TX/RX VLAN tagging
(XTE_EXT_[T|R]XVLAN_TAG_OPTION) adds transmit/receive one VLAN tag in ethernet frames. To enable this option, hardware requires to build with this feature and enable (XTE_FCS_INSERT_OPTION), (XTE_FCS_STRP_OPTION), (XTE_JUMBO_OOPTION) and disable (XTE_VLAN_OPTION). Support four modes, -XTE_VTAG_NONE : no tagging -XTE_VTAG_ALL : tag all frames -XTE_VTAG_EXISTED : tag already tagged frames -XTE_VTAG_SELECT : tag selected already tagged frames
PHY Communication
Prior to PHY access, the MDIO clock must be setup. This driver will set a safe default that should work with PLB bus speeds of up to 150 MHz and keep the MDIO clock below 2.5 MHz. If the user wishes faster access to the PHY then the clock divisor can be set to a different value (see XLlTemac_PhySetMdioDivisor()).
MII register access is performed through the functions XLlTemac_PhyRead() and XLlTemac_PhyWrite().
Link Sync
When the device is used in a multispeed environment, the link speed must be explicitly set using XLlTemac_SetOperatingSpeed() and must match the speed PHY has negotiated. If the speeds are mismatched, then the MAC will not pass traffic.
The application/OS software may use the AutoNegotiation interrupt to be notified when the PHY has completed auto-negotiation.
Asserts
Asserts are used within all Xilinx drivers to enforce constraints on argument values. Asserts can be turned off on a system-wide basis by defining, at compile time, the NDEBUG identifier. By default, asserts are turned on and it is recommended that users leave asserts on during development. For deployment use -DNDEBUG compiler switch to remove assert code.
Driver Errata
- A dropped receive frame indication may be reported by the driver after calling XLlTemac_Stop() followed by XLlTemac_Start(). This can occur if a frame is arriving when stop is called.
- On Rx with checksum offloading enabled and FCS/PAD stripping disabled, FCS and PAD data will be included in the checksum result.
- On Tx with checksum offloading enabled and auto FCS insertion disabled, the user calculated FCS will be included in the checksum result.
- Note:
Xilinx drivers are typically composed of two components, one is the driver and the other is the adapter. The driver is independent of OS and processor and is intended to be highly portable. The adapter is OS-specific and facilitates communication between the driver and an OS.
This driver is intended to be RTOS and processor independent. Any needs for dynamic memory management, threads or thread mutual exclusion, or cache control must be satisfied by the layer above this driver.
MODIFICATION HISTORY:
Ver Who Date Changes
----- ---- -------- -------------------------------------------------------
1.00a jvb 11/10/06 First release
1.00a rpm 06/08/07 Added interrupt IDs to config structure for convenience
1.00b drg 02/08/08 Added MGT check to the reset routine
2.00a wsy 08/08/08 Added extended multicast and VLAN features. Removed
support for static interrupt handlers from the MDD file.
|
Data Structures |
struct | XLlTemac_Config |
struct | XLlTemac |
Configuration options |
The following are device configuration options. See the XLlTemac_SetOptions, XLlTemac_ClearOptions and XLlTemac_GetOptions routines for information on how to use options.
The default state of the options are also noted below.
|
#define | XTE_PROMISC_OPTION |
#define | XTE_JUMBO_OPTION |
#define | XTE_VLAN_OPTION |
#define | XTE_FLOW_CONTROL_OPTION |
#define | XTE_FCS_STRIP_OPTION |
#define | XTE_FCS_INSERT_OPTION |
#define | XTE_LENTYPE_ERR_OPTION |
#define | XTE_TRANSMITTER_ENABLE_OPTION |
#define | XTE_RECEIVER_ENABLE_OPTION |
#define | XTE_BROADCAST_OPTION |
#define | XTE_MULTICAST_OPTION |
#define | XTE_EXT_MULTICAST_OPTION |
#define | XTE_EXT_TXVLAN_TRAN_OPTION |
#define | XTE_EXT_RXVLAN_TRAN_OPTION |
#define | XTE_EXT_TXVLAN_TAG_OPTION |
#define | XTE_EXT_RXVLAN_TAG_OPTION |
#define | XTE_EXT_TXVLAN_STRP_OPTION |
#define | XTE_EXT_RXVLAN_STRP_OPTION |
#define | XTE_DEFAULT_OPTIONS |
Reset parameters |
These are used by function XLlTemac_Reset().
|
#define | XTE_RESET_HARD |
#define | XTE_NORESET_HARD |
Defines |
#define | XLlTemac_IsStarted(InstancePtr) |
#define | XLlTemac_IsDma(InstancePtr) |
#define | XLlTemac_IsFifo(InstancePtr) |
#define | XLlTemac_LlDevBaseAddress(InstancePtr) |
#define | XLlTemac_IsRecvFrameDropped(InstancePtr) |
#define | XLlTemac_IsRxCsum(InstancePtr) |
#define | XLlTemac_IsTxCsum(InstancePtr) |
#define | XLlTemac_GetPhysicalInterface(InstancePtr) |
#define | XLlTemac_Status(InstancePtr) |
#define | XLlTemac_IntEnable(InstancePtr, Mask) |
#define | XLlTemac_IntDisable(InstancePtr, Mask) |
#define | XLlTemac_IntPending(InstancePtr) |
#define | XLlTemac_IntClear(InstancePtr, Mask) |
#define | XLlTemac_IsExtFuncCap(InstancePtr) |
#define | XLlTemac_IsExtMcastEnable(InstancePtr) |
#define | XLlTemac_IsExtMcast(InstancePtr) |
#define | XLlTemac_IsTxVlanStrp(InstancePtr) |
#define | XLlTemac_IsRxVlanStrp(InstancePtr) |
#define | XLlTemac_IsTxVlanTran(InstancePtr) |
#define | XLlTemac_IsRxVlanTran(InstancePtr) |
#define | XLlTemac_IsTxVlanTag(InstancePtr) |
#define | XLlTemac_IsRxVlanTag(InstancePtr) |
Typedefs |
typedef XLlTemac | XLlTemac |
Functions |
int | XLlTemac_CfgInitialize (XLlTemac *InstancePtr, XLlTemac_Config *CfgPtr, u32 VirtualAddress) |
void | XLlTemac_Start (XLlTemac *InstancePtr) |
void | XLlTemac_Stop (XLlTemac *InstancePtr) |
void | XLlTemac_Reset (XLlTemac *InstancePtr, int HardCoreAction) |
XLlTemac_Config * | XLlTemac_LookupConfig (u16 DeviceId) |
int | XLlTemac_SetOptions (XLlTemac *InstancePtr, u32 Options) |
int | XLlTemac_ClearOptions (XLlTemac *InstancePtr, u32 Options) |
u32 | XLlTemac_GetOptions (XLlTemac *InstancePtr) |
int | XLlTemac_SetMacAddress (XLlTemac *InstancePtr, void *AddressPtr) |
void | XLlTemac_GetMacAddress (XLlTemac *InstancePtr, void *AddressPtr) |
int | XLlTemac_SetMacPauseAddress (XLlTemac *InstancePtr, void *AddressPtr) |
void | XLlTemac_GetMacPauseAddress (XLlTemac *InstancePtr, void *AddressPtr) |
int | XLlTemac_SendPausePacket (XLlTemac *InstancePtr, u16 PauseValue) |
int | XLlTemac_GetSgmiiStatus (XLlTemac *InstancePtr, u16 *SpeedPtr) |
int | XLlTemac_GetRgmiiStatus (XLlTemac *InstancePtr, u16 *SpeedPtr, int *IsFullDuplexPtr, int *IsLinkUpPtr) |
u16 | XLlTemac_GetOperatingSpeed (XLlTemac *InstancePtr) |
void | XLlTemac_SetOperatingSpeed (XLlTemac *InstancePtr, u16 Speed) |
void | XLlTemac_PhySetMdioDivisor (XLlTemac *InstancePtr, u8 Divisor) |
int | XLlTemac_MulticastAdd (XLlTemac *InstancePtr, void *AddressPtr, int Entry) |
void | XLlTemac_MulticastGet (XLlTemac *InstancePtr, void *AddressPtr, int Entry) |
int | XLlTemac_MulticastClear (XLlTemac *InstancePtr, int Entry) |
int | XLlTemac_SetTpid (XLlTemac *InstancePtr, u16 Tpid, u8 Entry) |
int | XLlTemac_ClearTpid (XLlTemac *InstancePtr, u8 Entry) |
void | XLlTemac_GetTpid (XLlTemac *InstancePtr, u16 *TpidPtr, u8 Entry) |
int | XLlTemac_SetVTagMode (XLlTemac *InstancePtr, u32 Mode, int Dir) |
void | XLlTemac_GetVTagMode (XLlTemac *InstancePtr, u8 *ModePtr, int Dir) |
int | XLlTemac_SetVStripMode (XLlTemac *InstancePtr, u32 Mode, int Dir) |
void | XLlTemac_GetVStripMode (XLlTemac *InstancePtr, u8 *ModePtr, int Dir) |
int | XLlTemac_SetVTagValue (XLlTemac *InstancePtr, u32 VTagValue, int Dir) |
void | XLlTemac_GetVTagValue (XLlTemac *InstancePtr, u32 *VTagValuePtr, int Dir) |
int | XLlTemac_SetVidTable (XLlTemac *InstancePtr, u32 Entry, u32 Vid, u8 Strip, u8 Tag, int Dir) |
void | XLlTemac_GetVidTable (XLlTemac *InstancePtr, u32 Entry, u32 *VidPtr, u8 *StripPtr, u8 *TagPtr, int Dir) |
int | XLlTemac_AddExtMulticastGroup (XLlTemac *InstancePtr, void *AddressPtr) |
int | XLlTemac_ClearExtMulticastGroup (XLlTemac *InstancePtr, void *AddressPtr) |
int | XLlTemac_GetExtMulticastGroup (XLlTemac *InstancePtr, void *AddressPtr) |
void | XLlTemac_DumpExtMulticastGroup (XLlTemac *InstancePtr) |
Define Documentation
#define XLlTemac_GetPhysicalInterface |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_GetPhysicalInterface returns the type of PHY interface being used by the given instance, specified by InstancePtr.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_GetPhysicalInterface returns one of XTE_PHY_TYPE_<x> where <x> is MII, GMII, RGMII_1_3, RGMII_2_0, SGMII, or 1000BASE_X (defined in xlltemac.h).
- Note:
Signature: int XLlTemac_GetPhysicalInterface(XLlTemac *InstancePtr) |
#define XLlTemac_IntClear |
( |
InstancePtr, |
|
|
Mask |
|
) |
|
|
|
XLlTemac_IntClear clears pending interrupts specified in Mask. The corresponding pending interrupt for each bit set to 1 in Mask, will be cleared. In other words, XLlTemac_IntClear uses the "set a bit to clear it" scheme.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Mask | contains a bit mask of the pending interrupts to clear. The mask can be formed using a set of bitwise or'd values from the XTE_INT_*_MASK preprocessor symbols. |
- Note:
- C-style signature: void XLlTemac_IntClear(XLlTemac *InstancePtr, u32 Mask)
|
#define XLlTemac_IntDisable |
( |
InstancePtr, |
|
|
Mask |
|
) |
|
|
|
XLlTemac_IntDisable disables the interrupts specified in Mask. The corresponding interrupt for each bit set to 1 in Mask, will be disabled. In other words, XLlTemac_IntDisable uses the "set a bit to clear it" scheme.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Mask | contains a bit mask of the interrupts to disable. The mask can be formed using a set of bitwise or'd values from the XTE_INT_*_MASK preprocessor symbols. |
- Returns:
- N/A
- Note:
- C-style signature: void XLlTemac_IntDisable(XLlTemac *InstancePtr, u32 Mask)
|
#define XLlTemac_IntEnable |
( |
InstancePtr, |
|
|
Mask |
|
) |
|
|
|
XLlTemac_IntEnable enables the interrupts specified in Mask. The corresponding interrupt for each bit set to 1 in Mask, will be enabled.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Mask | contains a bit mask of the interrupts to enable. The mask can be formed using a set of bitwise or'd values from the XTE_INT_*_MASK preprocessor symbols. |
- Returns:
- N/A
- Note:
- C-style signature: void XLlTemac_IntEnable(XLlTemac *InstancePtr, u32 Mask)
|
#define XLlTemac_IntPending |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IntPending returns a bit mask of the pending interrupts. Each bit set to 1 in the return value represents a pending interrupt.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IntPending returns a bit mask of the interrupts that are pending. The mask will be a set of bitwise or'd values from the
XTE_INT_*_MASK preprocessor symbols.
- Note:
- C-style signature: u32 XLlTemac_IntPending(XLlTemac *InstancePtr)
|
#define XLlTemac_IsDma |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsDma reports if the device is currently connected to DMA.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsDma returns XTRUE if the device is connected DMA. Otherwise, XLlTemac_IsDma returns XFALSE.
- Note:
Signature: u32 XLlTemac_IsDma(XLlTemac *InstancePtr) |
#define XLlTemac_IsExtFuncCap |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsExtFuncCap determines if the device is capable of new/extend VLAN and multicast features.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- TRUE if the device is capable and configured with new/extended VLAN and multicast features Otherwise, returns FALSE.
- Note:
- C-style signature: u32 XLlTemac_IsExtFuncCap(XLlTemac *InstancePtr)
|
#define XLlTemac_IsExtMcast |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsExtMcast determines if the device is built with new/extended multicast features.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- TRUE if the device is built with new/extended multicast features. Otherwise, returns FALSE.
- Note:
- : This function indicates when hardware is built with extended Multicast feature.
C-style signature: u32 XLlTemac_IsExtMcast(XLlTemac *InstancePtr) |
#define XLlTemac_IsExtMcastEnable |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsExtMcastEnable determines if the new/extended multicast features is enabled.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- TRUE if the device new/extended multicast features is enabled. Otherwise, returns FALSE.
- Note:
- : This function indicates when extended Multicast is enabled in HW, extended multicast mode in wrapper can be tested.
C-style signature: u32 XLlTemac_IsExtMcastEnable(XLlTemac *InstancePtr) |
#define XLlTemac_IsFifo |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsFifo reports if the device is currently connected to a fifo core.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsFifo returns XTRUE if the device is connected to a fifo core. Otherwise, XLlTemac_IsFifo returns XFALSE.
- Note:
Signature: u32 XLlTemac_IsFifo(XLlTemac *InstancePtr) |
#define XLlTemac_IsRecvFrameDropped |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsRecvFrameDropped determines if the device thinks it has dropped a receive frame.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsRecvFrameDropped returns TRUE if the device interrupt status register reports that a frame has been dropped. Otherwise, XLlTemac_IsRecvFrameDropped returns FALSE.
- Note:
Signature: u32 XLlTemac_IsRecvFrameDropped(XLlTemac *InstancePtr) |
#define XLlTemac_IsRxCsum |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsRxCsum determines if the device is configured with checksum offloading on the receive channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsRxCsum returns TRUE if the device is configured with checksum offloading on the receive channel. Otherwise, XLlTemac_IsRxCsum returns FALSE.
- Note:
Signature: u32 XLlTemac_IsRxCsum(XLlTemac *InstancePtr) |
#define XLlTemac_IsRxVlanStrp |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsRxVlanStrp determines if the device is configured with receive VLAN stripping on the receive channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsRxVlanStrp returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsRxVlanStrp returns FALSE.
- Note:
Signature: u32 XLlTemac_IsRxVlanTran(XLlTemac *InstancePtr) |
#define XLlTemac_IsRxVlanTag |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsRxVlanTag determines if the device is configured with receive VLAN tagging on the receive channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsRxVlanTag returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsRxVlanTag returns FALSE.
- Note:
Signature: u32 XLlTemac_IsRxVlanTag(XLlTemac *InstancePtr) |
#define XLlTemac_IsRxVlanTran |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsRxVlanTran determines if the device is configured with receive VLAN translation on the receive channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsRxVlanTran returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsRxVlanTran returns FALSE.
- Note:
Signature: u32 XLlTemac_IsRxVlanTran(XLlTemac *InstancePtr) |
#define XLlTemac_IsStarted |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsStarted reports if the device is in the started or stopped state. To be in the started state, the calling code must have made a successful call to XLlTemac_Start. To be in the stopped state, XLlTemac_Stop or XLlTemac_CfgInitialize function must have been called.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsStarted returns TRUE if the device has been started. Otherwise, XLlTemac_IsStarted returns FALSE.
- Note:
Signature: u32 XLlTemac_IsStarted(XLlTemac *InstancePtr) |
#define XLlTemac_IsTxCsum |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsTxCsum determines if the device is configured with checksum offloading on the transmit channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsTxCsum returns TRUE if the device is configured with checksum offloading on the transmit channel. Otherwise, XLlTemac_IsTxCsum returns FALSE.
- Note:
Signature: u32 XLlTemac_IsTxCsum(XLlTemac *InstancePtr) |
#define XLlTemac_IsTxVlanStrp |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsTxVlanStrp determines if the device is configured with transmit VLAN stripping on the transmit channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsTxVlanStrp returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsTxVlanStrp returns FALSE.
- Note:
Signature: u32 XLlTemac_IsTxVlanStrp(XLlTemac *InstancePtr) |
#define XLlTemac_IsTxVlanTag |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsTxVlanTag determines if the device is configured with transmit VLAN tagging on the transmit channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsTxVlanTag returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsTxVlanTag returns FALSE.
- Note:
Signature: u32 XLlTemac_IsTxVlanTag(XLlTemac *InstancePtr) |
#define XLlTemac_IsTxVlanTran |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_IsTxVlanTran determines if the device is configured with transmit VLAN translation on the transmit channel.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsTxVlanTran returns TRUE if the device is configured with VLAN trabslation on the transmit channel. Otherwise, XLlTemac_IsTxVlanTran returns FALSE.
- Note:
Signature: u32 XLlTemac_IsTxVlanTran(XLlTemac *InstancePtr) |
#define XLlTemac_LlDevBaseAddress |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_LlDevBaseAddress reports the base address of the core connected to the TEMAC's local link interface.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IsFifo returns the base address of the core connected to the TEMAC's local link interface.
- Note:
Signature: u32 XLlTemac_LlDevBaseAddress(XLlTemac *InstancePtr) |
#define XLlTemac_Status |
( |
InstancePtr |
|
) |
|
|
|
XLlTemac_Status returns a bit mask of the interrupt status register (ISR). XLlTemac_Status can be used to query the status without having to have interrupts enabled.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_IntStatus returns a bit mask of the status conditions. The mask will be a set of bitwise or'd values from the
XTE_INT_*_MASK preprocessor symbols.
- Note:
- C-style signature: u32 XLlTemac_IntStatus(XLlTemac *InstancePtr)
|
#define XTE_BROADCAST_OPTION |
|
|
XTE_BROADCAST_OPTION specifies the TEMAC channel to receive frames sent to the broadcast Ethernet address. This driver sets this option to enabled (set) by default. |
#define XTE_DEFAULT_OPTIONS |
|
#define XTE_EXT_MULTICAST_OPTION |
|
|
XTE_EXT_MULTICAST_OPTION specifies the TEMAC channel to receive frames sent to Ethernet addresses that are programmed into the BRAM Multicast Address Table. This driver sets this option to be dependent on HW configuration by default. |
#define XTE_EXT_RXVLAN_STRP_OPTION |
|
|
XTE_EXT_RXVLAN_STRP_OPTION specifies the TEMAC channel to enable receive VLAN stripping. This driver sets this option to be dependent during HW build time by default. |
#define XTE_EXT_RXVLAN_TAG_OPTION |
|
|
XTE_EXT_RXVLAN_TAG_OPTION specifies the TEMAC channel to enable receive VLAN tagging. This driver sets this option to be dependent during HW build time by default. |
#define XTE_EXT_RXVLAN_TRAN_OPTION |
|
|
XTE_EXT_RXVLAN_TRAN_OPTION specifies the TEMAC channel to enable receive VLAN translation. This driver sets this option to be dependent on HW configuration by default. |
#define XTE_EXT_TXVLAN_STRP_OPTION |
|
|
XTE_EXT_TXVLAN_STRP_OPTION specifies the TEMAC channel to enable transmit VLAN stripping. This driver sets this option to be dependent during HW build time by default. |
#define XTE_EXT_TXVLAN_TAG_OPTION |
|
|
XTE_EXT_TXVLAN_TAG_OPTION specifies the TEMAC channel to enable transmit VLAN tagging. This driver sets this option to be dependent during HW build time by default. |
#define XTE_EXT_TXVLAN_TRAN_OPTION |
|
|
XTE_EXT_RXVLAN_TRAN_OPTION specifies the TEMAC channel to enable transmit VLAN translation. This driver sets this option to be dependent on HW configuration by default. |
#define XTE_FCS_INSERT_OPTION |
|
|
XTE_FCS_INSERT_OPTION specifies the TEMAC channel to generate the FCS field and add PAD automatically for outgoing frames. This driver sets this option to enabled (set) by default. |
#define XTE_FCS_STRIP_OPTION |
|
|
XTE_FCS_STRIP_OPTION specifies the TEMAC channel to strip FCS and PAD from received frames. Note that PAD from VLAN frames is not stripped. This driver sets this option to enabled (set) by default. |
#define XTE_FLOW_CONTROL_OPTION |
|
|
XTE_FLOW_CONTROL_OPTION specifies the TEMAC channel to recognize received flow control frames. This driver sets this option to enabled (set) by default. |
|
XTE_JUMBO_OPTION specifies the TEMAC channel to accept jumbo frames for transmit and receive. This driver sets this option to disabled (cleared) by default. |
#define XTE_LENTYPE_ERR_OPTION |
|
|
XTE_LENTYPE_ERR_OPTION specifies the TEMAC channel to enable Length/Type error checking (mismatched type/length field) for received frames. This driver sets this option to enabled (set) by default. |
#define XTE_MULTICAST_OPTION |
|
|
XTE_MULTICAST_OPTION specifies the TEMAC channel to receive frames sent to Ethernet addresses that are programmed into the Multicast Address Table (MAT). This driver sets this option to disabled (cleared) by default. |
#define XTE_PROMISC_OPTION |
|
|
XTE_PROMISC_OPTION specifies the TEMAC channel to accept all incoming packets. This driver sets this option to disabled (cleared) by default. |
#define XTE_RECEIVER_ENABLE_OPTION |
|
|
XTE_RECEIVER_ENABLE_OPTION specifies the TEMAC channel receiver to be enabled. This driver sets this option to enabled (set) by default. |
#define XTE_TRANSMITTER_ENABLE_OPTION |
|
|
XTE_TRANSMITTER_ENABLE_OPTION specifies the TEMAC channel transmitter to be enabled. This driver sets this option to enabled (set) by default. |
|
XTE_VLAN_OPTION specifies the TEMAC channel to enable VLAN support for transmit and receive. This driver sets this option to disabled (cleared) by default. |
Typedef Documentation
|
struct XLlTemac is the type for TEMAC driver instance data. The calling code is required to use a unique instance of this structure for every TEMAC channel used in the system. Each channel is treated as a separate device from the point of view of this driver. A reference to a structure of this type is then passed to the driver API functions. |
Function Documentation
int XLlTemac_AddExtMulticastGroup |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_AddExtMulticastGroup adds an entry to the multicast Ethernet address table in BRAM. The new entry, represents a group of MAC addresses based on the contents of AddressPtr. AddressPtr is one member of the MAC address set in the newly added entry.
The device must be stopped to use this function.
Once an Ethernet address is programmed, the TEMAC channel will begin receiving data sent from that address. The TEMAC hardware does not have a control bit to disable multicast filtering. The only way to prevent the TEMAC channel from receiving messages from an Ethernet address in the BRAM table is to clear it with XLlTemac_ClearExtMulticastGroup().
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | is a pointer to the 6-byte Ethernet address to add. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped XST_INVALID_PARAM, if input MAC address is not between 01:00:5E:00:00:00 and 01:00:5E:7F:FF:FF per RFC1112.
- Note:
This routine consider all 2**23 possible multicast ethernet addresses to be 8Mx1 bit or 1M bytes memory area. All defined multicast addresses are from 01.00.5E.00.00.00 to 01.00.5E.7F.FF.FF The most significant 25 bit out of 48 bit are static, so they will not be part of calculation.
In BRAM table, hardware requires to 'index' with bit 22-8, 15 bits in total. The least significant byte/8 bits are considered a group.
This API operates at a group (256 MAC addresses) for hardware to do the first layer address filtering. It is user's responsibility to provision this table appropriately. |
|
XLlTemac_CfgInitialize initializes a TEMAC channel along with the InstancePtr that references it. Each TEMAC channel is treated as a separate device from the point of view of this driver.
The PHY is setup independently from the TEMAC. Use the MII or whatever other interface may be present for setup.
- Parameters:
-
| InstancePtr | references the memory instance to be associated with the TEMAC channel upon initialization. |
| CfgPtr | references the structure holding the hardware configuration for the TEMAC channel to initialize. |
| EffectiveAddress | is the processor address used to access the base address of the TEMAC channel. In systems with an MMU and virtual memory, EffectiveAddress is the virtual address mapped to the physical in ConfigPtr->Config.BaseAddress . In systems without an active MMU, EffectiveAddress should be set to the same value as ConfigPtr->Config.BaseAddress . |
- Returns:
- XLlTemac_CfgInitialize returns XST_SUCCESS.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_ClearExtMulticastGroup |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_ClearExtMulticastGroup clears input multicast Ethernet address group from BRAM table.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | is a pointer to the 6-byte Ethernet address to clear. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped XST_INVALID_PARAM, if input MAC address is not between 01:00:5E:00:00:00 and 01:00:5E:7F:FF:FF * per RFC1112.
- Note:
Please reference XLlTemac_AddExtMulticastGroup for multicast address index and bit value calculation.
In BRAM table, hardware requires to 'index' with bit 22-8, 15 bits in total. The least significant byte/8 bits are considered a group.
There is a scenario might introduce issues. When multicast tables are programed initially to accept 01:00:5E:12:34:56 and 01:00:5E:12:34:78 but later decided to clear 01:00:5E:12:34:78. Without validating all possible combinations at the indexed entry, multicast BRAM table might be misconfigured and drop frames.
When clearing a multicast address table entry, note that a whole group of mac addresses will no longer be accepted - this because an entry in the table represents multiple(256) mac addresses.
The device must be stopped to use this function.
This API operates at a group (256 MAC addresses) level for hardware to perform the first layer address filtering. It is user's responsibility to provision this table appropriately. |
int XLlTemac_ClearOptions |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Options |
|
) |
|
|
|
XLlTemac_ClearOptions clears the options, Options for the TEMAC channel, specified by InstancePtr. The TEMAC channel should be stopped with XLlTemac_Stop() before changing options.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Options | is a bitmask of OR'd XTE_*_OPTION values for options to clear. Options not specified are not affected. |
- Returns:
- On successful completion, XLlTemac_ClearOptions returns XST_SUCCESS. Otherwise, if the device has not been stopped, XLlTemac_ClearOptions returns XST_DEVICE_IS_STARTED.
- Note:
- See xlltemac.h for a description of the available options.
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_ClearTpid |
( |
XLlTemac * |
InstancePtr, |
|
|
u8 |
Entry |
|
) |
|
|
|
XLlTemac_ClearTpid clears the VLAN Tag Protocol Identifier(TPID).
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Entry | is the hardware storage location to program this address and must be between 0..XTE_TPID_MAX_ENTRIES. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable or have the VLAN tag capability.
- Note:
|
void XLlTemac_DumpExtMulticastGroup |
( |
XLlTemac * |
InstancePtr |
) |
|
|
|
XLlTemac_DumpExtMulticastGroup dump ALL provisioned acceptable multicast MAC in the TEMAC channel's multicast BRAM table.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- N/A.
- Note:
In BRAM table, hardware requires to 'index' with bit 22-8, 15 bits in total. The least significant byte/8 bits are considered a set.
This API operates at a set (256 MAC addresses) level. |
int XLlTemac_GetExtMulticastGroup |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_GetExtMulticastGroup inquery the Ethernet addresses group stored in BRAM table.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | references the memory buffer to store the retrieved Ethernet address. This memory buffer must be at least 6 bytes in length. |
- Returns:
- TRUE, a provisioned acceptable multicast MAC address. FALSE, an unacceptable multicast MAC address.
- Note:
In BRAM table, hardware requires to 'index' with bit 22-8, 15 bits in total. The least significant byte/8 bits are considered a group. This API operates at a group (256 MAC addresses) level. |
void XLlTemac_GetMacAddress |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_GetMacAddress gets the MAC address for the TEMAC channel, specified by InstancePtr into the memory buffer specified by AddressPtr.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | references the memory buffer to store the retrieved MAC address. This memory buffer must be at least 6 bytes in length. |
- Returns:
- N/A
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driver. This routine also supports the extended/new VLAN and multicast mode. The XTE_RAF_NEWFNCENBL_MASK bit dictats which offset will be configured. |
void XLlTemac_GetMacPauseAddress |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_GetMacPauseAddress gets the MAC address used for pause frames for the TEMAC channel specified by InstancePtr.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | references the memory buffer to store the retrieved MAC address. This memory buffer must be at least 6 bytes in length. |
- Returns:
- N/A
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
u16 XLlTemac_GetOperatingSpeed |
( |
XLlTemac * |
InstancePtr |
) |
|
|
|
XLlTemac_GetOperatingSpeed gets the current operating link speed. This may be the value set by XLlTemac_SetOperatingSpeed() or a hardware default.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_GetOperatingSpeed returns the link speed in units of megabits per second.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
u32 XLlTemac_GetOptions |
( |
XLlTemac * |
InstancePtr |
) |
|
|
|
XLlTemac_GetOptions returns the current option settings.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- XLlTemac_GetOptions returns a bitmask of XTE_*_OPTION constants, each bit specifying an option that is currently active.
- Note:
- See xlltemac.h for a description of the available options.
|
int XLlTemac_GetRgmiiStatus |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 * |
SpeedPtr, |
|
|
int * |
IsFullDuplexPtr, |
|
|
int * |
IsLinkUpPtr |
|
) |
|
|
|
XLlTemac_GetRgmiiStatus get the state of the link when using the RGMII media interface.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| SpeedPtr | references the location to store the result, which is the autonegotiaged link speed in units of Mbits/sec, either 0, 10, 100, or 1000. |
| IsFullDuplexPtr | references the value to set to indicate full duplex operation. XLlTemac_GetRgmiiStatus sets IsFullDuplexPtr to TRUE when the RGMII link is operating in full duplex mode. Otherwise, XLlTemac_GetRgmiiStatus sets IsFullDuplexPtr to FALSE. |
| IsLinkUpPtr | references the value to set to indicate the link status. XLlTemac_GetRgmiiStatus sets IsLinkUpPtr to TRUE when the RGMII link up. Otherwise, XLlTemac_GetRgmiiStatus sets IsLinkUpPtr to FALSE. |
- Returns:
- On successful completion, XLlTemac_GetRgmiiStatus returns XST_SUCCESS. Otherwise, if TEMAC channel is not using an RGMII interface, XLlTemac_GetRgmiiStatus returns XST_NO_FEATURE.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_GetSgmiiStatus |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 * |
SpeedPtr |
|
) |
|
|
|
XLlTemac_GetSgmiiStatus get the state of the link when using the SGMII media interface.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| SpeedPtr | references the location to store the result, which is the autonegotiated link speed in units of Mbits/sec, either 0, 10, 100, or 1000. |
- Returns:
- On successful completion, XLlTemac_GetSgmiiStatus returns XST_SUCCESS. Otherwise, if TEMAC channel is not using an SGMII interface, XLlTemac_GetSgmiiStatus returns XST_NO_FEATURE.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
void XLlTemac_GetTpid |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 * |
TpidPtr, |
|
|
u8 |
Entry |
|
) |
|
|
|
XLlTemac_GetTpid gets the VLAN Tag Protocol Identifier value (TPID).
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| TpidPtr | references the location to store the result. |
| Entry | is the hardware storage location to program this address and must be between 0..XTE_TPID_MAX_ENTRIES. |
- Returns:
- N/A.
- Note:
|
void XLlTemac_GetVidTable |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Entry, |
|
|
u32 * |
VidPtr, |
|
|
u8 * |
StripPtr, |
|
|
u8 * |
TagPtr, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_GetVidTable gets VID table content includes new VLAN ID, strip and tag enable bits.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Entry | is the hardware storage location/index to program updated VID value, strip, or tag value. must be between 0..0xFFF. |
| VidPtr | references the location to store the result. It has Vid value indexed by Entry. |
| StripPtr | references the location to store the result. It is strip enable bit value indexed by Entry. |
| TagPtr | references the location to store the result. It is tag enable bit value indexed by Entry. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- N/A.
- Note:
In BRAM, hardware requires table to be 'indexed' with Entry and must be 0x000..0xFFF.
Bits layout is bbbb bbbb bbbb b b VLAN ID (12b), | | | VLAN double tag enable bit VLAN strip enable bit |
void XLlTemac_GetVStripMode |
( |
XLlTemac * |
InstancePtr, |
|
|
u8 * |
ModePtr, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_GetVStripMode configures the VLAN stripping mode.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| ModePtr | references the location to store the result. It is the VLAN strip mode. Value is b'00, b'01 or b'11. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- N/A.
- Note:
Three modes are supported, XTE_VSTRP_NONE - no stripping. XTE_VSTRP_ALL - strip one tag from all frames. XTE_VSTRP_SELECT - strip one tag from selected already tagged frames based on VID value.
The third mode(XTE_VSTRP_SELECT) requires a method for specifying which tagged frames should be stripped. The VLAN translation table 'stripped enabled' is referenced. That configuration is handled in XLlTemac_SetVidTable().
Mode value shifting is handled in this function. No shifting is required to call this function. |
void XLlTemac_GetVTagMode |
( |
XLlTemac * |
InstancePtr, |
|
|
u8 * |
ModePtr, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_GetVTagMode gets VLAN tagging mode.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| ModePtr | references the location to store the result. It is the VLAN tag mode. Value is between b'00-b'11. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- N/A.
- Note:
Mode value shifting is handled in this function. No shifting is required to call this function. |
void XLlTemac_GetVTagValue |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 * |
VTagValuePtr, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_GetVTagValue gets the configured VLAN tagging value.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| VTagValuePtr | references the location to store the result. Format is, TPID, one of the following 16 bit values, 0x8100, 0x88a8, 0x9100, 0x9200. Priority, 3 bits CFI, 1 bit VID, 12 bits |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- N/A.
- Note:
Ethernet VLAN frames' VLAN type/length(2B) and tag control information(2B). Bit layout : bbbb bbbb bbbb bbbb bbb b bbbb bbbb bbbb \ / | | \ VID (12b) / \ / | CFI bit (1b) TPID (16b) priority bit (3b) |
|
XLlTemac_LookupConfig returns a reference to an XLlTemac_Config structure based on the unique device id, DeviceId. The return value will refer to an entry in the device configuration table defined in the xlltemac_g.c file.
- Parameters:
-
| DeviceId | is the unique device ID of the device for the lookup operation. |
- Returns:
- XLlTemac_LookupConfig returns a reference to a config record in the configuration table (in xlltemac_g.c) corresponding to DeviceId, or NULL if no match is found.
|
int XLlTemac_MulticastAdd |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr, |
|
|
int |
Entry |
|
) |
|
|
|
XLlTemac_MulticastAdd adds the Ethernet address, AddressPtr to the TEMAC channel's multicast filter list, at list index Entry. The address referenced by AddressPtr may be of any unicast, multicast, or broadcast address form. The harware for the TEMAC channel can hold up to XTE_MULTI_MAT_ENTRIES addresses in this filter list.
The device must be stopped to use this function.
Once an Ethernet address is programmed, the TEMAC channel will begin receiving data sent from that address. The TEMAC hardware does not have a control bit to disable multicast filtering. The only way to prevent the TEMAC channel from receiving messages from an Ethernet address in the Multicast Address Table (MAT) is to clear it with XLlTemac_MulticastClear().
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | is a pointer to the 6-byte Ethernet address to set. The previous address at the location Entry (if any) is overwritten with the value at AddressPtr. |
| Entry | is the hardware storage location to program this address and must be between 0..XTE_MULTI_MAT_ENTRIES-1. |
- Returns:
- On successful completion, XLlTemac_MulticastAdd returns XST_SUCCESS. Otherwise, if the TEMAC channel is not stopped, XLlTemac_MulticastAdd returns XST_DEVICE_IS_STARTED.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr.
This routine works only with XTE_MULTICAST_OPTION that supports up to XTE_MULTI_MAT_ENTRIES. To use extended multicast feature (XTE_EXT_MULTICAST_OPTION), please enable extended multicast in hardware build and use XLlTemac_[Add|Clear|Get]ExtMulticastGroup() to manage multicast addresses. |
int XLlTemac_MulticastClear |
( |
XLlTemac * |
InstancePtr, |
|
|
int |
Entry |
|
) |
|
|
|
XLlTemac_MulticastClear clears the Ethernet address stored at index Entry in the TEMAC channel's multicast filter list.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Entry | is the HW storage location used when this address was added. It must be between 0..XTE_MULTI_MAT_ENTRIES-1. |
| Entry | is the hardware storage location to clear and must be between 0..XTE_MULTI_MAT_ENTRIES-1. |
- Returns:
- On successful completion, XLlTemac_MulticastClear returns XST_SUCCESS. Otherwise, if the TEMAC channel is not stopped, XLlTemac_MulticastClear returns XST_DEVICE_IS_STARTED.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr.
This routine works only with XTE_MULTICAST_OPTION that supports up to XTE_MULTI_MAT_ENTRIES. To use extended multicast feature (XTE_EXT_MULTICAST_OPTION), please enable extended multicast in hardware build and use XLlTemac_[Add|Clear|Get]ExtMulticastGroup() to manage multicast addresses. |
void XLlTemac_MulticastGet |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr, |
|
|
int |
Entry |
|
) |
|
|
|
XLlTemac_MulticastGet gets the Ethernet address stored at index Entry in the TEMAC channel's multicast filter list.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | references the memory buffer to store the retrieved Ethernet address. This memory buffer must be at least 6 bytes in length. |
| Entry | is the hardware storage location from which to retrieve the address and must be between 0..XTE_MULTI_MAT_ENTRIES-1. |
- Returns:
- N/A
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driver.
This routine works only with XTE_MULTICAST_OPTION that supports up to XTE_MULTI_MAT_ENTRIES. To use extended multicast feature (XTE_EXT_MULTICAST_OPTION), please enable extended multicast in hardware build and use XLlTemac_[Add|Clear|Get]ExtMulticastGroup() to manage multicast addresses. |
void XLlTemac_PhySetMdioDivisor |
( |
XLlTemac * |
InstancePtr, |
|
|
u8 |
Divisor |
|
) |
|
|
|
XLlTemac_PhySetMdioDivisor sets the MDIO clock divisor in the TEMAC channel, specified by InstancePtr to the value, Divisor. This function must be called once after each reset prior to accessing MII PHY registers.
From the Virtex-4 Embedded Tri-Mode Ethernet MAC User's Guide, the following equation governs the MDIO clock to the PHY:
f[HOSTCLK]
f[MDC] = -----------------
(1 + Divisor) * 2
where f[HOSTCLK] is the bus clock frequency in MHz, and f[MDC] is the MDIO clock frequency in MHz to the PHY. Typically, f[MDC] should not exceed 2.5 MHz. Some PHYs can tolerate faster speeds which means faster access.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Divisor | is the divisor value to set within the range of 0 to XTE_MC_CLK_DVD_MAX. |
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
void XLlTemac_Reset |
( |
XLlTemac * |
InstancePtr, |
|
|
int |
HardCoreAction |
|
) |
|
|
|
XLlTemac_Reset performs a reset of the TEMAC channel, specified by InstancePtr, or both channels if HardCoreAction is set to XTE_RESET_HARD.
XLlTemac_Reset also resets the TEMAC channel's options to their default values.
The calling software is responsible for re-configuring the TEMAC channel (if necessary) and restarting the MAC after the reset.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| HardCoreAction | describes how XLlTemac_Reset should treat the hard core block of the TEMAC.
|
If XTE_RESET_HARD is set to XTE_RESET_HARD, then XLlTemac_Reset asserts the reset signal to the hard core block which will reset both channels of the TEMAC. This, of course, will bork any activity that may be occuring on the other channel. So, be careful here.
Otherwise, XLlTemac_Reset resets just the transmitter and receiver of this TEMAC channel.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_SendPausePacket |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 |
PauseValue |
|
) |
|
|
|
XLlTemac_SendPausePacket sends a pause packet with the value of PauseValue.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| PauseValue | is the pause value in units of 512 bit times. |
- Returns:
- On successful completion, XLlTemac_SendPausePacket returns XST_SUCCESS. Otherwise, if the TEMAC channel is not started, XLlTemac_SendPausePacket returns XST_DEVICE_IS_STOPPED.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_SetMacAddress |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_SetMacAddress sets the MAC address for the TEMAC channel, specified by InstancePtr to the MAC address specified by AddressPtr. The TEMAC channel must be stopped before calling this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | is a reference to the 6-byte MAC address to set. |
- Returns:
- On successful completion, XLlTemac_SetMacAddress returns XST_SUCCESS. Otherwise, if the TEMAC channel has not stopped, XLlTemac_SetMacAddress returns XST_DEVICE_IS_STARTED.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driver. This routine also supports the extended/new VLAN and multicast mode. The XTE_RAF_NEWFNCENBL_MASK bit dictats which offset will be configured. |
int XLlTemac_SetMacPauseAddress |
( |
XLlTemac * |
InstancePtr, |
|
|
void * |
AddressPtr |
|
) |
|
|
|
XLlTemac_SetMacPauseAddress sets the MAC address used for pause frames to AddressPtr. AddressPtr will be the address the TEMAC channel will recognize as being for pause frames. Pause frames transmitted with XLlTemac_SendPausePacket() will also use this address.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| AddressPtr | is a pointer to the 6-byte Ethernet address to set. |
- Returns:
- On successful completion, XLlTemac_SetMacPauseAddress returns XST_SUCCESS. Otherwise, if the TEMAC channel is not stopped, XLlTemac_SetMacPauseAddress returns XST_DEVICE_IS_STARTED.
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
void XLlTemac_SetOperatingSpeed |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 |
Speed |
|
) |
|
|
|
XLlTemac_SetOperatingSpeed sets the current operating link speed. For any traffic to be passed, this speed must match the current MII/GMII/SGMII/RGMII link speed.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Speed | is the speed to set in units of Mbps. Valid values are 10, 100, or 1000. XLlTemac_SetOperatingSpeed ignores invalid values. |
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_SetOptions |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Options |
|
) |
|
|
|
XLlTemac_SetOptions enables the options, Options for the TEMAC channel, specified by InstancePtr. The TEMAC channel should be stopped with XLlTemac_Stop() before changing options.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Options | is a bitmask of OR'd XTE_*_OPTION values for options to set. Options not specified are not affected. |
- Returns:
- On successful completion, XLlTemac_SetOptions returns XST_SUCCESS. Otherwise, if the device has not been stopped, XLlTemac_SetOptions returns XST_DEVICE_IS_STARTED.
- Note:
- See xlltemac.h for a description of the available options.
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
int XLlTemac_SetTpid |
( |
XLlTemac * |
InstancePtr, |
|
|
u16 |
Tpid, |
|
|
u8 |
Entry |
|
) |
|
|
|
XLlTemac_SetTpid sets the VLAN Tag Protocol Identifier(TPID).
The device must be stopped to use this function.
Four values can be configured, 0x8100, 0x9100, 0x9200, 0x88A8.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Tpid | is a hex value to be added to the TPID table. |
| Entry | is the hardware storage location to program this address and must be between 0..XTE_TPID_MAX_ENTRIES. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable or have the VLAN tag capability. 3. XST_INVALID_PARAM, if Tpid is not one of supported values.
- Note:
|
int XLlTemac_SetVidTable |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Entry, |
|
|
u32 |
Vid, |
|
|
u8 |
Strip, |
|
|
u8 |
Tag, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_SetVidTable sets VID table includes new VLAN ID, strip and tag enable bits.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Entry | is the hardware storage location/index to program updated VID value, strip, or tag value. must be between 0..0xFFF. |
| Vid | is updated/translated Vid value to be programmed. |
| Strip | is strip enable indication for Vid. |
| Tag | is tag enable indication for Vid. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable/have extended functionalities.
- Note:
In BRAM, hardware requires table to be 'indexed' with Entry and must be 0x000..0xFFF.
Bits layout is bbbb bbbb bbbb b b VLAN ID (12b), | | | VLAN double tag enable bit VLAN strip enable bit
To disable translation indexed by Entry, Set Vid = Entry. |
int XLlTemac_SetVStripMode |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Mode, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_SetVStripMode configures the VLAN strip mode.
The device must be stopped to use this function.
Three modes can be configured, XTE_VSTRP_NONE - no stripping. XTE_VSTRP_ALL - strip one tag from all frames. XTE_VSTRP_SELECT - strip one tag from selected already tagged frames based on VID value.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Mode | is the VLAN strip mode. Value must be b'00, b'01, or b'11. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable or have the TX VLAN strip capability. 3. XST_INVALID_PARAM, if Mode is not one of supported modes.
- Note:
The third mode requires a method for specifying which tagged frames should be stripped. The VLAN translation table 'stripped enabled' is referenced. That configuration is handled in XLlTemac_SetVidTable().
Mode value shifting is handled in this function. No shifting is required to call this function. |
int XLlTemac_SetVTagMode |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
Mode, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_SetVTagMode configures the VLAN tagging mode.
The device must be stopped to use this function.
Four modes can be configured, XTE_VTAG_NONE - no tagging. XTE_VTAG_ALL - tag all frames. XTE_VTAG_EXISTED - tag already tagged frames. XTE_VTAG_SELECT - tag selected already tagged frames based on VID value.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| Mode | is the VLAN tag mode. Value must be between b'00-b'11. |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable or have the TX VLAN tag capability. 3. XST_INVALID_PARAM, if Mode is not one of supported modes.
- Note:
The fourth mode requires a method for specifying which tagged frames should receive an additional VLAN tag. The VLAN translation table 'tag enabled' is referenced. That configuration is handled in XLlTemac_SetVidTable().
Mode value shifting is handled in this function. No shifting is required to call this function. |
int XLlTemac_SetVTagValue |
( |
XLlTemac * |
InstancePtr, |
|
|
u32 |
VTagValue, |
|
|
int |
Dir |
|
) |
|
|
|
XLlTemac_SetVTagValue configures the VLAN tagging value.
The device must be stopped to use this function.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
| VTagValue | is the VLAN tag value to be configured. A 32bit value. TPID, one of the following 16 bit values, 0x8100, 0x88a8, 0x9100, 0x9200. Priority, 3 bits CFI, 1 bit VID, 12 bits |
| Dir | must be either XTE_TX or XTE_RX. |
- Returns:
- On successful completion, returns XST_SUCCESS. Otherwise, returns 1. XST_DEVICE_IS_STARTED, if the TEMAC channel is not stopped. 2. XST_NO_FEATURE, if the TEMAC does not enable/have TX VLAN tag capability. 3. XST_INVALID_PARAM, if the TPID is not one the four supported values.
- Note:
The four supported TPID values are 0x8100, 0x88a8, 0x9100, 0x9200. XLlTemac_SetVTagValue performs verification on TPID only.
Ethernet VLAN frames' VLAN type/length(2B) and tag control information(2B). Bit layout : bbbb bbbb bbbb bbbb bbb b bbbb bbbb bbbb \ / | | \ VID (12b) / \ / | CFI bit (1b) TPID (16b) priority bit (3b) |
void XLlTemac_Start |
( |
XLlTemac * |
InstancePtr |
) |
|
|
|
XLlTemac_Start starts the TEMAC channel as follows:
- Enable transmitter if XTE_TRANSMIT_ENABLE_OPTION is set
- Enable receiver if XTE_RECEIVER_ENABLE_OPTION is set
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- N/A
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
void XLlTemac_Stop |
( |
XLlTemac * |
InstancePtr |
) |
|
|
|
XLlTemac_Stop gracefully stops the TEMAC channel as follows:
- Disable all interrupts from this device
- Disable the receiver
XLlTemac_Stop does not modify any of the current device options.
Since the transmitter is not disabled, frames currently in internal buffers or in process by a DMA engine are allowed to be transmitted.
- Parameters:
-
| InstancePtr | references the TEMAC channel on which to operate. |
- Returns:
- N/A
- Note:
This routine accesses the hard TEMAC registers through a shared interface between both channels of the TEMAC. Becuase of this, the application/OS code must provide mutual exclusive access to this routine with any of the other routines in this TEMAC driverr. |
Copyright © 1995-2009 Xilinx, Inc. All rights reserved.