V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Committer:
emh203
Date:
Mon Jul 28 15:03:15 2014 +0000
Revision:
0:3d9c67d97d6f
1st working commit.   Had to remove arm_bitreversal2.s     arm_cfft_f32.c and arm_rfft_fast_f32.c.    The .s will not assemble.      For now I removed these functions so we could at least have a library for the other functions.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:3d9c67d97d6f 1 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 3 *
emh203 0:3d9c67d97d6f 4 * $Date: 12. March 2014
emh203 0:3d9c67d97d6f 5 * $Revision: V1.4.3
emh203 0:3d9c67d97d6f 6 *
emh203 0:3d9c67d97d6f 7 * Project: CMSIS DSP Library
emh203 0:3d9c67d97d6f 8 * Title: arm_fir_f32.c
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: Floating-point FIR filter processing function.
emh203 0:3d9c67d97d6f 11 *
emh203 0:3d9c67d97d6f 12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emh203 0:3d9c67d97d6f 13 *
emh203 0:3d9c67d97d6f 14 * Redistribution and use in source and binary forms, with or without
emh203 0:3d9c67d97d6f 15 * modification, are permitted provided that the following conditions
emh203 0:3d9c67d97d6f 16 * are met:
emh203 0:3d9c67d97d6f 17 * - Redistributions of source code must retain the above copyright
emh203 0:3d9c67d97d6f 18 * notice, this list of conditions and the following disclaimer.
emh203 0:3d9c67d97d6f 19 * - Redistributions in binary form must reproduce the above copyright
emh203 0:3d9c67d97d6f 20 * notice, this list of conditions and the following disclaimer in
emh203 0:3d9c67d97d6f 21 * the documentation and/or other materials provided with the
emh203 0:3d9c67d97d6f 22 * distribution.
emh203 0:3d9c67d97d6f 23 * - Neither the name of ARM LIMITED nor the names of its contributors
emh203 0:3d9c67d97d6f 24 * may be used to endorse or promote products derived from this
emh203 0:3d9c67d97d6f 25 * software without specific prior written permission.
emh203 0:3d9c67d97d6f 26 *
emh203 0:3d9c67d97d6f 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
emh203 0:3d9c67d97d6f 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
emh203 0:3d9c67d97d6f 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
emh203 0:3d9c67d97d6f 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
emh203 0:3d9c67d97d6f 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
emh203 0:3d9c67d97d6f 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
emh203 0:3d9c67d97d6f 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
emh203 0:3d9c67d97d6f 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emh203 0:3d9c67d97d6f 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
emh203 0:3d9c67d97d6f 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
emh203 0:3d9c67d97d6f 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emh203 0:3d9c67d97d6f 38 * POSSIBILITY OF SUCH DAMAGE.
emh203 0:3d9c67d97d6f 39 * -------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 40
emh203 0:3d9c67d97d6f 41 #include "arm_math.h"
emh203 0:3d9c67d97d6f 42
emh203 0:3d9c67d97d6f 43 /**
emh203 0:3d9c67d97d6f 44 * @ingroup groupFilters
emh203 0:3d9c67d97d6f 45 */
emh203 0:3d9c67d97d6f 46
emh203 0:3d9c67d97d6f 47 /**
emh203 0:3d9c67d97d6f 48 * @defgroup FIR Finite Impulse Response (FIR) Filters
emh203 0:3d9c67d97d6f 49 *
emh203 0:3d9c67d97d6f 50 * This set of functions implements Finite Impulse Response (FIR) filters
emh203 0:3d9c67d97d6f 51 * for Q7, Q15, Q31, and floating-point data types. Fast versions of Q15 and Q31 are also provided.
emh203 0:3d9c67d97d6f 52 * The functions operate on blocks of input and output data and each call to the function processes
emh203 0:3d9c67d97d6f 53 * <code>blockSize</code> samples through the filter. <code>pSrc</code> and
emh203 0:3d9c67d97d6f 54 * <code>pDst</code> points to input and output arrays containing <code>blockSize</code> values.
emh203 0:3d9c67d97d6f 55 *
emh203 0:3d9c67d97d6f 56 * \par Algorithm:
emh203 0:3d9c67d97d6f 57 * The FIR filter algorithm is based upon a sequence of multiply-accumulate (MAC) operations.
emh203 0:3d9c67d97d6f 58 * Each filter coefficient <code>b[n]</code> is multiplied by a state variable which equals a previous input sample <code>x[n]</code>.
emh203 0:3d9c67d97d6f 59 * <pre>
emh203 0:3d9c67d97d6f 60 * y[n] = b[0] * x[n] + b[1] * x[n-1] + b[2] * x[n-2] + ...+ b[numTaps-1] * x[n-numTaps+1]
emh203 0:3d9c67d97d6f 61 * </pre>
emh203 0:3d9c67d97d6f 62 * \par
emh203 0:3d9c67d97d6f 63 * \image html FIR.gif "Finite Impulse Response filter"
emh203 0:3d9c67d97d6f 64 * \par
emh203 0:3d9c67d97d6f 65 * <code>pCoeffs</code> points to a coefficient array of size <code>numTaps</code>.
emh203 0:3d9c67d97d6f 66 * Coefficients are stored in time reversed order.
emh203 0:3d9c67d97d6f 67 * \par
emh203 0:3d9c67d97d6f 68 * <pre>
emh203 0:3d9c67d97d6f 69 * {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
emh203 0:3d9c67d97d6f 70 * </pre>
emh203 0:3d9c67d97d6f 71 * \par
emh203 0:3d9c67d97d6f 72 * <code>pState</code> points to a state array of size <code>numTaps + blockSize - 1</code>.
emh203 0:3d9c67d97d6f 73 * Samples in the state buffer are stored in the following order.
emh203 0:3d9c67d97d6f 74 * \par
emh203 0:3d9c67d97d6f 75 * <pre>
emh203 0:3d9c67d97d6f 76 * {x[n-numTaps+1], x[n-numTaps], x[n-numTaps-1], x[n-numTaps-2]....x[0], x[1], ..., x[blockSize-1]}
emh203 0:3d9c67d97d6f 77 * </pre>
emh203 0:3d9c67d97d6f 78 * \par
emh203 0:3d9c67d97d6f 79 * Note that the length of the state buffer exceeds the length of the coefficient array by <code>blockSize-1</code>.
emh203 0:3d9c67d97d6f 80 * The increased state buffer length allows circular addressing, which is traditionally used in the FIR filters,
emh203 0:3d9c67d97d6f 81 * to be avoided and yields a significant speed improvement.
emh203 0:3d9c67d97d6f 82 * The state variables are updated after each block of data is processed; the coefficients are untouched.
emh203 0:3d9c67d97d6f 83 * \par Instance Structure
emh203 0:3d9c67d97d6f 84 * The coefficients and state variables for a filter are stored together in an instance data structure.
emh203 0:3d9c67d97d6f 85 * A separate instance structure must be defined for each filter.
emh203 0:3d9c67d97d6f 86 * Coefficient arrays may be shared among several instances while state variable arrays cannot be shared.
emh203 0:3d9c67d97d6f 87 * There are separate instance structure declarations for each of the 4 supported data types.
emh203 0:3d9c67d97d6f 88 *
emh203 0:3d9c67d97d6f 89 * \par Initialization Functions
emh203 0:3d9c67d97d6f 90 * There is also an associated initialization function for each data type.
emh203 0:3d9c67d97d6f 91 * The initialization function performs the following operations:
emh203 0:3d9c67d97d6f 92 * - Sets the values of the internal structure fields.
emh203 0:3d9c67d97d6f 93 * - Zeros out the values in the state buffer.
emh203 0:3d9c67d97d6f 94 * To do this manually without calling the init function, assign the follow subfields of the instance structure:
emh203 0:3d9c67d97d6f 95 * numTaps, pCoeffs, pState. Also set all of the values in pState to zero.
emh203 0:3d9c67d97d6f 96 *
emh203 0:3d9c67d97d6f 97 * \par
emh203 0:3d9c67d97d6f 98 * Use of the initialization function is optional.
emh203 0:3d9c67d97d6f 99 * However, if the initialization function is used, then the instance structure cannot be placed into a const data section.
emh203 0:3d9c67d97d6f 100 * To place an instance structure into a const data section, the instance structure must be manually initialized.
emh203 0:3d9c67d97d6f 101 * Set the values in the state buffer to zeros before static initialization.
emh203 0:3d9c67d97d6f 102 * The code below statically initializes each of the 4 different data type filter instance structures
emh203 0:3d9c67d97d6f 103 * <pre>
emh203 0:3d9c67d97d6f 104 *arm_fir_instance_f32 S = {numTaps, pState, pCoeffs};
emh203 0:3d9c67d97d6f 105 *arm_fir_instance_q31 S = {numTaps, pState, pCoeffs};
emh203 0:3d9c67d97d6f 106 *arm_fir_instance_q15 S = {numTaps, pState, pCoeffs};
emh203 0:3d9c67d97d6f 107 *arm_fir_instance_q7 S = {numTaps, pState, pCoeffs};
emh203 0:3d9c67d97d6f 108 * </pre>
emh203 0:3d9c67d97d6f 109 *
emh203 0:3d9c67d97d6f 110 * where <code>numTaps</code> is the number of filter coefficients in the filter; <code>pState</code> is the address of the state buffer;
emh203 0:3d9c67d97d6f 111 * <code>pCoeffs</code> is the address of the coefficient buffer.
emh203 0:3d9c67d97d6f 112 *
emh203 0:3d9c67d97d6f 113 * \par Fixed-Point Behavior
emh203 0:3d9c67d97d6f 114 * Care must be taken when using the fixed-point versions of the FIR filter functions.
emh203 0:3d9c67d97d6f 115 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
emh203 0:3d9c67d97d6f 116 * Refer to the function specific documentation below for usage guidelines.
emh203 0:3d9c67d97d6f 117 */
emh203 0:3d9c67d97d6f 118
emh203 0:3d9c67d97d6f 119 /**
emh203 0:3d9c67d97d6f 120 * @addtogroup FIR
emh203 0:3d9c67d97d6f 121 * @{
emh203 0:3d9c67d97d6f 122 */
emh203 0:3d9c67d97d6f 123
emh203 0:3d9c67d97d6f 124 /**
emh203 0:3d9c67d97d6f 125 *
emh203 0:3d9c67d97d6f 126 * @param[in] *S points to an instance of the floating-point FIR filter structure.
emh203 0:3d9c67d97d6f 127 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 128 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 129 * @param[in] blockSize number of samples to process per call.
emh203 0:3d9c67d97d6f 130 * @return none.
emh203 0:3d9c67d97d6f 131 *
emh203 0:3d9c67d97d6f 132 */
emh203 0:3d9c67d97d6f 133
emh203 0:3d9c67d97d6f 134 #ifndef ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 135
emh203 0:3d9c67d97d6f 136 /* Run the below code for Cortex-M4 and Cortex-M3 */
emh203 0:3d9c67d97d6f 137
emh203 0:3d9c67d97d6f 138 void arm_fir_f32(
emh203 0:3d9c67d97d6f 139 const arm_fir_instance_f32 * S,
emh203 0:3d9c67d97d6f 140 float32_t * pSrc,
emh203 0:3d9c67d97d6f 141 float32_t * pDst,
emh203 0:3d9c67d97d6f 142 uint32_t blockSize)
emh203 0:3d9c67d97d6f 143 {
emh203 0:3d9c67d97d6f 144 float32_t *pState = S->pState; /* State pointer */
emh203 0:3d9c67d97d6f 145 float32_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
emh203 0:3d9c67d97d6f 146 float32_t *pStateCurnt; /* Points to the current sample of the state */
emh203 0:3d9c67d97d6f 147 float32_t *px, *pb; /* Temporary pointers for state and coefficient buffers */
emh203 0:3d9c67d97d6f 148 float32_t acc0, acc1, acc2, acc3, acc4, acc5, acc6, acc7; /* Accumulators */
emh203 0:3d9c67d97d6f 149 float32_t x0, x1, x2, x3, x4, x5, x6, x7, c0; /* Temporary variables to hold state and coefficient values */
emh203 0:3d9c67d97d6f 150 uint32_t numTaps = S->numTaps; /* Number of filter coefficients in the filter */
emh203 0:3d9c67d97d6f 151 uint32_t i, tapCnt, blkCnt; /* Loop counters */
emh203 0:3d9c67d97d6f 152 float32_t p0,p1,p2,p3,p4,p5,p6,p7; /* Temporary product values */
emh203 0:3d9c67d97d6f 153
emh203 0:3d9c67d97d6f 154 /* S->pState points to state array which contains previous frame (numTaps - 1) samples */
emh203 0:3d9c67d97d6f 155 /* pStateCurnt points to the location where the new input data should be written */
emh203 0:3d9c67d97d6f 156 pStateCurnt = &(S->pState[(numTaps - 1u)]);
emh203 0:3d9c67d97d6f 157
emh203 0:3d9c67d97d6f 158 /* Apply loop unrolling and compute 8 output values simultaneously.
emh203 0:3d9c67d97d6f 159 * The variables acc0 ... acc7 hold output values that are being computed:
emh203 0:3d9c67d97d6f 160 *
emh203 0:3d9c67d97d6f 161 * acc0 = b[numTaps-1] * x[n-numTaps-1] + b[numTaps-2] * x[n-numTaps-2] + b[numTaps-3] * x[n-numTaps-3] +...+ b[0] * x[0]
emh203 0:3d9c67d97d6f 162 * acc1 = b[numTaps-1] * x[n-numTaps] + b[numTaps-2] * x[n-numTaps-1] + b[numTaps-3] * x[n-numTaps-2] +...+ b[0] * x[1]
emh203 0:3d9c67d97d6f 163 * acc2 = b[numTaps-1] * x[n-numTaps+1] + b[numTaps-2] * x[n-numTaps] + b[numTaps-3] * x[n-numTaps-1] +...+ b[0] * x[2]
emh203 0:3d9c67d97d6f 164 * acc3 = b[numTaps-1] * x[n-numTaps+2] + b[numTaps-2] * x[n-numTaps+1] + b[numTaps-3] * x[n-numTaps] +...+ b[0] * x[3]
emh203 0:3d9c67d97d6f 165 */
emh203 0:3d9c67d97d6f 166 blkCnt = blockSize >> 3;
emh203 0:3d9c67d97d6f 167
emh203 0:3d9c67d97d6f 168 /* First part of the processing with loop unrolling. Compute 8 outputs at a time.
emh203 0:3d9c67d97d6f 169 ** a second loop below computes the remaining 1 to 7 samples. */
emh203 0:3d9c67d97d6f 170 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 171 {
emh203 0:3d9c67d97d6f 172 /* Copy four new input samples into the state buffer */
emh203 0:3d9c67d97d6f 173 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 174 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 175 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 176 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 177
emh203 0:3d9c67d97d6f 178 /* Set all accumulators to zero */
emh203 0:3d9c67d97d6f 179 acc0 = 0.0f;
emh203 0:3d9c67d97d6f 180 acc1 = 0.0f;
emh203 0:3d9c67d97d6f 181 acc2 = 0.0f;
emh203 0:3d9c67d97d6f 182 acc3 = 0.0f;
emh203 0:3d9c67d97d6f 183 acc4 = 0.0f;
emh203 0:3d9c67d97d6f 184 acc5 = 0.0f;
emh203 0:3d9c67d97d6f 185 acc6 = 0.0f;
emh203 0:3d9c67d97d6f 186 acc7 = 0.0f;
emh203 0:3d9c67d97d6f 187
emh203 0:3d9c67d97d6f 188 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 189 px = pState;
emh203 0:3d9c67d97d6f 190
emh203 0:3d9c67d97d6f 191 /* Initialize coeff pointer */
emh203 0:3d9c67d97d6f 192 pb = (pCoeffs);
emh203 0:3d9c67d97d6f 193
emh203 0:3d9c67d97d6f 194 /* This is separated from the others to avoid
emh203 0:3d9c67d97d6f 195 * a call to __aeabi_memmove which would be slower
emh203 0:3d9c67d97d6f 196 */
emh203 0:3d9c67d97d6f 197 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 198 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 199 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 200 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 201
emh203 0:3d9c67d97d6f 202 /* Read the first seven samples from the state buffer: x[n-numTaps], x[n-numTaps-1], x[n-numTaps-2] */
emh203 0:3d9c67d97d6f 203 x0 = *px++;
emh203 0:3d9c67d97d6f 204 x1 = *px++;
emh203 0:3d9c67d97d6f 205 x2 = *px++;
emh203 0:3d9c67d97d6f 206 x3 = *px++;
emh203 0:3d9c67d97d6f 207 x4 = *px++;
emh203 0:3d9c67d97d6f 208 x5 = *px++;
emh203 0:3d9c67d97d6f 209 x6 = *px++;
emh203 0:3d9c67d97d6f 210
emh203 0:3d9c67d97d6f 211 /* Loop unrolling. Process 8 taps at a time. */
emh203 0:3d9c67d97d6f 212 tapCnt = numTaps >> 3u;
emh203 0:3d9c67d97d6f 213
emh203 0:3d9c67d97d6f 214 /* Loop over the number of taps. Unroll by a factor of 8.
emh203 0:3d9c67d97d6f 215 ** Repeat until we've computed numTaps-8 coefficients. */
emh203 0:3d9c67d97d6f 216 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 217 {
emh203 0:3d9c67d97d6f 218 /* Read the b[numTaps-1] coefficient */
emh203 0:3d9c67d97d6f 219 c0 = *(pb++);
emh203 0:3d9c67d97d6f 220
emh203 0:3d9c67d97d6f 221 /* Read x[n-numTaps-3] sample */
emh203 0:3d9c67d97d6f 222 x7 = *(px++);
emh203 0:3d9c67d97d6f 223
emh203 0:3d9c67d97d6f 224 /* acc0 += b[numTaps-1] * x[n-numTaps] */
emh203 0:3d9c67d97d6f 225 p0 = x0 * c0;
emh203 0:3d9c67d97d6f 226
emh203 0:3d9c67d97d6f 227 /* acc1 += b[numTaps-1] * x[n-numTaps-1] */
emh203 0:3d9c67d97d6f 228 p1 = x1 * c0;
emh203 0:3d9c67d97d6f 229
emh203 0:3d9c67d97d6f 230 /* acc2 += b[numTaps-1] * x[n-numTaps-2] */
emh203 0:3d9c67d97d6f 231 p2 = x2 * c0;
emh203 0:3d9c67d97d6f 232
emh203 0:3d9c67d97d6f 233 /* acc3 += b[numTaps-1] * x[n-numTaps-3] */
emh203 0:3d9c67d97d6f 234 p3 = x3 * c0;
emh203 0:3d9c67d97d6f 235
emh203 0:3d9c67d97d6f 236 /* acc4 += b[numTaps-1] * x[n-numTaps-4] */
emh203 0:3d9c67d97d6f 237 p4 = x4 * c0;
emh203 0:3d9c67d97d6f 238
emh203 0:3d9c67d97d6f 239 /* acc1 += b[numTaps-1] * x[n-numTaps-5] */
emh203 0:3d9c67d97d6f 240 p5 = x5 * c0;
emh203 0:3d9c67d97d6f 241
emh203 0:3d9c67d97d6f 242 /* acc2 += b[numTaps-1] * x[n-numTaps-6] */
emh203 0:3d9c67d97d6f 243 p6 = x6 * c0;
emh203 0:3d9c67d97d6f 244
emh203 0:3d9c67d97d6f 245 /* acc3 += b[numTaps-1] * x[n-numTaps-7] */
emh203 0:3d9c67d97d6f 246 p7 = x7 * c0;
emh203 0:3d9c67d97d6f 247
emh203 0:3d9c67d97d6f 248 /* Read the b[numTaps-2] coefficient */
emh203 0:3d9c67d97d6f 249 c0 = *(pb++);
emh203 0:3d9c67d97d6f 250
emh203 0:3d9c67d97d6f 251 /* Read x[n-numTaps-4] sample */
emh203 0:3d9c67d97d6f 252 x0 = *(px++);
emh203 0:3d9c67d97d6f 253
emh203 0:3d9c67d97d6f 254 acc0 += p0;
emh203 0:3d9c67d97d6f 255 acc1 += p1;
emh203 0:3d9c67d97d6f 256 acc2 += p2;
emh203 0:3d9c67d97d6f 257 acc3 += p3;
emh203 0:3d9c67d97d6f 258 acc4 += p4;
emh203 0:3d9c67d97d6f 259 acc5 += p5;
emh203 0:3d9c67d97d6f 260 acc6 += p6;
emh203 0:3d9c67d97d6f 261 acc7 += p7;
emh203 0:3d9c67d97d6f 262
emh203 0:3d9c67d97d6f 263
emh203 0:3d9c67d97d6f 264 /* Perform the multiply-accumulate */
emh203 0:3d9c67d97d6f 265 p0 = x1 * c0;
emh203 0:3d9c67d97d6f 266 p1 = x2 * c0;
emh203 0:3d9c67d97d6f 267 p2 = x3 * c0;
emh203 0:3d9c67d97d6f 268 p3 = x4 * c0;
emh203 0:3d9c67d97d6f 269 p4 = x5 * c0;
emh203 0:3d9c67d97d6f 270 p5 = x6 * c0;
emh203 0:3d9c67d97d6f 271 p6 = x7 * c0;
emh203 0:3d9c67d97d6f 272 p7 = x0 * c0;
emh203 0:3d9c67d97d6f 273
emh203 0:3d9c67d97d6f 274 /* Read the b[numTaps-3] coefficient */
emh203 0:3d9c67d97d6f 275 c0 = *(pb++);
emh203 0:3d9c67d97d6f 276
emh203 0:3d9c67d97d6f 277 /* Read x[n-numTaps-5] sample */
emh203 0:3d9c67d97d6f 278 x1 = *(px++);
emh203 0:3d9c67d97d6f 279
emh203 0:3d9c67d97d6f 280 acc0 += p0;
emh203 0:3d9c67d97d6f 281 acc1 += p1;
emh203 0:3d9c67d97d6f 282 acc2 += p2;
emh203 0:3d9c67d97d6f 283 acc3 += p3;
emh203 0:3d9c67d97d6f 284 acc4 += p4;
emh203 0:3d9c67d97d6f 285 acc5 += p5;
emh203 0:3d9c67d97d6f 286 acc6 += p6;
emh203 0:3d9c67d97d6f 287 acc7 += p7;
emh203 0:3d9c67d97d6f 288
emh203 0:3d9c67d97d6f 289 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 290 p0 = x2 * c0;
emh203 0:3d9c67d97d6f 291 p1 = x3 * c0;
emh203 0:3d9c67d97d6f 292 p2 = x4 * c0;
emh203 0:3d9c67d97d6f 293 p3 = x5 * c0;
emh203 0:3d9c67d97d6f 294 p4 = x6 * c0;
emh203 0:3d9c67d97d6f 295 p5 = x7 * c0;
emh203 0:3d9c67d97d6f 296 p6 = x0 * c0;
emh203 0:3d9c67d97d6f 297 p7 = x1 * c0;
emh203 0:3d9c67d97d6f 298
emh203 0:3d9c67d97d6f 299 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 300 c0 = *(pb++);
emh203 0:3d9c67d97d6f 301
emh203 0:3d9c67d97d6f 302 /* Read x[n-numTaps-6] sample */
emh203 0:3d9c67d97d6f 303 x2 = *(px++);
emh203 0:3d9c67d97d6f 304
emh203 0:3d9c67d97d6f 305 acc0 += p0;
emh203 0:3d9c67d97d6f 306 acc1 += p1;
emh203 0:3d9c67d97d6f 307 acc2 += p2;
emh203 0:3d9c67d97d6f 308 acc3 += p3;
emh203 0:3d9c67d97d6f 309 acc4 += p4;
emh203 0:3d9c67d97d6f 310 acc5 += p5;
emh203 0:3d9c67d97d6f 311 acc6 += p6;
emh203 0:3d9c67d97d6f 312 acc7 += p7;
emh203 0:3d9c67d97d6f 313
emh203 0:3d9c67d97d6f 314 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 315 p0 = x3 * c0;
emh203 0:3d9c67d97d6f 316 p1 = x4 * c0;
emh203 0:3d9c67d97d6f 317 p2 = x5 * c0;
emh203 0:3d9c67d97d6f 318 p3 = x6 * c0;
emh203 0:3d9c67d97d6f 319 p4 = x7 * c0;
emh203 0:3d9c67d97d6f 320 p5 = x0 * c0;
emh203 0:3d9c67d97d6f 321 p6 = x1 * c0;
emh203 0:3d9c67d97d6f 322 p7 = x2 * c0;
emh203 0:3d9c67d97d6f 323
emh203 0:3d9c67d97d6f 324 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 325 c0 = *(pb++);
emh203 0:3d9c67d97d6f 326
emh203 0:3d9c67d97d6f 327 /* Read x[n-numTaps-6] sample */
emh203 0:3d9c67d97d6f 328 x3 = *(px++);
emh203 0:3d9c67d97d6f 329
emh203 0:3d9c67d97d6f 330 acc0 += p0;
emh203 0:3d9c67d97d6f 331 acc1 += p1;
emh203 0:3d9c67d97d6f 332 acc2 += p2;
emh203 0:3d9c67d97d6f 333 acc3 += p3;
emh203 0:3d9c67d97d6f 334 acc4 += p4;
emh203 0:3d9c67d97d6f 335 acc5 += p5;
emh203 0:3d9c67d97d6f 336 acc6 += p6;
emh203 0:3d9c67d97d6f 337 acc7 += p7;
emh203 0:3d9c67d97d6f 338
emh203 0:3d9c67d97d6f 339 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 340 p0 = x4 * c0;
emh203 0:3d9c67d97d6f 341 p1 = x5 * c0;
emh203 0:3d9c67d97d6f 342 p2 = x6 * c0;
emh203 0:3d9c67d97d6f 343 p3 = x7 * c0;
emh203 0:3d9c67d97d6f 344 p4 = x0 * c0;
emh203 0:3d9c67d97d6f 345 p5 = x1 * c0;
emh203 0:3d9c67d97d6f 346 p6 = x2 * c0;
emh203 0:3d9c67d97d6f 347 p7 = x3 * c0;
emh203 0:3d9c67d97d6f 348
emh203 0:3d9c67d97d6f 349 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 350 c0 = *(pb++);
emh203 0:3d9c67d97d6f 351
emh203 0:3d9c67d97d6f 352 /* Read x[n-numTaps-6] sample */
emh203 0:3d9c67d97d6f 353 x4 = *(px++);
emh203 0:3d9c67d97d6f 354
emh203 0:3d9c67d97d6f 355 acc0 += p0;
emh203 0:3d9c67d97d6f 356 acc1 += p1;
emh203 0:3d9c67d97d6f 357 acc2 += p2;
emh203 0:3d9c67d97d6f 358 acc3 += p3;
emh203 0:3d9c67d97d6f 359 acc4 += p4;
emh203 0:3d9c67d97d6f 360 acc5 += p5;
emh203 0:3d9c67d97d6f 361 acc6 += p6;
emh203 0:3d9c67d97d6f 362 acc7 += p7;
emh203 0:3d9c67d97d6f 363
emh203 0:3d9c67d97d6f 364 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 365 p0 = x5 * c0;
emh203 0:3d9c67d97d6f 366 p1 = x6 * c0;
emh203 0:3d9c67d97d6f 367 p2 = x7 * c0;
emh203 0:3d9c67d97d6f 368 p3 = x0 * c0;
emh203 0:3d9c67d97d6f 369 p4 = x1 * c0;
emh203 0:3d9c67d97d6f 370 p5 = x2 * c0;
emh203 0:3d9c67d97d6f 371 p6 = x3 * c0;
emh203 0:3d9c67d97d6f 372 p7 = x4 * c0;
emh203 0:3d9c67d97d6f 373
emh203 0:3d9c67d97d6f 374 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 375 c0 = *(pb++);
emh203 0:3d9c67d97d6f 376
emh203 0:3d9c67d97d6f 377 /* Read x[n-numTaps-6] sample */
emh203 0:3d9c67d97d6f 378 x5 = *(px++);
emh203 0:3d9c67d97d6f 379
emh203 0:3d9c67d97d6f 380 acc0 += p0;
emh203 0:3d9c67d97d6f 381 acc1 += p1;
emh203 0:3d9c67d97d6f 382 acc2 += p2;
emh203 0:3d9c67d97d6f 383 acc3 += p3;
emh203 0:3d9c67d97d6f 384 acc4 += p4;
emh203 0:3d9c67d97d6f 385 acc5 += p5;
emh203 0:3d9c67d97d6f 386 acc6 += p6;
emh203 0:3d9c67d97d6f 387 acc7 += p7;
emh203 0:3d9c67d97d6f 388
emh203 0:3d9c67d97d6f 389 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 390 p0 = x6 * c0;
emh203 0:3d9c67d97d6f 391 p1 = x7 * c0;
emh203 0:3d9c67d97d6f 392 p2 = x0 * c0;
emh203 0:3d9c67d97d6f 393 p3 = x1 * c0;
emh203 0:3d9c67d97d6f 394 p4 = x2 * c0;
emh203 0:3d9c67d97d6f 395 p5 = x3 * c0;
emh203 0:3d9c67d97d6f 396 p6 = x4 * c0;
emh203 0:3d9c67d97d6f 397 p7 = x5 * c0;
emh203 0:3d9c67d97d6f 398
emh203 0:3d9c67d97d6f 399 /* Read the b[numTaps-4] coefficient */
emh203 0:3d9c67d97d6f 400 c0 = *(pb++);
emh203 0:3d9c67d97d6f 401
emh203 0:3d9c67d97d6f 402 /* Read x[n-numTaps-6] sample */
emh203 0:3d9c67d97d6f 403 x6 = *(px++);
emh203 0:3d9c67d97d6f 404
emh203 0:3d9c67d97d6f 405 acc0 += p0;
emh203 0:3d9c67d97d6f 406 acc1 += p1;
emh203 0:3d9c67d97d6f 407 acc2 += p2;
emh203 0:3d9c67d97d6f 408 acc3 += p3;
emh203 0:3d9c67d97d6f 409 acc4 += p4;
emh203 0:3d9c67d97d6f 410 acc5 += p5;
emh203 0:3d9c67d97d6f 411 acc6 += p6;
emh203 0:3d9c67d97d6f 412 acc7 += p7;
emh203 0:3d9c67d97d6f 413
emh203 0:3d9c67d97d6f 414 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 415 p0 = x7 * c0;
emh203 0:3d9c67d97d6f 416 p1 = x0 * c0;
emh203 0:3d9c67d97d6f 417 p2 = x1 * c0;
emh203 0:3d9c67d97d6f 418 p3 = x2 * c0;
emh203 0:3d9c67d97d6f 419 p4 = x3 * c0;
emh203 0:3d9c67d97d6f 420 p5 = x4 * c0;
emh203 0:3d9c67d97d6f 421 p6 = x5 * c0;
emh203 0:3d9c67d97d6f 422 p7 = x6 * c0;
emh203 0:3d9c67d97d6f 423
emh203 0:3d9c67d97d6f 424 tapCnt--;
emh203 0:3d9c67d97d6f 425
emh203 0:3d9c67d97d6f 426 acc0 += p0;
emh203 0:3d9c67d97d6f 427 acc1 += p1;
emh203 0:3d9c67d97d6f 428 acc2 += p2;
emh203 0:3d9c67d97d6f 429 acc3 += p3;
emh203 0:3d9c67d97d6f 430 acc4 += p4;
emh203 0:3d9c67d97d6f 431 acc5 += p5;
emh203 0:3d9c67d97d6f 432 acc6 += p6;
emh203 0:3d9c67d97d6f 433 acc7 += p7;
emh203 0:3d9c67d97d6f 434 }
emh203 0:3d9c67d97d6f 435
emh203 0:3d9c67d97d6f 436 /* If the filter length is not a multiple of 8, compute the remaining filter taps */
emh203 0:3d9c67d97d6f 437 tapCnt = numTaps % 0x8u;
emh203 0:3d9c67d97d6f 438
emh203 0:3d9c67d97d6f 439 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 440 {
emh203 0:3d9c67d97d6f 441 /* Read coefficients */
emh203 0:3d9c67d97d6f 442 c0 = *(pb++);
emh203 0:3d9c67d97d6f 443
emh203 0:3d9c67d97d6f 444 /* Fetch 1 state variable */
emh203 0:3d9c67d97d6f 445 x7 = *(px++);
emh203 0:3d9c67d97d6f 446
emh203 0:3d9c67d97d6f 447 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 448 p0 = x0 * c0;
emh203 0:3d9c67d97d6f 449 p1 = x1 * c0;
emh203 0:3d9c67d97d6f 450 p2 = x2 * c0;
emh203 0:3d9c67d97d6f 451 p3 = x3 * c0;
emh203 0:3d9c67d97d6f 452 p4 = x4 * c0;
emh203 0:3d9c67d97d6f 453 p5 = x5 * c0;
emh203 0:3d9c67d97d6f 454 p6 = x6 * c0;
emh203 0:3d9c67d97d6f 455 p7 = x7 * c0;
emh203 0:3d9c67d97d6f 456
emh203 0:3d9c67d97d6f 457 /* Reuse the present sample states for next sample */
emh203 0:3d9c67d97d6f 458 x0 = x1;
emh203 0:3d9c67d97d6f 459 x1 = x2;
emh203 0:3d9c67d97d6f 460 x2 = x3;
emh203 0:3d9c67d97d6f 461 x3 = x4;
emh203 0:3d9c67d97d6f 462 x4 = x5;
emh203 0:3d9c67d97d6f 463 x5 = x6;
emh203 0:3d9c67d97d6f 464 x6 = x7;
emh203 0:3d9c67d97d6f 465
emh203 0:3d9c67d97d6f 466 acc0 += p0;
emh203 0:3d9c67d97d6f 467 acc1 += p1;
emh203 0:3d9c67d97d6f 468 acc2 += p2;
emh203 0:3d9c67d97d6f 469 acc3 += p3;
emh203 0:3d9c67d97d6f 470 acc4 += p4;
emh203 0:3d9c67d97d6f 471 acc5 += p5;
emh203 0:3d9c67d97d6f 472 acc6 += p6;
emh203 0:3d9c67d97d6f 473 acc7 += p7;
emh203 0:3d9c67d97d6f 474
emh203 0:3d9c67d97d6f 475 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 476 tapCnt--;
emh203 0:3d9c67d97d6f 477 }
emh203 0:3d9c67d97d6f 478
emh203 0:3d9c67d97d6f 479 /* Advance the state pointer by 8 to process the next group of 8 samples */
emh203 0:3d9c67d97d6f 480 pState = pState + 8;
emh203 0:3d9c67d97d6f 481
emh203 0:3d9c67d97d6f 482 /* The results in the 8 accumulators, store in the destination buffer. */
emh203 0:3d9c67d97d6f 483 *pDst++ = acc0;
emh203 0:3d9c67d97d6f 484 *pDst++ = acc1;
emh203 0:3d9c67d97d6f 485 *pDst++ = acc2;
emh203 0:3d9c67d97d6f 486 *pDst++ = acc3;
emh203 0:3d9c67d97d6f 487 *pDst++ = acc4;
emh203 0:3d9c67d97d6f 488 *pDst++ = acc5;
emh203 0:3d9c67d97d6f 489 *pDst++ = acc6;
emh203 0:3d9c67d97d6f 490 *pDst++ = acc7;
emh203 0:3d9c67d97d6f 491
emh203 0:3d9c67d97d6f 492 blkCnt--;
emh203 0:3d9c67d97d6f 493 }
emh203 0:3d9c67d97d6f 494
emh203 0:3d9c67d97d6f 495 /* If the blockSize is not a multiple of 8, compute any remaining output samples here.
emh203 0:3d9c67d97d6f 496 ** No loop unrolling is used. */
emh203 0:3d9c67d97d6f 497 blkCnt = blockSize % 0x8u;
emh203 0:3d9c67d97d6f 498
emh203 0:3d9c67d97d6f 499 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 500 {
emh203 0:3d9c67d97d6f 501 /* Copy one sample at a time into state buffer */
emh203 0:3d9c67d97d6f 502 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 503
emh203 0:3d9c67d97d6f 504 /* Set the accumulator to zero */
emh203 0:3d9c67d97d6f 505 acc0 = 0.0f;
emh203 0:3d9c67d97d6f 506
emh203 0:3d9c67d97d6f 507 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 508 px = pState;
emh203 0:3d9c67d97d6f 509
emh203 0:3d9c67d97d6f 510 /* Initialize Coefficient pointer */
emh203 0:3d9c67d97d6f 511 pb = (pCoeffs);
emh203 0:3d9c67d97d6f 512
emh203 0:3d9c67d97d6f 513 i = numTaps;
emh203 0:3d9c67d97d6f 514
emh203 0:3d9c67d97d6f 515 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 516 do
emh203 0:3d9c67d97d6f 517 {
emh203 0:3d9c67d97d6f 518 acc0 += *px++ * *pb++;
emh203 0:3d9c67d97d6f 519 i--;
emh203 0:3d9c67d97d6f 520
emh203 0:3d9c67d97d6f 521 } while(i > 0u);
emh203 0:3d9c67d97d6f 522
emh203 0:3d9c67d97d6f 523 /* The result is store in the destination buffer. */
emh203 0:3d9c67d97d6f 524 *pDst++ = acc0;
emh203 0:3d9c67d97d6f 525
emh203 0:3d9c67d97d6f 526 /* Advance state pointer by 1 for the next sample */
emh203 0:3d9c67d97d6f 527 pState = pState + 1;
emh203 0:3d9c67d97d6f 528
emh203 0:3d9c67d97d6f 529 blkCnt--;
emh203 0:3d9c67d97d6f 530 }
emh203 0:3d9c67d97d6f 531
emh203 0:3d9c67d97d6f 532 /* Processing is complete.
emh203 0:3d9c67d97d6f 533 ** Now copy the last numTaps - 1 samples to the start of the state buffer.
emh203 0:3d9c67d97d6f 534 ** This prepares the state buffer for the next function call. */
emh203 0:3d9c67d97d6f 535
emh203 0:3d9c67d97d6f 536 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 537 pStateCurnt = S->pState;
emh203 0:3d9c67d97d6f 538
emh203 0:3d9c67d97d6f 539 tapCnt = (numTaps - 1u) >> 2u;
emh203 0:3d9c67d97d6f 540
emh203 0:3d9c67d97d6f 541 /* copy data */
emh203 0:3d9c67d97d6f 542 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 543 {
emh203 0:3d9c67d97d6f 544 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 545 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 546 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 547 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 548
emh203 0:3d9c67d97d6f 549 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 550 tapCnt--;
emh203 0:3d9c67d97d6f 551 }
emh203 0:3d9c67d97d6f 552
emh203 0:3d9c67d97d6f 553 /* Calculate remaining number of copies */
emh203 0:3d9c67d97d6f 554 tapCnt = (numTaps - 1u) % 0x4u;
emh203 0:3d9c67d97d6f 555
emh203 0:3d9c67d97d6f 556 /* Copy the remaining q31_t data */
emh203 0:3d9c67d97d6f 557 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 558 {
emh203 0:3d9c67d97d6f 559 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 560
emh203 0:3d9c67d97d6f 561 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 562 tapCnt--;
emh203 0:3d9c67d97d6f 563 }
emh203 0:3d9c67d97d6f 564 }
emh203 0:3d9c67d97d6f 565
emh203 0:3d9c67d97d6f 566 #else
emh203 0:3d9c67d97d6f 567
emh203 0:3d9c67d97d6f 568 void arm_fir_f32(
emh203 0:3d9c67d97d6f 569 const arm_fir_instance_f32 * S,
emh203 0:3d9c67d97d6f 570 float32_t * pSrc,
emh203 0:3d9c67d97d6f 571 float32_t * pDst,
emh203 0:3d9c67d97d6f 572 uint32_t blockSize)
emh203 0:3d9c67d97d6f 573 {
emh203 0:3d9c67d97d6f 574 float32_t *pState = S->pState; /* State pointer */
emh203 0:3d9c67d97d6f 575 float32_t *pCoeffs = S->pCoeffs; /* Coefficient pointer */
emh203 0:3d9c67d97d6f 576 float32_t *pStateCurnt; /* Points to the current sample of the state */
emh203 0:3d9c67d97d6f 577 float32_t *px, *pb; /* Temporary pointers for state and coefficient buffers */
emh203 0:3d9c67d97d6f 578 uint32_t numTaps = S->numTaps; /* Number of filter coefficients in the filter */
emh203 0:3d9c67d97d6f 579 uint32_t i, tapCnt, blkCnt; /* Loop counters */
emh203 0:3d9c67d97d6f 580
emh203 0:3d9c67d97d6f 581 /* Run the below code for Cortex-M0 */
emh203 0:3d9c67d97d6f 582
emh203 0:3d9c67d97d6f 583 float32_t acc;
emh203 0:3d9c67d97d6f 584
emh203 0:3d9c67d97d6f 585 /* S->pState points to state array which contains previous frame (numTaps - 1) samples */
emh203 0:3d9c67d97d6f 586 /* pStateCurnt points to the location where the new input data should be written */
emh203 0:3d9c67d97d6f 587 pStateCurnt = &(S->pState[(numTaps - 1u)]);
emh203 0:3d9c67d97d6f 588
emh203 0:3d9c67d97d6f 589 /* Initialize blkCnt with blockSize */
emh203 0:3d9c67d97d6f 590 blkCnt = blockSize;
emh203 0:3d9c67d97d6f 591
emh203 0:3d9c67d97d6f 592 while(blkCnt > 0u)
emh203 0:3d9c67d97d6f 593 {
emh203 0:3d9c67d97d6f 594 /* Copy one sample at a time into state buffer */
emh203 0:3d9c67d97d6f 595 *pStateCurnt++ = *pSrc++;
emh203 0:3d9c67d97d6f 596
emh203 0:3d9c67d97d6f 597 /* Set the accumulator to zero */
emh203 0:3d9c67d97d6f 598 acc = 0.0f;
emh203 0:3d9c67d97d6f 599
emh203 0:3d9c67d97d6f 600 /* Initialize state pointer */
emh203 0:3d9c67d97d6f 601 px = pState;
emh203 0:3d9c67d97d6f 602
emh203 0:3d9c67d97d6f 603 /* Initialize Coefficient pointer */
emh203 0:3d9c67d97d6f 604 pb = pCoeffs;
emh203 0:3d9c67d97d6f 605
emh203 0:3d9c67d97d6f 606 i = numTaps;
emh203 0:3d9c67d97d6f 607
emh203 0:3d9c67d97d6f 608 /* Perform the multiply-accumulates */
emh203 0:3d9c67d97d6f 609 do
emh203 0:3d9c67d97d6f 610 {
emh203 0:3d9c67d97d6f 611 /* acc = b[numTaps-1] * x[n-numTaps-1] + b[numTaps-2] * x[n-numTaps-2] + b[numTaps-3] * x[n-numTaps-3] +...+ b[0] * x[0] */
emh203 0:3d9c67d97d6f 612 acc += *px++ * *pb++;
emh203 0:3d9c67d97d6f 613 i--;
emh203 0:3d9c67d97d6f 614
emh203 0:3d9c67d97d6f 615 } while(i > 0u);
emh203 0:3d9c67d97d6f 616
emh203 0:3d9c67d97d6f 617 /* The result is store in the destination buffer. */
emh203 0:3d9c67d97d6f 618 *pDst++ = acc;
emh203 0:3d9c67d97d6f 619
emh203 0:3d9c67d97d6f 620 /* Advance state pointer by 1 for the next sample */
emh203 0:3d9c67d97d6f 621 pState = pState + 1;
emh203 0:3d9c67d97d6f 622
emh203 0:3d9c67d97d6f 623 blkCnt--;
emh203 0:3d9c67d97d6f 624 }
emh203 0:3d9c67d97d6f 625
emh203 0:3d9c67d97d6f 626 /* Processing is complete.
emh203 0:3d9c67d97d6f 627 ** Now copy the last numTaps - 1 samples to the starting of the state buffer.
emh203 0:3d9c67d97d6f 628 ** This prepares the state buffer for the next function call. */
emh203 0:3d9c67d97d6f 629
emh203 0:3d9c67d97d6f 630 /* Points to the start of the state buffer */
emh203 0:3d9c67d97d6f 631 pStateCurnt = S->pState;
emh203 0:3d9c67d97d6f 632
emh203 0:3d9c67d97d6f 633 /* Copy numTaps number of values */
emh203 0:3d9c67d97d6f 634 tapCnt = numTaps - 1u;
emh203 0:3d9c67d97d6f 635
emh203 0:3d9c67d97d6f 636 /* Copy data */
emh203 0:3d9c67d97d6f 637 while(tapCnt > 0u)
emh203 0:3d9c67d97d6f 638 {
emh203 0:3d9c67d97d6f 639 *pStateCurnt++ = *pState++;
emh203 0:3d9c67d97d6f 640
emh203 0:3d9c67d97d6f 641 /* Decrement the loop counter */
emh203 0:3d9c67d97d6f 642 tapCnt--;
emh203 0:3d9c67d97d6f 643 }
emh203 0:3d9c67d97d6f 644
emh203 0:3d9c67d97d6f 645 }
emh203 0:3d9c67d97d6f 646
emh203 0:3d9c67d97d6f 647 #endif /* #ifndef ARM_MATH_CM0_FAMILY */
emh203 0:3d9c67d97d6f 648
emh203 0:3d9c67d97d6f 649 /**
emh203 0:3d9c67d97d6f 650 * @} end of FIR group
emh203 0:3d9c67d97d6f 651 */