Software Drivers

xemacps.c File Reference


Detailed Description

The XEmacPs driver. Functions in this file are the minimum required functions for this driver. See xemacps.h for a detailed description of the driver.

 MODIFICATION HISTORY:

 Ver   Who  Date     Changes
 ----- ---- -------- -------------------------------------------------------
 1.00a wsy  01/10/10 First release
 

#include "xemacps.h"

Functions

void XEmacPs_StubHandler (void)
int XEmacPs_CfgInitialize (XEmacPs *InstancePtr, XEmacPs_Config *CfgPtr, u32 EffectiveAddress)
void XEmacPs_Start (XEmacPs *InstancePtr)
void XEmacPs_Stop (XEmacPs *InstancePtr)
void XEmacPs_Reset (XEmacPs *InstancePtr)


Function Documentation

int XEmacPs_CfgInitialize ( XEmacPs InstancePtr,
XEmacPs_Config CfgPtr,
u32  EffectiveAddress 
)

Initialize a specific XEmacPs instance/driver. The initialization entails:

The PHY is setup independently from the device. Use the MII or whatever other interface may be present for setup.

Parameters:
InstancePtr is a pointer to the instance to be worked on.
CfgPtr is the device configuration structure containing required hardware build data.
EffectiveAddress is the base address of the device. If address translation is not utilized, this parameter can be passed in using CfgPtr->Config.BaseAddress to specify the physical base address.
Returns:
  • XST_SUCCESS if initialization was successful

void XEmacPs_Reset ( XEmacPs InstancePtr  ) 

Perform a graceful reset of the Ethernet MAC. Resets the DMA channels, the transmitter, and the receiver.

Steps to reset

All options are placed in their default state. Any frames in the descriptor lists will remain in the lists. The side effect of doing this is that after a reset and following a restart of the device, frames were in the list before the reset may be transmitted or received.

The upper layer software is responsible for re-configuring (if necessary) and restarting the MAC after the reset. Note also that driver statistics are not cleared on reset. It is up to the upper layer software to clear the statistics if needed.

When a reset is required, the driver notifies the upper layer software of this need through the ErrorHandler callback and specific status codes. The upper layer software is responsible for calling this Reset function and then re-configuring the device.

Parameters:
InstancePtr is a pointer to the instance to be worked on.

void XEmacPs_Start ( XEmacPs InstancePtr  ) 

Start the Ethernet controller as follows:

Parameters:
InstancePtr is a pointer to the instance to be worked on.
Returns:
N/A
Note:
Hardware is configured with scatter-gather DMA, the driver expects to start the scatter-gather channels and expects that the user has previously set up the buffer descriptor lists.
This function makes use of internal resources that are shared between the Start, Stop, and Set/ClearOptions functions. So if one task might be setting device options while another is trying to start the device, the user is required to provide protection of this shared data (typically using a semaphore).

This function must not be preempted by an interrupt that may service the device.

void XEmacPs_Stop ( XEmacPs InstancePtr  ) 

Gracefully stop the Ethernet MAC as follows:

Device options currently in effect are not changed.

This function will disable all interrupts. Default interrupts settings that had been enabled will be restored when XEmacPs_Start() is called.

Parameters:
InstancePtr is a pointer to the instance to be worked on.
Note:
This function makes use of internal resources that are shared between the Start, Stop, SetOptions, and ClearOptions functions. So if one task might be setting device options while another is trying to start the device, the user is required to provide protection of this shared data (typically using a semaphore).
Stopping the DMA channels causes this function to block until the DMA operation is complete.

void XEmacPs_StubHandler ( void   ) 

This is a stub for the asynchronous callbacks. The stub is here in case the upper layer forgot to set the handler(s). On initialization, all handlers are set to this callback. It is considered an error for this handler to be invoked.

Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.