![]() |
emacps
Vitis Drivers API Documentation
|
This file implements the utility functions for the XEmacPs example code.
MODIFICATION HISTORY:
Ver Who Date Changes
1.00a wsy 01/10/10 First release 1.00a asa 01/24/12 A new version of EmacPsUtilEnterLoopback is used for Zynq boards. Now there are two versions of EmacPsUtilEnterLoopback, one for PEEP and one for Zynq. If the example is to be run on a PEEP board, define PEEP in xemacps_example.h. 1.01a asa 02/27/12 The sleep value after PHY loopback is setup is reduced for Zynq. 3.0 kpc 01/23/15 Removed PEEP board related code 3.2 hk 09/30/15 Added support for TI PHY DP83867 3.2 mus 02/20/16 Added support for microblaze. 3.9 hk 02/12/19 Use selected speed in loopback mode. 3.14 sk 12/23/20 Correct variable name to delay in EmacpsDelay() function to fix the doxygen warning.
Macros | |
#define | PHY_DETECT_REG1 2 |
This function detects the PHY address by looking for successful MII status register contents. More... | |
#define | PHY_REG0_RESET 0x8000 |
This function sets the PHY to loopback mode. More... | |
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 | EmacPsUtilEnterLocalLoopback (XEmacPs *EmacPsInstancePtr) |
This function sets the emacps to loopback mode. More... | |
void | EmacpsDelay (u32 delay) |
This function provides delays in seconds. More... | |
void | EmacPsUtilErrorTrap (const char *Message) |
This function is called by example code when an error is detected. More... | |
#define PHY_DETECT_REG1 2 |
This function detects the PHY address by looking for successful MII status register contents.
The | XEMACPS driver instance |
#define PHY_REG0_RESET 0x8000 |
This function sets the PHY to loopback mode.
The | XEMACPS driver instance |
Speed | is the loopback speed 10/100 Mbit. |
void EmacpsDelay | ( | u32 | delay | ) |
This function provides delays in seconds.
delay | in seconds |
Referenced by EmacPsDmaIntrExample().
void EmacPsUtilEnterLocalLoopback | ( | XEmacPs * | EmacPsInstancePtr | ) |
This function sets the emacps to loopback mode.
EmacPsInstancePtr | is the XEmacPs driver instance. |
References XEmacPs_Config::BaseAddress, XEMACPS_NWCTRL_LOOPEN_MASK, XEMACPS_NWCTRL_OFFSET, XEmacPs_ReadReg, and XEmacPs_WriteReg.
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.
Message | is the text explaining the error |
Referenced by EmacPsDmaIntrExample(), EmacPsDmaSingleFrameIntrExample(), and main().
void EmacPsUtilFrameHdrFormatMAC | ( | EthernetFrame * | FramePtr, |
char * | DestAddr | ||
) |
Set the MAC addresses in the frame.
FramePtr | is the pointer to the frame. |
DestAddr | is the Destination MAC address. |
Referenced by EmacPsDmaSingleFrameIntrExample().
void EmacPsUtilFrameHdrFormatType | ( | EthernetFrame * | FramePtr, |
u16 | FrameType | ||
) |
Set the frame type for the specified frame.
FramePtr | is the pointer to the frame. |
FrameType | is the Type to set in frame. |
Referenced by EmacPsDmaSingleFrameIntrExample().
void EmacPsUtilFrameMemClear | ( | EthernetFrame * | FramePtr | ) |
This function sets all bytes of a frame to 0.
FramePtr | is a pointer to the frame itself. |
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, ...
FramePtr | is a pointer to the frame to change. |
PayloadSize | is the number of bytes in the payload that will be set. |
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.
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. |
Referenced by EmacPsDmaSingleFrameIntrExample().
void EmacPsUtilstrncpy | ( | char * | Destination, |
const char * | Source, | ||
u32 | n | ||
) |
This function copies data from source to desitnation for n bytes.
Destination | is the targeted string to copy to. |
Source | is the source string to copy from. |
n | is number of bytes to be copied. |