emaclite: xemaclite_example.h File Reference

| emaclite Xilinx SDK Drivers API Documentation

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

Functions
xemaclite_example.h File Reference

## Overview

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

This file along with xemaclite_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 EDK standalone BSP development environment. The readme file contains more information on build requirements needed by these examples.

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    2.00a ktn  04/13/09 First release
    3.03a bss  09/01/12 Moved the declarations of RecvFrameLength
                  TransmitComplete, EmacLiteInstance,
                  TxFrame[XEL_MAX_FRAME_SIZE], RxFrame[XEL_MAX_FRAME_SIZE];
                          to xemaclite_example_util.c for fixing C++ compilation
                  errors

## Functions
void | EmacLitePhyDelay (unsigned int Seconds)
| For PPC we use a usleep call, for Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary. More...
u32 | EmacLitePhyDetect (XEmacLite *InstancePtr)
| This function detects the PHY address by looking for successful MII status register contents (PHY register 1). More...
int | EmacLiteEnablePhyLoopBack (XEmacLite *InstancePtr, u32 PhyAddress)
| This function enables the MAC loopback on the PHY. More...
int | EmacLiteDisablePhyLoopBack (XEmacLite *InstancePtr, u32 PhyAddress)
| This function disables the MAC loopback on the PHY. More...

## Function Documentation

int EmacLiteDisablePhyLoopBack | ( | XEmacLite * | InstancePtr,
|  | u32 | PhyAddress
| ) |  |

This function disables the MAC loopback on the PHY.

Parameters

  InstancePtr | is the pointer to the instance of EmacLite driver.
  PhyAddress | is the address of the Phy device.

Returns
  - XST_SUCCESS if the loop back was disabled.
  - XST_FAILURE if the loop back was not disabled.

Note
  None.

References XEmacLite_PhyRead(), and XEmacLite_PhyWrite().

Referenced by EmacLiteIntrExample(), EmacLitePhyLoopbackExample(), and EmacLitePolledExample().

int EmacLiteEnablePhyLoopBack | ( | XEmacLite * | InstancePtr,
|  | u32 | PhyAddress
| ) |  |

This function enables the MAC loopback on the PHY.

Parameters

  InstancePtr | is the pointer to the instance of EmacLite driver.
  PhyAddress | is the address of the Phy device.

Returns
  - XST_SUCCESS if the loop back is enabled.
  - XST_FAILURE if the loop back was not enabled.

Note
  None.

References EmacLitePhyDelay(), and XEmacLite_PhyWrite().

Referenced by EmacLiteIntrExample(), EmacLitePhyLoopbackExample(), and EmacLitePolledExample().

void EmacLitePhyDelay | ( | unsigned int | Seconds | ) |

For PPC we use a usleep call, for Microblaze we use an assembly loop that is roughly the same regardless of optimization level, although caches and memory access time can make the delay vary.

Just keep in mind that after resetting or updating the PHY modes, the PHY typically needs time to recover.

Returns
  None

Note
  None

Referenced by EmacLiteEnablePhyLoopBack().

u32 EmacLitePhyDetect | ( | XEmacLite * | InstancePtr | ) |

This function detects the PHY address by looking for successful MII status register contents (PHY register 1).

It looks for a PHY that supports auto-negotiation and 10Mbps full-duplex and half-duplex. So, this code won't work for PHYs that don't support those features, but it's a bit more general purpose than matching a specific PHY manufacturer ID.

Note also that on some (older) Xilinx ML4xx boards, PHY address 0 does not properly respond to this query. But, since the default is 0 and assuming no other address responds, then it seems to work OK.

Parameters

  InstancePtr | is the pointer to the instance of EmacLite driver.

Returns
  The address of the PHY device detected (returns 0 if not detected).

Note
  The bit mask (0x1808) of the MII status register (PHY Register 1) used in this function are: 0x1000: 10Mbps full duplex support. 0x0800: 10Mbps half duplex support. 0x0008: Auto-negotiation support.

References XEmacLite_PhyRead().

Referenced by EmacLiteIntrExample(), EmacLitePhyLoopbackExample(), and EmacLitePolledExample().