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

xemaclite_l.h File Reference


Detailed Description

This header file contains identifiers and basic driver functions and macros that can be used to access the Xilinx Ethernet Lite 10/100 MAC (EmacLite).

Refer to xemaclite.h for more details.

Note:
The functions and macros in this file assume that the proper device address is provided in the argument. If the ping buffer is the source or destination, the argument should be DeviceAddress + XEL_(T/R)XBUFF_OFFSET. If the pong buffer is the source or destination, the argument should be DeviceAddress + XEL_(T/R)XBUFF_OFFSET + XEL_BUFFER_OFFSET. The driver does not take the different buffers into consideration. For more details on the ping/pong buffer configuration please refer to the Ethernet Lite 10/100 Media Access Controller hardware specification.

 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- -----------------------------------------------
 1.00a ecm  06/01/02 First release
 1.01a ecm  03/31/04 Additional functionality and the _AlignedRead and
                     AlignedWrite functions.
                     Moved the bulk of description to xemaclite.h
 1.11a mta  03/21/07 Updated to new coding style
 2.00a ktn  02/16/09 Added support for MDIO and internal loop back
 


Defines

#define XEL_TXBUFF_OFFSET
#define XEL_MDIOADDR_OFFSET
#define XEL_MDIOWR_OFFSET
#define XEL_MDIORD_OFFSET
#define XEL_MDIOCNTR_OFFSET
#define XEL_GIER_OFFSET
#define XEL_TSR_OFFSET
#define XEL_TPLR_OFFSET
#define XEL_RXBUFF_OFFSET
#define XEL_RSR_OFFSET
#define XEL_RPLR_OFFSET
#define XEL_MAC_HI_OFFSET
#define XEL_MAC_LO_OFFSET
#define XEL_BUFFER_OFFSET
#define XEL_MDIO_ADDRESS_MASK
#define XEL_MDIO_ADDRESS_SHIFT
#define XEL_MDIO_OP_MASK
#define XEL_MDIOCNTR_STATUS_MASK
#define XEL_MDIOCNTR_ENABLE_MASK
#define XEL_GIER_GIE_MASK
#define XEL_TSR_XMIT_BUSY_MASK
#define XEL_TSR_PROGRAM_MASK
#define XEL_TSR_XMIT_IE_MASK
#define XEL_TSR_LOOPBACK_MASK
#define XEL_TSR_XMIT_ACTIVE_MASK
#define XEL_TSR_PROG_MAC_ADDR
#define XEL_RSR_RECV_DONE_MASK
#define XEL_RSR_RECV_IE_MASK
#define XEL_TPLR_LENGTH_MASK_HI
#define XEL_TPLR_LENGTH_MASK_LO
#define XEL_RPLR_LENGTH_MASK_HI
#define XEL_RPLR_LENGTH_MASK_LO
#define XEL_HEADER_SIZE
#define XEL_MTU_SIZE
#define XEL_FCS_SIZE
#define XEL_HEADER_OFFSET
#define XEL_HEADER_SHIFT
#define XEL_MAX_FRAME_SIZE
#define XEL_MAX_TX_FRAME_SIZE
#define XEL_MAC_ADDR_SIZE
#define XEL_ETHER_PROTO_TYPE_IP
#define XEL_ETHER_PROTO_TYPE_ARP
#define XEL_ETHER_PROTO_TYPE_VLAN
#define XEL_ARP_PACKET_SIZE
#define XEL_HEADER_IP_LENGTH_OFFSET
#define XEL_VLAN_TAG_SIZE
#define XEmacLite_mReadReg(BaseAddress, RegOffset)
#define XEmacLite_mWriteReg(BaseAddress, RegOffset, RegisterValue)
#define XEmacLite_mGetTxStatus(BaseAddress)
#define XEmacLite_mSetTxStatus(BaseAddress, Data)
#define XEmacLite_mGetRxStatus(BaseAddress)
#define XEmacLite_mSetRxStatus(BaseAddress, Data)
#define XEmacLite_mIsTxDone(BaseAddress)
#define XEmacLite_mIsRxEmpty(BaseAddress)

Functions

