You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
324 lines
28 KiB
HTML
324 lines
28 KiB
HTML
<!-- HTML header for doxygen 1.9.2-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://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=11"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
|
<title>CMSIS-DSP: arm_fir_example_f32.c</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>
|
|
<script type="text/javascript" src="footer.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.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">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function() { init_search(); });
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
|
jax: ["input/TeX","output/HTML-CSS"],
|
|
});
|
|
</script>
|
|
<script type="text/javascript" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@2/MathJax.js"></script>
|
|
<link href="$extra_stylesheet" rel="stylesheet" type="text/css" />
|
|
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
|
|
<link href="version.css" rel="stylesheet" type="text/css" />
|
|
<script type="text/javascript" src="../version.js"></script>
|
|
</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: 55px;">
|
|
<td id="projectlogo" style="padding: 1.5em;"><img alt="Logo" src="cmsis_logo_white_small.png"/></td>
|
|
<td style="padding-left: 1em; padding-bottom: 1em;padding-top: 1em;">
|
|
<div id="projectname">CMSIS-DSP
|
|
 <span id="projectnumber"><script type="text/javascript">
|
|
<!--
|
|
writeHeader.call(this);
|
|
writeVersionDropdown(this);
|
|
//-->
|
|
</script>
|
|
</span>
|
|
</div>
|
|
<div id="projectbrief">CMSIS DSP Software Library</div>
|
|
</td>
|
|
<!--END !PROJECT_NAME-->
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.9.2 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
var searchBox = new SearchBox("searchBox", "search",'Search','.html');
|
|
/* @license-end */
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Usage and Description</span></a></li>
|
|
<li><a href="modules.html"><span> API Reference</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.svg"
|
|
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.svg" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
|
$(document).ready(function(){initNavTree('arm_fir_example_f32_8c-example.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- 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">arm_fir_example_f32.c</div></div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
<div class="fragment"><div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * Copyright (C) 2010-2012 ARM Limited. All rights reserved.</span></div>
|
|
<div class="line"><span class="comment"> *</span></div>
|
|
<div class="line"><span class="comment">* $Date: 17. January 2013</span></div>
|
|
<div class="line"><span class="comment">* $Revision: V1.4.0</span></div>
|
|
<div class="line"><span class="comment">*</span></div>
|
|
<div class="line"><span class="comment">* Project: CMSIS DSP Library</span></div>
|
|
<div class="line"><span class="comment"> * Title: arm_fir_example_f32.c</span></div>
|
|
<div class="line"><span class="comment"> *</span></div>
|
|
<div class="line"><span class="comment"> * Description: Example code demonstrating how an FIR filter can be used</span></div>
|
|
<div class="line"><span class="comment"> * as a low pass filter.</span></div>
|
|
<div class="line"><span class="comment"> *</span></div>
|
|
<div class="line"><span class="comment"> * Target Processor: Cortex-M4/Cortex-M3</span></div>
|
|
<div class="line"><span class="comment"> *</span></div>
|
|
<div class="line"><span class="comment">* Redistribution and use in source and binary forms, with or without</span></div>
|
|
<div class="line"><span class="comment">* modification, are permitted provided that the following conditions</span></div>
|
|
<div class="line"><span class="comment">* are met:</span></div>
|
|
<div class="line"><span class="comment">* - Redistributions of source code must retain the above copyright</span></div>
|
|
<div class="line"><span class="comment">* notice, this list of conditions and the following disclaimer.</span></div>
|
|
<div class="line"><span class="comment">* - Redistributions in binary form must reproduce the above copyright</span></div>
|
|
<div class="line"><span class="comment">* notice, this list of conditions and the following disclaimer in</span></div>
|
|
<div class="line"><span class="comment">* the documentation and/or other materials provided with the</span></div>
|
|
<div class="line"><span class="comment">* distribution.</span></div>
|
|
<div class="line"><span class="comment">* - Neither the name of ARM LIMITED nor the names of its contributors</span></div>
|
|
<div class="line"><span class="comment">* may be used to endorse or promote products derived from this</span></div>
|
|
<div class="line"><span class="comment">* software without specific prior written permission.</span></div>
|
|
<div class="line"><span class="comment">*</span></div>
|
|
<div class="line"><span class="comment">* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS</span></div>
|
|
<div class="line"><span class="comment">* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT</span></div>
|
|
<div class="line"><span class="comment">* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS</span></div>
|
|
<div class="line"><span class="comment">* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE</span></div>
|
|
<div class="line"><span class="comment">* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,</span></div>
|
|
<div class="line"><span class="comment">* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,</span></div>
|
|
<div class="line"><span class="comment">* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></div>
|
|
<div class="line"><span class="comment">* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER</span></div>
|
|
<div class="line"><span class="comment">* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT</span></div>
|
|
<div class="line"><span class="comment">* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN</span></div>
|
|
<div class="line"><span class="comment">* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE</span></div>
|
|
<div class="line"><span class="comment">* POSSIBILITY OF SUCH DAMAGE.</span></div>
|
|
<div class="line"><span class="comment"> * -------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment">** Include Files</span></div>
|
|
<div class="line"><span class="comment">** ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#include "<a class="code" href="arm__math_8h.html">arm_math.h</a>"</span></div>
|
|
<div class="line"><span class="preprocessor">#include "math_helper.h"</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#if defined(SEMIHOSTING)</span></div>
|
|
<div class="line"><span class="preprocessor">#include <stdio.h></span></div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment">** Macro Defines</span></div>
|
|
<div class="line"><span class="comment">** ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#define TEST_LENGTH_SAMPLES 320</span></div>
|
|
<div class="line"><span class="comment">/*</span></div>
|
|
<div class="line"><span class="comment"></span> </div>
|
|
<div class="line"><span class="comment">This SNR is a bit small. Need to understand why</span></div>
|
|
<div class="line"><span class="comment">this example is not giving better SNR ...</span></div>
|
|
<div class="line"><span class="comment"></span> </div>
|
|
<div class="line"><span class="comment">*/</span></div>
|
|
<div class="line"><span class="preprocessor">#define SNR_THRESHOLD_F32 75.0f</span></div>
|
|
<div class="line"><span class="preprocessor">#define BLOCK_SIZE 32</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)</span></div>
|
|
<div class="line"><span class="comment">/* Must be a multiple of 16 */</span></div>
|
|
<div class="line"><span class="preprocessor">#define NUM_TAPS_ARRAY_SIZE 32</span></div>
|
|
<div class="line"><span class="preprocessor">#else</span></div>
|
|
<div class="line"><span class="preprocessor">#define NUM_TAPS_ARRAY_SIZE 29</span></div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#define NUM_TAPS 29</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* -------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * The input signal and reference output (computed with MATLAB)</span></div>
|
|
<div class="line"><span class="comment"> * are defined externally in arm_fir_lpf_data.c.</span></div>
|
|
<div class="line"><span class="comment"> * ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keyword">extern</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a id="a0" name="a0"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#a143154a165358f0016714cb7f1c83970">testInput_f32_1kHz_15kHz</a>[<a id="a1" name="a1"></a><a class="code hl_define" href="arm__fir__example__f32_8c.html#abc004a7fade488e72310fd96c0a101dc">TEST_LENGTH_SAMPLES</a>];</div>
|
|
<div class="line"><span class="keyword">extern</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a id="a2" name="a2"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#aa7570f8c2e7a3c929d9d32a14a51389f">refOutput</a>[<a class="code hl_define" href="arm__fir__example__f32_8c.html#abc004a7fade488e72310fd96c0a101dc">TEST_LENGTH_SAMPLES</a>];</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* -------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * Declare Test output buffer</span></div>
|
|
<div class="line"><span class="comment"> * ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keyword">static</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a class="code hl_variable" href="arm__dotproduct__example__f32_8c.html#a324833b61eae796082e07d078a67c34f">testOutput</a>[<a class="code hl_define" href="arm__fir__example__f32_8c.html#abc004a7fade488e72310fd96c0a101dc">TEST_LENGTH_SAMPLES</a>];</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* -------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * Declare State buffer of size (numTaps + blockSize - 1)</span></div>
|
|
<div class="line"><span class="comment"> * ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"><span class="preprocessor">#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)</span></div>
|
|
<div class="line"><span class="keyword">static</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a id="a3" name="a3"></a><a class="code hl_variable" href="arm__signal__converge__example__f32_8c.html#a7d9829fb8d2b8bc25b743bbc3604c074">firStateF32</a>[2 * <a id="a4" name="a4"></a><a class="code hl_define" href="arm__fir__example__f32_8c.html#ad51ded0bbd705f02f73fc60c0b721ced">BLOCK_SIZE</a> + <a id="a5" name="a5"></a><a class="code hl_define" href="arm__fir__example__f32_8c.html#a7579d94e0a80fb9d376ea6c7897f73b0">NUM_TAPS</a> - 1];</div>
|
|
<div class="line"><span class="preprocessor">#else</span></div>
|
|
<div class="line"><span class="keyword">static</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a class="code hl_variable" href="arm__signal__converge__example__f32_8c.html#a7d9829fb8d2b8bc25b743bbc3604c074">firStateF32</a>[<a class="code hl_define" href="arm__fir__example__f32_8c.html#ad51ded0bbd705f02f73fc60c0b721ced">BLOCK_SIZE</a> + <a class="code hl_define" href="arm__fir__example__f32_8c.html#a7579d94e0a80fb9d376ea6c7897f73b0">NUM_TAPS</a> - 1];</div>
|
|
<div class="line"><span class="preprocessor">#endif </span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment">** FIR Coefficients buffer generated using fir1() MATLAB function.</span></div>
|
|
<div class="line"><span class="comment">** fir1(28, 6/24)</span></div>
|
|
<div class="line"><span class="comment">** ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"><span class="preprocessor">#if defined(ARM_MATH_MVEF) && !defined(ARM_MATH_AUTOVECTORIZE)</span></div>
|
|
<div class="line"><span class="keyword">const</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a id="a6" name="a6"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#a51bd6e9a6b2f1946b05ad7db85ad5eb9">firCoeffs32</a>[<a id="a7" name="a7"></a><a class="code hl_define" href="arm__fir__example__f32_8c.html#ab5fb93e3377d7fac818babaa4885ed9c">NUM_TAPS_ARRAY_SIZE</a>] = {</div>
|
|
<div class="line"> -0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, +0.0085302217f, -0.0000000000f, -0.0173976984f,</div>
|
|
<div class="line"> -0.0341458607f, -0.0333591565f, +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, +0.2229246956f,</div>
|
|
<div class="line"> +0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f,</div>
|
|
<div class="line"> +0.0080754303f, +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f, 0.0f,0.0f,0.0f</div>
|
|
<div class="line">};</div>
|
|
<div class="line"><span class="preprocessor">#else</span></div>
|
|
<div class="line"><span class="keyword">const</span> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a class="code hl_variable" href="arm__fir__example__f32_8c.html#a51bd6e9a6b2f1946b05ad7db85ad5eb9">firCoeffs32</a>[<a class="code hl_define" href="arm__fir__example__f32_8c.html#ab5fb93e3377d7fac818babaa4885ed9c">NUM_TAPS_ARRAY_SIZE</a>] = {</div>
|
|
<div class="line"> -0.0018225230f, -0.0015879294f, +0.0000000000f, +0.0036977508f, +0.0080754303f, +0.0085302217f, -0.0000000000f, -0.0173976984f,</div>
|
|
<div class="line"> -0.0341458607f, -0.0333591565f, +0.0000000000f, +0.0676308395f, +0.1522061835f, +0.2229246956f, +0.2504960933f, +0.2229246956f,</div>
|
|
<div class="line"> +0.1522061835f, +0.0676308395f, +0.0000000000f, -0.0333591565f, -0.0341458607f, -0.0173976984f, -0.0000000000f, +0.0085302217f,</div>
|
|
<div class="line"> +0.0080754303f, +0.0036977508f, +0.0000000000f, -0.0015879294f, -0.0018225230f</div>
|
|
<div class="line">};</div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* ------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * Global variables for FIR LPF Example</span></div>
|
|
<div class="line"><span class="comment"> * ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line">uint32_t <a id="a8" name="a8"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a> = <a class="code hl_define" href="arm__fir__example__f32_8c.html#ad51ded0bbd705f02f73fc60c0b721ced">BLOCK_SIZE</a>;</div>
|
|
<div class="line">uint32_t <a id="a9" name="a9"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#af7d5613bda9a19b2ccae5d6cb79a22bc">numBlocks</a> = <a class="code hl_define" href="arm__fir__example__f32_8c.html#abc004a7fade488e72310fd96c0a101dc">TEST_LENGTH_SAMPLES</a>/<a class="code hl_define" href="arm__fir__example__f32_8c.html#ad51ded0bbd705f02f73fc60c0b721ced">BLOCK_SIZE</a>;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a id="a10" name="a10"></a><a class="code hl_variable" href="arm__fir__example__f32_8c.html#af06013f588a7003278de222913c9d819">snr</a>;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> * FIR LPF Example</span></div>
|
|
<div class="line"><span class="comment"> * ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line">int32_t <a id="a11" name="a11"></a><a class="code hl_function" href="arm__fir__example__f32_8c.html#a52d2cba30e6946c95578be946ac12a65">main</a>(<span class="keywordtype">void</span>)</div>
|
|
<div class="line">{</div>
|
|
<div class="line"> uint32_t i;</div>
|
|
<div class="line"> <a id="_a12" name="_a12"></a><a class="code hl_struct" href="structarm__fir__instance__f32.html" title="Instance structure for the floating-point FIR filter.">arm_fir_instance_f32</a> S;</div>
|
|
<div class="line"> <a class="code hl_enumeration" href="arm__math__types_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6" title="Error status returned by some functions in the library.">arm_status</a> <a id="a13" name="a13"></a><a class="code hl_variable" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a>;</div>
|
|
<div class="line"> <a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> *inputF32, *outputF32;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">/* Initialize input and output buffer pointers */</span></div>
|
|
<div class="line"> inputF32 = &<a class="code hl_variable" href="arm__fir__example__f32_8c.html#a143154a165358f0016714cb7f1c83970">testInput_f32_1kHz_15kHz</a>[0];</div>
|
|
<div class="line"> outputF32 = &<a class="code hl_variable" href="arm__dotproduct__example__f32_8c.html#a324833b61eae796082e07d078a67c34f">testOutput</a>[0];</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">/* Call FIR init function to initialize the instance structure. */</span></div>
|
|
<div class="line"> <a id="a14" name="a14"></a><a class="code hl_function" href="group__FIR.html#ga5afaa7b8e6735bbc19e582aa9755b0e1" title="Initialization function for the floating-point FIR filter.">arm_fir_init_f32</a>(&S, <a class="code hl_define" href="arm__fir__example__f32_8c.html#a7579d94e0a80fb9d376ea6c7897f73b0">NUM_TAPS</a>, (<a class="code hl_typedef" href="arm__math__types_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> *)&<a class="code hl_variable" href="arm__fir__example__f32_8c.html#a51bd6e9a6b2f1946b05ad7db85ad5eb9">firCoeffs32</a>[0], &<a class="code hl_variable" href="arm__signal__converge__example__f32_8c.html#a7d9829fb8d2b8bc25b743bbc3604c074">firStateF32</a>[0], <a class="code hl_variable" href="arm__fir__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> ** Call the FIR process function for every blockSize samples</span></div>
|
|
<div class="line"><span class="comment"> ** ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="keywordflow">for</span>(i=0; i < <a class="code hl_variable" href="arm__fir__example__f32_8c.html#af7d5613bda9a19b2ccae5d6cb79a22bc">numBlocks</a>; i++)</div>
|
|
<div class="line"> {</div>
|
|
<div class="line"> <a id="a15" name="a15"></a><a class="code hl_function" href="group__FIR.html#ga0cf008f650a75f5e2cf82d10691b64d9" title="Processing function for the floating-point FIR filter.">arm_fir_f32</a>(&S, inputF32 + (i * <a class="code hl_variable" href="arm__fir__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>), outputF32 + (i * <a class="code hl_variable" href="arm__fir__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>), <a class="code hl_variable" href="arm__fir__example__f32_8c.html#ab6558f40a619c2502fbc24c880fd4fb0">blockSize</a>);</div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="comment">/* ----------------------------------------------------------------------</span></div>
|
|
<div class="line"><span class="comment"> ** Compare the generated output against the reference output computed</span></div>
|
|
<div class="line"><span class="comment"> ** in MATLAB.</span></div>
|
|
<div class="line"><span class="comment"> ** ------------------------------------------------------------------- */</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <a class="code hl_variable" href="arm__fir__example__f32_8c.html#af06013f588a7003278de222913c9d819">snr</a> = arm_snr_f32(&<a class="code hl_variable" href="arm__fir__example__f32_8c.html#aa7570f8c2e7a3c929d9d32a14a51389f">refOutput</a>[0], &testOutput[0], <a class="code hl_define" href="arm__fir__example__f32_8c.html#abc004a7fade488e72310fd96c0a101dc">TEST_LENGTH_SAMPLES</a>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <a class="code hl_variable" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a> = (<a class="code hl_variable" href="arm__fir__example__f32_8c.html#af06013f588a7003278de222913c9d819">snr</a> < <a id="a16" name="a16"></a><a class="code hl_define" href="arm__fir__example__f32_8c.html#af7d1dd4deffa8e7ed6429e5dd0fe1812">SNR_THRESHOLD_F32</a>) ? <a id="a17" name="a17"></a><a class="code hl_enumvalue" href="arm__math__types_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6a09457f2be656b35015fd6d36202fa376">ARM_MATH_TEST_FAILURE</a> : <a id="a18" name="a18"></a><a class="code hl_enumvalue" href="arm__math__types_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6a9f8b2a10bd827fb4600e77d455902eb0">ARM_MATH_SUCCESS</a>;</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <span class="keywordflow">if</span> (<a class="code hl_variable" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a> != <a class="code hl_enumvalue" href="arm__math__types_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6a9f8b2a10bd827fb4600e77d455902eb0">ARM_MATH_SUCCESS</a>)</div>
|
|
<div class="line"> {</div>
|
|
<div class="line"><span class="preprocessor">#if defined (SEMIHOSTING)</span></div>
|
|
<div class="line"> printf(<span class="stringliteral">"FAILURE\n"</span>);</div>
|
|
<div class="line"><span class="preprocessor">#else</span></div>
|
|
<div class="line"> <span class="keywordflow">while</span> (1); <span class="comment">/* main function does not return */</span></div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line"> <span class="keywordflow">else</span></div>
|
|
<div class="line"> {</div>
|
|
<div class="line"><span class="preprocessor">#if defined (SEMIHOSTING)</span></div>
|
|
<div class="line"> printf(<span class="stringliteral">"SUCCESS\n"</span>);</div>
|
|
<div class="line"><span class="preprocessor">#else</span></div>
|
|
<div class="line"> <span class="keywordflow">while</span> (1); <span class="comment">/* main function does not return */</span></div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> }</div>
|
|
<div class="line">}</div>
|
|
<div class="line"> </div>
|
|
</div><!-- fragment --> </div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="footer">
|
|
<script type="text/javascript">
|
|
<!--
|
|
writeFooter.call(this);
|
|
//-->
|
|
</script>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|