realtek_ameba_mp_sdk/doc/api_doc/group__i2s.html
2020-07-31 22:16:12 +08:00

784 lines
33 KiB
HTML

<!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: I2S</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="summary">
<a href="#enumval-members">Enumerator</a> </div>
<div class="headertitle">
<div class="title">I2S<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>i2s 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:ga61dadd085c1777f559549e05962b2c9e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga61dadd085c1777f559549e05962b2c9e"></a>enum &#160;</td><td class="memItemRight" valign="bottom">{ <br />
&#160;&#160;<b>SR_8KHZ</b> = I2S_SR_8KHZ,
<b>SR_16KHZ</b> = I2S_SR_16KHZ,
<b>SR_24KHZ</b> = I2S_SR_24KHZ,
<b>SR_32KHZ</b> = I2S_SR_32KHZ,
<br />
&#160;&#160;<b>SR_48KHZ</b> = I2S_SR_48KHZ,
<b>SR_96KHZ</b> = I2S_SR_96KHZ,
<b>SR_7p35KHZ</b> = I2S_SR_7p35KHZ,
<b>SR_14p7KHZ</b> = I2S_SR_14p7KHZ,
<br />
&#160;&#160;<b>SR_22p05KHZ</b> = I2S_SR_22p05KHZ,
<b>SR_29p4KHZ</b> = I2S_SR_29p4KHZ,
<b>SR_44p1KHZ</b> = I2S_SR_44p1KHZ,
<b>SR_88p2KHZ</b> = I2S_SR_88p2KHZ
<br />
}</td></tr>
<tr class="separator:ga61dadd085c1777f559549e05962b2c9e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga726ca809ffd3d67ab4b8476646f26635"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga726ca809ffd3d67ab4b8476646f26635"></a>enum &#160;</td><td class="memItemRight" valign="bottom">{ <b>CH_STEREO</b> = I2S_CH_STEREO,
<b>CH_MONO</b> = I2S_CH_MONO
}</td></tr>
<tr class="separator:ga726ca809ffd3d67ab4b8476646f26635"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga0411cd49bb5b71852cecd93bcbf0ca2d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga0411cd49bb5b71852cecd93bcbf0ca2d"></a>enum &#160;</td><td class="memItemRight" valign="bottom">{ <b>WL_16b</b> = I2S_WL_16,
<b>WL_24b</b> = I2S_WL_24
}</td></tr>
<tr class="separator:ga0411cd49bb5b71852cecd93bcbf0ca2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gabed82baf7f470b522273a3e37c24c600"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="gabed82baf7f470b522273a3e37c24c600"></a>enum &#160;</td><td class="memItemRight" valign="bottom">{ <b>I2S_DIR_RX</b> = I2S_ONLY_RX,
<b>I2S_DIR_TX</b> = I2S_ONLY_TX,
<b>I2S_DIR_TXRX</b> = I2S_TXRX
}</td></tr>
<tr class="separator:gabed82baf7f470b522273a3e37c24c600"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga1dce5ac8f29993c9f64379fe9e546159"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga1dce5ac8f29993c9f64379fe9e546159"></a>
typedef void(*&#160;</td><td class="memItemRight" valign="bottom"><b>i2s_irq_handler</b>) (uint32_t id, char *pbuf)</td></tr>
<tr class="separator:ga1dce5ac8f29993c9f64379fe9e546159"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6642a1e40fe8f355e221ac21cf04dfd6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ga6642a1e40fe8f355e221ac21cf04dfd6"></a>
typedef struct i2s_s&#160;</td><td class="memItemRight" valign="bottom"><b>i2s_t</b></td></tr>
<tr class="separator:ga6642a1e40fe8f355e221ac21cf04dfd6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga321e0dcc5b8c1e84d9100446721f1a31"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga321e0dcc5b8c1e84d9100446721f1a31">i2s_deinit</a> (i2s_t *obj)</td></tr>
<tr class="memdesc:ga321e0dcc5b8c1e84d9100446721f1a31"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deinitializes the I2S device, include function/interrupt/I2S registers. <a href="#ga321e0dcc5b8c1e84d9100446721f1a31">More...</a><br /></td></tr>
<tr class="separator:ga321e0dcc5b8c1e84d9100446721f1a31"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaac2ff4d602d4f65651de034b1c17b7b6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#gaac2ff4d602d4f65651de034b1c17b7b6">i2s_set_dma_buffer</a> (i2s_t *obj, char *tx_buf, char *rx_buf, uint32_t page_num, uint32_t page_size)</td></tr>
<tr class="memdesc:gaac2ff4d602d4f65651de034b1c17b7b6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets page number, page size, page address. <a href="#gaac2ff4d602d4f65651de034b1c17b7b6">More...</a><br /></td></tr>
<tr class="separator:gaac2ff4d602d4f65651de034b1c17b7b6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa1c150e5fa2de45f6c6a6fb238a0496b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#gaa1c150e5fa2de45f6c6a6fb238a0496b">i2s_tx_irq_handler</a> (i2s_t *obj, i2s_irq_handler handler, uint32_t id)</td></tr>
<tr class="memdesc:gaa1c150e5fa2de45f6c6a6fb238a0496b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets TX interrupt handler. <a href="#gaa1c150e5fa2de45f6c6a6fb238a0496b">More...</a><br /></td></tr>
<tr class="separator:gaa1c150e5fa2de45f6c6a6fb238a0496b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga96ff405b0abff00bbcee9b82cb9c2cd7"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga96ff405b0abff00bbcee9b82cb9c2cd7">i2s_rx_irq_handler</a> (i2s_t *obj, i2s_irq_handler handler, uint32_t id)</td></tr>
<tr class="memdesc:ga96ff405b0abff00bbcee9b82cb9c2cd7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets RX interrupt handler. <a href="#ga96ff405b0abff00bbcee9b82cb9c2cd7">More...</a><br /></td></tr>
<tr class="separator:ga96ff405b0abff00bbcee9b82cb9c2cd7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga215ab83c7bcd74a02fb968e4b58093c2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga215ab83c7bcd74a02fb968e4b58093c2">i2s_set_direction</a> (i2s_t *obj, int trx_type)</td></tr>
<tr class="memdesc:ga215ab83c7bcd74a02fb968e4b58093c2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets i2s data transfer direction. <a href="#ga215ab83c7bcd74a02fb968e4b58093c2">More...</a><br /></td></tr>
<tr class="separator:ga215ab83c7bcd74a02fb968e4b58093c2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga4110092c5664a7807d7f3f3208acab0f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga4110092c5664a7807d7f3f3208acab0f">i2s_set_param</a> (i2s_t *obj, int channel_num, int rate, int word_len)</td></tr>
<tr class="memdesc:ga4110092c5664a7807d7f3f3208acab0f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets i2s channel number, sample rate, word length. <a href="#ga4110092c5664a7807d7f3f3208acab0f">More...</a><br /></td></tr>
<tr class="separator:ga4110092c5664a7807d7f3f3208acab0f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaee962b74efaa65f7bd0d3b897010367a"><td class="memItemLeft" align="right" valign="top">int *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#gaee962b74efaa65f7bd0d3b897010367a">i2s_get_tx_page</a> (i2s_t *obj)</td></tr>
<tr class="memdesc:gaee962b74efaa65f7bd0d3b897010367a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets current tx page address. <a href="#gaee962b74efaa65f7bd0d3b897010367a">More...</a><br /></td></tr>
<tr class="separator:gaee962b74efaa65f7bd0d3b897010367a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae1f067937d0622be9ce59ee3c4f52558"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#gae1f067937d0622be9ce59ee3c4f52558">i2s_send_page</a> (i2s_t *obj, uint32_t *pbuf)</td></tr>
<tr class="memdesc:gae1f067937d0622be9ce59ee3c4f52558"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets current tx page own by i2s. <a href="#gae1f067937d0622be9ce59ee3c4f52558">More...</a><br /></td></tr>
<tr class="separator:gae1f067937d0622be9ce59ee3c4f52558"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga29ee082ef52be9597fbe2dbbc07bacc6"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga29ee082ef52be9597fbe2dbbc07bacc6">i2s_recv_page</a> (i2s_t *obj)</td></tr>
<tr class="memdesc:ga29ee082ef52be9597fbe2dbbc07bacc6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets current rx page own by i2s. <a href="#ga29ee082ef52be9597fbe2dbbc07bacc6">More...</a><br /></td></tr>
<tr class="separator:ga29ee082ef52be9597fbe2dbbc07bacc6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga22890a58d7f933f95bcf336391486941"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga22890a58d7f933f95bcf336391486941">i2s_enable</a> (i2s_t *obj)</td></tr>
<tr class="memdesc:ga22890a58d7f933f95bcf336391486941"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enable i2s interrupt and function. <a href="#ga22890a58d7f933f95bcf336391486941">More...</a><br /></td></tr>
<tr class="separator:ga22890a58d7f933f95bcf336391486941"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga91f12ce2864d78b46d95111b8de284c5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga91f12ce2864d78b46d95111b8de284c5">i2s_disable</a> (i2s_t *obj)</td></tr>
<tr class="memdesc:ga91f12ce2864d78b46d95111b8de284c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disable i2s interrupt and function. <a href="#ga91f12ce2864d78b46d95111b8de284c5">More...</a><br /></td></tr>
<tr class="separator:ga91f12ce2864d78b46d95111b8de284c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
Ameba1 Only</h2></td></tr>
<tr class="memitem:ga64b640f74cd24fa1686a0345cbd6b321"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#ga64b640f74cd24fa1686a0345cbd6b321">i2s_init</a> (i2s_t *obj, PinName sck, PinName ws, PinName sd)</td></tr>
<tr class="memdesc:ga64b640f74cd24fa1686a0345cbd6b321"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the I2S device, include clock/function/interrupt/I2S registers. <a href="#ga64b640f74cd24fa1686a0345cbd6b321">More...</a><br /></td></tr>
<tr class="separator:ga64b640f74cd24fa1686a0345cbd6b321"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="member-group"></a>
AmebaZ Only</h2></td></tr>
<tr class="memitem:gadc1fff20e8cde565f4d3e19c43de138a"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__i2s.html#gadc1fff20e8cde565f4d3e19c43de138a">i2s_init</a> (i2s_t *obj, PinName sck, PinName ws, PinName sd_tx, PinName sd_rx, PinName mck)</td></tr>
<tr class="memdesc:gadc1fff20e8cde565f4d3e19c43de138a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initializes the I2S device, include clock/function/interrupt/I2S registers. <a href="#gadc1fff20e8cde565f4d3e19c43de138a">More...</a><br /></td></tr>
<tr class="separator:gadc1fff20e8cde565f4d3e19c43de138a"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>i2s functions </p>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga321e0dcc5b8c1e84d9100446721f1a31"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_deinit </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deinitializes the I2S device, include function/interrupt/I2S registers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s 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">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga91f12ce2864d78b46d95111b8de284c5"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_disable </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Disable i2s interrupt and function. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s 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">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga22890a58d7f933f95bcf336391486941"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_enable </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Enable i2s interrupt and function. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s 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">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="gaee962b74efaa65f7bd0d3b897010367a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int* i2s_get_tx_page </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Gets current tx page address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s 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>address of current tx page or NULL </td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>current page own by cpu, return address of current tx page </dd>
<dd>
current page own by i2s, return NULL </dd></dl>
</div>
</div>
<a class="anchor" id="ga64b640f74cd24fa1686a0345cbd6b321"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_init </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sck</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>ws</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sd</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the I2S device, include clock/function/interrupt/I2S registers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">sck</td><td>Serial clock PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">ws</td><td>Word select PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">sd</td><td>PinName according to pinmux spec. </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="gadc1fff20e8cde565f4d3e19c43de138a"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_init </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sck</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>ws</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sd_tx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>sd_rx</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">PinName&#160;</td>
<td class="paramname"><em>mck</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Initializes the I2S device, include clock/function/interrupt/I2S registers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">sck</td><td>Serial clock PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">ws</td><td>Word select PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">sd_tx</td><td>Tx PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">sd_rx</td><td>Rx PinName according to pinmux spec. </td></tr>
<tr><td class="paramname">mck</td><td>Master clock PinName according to pinmux spec. </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="ga29ee082ef52be9597fbe2dbbc07bacc6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_recv_page </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets current rx page own by i2s. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s 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">none</td><td></td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a class="anchor" id="ga96ff405b0abff00bbcee9b82cb9c2cd7"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_rx_irq_handler </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">i2s_irq_handler&#160;</td>
<td class="paramname"><em>handler</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>id</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets RX interrupt handler. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">handler</td><td>RX interrupt callback function. </td></tr>
<tr><td class="paramname">id</td><td>RX interrupt callback function parameter. </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="gae1f067937d0622be9ce59ee3c4f52558"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_send_page </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *&#160;</td>
<td class="paramname"><em>pbuf</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets current tx page own by i2s. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">pbuf</td><td>tx buffer adderss. </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="ga215ab83c7bcd74a02fb968e4b58093c2"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_set_direction </td>
<td>(</td>
<td class="paramtype">i2s_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>trx_type</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets i2s data transfer direction. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">trx_type</td><td>transfer direction. This parameter can be one of the following values: <ul>
<li>I2S_DIR_RX: Rx receive direction </li>
<li>I2S_DIR_TX: Tx transmission direction </li>
<li>I2S_DIR_TXRX: Tx &amp; Rx bi-direction </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="gaac2ff4d602d4f65651de034b1c17b7b6"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_set_dma_buffer </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>tx_buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">char *&#160;</td>
<td class="paramname"><em>rx_buf</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>page_num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>page_size</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets page number, page size, page address. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">tx_buf</td><td>pointer to the start address of Tx page. </td></tr>
<tr><td class="paramname">rx_buf</td><td>pointer to the start address of Rx page. </td></tr>
<tr><td class="paramname">page_num</td><td>page number. This parameter must be set to a value in the 2~4 range </td></tr>
<tr><td class="paramname">page_size</td><td>page size. This parameter must be set to a value in the 4~16384 bytes range </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="ga4110092c5664a7807d7f3f3208acab0f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_set_param </td>
<td>(</td>
<td class="paramtype">i2s_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>channel_num</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>rate</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int&#160;</td>
<td class="paramname"><em>word_len</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets i2s channel number, sample rate, word length. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">channel_num</td><td>this parameter can be one of the following values: <ul>
<li>CH_STEREO: stereo channel </li>
<li>CH_MONO: mono channel </li>
</ul>
</td></tr>
<tr><td class="paramname">rate</td><td>this parameter can be one of the following values: <ul>
<li>SR_8KHZ: sample rate is 8kHz </li>
<li>SR_16KHZ: sample rate is 16kHz </li>
<li>SR_24KHZ: sample rate is 24kHz </li>
<li>SR_32KHZ: sample rate is 32kHz </li>
<li>SR_48KHZ: sample rate is 48kHz </li>
<li>SR_96KHZ: sample rate is 96kHz </li>
<li>SR_7p35KHZ: sample rate is 7.35kHz </li>
<li>SR_14p7KHZ: sample rate is 14.7kHz </li>
<li>SR_22p05KHZ: sample rate is 22.05kHz </li>
<li>SR_29p4KHZ: sample rate is 29.4kHz </li>
<li>SR_44p1KHZ: sample rate is 44.1kHz </li>
<li>SR_88p2KHZ: sample rate is 88.2kHz </li>
</ul>
</td></tr>
<tr><td class="paramname">word_len</td><td>this parameter can be one of the following values: <ul>
<li>WL_16b: sample bit is 16 bit </li>
<li>WL_24b: sample bit is 24 bit </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="gaa1c150e5fa2de45f6c6a6fb238a0496b"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void i2s_tx_irq_handler </td>
<td>(</td>
<td class="paramtype">i2s_t *&#160;</td>
<td class="paramname"><em>obj</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">i2s_irq_handler&#160;</td>
<td class="paramname"><em>handler</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>id</em>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets TX interrupt handler. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">obj</td><td>i2s object define in application software. </td></tr>
<tr><td class="paramname">handler</td><td>TX interrupt callback function. </td></tr>
<tr><td class="paramname">id</td><td>TX interrupt callback function parameter. </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>
</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>