void XEmacLite_SendFrame (u32 BaseAddress, u8 *FramePtr, unsigned ByteCount)
u16 XEmacLite_RecvFrame (u32 BaseAddress, u8 *FramePtr)


Define Documentation

#define XEL_ARP_PACKET_SIZE
 

Max ARP packet size

#define XEL_BUFFER_OFFSET
 

Next buffer's offset same for both TX and RX

#define XEL_ETHER_PROTO_TYPE_ARP
 

ARP Protocol

#define XEL_ETHER_PROTO_TYPE_IP
 

IP Protocol

#define XEL_ETHER_PROTO_TYPE_VLAN
 

VLAN Tagged

#define XEL_FCS_SIZE
 

Size of CRC

#define XEL_GIER_GIE_MASK
 

Global Enable

#define XEL_GIER_OFFSET
 

Offset for the GIE Register

#define XEL_HEADER_IP_LENGTH_OFFSET
 

IP Length Offset

#define XEL_HEADER_OFFSET
 

Offset to length field

#define XEL_HEADER_SHIFT
 

Right shift value to align length

#define XEL_HEADER_SIZE
 

Size of header in bytes

#define XEL_MAC_ADDR_SIZE
 

length of MAC address

#define XEL_MAC_HI_OFFSET
 

MAC address hi offset

#define XEL_MAC_LO_OFFSET
 

MAC address lo offset

#define XEL_MAX_FRAME_SIZE
 

Max length of Rx frame used if length/type field contains the type (> 1500)

#define XEL_MAX_TX_FRAME_SIZE
 

Max length of Tx frame

#define XEL_MDIO_ADDRESS_MASK
 

PHY Address mask

#define XEL_MDIO_ADDRESS_SHIFT
 

PHY Address shift

#define XEL_MDIO_OP_MASK
 

PHY read access

#define XEL_MDIOADDR_OFFSET
 

MDIO Address offset register

#define XEL_MDIOCNTR_ENABLE_MASK
 

MDIO Enable

#define XEL_MDIOCNTR_OFFSET
 

MDIO Control Register offset

#define XEL_MDIOCNTR_STATUS_MASK
 

MDIO transfer in Progress

#define XEL_MDIORD_OFFSET
 

MDIO read data register offset

#define XEL_MDIOWR_OFFSET
 

MDIO write data register offset

#define XEL_MTU_SIZE
 

Max size of data in frame

#define XEL_RPLR_LENGTH_MASK_HI
 

Receive packet length upper byte

#define XEL_RPLR_LENGTH_MASK_LO
 

Receive packet length lower byte

#define XEL_RPLR_OFFSET
 

Rx packet length

#define XEL_RSR_OFFSET
 

Rx status

#define XEL_RSR_RECV_DONE_MASK
 

Recv complete

#define XEL_RSR_RECV_IE_MASK
 

Recv interrupt enable bit

#define XEL_RXBUFF_OFFSET
 

Receive Buffer

#define XEL_TPLR_LENGTH_MASK_HI
 

Transmit packet length upper byte

#define XEL_TPLR_LENGTH_MASK_LO
 

Transmit packet length lower byte

#define XEL_TPLR_OFFSET
 

Tx packet length

#define XEL_TSR_LOOPBACK_MASK
 

Loop back enable bit

#define XEL_TSR_OFFSET
 

Tx status

#define XEL_TSR_PROG_MAC_ADDR
 

define for programming the MAC address into the EmacLite

#define XEL_TSR_PROGRAM_MASK
 

Program the MAC address

#define XEL_TSR_XMIT_ACTIVE_MASK
 

Buffer is active, SW bit only. This is not documented in the HW spec

#define XEL_TSR_XMIT_BUSY_MASK
 

Xmit complete

#define XEL_TSR_XMIT_IE_MASK
 

Xmit interrupt enable bit

#define XEL_TXBUFF_OFFSET
 

Transmit Buffer

#define XEL_VLAN_TAG_SIZE
 

VLAN Tag Size

#define XEmacLite_mGetRxStatus BaseAddress   ) 
 

Get the Rx Status Register Contents.

Parameters:
BaseAddress is the base address of the device
Returns:
The contents of the Rx Status Register.
Note:
C-Style signature: u32 XEmacLite_mGetRxStatus(u32 BaseAddress)

