embeddedsw/XilinxProcessorIPLib/drivers/emaclite/doc/html/api/xemaclite_8c.html

598 lines
29 KiB
HTML
Raw Normal View History

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>
xemaclite.c File Reference
</title>
<link href="$DriverApiDocsCssPath" rel="stylesheet" type="text/css">
</head>
<h3 class="PageHeader">Xilinx Processor IP Library</h3>
<hl>Software Drivers</hl>
<hr class="whs1">
<!-- Generated by Doxygen 1.4.5 -->
<div class="tabs">
<ul>
<li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li id="current"><a href="files.html"><span>Files</span></a></li>
</ul></div>
<div class="tabs">
<ul>
<li><a href="files.html"><span>File&nbsp;List</span></a></li>
<li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
</ul></div>
<h1>xemaclite.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
Functions in this file are the minimum required functions for the EmacLite driver. See xemaclite.h for a detailed description of the driver.<p>
<pre>
MODIFICATION HISTORY:</pre><p>
<pre> Ver Who Date Changes
----- ---- -------- --------------------------------------------------------
1.01a ecm 01/31/04 First release
1.11a mta 03/21/07 Updated to new coding style
1.11a ecm 05/18/07 Updated the TxBufferAvailable routine to look at both
the active and busy bits
1.13a sv 02/1/08 Updated the TxBufferAvailable routine to return
busy status properly
2.00a ktn 02/16/09 Added support for MDIO
2.01a ktn 07/20/09 Modified XEmacLite_Send function to use Ping buffers
Interrupt enable bit since this alone is used to enable
the interrupts for both Ping and Pong Buffers.
3.00a ktn 10/22/09 Updated driver to use the HAL APIs/macros.
The macros have been renamed to remove _m from the name.
3.01a ktn 07/08/10 The macro XEmacLite_GetReceiveDataLength is changed to
a static function.
Updated the XEmacLite_GetReceiveDataLength and
XEmacLite_Recv functions to support little endian
MicroBlaze.
3.02a sdm 07/22/11 Removed redundant code in XEmacLite_Recv functions for
CR617290
3.04a srt 04/13/13 Removed warnings (CR 705000).</pre><p>
<pre> </pre>
<p>
<code>#include &quot;xil_io.h&quot;</code><br>
<code>#include &quot;xenv.h&quot;</code><br>
<code>#include &quot;xemaclite.h&quot;</code><br>
<code>#include &quot;<a class="el" href="xemaclite__i_8h.html">xemaclite_i.h</a>&quot;</code><br>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#8404d668432990ac1ec211f73ebb4533">XEmacLite_CfgInitialize</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, <a class="el" href="struct_x_emac_lite___config.html">XEmacLite_Config</a> *EmacLiteConfigPtr, u32 EffectiveAddr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#5c3030f436cfae88c6716d3b20c039fb">XEmacLite_Send</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, u8 *FramePtr, unsigned ByteCount)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u16&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#27e0b8e0cc1c85aa58962f8e758c8d59">XEmacLite_Recv</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, u8 *FramePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#3aabf3269fc90ce70b5e7aa0446e30a9">XEmacLite_SetMacAddress</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, u8 *AddressPtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#e9ee0df0e4d0ecb3357225a72fd7faf9">StubHandler</a> (void *CallBackRef)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#451a425b8498ab1a670ab21f8a6fb3e6">XEmacLite_TxBufferAvailable</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#25ab3dfa2fb019cdd91d2fb8ca21c45d">XEmacLite_FlushReceive</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#7b90724118256b3e65d996ad111202a7">XEmacLite_PhyRead</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, u32 PhyAddress, u32 RegNum, u16 *PhyDataPtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#0cc8a1a7757a036a39ade3bdfd885885">XEmacLite_PhyWrite</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr, u32 PhyAddress, u32 RegNum, u16 PhyData)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#ae439aa187524fe619e0c3a6391a3bf8">XEmacLite_EnableLoopBack</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xemaclite_8c.html#1e7f25f99f392854db244270ea769235">XEmacLite_DisableLoopBack</a> (<a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *InstancePtr)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="e9ee0df0e4d0ecb3357225a72fd7faf9"></a><!-- doxytag: member="xemaclite.c::StubHandler" ref="e9ee0df0e4d0ecb3357225a72fd7faf9" args="(void *CallBackRef)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void StubHandler </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">void *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>CallBackRef</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
This is a stub for the send and receive callbacks. The stub is here in case the upper layers forget to set the handlers.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>CallBackRef</em>&nbsp;</td><td>is a pointer to the upper layer callback reference.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="8404d668432990ac1ec211f73ebb4533"></a><!-- doxytag: member="xemaclite.c::XEmacLite_CfgInitialize" ref="8404d668432990ac1ec211f73ebb4533" args="(XEmacLite *InstancePtr, XEmacLite_Config *EmacLiteConfigPtr, u32 EffectiveAddr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XEmacLite_CfgInitialize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap><a class="el" href="struct_x_emac_lite___config.html">XEmacLite_Config</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>EmacLiteConfigPtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u32&nbsp;</td>
<td class="mdname" nowrap> <em>EffectiveAddr</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Initialize a specific <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance/driver. The initialization entails:<ul>
<li>Initialize fields of the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance structure.</li></ul>
<p>
The driver defaults to polled mode operation.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is a pointer to the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>EmacLiteConfigPtr</em>&nbsp;</td><td>points to the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> device configuration structure. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>EffectiveAddr</em>&nbsp;</td><td>is the device base address in the virtual memory address space. If the address translation is not used then the physical address is passed. Unexpected errors may occur if the address mapping is changed after this function is invoked.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if initialization was successful.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>The initialization of the PHY device is not done in this function. The user needs to use XEmacLite_PhyRead and XEmacLite_PhyWrite functions to access the PHY device. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="1e7f25f99f392854db244270ea769235"></a><!-- doxytag: member="xemaclite.c::XEmacLite_DisableLoopBack" ref="1e7f25f99f392854db244270ea769235" args="(XEmacLite *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void XEmacLite_DisableLoopBack </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>InstancePtr</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Disable Internal loop back functionality.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="ae439aa187524fe619e0c3a6391a3bf8"></a><!-- doxytag: member="xemaclite.c::XEmacLite_EnableLoopBack" ref="ae439aa187524fe619e0c3a6391a3bf8" args="(XEmacLite *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void XEmacLite_EnableLoopBack </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>InstancePtr</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Enable Internal loop back functionality.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="25ab3dfa2fb019cdd91d2fb8ca21c45d"></a><!-- doxytag: member="xemaclite.c::XEmacLite_FlushReceive" ref="25ab3dfa2fb019cdd91d2fb8ca21c45d" args="(XEmacLite *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void XEmacLite_FlushReceive </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>InstancePtr</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Flush the Receive buffers. All data will be lost.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="7b90724118256b3e65d996ad111202a7"></a><!-- doxytag: member="xemaclite.c::XEmacLite_PhyRead" ref="7b90724118256b3e65d996ad111202a7" args="(XEmacLite *InstancePtr, u32 PhyAddress, u32 RegNum, u16 *PhyDataPtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XEmacLite_PhyRead </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u32&nbsp;</td>
<td class="mdname" nowrap> <em>PhyAddress</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u32&nbsp;</td>
<td class="mdname" nowrap> <em>RegNum</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u16 *&nbsp;</td>
<td class="mdname" nowrap> <em>PhyDataPtr</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Read the specified PHY register.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>PhyAddress</em>&nbsp;</td><td>is the address of the PHY device. The valid range is is from 0 to 31. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RegNum</em>&nbsp;</td><td>is the register number in the PHY device which is to be read. The valid range is is from 0 to 31. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>PhyDataPtr</em>&nbsp;</td><td>is a pointer to the data in which the data read from the PHY device is returned.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the data is read from the PHY.</li><li>XST_DEVICE_BUSY if MDIO is busy.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>This function waits for the completion of MDIO data transfer. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="0cc8a1a7757a036a39ade3bdfd885885"></a><!-- doxytag: member="xemaclite.c::XEmacLite_PhyWrite" ref="0cc8a1a7757a036a39ade3bdfd885885" args="(XEmacLite *InstancePtr, u32 PhyAddress, u32 RegNum, u16 PhyData)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XEmacLite_PhyWrite </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u32&nbsp;</td>
<td class="mdname" nowrap> <em>PhyAddress</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u32&nbsp;</td>
<td class="mdname" nowrap> <em>RegNum</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u16&nbsp;</td>
<td class="mdname" nowrap> <em>PhyData</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Write the given data to the specified register in the PHY device.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>PhyAddress</em>&nbsp;</td><td>is the address of the PHY device. The valid range is is from 0 to 31. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RegNum</em>&nbsp;</td><td>is the register number in the PHY device which is to be written. The valid range is is from 0 to 31. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>PhyData</em>&nbsp;</td><td>is the data to be written to the specified register in the PHY device.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the data is written to the PHY.</li><li>XST_DEVICE_BUSY if MDIO is busy.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>This function waits for the completion of MDIO data transfer. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="27e0b8e0cc1c85aa58962f8e758c8d59"></a><!-- doxytag: member="xemaclite.c::XEmacLite_Recv" ref="27e0b8e0cc1c85aa58962f8e758c8d59" args="(XEmacLite *InstancePtr, u8 *FramePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">u16 XEmacLite_Recv </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u8 *&nbsp;</td>
<td class="mdname" nowrap> <em>FramePtr</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Receive a frame. Intended to be called from the interrupt context or with a wrapper which waits for the receive frame to be available.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is a pointer to the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FramePtr</em>&nbsp;</td><td>is a pointer to a buffer where the frame will be stored. The buffer must be at least XEL_MAX_FRAME_SIZE bytes. For optimal performance, a 32-bit aligned buffer should be used but it is not required, the function will align the data if necessary.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd></dd></dl>
The type/length field of the frame received. When the type/length field contains the type, XEL_MAX_FRAME_SIZE bytes will be copied out of the buffer and it is up to the higher layers to sort out the frame. Function returns 0 if there is no data waiting in the receive buffer or the pong buffer if configured.<p>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
This function call is not blocking in nature, i.e. it will not wait until a frame arrives. </td>
</tr>
</table>
<a class="anchor" name="5c3030f436cfae88c6716d3b20c039fb"></a><!-- doxytag: member="xemaclite.c::XEmacLite_Send" ref="5c3030f436cfae88c6716d3b20c039fb" args="(XEmacLite *InstancePtr, u8 *FramePtr, unsigned ByteCount)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XEmacLite_Send </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u8 *&nbsp;</td>
<td class="mdname" nowrap> <em>FramePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>unsigned&nbsp;</td>
<td class="mdname" nowrap> <em>ByteCount</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Send an Ethernet frame. The ByteCount is the total frame size, including header.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is a pointer to the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FramePtr</em>&nbsp;</td><td>is a pointer to frame. For optimal performance, a 32-bit aligned buffer should be used but it is not required, the function will align the data if necessary. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ByteCount</em>&nbsp;</td><td>is the size, in bytes, of the frame</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if data was transmitted.</li><li>XST_FAILURE if buffer(s) was (were) full and no valid data was transmitted.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
This function call is not blocking in nature, i.e. it will not wait until the frame is transmitted. </td>
</tr>
</table>
<a class="anchor" name="3aabf3269fc90ce70b5e7aa0446e30a9"></a><!-- doxytag: member="xemaclite.c::XEmacLite_SetMacAddress" ref="3aabf3269fc90ce70b5e7aa0446e30a9" args="(XEmacLite *InstancePtr, u8 *AddressPtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">void XEmacLite_SetMacAddress </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="md" nowrap align="right"></td>
<td class="md"></td>
<td class="md" nowrap>u8 *&nbsp;</td>
<td class="mdname" nowrap> <em>AddressPtr</em></td>
</tr>
<tr>
<td class="md"></td>
<td class="md">)&nbsp;</td>
<td class="md" colspan="2"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Set the MAC address for this device. The address is a 48-bit value.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is a pointer to the <a class="el" href="struct_x_emac_lite.html">XEmacLite</a> instance. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>AddressPtr</em>&nbsp;</td><td>is a pointer to a 6-byte MAC address. the format of the MAC address is major octet to minor octet</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
<ul>
<li>TX must be idle and RX should be idle for deterministic results. It is recommended that this function should be called after the initialization and before transmission of any packets from the device.</li><li>Function will not return if hardware is absent or not functioning properly.</li><li>The MAC address can be programmed using any of the two transmit buffers (if configured). </li></ul>
</td>
</tr>
</table>
<a class="anchor" name="451a425b8498ab1a670ab21f8a6fb3e6"></a><!-- doxytag: member="xemaclite.c::XEmacLite_TxBufferAvailable" ref="451a425b8498ab1a670ab21f8a6fb3e6" args="(XEmacLite *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XEmacLite_TxBufferAvailable </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_emac_lite.html">XEmacLite</a> *&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>InstancePtr</em> </td>
<td class="md" valign="top">&nbsp;)&nbsp;</td>
<td class="md" nowrap></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
Determine if there is a transmit buffer available.<p>
<dl compact><dt><b>Parameters:</b></dt><dd>
<table border="0" cellspacing="2" cellpadding="0">
<tr><td valign="top"></td><td valign="top"><em>InstancePtr</em>&nbsp;</td><td>is the pointer to the instance of the driver to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>TRUE if there is a TX buffer available for data to be written</li><li>FALSE if Tx Buffer is not available.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.