Robert Lopez / CMSIS5
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_fir_init_q31.c Source File

arm_fir_init_q31.c

00001 /* ----------------------------------------------------------------------
00002  * Project:      CMSIS DSP Library
00003  * Title:        arm_fir_init_q31.c
00004  * Description:  Q31 FIR filter initialization function.
00005  *
00006  * $Date:        27. January 2017
00007  * $Revision:    V.1.5.1
00008  *
00009  * Target Processor: Cortex-M cores
00010  * -------------------------------------------------------------------- */
00011 /*
00012  * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
00013  *
00014  * SPDX-License-Identifier: Apache-2.0
00015  *
00016  * Licensed under the Apache License, Version 2.0 (the License); you may
00017  * not use this file except in compliance with the License.
00018  * You may obtain a copy of the License at
00019  *
00020  * www.apache.org/licenses/LICENSE-2.0
00021  *
00022  * Unless required by applicable law or agreed to in writing, software
00023  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00024  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00025  * See the License for the specific language governing permissions and
00026  * limitations under the License.
00027  */
00028 
00029 #include "arm_math.h"
00030 
00031 /**
00032  * @ingroup groupFilters
00033  */
00034 
00035 /**
00036  * @addtogroup FIR
00037  * @{
00038  */
00039 
00040 /**
00041  * @details
00042  *
00043  * @param[in,out] *S points to an instance of the Q31 FIR filter structure.
00044  * @param[in]     numTaps  Number of filter coefficients in the filter.
00045  * @param[in]     *pCoeffs points to the filter coefficients buffer.
00046  * @param[in]     *pState points to the state buffer.
00047  * @param[in]     blockSize number of samples that are processed per call.
00048  * @return        none.
00049  *
00050  * <b>Description:</b>
00051  * \par
00052  * <code>pCoeffs</code> points to the array of filter coefficients stored in time reversed order:
00053  * <pre>
00054  *    {b[numTaps-1], b[numTaps-2], b[N-2], ..., b[1], b[0]}
00055  * </pre>
00056  * \par
00057  * <code>pState</code> points to the array of state variables.
00058  * <code>pState</code> is of length <code>numTaps+blockSize-1</code> samples, where <code>blockSize</code> is the number of input samples processed by each call to <code>arm_fir_q31()</code>.
00059  */
00060 
00061 void arm_fir_init_q31(
00062   arm_fir_instance_q31 * S,
00063   uint16_t numTaps,
00064   q31_t * pCoeffs,
00065   q31_t * pState,
00066   uint32_t blockSize)
00067 {
00068   /* Assign filter taps */
00069   S->numTaps = numTaps;
00070 
00071   /* Assign coefficient pointer */
00072   S->pCoeffs = pCoeffs;
00073 
00074   /* Clear state buffer and state array size is (blockSize + numTaps - 1) */
00075   memset(pState, 0, (blockSize + ((uint32_t) numTaps - 1U)) * sizeof(q31_t));
00076 
00077   /* Assign state pointer */
00078   S->pState = pState;
00079 
00080 }
00081 
00082 /**
00083  * @} end of FIR group
00084  */
00085