]> git.gag.com Git - fw/stlink/blob - exampleF4/CMSIS/DSP_Lib/Source/FilteringFunctions/arm_fir_sparse_init_q31.c
Added all the F4 libraries to the project
[fw/stlink] / exampleF4 / CMSIS / DSP_Lib / Source / FilteringFunctions / arm_fir_sparse_init_q31.c
1 /* ----------------------------------------------------------------------   
2 * Copyright (C) 2010 ARM Limited. All rights reserved.   
3 *   
4 * $Date:        15. July 2011  
5 * $Revision:    V1.0.10  
6 *   
7 * Project:          CMSIS DSP Library   
8 * Title:        arm_fir_sparse_init_q31.c   
9 *   
10 * Description:  Q31 sparse FIR filter initialization function.  
11 *   
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
13 *  
14 * Version 1.0.10 2011/7/15 
15 *    Big Endian support added and Merged M0 and M3/M4 Source code.  
16 *   
17 * Version 1.0.3 2010/11/29  
18 *    Re-organized the CMSIS folders and updated documentation.   
19 *    
20 * Version 1.0.2 2010/11/11   
21 *    Documentation updated.    
22 *   
23 * Version 1.0.1 2010/10/05    
24 *    Production release and review comments incorporated.   
25 *   
26 * Version 1.0.0 2010/09/20    
27 *    Production release and review comments incorporated   
28 *   
29 * Version 0.0.7  2010/06/10    
30 *    Misra-C changes done   
31 * ---------------------------------------------------------------------------*/
32
33 #include "arm_math.h"
34
35 /**   
36  * @ingroup groupFilters   
37  */
38
39 /**   
40  * @addtogroup FIR_Sparse   
41  * @{   
42  */
43
44 /**  
45  * @brief  Initialization function for the Q31 sparse FIR filter.  
46  * @param[in,out] *S         points to an instance of the Q31 sparse FIR structure.  
47  * @param[in]     numTaps    number of nonzero coefficients in the filter.  
48  * @param[in]     *pCoeffs   points to the array of filter coefficients.  
49  * @param[in]     *pState    points to the state buffer.  
50  * @param[in]     *pTapDelay points to the array of offset times.  
51  * @param[in]     maxDelay   maximum offset time supported.  
52  * @param[in]     blockSize  number of samples that will be processed per block.  
53  * @return none  
54  *   
55  * <b>Description:</b>   
56  * \par   
57  * <code>pCoeffs</code> holds the filter coefficients and has length <code>numTaps</code>.   
58  * <code>pState</code> holds the filter's state variables and must be of length   
59  * <code>maxDelay + blockSize</code>, where <code>maxDelay</code>   
60  * is the maximum number of delay line values.   
61  * <code>blockSize</code> is the number of words processed by <code>arm_fir_sparse_q31()</code> function.   
62  */
63
64 void arm_fir_sparse_init_q31(
65   arm_fir_sparse_instance_q31 * S,
66   uint16_t numTaps,
67   q31_t * pCoeffs,
68   q31_t * pState,
69   int32_t * pTapDelay,
70   uint16_t maxDelay,
71   uint32_t blockSize)
72 {
73   /* Assign filter taps */
74   S->numTaps = numTaps;
75
76   /* Assign coefficient pointer */
77   S->pCoeffs = pCoeffs;
78
79   /* Assign TapDelay pointer */
80   S->pTapDelay = pTapDelay;
81
82   /* Assign MaxDelay */
83   S->maxDelay = maxDelay;
84
85   /* reset the stateIndex to 0 */
86   S->stateIndex = 0u;
87
88   /* Clear state buffer and size is always maxDelay + blockSize */
89   memset(pState, 0, (maxDelay + blockSize) * sizeof(q31_t));
90
91   /* Assign state pointer */
92   S->pState = pState;
93
94 }
95
96 /**   
97  * @} end of FIR_Sparse group   
98  */