embeddedsw/XilinxProcessorIPLib/drivers/iic/doc/html/api/xiic_8c.html

615 lines
36 KiB
HTML
Raw Normal View History

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>
Xilinx Driver iic v3_0: xiic.c File Reference
</title>
<link href="doxygen_kalyanidocs/doc/css/driver_api_doxygen.css" 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.6.1 -->
<div class="navigation" id="top">
<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 class="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>
</div>
<div class="contents">
<h1>xiic.c File Reference</h1><code>#include &quot;<a class="el" href="xiic_8h.html">xiic.h</a>&quot;</code><br/>
<code>#include &quot;<a class="el" href="xiic__i_8h.html">xiic_i.h</a>&quot;</code><br/>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#ae1d05b288ae1f48c484d0fd308e72f8c">XIic_CfgInitialize</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, <a class="el" href="struct_x_iic___config.html">XIic_Config</a> *Config, u32 EffectiveAddr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#aaa989e0128057bf11803825d774d496f">XIic_Stop</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#a237935ed7fb41369f52d1d8a4f6fe2a6">XIic_Reset</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#ad944f42c3d9972fc2c986a7eed726297">XIic_SetAddress</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, int AddressType, int Address)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u16&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#a3e8f77e5df8d92a4b27627e03b5e1807">XIic_GetAddress</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, int AddressType)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#afe4e886e72abb9d860a6cb83c84c74a1">XIic_SetGpOutput</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, u8 OutputValue)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#a4108f79d22b71e2455844a8487b1a776">XIic_GetGpOutput</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, u8 *OutputValuePtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#aa4b84f9d58cbd40d2633140d79e2aed4">XIic_IsSlave</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#a86b4b2b307df26df2ecac39337c78bed">XIic_SetRecvHandler</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, void *CallBackRef, <a class="el" href="xiic_8h.html#a85db866c44d23a4c6e985f2c6c647053">XIic_Handler</a> FuncPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#ad33428830e9016ef50c1deae59d1e604">XIic_SetSendHandler</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, void *CallBackRef, <a class="el" href="xiic_8h.html#a85db866c44d23a4c6e985f2c6c647053">XIic_Handler</a> FuncPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#aa74a6884f6dfc826a10768d7d0333991">XIic_SetStatusHandler</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr, void *CallBackRef, <a class="el" href="xiic_8h.html#ac96e3f6975be1bdb8fe5956812855962">XIic_StatusHandler</a> FuncPtr)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic_8c.html#af4f74d08f52c1a9e6e1e0ee4035fe8eb">XIic_IsIicBusy</a> (<a class="el" href="struct_x_iic.html">XIic</a> *InstancePtr)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>Contains required functions for the <a class="el" href="struct_x_iic.html">XIic</a> component. See <a class="el" href="xiic_8h.html">xiic.h</a> for more information on the driver.</p>
<pre>
MODIFICATION HISTORY:</pre><pre> Ver Who Date Changes
----- --- ------- -----------------------------------------------
1.01a rfp 10/19/01 release
1.01c ecm 12/05/02 new rev
1.01c rmm 05/14/03 Fixed diab compiler warnings relating to asserts.
1.01d jhl 10/08/03 Added general purpose output feature
1.02a jvb 12/13/05 Added CfgInitialize(), and made CfgInitialize() take
a pointer to a config structure instead of a device id.
Moved Initialize() into <a class="el" href="xiic__sinit_8c.html">xiic_sinit.c</a>, and have
Initialize() call CfgInitialize() after it retrieved the
config structure using the device id. Removed include of
xparameters.h along with any dependencies on xparameters.h
and the _g.c config table.
1.02a mta 03/09/06 Added a new function <a class="el" href="xiic_8c.html#af4f74d08f52c1a9e6e1e0ee4035fe8eb">XIic_IsIicBusy()</a> which returns
whether IIC Bus is Busy or Free.
1.13a wgr 03/22/07 Converted to new coding style.
1.15a ktn 02/17/09 Fixed <a class="el" href="xiic_8c.html#a3e8f77e5df8d92a4b27627e03b5e1807">XIic_GetAddress()</a> to return correct device address.
1.16a ktn 07/18/09 Updated the notes in XIic_Reset function to clearly
indicate that only the Interrupt Registers are reset.
1.16a ktn 10/16/09 Updated the notes in the <a class="el" href="xiic_8h.html#a0a4d9b646c26bcf932561699d69d52b1">XIic_SelfTest()</a> API to mention
that the complete IIC core is Reset on giving a software
reset to the IIC core. This issue is fixed in the latest
version of the IIC core (some previous versions of the
core only reset the Interrupt Logic/Registers), please
see the Hw specification for further information.
2.00a ktn 10/22/09 Converted all register accesses to 32 bit access.
Some of the macros have been renamed to remove _m from
the name see the <a class="el" href="xiic__i_8h.html">xiic_i.h</a> and <a class="el" href="xiic__l_8h.html">xiic_l.h</a> file for further
information (Example XIic_mClearIntr is now
XIic_ClearIntr).
Some of the macros have been renamed to be consistent,
see the <a class="el" href="xiic__l_8h.html">xiic_l.h</a> file for further information
(Example XIIC_WRITE_IIER is renamed as XIic_WriteIier).
The driver has been updated to use the HAL APIs/macros.
2.07a adk 18/04/13 Updated the code to avoid unused variable warnings
when compiling with the -Wextra -Wall flags.
Changes done if files <a class="el" href="xiic_8c.html">xiic.c</a> and <a class="el" href="xiic__i_8h.html">xiic_i.h</a>. CR:705001.</pre><pre> </pre> <hr/><h2>Function Documentation</h2>
<a class="anchor" id="ae1d05b288ae1f48c484d0fd308e72f8c"></a><!-- doxytag: member="xiic.c::XIic_CfgInitialize" ref="ae1d05b288ae1f48c484d0fd308e72f8c" args="(XIic *InstancePtr, XIic_Config *Config, u32 EffectiveAddr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_CfgInitialize </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="struct_x_iic___config.html">XIic_Config</a> *&nbsp;</td>
<td class="paramname"> <em>Config</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">u32&nbsp;</td>
<td class="paramname"> <em>EffectiveAddr</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Initializes a specific <a class="el" href="struct_x_iic.html">XIic</a> instance. The initialization entails:</p>
<ul>
<li>Initialize the driver to allow access to the device registers and initialize other subcomponents necessary for the operation of the device.</li>
<li>Default options to:<ul>
<li>7-bit slave addressing</li>
<li>Send messages as a slave device</li>
<li>Repeated start off</li>
<li>General call recognition disabled</li>
</ul>
</li>
<li>Clear messageing and error statistics</li>
</ul>
<p>The <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> function must be called after this function before the device is ready to send and receive data on the IIC bus.</p>
<p>Before <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> is called, the interrupt control must connect the ISR routine to the interrupt handler. This is done by the user, and not <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> to allow the user to use an interrupt controller of their choice.</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Config</em>&nbsp;</td><td>is a reference to a structure containing information about a specific IIC device. This function can initialize multiple instance objects with the use of multiple calls giving different Config information on each call. </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. The caller is responsible for keeping the address mapping from EffectiveAddr 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. If address translation is not used, use Config-&gt;BaseAddress for this parameters, passing the physical address instead.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS when successful</li>
<li>XST_DEVICE_IS_STARTED indicates the device is started (i.e. interrupts enabled and messaging is possible). Must stop before re-initialization is allowed.</li>
</ul>
</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
<a class="anchor" id="a3e8f77e5df8d92a4b27627e03b5e1807"></a><!-- doxytag: member="xiic.c::XIic_GetAddress" ref="a3e8f77e5df8d92a4b27627e03b5e1807" args="(XIic *InstancePtr, int AddressType)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">u16 XIic_GetAddress </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>AddressType</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function gets the addresses for the IIC device driver. The addresses include the device address that the device responds to as a slave, or the slave address to communicate with on the bus. The address returned has the same format whether 7 or 10 bits.</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>AddressType</em>&nbsp;</td><td>indicates which address, the address which this responds to on the IIC bus as a slave, or the slave address to communicate with when this device is a master. One of the following values must be contained in this argument. </p>
<pre>
XII_ADDR_TO_SEND_TYPE Slave being addressed as a master
XII_ADDR_TO_RESPOND_TYPE Slave address to respond to as a slave
</pre><p> If neither of the two valid arguments are used, the function returns the address of the slave device</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>The address retrieved.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
<a class="anchor" id="a4108f79d22b71e2455844a8487b1a776"></a><!-- doxytag: member="xiic.c::XIic_GetGpOutput" ref="a4108f79d22b71e2455844a8487b1a776" args="(XIic *InstancePtr, u8 *OutputValuePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_GetGpOutput </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">u8 *&nbsp;</td>
<td class="paramname"> <em>OutputValuePtr</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function gets the contents of the General Purpose Output register for the IIC device driver. Note that the number of bits in this register is parameterizable in the hardware such that it may not exist. This function checks to ensure that it does exist to prevent bus errors.</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>OutputValuePtr</em>&nbsp;</td><td>contains the value which was read from the register.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the given data is read from the GPO register.</li>
<li>XST_NO_FEATURE if the hardware is configured such that this register does not contain any bits to read or write.</li>
</ul>
</dd></dl>
<p>The OutputValuePtr is also an output as it contains the value read.</p>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
<a class="anchor" id="af4f74d08f52c1a9e6e1e0ee4035fe8eb"></a><!-- doxytag: member="xiic.c::XIic_IsIicBusy" ref="af4f74d08f52c1a9e6e1e0ee4035fe8eb" args="(XIic *InstancePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">u32 XIic_IsIicBusy </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
</div>
</div>
<a class="anchor" id="aa4b84f9d58cbd40d2633140d79e2aed4"></a><!-- doxytag: member="xiic.c::XIic_IsSlave" ref="aa4b84f9d58cbd40d2633140d79e2aed4" args="(XIic *InstancePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">u32 XIic_IsSlave </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>A function to determine if the device is currently addressed as a slave.</p>
<dl><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_iic.html">XIic</a> instance to be worked on.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>TRUE if the device is addressed as slave.</li>
<li>FALSE if the device is NOT addressed as slave.</li>
</ul>
</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
<a class="anchor" id="a237935ed7fb41369f52d1d8a4f6fe2a6"></a><!-- doxytag: member="xiic.c::XIic_Reset" ref="a237935ed7fb41369f52d1d8a4f6fe2a6" args="(XIic *InstancePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void XIic_Reset </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Resets the IIC device.</p>
<dl><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_iic.html">XIic</a> instance to be worked on.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>The complete IIC core is Reset on giving a software reset to the IIC core. Some previous versions of the core only reset the Interrupt Logic/Registers, please refer to the HW specification for futher details about this. </dd></dl>
</div>
</div>
<a class="anchor" id="ad944f42c3d9972fc2c986a7eed726297"></a><!-- doxytag: member="xiic.c::XIic_SetAddress" ref="ad944f42c3d9972fc2c986a7eed726297" args="(XIic *InstancePtr, int AddressType, int Address)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_SetAddress </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>AddressType</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&nbsp;</td>
<td class="paramname"> <em>Address</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function sets the bus addresses. The addresses include the device address that the device responds to as a slave, or the slave address to communicate with on the bus. The IIC device hardware is built to allow either 7 or 10 bit slave addressing only at build time rather than at run time. When this device is a master, slave addressing can be selected at run time to match addressing modes for other bus devices.</p>
<p>Addresses are represented as hex values with no adjustment for the data direction bit as the software manages address bit placement. Example: For a 7 address written to the device of 1010 011X where X is the transfer direction (send/recv), the address parameter for this function needs to be 01010011 or 0x53 where the correct bit alllignment will be handled for 7 as well as 10 bit devices. This is especially important as the bit placement is not handled the same depending on which options are used such as repeated start.</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>AddressType</em>&nbsp;</td><td>indicates which address is being modified, the address which this device responds to on the IIC bus as a slave, or the slave address to communicate with when this device is a master. One of the following values must be contained in this argument. </p>
<pre>
XII_ADDR_TO_SEND_TYPE Slave being addressed by a this master
XII_ADDR_TO_RESPOND_TYPE Address to respond to as a slave device
</pre></td></tr>
<tr><td valign="top"></td><td valign="top"><em>Address</em>&nbsp;</td><td>contains the address to be set, 7 bit or 10 bit address. A ten bit address must be within the range: 0 - 1023 and a 7 bit address must be within the range 0 - 127.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS is returned if the address was successfully set.</li>
<li>XST_IIC_NO_10_BIT_ADDRESSING indicates only 7 bit addressing supported.</li>
<li>XST_INVALID_PARAM indicates an invalid parameter was specified.</li>
</ul>
</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd></dd></dl>
<p>Upper bits of 10-bit address is written only when current device is built as a ten bit device. </p>
</div>
</div>
<a class="anchor" id="afe4e886e72abb9d860a6cb83c84c74a1"></a><!-- doxytag: member="xiic.c::XIic_SetGpOutput" ref="afe4e886e72abb9d860a6cb83c84c74a1" args="(XIic *InstancePtr, u8 OutputValue)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_SetGpOutput </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">u8&nbsp;</td>
<td class="paramname"> <em>OutputValue</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function sets the contents of the General Purpose Output register for the IIC device driver. Note that the number of bits in this register is parameterizable in the hardware such that it may not exist. This function checks to ensure that it does exist to prevent bus errors, but does not ensure that the number of bits in the register are sufficient for the value being written (won't cause a bus error).</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>OutputValue</em>&nbsp;</td><td>contains the value to be written to the register.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the given data is written to the GPO register.</li>
<li>XST_NO_FEATURE if the hardware is configured such that this register does not contain any bits to read or write.</li>
</ul>
</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
<a class="anchor" id="a86b4b2b307df26df2ecac39337c78bed"></a><!-- doxytag: member="xiic.c::XIic_SetRecvHandler" ref="a86b4b2b307df26df2ecac39337c78bed" args="(XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void XIic_SetRecvHandler </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>CallBackRef</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="xiic_8h.html#a85db866c44d23a4c6e985f2c6c647053">XIic_Handler</a>&nbsp;</td>
<td class="paramname"> <em>FuncPtr</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the receive callback function, the receive handler, which the driver calls when it finishes receiving data. The number of bytes used to signal when the receive is complete is the number of bytes set in the XIic_Recv function.</p>
<p>The handler executes in an interrupt context such that it must minimize the amount of processing performed such as transferring data to a thread context.</p>
<p>The number of bytes received is passed to the handler as an argument.</p>
<dl><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_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>CallBackRef</em>&nbsp;</td><td>is the upper layer callback reference passed back when the callback function is invoked. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FuncPtr</em>&nbsp;</td><td>is the pointer to the callback function.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>The handler is called within interrupt context . </dd></dl>
</div>
</div>
<a class="anchor" id="ad33428830e9016ef50c1deae59d1e604"></a><!-- doxytag: member="xiic.c::XIic_SetSendHandler" ref="ad33428830e9016ef50c1deae59d1e604" args="(XIic *InstancePtr, void *CallBackRef, XIic_Handler FuncPtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void XIic_SetSendHandler </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>CallBackRef</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="xiic_8h.html#a85db866c44d23a4c6e985f2c6c647053">XIic_Handler</a>&nbsp;</td>
<td class="paramname"> <em>FuncPtr</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the send callback function, the send handler, which the driver calls when it receives confirmation of sent data. The handler executes in an interrupt context such that it must minimize the amount of processing performed such as transferring data to a thread context.</p>
<dl><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>the pointer to the <a class="el" href="struct_x_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>CallBackRef</em>&nbsp;</td><td>the upper layer callback reference passed back when the callback function is invoked. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FuncPtr</em>&nbsp;</td><td>the pointer to the callback function.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>The handler is called within interrupt context . </dd></dl>
</div>
</div>
<a class="anchor" id="aa74a6884f6dfc826a10768d7d0333991"></a><!-- doxytag: member="xiic.c::XIic_SetStatusHandler" ref="aa74a6884f6dfc826a10768d7d0333991" args="(XIic *InstancePtr, void *CallBackRef, XIic_StatusHandler FuncPtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void XIic_SetStatusHandler </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void *&nbsp;</td>
<td class="paramname"> <em>CallBackRef</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="xiic_8h.html#ac96e3f6975be1bdb8fe5956812855962">XIic_StatusHandler</a>&nbsp;</td>
<td class="paramname"> <em>FuncPtr</em></td><td>&nbsp;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Sets the status callback function, the status handler, which the driver calls when it encounters conditions which are not data related. The handler executes in an interrupt context such that it must minimize the amount of processing performed such as transferring data to a thread context. The status events that can be returned are described in <a class="el" href="xiic_8h.html">xiic.h</a>.</p>
<dl><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>points to the <a class="el" href="struct_x_iic.html">XIic</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>CallBackRef</em>&nbsp;</td><td>is the upper layer callback reference passed back when the callback function is invoked. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>FuncPtr</em>&nbsp;</td><td>is the pointer to the callback function.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>The handler is called within interrupt context . </dd></dl>
</div>
</div>
<a class="anchor" id="a5f4e497710a9c3719f27d40faa74a10f"></a><!-- doxytag: member="xiic.c::XIic_Start" ref="a5f4e497710a9c3719f27d40faa74a10f" args="(XIic *InstancePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_Start </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function starts the IIC device and driver by enabling the proper interrupts such that data may be sent and received on the IIC bus. This function must be called before the functions to send and receive data.</p>
<p>Before <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> is called, the interrupt control must connect the ISR routine to the interrupt handler. This is done by the user, and not <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> to allow the user to use an interrupt controller of their choice.</p>
<p>Start enables:</p>
<ul>
<li>IIC device</li>
<li>Interrupts:<ul>
<li>Addressed as slave to allow messages from another master</li>
<li>Arbitration Lost to detect Tx arbitration errors</li>
<li>Global IIC interrupt</li>
</ul>
</li>
</ul>
<dl><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_iic.html">XIic</a> instance to be worked on.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>XST_SUCCESS always.</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd></dd></dl>
<p>The device interrupt is connected to the interrupt controller, but no "messaging" interrupts are enabled. Addressed as Slave is enabled to reception of messages when this devices address is written to the bus. The correct messaging interrupts are enabled when sending or receiving via the IicSend() and IicRecv() functions. No action is required by the user to control any IIC interrupts as the driver completely manages all 8 interrupts. Start and Stop control the ability to use the device. Stopping the device completely stops all device interrupts from the processor. </p>
</div>
</div>
<a class="anchor" id="aaa989e0128057bf11803825d774d496f"></a><!-- doxytag: member="xiic.c::XIic_Stop" ref="aaa989e0128057bf11803825d774d496f" args="(XIic *InstancePtr)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int XIic_Stop </td>
<td>(</td>
<td class="paramtype"><a class="el" href="struct_x_iic.html">XIic</a> *&nbsp;</td>
<td class="paramname"> <em>InstancePtr</em></td>
<td>&nbsp;)&nbsp;</td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>This function stops the IIC device and driver such that data is no longer sent or received on the IIC bus. This function stops the device by disabling interrupts. This function only disables interrupts within the device such that the caller is responsible for disconnecting the interrupt handler of the device from the interrupt source and disabling interrupts at other levels.</p>
<p>Due to bus throttling that could hold the bus between messages when using repeated start option, stop will not occur when the device is actively sending or receiving data from the IIC bus or the bus is being throttled by this device, but instead return XST_IIC_BUS_BUSY.</p>
<dl><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_iic.html">XIic</a> instance to be worked on.</td></tr>
</table>
</dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS indicates all IIC interrupts are disabled. No messages can be received or transmitted until <a class="el" href="xiic_8c.html#a5f4e497710a9c3719f27d40faa74a10f">XIic_Start()</a> is called.</li>
<li>XST_IIC_BUS_BUSY indicates this device is currently engaged in message traffic and cannot be stopped.</li>
</ul>
</dd></dl>
<dl class="note"><dt><b>Note:</b></dt><dd>None. </dd></dl>
</div>
</div>
</div>
<p class="Copyright">
Copyright &copy; 1995-2014 Xilinx, Inc. All rights reserved.
</p>
</body>
</html>