emaclite: xemaclite_intr_example.c File Reference

| emaclite Xilinx SDK Drivers API Documentation

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

Functions
xemaclite_intr_example.c File Reference

## Overview

This file contains an example for using the EmacLite hardware and driver.

This file contains an interrupt example outlining the use of interrupts and callbacks in the transmission/reception of an Ethernet frame of 1000 bytes of payload.

If the MDIO interface is NOT configured in the EmacLite core then this example will transmit a frame. If the MDIO interface is configured in the EmacLite core then this example will enable the MAC loopback in the PHY device, then transmit the frame and compare the received frame.

Note

None

    MODIFICATION HISTORY:

    Ver   Who  Date     Changes

    1.01a ecm  05/21/04 First release
    1.01a sv   06/06/05 Minor changes to comply to Doxygen and coding guidelines
    1.01a sv   06/06/06 Minor changes for supporting Test App Interrupt examples
    2.00a ktn  02/25/09 Updated to use PHY loop back if MDIO is configured in
                  core
    3.00a ktn  10/22/09 Updated the example to use the HAL APIs/macros.
                  Updated example to use the macros that have been changed
                  in the driver to remove _m from the name of the macro.
    3.01a ktn  07/08/10 Updated example to support Little Endian MicroBlaze.
    4.2  adk   29/02/16 Updated example to support Zynq and ZynqMP.
    4.3   ms   01/23/17 Added xil_printf statement in main function to
                        ensure that "Successfully ran" and "Failed" strings
                        are available in all examples. This is a fix for
                        CR-965028.

## Functions
int | EmacLiteIntrExample (INTC *IntcInstancePtr, XEmacLite *EmacLiteInstPtr, u16 EmacLiteDeviceId, u16 EmacLiteIntrId)
| The main entry point for the EmacLite driver example in interrupt mode. More...
int | main ()
| This function is the main function of the EmacLite interrupt example. More...

## Function Documentation

int EmacLiteIntrExample | ( | INTC * | IntcInstancePtr,
|  | XEmacLite * | EmacLiteInstPtr,
|  | u16 | EmacLiteDeviceId,
|  | u16 | EmacLiteIntrId
| ) |  |

The main entry point for the EmacLite driver example in interrupt mode.

This function will transmit/receive the Ethernet frames and verify the data in the received frame (if the MDIO interface is configured in the EmacLite core). This function simply transmits a frame if the MDIO interface is not configured in the EmacLite core.

Parameters

  IntcInstancePtr | is a pointer to the instance of the Intc.
  EmacLiteInstPtr | is a pointer to the instance of the EmacLite.
  EmacLiteDeviceId | is device ID of the XEmacLite Device , typically XPAR_<EMACLITE_instance>_DEVICE_ID value from xparameters.h.
  EmacLiteIntrId | is the interrupt ID and is typically XPAR_<INTC_instance>_<EMACLITE_instance>_VEC_ID value from xparameters.h.

Returns
  XST_SUCCESS if successful, otherwise XST_FAILURE.

Note
  None.

References XEmacLite_Config::BaseAddress, EmacLiteDisablePhyLoopBack(), EmacLiteEnablePhyLoopBack(), EmacLitePhyDetect(), XEmacLite_CfgInitialize(), XEmacLite_DisableInterrupts(), XEmacLite_EnableInterrupts(), XEmacLite_FlushReceive(), XEmacLite_IsMdioConfigured, XEmacLite_LookupConfig(), XEmacLite_SetMacAddress(), XEmacLite_SetRecvHandler(), XEmacLite_SetSendHandler(), and XEmacLite_TxBufferAvailable().

Referenced by main().

int main | ( | void |  | ) |

This function is the main function of the EmacLite interrupt example.

Parameters

  None. |

Returns
  XST_SUCCESS if successful, otherwise XST_FAILURE.

Note
  None.

References EmacLiteIntrExample().