#define XEmacLite_mGetTxStatus BaseAddress   ) 
 

Get the Tx Status Register Contents.

Parameters:
BaseAddress is the base address of the device
Returns:
The contents of the Tx Status Register.
Note:
C-Style signature: u32 XEmacLite_mGetTxStatus(u32 BaseAddress)

#define XEmacLite_mIsRxEmpty BaseAddress   ) 
 

Check to see if the receive is empty.

Parameters:
BaseAddress is the base address of the device
Returns:
TRUE if it is empty, or FALSE if it is not.
Note:
C-Style signature: int XEmacLite_mIsRxEmpty(u32 BaseAddress)

#define XEmacLite_mIsTxDone BaseAddress   ) 
 

Check to see if the transmission is complete.

Parameters:
BaseAddress is the base address of the device
Returns:
TRUE if it is done, or FALSE if it is not.
Note:
C-Style signature: int XEmacLite_mIsTxDone(u32 BaseAddress)

#define XEmacLite_mReadReg BaseAddress,
RegOffset   ) 
 

Read from the specified EmacLite device register.

Parameters:
BaseAddress contains the base address of the device.
RegOffset contains the offset from the 1st register of the device to select the specific register.
Returns:
The value read from the register.
Note:
C-Style signature: u32 XEmacLite_mReadReg(u32 BaseAddress, u32 RegOffset);

#define XEmacLite_mSetRxStatus BaseAddress,
Data   ) 
 

Set the Rx Status Register Contents.

Parameters:
BaseAddress is the base address of the device
Data is the value to be written to the Register.
Returns:
None.
Note:
C-Style signature: u32 XEmacLite_mSetRxStatus(u32 BaseAddress, u32 Data)

#define XEmacLite_mSetTxStatus BaseAddress,
Data   ) 
 

Set the Tx Status Register Contents.

Parameters:
BaseAddress is the base address of the device
Data is the value to be written to the Register.
Returns:
None.
Note:
C-Style signature: u32 XEmacLite_mSetTxStatus(u32 BaseAddress, u32 Data)

#define XEmacLite_mWriteReg BaseAddress,
RegOffset,
RegisterValue   ) 
 

Write to the specified EmacLite device register.

Parameters:
BaseAddress contains the base address of the device.
RegOffset contains the offset from the 1st register of the device to select the specific register.
RegisterValue is the value to be written to the register.
Returns:
None.
Note:
C-Style signature: void XEmacLite_mWriteReg(u32 BaseAddress, u32 RegOffset, u32 RegisterValue);


Function Documentation

u16 XEmacLite_RecvFrame u32  BaseAddress,
u8 *  FramePtr
 

Receive a frame. Wait for a frame to arrive.

Parameters:
BaseAddress is the base address of the device
FramePtr is a pointer to a buffer where the frame will be stored.
Returns:
The type/length field of the frame received. When the type/length field contains the type , XEL_MAX_FRAME_SIZE bytes will be copied out of the buffer and it is up to the higher layers to sort out the frame.

Note:
This function call is blocking in nature, i.e. it will wait until a frame arrives.

If the ping buffer is the source of the data, the argument should be DeviceAddress + XEL_RXBUFF_OFFSET. If the pong buffer is the source of the data, the argument should be DeviceAddress + XEL_RXBUFF_OFFSET + XEL_BUFFER_OFFSET. The function does not take the different buffers into consideration.

void XEmacLite_SendFrame u32  BaseAddress,
u8 *  FramePtr,
unsigned  ByteCount
 

Send an Ethernet frame. The size is the total frame size, including header. This function blocks waiting for the frame to be transmitted.

Parameters:
BaseAddress is the base address of the device
FramePtr is a pointer to frame
ByteCount is the size, in bytes, of the frame
Returns:
None.
Note:
This function call is blocking in nature, i.e. it will wait until the frame is transmitted. This function can hang and not exit if the hardware is not configured properly.

If the ping buffer is the destination of the data, the argument should be DeviceAddress + XEL_TXBUFF_OFFSET. If the pong buffer is the destination of the data, the argument should be DeviceAddress + XEL_TXBUFF_OFFSET + XEL_BUFFER_OFFSET. The function does not take the different buffers into consideration.