embeddedsw/XilinxProcessorIPLib/drivers/gpio/doc/html/api/xgpio_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

318 lines
16 KiB
HTML
Executable file

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>
xgpio.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>xgpio.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The implementation of the <a class="el" href="struct_x_gpio.html">XGpio</a> driver's basic functionality. See xgpio.h for more information about the driver.<p>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
None<p>
<pre>
MODIFICATION HISTORY:</pre><p>
<pre> Ver Who Date Changes
----- ---- -------- -----------------------------------------------
1.00a rmm 02/04/02 First release
2.00a jhl 12/16/02 Update for dual channel and interrupt support
2.01a jvb 12/13/05 Changed Initialize() into CfgInitialize(), and made
CfgInitialize() take a pointer to a config structure
instead of a device id. Moved Initialize() into
<a class="el" href="xgpio__sinit_8c.html">xgpio_sinit.c</a>, and had 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.
2.11a mta 03/21/07 Updated to new coding style, added GetDataDirection
2.12a sv 11/21/07 Updated driver to support access through DCR bus
3.00a sv 11/21/09 Updated to use HAL Processor APIs. Renamed the
macros to remove _m from the name.
</pre>
<p>
<code>#include &quot;xgpio.h&quot;</code><br>
<code>#include &quot;xstatus.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="xgpio_8c.html#b087babbe56b60f23b522dbc2989feea">XGpio_CfgInitialize</a> (<a class="el" href="struct_x_gpio.html">XGpio</a> *InstancePtr, <a class="el" href="struct_x_gpio___config.html">XGpio_Config</a> *Config, u32 EffectiveAddr)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xgpio_8c.html#af146126ae9b4fb2196322bc8fb8dac4">XGpio_SetDataDirection</a> (<a class="el" href="struct_x_gpio.html">XGpio</a> *InstancePtr, unsigned Channel, u32 DirectionMask)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xgpio_8c.html#0a5403bd81cfc8f74b7d707b9344ac49">XGpio_GetDataDirection</a> (<a class="el" href="struct_x_gpio.html">XGpio</a> *InstancePtr, unsigned Channel)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">u32&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xgpio_8c.html#e0f1b5b97adbd4b1ffc0e0ea8ce446a1">XGpio_DiscreteRead</a> (<a class="el" href="struct_x_gpio.html">XGpio</a> *InstancePtr, unsigned Channel)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xgpio_8c.html#123b868886b4aa27a0be17fe65902315">XGpio_DiscreteWrite</a> (<a class="el" href="struct_x_gpio.html">XGpio</a> *InstancePtr, unsigned Channel, u32 Data)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="b087babbe56b60f23b522dbc2989feea"></a><!-- doxytag: member="xgpio.c::XGpio_CfgInitialize" ref="b087babbe56b60f23b522dbc2989feea" args="(XGpio *InstancePtr, XGpio_Config *Config, 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 XGpio_CfgInitialize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_gpio.html">XGpio</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_gpio___config.html">XGpio_Config</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>Config</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 the <a class="el" href="struct_x_gpio.html">XGpio</a> instance provided by the caller based on the given configuration data.<p>
Nothing is done except to initialize the InstancePtr.<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 an <a class="el" href="struct_x_gpio.html">XGpio</a> instance. The memory the pointer references must be pre-allocated by the caller. Further calls to manipulate the driver through the <a class="el" href="struct_x_gpio.html">XGpio</a> API must be made with this pointer. </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 GPIO device. This function initializes an InstancePtr object for a specific device specified by the contents of Config. 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>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS Initialization was successfull.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="e0f1b5b97adbd4b1ffc0e0ea8ce446a1"></a><!-- doxytag: member="xgpio.c::XGpio_DiscreteRead" ref="e0f1b5b97adbd4b1ffc0e0ea8ce446a1" args="(XGpio *InstancePtr, unsigned Channel)" --><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 XGpio_DiscreteRead </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_gpio.html">XGpio</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>unsigned&nbsp;</td>
<td class="mdname" nowrap> <em>Channel</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 state of discretes for the specified GPIO channnel.<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 an <a class="el" href="struct_x_gpio.html">XGpio</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Channel</em>&nbsp;</td><td>contains the channel of the GPIO (1 or 2) to operate on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Current copy of the discretes register.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>The hardware must be built for dual channels if this function is used with any channel other than 1. If it is not, this function will assert. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="123b868886b4aa27a0be17fe65902315"></a><!-- doxytag: member="xgpio.c::XGpio_DiscreteWrite" ref="123b868886b4aa27a0be17fe65902315" args="(XGpio *InstancePtr, unsigned Channel, u32 Data)" --><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 XGpio_DiscreteWrite </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_gpio.html">XGpio</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>unsigned&nbsp;</td>
<td class="mdname" nowrap> <em>Channel</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>Data</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 to discretes register for the specified GPIO channel.<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 an <a class="el" href="struct_x_gpio.html">XGpio</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Channel</em>&nbsp;</td><td>contains the channel of the GPIO (1 or 2) to operate on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Data</em>&nbsp;</td><td>is the value to be written to the discretes register.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>The hardware must be built for dual channels if this function is used with any channel other than 1. If it is not, this function will assert. See also <a class="el" href="xgpio__extra_8c.html#102aca7267ccc30338fdd8eb4b5d2c62">XGpio_DiscreteSet()</a> and <a class="el" href="xgpio__extra_8c.html#6b92989596db7d39698d838f6c5a6fc7">XGpio_DiscreteClear()</a>. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="0a5403bd81cfc8f74b7d707b9344ac49"></a><!-- doxytag: member="xgpio.c::XGpio_GetDataDirection" ref="0a5403bd81cfc8f74b7d707b9344ac49" args="(XGpio *InstancePtr, unsigned Channel)" --><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 XGpio_GetDataDirection </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_gpio.html">XGpio</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>unsigned&nbsp;</td>
<td class="mdname" nowrap> <em>Channel</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>
Get the input/output direction of all discrete signals for the specified GPIO channel.<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 an <a class="el" href="struct_x_gpio.html">XGpio</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Channel</em>&nbsp;</td><td>contains the channel of the GPIO (1 or 2) to operate on.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>Bitmask specifying which discretes are input and which are output. Bits set to 0 are output and bits set to 1 are input.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd></dd></dl>
The hardware must be built for dual channels if this function is used with any channel other than 1. If it is not, this function will assert. </td>
</tr>
</table>
<a class="anchor" name="af146126ae9b4fb2196322bc8fb8dac4"></a><!-- doxytag: member="xgpio.c::XGpio_SetDataDirection" ref="af146126ae9b4fb2196322bc8fb8dac4" args="(XGpio *InstancePtr, unsigned Channel, u32 DirectionMask)" --><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 XGpio_SetDataDirection </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_gpio.html">XGpio</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>unsigned&nbsp;</td>
<td class="mdname" nowrap> <em>Channel</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>DirectionMask</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 input/output direction of all discrete signals for the specified GPIO channel.<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 an <a class="el" href="struct_x_gpio.html">XGpio</a> instance to be worked on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Channel</em>&nbsp;</td><td>contains the channel of the GPIO (1 or 2) to operate on. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>DirectionMask</em>&nbsp;</td><td>is a bitmask specifying which discretes are input and which are output. Bits set to 0 are output and bits set to 1 are input.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd>None.</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>The hardware must be built for dual channels if this function is used with any channel other than 1. If it is not, this function will assert. </dd></dl>
</td>
</tr>
</table>
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.