### Xilinx Processor IP Library

Software Drivers

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

# xemaclite_l.c File Reference

## Detailed Description

This file contains the minimal, polled functions to send and receive Ethernet frames.

Refer to xemaclite.h for more details.

     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.
     1.11a mta  03/21/07 Updated to new coding style
     2.01a ktn  07/20/09 Updated the XEmacLite_AlignedWrite and
                         XEmacLite_AlignedRead functions to use volatile
                         variables so that they are not optimized.

## Functions
void | XEmacLite_AlignedWrite (void *SrcPtr, u32 *DestPtr, unsigned ByteCount)
void | XEmacLite_AlignedRead (u32 *SrcPtr, void *DestPtr, unsigned ByteCount)
void | XEmacLite_SendFrame (u32 BaseAddress, u8 *FramePtr, unsigned ByteCount)
u16 | XEmacLite_RecvFrame (u32 BaseAddress, u8 *FramePtr)

## Function Documentation

void XEmacLite_AlignedRead | ( | u32 * | SrcPtr,
|  | void * | DestPtr,
|  | unsigned | ByteCount
| ) |

  | This function reads from a 32-bit aligned source address range and aligns the writes to the provided destination pointer alignment. Parameters:
  | SrcPtr | is a pointer to incoming data of 32-bit alignment.
  | DestPtr | is a pointer to outgoing data of any alignment.
  | ByteCount | is the number of bytes to read.
Returns: None. Note: None.

void XEmacLite_AlignedWrite | ( | void * | SrcPtr,
|  | u32 * | DestPtr,
|  | unsigned | ByteCount
| ) |

  | This function aligns the incoming data and writes it out to a 32-bit aligned destination address range. Parameters:
  | SrcPtr | is a pointer to incoming data of any alignment.
  | DestPtr | is a pointer to outgoing data of 32-bit alignment.
  | ByteCount | is the number of bytes to write.
Returns: None. Note: None.

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.

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