Files
luban-lite-t3e-pro/doc/topics/sdk/i2s/i2s_interface.html
2025-01-23 16:37:00 +08:00

218 lines
61 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="表 1 . aic_i2s_set_sysclk 函数原型 static int aic_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) 功能说明 设置 S 模块输出的 mclk 时钟频率 参数定义 dai指向 dai 的指针 | clk_id要设置的时钟 id | ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="concept"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-07-05"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="i2s_interface_design"/><meta name="DC.language" content="zh-CN"/><title>接口设计</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/i2s/i2s_interface.dita"/><meta name="wh-out-relpath" content="topics/sdk/i2s/i2s_interface.html"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
<body id="i2s_interface_design" class="wh_topic_page frmBody">
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
跳转到主要内容
</a>
<header class="navbar navbar-default wh_header">
<div class="container-fluid">
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
<div class="wh_logo_and_publication_title_container">
<div class="wh_logo_and_publication_title">
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
</div>
</div>
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
</div>
</div>
</div>
</header>
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
</div>
<div class="container-fluid" id="wh_topic_container">
<div class="row">
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
<div data-tooltip-position="bottom" class=" wh_breadcrumb "></div>
<div class="wh_right_tools">
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
</div>
</nav>
</div>
<div class="wh_content_area">
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12" id="wh_topic_body">
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
<span class="close-toc-icon-container">
<span class="close-toc-icon"></span>
</span>
</button>
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic concept/concept topic concept" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/i2s/i2s_interface.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">接口设计</h1><div class="date inPage">5 Jul 2024</div><div style="color: gray;">
Read time: 3 minute(s)
</div><div class="- topic/body concept/conbody body conbody"><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_g4x_sh3_d1c" data-ofbid="i2s_interface_design__table_g4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 1</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_set_sysclk</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_g4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_g4x_sh3_d1c__entry__2">static int aic_i2s_set_sysclk(struct snd_soc_dai *dai, int
clk_id, unsigned int freq, int dir)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__2">设置 S 模块输出的 mclk 时钟频率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__2">dai指向 dai 的指针 | clk_id要设置的时钟 id | freq设置的时钟频率 | dir
unused</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_g4x_sh3_d1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_h4x_sh3_d1c" data-ofbid="i2s_interface_design__table_h4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 2</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_set_bclk_ratio</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_h4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_h4x_sh3_d1c__entry__2">static int aic_i2s_set_bclk_ratio(struct snd_soc_dai *dai,
unsigned int ratio)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__2">设置 S 模块 LRCK 与 BCLK 时钟频率的比率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__2">dai指向 dai 的指针 | ratio需要设置的比率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_h4x_sh3_d1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_i4x_sh3_d1c" data-ofbid="i2s_interface_design__table_i4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 3</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_set_fmt</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_i4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_i4x_sh3_d1c__entry__2">static int aic_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int
fmt)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__2">设置 S 模块的格式</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__2">dai指向 dai 的指针 | fmt需要设置的格式</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_i4x_sh3_d1c__entry__2">通过该函数可以设置的格式有: | 1. I2S 的主从模式 | 2. BCLK 和 LRCK 的极性 | 3.
I2S 的数据格式</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_j4x_sh3_d1c" data-ofbid="i2s_interface_design__table_j4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 4</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_set_tdm_slot</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_j4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_j4x_sh3_d1c__entry__2">static int aic_i2s_set_tdm_slot(struct snd_soc_dai *dai,unsigned
int tx_mask, unsigned int rx_mask,int slots, int slot_width)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__2">设置 S 模块 TDM 模式下的通道个数和宽度</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__2">dai指向 dai 的指针 | tx_masktx slot 的 mask | rx_maskrx slot 的 mask |
slots设置的通道个数 | slot_width设置的通道宽度</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_j4x_sh3_d1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_k4x_sh3_d1c" data-ofbid="i2s_interface_design__table_k4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 5</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_hw_params</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_k4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_k4x_sh3_d1c__entry__2">static int aic_i2s_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__2">设置 S 模块硬件参数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__2">substream指向 playback 或 capture 的 substream | params指向硬件参数指针 |
dai指向 dai 的指针</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_k4x_sh3_d1c__entry__2">通过该函数,可以设置采样精度,帧率,以及时钟等参数</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_l4x_sh3_d1c" data-ofbid="i2s_interface_design__table_l4x_sh3_d1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 6</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">aic_i2s_trigger</span></caption><colgroup><col style="width:50%"/><col style="width:50%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_l4x_sh3_d1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_l4x_sh3_d1c__entry__2">static int aic_i2s_trigger(struct snd_pcm_substream *substream,
int cmd, struct snd_soc_dai *dai)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__2">I2S 的触发函数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__2">substream指向 playback 或 capture 的 substream | cmd触发的命令 |
dai指向 dai 的指针</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__2">0执行成功 | -EINVAL参数非法</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_l4x_sh3_d1c__entry__2">通过该函数,可以开始或停止音频的播放或录音</td></tr></tbody></table></div><section class="- topic/section section" id="i2s_interface_design__section_sf5_vkj_g1c" data-ofbid="i2s_interface_design__section_sf5_vkj_g1c"><h2 class="- topic/title title sectiontitle"><strong class="+ topic/ph hi-d/b ph b">driver 层接口设计</strong></h2>
driver 层可以同时实现 playback 和 record 两个功能,主要根据的是音频数据流的方向进行判别。<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_avc_xkj_g1c" data-ofbid="i2s_interface_design__table_avc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 7</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_init</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_avc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_avc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_init(struct rt_audio_device
*audio)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__2">i2s 的初始化函数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__2">audio指向音频设备的指针</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_avc_xkj_g1c__entry__2">RT_EOK执行成功</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_avc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_avc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_bvc_xkj_g1c" data-ofbid="i2s_interface_design__table_bvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 8</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_buffer_info</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_bvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_bvc_xkj_g1c__entry__2">void drv_i2s_sound_buffer_info(struct rt_audio_device *audio,
struct rt_audio_buf_info *info)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__2">获取音频的 buffer 参数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__2">audio指向音频设备的指针 <p class="- topic/p p" data-ofbid="d32110e282__20250121171515">info用于获取 buffer 参数的指针</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__2"></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_bvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_cvc_xkj_g1c" data-ofbid="i2s_interface_design__table_cvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 9</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_start</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_cvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_cvc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_start(struct rt_audio_device *audio,
int stream)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__2">开始音频播放</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__2">audio指向音频设备的指针。<p class="- topic/p p" data-ofbid="d32110e317__20250121171515">stream音频数据流方向</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__2">RT_EOK执行成功。<p class="- topic/p p" data-ofbid="d32110e324__20250121171515">RT_EINVAL参数非法</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_cvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_dvc_xkj_g1c" data-ofbid="i2s_interface_design__table_dvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 10</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_stop</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_dvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_dvc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_stop(struct rt_audio_device *audio,
int stream)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__2">结束音频播放</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__2">audio指向音频设备的指针。<p class="- topic/p p" data-ofbid="d32110e354__20250121171515">stream音频数据流方向</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__2">RT_EOK执行成功。<p class="- topic/p p" data-ofbid="d32110e361__20250121171515">-RT_EINVAL参数非法</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_dvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_evc_xkj_g1c" data-ofbid="i2s_interface_design__table_evc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 11</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_pause</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_evc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_evc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_pause(struct rt_audio_device *audio,
int enable)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__2">暂停/恢复音频播放</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__2">audio指向音频设备的指针。<p class="- topic/p p" data-ofbid="d32110e391__20250121171515">enable音频暂停和恢复播放使能位(0 为恢复,非 0
为暂停)</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_evc_xkj_g1c__entry__2">RT_EOK执行成功</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_evc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_evc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_fvc_xkj_g1c" data-ofbid="i2s_interface_design__table_fvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 12</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_configure</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_fvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_fvc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_configure(struct rt_audio_device
*audio, struct rt_audio_caps *caps)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__1">功能原型</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__2">音频设备配置接口,用于配置采样格式,采样率,通道数等接口</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__2">audio指向音频设备的指针<p class="- topic/p p" data-ofbid="d32110e426__20250121171515">caps指向配置参数的指针</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__2">RT_EOK执行成功<p class="- topic/p p" data-ofbid="d32110e433__20250121171515">-RT_ERROR参数不支持</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_fvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_gvc_xkj_g1c" data-ofbid="i2s_interface_design__table_gvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 13</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_i2s_sound_getcaps</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_gvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_gvc_xkj_g1c__entry__2">rt_err_t drv_i2s_sound_getcaps(struct rt_audio_device *audio,
struct rt_audio_caps *caps)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__2">获取音频设备的参数</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__2">audio指向音频设备的指针 <p class="- topic/p p" data-ofbid="d32110e463__20250121171515">caps指向配置参数的指针</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__2">RT_EOK执行成功。<p class="- topic/p p" data-ofbid="d32110e470__20250121171515">-RT_ERROR参数不支持</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_gvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div><div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_hvc_xkj_g1c" data-ofbid="i2s_interface_design__table_hvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 14</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">drv_audio_get_i2s_sound_avail</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_hvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_hvc_xkj_g1c__entry__2">rt_size_t drv_i2s_sound_get_playback_avail(struct
rt_audio_device *audio)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__2">获取音频缓存的数据大小</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__2">audio指向音频设备的指针</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__2">缓存数据的大小</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_hvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
</section><section class="- topic/section section" id="i2s_interface_design__section_tcm_ykj_g1c" data-ofbid="i2s_interface_design__section_tcm_ykj_g1c"><h2 class="- topic/title title sectiontitle">hal 层接口设计</h2>
<p class="- topic/p p" data-ofbid="d32110e516__20250121171515">hal 层接口也是分 playbackrecord 两部分进行设计,下面以 playback 端的接口进行说明。</p>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_jvc_xkj_g1c" data-ofbid="i2s_interface_design__table_jvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 15</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_protocol_select</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_jvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_jvc_xkj_g1c__entry__2">int hal_i2s_protocol_select(aic_i2s_ctrl *i2s, i2s_protocol_t
protocol)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__2">设置传输协议</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针 <p class="- topic/p p" data-ofbid="d32110e542__20250121171515">protocol传输协议</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__2">0执行成功。<p class="- topic/p p" data-ofbid="d32110e549__20250121171515">-EINVAL参数不支持</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_jvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_kvc_xkj_g1c" data-ofbid="i2s_interface_design__table_kvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 16</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_sample_width_select</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_kvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_kvc_xkj_g1c__entry__2">int hal_i2s_sample_width_select(aic_i2s_ctrl *i2s,
i2s_sample_width_t width)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__2">设置采样通道的位宽</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e580__20250121171515">width通道的位宽</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__2">0执行成功</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_kvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_lvc_xkj_g1c" data-ofbid="i2s_interface_design__table_lvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 17</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_mclk_set</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_lvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_lvc_xkj_g1c__entry__2">int hal_i2s_mclk_set(aic_i2s_ctrl *i2s, i2s_sample_rate_t
sample_rate, uint32_t mclk_nfs)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__2">设置 MCLK 的时钟频率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e616__20250121171515">sample_rate采样率</p><p class="- topic/p p" data-ofbid="d32110e618__20250121171515">mclk_nfsMCLK 的时钟频率</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__2">0执行成功<p class="- topic/p p" data-ofbid="d32110e625__20250121171515">-EINVAL参数不支持</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_lvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_mvc_xkj_g1c" data-ofbid="i2s_interface_design__table_mvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 18</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_polarity_set</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_mvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_mvc_xkj_g1c__entry__2">void hal_i2s_polarity_set(aic_i2s_ctrl *i2s, i2s_polarity_t
polarity)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__2">选择 LRCK 的左右通道极性</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e657__20250121171515">polarityLRCK 的左右通道极性</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__2"></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_mvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_nvc_xkj_g1c" data-ofbid="i2s_interface_design__table_nvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 19</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_sclk_set</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_nvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_nvc_xkj_g1c__entry__2">int hal_i2s_sclk_set(aic_i2s_ctrl *i2s, i2s_sample_rate_t
sample_rate, uint32_t sclk_nfs)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__2">设置 SCLK/LRCK 的比率</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e693__20250121171515">sample_rate采样率</p><p class="- topic/p p" data-ofbid="d32110e695__20250121171515">sclk_nfs需要设置的比率</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__2">0执行成功<p class="- topic/p p" data-ofbid="d32110e702__20250121171515">-EINVAL参数不支持</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_nvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_ovc_xkj_g1c" data-ofbid="i2s_interface_design__table_ovc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 20</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_channel_select</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_ovc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_ovc_xkj_g1c__entry__2">void hal_i2s_channel_select(aic_i2s_ctrl *i2s,
i2s_sound_channel_t channel, i2s_stream_t stream)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__2">I2S 通道数量设置</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e733__20250121171515">channel指向 t 的变量,表示要使用的通道</p><p class="- topic/p p" data-ofbid="d32110e735__20250121171515">stream音频数据流的方向</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__2"></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_ovc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_pvc_xkj_g1c" data-ofbid="i2s_interface_design__table_pvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 21</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_playback_start</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_pvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_pvc_xkj_g1c__entry__2">void hal_i2s_playback_start(aic_i2s_ctrl *i2s, i2s_format_t
*format)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__2">开始播放</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针<p class="- topic/p p" data-ofbid="d32110e771__20250121171515">format指向 t 的指针</p></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__2"></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_pvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
<div class="table-container"><table class="- topic/table table frame-all" id="i2s_interface_design__table_qvc_xkj_g1c" data-ofbid="i2s_interface_design__table_qvc_xkj_g1c" data-cols="2"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label"><span class="table--title-label-number"> 22</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">hal_i2s_playback_stop</span></caption><colgroup><col style="width:25%"/><col style="width:75%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="i2s_interface_design__table_qvc_xkj_g1c__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="i2s_interface_design__table_qvc_xkj_g1c__entry__2">void hal_i2s_playback_stop(aic_i2s_ctrl *i2s)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__2">停止播放</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__2">i2s指向 ctrl 的指针</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__2"></td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="i2s_interface_design__table_qvc_xkj_g1c__entry__2">-</td></tr></tbody></table></div>
</section></div></article></main></div>
</div>
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
<div id="wh_topic_toc_content">
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#i2s_interface_design__section_sf5_vkj_g1c" data-tocid="i2s_interface_design__section_sf5_vkj_g1c"><strong class="+ topic/ph hi-d/b ph b">driver 层接口设计</strong></a></div></li><li class="section-item"><div class="section-title"><a href="#i2s_interface_design__section_tcm_ykj_g1c" data-tocid="i2s_interface_design__section_tcm_ykj_g1c">hal 层接口设计</a></div></li></ul></div>
</div>
</nav>
</div>
</div>
</div>
<footer class="navbar navbar-default wh_footer">
<div class=" footer-container mx-auto ">
<title>footer def</title>
<style><!--
.p1 {
font-family: FangZhengShuSong, Times, serif;
}
.p2 {
font-family: Arial, Helvetica, sans-serif;
}
.p3 {
font-family: "Lucida Console", "Courier New", monospace;
}
--></style>
<div class="webhelp.fragment.footer">
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
</div><div>
<div class="generation_time">
Update Time: 2025-01-21
</div>
</div>
</div>
</footer>
<div id="go2top" class="d-print-none">
<span class="oxy-icon oxy-icon-up"></span>
</div>
<div id="modal_img_large" class="modal">
<span class="close oxy-icon oxy-icon-remove"></span>
<div id="modal_img_container"></div>
<div id="caption"></div>
</div>
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
</body>
</html>