| emacps Vitis Drivers API Documentation

- Overview
- Data Structures
- APIs
- File List
- Examples

Functions
xemacps_example.h File Reference

## Overview

Defines common data types, prototypes, and includes the proper headers for use with the EMACPS example code residing in this directory.

This file along with xemacps_example_util.c are utilized with the specific example code in the other source code files provided. These examples are designed to be compiled and utilized within the SDK standalone BSP development environment.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.00a wsy  01/10/10 First release
    1.01a asa  02/27/12 Hash define added for EMACPS_SLCR_DIV_MASK.
    1.05a asa  09/22/13 The EthernetFrame is made cache line aligned (32 bytes).
                                      Fix for CR #663885.
    3.0   hk   02/20/15 Increase array sizes to add support for jumbo frames.
    3.2   mus  02//16 Added support support to INTC controller
    3.3   kpc  12/09/16 Fixed issue when -O2 is enabled
    3.9   hk   01/23/19 Update versal emulation specific fixes.
               03/20/19 Fix alignment pragmas for IAR compiler.

## Functions
void | EmacPsUtilFrameHdrFormatMAC (EthernetFrame *FramePtr, char *DestAddr)
| Set the MAC addresses in the frame. More...
void | EmacPsUtilFrameHdrFormatType (EthernetFrame *FramePtr, u16 FrameType)
| Set the frame type for the specified frame. More...
void | EmacPsUtilFrameSetPayloadData (EthernetFrame *FramePtr, u32 PayloadSize)
| This function places a pattern in the payload section of a frame. More...
LONG | EmacPsUtilFrameVerify (EthernetFrame *CheckFrame, EthernetFrame *ActualFrame)
| This function verifies the frame data against a CheckFrame. More...
void | EmacPsUtilFrameMemClear (EthernetFrame *FramePtr)
| This function sets all bytes of a frame to 0. More...
void | EmacPsUtilstrncpy (char *Destination, const char *Source, u32 n)
| This function copies data from source to desitnation for n bytes. More...
void | EmacPsUtilErrorTrap (const char *Message)
| This function is called by example code when an error is detected. More...
void | EmacpsDelay (u32 delay)
| This function provides delays in seconds. More...

## Function Documentation

void EmacpsDelay | ( | u32 | delay | ) |

This function provides delays in seconds.

Parameters

  delay | in seconds

Returns
  None.

Note
  for microblaze the delay is not accurate and it need to tuned.

Referenced by EmacPsDmaIntrExample().

void EmacPsUtilErrorTrap | ( | const char * | Message | ) |

This function is called by example code when an error is detected.

It can be set as a breakpoint with a debugger or it can be used to print out the given message if there is a UART or STDIO device.

Parameters

  Message | is the text explaining the error

Returns
  None

Note
  None

Referenced by EmacPsDmaIntrExample(), EmacPsDmaSingleFrameIntrExample(), and main().

void EmacPsUtilFrameHdrFormatMAC | ( | EthernetFrame * | FramePtr,
|  | char * | DestAddr
| ) |  |

Set the MAC addresses in the frame.

Parameters

  FramePtr | is the pointer to the frame.
  DestAddr | is the Destination MAC address.

Returns
  None.

Note
  None.

Referenced by EmacPsDmaSingleFrameIntrExample().

void EmacPsUtilFrameHdrFormatType | ( | EthernetFrame * | FramePtr,
|  | u16 | FrameType
| ) |  |

Set the frame type for the specified frame.

Parameters

  FramePtr | is the pointer to the frame.
  FrameType | is the Type to set in frame.

Returns
  None.

Note
  None.

Referenced by EmacPsDmaSingleFrameIntrExample().

void EmacPsUtilFrameMemClear | ( | EthernetFrame * | FramePtr | ) |

This function sets all bytes of a frame to 0.

Parameters

  FramePtr | is a pointer to the frame itself.

Returns
  None.

Note
  None.

Referenced by EmacPsDmaSingleFrameIntrExample().

void EmacPsUtilFrameSetPayloadData | ( | EthernetFrame * | FramePtr,
|  | u32 | PayloadSize
| ) |  |

This function places a pattern in the payload section of a frame.

The pattern is a 8 bit incrementing series of numbers starting with 0. Once the pattern reaches 256, then the pattern changes to a 16 bit incrementing pattern:

      0, 1, 2, ... 254, 255, 00, 00, 00, 01, 00, 02, ...

Parameters

  FramePtr | is a pointer to the frame to change.
  PayloadSize | is the number of bytes in the payload that will be set.

Returns
  None.

Note
  None.

Referenced by EmacPsDmaSingleFrameIntrExample().

LONG EmacPsUtilFrameVerify | ( | EthernetFrame * | CheckFrame,
|  | EthernetFrame * | ActualFrame
| ) |  |

This function verifies the frame data against a CheckFrame.

Validation occurs by comparing the ActualFrame to the header of the CheckFrame. If the headers match, then the payload of ActualFrame is verified for the same pattern Util_FrameSetPayloadData() generates.

Parameters

  CheckFrame | is a pointer to a frame containing the 14 byte header that should be present in the ActualFrame parameter.
  ActualFrame | is a pointer to a frame to validate.

Returns
  XST_SUCCESS if successful, else XST_FAILURE.

Note
  None.

Referenced by EmacPsDmaSingleFrameIntrExample().

void EmacPsUtilstrncpy | ( | char * | Destination,
|  | const char * | Source,
|  | u32 | n
| ) |  |

This function copies data from source to desitnation for n bytes.

Parameters

  Destination | is the targeted string to copy to.
  Source | is the source string to copy from.
  n | is number of bytes to be copied.

Note
  This function is similar to strncpy(), however strncpy will stop either at null byte or n bytes is been copied. This function will copy n bytes without checking the content.