sdk-ameba-v4.0b_without_nda.../doc/api_doc/group__port.html

399 lines
16 KiB
HTML
Raw Permalink Normal View History

2017-10-15 06:36:37 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>SDK4.0: PORT</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SDK4.0
</div>
<div id="projectbrief">This document shows Ameba SDK 4.0 APIs</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li class="current"><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">PORT<div class="ingroups"><a class="el" href="group__sdk.html">Ameba SDK</a> &raquo; <a class="el" href="group__hal.html">HAL</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p>port functions
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Ameba Common</h2></td></tr>
<tr class="memitem:gaed62f3ea86da10b6ac0aa7fa2e599aff"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gaed62f3ea86da10b6ac0aa7fa2e599aff"></a>
typedef struct port_s&#160;</td><td class="memItemRight" valign="bottom"><b>port_t</b></td></tr>
<tr class="separator:gaed62f3ea86da10b6ac0aa7fa2e599aff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga784619347b19886a2418e6db3701ee12"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#ga784619347b19886a2418e6db3701ee12">port_init</a> (port_t *obj, PortName port, int mask, PinDirection dir)</td></tr>
<tr class="memdesc:ga784619347b19886a2418e6db3701ee12"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the GPIO device port, include data direction registers. <a href="#ga784619347b19886a2418e6db3701ee12">More...</a><br /></td></tr>
<tr class="separator:ga784619347b19886a2418e6db3701ee12"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga60e95a3f2bcb6133ea92cbcdaf27d58f"><td class="memItemLeft" align="right" valign="top">PinName&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#ga60e95a3f2bcb6133ea92cbcdaf27d58f">port_pin</a> (PortName port, int pin_n)</td></tr>
<tr class="memdesc:ga60e95a3f2bcb6133ea92cbcdaf27d58f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get GPIO port pin name. <a href="#ga60e95a3f2bcb6133ea92cbcdaf27d58f">More...</a><br /></td></tr>
<tr class="separator:ga60e95a3f2bcb6133ea92cbcdaf27d58f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga42747a84dadf91597e37ddb79e5b63bf"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#ga42747a84dadf91597e37ddb79e5b63bf">port_mode</a> (port_t *obj, PinMode mode)</td></tr>
<tr class="memdesc:ga42747a84dadf91597e37ddb79e5b63bf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configure GPIO port pins pull up/pull down. <a href="#ga42747a84dadf91597e37ddb79e5b63bf">More...</a><br /></td></tr>
<tr class="separator:ga42747a84dadf91597e37ddb79e5b63bf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9f0bcf5a6986c1dc9ce7b99e55622140"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#ga9f0bcf5a6986c1dc9ce7b99e55622140">port_dir</a> (port_t *obj, PinDirection dir)</td></tr>
<tr class="memdesc:ga9f0bcf5a6986c1dc9ce7b99e55622140"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set GPIO port pins data direction. <a href="#ga9f0bcf5a6986c1dc9ce7b99e55622140">More...</a><br /></td></tr>
<tr class="separator:ga9f0bcf5a6986c1dc9ce7b99e55622140"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa7492fe3871b1354b87545fd44335769"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#gaa7492fe3871b1354b87545fd44335769">port_write</a> (port_t *obj, int value)</td></tr>
<tr class="memdesc:gaa7492fe3871b1354b87545fd44335769"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets value to the selected port pins. <a href="#gaa7492fe3871b1354b87545fd44335769">More...</a><br /></td></tr>
<tr class="separator:gaa7492fe3871b1354b87545fd44335769"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5fc1ee6dffaa5f560ee25537a203c3d8"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__port.html#ga5fc1ee6dffaa5f560ee25537a203c3d8">port_read</a> (port_t *obj)</td></tr>
<tr class="memdesc:ga5fc1ee6dffaa5f560ee25537a203c3d8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads the specified gpio port pins. <a href="#ga5fc1ee6dffaa5f560ee25537a203c3d8">More...</a><br /></td></tr>
<tr class="separator:ga5fc1ee6dffaa5f560ee25537a203c3d8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>port functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga9f0bcf5a6986c1dc9ce7b99e55622140"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void port_dir </td>
<td>(</td>
<td class="paramtype">port_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinDirection&#160;</td>
<td class="paramname"><em>dir</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set GPIO port pins data direction. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>gpio port object define in application software. </td></tr>
<tr><td class="paramname">dir</td><td>this parameter can be one of the following values: <ul>
<li>PIN_INPUT: port pins are input </li>
<li>PIN_OUTPUT: port pins are output </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga784619347b19886a2418e6db3701ee12"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void port_init </td>
<td>(</td>
<td class="paramtype">port_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PortName&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>mask</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinDirection&#160;</td>
<td class="paramname"><em>dir</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the GPIO device port, include data direction registers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>gpio port object define in application software. </td></tr>
<tr><td class="paramname">port</td><td>PortName according to pinmux spec, this parameter can be one of the following values: <ul>
<li>PortA: port A, has 32 pins </li>
<li>PortB: port B, has 7 pins </li>
</ul>
</td></tr>
<tr><td class="paramname">mask</td><td>One bit one gpio pin, select one or multiple pins of the specified port. </td></tr>
<tr><td class="paramname">dir</td><td>gpio port direction, this parameter can be one of the following values: <ul>
<li>PIN_INPUT: port pins are input </li>
<li>PIN_OUTPUT: port pins are output </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga42747a84dadf91597e37ddb79e5b63bf"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void port_mode </td>
<td>(</td>
<td class="paramtype">port_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinMode&#160;</td>
<td class="paramname"><em>mode</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Configure GPIO port pins pull up/pull down. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>gpio port object define in application software. </td></tr>
<tr><td class="paramname">mode</td><td>this parameter can be one of the following values: <ul>
<li>PullNone: HighZ </li>
<li>OpenDrain(is OpenDrain output): no pull + OUT + GPIO[gpio_bit] = 0 </li>
<li>PullDown: pull down </li>
<li>PullUp: pull up </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga60e95a3f2bcb6133ea92cbcdaf27d58f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">PinName port_pin </td>
<td>(</td>
<td class="paramtype">PortName&#160;</td>
<td class="paramname"><em>port</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>pin_n</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get GPIO port pin name. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">port</td><td>PortName according to pinmux spec, this parameter can be one of the following values: <ul>
<li>PortA: port number is A, has 32 pins </li>
<li>PortB: port number is B, has 7 pins </li>
</ul>
</td></tr>
<tr><td class="paramname">pin_n</td><td>pin number. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>pin_n must be set to a value in the 0~31 range when PortA </dd>
<dd>
pin_n must be set to a value in the 0~6 range when PortB </dd></dl>
</div>
</div>
<a class="anchor" id="ga5fc1ee6dffaa5f560ee25537a203c3d8"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int port_read </td>
<td>(</td>
<td class="paramtype">port_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Reads the specified gpio port pins. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>gpio port object define in application software. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname"></td><td>state of the specified gpio port pins </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>corresponding bit is 1, pin state is high; corresponding bit is 0, pin state is low </dd></dl>
</div>
</div>
<a class="anchor" id="gaa7492fe3871b1354b87545fd44335769"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void port_write </td>
<td>(</td>
<td class="paramtype">port_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>value</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets value to the selected port pins. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>gpio port object define in application software. </td></tr>
<tr><td class="paramname">value</td><td>One bit one gpio pin, set value to one or multiple pins of the specified port. </td></tr>
</table>
</dd>
</dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">none</td><td></td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>corresponding bit is 1, pin state set to high; corresponding bit is 0, pin state set to low </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.11
</small></address>
</body>
</html>