embeddedsw/XilinxProcessorIPLib/drivers/can/doc/html/api/xcan_8c.html
Jagannadha Sutradharudu Teki 2c8f92039d embeddesw: Add initial code support
Added initial support Xilinx Embedded Software.

Signed-off-by: Jagannadha Sutradharudu Teki <jaganna@xilinx.com>
2014-06-24 16:45:01 +05:30

987 lines
52 KiB
HTML
Executable file

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>
xcan.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>xcan.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The <a class="el" href="struct_x_can.html">XCan</a> driver. Functions in this file are the minimum required functions for this driver. See xcan.h for a detailed description of the driver.<p>
<pre>
MODIFICATION HISTORY:</pre><p>
<pre> Ver Who Date Changes
----- ---- -------- -------------------------------------------------------
1.00a xd 04/12/05 First release
1.10a mta 05/13/07 Updated to new coding style
2.00a ktn 10/22/09 Updated to use the HAL APIs/macros.
The macros have been renamed to remove _m from the name in
all the driver files.
</pre>
<p>
<code>#include &quot;xil_types.h&quot;</code><br>
<code>#include &quot;xil_assert.h&quot;</code><br>
<code>#include &quot;xil_io.h&quot;</code><br>
<code>#include &quot;xenv.h&quot;</code><br>
<code>#include &quot;xcan.h&quot;</code><br>
<code>#include &quot;xparameters.h&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="xcan_8c.html#71132945b5d2f0a22c54c23a87be2415">XCan_Initialize</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u16 DeviceId)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#c7e9d7949a7ad31ff6fa96622e09d147">XCan_VmInitialize</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u16 DeviceId, u32 VirtAddr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#4e3c77247fec5c6e8eccfc36df711fd6">XCan_Reset</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u8&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#4fa70da33106e34dc984dd04d3074a70">XCan_GetMode</a> (<a class="el" href="struct_x_can.html">XCan</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="xcan_8c.html#3769b99994f2ccef99bd19203a565c11">XCan_EnterMode</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u8 OperationMode)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#12414be29a85876270781fc88e841976">XCan_GetStatus</a> (<a class="el" href="struct_x_can.html">XCan</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="xcan_8c.html#317099810a8dff8268430dd92b561c20">XCan_GetBusErrorCounter</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u8 *RxErrorCount, u8 *TxErrorCount)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#275218d602c31fb0f2b860c3ef5d4008">XCan_GetBusErrorStatus</a> (<a class="el" href="struct_x_can.html">XCan</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="xcan_8c.html#6b7a7da50e1711a0d474fe15db3035f1">XCan_ClearBusErrorStatus</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 Mask)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#9cb561530641046d8f0cdc70e99bde1d">XCan_Send</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 *FramePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#89ebe03a1da93b13bc75ecb8c6499ff0">XCan_Recv</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 *FramePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#9e06db4f0ad6a9a1accdb16e1b23e4ee">XCan_SendHighPriority</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 *FramePtr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#97dea5c40bd7dffa75086c65237b40a8">XCan_AcceptFilterEnable</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 FilterIndexes)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#3c6ef11316aaf911d70b061c9ecd3613">XCan_AcceptFilterDisable</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 FilterIndexes)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#10decfa407e642d9f3a77ef29af674bf">XCan_AcceptFilterGetEnabled</a> (<a class="el" href="struct_x_can.html">XCan</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="xcan_8c.html#8e2dea118523a03819c57b2b2d57a22e">XCan_AcceptFilterSet</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 FilterIndex, u32 MaskValue, u32 IdValue)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#2f40029067f3b988ae0522ab081343b0">XCan_AcceptFilterGet</a> (<a class="el" href="struct_x_can.html">XCan</a> *InstancePtr, u32 FilterIndex, u32 *MaskValue, u32 *IdValue)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct_x_can___config.html">XCan_Config</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#b8592fb5d337e8a1016dc93c1c2cb305">XCan_LookupConfig</a> (u16 DeviceId)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct_x_can___config.html">XCan_Config</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#484ef44ed2c8a5ca50ca7190d8ddae65">XCan_GetConfig</a> (unsigned int InstanceIndex)</td></tr>
<tr><td colspan="2"><br><h2>Variables</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="struct_x_can___config.html">XCan_Config</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xcan_8c.html#8b29ea2fb69df19e7bc942eef60947d5">XCan_ConfigTable</a> []</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="3c6ef11316aaf911d70b061c9ecd3613"></a><!-- doxytag: member="xcan.c::XCan_AcceptFilterDisable" ref="3c6ef11316aaf911d70b061c9ecd3613" args="(XCan *InstancePtr, u32 FilterIndexes)" --><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 XCan_AcceptFilterDisable </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>FilterIndexes</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>
This routine disables individual acceptance filters. Up to 4 filters could be disabled. If all acceptance filters are disabled then all received frames are stored in the RX FIFO.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FilterIndexes</em>&nbsp;</td><td>specifies which filter(s) to disable. Use any XCAN_AFR_UAF*_MASK to disable one filter, and "Or" multiple XCAN_AFR_UAF*_MASK values if multiple filters need to be disabled. Any filter not specified in this parameter will keep its previous enable/disable setting. If all acceptance filters are disabled then all received frames are stored in the RX FIFO.</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>
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure. </td>
</tr>
</table>
<a class="anchor" name="97dea5c40bd7dffa75086c65237b40a8"></a><!-- doxytag: member="xcan.c::XCan_AcceptFilterEnable" ref="97dea5c40bd7dffa75086c65237b40a8" args="(XCan *InstancePtr, u32 FilterIndexes)" --><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 XCan_AcceptFilterEnable </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>FilterIndexes</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>
This routine enables individual acceptance filters. Up to 4 filters could be enabled.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FilterIndexes</em>&nbsp;</td><td>specifies which filter(s) to enable. Use any XCAN_AFR_UAF*_MASK to enable one filter, and "Or" multiple XCAN_AFR_UAF*_MASK values if multiple filters need to be enabled. Any filter not specified in this parameter will keep its previous enable/disable setting.</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>
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure. </td>
</tr>
</table>
<a class="anchor" name="2f40029067f3b988ae0522ab081343b0"></a><!-- doxytag: member="xcan.c::XCan_AcceptFilterGet" ref="2f40029067f3b988ae0522ab081343b0" args="(XCan *InstancePtr, u32 FilterIndex, u32 *MaskValue, u32 *IdValue)" --><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 XCan_AcceptFilterGet </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>FilterIndex</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>MaskValue</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>IdValue</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>
This function reads the values of the Acceptance Filter Mask and ID Register for the specified Acceptance Filter. Use XCAN_IDR_* defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to interpret the values. Read xcan.h and device specification for details.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FilterIndex</em>&nbsp;</td><td>defines which Acceptance Filter Mask Register to get Mask and ID from. Use any single XCAN_FILTER_* value. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>MaskValue</em>&nbsp;</td><td>will store the Mask value read from the chosen Acceptance Filter Mask Register after this function returns. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>IdValue</em>&nbsp;</td><td>will store the ID value read from the chosen Acceptance Filter ID Register after this function returns.</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>
Acceptance Filter Mask and ID Registers are optional registers in Xilinx CAN device. If they are NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure. </td>
</tr>
</table>
<a class="anchor" name="10decfa407e642d9f3a77ef29af674bf"></a><!-- doxytag: member="xcan.c::XCan_AcceptFilterGetEnabled" ref="10decfa407e642d9f3a77ef29af674bf" args="(XCan *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">u32 XCan_AcceptFilterGetEnabled </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>
This function returns enabled acceptance filters. Use XCAN_AFR_UAF*_MASK defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to interpret the returned value. If no acceptance filters are enabled then all received frames are stored in the RX FIFO.<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_can.html">XCan</a> instance to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The value stored in Acceptance Filter Register.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
Acceptance Filter Register is an optional register in Xilinx CAN device. If it is NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure. </td>
</tr>
</table>
<a class="anchor" name="8e2dea118523a03819c57b2b2d57a22e"></a><!-- doxytag: member="xcan.c::XCan_AcceptFilterSet" ref="8e2dea118523a03819c57b2b2d57a22e" args="(XCan *InstancePtr, u32 FilterIndex, u32 MaskValue, u32 IdValue)" --><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 XCan_AcceptFilterSet </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>FilterIndex</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>MaskValue</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>IdValue</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>
This function sets values to the Acceptance Filter Mask Register (AFMR) and Acceptance Filter ID Register (AFIR) for the specified Acceptance Filter. Use XCAN_IDR_* defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to create the values to set the filter. Read xcan.h and device specification for details.<p>
This function should be called only after:<ul>
<li>The given filter is disabled by calling <a class="el" href="xcan_8c.html#3c6ef11316aaf911d70b061c9ecd3613">XCan_AcceptFilterDisable()</a>;</li><li>And the CAN device is ready to accept writes to AFMR and AFIR, i.e., XCan_IsAcceptFilterBusy() returns FALSE.</li></ul>
<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FilterIndex</em>&nbsp;</td><td>defines which Acceptance Filter Mask and ID Register to set. Use any single XCAN_AFR_UAF*_MASK value. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>MaskValue</em>&nbsp;</td><td>is the value to write to the chosen Acceptance Filter Mask Register. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>IdValue</em>&nbsp;</td><td>is the value to write to the chosen Acceptance Filter ID Register.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the values were set successfully.</li><li>XST_FAILURE if the given filter was not disabled, or the CAN device was not ready to accept writes to AFMR and AFIR.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
Acceptance Filter Mask and ID Registers are optional registers in Xilinx CAN device. If they are NOT existing in the device, this function should NOT be used. Calling this function in this case will cause an assertion failure. </td>
</tr>
</table>
<a class="anchor" name="6b7a7da50e1711a0d474fe15db3035f1"></a><!-- doxytag: member="xcan.c::XCan_ClearBusErrorStatus" ref="6b7a7da50e1711a0d474fe15db3035f1" args="(XCan *InstancePtr, u32 Mask)" --><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 XCan_ClearBusErrorStatus </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>Mask</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>
This function clears Error Status bit(s) previously set in Error Status Register (ESR). Use the XCAN_ESR_* constants defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to create the value to pass in. If a bit was cleared in Error Status Register before this function is called, it will not be touched.<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_can.html">XCan</a> instance to be worked on.</td></tr>
<tr><td valign="top"></td><td valign="top"><em>Mask</em>&nbsp;</td><td>is he 32-bit mask used to clear bits in Error Status Register. Multiple XCAN_ESR_* values could be 'OR'ed to clear multiple bits</td></tr>
</table>
</dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="3769b99994f2ccef99bd19203a565c11"></a><!-- doxytag: member="xcan.c::XCan_EnterMode" ref="3769b99994f2ccef99bd19203a565c11" args="(XCan *InstancePtr, u8 OperationMode)" --><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 XCan_EnterMode </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>OperationMode</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>
This function allows the CAN device to enter one of the following operation modes:<p>
<ul>
<li>Configuration Mode: Pass in parameter XCAN_MODE_CONFIG</li><li>Sleep Mode: Pass in parameter XCAN_MODE_SLEEP</li><li>Normal Mode: Pass in parameter XCAN_MODE_NORMAL</li><li>Loop Back Mode: Pass in parameter XCAN_MODE_LOOPBACK.</li></ul>
<p>
Read xcan.h and device specification for detailed description of each operation mode.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>OperationMode</em>&nbsp;</td><td>specify which operation mode to enter. Valid value is any of XCAN_MODE_* defined in xcan.h. Please note no multiple modes could be entered at the same time.</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>
This function does NOT ensure CAN device enters the specified operation mode before returns the control to the caller. The caller is responsible for checking current operation mode using <a class="el" href="xcan_8c.html#4fa70da33106e34dc984dd04d3074a70">XCan_GetMode()</a>. </td>
</tr>
</table>
<a class="anchor" name="317099810a8dff8268430dd92b561c20"></a><!-- doxytag: member="xcan.c::XCan_GetBusErrorCounter" ref="317099810a8dff8268430dd92b561c20" args="(XCan *InstancePtr, u8 *RxErrorCount, u8 *TxErrorCount)" --><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 XCan_GetBusErrorCounter </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>RxErrorCount</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>TxErrorCount</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>
This function reads Receive and Transmit error counters.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>RxErrorCount</em>&nbsp;</td><td>will contain Receive Error Counter value after this function returns. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>TxErrorCount</em>&nbsp;</td><td>will contain Transmit Error Counter value after this function returns.</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="275218d602c31fb0f2b860c3ef5d4008"></a><!-- doxytag: member="xcan.c::XCan_GetBusErrorStatus" ref="275218d602c31fb0f2b860c3ef5d4008" args="(XCan *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">u32 XCan_GetBusErrorStatus </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>
This function reads Error Status value from Error Status Register (ESR). Use the XCAN_ESR_* constants defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to interpret the returned 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_can.html">XCan</a> instance to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The 32-bit value read from Error Status Register.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="484ef44ed2c8a5ca50ca7190d8ddae65"></a><!-- doxytag: member="xcan.c::XCan_GetConfig" ref="484ef44ed2c8a5ca50ca7190d8ddae65" args="(unsigned int InstanceIndex)" --><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"><a class="el" href="struct_x_can___config.html">XCan_Config</a>* XCan_GetConfig </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">unsigned int&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>InstanceIndex</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 function looks for the device configuration based on the device index. The table XCan_ConfigTable[] contains the configuration information for each device in the system.<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>InstanceIndex</em>&nbsp;</td><td>is a 0-based integer indexing all CAN devices in the system.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="4fa70da33106e34dc984dd04d3074a70"></a><!-- doxytag: member="xcan.c::XCan_GetMode" ref="4fa70da33106e34dc984dd04d3074a70" args="(XCan *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">u8 XCan_GetMode </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>
This routine returns current operation mode the CAN device is in.<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_can.html">XCan</a> instance to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XCAN_MODE_CONFIG if the device is in Configuration Mode.</li><li>XCAN_MODE_SLEEP if the device is in Sleep Mode.</li><li>XCAN_MODE_NORMAL if the device is in Normal Mode.</li><li>XCAN_MODE_LOOPBACK if the device is in Loop Back Mode.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="12414be29a85876270781fc88e841976"></a><!-- doxytag: member="xcan.c::XCan_GetStatus" ref="12414be29a85876270781fc88e841976" args="(XCan *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">u32 XCan_GetStatus </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>
This function returns Status value from Status Register (SR). Use the XCAN_SR_* constants defined in <a class="el" href="xcan__l_8h.html">xcan_l.h</a> to interpret the returned 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_can.html">XCan</a> instance to be worked on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>The 32-bit value read from Status Register.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="71132945b5d2f0a22c54c23a87be2415"></a><!-- doxytag: member="xcan.c::XCan_Initialize" ref="71132945b5d2f0a22c54c23a87be2415" args="(XCan *InstancePtr, u16 DeviceId)" --><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 XCan_Initialize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>u16&nbsp;</td>
<td class="mdname" nowrap> <em>DeviceId</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>
This routine initializes a specific <a class="el" href="struct_x_can.html">XCan</a> instance/driver. This function should only be used when no Virtual Memory support is needed. To use virtual memory, the caller should invoke <a class="el" href="xcan_8c.html#c7e9d7949a7ad31ff6fa96622e09d147">XCan_VmInitialize()</a>. See the description of <a class="el" href="xcan_8c.html#c7e9d7949a7ad31ff6fa96622e09d147">XCan_VmInitialize()</a> for detailed information.<p>
This initialization entails:<ul>
<li>Search for device configuration given the device ID.</li><li>Initialize Base Address field of the <a class="el" href="struct_x_can.html">XCan</a> structure using the device address in the found device configuration.</li><li>Populate all other data fields in the <a class="el" href="struct_x_can.html">XCan</a> structure</li><li>Reset the device.</li></ul>
<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>DeviceId</em>&nbsp;</td><td>is the unique ID of the device controlled by this <a class="el" href="struct_x_can.html">XCan</a> instance. Passing in a device ID associates the generic <a class="el" href="struct_x_can.html">XCan</a> instance to a specific device, as chosen by the caller or application developer.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if initialization was successful</li><li>XST_DEVICE_NOT_FOUND if device configuration information was not found for a device with the supplied device ID.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="b8592fb5d337e8a1016dc93c1c2cb305"></a><!-- doxytag: member="xcan.c::XCan_LookupConfig" ref="b8592fb5d337e8a1016dc93c1c2cb305" args="(u16 DeviceId)" --><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"><a class="el" href="struct_x_can___config.html">XCan_Config</a>* XCan_LookupConfig </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">u16&nbsp;</td>
<td class="mdname1" valign="top" nowrap> <em>DeviceId</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 function looks for the device configuration based on the unique device ID. The table XCan_ConfigTable[] contains the configuration information for each device in the system.<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>DeviceId</em>&nbsp;</td><td>is the unique device ID of the device being looked up.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>A pointer to the configuration table entry corresponding to the given device ID, or NULL if no match is found.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="89ebe03a1da93b13bc75ecb8c6499ff0"></a><!-- doxytag: member="xcan.c::XCan_Recv" ref="89ebe03a1da93b13bc75ecb8c6499ff0" args="(XCan *InstancePtr, u32 *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">int XCan_Recv </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>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>
This function receives a CAN Frame. This function first checks if RX FIFO is empty, if not, it then reads a frame from the RX FIFO into the given buffer. This function returns error code immediately if there is no frame in the RX FIFO.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FramePtr</em>&nbsp;</td><td>is a pointer to a 32-bit aligned buffer where the CAN frame to be written.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if RX FIFO was not empty and a frame was read from RX FIFO successfully and written into the given buffer;</li><li>XST_NO_DATA if there is no frame to be received from the FIFO</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="4e3c77247fec5c6e8eccfc36df711fd6"></a><!-- doxytag: member="xcan.c::XCan_Reset" ref="4e3c77247fec5c6e8eccfc36df711fd6" args="(XCan *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 XCan_Reset </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>
This function resets the CAN device. Calling this function resets the device immediately, and any pending transmission or reception is terminated at once. Both Object Layer and Transfer Layer are reset. This function does not reset the Physical Layer. All registers are reset to the default values, and no previous status will be restored. TX FIFO, RX FIFO and TX High Priority Buffer are also reset.<p>
When a reset is required due to an internal error, the driver notifies the upper layer software of this need through the error status code or interrupts The upper layer software is responsible for calling this Reset function and then re-configuring the device.<p>
The CAN device will be in Configuration Mode immediately after this function returns.<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_can.html">XCan</a> instance 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="9cb561530641046d8f0cdc70e99bde1d"></a><!-- doxytag: member="xcan.c::XCan_Send" ref="9cb561530641046d8f0cdc70e99bde1d" args="(XCan *InstancePtr, u32 *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">int XCan_Send </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>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>
This function sends a CAN Frame. This function first checks if TX FIFO is full. If not, it then writes the given frame into the TX FIFO; otherwise, it returns error code immediately. This function does not wait for the given frame being sent to CAN bus.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FramePtr</em>&nbsp;</td><td>is a pointer to a 32-bit aligned buffer containing the CAN frame to be sent.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if TX FIFO was not full and the given frame was written into the FIFO;</li><li>XST_FIFO_NO_ROOM if there is no room in the TX FIFO for the given frame</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="9e06db4f0ad6a9a1accdb16e1b23e4ee"></a><!-- doxytag: member="xcan.c::XCan_SendHighPriority" ref="9e06db4f0ad6a9a1accdb16e1b23e4ee" args="(XCan *InstancePtr, u32 *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">int XCan_SendHighPriority </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>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>
This routine sends a CAN High Priority frame. This function first checks if TX High Priority Buffer is empty. If yes, it then writes the given frame into the Buffer. If not, This function returns immediately. This function does not wait for the given frame being sent to CAN bus.<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FramePtr</em>&nbsp;</td><td>is a pointer to a 32-bit aligned buffer containing the CAN High Priority frame to be sent.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if TX High Priority Buffer was not full and the given frame was written into the buffer;</li><li>XST_FIFO_NO_ROOM if there is no room in the TX High Priority Buffer for this frame.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
If the frame needs to be sent immediately and not delayed by processor's interrupts handling, the caller should disable interrupt at processor level before invoking this function. </td>
</tr>
</table>
<a class="anchor" name="c7e9d7949a7ad31ff6fa96622e09d147"></a><!-- doxytag: member="xcan.c::XCan_VmInitialize" ref="c7e9d7949a7ad31ff6fa96622e09d147" args="(XCan *InstancePtr, u16 DeviceId, u32 VirtAddr)" --><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 XCan_VmInitialize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_can.html">XCan</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>u16&nbsp;</td>
<td class="mdname" nowrap> <em>DeviceId</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>VirtAddr</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>
This routine initializes of a specific <a class="el" href="struct_x_can.html">XCan</a> instance/driver. This function should only be used if Virtual Memory support is necessary. The caller is responsible for calculating the correct device base address in Virtual memory address space and passing it into this function.<p>
This initialization entails:<ul>
<li>Search for device configuration given the device ID.</li><li>Initialize Base Address field of the <a class="el" href="struct_x_can.html">XCan</a> structure using the given virtual address parameter value.</li><li>Populate all other data fields in the <a class="el" href="struct_x_can.html">XCan</a> structure.</li><li>Reset the device.</li></ul>
<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_can.html">XCan</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>DeviceId</em>&nbsp;</td><td>is the unique ID of the device controlled by this <a class="el" href="struct_x_can.html">XCan</a> instance. Passing in a device ID associates the generic <a class="el" href="struct_x_can.html">XCan</a> instance to a specific device, as chosen by the caller or application developer. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>VirtAddr</em>&nbsp;</td><td>is the device base address in the virtual memory address space. The caller is responsible for keeping the address mapping from VirtAddr to the device physical base address unchanged once this function is invoked. Unexpected errors may occur if the address mapping changes after this function is called.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if initialization was successful</li><li>XST_DEVICE_NOT_FOUND if device configuration information was not found for a device with the supplied device ID.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<hr><h2>Variable Documentation</h2>
<a class="anchor" name="8b29ea2fb69df19e7bc942eef60947d5"></a><!-- doxytag: member="xcan.c::XCan_ConfigTable" ref="8b29ea2fb69df19e7bc942eef60947d5" args="[]" --><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"><a class="el" href="struct_x_can___config.html">XCan_Config</a> <a class="el" href="xcan__g_8c.html#9be0fb87c8e629aee7828db8ad931929">XCan_ConfigTable</a>[] </td>
</tr>
</table>
</td>
</tr>
</table>
<table cellspacing="5" cellpadding="0" border="0">
<tr>
<td>
&nbsp;
</td>
<td>
<p>
This table contains configuration information for each CAN device in the system. </td>
</tr>
</table>
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.