embeddedsw/XilinxProcessorIPLib/drivers/usbps/doc/html/api/xusbps_8c.html

354 lines
18 KiB
HTML
Raw Normal View History

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>
xusbps.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>xusbps.c File Reference</h1><hr><a name="_details"></a><h2>Detailed Description</h2>
The <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> driver. Functions in this file are the minimum required functions for this driver. See xusbps.h for a detailed description of the driver.<p>
<dl compact><dt><b>Note:</b></dt><dd>None.</dd></dl>
<pre>
MODIFICATION HISTORY:</pre><p>
<pre> Ver Who Date Changes
----- ---- -------- --------------------------------------------------------
1.00a jz 10/10/10 First release
2.1 kpc 04/28/14 Removed ununsed functions
</pre>
<p>
<code>#include &lt;stdio.h&gt;</code><br>
<code>#include &quot;xusbps.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="xusbps_8c.html#6ec9505ad79cc31a819831c592a4846d">XUsbPs_CfgInitialize</a> (<a class="el" href="struct_x_usb_ps.html">XUsbPs</a> *InstancePtr, const <a class="el" href="struct_x_usb_ps___config.html">XUsbPs_Config</a> *ConfigPtr, u32 VirtBaseAddress)</td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="xusbps_8c.html#f8e27cc93d9b704e9e9df7d134271ec3">XUsbPs_DeviceReset</a> (<a class="el" href="struct_x_usb_ps.html">XUsbPs</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="xusbps_8c.html#2fb177b2da1d9f6aa527110498ce9fbe">XUsbPs_Reset</a> (<a class="el" href="struct_x_usb_ps.html">XUsbPs</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="xusbps_8c.html#fc87634089c404ef439c7f10079eb7ff">XUsbPs_Suspend</a> (const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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="xusbps_8c.html#9da85bf0a61d8bc082ae71658874540b">XUsbPs_Resume</a> (const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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="xusbps_8c.html#894d7575401b156ca3ef0917735ca752">XUsbPs_RequestHostResume</a> (const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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="xusbps_8c.html#97a77e3eb7cc80476cc96eec2def3725">XUsbPs_SetDeviceAddress</a> (<a class="el" href="struct_x_usb_ps.html">XUsbPs</a> *InstancePtr, u8 Address)</td></tr>
</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="6ec9505ad79cc31a819831c592a4846d"></a><!-- doxytag: member="xusbps.c::XUsbPs_CfgInitialize" ref="6ec9505ad79cc31a819831c592a4846d" args="(XUsbPs *InstancePtr, const XUsbPs_Config *ConfigPtr, u32 VirtBaseAddress)" --><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 XUsbPs_CfgInitialize </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_usb_ps.html">XUsbPs</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>const <a class="el" href="struct_x_usb_ps___config.html">XUsbPs_Config</a> *&nbsp;</td>
<td class="mdname" nowrap> <em>ConfigPtr</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>VirtBaseAddress</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 initializes a <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance/driver.<p>
The initialization entails:<ul>
<li>Initialize all members of the <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> structure.</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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>ConfigPtr</em>&nbsp;</td><td>is a pointer to a <a class="el" href="struct_x_usb_ps___config.html">XUsbPs_Config</a> configuration structure. This structure will contain the requested configuration for the device. Typically, this is a local structure and the content of which will be copied into the configuration structure within <a class="el" href="struct_x_usb_ps.html">XUsbPs</a>. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>VirtBaseAddress</em>&nbsp;</td><td>is the base address of the device. For systems with virtual memory, this address must be the virtual address of the device. For systems that do not support virtual memory this address should be the physical address of the device. For backwards compatibilty NULL may be passed in systems that do not support virtual memory (deprecated).</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS no errors occured.</li><li>XST_FAILURE an error occured during initialization.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>After calling <a class="el" href="xusbps_8c.html#6ec9505ad79cc31a819831c592a4846d">XUsbPs_CfgInitialize()</a> the controller IS NOT READY for use. Before the controller can be used its DEVICE parameters must be configured. See xusbps.h for details. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="f8e27cc93d9b704e9e9df7d134271ec3"></a><!-- doxytag: member="xusbps.c::XUsbPs_DeviceReset" ref="f8e27cc93d9b704e9e9df7d134271ec3" args="(XUsbPs *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 XUsbPs_DeviceReset </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_usb_ps.html">XUsbPs</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 performs device reset, device is stopped at the end.<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller.</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="894d7575401b156ca3ef0917735ca752"></a><!-- doxytag: member="xusbps.c::XUsbPs_RequestHostResume" ref="894d7575401b156ca3ef0917735ca752" args="(const XUsbPs *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XUsbPs_RequestHostResume </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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>
USB Assert Resume<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the USB device has Resumed successfully</li><li>XST_FAILURE on any error</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="2fb177b2da1d9f6aa527110498ce9fbe"></a><!-- doxytag: member="xusbps.c::XUsbPs_Reset" ref="2fb177b2da1d9f6aa527110498ce9fbe" args="(XUsbPs *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XUsbPs_Reset </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_usb_ps.html">XUsbPs</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 USB device. All the configuration registers are reset to their default values. The function waits until the reset operation is complete or for a certain duration within which the reset operation is expected to be completed.<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS Reset operation completed successfully.</li><li>XST_FAILURE Reset operation timed out.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="9da85bf0a61d8bc082ae71658874540b"></a><!-- doxytag: member="xusbps.c::XUsbPs_Resume" ref="9da85bf0a61d8bc082ae71658874540b" args="(const XUsbPs *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XUsbPs_Resume </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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>
USB Resume<p>
If the USB controller is suspended, its operation is resumed when any non-idle signaling is received on its upstream facing port.<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the USB device has Resumed successfully</li><li>XST_FAILURE on any error</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="97a77e3eb7cc80476cc96eec2def3725"></a><!-- doxytag: member="xusbps.c::XUsbPs_SetDeviceAddress" ref="97a77e3eb7cc80476cc96eec2def3725" args="(XUsbPs *InstancePtr, u8 Address)" --><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 XUsbPs_SetDeviceAddress </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top"><a class="el" href="struct_x_usb_ps.html">XUsbPs</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>Address</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 functions sets the controller's DEVICE address. It also sets the advance bit so the controller will wait for the next IN-ACK before the new address takes effect.<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller. </td></tr>
<tr><td valign="top"></td><td valign="top"><em>Address</em>&nbsp;</td><td>is the Address of the device.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS: Address set successfully.</li><li>XST_FAILURE: An error occured.</li><li>XST_INVALID_PARAM: Invalid parameter passed, e.g. address value too big.</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
<a class="anchor" name="fc87634089c404ef439c7f10079eb7ff"></a><!-- doxytag: member="xusbps.c::XUsbPs_Suspend" ref="fc87634089c404ef439c7f10079eb7ff" args="(const XUsbPs *InstancePtr)" --><p>
<table class="mdTable" cellpadding="2" cellspacing="0">
<tr>
<td class="mdRow">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="md" nowrap valign="top">int XUsbPs_Suspend </td>
<td class="md" valign="top">(&nbsp;</td>
<td class="md" nowrap valign="top">const <a class="el" href="struct_x_usb_ps.html">XUsbPs</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>
USB Suspend<p>
In order to conserve power, USB devices automatically enter the suspended state when the device has observed no bus traffic for a specified period. When suspended, the USB device maintains any internal status, including its address and configuration. Attached devices must be prepared to suspend at any time they are powered, regardless of if they have been assigned a non-default address, are configured, or neither. Bus activity may cease due to the host entering a suspend mode of its own. In addition, a USB device shall also enter the suspended state when the hub port it is attached to is disabled.<p>
A USB device exits suspend mode when there is bus activity. A USB device may also request the host to exit suspend mode or selective suspend by using electrical signaling to indicate remote wakeup. The ability of a device to signal remote wakeup is optional. If the USB device is capable of remote wakeup signaling, the device must support the ability of the host to enable and disable this capability. When the device is reset, remote wakeup signaling must be disabled.<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 <a class="el" href="struct_x_usb_ps.html">XUsbPs</a> instance of the controller.</td></tr>
</table>
</dl>
<dl compact><dt><b>Returns:</b></dt><dd><ul>
<li>XST_SUCCESS if the USB device has entered Suspend mode successfully</li><li>XST_FAILURE on any error</li></ul>
</dd></dl>
<dl compact><dt><b>Note:</b></dt><dd>None. </dd></dl>
</td>
</tr>
</table>
Copyright @ 1995-2014 Xilinx, Inc. All rights reserved.