### Xilinx Processor IP Library

<hl>Software Drivers</hl>

Main Page | Data Structures | File List | Data Fields | Globals

# xlltemac_control.c File Reference

## Detailed Description

Functions in this file implement general purpose command and control related functionality. See xlltemac.h for a detailed description of the driver.

     MODIFICATION HISTORY:

     Ver   Who  Date     Changes
     ----- ---- -------- -------------------------------------------------------
     1.00a jvb  11/10/06 First release
     2.00a wsy  08/08/08 Added extended VLAN and multicast features

## Functions

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_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)
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)

## 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.

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_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_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.

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)

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.

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_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.

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)

Copyright © 1995-2009 Xilinx, Inc. All rights reserved.