]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M7_SAMV71_Xplained_IAR_Keil/libchip_samv7/include/cmsis/CMSIS/Include/arm_math.h
Final V8.2.1 release ready for tagging:
[freertos] / FreeRTOS / Demo / CORTEX_M7_SAMV71_Xplained_IAR_Keil / libchip_samv7 / include / cmsis / CMSIS / Include / arm_math.h
1 /* ----------------------------------------------------------------------\r
2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.\r
3 *\r
4 * $Date:        12. March 2014\r
5 * $Revision:    V1.4.3\r
6 *\r
7 * Project:          CMSIS DSP Library\r
8 * Title:            arm_math.h\r
9 *\r
10 * Description:  Public header file for CMSIS DSP Library\r
11 *\r
12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0\r
13 *\r
14 * Redistribution and use in source and binary forms, with or without\r
15 * modification, are permitted provided that the following conditions\r
16 * are met:\r
17 *   - Redistributions of source code must retain the above copyright\r
18 *     notice, this list of conditions and the following disclaimer.\r
19 *   - Redistributions in binary form must reproduce the above copyright\r
20 *     notice, this list of conditions and the following disclaimer in\r
21 *     the documentation and/or other materials provided with the\r
22 *     distribution.\r
23 *   - Neither the name of ARM LIMITED nor the names of its contributors\r
24 *     may be used to endorse or promote products derived from this\r
25 *     software without specific prior written permission.\r
26 *\r
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\r
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\r
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r
34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r
35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
38 * POSSIBILITY OF SUCH DAMAGE.\r
39  * -------------------------------------------------------------------- */\r
40 \r
41 /**\r
42    \mainpage CMSIS DSP Software Library\r
43    *\r
44    * Introduction\r
45    * ------------\r
46    *\r
47    * This user manual describes the CMSIS DSP software library,\r
48    * a suite of common signal processing functions for use on Cortex-M processor based devices.\r
49    *\r
50    * The library is divided into a number of functions each covering a specific category:\r
51    * - Basic math functions\r
52    * - Fast math functions\r
53    * - Complex math functions\r
54    * - Filters\r
55    * - Matrix functions\r
56    * - Transforms\r
57    * - Motor control functions\r
58    * - Statistical functions\r
59    * - Support functions\r
60    * - Interpolation functions\r
61    *\r
62    * The library has separate functions for operating on 8-bit integers, 16-bit integers,\r
63    * 32-bit integer and 32-bit floating-point values.\r
64    *\r
65    * Using the Library\r
66    * ------------\r
67    *\r
68    * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.\r
69    * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)\r
70    * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)\r
71    * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)\r
72    * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)\r
73    * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)\r
74    * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)\r
75    * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)\r
76    * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)\r
77    *\r
78    * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.\r
79    * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single\r
80    * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.\r
81    * Define the appropriate pre processor MACRO ARM_MATH_CM4 or  ARM_MATH_CM3 or\r
82    * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.\r
83    *\r
84    * Examples\r
85    * --------\r
86    *\r
87    * The library ships with a number of examples which demonstrate how to use the library functions.\r
88    *\r
89    * Toolchain Support\r
90    * ------------\r
91    *\r
92    * The library has been developed and tested with MDK-ARM version 4.60.\r
93    * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.\r
94    *\r
95    * Building the Library\r
96    * ------------\r
97    *\r
98    * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.\r
99    * - arm_cortexM_math.uvproj\r
100    *\r
101    *\r
102    * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.\r
103    *\r
104    * Pre-processor Macros\r
105    * ------------\r
106    *\r
107    * Each library project have differant pre-processor macros.\r
108    *\r
109    * - UNALIGNED_SUPPORT_DISABLE:\r
110    *\r
111    * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access\r
112    *\r
113    * - ARM_MATH_BIG_ENDIAN:\r
114    *\r
115    * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.\r
116    *\r
117    * - ARM_MATH_MATRIX_CHECK:\r
118    *\r
119    * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices\r
120    *\r
121    * - ARM_MATH_ROUNDING:\r
122    *\r
123    * Define macro ARM_MATH_ROUNDING for rounding on support functions\r
124    *\r
125    * - ARM_MATH_CMx:\r
126    *\r
127    * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target\r
128    * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.\r
129    *\r
130    * - __FPU_PRESENT:\r
131    *\r
132    * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries\r
133    *\r
134    * <hr>\r
135    * CMSIS-DSP in ARM::CMSIS Pack\r
136    * -----------------------------\r
137    * \r
138    * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:\r
139    * |File/Folder                   |Content                                                                 |\r
140    * |------------------------------|------------------------------------------------------------------------|\r
141    * |\b CMSIS\\Documentation\\DSP  | This documentation                                                     |\r
142    * |\b CMSIS\\DSP_Lib             | Software license agreement (license.txt)                               |\r
143    * |\b CMSIS\\DSP_Lib\\Examples   | Example projects demonstrating the usage of the library functions      |\r
144    * |\b CMSIS\\DSP_Lib\\Source     | Source files for rebuilding the library                                |\r
145    * \r
146    * <hr>\r
147    * Revision History of CMSIS-DSP\r
148    * ------------\r
149    * Please refer to \ref ChangeLog_pg.\r
150    *\r
151    * Copyright Notice\r
152    * ------------\r
153    *\r
154    * Copyright (C) 2010-2014 ARM Limited. All rights reserved.\r
155    */\r
156 \r
157 \r
158 /**\r
159  * @defgroup groupMath Basic Math Functions\r
160  */\r
161 \r
162 /**\r
163  * @defgroup groupFastMath Fast Math Functions\r
164  * This set of functions provides a fast approximation to sine, cosine, and square root.\r
165  * As compared to most of the other functions in the CMSIS math library, the fast math functions\r
166  * operate on individual values and not arrays.\r
167  * There are separate functions for Q15, Q31, and floating-point data.\r
168  *\r
169  */\r
170 \r
171 /**\r
172  * @defgroup groupCmplxMath Complex Math Functions\r
173  * This set of functions operates on complex data vectors.\r
174  * The data in the complex arrays is stored in an interleaved fashion\r
175  * (real, imag, real, imag, ...).\r
176  * In the API functions, the number of samples in a complex array refers\r
177  * to the number of complex values; the array contains twice this number of\r
178  * real values.\r
179  */\r
180 \r
181 /**\r
182  * @defgroup groupFilters Filtering Functions\r
183  */\r
184 \r
185 /**\r
186  * @defgroup groupMatrix Matrix Functions\r
187  *\r
188  * This set of functions provides basic matrix math operations.\r
189  * The functions operate on matrix data structures.  For example,\r
190  * the type\r
191  * definition for the floating-point matrix structure is shown\r
192  * below:\r
193  * <pre>\r
194  *     typedef struct\r
195  *     {\r
196  *       uint16_t numRows;     // number of rows of the matrix.\r
197  *       uint16_t numCols;     // number of columns of the matrix.\r
198  *       float32_t *pData;     // points to the data of the matrix.\r
199  *     } arm_matrix_instance_f32;\r
200  * </pre>\r
201  * There are similar definitions for Q15 and Q31 data types.\r
202  *\r
203  * The structure specifies the size of the matrix and then points to\r
204  * an array of data.  The array is of size <code>numRows X numCols</code>\r
205  * and the values are arranged in row order.  That is, the\r
206  * matrix element (i, j) is stored at:\r
207  * <pre>\r
208  *     pData[i*numCols + j]\r
209  * </pre>\r
210  *\r
211  * \par Init Functions\r
212  * There is an associated initialization function for each type of matrix\r
213  * data structure.\r
214  * The initialization function sets the values of the internal structure fields.\r
215  * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>\r
216  * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types,  respectively.\r
217  *\r
218  * \par\r
219  * Use of the initialization function is optional. However, if initialization function is used\r
220  * then the instance structure cannot be placed into a const data section.\r
221  * To place the instance structure in a const data\r
222  * section, manually initialize the data structure.  For example:\r
223  * <pre>\r
224  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>\r
225  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>\r
226  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>\r
227  * </pre>\r
228  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>\r
229  * specifies the number of columns, and <code>pData</code> points to the\r
230  * data array.\r
231  *\r
232  * \par Size Checking\r
233  * By default all of the matrix functions perform size checking on the input and\r
234  * output matrices.  For example, the matrix addition function verifies that the\r
235  * two input matrices and the output matrix all have the same number of rows and\r
236  * columns.  If the size check fails the functions return:\r
237  * <pre>\r
238  *     ARM_MATH_SIZE_MISMATCH\r
239  * </pre>\r
240  * Otherwise the functions return\r
241  * <pre>\r
242  *     ARM_MATH_SUCCESS\r
243  * </pre>\r
244  * There is some overhead associated with this matrix size checking.\r
245  * The matrix size checking is enabled via the \#define\r
246  * <pre>\r
247  *     ARM_MATH_MATRIX_CHECK\r
248  * </pre>\r
249  * within the library project settings.  By default this macro is defined\r
250  * and size checking is enabled.  By changing the project settings and\r
251  * undefining this macro size checking is eliminated and the functions\r
252  * run a bit faster.  With size checking disabled the functions always\r
253  * return <code>ARM_MATH_SUCCESS</code>.\r
254  */\r
255 \r
256 /**\r
257  * @defgroup groupTransforms Transform Functions\r
258  */\r
259 \r
260 /**\r
261  * @defgroup groupController Controller Functions\r
262  */\r
263 \r
264 /**\r
265  * @defgroup groupStats Statistics Functions\r
266  */\r
267 /**\r
268  * @defgroup groupSupport Support Functions\r
269  */\r
270 \r
271 /**\r
272  * @defgroup groupInterpolation Interpolation Functions\r
273  * These functions perform 1- and 2-dimensional interpolation of data.\r
274  * Linear interpolation is used for 1-dimensional data and\r
275  * bilinear interpolation is used for 2-dimensional data.\r
276  */\r
277 \r
278 /**\r
279  * @defgroup groupExamples Examples\r
280  */\r
281 #ifndef _ARM_MATH_H\r
282 #define _ARM_MATH_H\r
283 \r
284 #define __CMSIS_GENERIC         /* disable NVIC and Systick functions */\r
285 \r
286 #if defined (ARM_MATH_CM4)\r
287 #include "core_cm4.h"\r
288 #elif defined (ARM_MATH_CM3)\r
289 #include "core_cm3.h"\r
290 #elif defined (ARM_MATH_CM0)\r
291 #include "core_cm0.h"\r
292 #define ARM_MATH_CM0_FAMILY\r
293 #elif defined (ARM_MATH_CM0PLUS)\r
294 #include "core_cm0plus.h"\r
295 #define ARM_MATH_CM0_FAMILY\r
296 #else\r
297 #include "ARMCM4.h"\r
298 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."\r
299 #endif\r
300 \r
301 #undef  __CMSIS_GENERIC         /* enable NVIC and Systick functions */\r
302 #include "string.h"\r
303 #include "math.h"\r
304 #ifdef  __cplusplus\r
305 extern "C"\r
306 {\r
307 #endif\r
308 \r
309 \r
310   /**\r
311    * @brief Macros required for reciprocal calculation in Normalized LMS\r
312    */\r
313 \r
314 #define DELTA_Q31                       (0x100)\r
315 #define DELTA_Q15                       0x5\r
316 #define INDEX_MASK                      0x0000003F\r
317 #ifndef PI\r
318 #define PI                                      3.14159265358979f\r
319 #endif\r
320 \r
321   /**\r
322    * @brief Macros required for SINE and COSINE Fast math approximations\r
323    */\r
324 \r
325 #define FAST_MATH_TABLE_SIZE  512\r
326 #define FAST_MATH_Q31_SHIFT   (32 - 10)\r
327 #define FAST_MATH_Q15_SHIFT   (16 - 10)\r
328 #define CONTROLLER_Q31_SHIFT  (32 - 9)\r
329 #define TABLE_SIZE  256\r
330 #define TABLE_SPACING_Q31          0x400000\r
331 #define TABLE_SPACING_Q15          0x80\r
332 \r
333   /**\r
334    * @brief Macros required for SINE and COSINE Controller functions\r
335    */\r
336   /* 1.31(q31) Fixed value of 2/360 */\r
337   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */\r
338 #define INPUT_SPACING                   0xB60B61\r
339 \r
340   /**\r
341    * @brief Macro for Unaligned Support\r
342    */\r
343 #ifndef UNALIGNED_SUPPORT_DISABLE\r
344     #define ALIGN4\r
345 #else\r
346   #if defined  (__GNUC__)\r
347     #define ALIGN4 __attribute__((aligned(4)))\r
348   #else\r
349     #define ALIGN4 __align(4)\r
350   #endif\r
351 #endif  /*      #ifndef UNALIGNED_SUPPORT_DISABLE       */\r
352 \r
353   /**\r
354    * @brief Error status returned by some functions in the library.\r
355    */\r
356 \r
357   typedef enum\r
358   {\r
359     ARM_MATH_SUCCESS = 0,                /**< No error */\r
360     ARM_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */\r
361     ARM_MATH_LENGTH_ERROR = -2,          /**< Length of data buffer is incorrect */\r
362     ARM_MATH_SIZE_MISMATCH = -3,         /**< Size of matrices is not compatible with the operation. */\r
363     ARM_MATH_NANINF = -4,                /**< Not-a-number (NaN) or infinity is generated */\r
364     ARM_MATH_SINGULAR = -5,              /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */\r
365     ARM_MATH_TEST_FAILURE = -6           /**< Test Failed  */\r
366   } arm_status;\r
367 \r
368   /**\r
369    * @brief 8-bit fractional data type in 1.7 format.\r
370    */\r
371   typedef int8_t q7_t;\r
372 \r
373   /**\r
374    * @brief 16-bit fractional data type in 1.15 format.\r
375    */\r
376   typedef int16_t q15_t;\r
377 \r
378   /**\r
379    * @brief 32-bit fractional data type in 1.31 format.\r
380    */\r
381   typedef int32_t q31_t;\r
382 \r
383   /**\r
384    * @brief 64-bit fractional data type in 1.63 format.\r
385    */\r
386   typedef int64_t q63_t;\r
387 \r
388   /**\r
389    * @brief 32-bit floating-point type definition.\r
390    */\r
391   typedef float float32_t;\r
392 \r
393   /**\r
394    * @brief 64-bit floating-point type definition.\r
395    */\r
396   typedef double float64_t;\r
397 \r
398   /**\r
399    * @brief definition to read/write two 16 bit values.\r
400    */\r
401 #if defined __CC_ARM\r
402 #define __SIMD32_TYPE int32_t __packed\r
403 #define CMSIS_UNUSED __attribute__((unused))\r
404 #elif defined __ICCARM__\r
405 #define CMSIS_UNUSED\r
406 #define __SIMD32_TYPE int32_t __packed\r
407 #elif defined __GNUC__\r
408 #define __SIMD32_TYPE int32_t\r
409 #define CMSIS_UNUSED __attribute__((unused))\r
410 #elif defined __CSMC__                  /* Cosmic */\r
411 #define CMSIS_UNUSED\r
412 #define __SIMD32_TYPE int32_t\r
413 #else\r
414 #error Unknown compiler\r
415 #endif\r
416 \r
417 #define __SIMD32(addr)  (*(__SIMD32_TYPE **) & (addr))\r
418 #define __SIMD32_CONST(addr)  ((__SIMD32_TYPE *)(addr))\r
419 \r
420 #define _SIMD32_OFFSET(addr)  (*(__SIMD32_TYPE *)  (addr))\r
421 \r
422 #define __SIMD64(addr)  (*(int64_t **) & (addr))\r
423 \r
424 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)\r
425   /**\r
426    * @brief definition to pack two 16 bit values.\r
427    */\r
428 #define __PKHBT(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0x0000FFFF) | \\r
429                                          (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )\r
430 #define __PKHTB(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0xFFFF0000) | \\r
431                                          (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF)  )\r
432 \r
433 #endif\r
434 \r
435 \r
436    /**\r
437    * @brief definition to pack four 8 bit values.\r
438    */\r
439 #ifndef ARM_MATH_BIG_ENDIAN\r
440 \r
441 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \\r
442                                 (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \\r
443                                                             (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) |     \\r
444                                                             (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )\r
445 #else\r
446 \r
447 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) | \\r
448                                 (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) | \\r
449                                                             (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) |     \\r
450                                                             (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )\r
451 \r
452 #endif\r
453 \r
454 \r
455   /**\r
456    * @brief Clips Q63 to Q31 values.\r
457    */\r
458   static __INLINE q31_t clip_q63_to_q31(\r
459   q63_t x)\r
460   {\r
461     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?\r
462       ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;\r
463   }\r
464 \r
465   /**\r
466    * @brief Clips Q63 to Q15 values.\r
467    */\r
468   static __INLINE q15_t clip_q63_to_q15(\r
469   q63_t x)\r
470   {\r
471     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?\r
472       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);\r
473   }\r
474 \r
475   /**\r
476    * @brief Clips Q31 to Q7 values.\r
477    */\r
478   static __INLINE q7_t clip_q31_to_q7(\r
479   q31_t x)\r
480   {\r
481     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?\r
482       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;\r
483   }\r
484 \r
485   /**\r
486    * @brief Clips Q31 to Q15 values.\r
487    */\r
488   static __INLINE q15_t clip_q31_to_q15(\r
489   q31_t x)\r
490   {\r
491     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?\r
492       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;\r
493   }\r
494 \r
495   /**\r
496    * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.\r
497    */\r
498 \r
499   static __INLINE q63_t mult32x64(\r
500   q63_t x,\r
501   q31_t y)\r
502   {\r
503     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +\r
504             (((q63_t) (x >> 32) * y)));\r
505   }\r
506 \r
507 \r
508 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM   )\r
509 #define __CLZ __clz\r
510 #endif\r
511 \r
512 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )\r
513 \r
514   static __INLINE uint32_t __CLZ(\r
515   q31_t data);\r
516 \r
517 \r
518   static __INLINE uint32_t __CLZ(\r
519   q31_t data)\r
520   {\r
521     uint32_t count = 0;\r
522     uint32_t mask = 0x80000000;\r
523 \r
524     while((data & mask) == 0)\r
525     {\r
526       count += 1u;\r
527       mask = mask >> 1u;\r
528     }\r
529 \r
530     return (count);\r
531 \r
532   }\r
533 \r
534 #endif\r
535 \r
536   /**\r
537    * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.\r
538    */\r
539 \r
540   static __INLINE uint32_t arm_recip_q31(\r
541   q31_t in,\r
542   q31_t * dst,\r
543   q31_t * pRecipTable)\r
544   {\r
545 \r
546     uint32_t out, tempVal;\r
547     uint32_t index, i;\r
548     uint32_t signBits;\r
549 \r
550     if(in > 0)\r
551     {\r
552       signBits = __CLZ(in) - 1;\r
553     }\r
554     else\r
555     {\r
556       signBits = __CLZ(-in) - 1;\r
557     }\r
558 \r
559     /* Convert input sample to 1.31 format */\r
560     in = in << signBits;\r
561 \r
562     /* calculation of index for initial approximated Val */\r
563     index = (uint32_t) (in >> 24u);\r
564     index = (index & INDEX_MASK);\r
565 \r
566     /* 1.31 with exp 1 */\r
567     out = pRecipTable[index];\r
568 \r
569     /* calculation of reciprocal value */\r
570     /* running approximation for two iterations */\r
571     for (i = 0u; i < 2u; i++)\r
572     {\r
573       tempVal = (q31_t) (((q63_t) in * out) >> 31u);\r
574       tempVal = 0x7FFFFFFF - tempVal;\r
575       /*      1.31 with exp 1 */\r
576       //out = (q31_t) (((q63_t) out * tempVal) >> 30u);\r
577       out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);\r
578     }\r
579 \r
580     /* write output */\r
581     *dst = out;\r
582 \r
583     /* return num of signbits of out = 1/in value */\r
584     return (signBits + 1u);\r
585 \r
586   }\r
587 \r
588   /**\r
589    * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.\r
590    */\r
591   static __INLINE uint32_t arm_recip_q15(\r
592   q15_t in,\r
593   q15_t * dst,\r
594   q15_t * pRecipTable)\r
595   {\r
596 \r
597     uint32_t out = 0, tempVal = 0;\r
598     uint32_t index = 0, i = 0;\r
599     uint32_t signBits = 0;\r
600 \r
601     if(in > 0)\r
602     {\r
603       signBits = __CLZ(in) - 17;\r
604     }\r
605     else\r
606     {\r
607       signBits = __CLZ(-in) - 17;\r
608     }\r
609 \r
610     /* Convert input sample to 1.15 format */\r
611     in = in << signBits;\r
612 \r
613     /* calculation of index for initial approximated Val */\r
614     index = in >> 8;\r
615     index = (index & INDEX_MASK);\r
616 \r
617     /*      1.15 with exp 1  */\r
618     out = pRecipTable[index];\r
619 \r
620     /* calculation of reciprocal value */\r
621     /* running approximation for two iterations */\r
622     for (i = 0; i < 2; i++)\r
623     {\r
624       tempVal = (q15_t) (((q31_t) in * out) >> 15);\r
625       tempVal = 0x7FFF - tempVal;\r
626       /*      1.15 with exp 1 */\r
627       out = (q15_t) (((q31_t) out * tempVal) >> 14);\r
628     }\r
629 \r
630     /* write output */\r
631     *dst = out;\r
632 \r
633     /* return num of signbits of out = 1/in value */\r
634     return (signBits + 1);\r
635 \r
636   }\r
637 \r
638 \r
639   /*\r
640    * @brief C custom defined intrinisic function for only M0 processors\r
641    */\r
642 #if defined(ARM_MATH_CM0_FAMILY)\r
643 \r
644   static __INLINE q31_t __SSAT(\r
645   q31_t x,\r
646   uint32_t y)\r
647   {\r
648     int32_t posMax, negMin;\r
649     uint32_t i;\r
650 \r
651     posMax = 1;\r
652     for (i = 0; i < (y - 1); i++)\r
653     {\r
654       posMax = posMax * 2;\r
655     }\r
656 \r
657     if(x > 0)\r
658     {\r
659       posMax = (posMax - 1);\r
660 \r
661       if(x > posMax)\r
662       {\r
663         x = posMax;\r
664       }\r
665     }\r
666     else\r
667     {\r
668       negMin = -posMax;\r
669 \r
670       if(x < negMin)\r
671       {\r
672         x = negMin;\r
673       }\r
674     }\r
675     return (x);\r
676 \r
677 \r
678   }\r
679 \r
680 #endif /* end of ARM_MATH_CM0_FAMILY */\r
681 \r
682 \r
683 \r
684   /*\r
685    * @brief C custom defined intrinsic function for M3 and M0 processors\r
686    */\r
687 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)\r
688 \r
689   /*\r
690    * @brief C custom defined QADD8 for M3 and M0 processors\r
691    */\r
692   static __INLINE q31_t __QADD8(\r
693   q31_t x,\r
694   q31_t y)\r
695   {\r
696 \r
697     q31_t sum;\r
698     q7_t r, s, t, u;\r
699 \r
700     r = (q7_t) x;\r
701     s = (q7_t) y;\r
702 \r
703     r = __SSAT((q31_t) (r + s), 8);\r
704     s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);\r
705     t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);\r
706     u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);\r
707 \r
708     sum =\r
709       (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |\r
710       (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);\r
711 \r
712     return sum;\r
713 \r
714   }\r
715 \r
716   /*\r
717    * @brief C custom defined QSUB8 for M3 and M0 processors\r
718    */\r
719   static __INLINE q31_t __QSUB8(\r
720   q31_t x,\r
721   q31_t y)\r
722   {\r
723 \r
724     q31_t sum;\r
725     q31_t r, s, t, u;\r
726 \r
727     r = (q7_t) x;\r
728     s = (q7_t) y;\r
729 \r
730     r = __SSAT((r - s), 8);\r
731     s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;\r
732     t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;\r
733     u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;\r
734 \r
735     sum =\r
736       (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &\r
737                                                                 0x000000FF);\r
738 \r
739     return sum;\r
740   }\r
741 \r
742   /*\r
743    * @brief C custom defined QADD16 for M3 and M0 processors\r
744    */\r
745 \r
746   /*\r
747    * @brief C custom defined QADD16 for M3 and M0 processors\r
748    */\r
749   static __INLINE q31_t __QADD16(\r
750   q31_t x,\r
751   q31_t y)\r
752   {\r
753 \r
754     q31_t sum;\r
755     q31_t r, s;\r
756 \r
757     r = (q15_t) x;\r
758     s = (q15_t) y;\r
759 \r
760     r = __SSAT(r + s, 16);\r
761     s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;\r
762 \r
763     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
764 \r
765     return sum;\r
766 \r
767   }\r
768 \r
769   /*\r
770    * @brief C custom defined SHADD16 for M3 and M0 processors\r
771    */\r
772   static __INLINE q31_t __SHADD16(\r
773   q31_t x,\r
774   q31_t y)\r
775   {\r
776 \r
777     q31_t sum;\r
778     q31_t r, s;\r
779 \r
780     r = (q15_t) x;\r
781     s = (q15_t) y;\r
782 \r
783     r = ((r >> 1) + (s >> 1));\r
784     s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;\r
785 \r
786     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
787 \r
788     return sum;\r
789 \r
790   }\r
791 \r
792   /*\r
793    * @brief C custom defined QSUB16 for M3 and M0 processors\r
794    */\r
795   static __INLINE q31_t __QSUB16(\r
796   q31_t x,\r
797   q31_t y)\r
798   {\r
799 \r
800     q31_t sum;\r
801     q31_t r, s;\r
802 \r
803     r = (q15_t) x;\r
804     s = (q15_t) y;\r
805 \r
806     r = __SSAT(r - s, 16);\r
807     s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;\r
808 \r
809     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
810 \r
811     return sum;\r
812   }\r
813 \r
814   /*\r
815    * @brief C custom defined SHSUB16 for M3 and M0 processors\r
816    */\r
817   static __INLINE q31_t __SHSUB16(\r
818   q31_t x,\r
819   q31_t y)\r
820   {\r
821 \r
822     q31_t diff;\r
823     q31_t r, s;\r
824 \r
825     r = (q15_t) x;\r
826     s = (q15_t) y;\r
827 \r
828     r = ((r >> 1) - (s >> 1));\r
829     s = (((x >> 17) - (y >> 17)) << 16);\r
830 \r
831     diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
832 \r
833     return diff;\r
834   }\r
835 \r
836   /*\r
837    * @brief C custom defined QASX for M3 and M0 processors\r
838    */\r
839   static __INLINE q31_t __QASX(\r
840   q31_t x,\r
841   q31_t y)\r
842   {\r
843 \r
844     q31_t sum = 0;\r
845 \r
846     sum =\r
847       ((sum +\r
848         clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +\r
849       clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));\r
850 \r
851     return sum;\r
852   }\r
853 \r
854   /*\r
855    * @brief C custom defined SHASX for M3 and M0 processors\r
856    */\r
857   static __INLINE q31_t __SHASX(\r
858   q31_t x,\r
859   q31_t y)\r
860   {\r
861 \r
862     q31_t sum;\r
863     q31_t r, s;\r
864 \r
865     r = (q15_t) x;\r
866     s = (q15_t) y;\r
867 \r
868     r = ((r >> 1) - (y >> 17));\r
869     s = (((x >> 17) + (s >> 1)) << 16);\r
870 \r
871     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
872 \r
873     return sum;\r
874   }\r
875 \r
876 \r
877   /*\r
878    * @brief C custom defined QSAX for M3 and M0 processors\r
879    */\r
880   static __INLINE q31_t __QSAX(\r
881   q31_t x,\r
882   q31_t y)\r
883   {\r
884 \r
885     q31_t sum = 0;\r
886 \r
887     sum =\r
888       ((sum +\r
889         clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +\r
890       clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));\r
891 \r
892     return sum;\r
893   }\r
894 \r
895   /*\r
896    * @brief C custom defined SHSAX for M3 and M0 processors\r
897    */\r
898   static __INLINE q31_t __SHSAX(\r
899   q31_t x,\r
900   q31_t y)\r
901   {\r
902 \r
903     q31_t sum;\r
904     q31_t r, s;\r
905 \r
906     r = (q15_t) x;\r
907     s = (q15_t) y;\r
908 \r
909     r = ((r >> 1) + (y >> 17));\r
910     s = (((x >> 17) - (s >> 1)) << 16);\r
911 \r
912     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);\r
913 \r
914     return sum;\r
915   }\r
916 \r
917   /*\r
918    * @brief C custom defined SMUSDX for M3 and M0 processors\r
919    */\r
920   static __INLINE q31_t __SMUSDX(\r
921   q31_t x,\r
922   q31_t y)\r
923   {\r
924 \r
925     return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -\r
926                      ((q15_t) (x >> 16) * (q15_t) y)));\r
927   }\r
928 \r
929   /*\r
930    * @brief C custom defined SMUADX for M3 and M0 processors\r
931    */\r
932   static __INLINE q31_t __SMUADX(\r
933   q31_t x,\r
934   q31_t y)\r
935   {\r
936 \r
937     return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +\r
938                      ((q15_t) (x >> 16) * (q15_t) y)));\r
939   }\r
940 \r
941   /*\r
942    * @brief C custom defined QADD for M3 and M0 processors\r
943    */\r
944   static __INLINE q31_t __QADD(\r
945   q31_t x,\r
946   q31_t y)\r
947   {\r
948     return clip_q63_to_q31((q63_t) x + y);\r
949   }\r
950 \r
951   /*\r
952    * @brief C custom defined QSUB for M3 and M0 processors\r
953    */\r
954   static __INLINE q31_t __QSUB(\r
955   q31_t x,\r
956   q31_t y)\r
957   {\r
958     return clip_q63_to_q31((q63_t) x - y);\r
959   }\r
960 \r
961   /*\r
962    * @brief C custom defined SMLAD for M3 and M0 processors\r
963    */\r
964   static __INLINE q31_t __SMLAD(\r
965   q31_t x,\r
966   q31_t y,\r
967   q31_t sum)\r
968   {\r
969 \r
970     return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +\r
971             ((q15_t) x * (q15_t) y));\r
972   }\r
973 \r
974   /*\r
975    * @brief C custom defined SMLADX for M3 and M0 processors\r
976    */\r
977   static __INLINE q31_t __SMLADX(\r
978   q31_t x,\r
979   q31_t y,\r
980   q31_t sum)\r
981   {\r
982 \r
983     return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +\r
984             ((q15_t) x * (q15_t) (y >> 16)));\r
985   }\r
986 \r
987   /*\r
988    * @brief C custom defined SMLSDX for M3 and M0 processors\r
989    */\r
990   static __INLINE q31_t __SMLSDX(\r
991   q31_t x,\r
992   q31_t y,\r
993   q31_t sum)\r
994   {\r
995 \r
996     return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +\r
997             ((q15_t) x * (q15_t) (y >> 16)));\r
998   }\r
999 \r
1000   /*\r
1001    * @brief C custom defined SMLALD for M3 and M0 processors\r
1002    */\r
1003   static __INLINE q63_t __SMLALD(\r
1004   q31_t x,\r
1005   q31_t y,\r
1006   q63_t sum)\r
1007   {\r
1008 \r
1009     return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +\r
1010             ((q15_t) x * (q15_t) y));\r
1011   }\r
1012 \r
1013   /*\r
1014    * @brief C custom defined SMLALDX for M3 and M0 processors\r
1015    */\r
1016   static __INLINE q63_t __SMLALDX(\r
1017   q31_t x,\r
1018   q31_t y,\r
1019   q63_t sum)\r
1020   {\r
1021 \r
1022     return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +\r
1023       ((q15_t) x * (q15_t) (y >> 16));\r
1024   }\r
1025 \r
1026   /*\r
1027    * @brief C custom defined SMUAD for M3 and M0 processors\r
1028    */\r
1029   static __INLINE q31_t __SMUAD(\r
1030   q31_t x,\r
1031   q31_t y)\r
1032   {\r
1033 \r
1034     return (((x >> 16) * (y >> 16)) +\r
1035             (((x << 16) >> 16) * ((y << 16) >> 16)));\r
1036   }\r
1037 \r
1038   /*\r
1039    * @brief C custom defined SMUSD for M3 and M0 processors\r
1040    */\r
1041   static __INLINE q31_t __SMUSD(\r
1042   q31_t x,\r
1043   q31_t y)\r
1044   {\r
1045 \r
1046     return (-((x >> 16) * (y >> 16)) +\r
1047             (((x << 16) >> 16) * ((y << 16) >> 16)));\r
1048   }\r
1049 \r
1050 \r
1051   /*\r
1052    * @brief C custom defined SXTB16 for M3 and M0 processors\r
1053    */\r
1054   static __INLINE q31_t __SXTB16(\r
1055   q31_t x)\r
1056   {\r
1057 \r
1058     return ((((x << 24) >> 24) & 0x0000FFFF) |\r
1059             (((x << 8) >> 8) & 0xFFFF0000));\r
1060   }\r
1061 \r
1062 \r
1063 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */\r
1064 \r
1065 \r
1066   /**\r
1067    * @brief Instance structure for the Q7 FIR filter.\r
1068    */\r
1069   typedef struct\r
1070   {\r
1071     uint16_t numTaps;        /**< number of filter coefficients in the filter. */\r
1072     q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1073     q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
1074   } arm_fir_instance_q7;\r
1075 \r
1076   /**\r
1077    * @brief Instance structure for the Q15 FIR filter.\r
1078    */\r
1079   typedef struct\r
1080   {\r
1081     uint16_t numTaps;         /**< number of filter coefficients in the filter. */\r
1082     q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1083     q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
1084   } arm_fir_instance_q15;\r
1085 \r
1086   /**\r
1087    * @brief Instance structure for the Q31 FIR filter.\r
1088    */\r
1089   typedef struct\r
1090   {\r
1091     uint16_t numTaps;         /**< number of filter coefficients in the filter. */\r
1092     q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1093     q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */\r
1094   } arm_fir_instance_q31;\r
1095 \r
1096   /**\r
1097    * @brief Instance structure for the floating-point FIR filter.\r
1098    */\r
1099   typedef struct\r
1100   {\r
1101     uint16_t numTaps;     /**< number of filter coefficients in the filter. */\r
1102     float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
1103     float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */\r
1104   } arm_fir_instance_f32;\r
1105 \r
1106 \r
1107   /**\r
1108    * @brief Processing function for the Q7 FIR filter.\r
1109    * @param[in] *S points to an instance of the Q7 FIR filter structure.\r
1110    * @param[in] *pSrc points to the block of input data.\r
1111    * @param[out] *pDst points to the block of output data.\r
1112    * @param[in] blockSize number of samples to process.\r
1113    * @return none.\r
1114    */\r
1115   void arm_fir_q7(\r
1116   const arm_fir_instance_q7 * S,\r
1117   q7_t * pSrc,\r
1118   q7_t * pDst,\r
1119   uint32_t blockSize);\r
1120 \r
1121 \r
1122   /**\r
1123    * @brief  Initialization function for the Q7 FIR filter.\r
1124    * @param[in,out] *S points to an instance of the Q7 FIR structure.\r
1125    * @param[in] numTaps  Number of filter coefficients in the filter.\r
1126    * @param[in] *pCoeffs points to the filter coefficients.\r
1127    * @param[in] *pState points to the state buffer.\r
1128    * @param[in] blockSize number of samples that are processed.\r
1129    * @return none\r
1130    */\r
1131   void arm_fir_init_q7(\r
1132   arm_fir_instance_q7 * S,\r
1133   uint16_t numTaps,\r
1134   q7_t * pCoeffs,\r
1135   q7_t * pState,\r
1136   uint32_t blockSize);\r
1137 \r
1138 \r
1139   /**\r
1140    * @brief Processing function for the Q15 FIR filter.\r
1141    * @param[in] *S points to an instance of the Q15 FIR structure.\r
1142    * @param[in] *pSrc points to the block of input data.\r
1143    * @param[out] *pDst points to the block of output data.\r
1144    * @param[in] blockSize number of samples to process.\r
1145    * @return none.\r
1146    */\r
1147   void arm_fir_q15(\r
1148   const arm_fir_instance_q15 * S,\r
1149   q15_t * pSrc,\r
1150   q15_t * pDst,\r
1151   uint32_t blockSize);\r
1152 \r
1153   /**\r
1154    * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.\r
1155    * @param[in] *S points to an instance of the Q15 FIR filter structure.\r
1156    * @param[in] *pSrc points to the block of input data.\r
1157    * @param[out] *pDst points to the block of output data.\r
1158    * @param[in] blockSize number of samples to process.\r
1159    * @return none.\r
1160    */\r
1161   void arm_fir_fast_q15(\r
1162   const arm_fir_instance_q15 * S,\r
1163   q15_t * pSrc,\r
1164   q15_t * pDst,\r
1165   uint32_t blockSize);\r
1166 \r
1167   /**\r
1168    * @brief  Initialization function for the Q15 FIR filter.\r
1169    * @param[in,out] *S points to an instance of the Q15 FIR filter structure.\r
1170    * @param[in] numTaps  Number of filter coefficients in the filter. Must be even and greater than or equal to 4.\r
1171    * @param[in] *pCoeffs points to the filter coefficients.\r
1172    * @param[in] *pState points to the state buffer.\r
1173    * @param[in] blockSize number of samples that are processed at a time.\r
1174    * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if\r
1175    * <code>numTaps</code> is not a supported value.\r
1176    */\r
1177 \r
1178   arm_status arm_fir_init_q15(\r
1179   arm_fir_instance_q15 * S,\r
1180   uint16_t numTaps,\r
1181   q15_t * pCoeffs,\r
1182   q15_t * pState,\r
1183   uint32_t blockSize);\r
1184 \r
1185   /**\r
1186    * @brief Processing function for the Q31 FIR filter.\r
1187    * @param[in] *S points to an instance of the Q31 FIR filter structure.\r
1188    * @param[in] *pSrc points to the block of input data.\r
1189    * @param[out] *pDst points to the block of output data.\r
1190    * @param[in] blockSize number of samples to process.\r
1191    * @return none.\r
1192    */\r
1193   void arm_fir_q31(\r
1194   const arm_fir_instance_q31 * S,\r
1195   q31_t * pSrc,\r
1196   q31_t * pDst,\r
1197   uint32_t blockSize);\r
1198 \r
1199   /**\r
1200    * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.\r
1201    * @param[in] *S points to an instance of the Q31 FIR structure.\r
1202    * @param[in] *pSrc points to the block of input data.\r
1203    * @param[out] *pDst points to the block of output data.\r
1204    * @param[in] blockSize number of samples to process.\r
1205    * @return none.\r
1206    */\r
1207   void arm_fir_fast_q31(\r
1208   const arm_fir_instance_q31 * S,\r
1209   q31_t * pSrc,\r
1210   q31_t * pDst,\r
1211   uint32_t blockSize);\r
1212 \r
1213   /**\r
1214    * @brief  Initialization function for the Q31 FIR filter.\r
1215    * @param[in,out] *S points to an instance of the Q31 FIR structure.\r
1216    * @param[in]         numTaps  Number of filter coefficients in the filter.\r
1217    * @param[in]         *pCoeffs points to the filter coefficients.\r
1218    * @param[in]         *pState points to the state buffer.\r
1219    * @param[in]         blockSize number of samples that are processed at a time.\r
1220    * @return            none.\r
1221    */\r
1222   void arm_fir_init_q31(\r
1223   arm_fir_instance_q31 * S,\r
1224   uint16_t numTaps,\r
1225   q31_t * pCoeffs,\r
1226   q31_t * pState,\r
1227   uint32_t blockSize);\r
1228 \r
1229   /**\r
1230    * @brief Processing function for the floating-point FIR filter.\r
1231    * @param[in] *S points to an instance of the floating-point FIR structure.\r
1232    * @param[in] *pSrc points to the block of input data.\r
1233    * @param[out] *pDst points to the block of output data.\r
1234    * @param[in] blockSize number of samples to process.\r
1235    * @return none.\r
1236    */\r
1237   void arm_fir_f32(\r
1238   const arm_fir_instance_f32 * S,\r
1239   float32_t * pSrc,\r
1240   float32_t * pDst,\r
1241   uint32_t blockSize);\r
1242 \r
1243   /**\r
1244    * @brief  Initialization function for the floating-point FIR filter.\r
1245    * @param[in,out] *S points to an instance of the floating-point FIR filter structure.\r
1246    * @param[in]         numTaps  Number of filter coefficients in the filter.\r
1247    * @param[in]         *pCoeffs points to the filter coefficients.\r
1248    * @param[in]         *pState points to the state buffer.\r
1249    * @param[in]         blockSize number of samples that are processed at a time.\r
1250    * @return            none.\r
1251    */\r
1252   void arm_fir_init_f32(\r
1253   arm_fir_instance_f32 * S,\r
1254   uint16_t numTaps,\r
1255   float32_t * pCoeffs,\r
1256   float32_t * pState,\r
1257   uint32_t blockSize);\r
1258 \r
1259 \r
1260   /**\r
1261    * @brief Instance structure for the Q15 Biquad cascade filter.\r
1262    */\r
1263   typedef struct\r
1264   {\r
1265     int8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1266     q15_t *pState;            /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1267     q15_t *pCoeffs;           /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1268     int8_t postShift;         /**< Additional shift, in bits, applied to each output sample. */\r
1269 \r
1270   } arm_biquad_casd_df1_inst_q15;\r
1271 \r
1272 \r
1273   /**\r
1274    * @brief Instance structure for the Q31 Biquad cascade filter.\r
1275    */\r
1276   typedef struct\r
1277   {\r
1278     uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1279     q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1280     q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1281     uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */\r
1282 \r
1283   } arm_biquad_casd_df1_inst_q31;\r
1284 \r
1285   /**\r
1286    * @brief Instance structure for the floating-point Biquad cascade filter.\r
1287    */\r
1288   typedef struct\r
1289   {\r
1290     uint32_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
1291     float32_t *pState;          /**< Points to the array of state coefficients.  The array is of length 4*numStages. */\r
1292     float32_t *pCoeffs;         /**< Points to the array of coefficients.  The array is of length 5*numStages. */\r
1293 \r
1294 \r
1295   } arm_biquad_casd_df1_inst_f32;\r
1296 \r
1297 \r
1298 \r
1299   /**\r
1300    * @brief Processing function for the Q15 Biquad cascade filter.\r
1301    * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.\r
1302    * @param[in]  *pSrc points to the block of input data.\r
1303    * @param[out] *pDst points to the block of output data.\r
1304    * @param[in]  blockSize number of samples to process.\r
1305    * @return     none.\r
1306    */\r
1307 \r
1308   void arm_biquad_cascade_df1_q15(\r
1309   const arm_biquad_casd_df1_inst_q15 * S,\r
1310   q15_t * pSrc,\r
1311   q15_t * pDst,\r
1312   uint32_t blockSize);\r
1313 \r
1314   /**\r
1315    * @brief  Initialization function for the Q15 Biquad cascade filter.\r
1316    * @param[in,out] *S           points to an instance of the Q15 Biquad cascade structure.\r
1317    * @param[in]     numStages    number of 2nd order stages in the filter.\r
1318    * @param[in]     *pCoeffs     points to the filter coefficients.\r
1319    * @param[in]     *pState      points to the state buffer.\r
1320    * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format\r
1321    * @return        none\r
1322    */\r
1323 \r
1324   void arm_biquad_cascade_df1_init_q15(\r
1325   arm_biquad_casd_df1_inst_q15 * S,\r
1326   uint8_t numStages,\r
1327   q15_t * pCoeffs,\r
1328   q15_t * pState,\r
1329   int8_t postShift);\r
1330 \r
1331 \r
1332   /**\r
1333    * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.\r
1334    * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.\r
1335    * @param[in]  *pSrc points to the block of input data.\r
1336    * @param[out] *pDst points to the block of output data.\r
1337    * @param[in]  blockSize number of samples to process.\r
1338    * @return     none.\r
1339    */\r
1340 \r
1341   void arm_biquad_cascade_df1_fast_q15(\r
1342   const arm_biquad_casd_df1_inst_q15 * S,\r
1343   q15_t * pSrc,\r
1344   q15_t * pDst,\r
1345   uint32_t blockSize);\r
1346 \r
1347 \r
1348   /**\r
1349    * @brief Processing function for the Q31 Biquad cascade filter\r
1350    * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.\r
1351    * @param[in]  *pSrc      points to the block of input data.\r
1352    * @param[out] *pDst      points to the block of output data.\r
1353    * @param[in]  blockSize  number of samples to process.\r
1354    * @return     none.\r
1355    */\r
1356 \r
1357   void arm_biquad_cascade_df1_q31(\r
1358   const arm_biquad_casd_df1_inst_q31 * S,\r
1359   q31_t * pSrc,\r
1360   q31_t * pDst,\r
1361   uint32_t blockSize);\r
1362 \r
1363   /**\r
1364    * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.\r
1365    * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.\r
1366    * @param[in]  *pSrc      points to the block of input data.\r
1367    * @param[out] *pDst      points to the block of output data.\r
1368    * @param[in]  blockSize  number of samples to process.\r
1369    * @return     none.\r
1370    */\r
1371 \r
1372   void arm_biquad_cascade_df1_fast_q31(\r
1373   const arm_biquad_casd_df1_inst_q31 * S,\r
1374   q31_t * pSrc,\r
1375   q31_t * pDst,\r
1376   uint32_t blockSize);\r
1377 \r
1378   /**\r
1379    * @brief  Initialization function for the Q31 Biquad cascade filter.\r
1380    * @param[in,out] *S           points to an instance of the Q31 Biquad cascade structure.\r
1381    * @param[in]     numStages      number of 2nd order stages in the filter.\r
1382    * @param[in]     *pCoeffs     points to the filter coefficients.\r
1383    * @param[in]     *pState      points to the state buffer.\r
1384    * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format\r
1385    * @return        none\r
1386    */\r
1387 \r
1388   void arm_biquad_cascade_df1_init_q31(\r
1389   arm_biquad_casd_df1_inst_q31 * S,\r
1390   uint8_t numStages,\r
1391   q31_t * pCoeffs,\r
1392   q31_t * pState,\r
1393   int8_t postShift);\r
1394 \r
1395   /**\r
1396    * @brief Processing function for the floating-point Biquad cascade filter.\r
1397    * @param[in]  *S         points to an instance of the floating-point Biquad cascade structure.\r
1398    * @param[in]  *pSrc      points to the block of input data.\r
1399    * @param[out] *pDst      points to the block of output data.\r
1400    * @param[in]  blockSize  number of samples to process.\r
1401    * @return     none.\r
1402    */\r
1403 \r
1404   void arm_biquad_cascade_df1_f32(\r
1405   const arm_biquad_casd_df1_inst_f32 * S,\r
1406   float32_t * pSrc,\r
1407   float32_t * pDst,\r
1408   uint32_t blockSize);\r
1409 \r
1410   /**\r
1411    * @brief  Initialization function for the floating-point Biquad cascade filter.\r
1412    * @param[in,out] *S           points to an instance of the floating-point Biquad cascade structure.\r
1413    * @param[in]     numStages    number of 2nd order stages in the filter.\r
1414    * @param[in]     *pCoeffs     points to the filter coefficients.\r
1415    * @param[in]     *pState      points to the state buffer.\r
1416    * @return        none\r
1417    */\r
1418 \r
1419   void arm_biquad_cascade_df1_init_f32(\r
1420   arm_biquad_casd_df1_inst_f32 * S,\r
1421   uint8_t numStages,\r
1422   float32_t * pCoeffs,\r
1423   float32_t * pState);\r
1424 \r
1425 \r
1426   /**\r
1427    * @brief Instance structure for the floating-point matrix structure.\r
1428    */\r
1429 \r
1430   typedef struct\r
1431   {\r
1432     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1433     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1434     float32_t *pData;     /**< points to the data of the matrix. */\r
1435   } arm_matrix_instance_f32;\r
1436 \r
1437   /**\r
1438    * @brief Instance structure for the Q15 matrix structure.\r
1439    */\r
1440 \r
1441   typedef struct\r
1442   {\r
1443     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1444     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1445     q15_t *pData;         /**< points to the data of the matrix. */\r
1446 \r
1447   } arm_matrix_instance_q15;\r
1448 \r
1449   /**\r
1450    * @brief Instance structure for the Q31 matrix structure.\r
1451    */\r
1452 \r
1453   typedef struct\r
1454   {\r
1455     uint16_t numRows;     /**< number of rows of the matrix.     */\r
1456     uint16_t numCols;     /**< number of columns of the matrix.  */\r
1457     q31_t *pData;         /**< points to the data of the matrix. */\r
1458 \r
1459   } arm_matrix_instance_q31;\r
1460 \r
1461 \r
1462 \r
1463   /**\r
1464    * @brief Floating-point matrix addition.\r
1465    * @param[in]       *pSrcA points to the first input matrix structure\r
1466    * @param[in]       *pSrcB points to the second input matrix structure\r
1467    * @param[out]      *pDst points to output matrix structure\r
1468    * @return     The function returns either\r
1469    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1470    */\r
1471 \r
1472   arm_status arm_mat_add_f32(\r
1473   const arm_matrix_instance_f32 * pSrcA,\r
1474   const arm_matrix_instance_f32 * pSrcB,\r
1475   arm_matrix_instance_f32 * pDst);\r
1476 \r
1477   /**\r
1478    * @brief Q15 matrix addition.\r
1479    * @param[in]       *pSrcA points to the first input matrix structure\r
1480    * @param[in]       *pSrcB points to the second input matrix structure\r
1481    * @param[out]      *pDst points to output matrix structure\r
1482    * @return     The function returns either\r
1483    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1484    */\r
1485 \r
1486   arm_status arm_mat_add_q15(\r
1487   const arm_matrix_instance_q15 * pSrcA,\r
1488   const arm_matrix_instance_q15 * pSrcB,\r
1489   arm_matrix_instance_q15 * pDst);\r
1490 \r
1491   /**\r
1492    * @brief Q31 matrix addition.\r
1493    * @param[in]       *pSrcA points to the first input matrix structure\r
1494    * @param[in]       *pSrcB points to the second input matrix structure\r
1495    * @param[out]      *pDst points to output matrix structure\r
1496    * @return     The function returns either\r
1497    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1498    */\r
1499 \r
1500   arm_status arm_mat_add_q31(\r
1501   const arm_matrix_instance_q31 * pSrcA,\r
1502   const arm_matrix_instance_q31 * pSrcB,\r
1503   arm_matrix_instance_q31 * pDst);\r
1504 \r
1505   /**\r
1506    * @brief Floating-point, complex, matrix multiplication.\r
1507    * @param[in]       *pSrcA points to the first input matrix structure\r
1508    * @param[in]       *pSrcB points to the second input matrix structure\r
1509    * @param[out]      *pDst points to output matrix structure\r
1510    * @return     The function returns either\r
1511    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1512    */\r
1513 \r
1514   arm_status arm_mat_cmplx_mult_f32(\r
1515   const arm_matrix_instance_f32 * pSrcA,\r
1516   const arm_matrix_instance_f32 * pSrcB,\r
1517   arm_matrix_instance_f32 * pDst);\r
1518 \r
1519   /**\r
1520    * @brief Q15, complex,  matrix multiplication.\r
1521    * @param[in]       *pSrcA points to the first input matrix structure\r
1522    * @param[in]       *pSrcB points to the second input matrix structure\r
1523    * @param[out]      *pDst points to output matrix structure\r
1524    * @return     The function returns either\r
1525    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1526    */\r
1527 \r
1528   arm_status arm_mat_cmplx_mult_q15(\r
1529   const arm_matrix_instance_q15 * pSrcA,\r
1530   const arm_matrix_instance_q15 * pSrcB,\r
1531   arm_matrix_instance_q15 * pDst,\r
1532   q15_t * pScratch);\r
1533 \r
1534   /**\r
1535    * @brief Q31, complex, matrix multiplication.\r
1536    * @param[in]       *pSrcA points to the first input matrix structure\r
1537    * @param[in]       *pSrcB points to the second input matrix structure\r
1538    * @param[out]      *pDst points to output matrix structure\r
1539    * @return     The function returns either\r
1540    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1541    */\r
1542 \r
1543   arm_status arm_mat_cmplx_mult_q31(\r
1544   const arm_matrix_instance_q31 * pSrcA,\r
1545   const arm_matrix_instance_q31 * pSrcB,\r
1546   arm_matrix_instance_q31 * pDst);\r
1547 \r
1548 \r
1549   /**\r
1550    * @brief Floating-point matrix transpose.\r
1551    * @param[in]  *pSrc points to the input matrix\r
1552    * @param[out] *pDst points to the output matrix\r
1553    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1554    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1555    */\r
1556 \r
1557   arm_status arm_mat_trans_f32(\r
1558   const arm_matrix_instance_f32 * pSrc,\r
1559   arm_matrix_instance_f32 * pDst);\r
1560 \r
1561 \r
1562   /**\r
1563    * @brief Q15 matrix transpose.\r
1564    * @param[in]  *pSrc points to the input matrix\r
1565    * @param[out] *pDst points to the output matrix\r
1566    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1567    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1568    */\r
1569 \r
1570   arm_status arm_mat_trans_q15(\r
1571   const arm_matrix_instance_q15 * pSrc,\r
1572   arm_matrix_instance_q15 * pDst);\r
1573 \r
1574   /**\r
1575    * @brief Q31 matrix transpose.\r
1576    * @param[in]  *pSrc points to the input matrix\r
1577    * @param[out] *pDst points to the output matrix\r
1578    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>\r
1579    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1580    */\r
1581 \r
1582   arm_status arm_mat_trans_q31(\r
1583   const arm_matrix_instance_q31 * pSrc,\r
1584   arm_matrix_instance_q31 * pDst);\r
1585 \r
1586 \r
1587   /**\r
1588    * @brief Floating-point matrix multiplication\r
1589    * @param[in]       *pSrcA points to the first input matrix structure\r
1590    * @param[in]       *pSrcB points to the second input matrix structure\r
1591    * @param[out]      *pDst points to output matrix structure\r
1592    * @return     The function returns either\r
1593    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1594    */\r
1595 \r
1596   arm_status arm_mat_mult_f32(\r
1597   const arm_matrix_instance_f32 * pSrcA,\r
1598   const arm_matrix_instance_f32 * pSrcB,\r
1599   arm_matrix_instance_f32 * pDst);\r
1600 \r
1601   /**\r
1602    * @brief Q15 matrix multiplication\r
1603    * @param[in]       *pSrcA points to the first input matrix structure\r
1604    * @param[in]       *pSrcB points to the second input matrix structure\r
1605    * @param[out]      *pDst points to output matrix structure\r
1606    * @param[in]          *pState points to the array for storing intermediate results\r
1607    * @return     The function returns either\r
1608    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1609    */\r
1610 \r
1611   arm_status arm_mat_mult_q15(\r
1612   const arm_matrix_instance_q15 * pSrcA,\r
1613   const arm_matrix_instance_q15 * pSrcB,\r
1614   arm_matrix_instance_q15 * pDst,\r
1615   q15_t * pState);\r
1616 \r
1617   /**\r
1618    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4\r
1619    * @param[in]       *pSrcA  points to the first input matrix structure\r
1620    * @param[in]       *pSrcB  points to the second input matrix structure\r
1621    * @param[out]      *pDst   points to output matrix structure\r
1622    * @param[in]           *pState points to the array for storing intermediate results\r
1623    * @return     The function returns either\r
1624    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1625    */\r
1626 \r
1627   arm_status arm_mat_mult_fast_q15(\r
1628   const arm_matrix_instance_q15 * pSrcA,\r
1629   const arm_matrix_instance_q15 * pSrcB,\r
1630   arm_matrix_instance_q15 * pDst,\r
1631   q15_t * pState);\r
1632 \r
1633   /**\r
1634    * @brief Q31 matrix multiplication\r
1635    * @param[in]       *pSrcA points to the first input matrix structure\r
1636    * @param[in]       *pSrcB points to the second input matrix structure\r
1637    * @param[out]      *pDst points to output matrix structure\r
1638    * @return     The function returns either\r
1639    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1640    */\r
1641 \r
1642   arm_status arm_mat_mult_q31(\r
1643   const arm_matrix_instance_q31 * pSrcA,\r
1644   const arm_matrix_instance_q31 * pSrcB,\r
1645   arm_matrix_instance_q31 * pDst);\r
1646 \r
1647   /**\r
1648    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4\r
1649    * @param[in]       *pSrcA points to the first input matrix structure\r
1650    * @param[in]       *pSrcB points to the second input matrix structure\r
1651    * @param[out]      *pDst points to output matrix structure\r
1652    * @return     The function returns either\r
1653    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1654    */\r
1655 \r
1656   arm_status arm_mat_mult_fast_q31(\r
1657   const arm_matrix_instance_q31 * pSrcA,\r
1658   const arm_matrix_instance_q31 * pSrcB,\r
1659   arm_matrix_instance_q31 * pDst);\r
1660 \r
1661 \r
1662   /**\r
1663    * @brief Floating-point matrix subtraction\r
1664    * @param[in]       *pSrcA points to the first input matrix structure\r
1665    * @param[in]       *pSrcB points to the second input matrix structure\r
1666    * @param[out]      *pDst points to output matrix structure\r
1667    * @return     The function returns either\r
1668    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1669    */\r
1670 \r
1671   arm_status arm_mat_sub_f32(\r
1672   const arm_matrix_instance_f32 * pSrcA,\r
1673   const arm_matrix_instance_f32 * pSrcB,\r
1674   arm_matrix_instance_f32 * pDst);\r
1675 \r
1676   /**\r
1677    * @brief Q15 matrix subtraction\r
1678    * @param[in]       *pSrcA points to the first input matrix structure\r
1679    * @param[in]       *pSrcB points to the second input matrix structure\r
1680    * @param[out]      *pDst points to output matrix structure\r
1681    * @return     The function returns either\r
1682    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1683    */\r
1684 \r
1685   arm_status arm_mat_sub_q15(\r
1686   const arm_matrix_instance_q15 * pSrcA,\r
1687   const arm_matrix_instance_q15 * pSrcB,\r
1688   arm_matrix_instance_q15 * pDst);\r
1689 \r
1690   /**\r
1691    * @brief Q31 matrix subtraction\r
1692    * @param[in]       *pSrcA points to the first input matrix structure\r
1693    * @param[in]       *pSrcB points to the second input matrix structure\r
1694    * @param[out]      *pDst points to output matrix structure\r
1695    * @return     The function returns either\r
1696    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1697    */\r
1698 \r
1699   arm_status arm_mat_sub_q31(\r
1700   const arm_matrix_instance_q31 * pSrcA,\r
1701   const arm_matrix_instance_q31 * pSrcB,\r
1702   arm_matrix_instance_q31 * pDst);\r
1703 \r
1704   /**\r
1705    * @brief Floating-point matrix scaling.\r
1706    * @param[in]  *pSrc points to the input matrix\r
1707    * @param[in]  scale scale factor\r
1708    * @param[out] *pDst points to the output matrix\r
1709    * @return     The function returns either\r
1710    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1711    */\r
1712 \r
1713   arm_status arm_mat_scale_f32(\r
1714   const arm_matrix_instance_f32 * pSrc,\r
1715   float32_t scale,\r
1716   arm_matrix_instance_f32 * pDst);\r
1717 \r
1718   /**\r
1719    * @brief Q15 matrix scaling.\r
1720    * @param[in]       *pSrc points to input matrix\r
1721    * @param[in]       scaleFract fractional portion of the scale factor\r
1722    * @param[in]       shift number of bits to shift the result by\r
1723    * @param[out]      *pDst points to output matrix\r
1724    * @return     The function returns either\r
1725    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1726    */\r
1727 \r
1728   arm_status arm_mat_scale_q15(\r
1729   const arm_matrix_instance_q15 * pSrc,\r
1730   q15_t scaleFract,\r
1731   int32_t shift,\r
1732   arm_matrix_instance_q15 * pDst);\r
1733 \r
1734   /**\r
1735    * @brief Q31 matrix scaling.\r
1736    * @param[in]       *pSrc points to input matrix\r
1737    * @param[in]       scaleFract fractional portion of the scale factor\r
1738    * @param[in]       shift number of bits to shift the result by\r
1739    * @param[out]      *pDst points to output matrix structure\r
1740    * @return     The function returns either\r
1741    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.\r
1742    */\r
1743 \r
1744   arm_status arm_mat_scale_q31(\r
1745   const arm_matrix_instance_q31 * pSrc,\r
1746   q31_t scaleFract,\r
1747   int32_t shift,\r
1748   arm_matrix_instance_q31 * pDst);\r
1749 \r
1750 \r
1751   /**\r
1752    * @brief  Q31 matrix initialization.\r
1753    * @param[in,out] *S             points to an instance of the floating-point matrix structure.\r
1754    * @param[in]     nRows          number of rows in the matrix.\r
1755    * @param[in]     nColumns       number of columns in the matrix.\r
1756    * @param[in]     *pData             points to the matrix data array.\r
1757    * @return        none\r
1758    */\r
1759 \r
1760   void arm_mat_init_q31(\r
1761   arm_matrix_instance_q31 * S,\r
1762   uint16_t nRows,\r
1763   uint16_t nColumns,\r
1764   q31_t * pData);\r
1765 \r
1766   /**\r
1767    * @brief  Q15 matrix initialization.\r
1768    * @param[in,out] *S             points to an instance of the floating-point matrix structure.\r
1769    * @param[in]     nRows          number of rows in the matrix.\r
1770    * @param[in]     nColumns       number of columns in the matrix.\r
1771    * @param[in]     *pData             points to the matrix data array.\r
1772    * @return        none\r
1773    */\r
1774 \r
1775   void arm_mat_init_q15(\r
1776   arm_matrix_instance_q15 * S,\r
1777   uint16_t nRows,\r
1778   uint16_t nColumns,\r
1779   q15_t * pData);\r
1780 \r
1781   /**\r
1782    * @brief  Floating-point matrix initialization.\r
1783    * @param[in,out] *S             points to an instance of the floating-point matrix structure.\r
1784    * @param[in]     nRows          number of rows in the matrix.\r
1785    * @param[in]     nColumns       number of columns in the matrix.\r
1786    * @param[in]     *pData             points to the matrix data array.\r
1787    * @return        none\r
1788    */\r
1789 \r
1790   void arm_mat_init_f32(\r
1791   arm_matrix_instance_f32 * S,\r
1792   uint16_t nRows,\r
1793   uint16_t nColumns,\r
1794   float32_t * pData);\r
1795 \r
1796 \r
1797 \r
1798   /**\r
1799    * @brief Instance structure for the Q15 PID Control.\r
1800    */\r
1801   typedef struct\r
1802   {\r
1803     q15_t A0;    /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1804 #ifdef ARM_MATH_CM0_FAMILY\r
1805     q15_t A1;\r
1806     q15_t A2;\r
1807 #else\r
1808     q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/\r
1809 #endif\r
1810     q15_t state[3];       /**< The state array of length 3. */\r
1811     q15_t Kp;           /**< The proportional gain. */\r
1812     q15_t Ki;           /**< The integral gain. */\r
1813     q15_t Kd;           /**< The derivative gain. */\r
1814   } arm_pid_instance_q15;\r
1815 \r
1816   /**\r
1817    * @brief Instance structure for the Q31 PID Control.\r
1818    */\r
1819   typedef struct\r
1820   {\r
1821     q31_t A0;            /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1822     q31_t A1;            /**< The derived gain, A1 = -Kp - 2Kd. */\r
1823     q31_t A2;            /**< The derived gain, A2 = Kd . */\r
1824     q31_t state[3];      /**< The state array of length 3. */\r
1825     q31_t Kp;            /**< The proportional gain. */\r
1826     q31_t Ki;            /**< The integral gain. */\r
1827     q31_t Kd;            /**< The derivative gain. */\r
1828 \r
1829   } arm_pid_instance_q31;\r
1830 \r
1831   /**\r
1832    * @brief Instance structure for the floating-point PID Control.\r
1833    */\r
1834   typedef struct\r
1835   {\r
1836     float32_t A0;          /**< The derived gain, A0 = Kp + Ki + Kd . */\r
1837     float32_t A1;          /**< The derived gain, A1 = -Kp - 2Kd. */\r
1838     float32_t A2;          /**< The derived gain, A2 = Kd . */\r
1839     float32_t state[3];    /**< The state array of length 3. */\r
1840     float32_t Kp;               /**< The proportional gain. */\r
1841     float32_t Ki;               /**< The integral gain. */\r
1842     float32_t Kd;               /**< The derivative gain. */\r
1843   } arm_pid_instance_f32;\r
1844 \r
1845 \r
1846 \r
1847   /**\r
1848    * @brief  Initialization function for the floating-point PID Control.\r
1849    * @param[in,out] *S      points to an instance of the PID structure.\r
1850    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1851    * @return none.\r
1852    */\r
1853   void arm_pid_init_f32(\r
1854   arm_pid_instance_f32 * S,\r
1855   int32_t resetStateFlag);\r
1856 \r
1857   /**\r
1858    * @brief  Reset function for the floating-point PID Control.\r
1859    * @param[in,out] *S is an instance of the floating-point PID Control structure\r
1860    * @return none\r
1861    */\r
1862   void arm_pid_reset_f32(\r
1863   arm_pid_instance_f32 * S);\r
1864 \r
1865 \r
1866   /**\r
1867    * @brief  Initialization function for the Q31 PID Control.\r
1868    * @param[in,out] *S points to an instance of the Q15 PID structure.\r
1869    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1870    * @return none.\r
1871    */\r
1872   void arm_pid_init_q31(\r
1873   arm_pid_instance_q31 * S,\r
1874   int32_t resetStateFlag);\r
1875 \r
1876 \r
1877   /**\r
1878    * @brief  Reset function for the Q31 PID Control.\r
1879    * @param[in,out] *S points to an instance of the Q31 PID Control structure\r
1880    * @return none\r
1881    */\r
1882 \r
1883   void arm_pid_reset_q31(\r
1884   arm_pid_instance_q31 * S);\r
1885 \r
1886   /**\r
1887    * @brief  Initialization function for the Q15 PID Control.\r
1888    * @param[in,out] *S points to an instance of the Q15 PID structure.\r
1889    * @param[in] resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.\r
1890    * @return none.\r
1891    */\r
1892   void arm_pid_init_q15(\r
1893   arm_pid_instance_q15 * S,\r
1894   int32_t resetStateFlag);\r
1895 \r
1896   /**\r
1897    * @brief  Reset function for the Q15 PID Control.\r
1898    * @param[in,out] *S points to an instance of the q15 PID Control structure\r
1899    * @return none\r
1900    */\r
1901   void arm_pid_reset_q15(\r
1902   arm_pid_instance_q15 * S);\r
1903 \r
1904 \r
1905   /**\r
1906    * @brief Instance structure for the floating-point Linear Interpolate function.\r
1907    */\r
1908   typedef struct\r
1909   {\r
1910     uint32_t nValues;           /**< nValues */\r
1911     float32_t x1;               /**< x1 */\r
1912     float32_t xSpacing;         /**< xSpacing */\r
1913     float32_t *pYData;          /**< pointer to the table of Y values */\r
1914   } arm_linear_interp_instance_f32;\r
1915 \r
1916   /**\r
1917    * @brief Instance structure for the floating-point bilinear interpolation function.\r
1918    */\r
1919 \r
1920   typedef struct\r
1921   {\r
1922     uint16_t numRows;   /**< number of rows in the data table. */\r
1923     uint16_t numCols;   /**< number of columns in the data table. */\r
1924     float32_t *pData;   /**< points to the data table. */\r
1925   } arm_bilinear_interp_instance_f32;\r
1926 \r
1927    /**\r
1928    * @brief Instance structure for the Q31 bilinear interpolation function.\r
1929    */\r
1930 \r
1931   typedef struct\r
1932   {\r
1933     uint16_t numRows;   /**< number of rows in the data table. */\r
1934     uint16_t numCols;   /**< number of columns in the data table. */\r
1935     q31_t *pData;       /**< points to the data table. */\r
1936   } arm_bilinear_interp_instance_q31;\r
1937 \r
1938    /**\r
1939    * @brief Instance structure for the Q15 bilinear interpolation function.\r
1940    */\r
1941 \r
1942   typedef struct\r
1943   {\r
1944     uint16_t numRows;   /**< number of rows in the data table. */\r
1945     uint16_t numCols;   /**< number of columns in the data table. */\r
1946     q15_t *pData;       /**< points to the data table. */\r
1947   } arm_bilinear_interp_instance_q15;\r
1948 \r
1949    /**\r
1950    * @brief Instance structure for the Q15 bilinear interpolation function.\r
1951    */\r
1952 \r
1953   typedef struct\r
1954   {\r
1955     uint16_t numRows;   /**< number of rows in the data table. */\r
1956     uint16_t numCols;   /**< number of columns in the data table. */\r
1957     q7_t *pData;                /**< points to the data table. */\r
1958   } arm_bilinear_interp_instance_q7;\r
1959 \r
1960 \r
1961   /**\r
1962    * @brief Q7 vector multiplication.\r
1963    * @param[in]       *pSrcA points to the first input vector\r
1964    * @param[in]       *pSrcB points to the second input vector\r
1965    * @param[out]      *pDst  points to the output vector\r
1966    * @param[in]       blockSize number of samples in each vector\r
1967    * @return none.\r
1968    */\r
1969 \r
1970   void arm_mult_q7(\r
1971   q7_t * pSrcA,\r
1972   q7_t * pSrcB,\r
1973   q7_t * pDst,\r
1974   uint32_t blockSize);\r
1975 \r
1976   /**\r
1977    * @brief Q15 vector multiplication.\r
1978    * @param[in]       *pSrcA points to the first input vector\r
1979    * @param[in]       *pSrcB points to the second input vector\r
1980    * @param[out]      *pDst  points to the output vector\r
1981    * @param[in]       blockSize number of samples in each vector\r
1982    * @return none.\r
1983    */\r
1984 \r
1985   void arm_mult_q15(\r
1986   q15_t * pSrcA,\r
1987   q15_t * pSrcB,\r
1988   q15_t * pDst,\r
1989   uint32_t blockSize);\r
1990 \r
1991   /**\r
1992    * @brief Q31 vector multiplication.\r
1993    * @param[in]       *pSrcA points to the first input vector\r
1994    * @param[in]       *pSrcB points to the second input vector\r
1995    * @param[out]      *pDst points to the output vector\r
1996    * @param[in]       blockSize number of samples in each vector\r
1997    * @return none.\r
1998    */\r
1999 \r
2000   void arm_mult_q31(\r
2001   q31_t * pSrcA,\r
2002   q31_t * pSrcB,\r
2003   q31_t * pDst,\r
2004   uint32_t blockSize);\r
2005 \r
2006   /**\r
2007    * @brief Floating-point vector multiplication.\r
2008    * @param[in]       *pSrcA points to the first input vector\r
2009    * @param[in]       *pSrcB points to the second input vector\r
2010    * @param[out]      *pDst points to the output vector\r
2011    * @param[in]       blockSize number of samples in each vector\r
2012    * @return none.\r
2013    */\r
2014 \r
2015   void arm_mult_f32(\r
2016   float32_t * pSrcA,\r
2017   float32_t * pSrcB,\r
2018   float32_t * pDst,\r
2019   uint32_t blockSize);\r
2020 \r
2021 \r
2022 \r
2023 \r
2024 \r
2025 \r
2026   /**\r
2027    * @brief Instance structure for the Q15 CFFT/CIFFT function.\r
2028    */\r
2029 \r
2030   typedef struct\r
2031   {\r
2032     uint16_t fftLen;                 /**< length of the FFT. */\r
2033     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2034     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2035     q15_t *pTwiddle;                     /**< points to the Sin twiddle factor table. */\r
2036     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2037     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2038     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2039   } arm_cfft_radix2_instance_q15;\r
2040 \r
2041   arm_status arm_cfft_radix2_init_q15(\r
2042   arm_cfft_radix2_instance_q15 * S,\r
2043   uint16_t fftLen,\r
2044   uint8_t ifftFlag,\r
2045   uint8_t bitReverseFlag);\r
2046 \r
2047   void arm_cfft_radix2_q15(\r
2048   const arm_cfft_radix2_instance_q15 * S,\r
2049   q15_t * pSrc);\r
2050 \r
2051 \r
2052 \r
2053   /**\r
2054    * @brief Instance structure for the Q15 CFFT/CIFFT function.\r
2055    */\r
2056 \r
2057   typedef struct\r
2058   {\r
2059     uint16_t fftLen;                 /**< length of the FFT. */\r
2060     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2061     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2062     q15_t *pTwiddle;                 /**< points to the twiddle factor table. */\r
2063     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2064     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2065     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2066   } arm_cfft_radix4_instance_q15;\r
2067 \r
2068   arm_status arm_cfft_radix4_init_q15(\r
2069   arm_cfft_radix4_instance_q15 * S,\r
2070   uint16_t fftLen,\r
2071   uint8_t ifftFlag,\r
2072   uint8_t bitReverseFlag);\r
2073 \r
2074   void arm_cfft_radix4_q15(\r
2075   const arm_cfft_radix4_instance_q15 * S,\r
2076   q15_t * pSrc);\r
2077 \r
2078   /**\r
2079    * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.\r
2080    */\r
2081 \r
2082   typedef struct\r
2083   {\r
2084     uint16_t fftLen;                 /**< length of the FFT. */\r
2085     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2086     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2087     q31_t *pTwiddle;                     /**< points to the Twiddle factor table. */\r
2088     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2089     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2090     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2091   } arm_cfft_radix2_instance_q31;\r
2092 \r
2093   arm_status arm_cfft_radix2_init_q31(\r
2094   arm_cfft_radix2_instance_q31 * S,\r
2095   uint16_t fftLen,\r
2096   uint8_t ifftFlag,\r
2097   uint8_t bitReverseFlag);\r
2098 \r
2099   void arm_cfft_radix2_q31(\r
2100   const arm_cfft_radix2_instance_q31 * S,\r
2101   q31_t * pSrc);\r
2102 \r
2103   /**\r
2104    * @brief Instance structure for the Q31 CFFT/CIFFT function.\r
2105    */\r
2106 \r
2107   typedef struct\r
2108   {\r
2109     uint16_t fftLen;                 /**< length of the FFT. */\r
2110     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2111     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2112     q31_t *pTwiddle;                 /**< points to the twiddle factor table. */\r
2113     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */\r
2114     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2115     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2116   } arm_cfft_radix4_instance_q31;\r
2117 \r
2118   void arm_cfft_radix4_q31(\r
2119   const arm_cfft_radix4_instance_q31 * S,\r
2120   q31_t * pSrc);\r
2121 \r
2122   arm_status arm_cfft_radix4_init_q31(\r
2123   arm_cfft_radix4_instance_q31 * S,\r
2124   uint16_t fftLen,\r
2125   uint8_t ifftFlag,\r
2126   uint8_t bitReverseFlag);\r
2127 \r
2128   /**\r
2129    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2130    */\r
2131 \r
2132   typedef struct\r
2133   {\r
2134     uint16_t fftLen;                   /**< length of the FFT. */\r
2135     uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2136     uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2137     float32_t *pTwiddle;               /**< points to the Twiddle factor table. */\r
2138     uint16_t *pBitRevTable;            /**< points to the bit reversal table. */\r
2139     uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2140     uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2141     float32_t onebyfftLen;                 /**< value of 1/fftLen. */\r
2142   } arm_cfft_radix2_instance_f32;\r
2143 \r
2144 /* Deprecated */\r
2145   arm_status arm_cfft_radix2_init_f32(\r
2146   arm_cfft_radix2_instance_f32 * S,\r
2147   uint16_t fftLen,\r
2148   uint8_t ifftFlag,\r
2149   uint8_t bitReverseFlag);\r
2150 \r
2151 /* Deprecated */\r
2152   void arm_cfft_radix2_f32(\r
2153   const arm_cfft_radix2_instance_f32 * S,\r
2154   float32_t * pSrc);\r
2155 \r
2156   /**\r
2157    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2158    */\r
2159 \r
2160   typedef struct\r
2161   {\r
2162     uint16_t fftLen;                   /**< length of the FFT. */\r
2163     uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */\r
2164     uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */\r
2165     float32_t *pTwiddle;               /**< points to the Twiddle factor table. */\r
2166     uint16_t *pBitRevTable;            /**< points to the bit reversal table. */\r
2167     uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2168     uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */\r
2169     float32_t onebyfftLen;                 /**< value of 1/fftLen. */\r
2170   } arm_cfft_radix4_instance_f32;\r
2171 \r
2172 /* Deprecated */\r
2173   arm_status arm_cfft_radix4_init_f32(\r
2174   arm_cfft_radix4_instance_f32 * S,\r
2175   uint16_t fftLen,\r
2176   uint8_t ifftFlag,\r
2177   uint8_t bitReverseFlag);\r
2178 \r
2179 /* Deprecated */\r
2180   void arm_cfft_radix4_f32(\r
2181   const arm_cfft_radix4_instance_f32 * S,\r
2182   float32_t * pSrc);\r
2183 \r
2184   /**\r
2185    * @brief Instance structure for the floating-point CFFT/CIFFT function.\r
2186    */\r
2187 \r
2188   typedef struct\r
2189   {\r
2190     uint16_t fftLen;                   /**< length of the FFT. */\r
2191     const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */\r
2192     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */\r
2193     uint16_t bitRevLength;             /**< bit reversal table length. */\r
2194   } arm_cfft_instance_f32;\r
2195 \r
2196   void arm_cfft_f32(\r
2197   const arm_cfft_instance_f32 * S,\r
2198   float32_t * p1,\r
2199   uint8_t ifftFlag,\r
2200   uint8_t bitReverseFlag);\r
2201 \r
2202   /**\r
2203    * @brief Instance structure for the Q15 RFFT/RIFFT function.\r
2204    */\r
2205 \r
2206   typedef struct\r
2207   {\r
2208     uint32_t fftLenReal;                      /**< length of the real FFT. */\r
2209     uint32_t fftLenBy2;                       /**< length of the complex FFT. */\r
2210     uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2211     uint8_t bitReverseFlagR;                      /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2212     uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2213     q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */\r
2214     q15_t *pTwiddleBReal;                     /**< points to the imag twiddle factor table. */\r
2215     arm_cfft_radix4_instance_q15 *pCfft;          /**< points to the complex FFT instance. */\r
2216   } arm_rfft_instance_q15;\r
2217 \r
2218   arm_status arm_rfft_init_q15(\r
2219   arm_rfft_instance_q15 * S,\r
2220   arm_cfft_radix4_instance_q15 * S_CFFT,\r
2221   uint32_t fftLenReal,\r
2222   uint32_t ifftFlagR,\r
2223   uint32_t bitReverseFlag);\r
2224 \r
2225   void arm_rfft_q15(\r
2226   const arm_rfft_instance_q15 * S,\r
2227   q15_t * pSrc,\r
2228   q15_t * pDst);\r
2229 \r
2230   /**\r
2231    * @brief Instance structure for the Q31 RFFT/RIFFT function.\r
2232    */\r
2233 \r
2234   typedef struct\r
2235   {\r
2236     uint32_t fftLenReal;                        /**< length of the real FFT. */\r
2237     uint32_t fftLenBy2;                         /**< length of the complex FFT. */\r
2238     uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2239     uint8_t bitReverseFlagR;                        /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2240     uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2241     q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */\r
2242     q31_t *pTwiddleBReal;                       /**< points to the imag twiddle factor table. */\r
2243     arm_cfft_radix4_instance_q31 *pCfft;        /**< points to the complex FFT instance. */\r
2244   } arm_rfft_instance_q31;\r
2245 \r
2246   arm_status arm_rfft_init_q31(\r
2247   arm_rfft_instance_q31 * S,\r
2248   arm_cfft_radix4_instance_q31 * S_CFFT,\r
2249   uint32_t fftLenReal,\r
2250   uint32_t ifftFlagR,\r
2251   uint32_t bitReverseFlag);\r
2252 \r
2253   void arm_rfft_q31(\r
2254   const arm_rfft_instance_q31 * S,\r
2255   q31_t * pSrc,\r
2256   q31_t * pDst);\r
2257 \r
2258   /**\r
2259    * @brief Instance structure for the floating-point RFFT/RIFFT function.\r
2260    */\r
2261 \r
2262   typedef struct\r
2263   {\r
2264     uint32_t fftLenReal;                        /**< length of the real FFT. */\r
2265     uint16_t fftLenBy2;                         /**< length of the complex FFT. */\r
2266     uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */\r
2267     uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */\r
2268     uint32_t twidCoefRModifier;                     /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */\r
2269     float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */\r
2270     float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */\r
2271     arm_cfft_radix4_instance_f32 *pCfft;        /**< points to the complex FFT instance. */\r
2272   } arm_rfft_instance_f32;\r
2273 \r
2274   arm_status arm_rfft_init_f32(\r
2275   arm_rfft_instance_f32 * S,\r
2276   arm_cfft_radix4_instance_f32 * S_CFFT,\r
2277   uint32_t fftLenReal,\r
2278   uint32_t ifftFlagR,\r
2279   uint32_t bitReverseFlag);\r
2280 \r
2281   void arm_rfft_f32(\r
2282   const arm_rfft_instance_f32 * S,\r
2283   float32_t * pSrc,\r
2284   float32_t * pDst);\r
2285 \r
2286   /**\r
2287    * @brief Instance structure for the floating-point RFFT/RIFFT function.\r
2288    */\r
2289 \r
2290 typedef struct\r
2291   {\r
2292     arm_cfft_instance_f32 Sint;      /**< Internal CFFT structure. */\r
2293     uint16_t fftLenRFFT;                        /**< length of the real sequence */\r
2294         float32_t * pTwiddleRFFT;                                       /**< Twiddle factors real stage  */\r
2295   } arm_rfft_fast_instance_f32 ;\r
2296 \r
2297 arm_status arm_rfft_fast_init_f32 (\r
2298         arm_rfft_fast_instance_f32 * S,\r
2299         uint16_t fftLen);\r
2300 \r
2301 void arm_rfft_fast_f32(\r
2302   arm_rfft_fast_instance_f32 * S,\r
2303   float32_t * p, float32_t * pOut,\r
2304   uint8_t ifftFlag);\r
2305 \r
2306   /**\r
2307    * @brief Instance structure for the floating-point DCT4/IDCT4 function.\r
2308    */\r
2309 \r
2310   typedef struct\r
2311   {\r
2312     uint16_t N;                         /**< length of the DCT4. */\r
2313     uint16_t Nby2;                      /**< half of the length of the DCT4. */\r
2314     float32_t normalize;                /**< normalizing factor. */\r
2315     float32_t *pTwiddle;                /**< points to the twiddle factor table. */\r
2316     float32_t *pCosFactor;              /**< points to the cosFactor table. */\r
2317     arm_rfft_instance_f32 *pRfft;        /**< points to the real FFT instance. */\r
2318     arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */\r
2319   } arm_dct4_instance_f32;\r
2320 \r
2321   /**\r
2322    * @brief  Initialization function for the floating-point DCT4/IDCT4.\r
2323    * @param[in,out] *S         points to an instance of floating-point DCT4/IDCT4 structure.\r
2324    * @param[in]     *S_RFFT    points to an instance of floating-point RFFT/RIFFT structure.\r
2325    * @param[in]     *S_CFFT    points to an instance of floating-point CFFT/CIFFT structure.\r
2326    * @param[in]     N          length of the DCT4.\r
2327    * @param[in]     Nby2       half of the length of the DCT4.\r
2328    * @param[in]     normalize  normalizing factor.\r
2329    * @return            arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length.\r
2330    */\r
2331 \r
2332   arm_status arm_dct4_init_f32(\r
2333   arm_dct4_instance_f32 * S,\r
2334   arm_rfft_instance_f32 * S_RFFT,\r
2335   arm_cfft_radix4_instance_f32 * S_CFFT,\r
2336   uint16_t N,\r
2337   uint16_t Nby2,\r
2338   float32_t normalize);\r
2339 \r
2340   /**\r
2341    * @brief Processing function for the floating-point DCT4/IDCT4.\r
2342    * @param[in]       *S             points to an instance of the floating-point DCT4/IDCT4 structure.\r
2343    * @param[in]       *pState        points to state buffer.\r
2344    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.\r
2345    * @return none.\r
2346    */\r
2347 \r
2348   void arm_dct4_f32(\r
2349   const arm_dct4_instance_f32 * S,\r
2350   float32_t * pState,\r
2351   float32_t * pInlineBuffer);\r
2352 \r
2353   /**\r
2354    * @brief Instance structure for the Q31 DCT4/IDCT4 function.\r
2355    */\r
2356 \r
2357   typedef struct\r
2358   {\r
2359     uint16_t N;                         /**< length of the DCT4. */\r
2360     uint16_t Nby2;                      /**< half of the length of the DCT4. */\r
2361     q31_t normalize;                    /**< normalizing factor. */\r
2362     q31_t *pTwiddle;                    /**< points to the twiddle factor table. */\r
2363     q31_t *pCosFactor;                  /**< points to the cosFactor table. */\r
2364     arm_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */\r
2365     arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */\r
2366   } arm_dct4_instance_q31;\r
2367 \r
2368   /**\r
2369    * @brief  Initialization function for the Q31 DCT4/IDCT4.\r
2370    * @param[in,out] *S         points to an instance of Q31 DCT4/IDCT4 structure.\r
2371    * @param[in]     *S_RFFT    points to an instance of Q31 RFFT/RIFFT structure\r
2372    * @param[in]     *S_CFFT    points to an instance of Q31 CFFT/CIFFT structure\r
2373    * @param[in]     N          length of the DCT4.\r
2374    * @param[in]     Nby2       half of the length of the DCT4.\r
2375    * @param[in]     normalize  normalizing factor.\r
2376    * @return            arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.\r
2377    */\r
2378 \r
2379   arm_status arm_dct4_init_q31(\r
2380   arm_dct4_instance_q31 * S,\r
2381   arm_rfft_instance_q31 * S_RFFT,\r
2382   arm_cfft_radix4_instance_q31 * S_CFFT,\r
2383   uint16_t N,\r
2384   uint16_t Nby2,\r
2385   q31_t normalize);\r
2386 \r
2387   /**\r
2388    * @brief Processing function for the Q31 DCT4/IDCT4.\r
2389    * @param[in]       *S             points to an instance of the Q31 DCT4 structure.\r
2390    * @param[in]       *pState        points to state buffer.\r
2391    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.\r
2392    * @return none.\r
2393    */\r
2394 \r
2395   void arm_dct4_q31(\r
2396   const arm_dct4_instance_q31 * S,\r
2397   q31_t * pState,\r
2398   q31_t * pInlineBuffer);\r
2399 \r
2400   /**\r
2401    * @brief Instance structure for the Q15 DCT4/IDCT4 function.\r
2402    */\r
2403 \r
2404   typedef struct\r
2405   {\r
2406     uint16_t N;                         /**< length of the DCT4. */\r
2407     uint16_t Nby2;                      /**< half of the length of the DCT4. */\r
2408     q15_t normalize;                    /**< normalizing factor. */\r
2409     q15_t *pTwiddle;                    /**< points to the twiddle factor table. */\r
2410     q15_t *pCosFactor;                  /**< points to the cosFactor table. */\r
2411     arm_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */\r
2412     arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */\r
2413   } arm_dct4_instance_q15;\r
2414 \r
2415   /**\r
2416    * @brief  Initialization function for the Q15 DCT4/IDCT4.\r
2417    * @param[in,out] *S         points to an instance of Q15 DCT4/IDCT4 structure.\r
2418    * @param[in]     *S_RFFT    points to an instance of Q15 RFFT/RIFFT structure.\r
2419    * @param[in]     *S_CFFT    points to an instance of Q15 CFFT/CIFFT structure.\r
2420    * @param[in]     N          length of the DCT4.\r
2421    * @param[in]     Nby2       half of the length of the DCT4.\r
2422    * @param[in]     normalize  normalizing factor.\r
2423    * @return            arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length.\r
2424    */\r
2425 \r
2426   arm_status arm_dct4_init_q15(\r
2427   arm_dct4_instance_q15 * S,\r
2428   arm_rfft_instance_q15 * S_RFFT,\r
2429   arm_cfft_radix4_instance_q15 * S_CFFT,\r
2430   uint16_t N,\r
2431   uint16_t Nby2,\r
2432   q15_t normalize);\r
2433 \r
2434   /**\r
2435    * @brief Processing function for the Q15 DCT4/IDCT4.\r
2436    * @param[in]       *S             points to an instance of the Q15 DCT4 structure.\r
2437    * @param[in]       *pState        points to state buffer.\r
2438    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.\r
2439    * @return none.\r
2440    */\r
2441 \r
2442   void arm_dct4_q15(\r
2443   const arm_dct4_instance_q15 * S,\r
2444   q15_t * pState,\r
2445   q15_t * pInlineBuffer);\r
2446 \r
2447   /**\r
2448    * @brief Floating-point vector addition.\r
2449    * @param[in]       *pSrcA points to the first input vector\r
2450    * @param[in]       *pSrcB points to the second input vector\r
2451    * @param[out]      *pDst points to the output vector\r
2452    * @param[in]       blockSize number of samples in each vector\r
2453    * @return none.\r
2454    */\r
2455 \r
2456   void arm_add_f32(\r
2457   float32_t * pSrcA,\r
2458   float32_t * pSrcB,\r
2459   float32_t * pDst,\r
2460   uint32_t blockSize);\r
2461 \r
2462   /**\r
2463    * @brief Q7 vector addition.\r
2464    * @param[in]       *pSrcA points to the first input vector\r
2465    * @param[in]       *pSrcB points to the second input vector\r
2466    * @param[out]      *pDst points to the output vector\r
2467    * @param[in]       blockSize number of samples in each vector\r
2468    * @return none.\r
2469    */\r
2470 \r
2471   void arm_add_q7(\r
2472   q7_t * pSrcA,\r
2473   q7_t * pSrcB,\r
2474   q7_t * pDst,\r
2475   uint32_t blockSize);\r
2476 \r
2477   /**\r
2478    * @brief Q15 vector addition.\r
2479    * @param[in]       *pSrcA points to the first input vector\r
2480    * @param[in]       *pSrcB points to the second input vector\r
2481    * @param[out]      *pDst points to the output vector\r
2482    * @param[in]       blockSize number of samples in each vector\r
2483    * @return none.\r
2484    */\r
2485 \r
2486   void arm_add_q15(\r
2487   q15_t * pSrcA,\r
2488   q15_t * pSrcB,\r
2489   q15_t * pDst,\r
2490   uint32_t blockSize);\r
2491 \r
2492   /**\r
2493    * @brief Q31 vector addition.\r
2494    * @param[in]       *pSrcA points to the first input vector\r
2495    * @param[in]       *pSrcB points to the second input vector\r
2496    * @param[out]      *pDst points to the output vector\r
2497    * @param[in]       blockSize number of samples in each vector\r
2498    * @return none.\r
2499    */\r
2500 \r
2501   void arm_add_q31(\r
2502   q31_t * pSrcA,\r
2503   q31_t * pSrcB,\r
2504   q31_t * pDst,\r
2505   uint32_t blockSize);\r
2506 \r
2507   /**\r
2508    * @brief Floating-point vector subtraction.\r
2509    * @param[in]       *pSrcA points to the first input vector\r
2510    * @param[in]       *pSrcB points to the second input vector\r
2511    * @param[out]      *pDst points to the output vector\r
2512    * @param[in]       blockSize number of samples in each vector\r
2513    * @return none.\r
2514    */\r
2515 \r
2516   void arm_sub_f32(\r
2517   float32_t * pSrcA,\r
2518   float32_t * pSrcB,\r
2519   float32_t * pDst,\r
2520   uint32_t blockSize);\r
2521 \r
2522   /**\r
2523    * @brief Q7 vector subtraction.\r
2524    * @param[in]       *pSrcA points to the first input vector\r
2525    * @param[in]       *pSrcB points to the second input vector\r
2526    * @param[out]      *pDst points to the output vector\r
2527    * @param[in]       blockSize number of samples in each vector\r
2528    * @return none.\r
2529    */\r
2530 \r
2531   void arm_sub_q7(\r
2532   q7_t * pSrcA,\r
2533   q7_t * pSrcB,\r
2534   q7_t * pDst,\r
2535   uint32_t blockSize);\r
2536 \r
2537   /**\r
2538    * @brief Q15 vector subtraction.\r
2539    * @param[in]       *pSrcA points to the first input vector\r
2540    * @param[in]       *pSrcB points to the second input vector\r
2541    * @param[out]      *pDst points to the output vector\r
2542    * @param[in]       blockSize number of samples in each vector\r
2543    * @return none.\r
2544    */\r
2545 \r
2546   void arm_sub_q15(\r
2547   q15_t * pSrcA,\r
2548   q15_t * pSrcB,\r
2549   q15_t * pDst,\r
2550   uint32_t blockSize);\r
2551 \r
2552   /**\r
2553    * @brief Q31 vector subtraction.\r
2554    * @param[in]       *pSrcA points to the first input vector\r
2555    * @param[in]       *pSrcB points to the second input vector\r
2556    * @param[out]      *pDst points to the output vector\r
2557    * @param[in]       blockSize number of samples in each vector\r
2558    * @return none.\r
2559    */\r
2560 \r
2561   void arm_sub_q31(\r
2562   q31_t * pSrcA,\r
2563   q31_t * pSrcB,\r
2564   q31_t * pDst,\r
2565   uint32_t blockSize);\r
2566 \r
2567   /**\r
2568    * @brief Multiplies a floating-point vector by a scalar.\r
2569    * @param[in]       *pSrc points to the input vector\r
2570    * @param[in]       scale scale factor to be applied\r
2571    * @param[out]      *pDst points to the output vector\r
2572    * @param[in]       blockSize number of samples in the vector\r
2573    * @return none.\r
2574    */\r
2575 \r
2576   void arm_scale_f32(\r
2577   float32_t * pSrc,\r
2578   float32_t scale,\r
2579   float32_t * pDst,\r
2580   uint32_t blockSize);\r
2581 \r
2582   /**\r
2583    * @brief Multiplies a Q7 vector by a scalar.\r
2584    * @param[in]       *pSrc points to the input vector\r
2585    * @param[in]       scaleFract fractional portion of the scale value\r
2586    * @param[in]       shift number of bits to shift the result by\r
2587    * @param[out]      *pDst points to the output vector\r
2588    * @param[in]       blockSize number of samples in the vector\r
2589    * @return none.\r
2590    */\r
2591 \r
2592   void arm_scale_q7(\r
2593   q7_t * pSrc,\r
2594   q7_t scaleFract,\r
2595   int8_t shift,\r
2596   q7_t * pDst,\r
2597   uint32_t blockSize);\r
2598 \r
2599   /**\r
2600    * @brief Multiplies a Q15 vector by a scalar.\r
2601    * @param[in]       *pSrc points to the input vector\r
2602    * @param[in]       scaleFract fractional portion of the scale value\r
2603    * @param[in]       shift number of bits to shift the result by\r
2604    * @param[out]      *pDst points to the output vector\r
2605    * @param[in]       blockSize number of samples in the vector\r
2606    * @return none.\r
2607    */\r
2608 \r
2609   void arm_scale_q15(\r
2610   q15_t * pSrc,\r
2611   q15_t scaleFract,\r
2612   int8_t shift,\r
2613   q15_t * pDst,\r
2614   uint32_t blockSize);\r
2615 \r
2616   /**\r
2617    * @brief Multiplies a Q31 vector by a scalar.\r
2618    * @param[in]       *pSrc points to the input vector\r
2619    * @param[in]       scaleFract fractional portion of the scale value\r
2620    * @param[in]       shift number of bits to shift the result by\r
2621    * @param[out]      *pDst points to the output vector\r
2622    * @param[in]       blockSize number of samples in the vector\r
2623    * @return none.\r
2624    */\r
2625 \r
2626   void arm_scale_q31(\r
2627   q31_t * pSrc,\r
2628   q31_t scaleFract,\r
2629   int8_t shift,\r
2630   q31_t * pDst,\r
2631   uint32_t blockSize);\r
2632 \r
2633   /**\r
2634    * @brief Q7 vector absolute value.\r
2635    * @param[in]       *pSrc points to the input buffer\r
2636    * @param[out]      *pDst points to the output buffer\r
2637    * @param[in]       blockSize number of samples in each vector\r
2638    * @return none.\r
2639    */\r
2640 \r
2641   void arm_abs_q7(\r
2642   q7_t * pSrc,\r
2643   q7_t * pDst,\r
2644   uint32_t blockSize);\r
2645 \r
2646   /**\r
2647    * @brief Floating-point vector absolute value.\r
2648    * @param[in]       *pSrc points to the input buffer\r
2649    * @param[out]      *pDst points to the output buffer\r
2650    * @param[in]       blockSize number of samples in each vector\r
2651    * @return none.\r
2652    */\r
2653 \r
2654   void arm_abs_f32(\r
2655   float32_t * pSrc,\r
2656   float32_t * pDst,\r
2657   uint32_t blockSize);\r
2658 \r
2659   /**\r
2660    * @brief Q15 vector absolute value.\r
2661    * @param[in]       *pSrc points to the input buffer\r
2662    * @param[out]      *pDst points to the output buffer\r
2663    * @param[in]       blockSize number of samples in each vector\r
2664    * @return none.\r
2665    */\r
2666 \r
2667   void arm_abs_q15(\r
2668   q15_t * pSrc,\r
2669   q15_t * pDst,\r
2670   uint32_t blockSize);\r
2671 \r
2672   /**\r
2673    * @brief Q31 vector absolute value.\r
2674    * @param[in]       *pSrc points to the input buffer\r
2675    * @param[out]      *pDst points to the output buffer\r
2676    * @param[in]       blockSize number of samples in each vector\r
2677    * @return none.\r
2678    */\r
2679 \r
2680   void arm_abs_q31(\r
2681   q31_t * pSrc,\r
2682   q31_t * pDst,\r
2683   uint32_t blockSize);\r
2684 \r
2685   /**\r
2686    * @brief Dot product of floating-point vectors.\r
2687    * @param[in]       *pSrcA points to the first input vector\r
2688    * @param[in]       *pSrcB points to the second input vector\r
2689    * @param[in]       blockSize number of samples in each vector\r
2690    * @param[out]      *result output result returned here\r
2691    * @return none.\r
2692    */\r
2693 \r
2694   void arm_dot_prod_f32(\r
2695   float32_t * pSrcA,\r
2696   float32_t * pSrcB,\r
2697   uint32_t blockSize,\r
2698   float32_t * result);\r
2699 \r
2700   /**\r
2701    * @brief Dot product of Q7 vectors.\r
2702    * @param[in]       *pSrcA points to the first input vector\r
2703    * @param[in]       *pSrcB points to the second input vector\r
2704    * @param[in]       blockSize number of samples in each vector\r
2705    * @param[out]      *result output result returned here\r
2706    * @return none.\r
2707    */\r
2708 \r
2709   void arm_dot_prod_q7(\r
2710   q7_t * pSrcA,\r
2711   q7_t * pSrcB,\r
2712   uint32_t blockSize,\r
2713   q31_t * result);\r
2714 \r
2715   /**\r
2716    * @brief Dot product of Q15 vectors.\r
2717    * @param[in]       *pSrcA points to the first input vector\r
2718    * @param[in]       *pSrcB points to the second input vector\r
2719    * @param[in]       blockSize number of samples in each vector\r
2720    * @param[out]      *result output result returned here\r
2721    * @return none.\r
2722    */\r
2723 \r
2724   void arm_dot_prod_q15(\r
2725   q15_t * pSrcA,\r
2726   q15_t * pSrcB,\r
2727   uint32_t blockSize,\r
2728   q63_t * result);\r
2729 \r
2730   /**\r
2731    * @brief Dot product of Q31 vectors.\r
2732    * @param[in]       *pSrcA points to the first input vector\r
2733    * @param[in]       *pSrcB points to the second input vector\r
2734    * @param[in]       blockSize number of samples in each vector\r
2735    * @param[out]      *result output result returned here\r
2736    * @return none.\r
2737    */\r
2738 \r
2739   void arm_dot_prod_q31(\r
2740   q31_t * pSrcA,\r
2741   q31_t * pSrcB,\r
2742   uint32_t blockSize,\r
2743   q63_t * result);\r
2744 \r
2745   /**\r
2746    * @brief  Shifts the elements of a Q7 vector a specified number of bits.\r
2747    * @param[in]  *pSrc points to the input vector\r
2748    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2749    * @param[out]  *pDst points to the output vector\r
2750    * @param[in]  blockSize number of samples in the vector\r
2751    * @return none.\r
2752    */\r
2753 \r
2754   void arm_shift_q7(\r
2755   q7_t * pSrc,\r
2756   int8_t shiftBits,\r
2757   q7_t * pDst,\r
2758   uint32_t blockSize);\r
2759 \r
2760   /**\r
2761    * @brief  Shifts the elements of a Q15 vector a specified number of bits.\r
2762    * @param[in]  *pSrc points to the input vector\r
2763    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2764    * @param[out]  *pDst points to the output vector\r
2765    * @param[in]  blockSize number of samples in the vector\r
2766    * @return none.\r
2767    */\r
2768 \r
2769   void arm_shift_q15(\r
2770   q15_t * pSrc,\r
2771   int8_t shiftBits,\r
2772   q15_t * pDst,\r
2773   uint32_t blockSize);\r
2774 \r
2775   /**\r
2776    * @brief  Shifts the elements of a Q31 vector a specified number of bits.\r
2777    * @param[in]  *pSrc points to the input vector\r
2778    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.\r
2779    * @param[out]  *pDst points to the output vector\r
2780    * @param[in]  blockSize number of samples in the vector\r
2781    * @return none.\r
2782    */\r
2783 \r
2784   void arm_shift_q31(\r
2785   q31_t * pSrc,\r
2786   int8_t shiftBits,\r
2787   q31_t * pDst,\r
2788   uint32_t blockSize);\r
2789 \r
2790   /**\r
2791    * @brief  Adds a constant offset to a floating-point vector.\r
2792    * @param[in]  *pSrc points to the input vector\r
2793    * @param[in]  offset is the offset to be added\r
2794    * @param[out]  *pDst points to the output vector\r
2795    * @param[in]  blockSize number of samples in the vector\r
2796    * @return none.\r
2797    */\r
2798 \r
2799   void arm_offset_f32(\r
2800   float32_t * pSrc,\r
2801   float32_t offset,\r
2802   float32_t * pDst,\r
2803   uint32_t blockSize);\r
2804 \r
2805   /**\r
2806    * @brief  Adds a constant offset to a Q7 vector.\r
2807    * @param[in]  *pSrc points to the input vector\r
2808    * @param[in]  offset is the offset to be added\r
2809    * @param[out]  *pDst points to the output vector\r
2810    * @param[in]  blockSize number of samples in the vector\r
2811    * @return none.\r
2812    */\r
2813 \r
2814   void arm_offset_q7(\r
2815   q7_t * pSrc,\r
2816   q7_t offset,\r
2817   q7_t * pDst,\r
2818   uint32_t blockSize);\r
2819 \r
2820   /**\r
2821    * @brief  Adds a constant offset to a Q15 vector.\r
2822    * @param[in]  *pSrc points to the input vector\r
2823    * @param[in]  offset is the offset to be added\r
2824    * @param[out]  *pDst points to the output vector\r
2825    * @param[in]  blockSize number of samples in the vector\r
2826    * @return none.\r
2827    */\r
2828 \r
2829   void arm_offset_q15(\r
2830   q15_t * pSrc,\r
2831   q15_t offset,\r
2832   q15_t * pDst,\r
2833   uint32_t blockSize);\r
2834 \r
2835   /**\r
2836    * @brief  Adds a constant offset to a Q31 vector.\r
2837    * @param[in]  *pSrc points to the input vector\r
2838    * @param[in]  offset is the offset to be added\r
2839    * @param[out]  *pDst points to the output vector\r
2840    * @param[in]  blockSize number of samples in the vector\r
2841    * @return none.\r
2842    */\r
2843 \r
2844   void arm_offset_q31(\r
2845   q31_t * pSrc,\r
2846   q31_t offset,\r
2847   q31_t * pDst,\r
2848   uint32_t blockSize);\r
2849 \r
2850   /**\r
2851    * @brief  Negates the elements of a floating-point vector.\r
2852    * @param[in]  *pSrc points to the input vector\r
2853    * @param[out]  *pDst points to the output vector\r
2854    * @param[in]  blockSize number of samples in the vector\r
2855    * @return none.\r
2856    */\r
2857 \r
2858   void arm_negate_f32(\r
2859   float32_t * pSrc,\r
2860   float32_t * pDst,\r
2861   uint32_t blockSize);\r
2862 \r
2863   /**\r
2864    * @brief  Negates the elements of a Q7 vector.\r
2865    * @param[in]  *pSrc points to the input vector\r
2866    * @param[out]  *pDst points to the output vector\r
2867    * @param[in]  blockSize number of samples in the vector\r
2868    * @return none.\r
2869    */\r
2870 \r
2871   void arm_negate_q7(\r
2872   q7_t * pSrc,\r
2873   q7_t * pDst,\r
2874   uint32_t blockSize);\r
2875 \r
2876   /**\r
2877    * @brief  Negates the elements of a Q15 vector.\r
2878    * @param[in]  *pSrc points to the input vector\r
2879    * @param[out]  *pDst points to the output vector\r
2880    * @param[in]  blockSize number of samples in the vector\r
2881    * @return none.\r
2882    */\r
2883 \r
2884   void arm_negate_q15(\r
2885   q15_t * pSrc,\r
2886   q15_t * pDst,\r
2887   uint32_t blockSize);\r
2888 \r
2889   /**\r
2890    * @brief  Negates the elements of a Q31 vector.\r
2891    * @param[in]  *pSrc points to the input vector\r
2892    * @param[out]  *pDst points to the output vector\r
2893    * @param[in]  blockSize number of samples in the vector\r
2894    * @return none.\r
2895    */\r
2896 \r
2897   void arm_negate_q31(\r
2898   q31_t * pSrc,\r
2899   q31_t * pDst,\r
2900   uint32_t blockSize);\r
2901   /**\r
2902    * @brief  Copies the elements of a floating-point vector.\r
2903    * @param[in]  *pSrc input pointer\r
2904    * @param[out]  *pDst output pointer\r
2905    * @param[in]  blockSize number of samples to process\r
2906    * @return none.\r
2907    */\r
2908   void arm_copy_f32(\r
2909   float32_t * pSrc,\r
2910   float32_t * pDst,\r
2911   uint32_t blockSize);\r
2912 \r
2913   /**\r
2914    * @brief  Copies the elements of a Q7 vector.\r
2915    * @param[in]  *pSrc input pointer\r
2916    * @param[out]  *pDst output pointer\r
2917    * @param[in]  blockSize number of samples to process\r
2918    * @return none.\r
2919    */\r
2920   void arm_copy_q7(\r
2921   q7_t * pSrc,\r
2922   q7_t * pDst,\r
2923   uint32_t blockSize);\r
2924 \r
2925   /**\r
2926    * @brief  Copies the elements of a Q15 vector.\r
2927    * @param[in]  *pSrc input pointer\r
2928    * @param[out]  *pDst output pointer\r
2929    * @param[in]  blockSize number of samples to process\r
2930    * @return none.\r
2931    */\r
2932   void arm_copy_q15(\r
2933   q15_t * pSrc,\r
2934   q15_t * pDst,\r
2935   uint32_t blockSize);\r
2936 \r
2937   /**\r
2938    * @brief  Copies the elements of a Q31 vector.\r
2939    * @param[in]  *pSrc input pointer\r
2940    * @param[out]  *pDst output pointer\r
2941    * @param[in]  blockSize number of samples to process\r
2942    * @return none.\r
2943    */\r
2944   void arm_copy_q31(\r
2945   q31_t * pSrc,\r
2946   q31_t * pDst,\r
2947   uint32_t blockSize);\r
2948   /**\r
2949    * @brief  Fills a constant value into a floating-point vector.\r
2950    * @param[in]  value input value to be filled\r
2951    * @param[out]  *pDst output pointer\r
2952    * @param[in]  blockSize number of samples to process\r
2953    * @return none.\r
2954    */\r
2955   void arm_fill_f32(\r
2956   float32_t value,\r
2957   float32_t * pDst,\r
2958   uint32_t blockSize);\r
2959 \r
2960   /**\r
2961    * @brief  Fills a constant value into a Q7 vector.\r
2962    * @param[in]  value input value to be filled\r
2963    * @param[out]  *pDst output pointer\r
2964    * @param[in]  blockSize number of samples to process\r
2965    * @return none.\r
2966    */\r
2967   void arm_fill_q7(\r
2968   q7_t value,\r
2969   q7_t * pDst,\r
2970   uint32_t blockSize);\r
2971 \r
2972   /**\r
2973    * @brief  Fills a constant value into a Q15 vector.\r
2974    * @param[in]  value input value to be filled\r
2975    * @param[out]  *pDst output pointer\r
2976    * @param[in]  blockSize number of samples to process\r
2977    * @return none.\r
2978    */\r
2979   void arm_fill_q15(\r
2980   q15_t value,\r
2981   q15_t * pDst,\r
2982   uint32_t blockSize);\r
2983 \r
2984   /**\r
2985    * @brief  Fills a constant value into a Q31 vector.\r
2986    * @param[in]  value input value to be filled\r
2987    * @param[out]  *pDst output pointer\r
2988    * @param[in]  blockSize number of samples to process\r
2989    * @return none.\r
2990    */\r
2991   void arm_fill_q31(\r
2992   q31_t value,\r
2993   q31_t * pDst,\r
2994   uint32_t blockSize);\r
2995 \r
2996 /**\r
2997  * @brief Convolution of floating-point sequences.\r
2998  * @param[in] *pSrcA points to the first input sequence.\r
2999  * @param[in] srcALen length of the first input sequence.\r
3000  * @param[in] *pSrcB points to the second input sequence.\r
3001  * @param[in] srcBLen length of the second input sequence.\r
3002  * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.\r
3003  * @return none.\r
3004  */\r
3005 \r
3006   void arm_conv_f32(\r
3007   float32_t * pSrcA,\r
3008   uint32_t srcALen,\r
3009   float32_t * pSrcB,\r
3010   uint32_t srcBLen,\r
3011   float32_t * pDst);\r
3012 \r
3013 \r
3014   /**\r
3015    * @brief Convolution of Q15 sequences.\r
3016    * @param[in] *pSrcA points to the first input sequence.\r
3017    * @param[in] srcALen length of the first input sequence.\r
3018    * @param[in] *pSrcB points to the second input sequence.\r
3019    * @param[in] srcBLen length of the second input sequence.\r
3020    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3021    * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3022    * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).\r
3023    * @return none.\r
3024    */\r
3025 \r
3026 \r
3027   void arm_conv_opt_q15(\r
3028   q15_t * pSrcA,\r
3029   uint32_t srcALen,\r
3030   q15_t * pSrcB,\r
3031   uint32_t srcBLen,\r
3032   q15_t * pDst,\r
3033   q15_t * pScratch1,\r
3034   q15_t * pScratch2);\r
3035 \r
3036 \r
3037 /**\r
3038  * @brief Convolution of Q15 sequences.\r
3039  * @param[in] *pSrcA points to the first input sequence.\r
3040  * @param[in] srcALen length of the first input sequence.\r
3041  * @param[in] *pSrcB points to the second input sequence.\r
3042  * @param[in] srcBLen length of the second input sequence.\r
3043  * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.\r
3044  * @return none.\r
3045  */\r
3046 \r
3047   void arm_conv_q15(\r
3048   q15_t * pSrcA,\r
3049   uint32_t srcALen,\r
3050   q15_t * pSrcB,\r
3051   uint32_t srcBLen,\r
3052   q15_t * pDst);\r
3053 \r
3054   /**\r
3055    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3056    * @param[in] *pSrcA points to the first input sequence.\r
3057    * @param[in] srcALen length of the first input sequence.\r
3058    * @param[in] *pSrcB points to the second input sequence.\r
3059    * @param[in] srcBLen length of the second input sequence.\r
3060    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3061    * @return none.\r
3062    */\r
3063 \r
3064   void arm_conv_fast_q15(\r
3065                           q15_t * pSrcA,\r
3066                          uint32_t srcALen,\r
3067                           q15_t * pSrcB,\r
3068                          uint32_t srcBLen,\r
3069                          q15_t * pDst);\r
3070 \r
3071   /**\r
3072    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3073    * @param[in] *pSrcA points to the first input sequence.\r
3074    * @param[in] srcALen length of the first input sequence.\r
3075    * @param[in] *pSrcB points to the second input sequence.\r
3076    * @param[in] srcBLen length of the second input sequence.\r
3077    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3078    * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3079    * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).\r
3080    * @return none.\r
3081    */\r
3082 \r
3083   void arm_conv_fast_opt_q15(\r
3084   q15_t * pSrcA,\r
3085   uint32_t srcALen,\r
3086   q15_t * pSrcB,\r
3087   uint32_t srcBLen,\r
3088   q15_t * pDst,\r
3089   q15_t * pScratch1,\r
3090   q15_t * pScratch2);\r
3091 \r
3092 \r
3093 \r
3094   /**\r
3095    * @brief Convolution of Q31 sequences.\r
3096    * @param[in] *pSrcA points to the first input sequence.\r
3097    * @param[in] srcALen length of the first input sequence.\r
3098    * @param[in] *pSrcB points to the second input sequence.\r
3099    * @param[in] srcBLen length of the second input sequence.\r
3100    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3101    * @return none.\r
3102    */\r
3103 \r
3104   void arm_conv_q31(\r
3105   q31_t * pSrcA,\r
3106   uint32_t srcALen,\r
3107   q31_t * pSrcB,\r
3108   uint32_t srcBLen,\r
3109   q31_t * pDst);\r
3110 \r
3111   /**\r
3112    * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3113    * @param[in] *pSrcA points to the first input sequence.\r
3114    * @param[in] srcALen length of the first input sequence.\r
3115    * @param[in] *pSrcB points to the second input sequence.\r
3116    * @param[in] srcBLen length of the second input sequence.\r
3117    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3118    * @return none.\r
3119    */\r
3120 \r
3121   void arm_conv_fast_q31(\r
3122   q31_t * pSrcA,\r
3123   uint32_t srcALen,\r
3124   q31_t * pSrcB,\r
3125   uint32_t srcBLen,\r
3126   q31_t * pDst);\r
3127 \r
3128 \r
3129     /**\r
3130    * @brief Convolution of Q7 sequences.\r
3131    * @param[in] *pSrcA points to the first input sequence.\r
3132    * @param[in] srcALen length of the first input sequence.\r
3133    * @param[in] *pSrcB points to the second input sequence.\r
3134    * @param[in] srcBLen length of the second input sequence.\r
3135    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3136    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3137    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
3138    * @return none.\r
3139    */\r
3140 \r
3141   void arm_conv_opt_q7(\r
3142   q7_t * pSrcA,\r
3143   uint32_t srcALen,\r
3144   q7_t * pSrcB,\r
3145   uint32_t srcBLen,\r
3146   q7_t * pDst,\r
3147   q15_t * pScratch1,\r
3148   q15_t * pScratch2);\r
3149 \r
3150 \r
3151 \r
3152   /**\r
3153    * @brief Convolution of Q7 sequences.\r
3154    * @param[in] *pSrcA points to the first input sequence.\r
3155    * @param[in] srcALen length of the first input sequence.\r
3156    * @param[in] *pSrcB points to the second input sequence.\r
3157    * @param[in] srcBLen length of the second input sequence.\r
3158    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.\r
3159    * @return none.\r
3160    */\r
3161 \r
3162   void arm_conv_q7(\r
3163   q7_t * pSrcA,\r
3164   uint32_t srcALen,\r
3165   q7_t * pSrcB,\r
3166   uint32_t srcBLen,\r
3167   q7_t * pDst);\r
3168 \r
3169 \r
3170   /**\r
3171    * @brief Partial convolution of floating-point sequences.\r
3172    * @param[in]       *pSrcA points to the first input sequence.\r
3173    * @param[in]       srcALen length of the first input sequence.\r
3174    * @param[in]       *pSrcB points to the second input sequence.\r
3175    * @param[in]       srcBLen length of the second input sequence.\r
3176    * @param[out]      *pDst points to the block of output data\r
3177    * @param[in]       firstIndex is the first output sample to start with.\r
3178    * @param[in]       numPoints is the number of output points to be computed.\r
3179    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3180    */\r
3181 \r
3182   arm_status arm_conv_partial_f32(\r
3183   float32_t * pSrcA,\r
3184   uint32_t srcALen,\r
3185   float32_t * pSrcB,\r
3186   uint32_t srcBLen,\r
3187   float32_t * pDst,\r
3188   uint32_t firstIndex,\r
3189   uint32_t numPoints);\r
3190 \r
3191     /**\r
3192    * @brief Partial convolution of Q15 sequences.\r
3193    * @param[in]       *pSrcA points to the first input sequence.\r
3194    * @param[in]       srcALen length of the first input sequence.\r
3195    * @param[in]       *pSrcB points to the second input sequence.\r
3196    * @param[in]       srcBLen length of the second input sequence.\r
3197    * @param[out]      *pDst points to the block of output data\r
3198    * @param[in]       firstIndex is the first output sample to start with.\r
3199    * @param[in]       numPoints is the number of output points to be computed.\r
3200    * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3201    * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).\r
3202    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3203    */\r
3204 \r
3205   arm_status arm_conv_partial_opt_q15(\r
3206   q15_t * pSrcA,\r
3207   uint32_t srcALen,\r
3208   q15_t * pSrcB,\r
3209   uint32_t srcBLen,\r
3210   q15_t * pDst,\r
3211   uint32_t firstIndex,\r
3212   uint32_t numPoints,\r
3213   q15_t * pScratch1,\r
3214   q15_t * pScratch2);\r
3215 \r
3216 \r
3217 /**\r
3218    * @brief Partial convolution of Q15 sequences.\r
3219    * @param[in]       *pSrcA points to the first input sequence.\r
3220    * @param[in]       srcALen length of the first input sequence.\r
3221    * @param[in]       *pSrcB points to the second input sequence.\r
3222    * @param[in]       srcBLen length of the second input sequence.\r
3223    * @param[out]      *pDst points to the block of output data\r
3224    * @param[in]       firstIndex is the first output sample to start with.\r
3225    * @param[in]       numPoints is the number of output points to be computed.\r
3226    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3227    */\r
3228 \r
3229   arm_status arm_conv_partial_q15(\r
3230   q15_t * pSrcA,\r
3231   uint32_t srcALen,\r
3232   q15_t * pSrcB,\r
3233   uint32_t srcBLen,\r
3234   q15_t * pDst,\r
3235   uint32_t firstIndex,\r
3236   uint32_t numPoints);\r
3237 \r
3238   /**\r
3239    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3240    * @param[in]       *pSrcA points to the first input sequence.\r
3241    * @param[in]       srcALen length of the first input sequence.\r
3242    * @param[in]       *pSrcB points to the second input sequence.\r
3243    * @param[in]       srcBLen length of the second input sequence.\r
3244    * @param[out]      *pDst points to the block of output data\r
3245    * @param[in]       firstIndex is the first output sample to start with.\r
3246    * @param[in]       numPoints is the number of output points to be computed.\r
3247    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3248    */\r
3249 \r
3250   arm_status arm_conv_partial_fast_q15(\r
3251                                         q15_t * pSrcA,\r
3252                                        uint32_t srcALen,\r
3253                                         q15_t * pSrcB,\r
3254                                        uint32_t srcBLen,\r
3255                                        q15_t * pDst,\r
3256                                        uint32_t firstIndex,\r
3257                                        uint32_t numPoints);\r
3258 \r
3259 \r
3260   /**\r
3261    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3262    * @param[in]       *pSrcA points to the first input sequence.\r
3263    * @param[in]       srcALen length of the first input sequence.\r
3264    * @param[in]       *pSrcB points to the second input sequence.\r
3265    * @param[in]       srcBLen length of the second input sequence.\r
3266    * @param[out]      *pDst points to the block of output data\r
3267    * @param[in]       firstIndex is the first output sample to start with.\r
3268    * @param[in]       numPoints is the number of output points to be computed.\r
3269    * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3270    * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).\r
3271    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3272    */\r
3273 \r
3274   arm_status arm_conv_partial_fast_opt_q15(\r
3275   q15_t * pSrcA,\r
3276   uint32_t srcALen,\r
3277   q15_t * pSrcB,\r
3278   uint32_t srcBLen,\r
3279   q15_t * pDst,\r
3280   uint32_t firstIndex,\r
3281   uint32_t numPoints,\r
3282   q15_t * pScratch1,\r
3283   q15_t * pScratch2);\r
3284 \r
3285 \r
3286   /**\r
3287    * @brief Partial convolution of Q31 sequences.\r
3288    * @param[in]       *pSrcA points to the first input sequence.\r
3289    * @param[in]       srcALen length of the first input sequence.\r
3290    * @param[in]       *pSrcB points to the second input sequence.\r
3291    * @param[in]       srcBLen length of the second input sequence.\r
3292    * @param[out]      *pDst points to the block of output data\r
3293    * @param[in]       firstIndex is the first output sample to start with.\r
3294    * @param[in]       numPoints is the number of output points to be computed.\r
3295    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3296    */\r
3297 \r
3298   arm_status arm_conv_partial_q31(\r
3299   q31_t * pSrcA,\r
3300   uint32_t srcALen,\r
3301   q31_t * pSrcB,\r
3302   uint32_t srcBLen,\r
3303   q31_t * pDst,\r
3304   uint32_t firstIndex,\r
3305   uint32_t numPoints);\r
3306 \r
3307 \r
3308   /**\r
3309    * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4\r
3310    * @param[in]       *pSrcA points to the first input sequence.\r
3311    * @param[in]       srcALen length of the first input sequence.\r
3312    * @param[in]       *pSrcB points to the second input sequence.\r
3313    * @param[in]       srcBLen length of the second input sequence.\r
3314    * @param[out]      *pDst points to the block of output data\r
3315    * @param[in]       firstIndex is the first output sample to start with.\r
3316    * @param[in]       numPoints is the number of output points to be computed.\r
3317    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3318    */\r
3319 \r
3320   arm_status arm_conv_partial_fast_q31(\r
3321   q31_t * pSrcA,\r
3322   uint32_t srcALen,\r
3323   q31_t * pSrcB,\r
3324   uint32_t srcBLen,\r
3325   q31_t * pDst,\r
3326   uint32_t firstIndex,\r
3327   uint32_t numPoints);\r
3328 \r
3329 \r
3330   /**\r
3331    * @brief Partial convolution of Q7 sequences\r
3332    * @param[in]       *pSrcA points to the first input sequence.\r
3333    * @param[in]       srcALen length of the first input sequence.\r
3334    * @param[in]       *pSrcB points to the second input sequence.\r
3335    * @param[in]       srcBLen length of the second input sequence.\r
3336    * @param[out]      *pDst points to the block of output data\r
3337    * @param[in]       firstIndex is the first output sample to start with.\r
3338    * @param[in]       numPoints is the number of output points to be computed.\r
3339    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
3340    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
3341    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3342    */\r
3343 \r
3344   arm_status arm_conv_partial_opt_q7(\r
3345   q7_t * pSrcA,\r
3346   uint32_t srcALen,\r
3347   q7_t * pSrcB,\r
3348   uint32_t srcBLen,\r
3349   q7_t * pDst,\r
3350   uint32_t firstIndex,\r
3351   uint32_t numPoints,\r
3352   q15_t * pScratch1,\r
3353   q15_t * pScratch2);\r
3354 \r
3355 \r
3356 /**\r
3357    * @brief Partial convolution of Q7 sequences.\r
3358    * @param[in]       *pSrcA points to the first input sequence.\r
3359    * @param[in]       srcALen length of the first input sequence.\r
3360    * @param[in]       *pSrcB points to the second input sequence.\r
3361    * @param[in]       srcBLen length of the second input sequence.\r
3362    * @param[out]      *pDst points to the block of output data\r
3363    * @param[in]       firstIndex is the first output sample to start with.\r
3364    * @param[in]       numPoints is the number of output points to be computed.\r
3365    * @return  Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2].\r
3366    */\r
3367 \r
3368   arm_status arm_conv_partial_q7(\r
3369   q7_t * pSrcA,\r
3370   uint32_t srcALen,\r
3371   q7_t * pSrcB,\r
3372   uint32_t srcBLen,\r
3373   q7_t * pDst,\r
3374   uint32_t firstIndex,\r
3375   uint32_t numPoints);\r
3376 \r
3377 \r
3378 \r
3379   /**\r
3380    * @brief Instance structure for the Q15 FIR decimator.\r
3381    */\r
3382 \r
3383   typedef struct\r
3384   {\r
3385     uint8_t M;                      /**< decimation factor. */\r
3386     uint16_t numTaps;               /**< number of coefficients in the filter. */\r
3387     q15_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/\r
3388     q15_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3389   } arm_fir_decimate_instance_q15;\r
3390 \r
3391   /**\r
3392    * @brief Instance structure for the Q31 FIR decimator.\r
3393    */\r
3394 \r
3395   typedef struct\r
3396   {\r
3397     uint8_t M;                  /**< decimation factor. */\r
3398     uint16_t numTaps;           /**< number of coefficients in the filter. */\r
3399     q31_t *pCoeffs;              /**< points to the coefficient array. The array is of length numTaps.*/\r
3400     q31_t *pState;               /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3401 \r
3402   } arm_fir_decimate_instance_q31;\r
3403 \r
3404   /**\r
3405    * @brief Instance structure for the floating-point FIR decimator.\r
3406    */\r
3407 \r
3408   typedef struct\r
3409   {\r
3410     uint8_t M;                          /**< decimation factor. */\r
3411     uint16_t numTaps;                   /**< number of coefficients in the filter. */\r
3412     float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/\r
3413     float32_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
3414 \r
3415   } arm_fir_decimate_instance_f32;\r
3416 \r
3417 \r
3418 \r
3419   /**\r
3420    * @brief Processing function for the floating-point FIR decimator.\r
3421    * @param[in] *S points to an instance of the floating-point FIR decimator structure.\r
3422    * @param[in] *pSrc points to the block of input data.\r
3423    * @param[out] *pDst points to the block of output data\r
3424    * @param[in] blockSize number of input samples to process per call.\r
3425    * @return none\r
3426    */\r
3427 \r
3428   void arm_fir_decimate_f32(\r
3429   const arm_fir_decimate_instance_f32 * S,\r
3430   float32_t * pSrc,\r
3431   float32_t * pDst,\r
3432   uint32_t blockSize);\r
3433 \r
3434 \r
3435   /**\r
3436    * @brief  Initialization function for the floating-point FIR decimator.\r
3437    * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.\r
3438    * @param[in] numTaps  number of coefficients in the filter.\r
3439    * @param[in] M  decimation factor.\r
3440    * @param[in] *pCoeffs points to the filter coefficients.\r
3441    * @param[in] *pState points to the state buffer.\r
3442    * @param[in] blockSize number of input samples to process per call.\r
3443    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3444    * <code>blockSize</code> is not a multiple of <code>M</code>.\r
3445    */\r
3446 \r
3447   arm_status arm_fir_decimate_init_f32(\r
3448   arm_fir_decimate_instance_f32 * S,\r
3449   uint16_t numTaps,\r
3450   uint8_t M,\r
3451   float32_t * pCoeffs,\r
3452   float32_t * pState,\r
3453   uint32_t blockSize);\r
3454 \r
3455   /**\r
3456    * @brief Processing function for the Q15 FIR decimator.\r
3457    * @param[in] *S points to an instance of the Q15 FIR decimator structure.\r
3458    * @param[in] *pSrc points to the block of input data.\r
3459    * @param[out] *pDst points to the block of output data\r
3460    * @param[in] blockSize number of input samples to process per call.\r
3461    * @return none\r
3462    */\r
3463 \r
3464   void arm_fir_decimate_q15(\r
3465   const arm_fir_decimate_instance_q15 * S,\r
3466   q15_t * pSrc,\r
3467   q15_t * pDst,\r
3468   uint32_t blockSize);\r
3469 \r
3470   /**\r
3471    * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.\r
3472    * @param[in] *S points to an instance of the Q15 FIR decimator structure.\r
3473    * @param[in] *pSrc points to the block of input data.\r
3474    * @param[out] *pDst points to the block of output data\r
3475    * @param[in] blockSize number of input samples to process per call.\r
3476    * @return none\r
3477    */\r
3478 \r
3479   void arm_fir_decimate_fast_q15(\r
3480   const arm_fir_decimate_instance_q15 * S,\r
3481   q15_t * pSrc,\r
3482   q15_t * pDst,\r
3483   uint32_t blockSize);\r
3484 \r
3485 \r
3486 \r
3487   /**\r
3488    * @brief  Initialization function for the Q15 FIR decimator.\r
3489    * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.\r
3490    * @param[in] numTaps  number of coefficients in the filter.\r
3491    * @param[in] M  decimation factor.\r
3492    * @param[in] *pCoeffs points to the filter coefficients.\r
3493    * @param[in] *pState points to the state buffer.\r
3494    * @param[in] blockSize number of input samples to process per call.\r
3495    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3496    * <code>blockSize</code> is not a multiple of <code>M</code>.\r
3497    */\r
3498 \r
3499   arm_status arm_fir_decimate_init_q15(\r
3500   arm_fir_decimate_instance_q15 * S,\r
3501   uint16_t numTaps,\r
3502   uint8_t M,\r
3503   q15_t * pCoeffs,\r
3504   q15_t * pState,\r
3505   uint32_t blockSize);\r
3506 \r
3507   /**\r
3508    * @brief Processing function for the Q31 FIR decimator.\r
3509    * @param[in] *S points to an instance of the Q31 FIR decimator structure.\r
3510    * @param[in] *pSrc points to the block of input data.\r
3511    * @param[out] *pDst points to the block of output data\r
3512    * @param[in] blockSize number of input samples to process per call.\r
3513    * @return none\r
3514    */\r
3515 \r
3516   void arm_fir_decimate_q31(\r
3517   const arm_fir_decimate_instance_q31 * S,\r
3518   q31_t * pSrc,\r
3519   q31_t * pDst,\r
3520   uint32_t blockSize);\r
3521 \r
3522   /**\r
3523    * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.\r
3524    * @param[in] *S points to an instance of the Q31 FIR decimator structure.\r
3525    * @param[in] *pSrc points to the block of input data.\r
3526    * @param[out] *pDst points to the block of output data\r
3527    * @param[in] blockSize number of input samples to process per call.\r
3528    * @return none\r
3529    */\r
3530 \r
3531   void arm_fir_decimate_fast_q31(\r
3532   arm_fir_decimate_instance_q31 * S,\r
3533   q31_t * pSrc,\r
3534   q31_t * pDst,\r
3535   uint32_t blockSize);\r
3536 \r
3537 \r
3538   /**\r
3539    * @brief  Initialization function for the Q31 FIR decimator.\r
3540    * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.\r
3541    * @param[in] numTaps  number of coefficients in the filter.\r
3542    * @param[in] M  decimation factor.\r
3543    * @param[in] *pCoeffs points to the filter coefficients.\r
3544    * @param[in] *pState points to the state buffer.\r
3545    * @param[in] blockSize number of input samples to process per call.\r
3546    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3547    * <code>blockSize</code> is not a multiple of <code>M</code>.\r
3548    */\r
3549 \r
3550   arm_status arm_fir_decimate_init_q31(\r
3551   arm_fir_decimate_instance_q31 * S,\r
3552   uint16_t numTaps,\r
3553   uint8_t M,\r
3554   q31_t * pCoeffs,\r
3555   q31_t * pState,\r
3556   uint32_t blockSize);\r
3557 \r
3558 \r
3559 \r
3560   /**\r
3561    * @brief Instance structure for the Q15 FIR interpolator.\r
3562    */\r
3563 \r
3564   typedef struct\r
3565   {\r
3566     uint8_t L;                      /**< upsample factor. */\r
3567     uint16_t phaseLength;           /**< length of each polyphase filter component. */\r
3568     q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3569     q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */\r
3570   } arm_fir_interpolate_instance_q15;\r
3571 \r
3572   /**\r
3573    * @brief Instance structure for the Q31 FIR interpolator.\r
3574    */\r
3575 \r
3576   typedef struct\r
3577   {\r
3578     uint8_t L;                      /**< upsample factor. */\r
3579     uint16_t phaseLength;           /**< length of each polyphase filter component. */\r
3580     q31_t *pCoeffs;                  /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3581     q31_t *pState;                   /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */\r
3582   } arm_fir_interpolate_instance_q31;\r
3583 \r
3584   /**\r
3585    * @brief Instance structure for the floating-point FIR interpolator.\r
3586    */\r
3587 \r
3588   typedef struct\r
3589   {\r
3590     uint8_t L;                     /**< upsample factor. */\r
3591     uint16_t phaseLength;          /**< length of each polyphase filter component. */\r
3592     float32_t *pCoeffs;             /**< points to the coefficient array. The array is of length L*phaseLength. */\r
3593     float32_t *pState;              /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */\r
3594   } arm_fir_interpolate_instance_f32;\r
3595 \r
3596 \r
3597   /**\r
3598    * @brief Processing function for the Q15 FIR interpolator.\r
3599    * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.\r
3600    * @param[in] *pSrc     points to the block of input data.\r
3601    * @param[out] *pDst    points to the block of output data.\r
3602    * @param[in] blockSize number of input samples to process per call.\r
3603    * @return none.\r
3604    */\r
3605 \r
3606   void arm_fir_interpolate_q15(\r
3607   const arm_fir_interpolate_instance_q15 * S,\r
3608   q15_t * pSrc,\r
3609   q15_t * pDst,\r
3610   uint32_t blockSize);\r
3611 \r
3612 \r
3613   /**\r
3614    * @brief  Initialization function for the Q15 FIR interpolator.\r
3615    * @param[in,out] *S        points to an instance of the Q15 FIR interpolator structure.\r
3616    * @param[in]     L         upsample factor.\r
3617    * @param[in]     numTaps   number of filter coefficients in the filter.\r
3618    * @param[in]     *pCoeffs  points to the filter coefficient buffer.\r
3619    * @param[in]     *pState   points to the state buffer.\r
3620    * @param[in]     blockSize number of input samples to process per call.\r
3621    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3622    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3623    */\r
3624 \r
3625   arm_status arm_fir_interpolate_init_q15(\r
3626   arm_fir_interpolate_instance_q15 * S,\r
3627   uint8_t L,\r
3628   uint16_t numTaps,\r
3629   q15_t * pCoeffs,\r
3630   q15_t * pState,\r
3631   uint32_t blockSize);\r
3632 \r
3633   /**\r
3634    * @brief Processing function for the Q31 FIR interpolator.\r
3635    * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.\r
3636    * @param[in] *pSrc     points to the block of input data.\r
3637    * @param[out] *pDst    points to the block of output data.\r
3638    * @param[in] blockSize number of input samples to process per call.\r
3639    * @return none.\r
3640    */\r
3641 \r
3642   void arm_fir_interpolate_q31(\r
3643   const arm_fir_interpolate_instance_q31 * S,\r
3644   q31_t * pSrc,\r
3645   q31_t * pDst,\r
3646   uint32_t blockSize);\r
3647 \r
3648   /**\r
3649    * @brief  Initialization function for the Q31 FIR interpolator.\r
3650    * @param[in,out] *S        points to an instance of the Q31 FIR interpolator structure.\r
3651    * @param[in]     L         upsample factor.\r
3652    * @param[in]     numTaps   number of filter coefficients in the filter.\r
3653    * @param[in]     *pCoeffs  points to the filter coefficient buffer.\r
3654    * @param[in]     *pState   points to the state buffer.\r
3655    * @param[in]     blockSize number of input samples to process per call.\r
3656    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3657    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3658    */\r
3659 \r
3660   arm_status arm_fir_interpolate_init_q31(\r
3661   arm_fir_interpolate_instance_q31 * S,\r
3662   uint8_t L,\r
3663   uint16_t numTaps,\r
3664   q31_t * pCoeffs,\r
3665   q31_t * pState,\r
3666   uint32_t blockSize);\r
3667 \r
3668 \r
3669   /**\r
3670    * @brief Processing function for the floating-point FIR interpolator.\r
3671    * @param[in] *S        points to an instance of the floating-point FIR interpolator structure.\r
3672    * @param[in] *pSrc     points to the block of input data.\r
3673    * @param[out] *pDst    points to the block of output data.\r
3674    * @param[in] blockSize number of input samples to process per call.\r
3675    * @return none.\r
3676    */\r
3677 \r
3678   void arm_fir_interpolate_f32(\r
3679   const arm_fir_interpolate_instance_f32 * S,\r
3680   float32_t * pSrc,\r
3681   float32_t * pDst,\r
3682   uint32_t blockSize);\r
3683 \r
3684   /**\r
3685    * @brief  Initialization function for the floating-point FIR interpolator.\r
3686    * @param[in,out] *S        points to an instance of the floating-point FIR interpolator structure.\r
3687    * @param[in]     L         upsample factor.\r
3688    * @param[in]     numTaps   number of filter coefficients in the filter.\r
3689    * @param[in]     *pCoeffs  points to the filter coefficient buffer.\r
3690    * @param[in]     *pState   points to the state buffer.\r
3691    * @param[in]     blockSize number of input samples to process per call.\r
3692    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if\r
3693    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.\r
3694    */\r
3695 \r
3696   arm_status arm_fir_interpolate_init_f32(\r
3697   arm_fir_interpolate_instance_f32 * S,\r
3698   uint8_t L,\r
3699   uint16_t numTaps,\r
3700   float32_t * pCoeffs,\r
3701   float32_t * pState,\r
3702   uint32_t blockSize);\r
3703 \r
3704   /**\r
3705    * @brief Instance structure for the high precision Q31 Biquad cascade filter.\r
3706    */\r
3707 \r
3708   typedef struct\r
3709   {\r
3710     uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3711     q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */\r
3712     q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3713     uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */\r
3714 \r
3715   } arm_biquad_cas_df1_32x64_ins_q31;\r
3716 \r
3717 \r
3718   /**\r
3719    * @param[in]  *S        points to an instance of the high precision Q31 Biquad cascade filter structure.\r
3720    * @param[in]  *pSrc     points to the block of input data.\r
3721    * @param[out] *pDst     points to the block of output data\r
3722    * @param[in]  blockSize number of samples to process.\r
3723    * @return none.\r
3724    */\r
3725 \r
3726   void arm_biquad_cas_df1_32x64_q31(\r
3727   const arm_biquad_cas_df1_32x64_ins_q31 * S,\r
3728   q31_t * pSrc,\r
3729   q31_t * pDst,\r
3730   uint32_t blockSize);\r
3731 \r
3732 \r
3733   /**\r
3734    * @param[in,out] *S           points to an instance of the high precision Q31 Biquad cascade filter structure.\r
3735    * @param[in]     numStages    number of 2nd order stages in the filter.\r
3736    * @param[in]     *pCoeffs     points to the filter coefficients.\r
3737    * @param[in]     *pState      points to the state buffer.\r
3738    * @param[in]     postShift    shift to be applied to the output. Varies according to the coefficients format\r
3739    * @return        none\r
3740    */\r
3741 \r
3742   void arm_biquad_cas_df1_32x64_init_q31(\r
3743   arm_biquad_cas_df1_32x64_ins_q31 * S,\r
3744   uint8_t numStages,\r
3745   q31_t * pCoeffs,\r
3746   q63_t * pState,\r
3747   uint8_t postShift);\r
3748 \r
3749 \r
3750 \r
3751   /**\r
3752    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.\r
3753    */\r
3754 \r
3755   typedef struct\r
3756   {\r
3757     uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */\r
3758     float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */\r
3759     float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */\r
3760   } arm_biquad_cascade_df2T_instance_f32;\r
3761 \r
3762 \r
3763   /**\r
3764    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.\r
3765    * @param[in]  *S        points to an instance of the filter data structure.\r
3766    * @param[in]  *pSrc     points to the block of input data.\r
3767    * @param[out] *pDst     points to the block of output data\r
3768    * @param[in]  blockSize number of samples to process.\r
3769    * @return none.\r
3770    */\r
3771 \r
3772   void arm_biquad_cascade_df2T_f32(\r
3773   const arm_biquad_cascade_df2T_instance_f32 * S,\r
3774   float32_t * pSrc,\r
3775   float32_t * pDst,\r
3776   uint32_t blockSize);\r
3777 \r
3778 \r
3779   /**\r
3780    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.\r
3781    * @param[in,out] *S           points to an instance of the filter data structure.\r
3782    * @param[in]     numStages    number of 2nd order stages in the filter.\r
3783    * @param[in]     *pCoeffs     points to the filter coefficients.\r
3784    * @param[in]     *pState      points to the state buffer.\r
3785    * @return        none\r
3786    */\r
3787 \r
3788   void arm_biquad_cascade_df2T_init_f32(\r
3789   arm_biquad_cascade_df2T_instance_f32 * S,\r
3790   uint8_t numStages,\r
3791   float32_t * pCoeffs,\r
3792   float32_t * pState);\r
3793 \r
3794 \r
3795 \r
3796   /**\r
3797    * @brief Instance structure for the Q15 FIR lattice filter.\r
3798    */\r
3799 \r
3800   typedef struct\r
3801   {\r
3802     uint16_t numStages;                          /**< number of filter stages. */\r
3803     q15_t *pState;                               /**< points to the state variable array. The array is of length numStages. */\r
3804     q15_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */\r
3805   } arm_fir_lattice_instance_q15;\r
3806 \r
3807   /**\r
3808    * @brief Instance structure for the Q31 FIR lattice filter.\r
3809    */\r
3810 \r
3811   typedef struct\r
3812   {\r
3813     uint16_t numStages;                          /**< number of filter stages. */\r
3814     q31_t *pState;                               /**< points to the state variable array. The array is of length numStages. */\r
3815     q31_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */\r
3816   } arm_fir_lattice_instance_q31;\r
3817 \r
3818   /**\r
3819    * @brief Instance structure for the floating-point FIR lattice filter.\r
3820    */\r
3821 \r
3822   typedef struct\r
3823   {\r
3824     uint16_t numStages;                  /**< number of filter stages. */\r
3825     float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */\r
3826     float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */\r
3827   } arm_fir_lattice_instance_f32;\r
3828 \r
3829   /**\r
3830    * @brief Initialization function for the Q15 FIR lattice filter.\r
3831    * @param[in] *S points to an instance of the Q15 FIR lattice structure.\r
3832    * @param[in] numStages  number of filter stages.\r
3833    * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.\r
3834    * @param[in] *pState points to the state buffer.  The array is of length numStages.\r
3835    * @return none.\r
3836    */\r
3837 \r
3838   void arm_fir_lattice_init_q15(\r
3839   arm_fir_lattice_instance_q15 * S,\r
3840   uint16_t numStages,\r
3841   q15_t * pCoeffs,\r
3842   q15_t * pState);\r
3843 \r
3844 \r
3845   /**\r
3846    * @brief Processing function for the Q15 FIR lattice filter.\r
3847    * @param[in] *S points to an instance of the Q15 FIR lattice structure.\r
3848    * @param[in] *pSrc points to the block of input data.\r
3849    * @param[out] *pDst points to the block of output data.\r
3850    * @param[in] blockSize number of samples to process.\r
3851    * @return none.\r
3852    */\r
3853   void arm_fir_lattice_q15(\r
3854   const arm_fir_lattice_instance_q15 * S,\r
3855   q15_t * pSrc,\r
3856   q15_t * pDst,\r
3857   uint32_t blockSize);\r
3858 \r
3859   /**\r
3860    * @brief Initialization function for the Q31 FIR lattice filter.\r
3861    * @param[in] *S points to an instance of the Q31 FIR lattice structure.\r
3862    * @param[in] numStages  number of filter stages.\r
3863    * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.\r
3864    * @param[in] *pState points to the state buffer.   The array is of length numStages.\r
3865    * @return none.\r
3866    */\r
3867 \r
3868   void arm_fir_lattice_init_q31(\r
3869   arm_fir_lattice_instance_q31 * S,\r
3870   uint16_t numStages,\r
3871   q31_t * pCoeffs,\r
3872   q31_t * pState);\r
3873 \r
3874 \r
3875   /**\r
3876    * @brief Processing function for the Q31 FIR lattice filter.\r
3877    * @param[in]  *S        points to an instance of the Q31 FIR lattice structure.\r
3878    * @param[in]  *pSrc     points to the block of input data.\r
3879    * @param[out] *pDst     points to the block of output data\r
3880    * @param[in]  blockSize number of samples to process.\r
3881    * @return none.\r
3882    */\r
3883 \r
3884   void arm_fir_lattice_q31(\r
3885   const arm_fir_lattice_instance_q31 * S,\r
3886   q31_t * pSrc,\r
3887   q31_t * pDst,\r
3888   uint32_t blockSize);\r
3889 \r
3890 /**\r
3891  * @brief Initialization function for the floating-point FIR lattice filter.\r
3892  * @param[in] *S points to an instance of the floating-point FIR lattice structure.\r
3893  * @param[in] numStages  number of filter stages.\r
3894  * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.\r
3895  * @param[in] *pState points to the state buffer.  The array is of length numStages.\r
3896  * @return none.\r
3897  */\r
3898 \r
3899   void arm_fir_lattice_init_f32(\r
3900   arm_fir_lattice_instance_f32 * S,\r
3901   uint16_t numStages,\r
3902   float32_t * pCoeffs,\r
3903   float32_t * pState);\r
3904 \r
3905   /**\r
3906    * @brief Processing function for the floating-point FIR lattice filter.\r
3907    * @param[in]  *S        points to an instance of the floating-point FIR lattice structure.\r
3908    * @param[in]  *pSrc     points to the block of input data.\r
3909    * @param[out] *pDst     points to the block of output data\r
3910    * @param[in]  blockSize number of samples to process.\r
3911    * @return none.\r
3912    */\r
3913 \r
3914   void arm_fir_lattice_f32(\r
3915   const arm_fir_lattice_instance_f32 * S,\r
3916   float32_t * pSrc,\r
3917   float32_t * pDst,\r
3918   uint32_t blockSize);\r
3919 \r
3920   /**\r
3921    * @brief Instance structure for the Q15 IIR lattice filter.\r
3922    */\r
3923   typedef struct\r
3924   {\r
3925     uint16_t numStages;                         /**< number of stages in the filter. */\r
3926     q15_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3927     q15_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */\r
3928     q15_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3929   } arm_iir_lattice_instance_q15;\r
3930 \r
3931   /**\r
3932    * @brief Instance structure for the Q31 IIR lattice filter.\r
3933    */\r
3934   typedef struct\r
3935   {\r
3936     uint16_t numStages;                         /**< number of stages in the filter. */\r
3937     q31_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3938     q31_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */\r
3939     q31_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3940   } arm_iir_lattice_instance_q31;\r
3941 \r
3942   /**\r
3943    * @brief Instance structure for the floating-point IIR lattice filter.\r
3944    */\r
3945   typedef struct\r
3946   {\r
3947     uint16_t numStages;                         /**< number of stages in the filter. */\r
3948     float32_t *pState;                          /**< points to the state variable array. The array is of length numStages+blockSize. */\r
3949     float32_t *pkCoeffs;                        /**< points to the reflection coefficient array. The array is of length numStages. */\r
3950     float32_t *pvCoeffs;                        /**< points to the ladder coefficient array. The array is of length numStages+1. */\r
3951   } arm_iir_lattice_instance_f32;\r
3952 \r
3953   /**\r
3954    * @brief Processing function for the floating-point IIR lattice filter.\r
3955    * @param[in] *S points to an instance of the floating-point IIR lattice structure.\r
3956    * @param[in] *pSrc points to the block of input data.\r
3957    * @param[out] *pDst points to the block of output data.\r
3958    * @param[in] blockSize number of samples to process.\r
3959    * @return none.\r
3960    */\r
3961 \r
3962   void arm_iir_lattice_f32(\r
3963   const arm_iir_lattice_instance_f32 * S,\r
3964   float32_t * pSrc,\r
3965   float32_t * pDst,\r
3966   uint32_t blockSize);\r
3967 \r
3968   /**\r
3969    * @brief Initialization function for the floating-point IIR lattice filter.\r
3970    * @param[in] *S points to an instance of the floating-point IIR lattice structure.\r
3971    * @param[in] numStages number of stages in the filter.\r
3972    * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.\r
3973    * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.\r
3974    * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize-1.\r
3975    * @param[in] blockSize number of samples to process.\r
3976    * @return none.\r
3977    */\r
3978 \r
3979   void arm_iir_lattice_init_f32(\r
3980   arm_iir_lattice_instance_f32 * S,\r
3981   uint16_t numStages,\r
3982   float32_t * pkCoeffs,\r
3983   float32_t * pvCoeffs,\r
3984   float32_t * pState,\r
3985   uint32_t blockSize);\r
3986 \r
3987 \r
3988   /**\r
3989    * @brief Processing function for the Q31 IIR lattice filter.\r
3990    * @param[in] *S points to an instance of the Q31 IIR lattice structure.\r
3991    * @param[in] *pSrc points to the block of input data.\r
3992    * @param[out] *pDst points to the block of output data.\r
3993    * @param[in] blockSize number of samples to process.\r
3994    * @return none.\r
3995    */\r
3996 \r
3997   void arm_iir_lattice_q31(\r
3998   const arm_iir_lattice_instance_q31 * S,\r
3999   q31_t * pSrc,\r
4000   q31_t * pDst,\r
4001   uint32_t blockSize);\r
4002 \r
4003 \r
4004   /**\r
4005    * @brief Initialization function for the Q31 IIR lattice filter.\r
4006    * @param[in] *S points to an instance of the Q31 IIR lattice structure.\r
4007    * @param[in] numStages number of stages in the filter.\r
4008    * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.\r
4009    * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.\r
4010    * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize.\r
4011    * @param[in] blockSize number of samples to process.\r
4012    * @return none.\r
4013    */\r
4014 \r
4015   void arm_iir_lattice_init_q31(\r
4016   arm_iir_lattice_instance_q31 * S,\r
4017   uint16_t numStages,\r
4018   q31_t * pkCoeffs,\r
4019   q31_t * pvCoeffs,\r
4020   q31_t * pState,\r
4021   uint32_t blockSize);\r
4022 \r
4023 \r
4024   /**\r
4025    * @brief Processing function for the Q15 IIR lattice filter.\r
4026    * @param[in] *S points to an instance of the Q15 IIR lattice structure.\r
4027    * @param[in] *pSrc points to the block of input data.\r
4028    * @param[out] *pDst points to the block of output data.\r
4029    * @param[in] blockSize number of samples to process.\r
4030    * @return none.\r
4031    */\r
4032 \r
4033   void arm_iir_lattice_q15(\r
4034   const arm_iir_lattice_instance_q15 * S,\r
4035   q15_t * pSrc,\r
4036   q15_t * pDst,\r
4037   uint32_t blockSize);\r
4038 \r
4039 \r
4040 /**\r
4041  * @brief Initialization function for the Q15 IIR lattice filter.\r
4042  * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.\r
4043  * @param[in] numStages  number of stages in the filter.\r
4044  * @param[in] *pkCoeffs points to reflection coefficient buffer.  The array is of length numStages.\r
4045  * @param[in] *pvCoeffs points to ladder coefficient buffer.  The array is of length numStages+1.\r
4046  * @param[in] *pState points to state buffer.  The array is of length numStages+blockSize.\r
4047  * @param[in] blockSize number of samples to process per call.\r
4048  * @return none.\r
4049  */\r
4050 \r
4051   void arm_iir_lattice_init_q15(\r
4052   arm_iir_lattice_instance_q15 * S,\r
4053   uint16_t numStages,\r
4054   q15_t * pkCoeffs,\r
4055   q15_t * pvCoeffs,\r
4056   q15_t * pState,\r
4057   uint32_t blockSize);\r
4058 \r
4059   /**\r
4060    * @brief Instance structure for the floating-point LMS filter.\r
4061    */\r
4062 \r
4063   typedef struct\r
4064   {\r
4065     uint16_t numTaps;    /**< number of coefficients in the filter. */\r
4066     float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4067     float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */\r
4068     float32_t mu;        /**< step size that controls filter coefficient updates. */\r
4069   } arm_lms_instance_f32;\r
4070 \r
4071   /**\r
4072    * @brief Processing function for floating-point LMS filter.\r
4073    * @param[in]  *S points to an instance of the floating-point LMS filter structure.\r
4074    * @param[in]  *pSrc points to the block of input data.\r
4075    * @param[in]  *pRef points to the block of reference data.\r
4076    * @param[out] *pOut points to the block of output data.\r
4077    * @param[out] *pErr points to the block of error data.\r
4078    * @param[in]  blockSize number of samples to process.\r
4079    * @return     none.\r
4080    */\r
4081 \r
4082   void arm_lms_f32(\r
4083   const arm_lms_instance_f32 * S,\r
4084   float32_t * pSrc,\r
4085   float32_t * pRef,\r
4086   float32_t * pOut,\r
4087   float32_t * pErr,\r
4088   uint32_t blockSize);\r
4089 \r
4090   /**\r
4091    * @brief Initialization function for floating-point LMS filter.\r
4092    * @param[in] *S points to an instance of the floating-point LMS filter structure.\r
4093    * @param[in] numTaps  number of filter coefficients.\r
4094    * @param[in] *pCoeffs points to the coefficient buffer.\r
4095    * @param[in] *pState points to state buffer.\r
4096    * @param[in] mu step size that controls filter coefficient updates.\r
4097    * @param[in] blockSize number of samples to process.\r
4098    * @return none.\r
4099    */\r
4100 \r
4101   void arm_lms_init_f32(\r
4102   arm_lms_instance_f32 * S,\r
4103   uint16_t numTaps,\r
4104   float32_t * pCoeffs,\r
4105   float32_t * pState,\r
4106   float32_t mu,\r
4107   uint32_t blockSize);\r
4108 \r
4109   /**\r
4110    * @brief Instance structure for the Q15 LMS filter.\r
4111    */\r
4112 \r
4113   typedef struct\r
4114   {\r
4115     uint16_t numTaps;    /**< number of coefficients in the filter. */\r
4116     q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4117     q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */\r
4118     q15_t mu;            /**< step size that controls filter coefficient updates. */\r
4119     uint32_t postShift;  /**< bit shift applied to coefficients. */\r
4120   } arm_lms_instance_q15;\r
4121 \r
4122 \r
4123   /**\r
4124    * @brief Initialization function for the Q15 LMS filter.\r
4125    * @param[in] *S points to an instance of the Q15 LMS filter structure.\r
4126    * @param[in] numTaps  number of filter coefficients.\r
4127    * @param[in] *pCoeffs points to the coefficient buffer.\r
4128    * @param[in] *pState points to the state buffer.\r
4129    * @param[in] mu step size that controls filter coefficient updates.\r
4130    * @param[in] blockSize number of samples to process.\r
4131    * @param[in] postShift bit shift applied to coefficients.\r
4132    * @return    none.\r
4133    */\r
4134 \r
4135   void arm_lms_init_q15(\r
4136   arm_lms_instance_q15 * S,\r
4137   uint16_t numTaps,\r
4138   q15_t * pCoeffs,\r
4139   q15_t * pState,\r
4140   q15_t mu,\r
4141   uint32_t blockSize,\r
4142   uint32_t postShift);\r
4143 \r
4144   /**\r
4145    * @brief Processing function for Q15 LMS filter.\r
4146    * @param[in] *S points to an instance of the Q15 LMS filter structure.\r
4147    * @param[in] *pSrc points to the block of input data.\r
4148    * @param[in] *pRef points to the block of reference data.\r
4149    * @param[out] *pOut points to the block of output data.\r
4150    * @param[out] *pErr points to the block of error data.\r
4151    * @param[in] blockSize number of samples to process.\r
4152    * @return none.\r
4153    */\r
4154 \r
4155   void arm_lms_q15(\r
4156   const arm_lms_instance_q15 * S,\r
4157   q15_t * pSrc,\r
4158   q15_t * pRef,\r
4159   q15_t * pOut,\r
4160   q15_t * pErr,\r
4161   uint32_t blockSize);\r
4162 \r
4163 \r
4164   /**\r
4165    * @brief Instance structure for the Q31 LMS filter.\r
4166    */\r
4167 \r
4168   typedef struct\r
4169   {\r
4170     uint16_t numTaps;    /**< number of coefficients in the filter. */\r
4171     q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4172     q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */\r
4173     q31_t mu;            /**< step size that controls filter coefficient updates. */\r
4174     uint32_t postShift;  /**< bit shift applied to coefficients. */\r
4175 \r
4176   } arm_lms_instance_q31;\r
4177 \r
4178   /**\r
4179    * @brief Processing function for Q31 LMS filter.\r
4180    * @param[in]  *S points to an instance of the Q15 LMS filter structure.\r
4181    * @param[in]  *pSrc points to the block of input data.\r
4182    * @param[in]  *pRef points to the block of reference data.\r
4183    * @param[out] *pOut points to the block of output data.\r
4184    * @param[out] *pErr points to the block of error data.\r
4185    * @param[in]  blockSize number of samples to process.\r
4186    * @return     none.\r
4187    */\r
4188 \r
4189   void arm_lms_q31(\r
4190   const arm_lms_instance_q31 * S,\r
4191   q31_t * pSrc,\r
4192   q31_t * pRef,\r
4193   q31_t * pOut,\r
4194   q31_t * pErr,\r
4195   uint32_t blockSize);\r
4196 \r
4197   /**\r
4198    * @brief Initialization function for Q31 LMS filter.\r
4199    * @param[in] *S points to an instance of the Q31 LMS filter structure.\r
4200    * @param[in] numTaps  number of filter coefficients.\r
4201    * @param[in] *pCoeffs points to coefficient buffer.\r
4202    * @param[in] *pState points to state buffer.\r
4203    * @param[in] mu step size that controls filter coefficient updates.\r
4204    * @param[in] blockSize number of samples to process.\r
4205    * @param[in] postShift bit shift applied to coefficients.\r
4206    * @return none.\r
4207    */\r
4208 \r
4209   void arm_lms_init_q31(\r
4210   arm_lms_instance_q31 * S,\r
4211   uint16_t numTaps,\r
4212   q31_t * pCoeffs,\r
4213   q31_t * pState,\r
4214   q31_t mu,\r
4215   uint32_t blockSize,\r
4216   uint32_t postShift);\r
4217 \r
4218   /**\r
4219    * @brief Instance structure for the floating-point normalized LMS filter.\r
4220    */\r
4221 \r
4222   typedef struct\r
4223   {\r
4224     uint16_t numTaps;     /**< number of coefficients in the filter. */\r
4225     float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4226     float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */\r
4227     float32_t mu;        /**< step size that control filter coefficient updates. */\r
4228     float32_t energy;    /**< saves previous frame energy. */\r
4229     float32_t x0;        /**< saves previous input sample. */\r
4230   } arm_lms_norm_instance_f32;\r
4231 \r
4232   /**\r
4233    * @brief Processing function for floating-point normalized LMS filter.\r
4234    * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.\r
4235    * @param[in] *pSrc points to the block of input data.\r
4236    * @param[in] *pRef points to the block of reference data.\r
4237    * @param[out] *pOut points to the block of output data.\r
4238    * @param[out] *pErr points to the block of error data.\r
4239    * @param[in] blockSize number of samples to process.\r
4240    * @return none.\r
4241    */\r
4242 \r
4243   void arm_lms_norm_f32(\r
4244   arm_lms_norm_instance_f32 * S,\r
4245   float32_t * pSrc,\r
4246   float32_t * pRef,\r
4247   float32_t * pOut,\r
4248   float32_t * pErr,\r
4249   uint32_t blockSize);\r
4250 \r
4251   /**\r
4252    * @brief Initialization function for floating-point normalized LMS filter.\r
4253    * @param[in] *S points to an instance of the floating-point LMS filter structure.\r
4254    * @param[in] numTaps  number of filter coefficients.\r
4255    * @param[in] *pCoeffs points to coefficient buffer.\r
4256    * @param[in] *pState points to state buffer.\r
4257    * @param[in] mu step size that controls filter coefficient updates.\r
4258    * @param[in] blockSize number of samples to process.\r
4259    * @return none.\r
4260    */\r
4261 \r
4262   void arm_lms_norm_init_f32(\r
4263   arm_lms_norm_instance_f32 * S,\r
4264   uint16_t numTaps,\r
4265   float32_t * pCoeffs,\r
4266   float32_t * pState,\r
4267   float32_t mu,\r
4268   uint32_t blockSize);\r
4269 \r
4270 \r
4271   /**\r
4272    * @brief Instance structure for the Q31 normalized LMS filter.\r
4273    */\r
4274   typedef struct\r
4275   {\r
4276     uint16_t numTaps;     /**< number of coefficients in the filter. */\r
4277     q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4278     q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */\r
4279     q31_t mu;             /**< step size that controls filter coefficient updates. */\r
4280     uint8_t postShift;    /**< bit shift applied to coefficients. */\r
4281     q31_t *recipTable;    /**< points to the reciprocal initial value table. */\r
4282     q31_t energy;         /**< saves previous frame energy. */\r
4283     q31_t x0;             /**< saves previous input sample. */\r
4284   } arm_lms_norm_instance_q31;\r
4285 \r
4286   /**\r
4287    * @brief Processing function for Q31 normalized LMS filter.\r
4288    * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.\r
4289    * @param[in] *pSrc points to the block of input data.\r
4290    * @param[in] *pRef points to the block of reference data.\r
4291    * @param[out] *pOut points to the block of output data.\r
4292    * @param[out] *pErr points to the block of error data.\r
4293    * @param[in] blockSize number of samples to process.\r
4294    * @return none.\r
4295    */\r
4296 \r
4297   void arm_lms_norm_q31(\r
4298   arm_lms_norm_instance_q31 * S,\r
4299   q31_t * pSrc,\r
4300   q31_t * pRef,\r
4301   q31_t * pOut,\r
4302   q31_t * pErr,\r
4303   uint32_t blockSize);\r
4304 \r
4305   /**\r
4306    * @brief Initialization function for Q31 normalized LMS filter.\r
4307    * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.\r
4308    * @param[in] numTaps  number of filter coefficients.\r
4309    * @param[in] *pCoeffs points to coefficient buffer.\r
4310    * @param[in] *pState points to state buffer.\r
4311    * @param[in] mu step size that controls filter coefficient updates.\r
4312    * @param[in] blockSize number of samples to process.\r
4313    * @param[in] postShift bit shift applied to coefficients.\r
4314    * @return none.\r
4315    */\r
4316 \r
4317   void arm_lms_norm_init_q31(\r
4318   arm_lms_norm_instance_q31 * S,\r
4319   uint16_t numTaps,\r
4320   q31_t * pCoeffs,\r
4321   q31_t * pState,\r
4322   q31_t mu,\r
4323   uint32_t blockSize,\r
4324   uint8_t postShift);\r
4325 \r
4326   /**\r
4327    * @brief Instance structure for the Q15 normalized LMS filter.\r
4328    */\r
4329 \r
4330   typedef struct\r
4331   {\r
4332     uint16_t numTaps;    /**< Number of coefficients in the filter. */\r
4333     q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */\r
4334     q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */\r
4335     q15_t mu;            /**< step size that controls filter coefficient updates. */\r
4336     uint8_t postShift;   /**< bit shift applied to coefficients. */\r
4337     q15_t *recipTable;   /**< Points to the reciprocal initial value table. */\r
4338     q15_t energy;        /**< saves previous frame energy. */\r
4339     q15_t x0;            /**< saves previous input sample. */\r
4340   } arm_lms_norm_instance_q15;\r
4341 \r
4342   /**\r
4343    * @brief Processing function for Q15 normalized LMS filter.\r
4344    * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.\r
4345    * @param[in] *pSrc points to the block of input data.\r
4346    * @param[in] *pRef points to the block of reference data.\r
4347    * @param[out] *pOut points to the block of output data.\r
4348    * @param[out] *pErr points to the block of error data.\r
4349    * @param[in] blockSize number of samples to process.\r
4350    * @return none.\r
4351    */\r
4352 \r
4353   void arm_lms_norm_q15(\r
4354   arm_lms_norm_instance_q15 * S,\r
4355   q15_t * pSrc,\r
4356   q15_t * pRef,\r
4357   q15_t * pOut,\r
4358   q15_t * pErr,\r
4359   uint32_t blockSize);\r
4360 \r
4361 \r
4362   /**\r
4363    * @brief Initialization function for Q15 normalized LMS filter.\r
4364    * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.\r
4365    * @param[in] numTaps  number of filter coefficients.\r
4366    * @param[in] *pCoeffs points to coefficient buffer.\r
4367    * @param[in] *pState points to state buffer.\r
4368    * @param[in] mu step size that controls filter coefficient updates.\r
4369    * @param[in] blockSize number of samples to process.\r
4370    * @param[in] postShift bit shift applied to coefficients.\r
4371    * @return none.\r
4372    */\r
4373 \r
4374   void arm_lms_norm_init_q15(\r
4375   arm_lms_norm_instance_q15 * S,\r
4376   uint16_t numTaps,\r
4377   q15_t * pCoeffs,\r
4378   q15_t * pState,\r
4379   q15_t mu,\r
4380   uint32_t blockSize,\r
4381   uint8_t postShift);\r
4382 \r
4383   /**\r
4384    * @brief Correlation of floating-point sequences.\r
4385    * @param[in] *pSrcA points to the first input sequence.\r
4386    * @param[in] srcALen length of the first input sequence.\r
4387    * @param[in] *pSrcB points to the second input sequence.\r
4388    * @param[in] srcBLen length of the second input sequence.\r
4389    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4390    * @return none.\r
4391    */\r
4392 \r
4393   void arm_correlate_f32(\r
4394   float32_t * pSrcA,\r
4395   uint32_t srcALen,\r
4396   float32_t * pSrcB,\r
4397   uint32_t srcBLen,\r
4398   float32_t * pDst);\r
4399 \r
4400 \r
4401    /**\r
4402    * @brief Correlation of Q15 sequences\r
4403    * @param[in] *pSrcA points to the first input sequence.\r
4404    * @param[in] srcALen length of the first input sequence.\r
4405    * @param[in] *pSrcB points to the second input sequence.\r
4406    * @param[in] srcBLen length of the second input sequence.\r
4407    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4408    * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4409    * @return none.\r
4410    */\r
4411   void arm_correlate_opt_q15(\r
4412   q15_t * pSrcA,\r
4413   uint32_t srcALen,\r
4414   q15_t * pSrcB,\r
4415   uint32_t srcBLen,\r
4416   q15_t * pDst,\r
4417   q15_t * pScratch);\r
4418 \r
4419 \r
4420   /**\r
4421    * @brief Correlation of Q15 sequences.\r
4422    * @param[in] *pSrcA points to the first input sequence.\r
4423    * @param[in] srcALen length of the first input sequence.\r
4424    * @param[in] *pSrcB points to the second input sequence.\r
4425    * @param[in] srcBLen length of the second input sequence.\r
4426    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4427    * @return none.\r
4428    */\r
4429 \r
4430   void arm_correlate_q15(\r
4431   q15_t * pSrcA,\r
4432   uint32_t srcALen,\r
4433   q15_t * pSrcB,\r
4434   uint32_t srcBLen,\r
4435   q15_t * pDst);\r
4436 \r
4437   /**\r
4438    * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.\r
4439    * @param[in] *pSrcA points to the first input sequence.\r
4440    * @param[in] srcALen length of the first input sequence.\r
4441    * @param[in] *pSrcB points to the second input sequence.\r
4442    * @param[in] srcBLen length of the second input sequence.\r
4443    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4444    * @return none.\r
4445    */\r
4446 \r
4447   void arm_correlate_fast_q15(\r
4448                                q15_t * pSrcA,\r
4449                               uint32_t srcALen,\r
4450                                q15_t * pSrcB,\r
4451                               uint32_t srcBLen,\r
4452                               q15_t * pDst);\r
4453 \r
4454 \r
4455 \r
4456   /**\r
4457    * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.\r
4458    * @param[in] *pSrcA points to the first input sequence.\r
4459    * @param[in] srcALen length of the first input sequence.\r
4460    * @param[in] *pSrcB points to the second input sequence.\r
4461    * @param[in] srcBLen length of the second input sequence.\r
4462    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4463    * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4464    * @return none.\r
4465    */\r
4466 \r
4467   void arm_correlate_fast_opt_q15(\r
4468   q15_t * pSrcA,\r
4469   uint32_t srcALen,\r
4470   q15_t * pSrcB,\r
4471   uint32_t srcBLen,\r
4472   q15_t * pDst,\r
4473   q15_t * pScratch);\r
4474 \r
4475   /**\r
4476    * @brief Correlation of Q31 sequences.\r
4477    * @param[in] *pSrcA points to the first input sequence.\r
4478    * @param[in] srcALen length of the first input sequence.\r
4479    * @param[in] *pSrcB points to the second input sequence.\r
4480    * @param[in] srcBLen length of the second input sequence.\r
4481    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4482    * @return none.\r
4483    */\r
4484 \r
4485   void arm_correlate_q31(\r
4486   q31_t * pSrcA,\r
4487   uint32_t srcALen,\r
4488   q31_t * pSrcB,\r
4489   uint32_t srcBLen,\r
4490   q31_t * pDst);\r
4491 \r
4492   /**\r
4493    * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4\r
4494    * @param[in] *pSrcA points to the first input sequence.\r
4495    * @param[in] srcALen length of the first input sequence.\r
4496    * @param[in] *pSrcB points to the second input sequence.\r
4497    * @param[in] srcBLen length of the second input sequence.\r
4498    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4499    * @return none.\r
4500    */\r
4501 \r
4502   void arm_correlate_fast_q31(\r
4503   q31_t * pSrcA,\r
4504   uint32_t srcALen,\r
4505   q31_t * pSrcB,\r
4506   uint32_t srcBLen,\r
4507   q31_t * pDst);\r
4508 \r
4509 \r
4510 \r
4511  /**\r
4512    * @brief Correlation of Q7 sequences.\r
4513    * @param[in] *pSrcA points to the first input sequence.\r
4514    * @param[in] srcALen length of the first input sequence.\r
4515    * @param[in] *pSrcB points to the second input sequence.\r
4516    * @param[in] srcBLen length of the second input sequence.\r
4517    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4518    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.\r
4519    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).\r
4520    * @return none.\r
4521    */\r
4522 \r
4523   void arm_correlate_opt_q7(\r
4524   q7_t * pSrcA,\r
4525   uint32_t srcALen,\r
4526   q7_t * pSrcB,\r
4527   uint32_t srcBLen,\r
4528   q7_t * pDst,\r
4529   q15_t * pScratch1,\r
4530   q15_t * pScratch2);\r
4531 \r
4532 \r
4533   /**\r
4534    * @brief Correlation of Q7 sequences.\r
4535    * @param[in] *pSrcA points to the first input sequence.\r
4536    * @param[in] srcALen length of the first input sequence.\r
4537    * @param[in] *pSrcB points to the second input sequence.\r
4538    * @param[in] srcBLen length of the second input sequence.\r
4539    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.\r
4540    * @return none.\r
4541    */\r
4542 \r
4543   void arm_correlate_q7(\r
4544   q7_t * pSrcA,\r
4545   uint32_t srcALen,\r
4546   q7_t * pSrcB,\r
4547   uint32_t srcBLen,\r
4548   q7_t * pDst);\r
4549 \r
4550 \r
4551   /**\r
4552    * @brief Instance structure for the floating-point sparse FIR filter.\r
4553    */\r
4554   typedef struct\r
4555   {\r
4556     uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4557     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4558     float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4559     float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/\r
4560     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4561     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4562   } arm_fir_sparse_instance_f32;\r
4563 \r
4564   /**\r
4565    * @brief Instance structure for the Q31 sparse FIR filter.\r
4566    */\r
4567 \r
4568   typedef struct\r
4569   {\r
4570     uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4571     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4572     q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4573     q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/\r
4574     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4575     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4576   } arm_fir_sparse_instance_q31;\r
4577 \r
4578   /**\r
4579    * @brief Instance structure for the Q15 sparse FIR filter.\r
4580    */\r
4581 \r
4582   typedef struct\r
4583   {\r
4584     uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4585     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4586     q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4587     q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/\r
4588     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4589     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4590   } arm_fir_sparse_instance_q15;\r
4591 \r
4592   /**\r
4593    * @brief Instance structure for the Q7 sparse FIR filter.\r
4594    */\r
4595 \r
4596   typedef struct\r
4597   {\r
4598     uint16_t numTaps;             /**< number of coefficients in the filter. */\r
4599     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */\r
4600     q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */\r
4601     q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/\r
4602     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */\r
4603     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */\r
4604   } arm_fir_sparse_instance_q7;\r
4605 \r
4606   /**\r
4607    * @brief Processing function for the floating-point sparse FIR filter.\r
4608    * @param[in]  *S          points to an instance of the floating-point sparse FIR structure.\r
4609    * @param[in]  *pSrc       points to the block of input data.\r
4610    * @param[out] *pDst       points to the block of output data\r
4611    * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.\r
4612    * @param[in]  blockSize   number of input samples to process per call.\r
4613    * @return none.\r
4614    */\r
4615 \r
4616   void arm_fir_sparse_f32(\r
4617   arm_fir_sparse_instance_f32 * S,\r
4618   float32_t * pSrc,\r
4619   float32_t * pDst,\r
4620   float32_t * pScratchIn,\r
4621   uint32_t blockSize);\r
4622 \r
4623   /**\r
4624    * @brief  Initialization function for the floating-point sparse FIR filter.\r
4625    * @param[in,out] *S         points to an instance of the floating-point sparse FIR structure.\r
4626    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4627    * @param[in]     *pCoeffs   points to the array of filter coefficients.\r
4628    * @param[in]     *pState    points to the state buffer.\r
4629    * @param[in]     *pTapDelay points to the array of offset times.\r
4630    * @param[in]     maxDelay   maximum offset time supported.\r
4631    * @param[in]     blockSize  number of samples that will be processed per block.\r
4632    * @return none\r
4633    */\r
4634 \r
4635   void arm_fir_sparse_init_f32(\r
4636   arm_fir_sparse_instance_f32 * S,\r
4637   uint16_t numTaps,\r
4638   float32_t * pCoeffs,\r
4639   float32_t * pState,\r
4640   int32_t * pTapDelay,\r
4641   uint16_t maxDelay,\r
4642   uint32_t blockSize);\r
4643 \r
4644   /**\r
4645    * @brief Processing function for the Q31 sparse FIR filter.\r
4646    * @param[in]  *S          points to an instance of the Q31 sparse FIR structure.\r
4647    * @param[in]  *pSrc       points to the block of input data.\r
4648    * @param[out] *pDst       points to the block of output data\r
4649    * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.\r
4650    * @param[in]  blockSize   number of input samples to process per call.\r
4651    * @return none.\r
4652    */\r
4653 \r
4654   void arm_fir_sparse_q31(\r
4655   arm_fir_sparse_instance_q31 * S,\r
4656   q31_t * pSrc,\r
4657   q31_t * pDst,\r
4658   q31_t * pScratchIn,\r
4659   uint32_t blockSize);\r
4660 \r
4661   /**\r
4662    * @brief  Initialization function for the Q31 sparse FIR filter.\r
4663    * @param[in,out] *S         points to an instance of the Q31 sparse FIR structure.\r
4664    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4665    * @param[in]     *pCoeffs   points to the array of filter coefficients.\r
4666    * @param[in]     *pState    points to the state buffer.\r
4667    * @param[in]     *pTapDelay points to the array of offset times.\r
4668    * @param[in]     maxDelay   maximum offset time supported.\r
4669    * @param[in]     blockSize  number of samples that will be processed per block.\r
4670    * @return none\r
4671    */\r
4672 \r
4673   void arm_fir_sparse_init_q31(\r
4674   arm_fir_sparse_instance_q31 * S,\r
4675   uint16_t numTaps,\r
4676   q31_t * pCoeffs,\r
4677   q31_t * pState,\r
4678   int32_t * pTapDelay,\r
4679   uint16_t maxDelay,\r
4680   uint32_t blockSize);\r
4681 \r
4682   /**\r
4683    * @brief Processing function for the Q15 sparse FIR filter.\r
4684    * @param[in]  *S           points to an instance of the Q15 sparse FIR structure.\r
4685    * @param[in]  *pSrc        points to the block of input data.\r
4686    * @param[out] *pDst        points to the block of output data\r
4687    * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.\r
4688    * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.\r
4689    * @param[in]  blockSize    number of input samples to process per call.\r
4690    * @return none.\r
4691    */\r
4692 \r
4693   void arm_fir_sparse_q15(\r
4694   arm_fir_sparse_instance_q15 * S,\r
4695   q15_t * pSrc,\r
4696   q15_t * pDst,\r
4697   q15_t * pScratchIn,\r
4698   q31_t * pScratchOut,\r
4699   uint32_t blockSize);\r
4700 \r
4701 \r
4702   /**\r
4703    * @brief  Initialization function for the Q15 sparse FIR filter.\r
4704    * @param[in,out] *S         points to an instance of the Q15 sparse FIR structure.\r
4705    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4706    * @param[in]     *pCoeffs   points to the array of filter coefficients.\r
4707    * @param[in]     *pState    points to the state buffer.\r
4708    * @param[in]     *pTapDelay points to the array of offset times.\r
4709    * @param[in]     maxDelay   maximum offset time supported.\r
4710    * @param[in]     blockSize  number of samples that will be processed per block.\r
4711    * @return none\r
4712    */\r
4713 \r
4714   void arm_fir_sparse_init_q15(\r
4715   arm_fir_sparse_instance_q15 * S,\r
4716   uint16_t numTaps,\r
4717   q15_t * pCoeffs,\r
4718   q15_t * pState,\r
4719   int32_t * pTapDelay,\r
4720   uint16_t maxDelay,\r
4721   uint32_t blockSize);\r
4722 \r
4723   /**\r
4724    * @brief Processing function for the Q7 sparse FIR filter.\r
4725    * @param[in]  *S           points to an instance of the Q7 sparse FIR structure.\r
4726    * @param[in]  *pSrc        points to the block of input data.\r
4727    * @param[out] *pDst        points to the block of output data\r
4728    * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.\r
4729    * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.\r
4730    * @param[in]  blockSize    number of input samples to process per call.\r
4731    * @return none.\r
4732    */\r
4733 \r
4734   void arm_fir_sparse_q7(\r
4735   arm_fir_sparse_instance_q7 * S,\r
4736   q7_t * pSrc,\r
4737   q7_t * pDst,\r
4738   q7_t * pScratchIn,\r
4739   q31_t * pScratchOut,\r
4740   uint32_t blockSize);\r
4741 \r
4742   /**\r
4743    * @brief  Initialization function for the Q7 sparse FIR filter.\r
4744    * @param[in,out] *S         points to an instance of the Q7 sparse FIR structure.\r
4745    * @param[in]     numTaps    number of nonzero coefficients in the filter.\r
4746    * @param[in]     *pCoeffs   points to the array of filter coefficients.\r
4747    * @param[in]     *pState    points to the state buffer.\r
4748    * @param[in]     *pTapDelay points to the array of offset times.\r
4749    * @param[in]     maxDelay   maximum offset time supported.\r
4750    * @param[in]     blockSize  number of samples that will be processed per block.\r
4751    * @return none\r
4752    */\r
4753 \r
4754   void arm_fir_sparse_init_q7(\r
4755   arm_fir_sparse_instance_q7 * S,\r
4756   uint16_t numTaps,\r
4757   q7_t * pCoeffs,\r
4758   q7_t * pState,\r
4759   int32_t * pTapDelay,\r
4760   uint16_t maxDelay,\r
4761   uint32_t blockSize);\r
4762 \r
4763 \r
4764   /*\r
4765    * @brief  Floating-point sin_cos function.\r
4766    * @param[in]  theta    input value in degrees\r
4767    * @param[out] *pSinVal points to the processed sine output.\r
4768    * @param[out] *pCosVal points to the processed cos output.\r
4769    * @return none.\r
4770    */\r
4771 \r
4772   void arm_sin_cos_f32(\r
4773   float32_t theta,\r
4774   float32_t * pSinVal,\r
4775   float32_t * pCcosVal);\r
4776 \r
4777   /*\r
4778    * @brief  Q31 sin_cos function.\r
4779    * @param[in]  theta    scaled input value in degrees\r
4780    * @param[out] *pSinVal points to the processed sine output.\r
4781    * @param[out] *pCosVal points to the processed cosine output.\r
4782    * @return none.\r
4783    */\r
4784 \r
4785   void arm_sin_cos_q31(\r
4786   q31_t theta,\r
4787   q31_t * pSinVal,\r
4788   q31_t * pCosVal);\r
4789 \r
4790 \r
4791   /**\r
4792    * @brief  Floating-point complex conjugate.\r
4793    * @param[in]  *pSrc points to the input vector\r
4794    * @param[out]  *pDst points to the output vector\r
4795    * @param[in]  numSamples number of complex samples in each vector\r
4796    * @return none.\r
4797    */\r
4798 \r
4799   void arm_cmplx_conj_f32(\r
4800   float32_t * pSrc,\r
4801   float32_t * pDst,\r
4802   uint32_t numSamples);\r
4803 \r
4804   /**\r
4805    * @brief  Q31 complex conjugate.\r
4806    * @param[in]  *pSrc points to the input vector\r
4807    * @param[out]  *pDst points to the output vector\r
4808    * @param[in]  numSamples number of complex samples in each vector\r
4809    * @return none.\r
4810    */\r
4811 \r
4812   void arm_cmplx_conj_q31(\r
4813   q31_t * pSrc,\r
4814   q31_t * pDst,\r
4815   uint32_t numSamples);\r
4816 \r
4817   /**\r
4818    * @brief  Q15 complex conjugate.\r
4819    * @param[in]  *pSrc points to the input vector\r
4820    * @param[out]  *pDst points to the output vector\r
4821    * @param[in]  numSamples number of complex samples in each vector\r
4822    * @return none.\r
4823    */\r
4824 \r
4825   void arm_cmplx_conj_q15(\r
4826   q15_t * pSrc,\r
4827   q15_t * pDst,\r
4828   uint32_t numSamples);\r
4829 \r
4830 \r
4831 \r
4832   /**\r
4833    * @brief  Floating-point complex magnitude squared\r
4834    * @param[in]  *pSrc points to the complex input vector\r
4835    * @param[out]  *pDst points to the real output vector\r
4836    * @param[in]  numSamples number of complex samples in the input vector\r
4837    * @return none.\r
4838    */\r
4839 \r
4840   void arm_cmplx_mag_squared_f32(\r
4841   float32_t * pSrc,\r
4842   float32_t * pDst,\r
4843   uint32_t numSamples);\r
4844 \r
4845   /**\r
4846    * @brief  Q31 complex magnitude squared\r
4847    * @param[in]  *pSrc points to the complex input vector\r
4848    * @param[out]  *pDst points to the real output vector\r
4849    * @param[in]  numSamples number of complex samples in the input vector\r
4850    * @return none.\r
4851    */\r
4852 \r
4853   void arm_cmplx_mag_squared_q31(\r
4854   q31_t * pSrc,\r
4855   q31_t * pDst,\r
4856   uint32_t numSamples);\r
4857 \r
4858   /**\r
4859    * @brief  Q15 complex magnitude squared\r
4860    * @param[in]  *pSrc points to the complex input vector\r
4861    * @param[out]  *pDst points to the real output vector\r
4862    * @param[in]  numSamples number of complex samples in the input vector\r
4863    * @return none.\r
4864    */\r
4865 \r
4866   void arm_cmplx_mag_squared_q15(\r
4867   q15_t * pSrc,\r
4868   q15_t * pDst,\r
4869   uint32_t numSamples);\r
4870 \r
4871 \r
4872  /**\r
4873    * @ingroup groupController\r
4874    */\r
4875 \r
4876   /**\r
4877    * @defgroup PID PID Motor Control\r
4878    *\r
4879    * A Proportional Integral Derivative (PID) controller is a generic feedback control\r
4880    * loop mechanism widely used in industrial control systems.\r
4881    * A PID controller is the most commonly used type of feedback controller.\r
4882    *\r
4883    * This set of functions implements (PID) controllers\r
4884    * for Q15, Q31, and floating-point data types.  The functions operate on a single sample\r
4885    * of data and each call to the function returns a single processed value.\r
4886    * <code>S</code> points to an instance of the PID control data structure.  <code>in</code>\r
4887    * is the input sample value. The functions return the output value.\r
4888    *\r
4889    * \par Algorithm:\r
4890    * <pre>\r
4891    *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]\r
4892    *    A0 = Kp + Ki + Kd\r
4893    *    A1 = (-Kp ) - (2 * Kd )\r
4894    *    A2 = Kd  </pre>\r
4895    *\r
4896    * \par\r
4897    * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant\r
4898    *\r
4899    * \par\r
4900    * \image html PID.gif "Proportional Integral Derivative Controller"\r
4901    *\r
4902    * \par\r
4903    * The PID controller calculates an "error" value as the difference between\r
4904    * the measured output and the reference input.\r
4905    * The controller attempts to minimize the error by adjusting the process control inputs.\r
4906    * The proportional value determines the reaction to the current error,\r
4907    * the integral value determines the reaction based on the sum of recent errors,\r
4908    * and the derivative value determines the reaction based on the rate at which the error has been changing.\r
4909    *\r
4910    * \par Instance Structure\r
4911    * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.\r
4912    * A separate instance structure must be defined for each PID Controller.\r
4913    * There are separate instance structure declarations for each of the 3 supported data types.\r
4914    *\r
4915    * \par Reset Functions\r
4916    * There is also an associated reset function for each data type which clears the state array.\r
4917    *\r
4918    * \par Initialization Functions\r
4919    * There is also an associated initialization function for each data type.\r
4920    * The initialization function performs the following operations:\r
4921    * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.\r
4922    * - Zeros out the values in the state buffer.\r
4923    *\r
4924    * \par\r
4925    * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.\r
4926    *\r
4927    * \par Fixed-Point Behavior\r
4928    * Care must be taken when using the fixed-point versions of the PID Controller functions.\r
4929    * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.\r
4930    * Refer to the function specific documentation below for usage guidelines.\r
4931    */\r
4932 \r
4933   /**\r
4934    * @addtogroup PID\r
4935    * @{\r
4936    */\r
4937 \r
4938   /**\r
4939    * @brief  Process function for the floating-point PID Control.\r
4940    * @param[in,out] *S is an instance of the floating-point PID Control structure\r
4941    * @param[in] in input sample to process\r
4942    * @return out processed output sample.\r
4943    */\r
4944 \r
4945 \r
4946   static __INLINE float32_t arm_pid_f32(\r
4947   arm_pid_instance_f32 * S,\r
4948   float32_t in)\r
4949   {\r
4950     float32_t out;\r
4951 \r
4952     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */\r
4953     out = (S->A0 * in) +\r
4954       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);\r
4955 \r
4956     /* Update state */\r
4957     S->state[1] = S->state[0];\r
4958     S->state[0] = in;\r
4959     S->state[2] = out;\r
4960 \r
4961     /* return to application */\r
4962     return (out);\r
4963 \r
4964   }\r
4965 \r
4966   /**\r
4967    * @brief  Process function for the Q31 PID Control.\r
4968    * @param[in,out] *S points to an instance of the Q31 PID Control structure\r
4969    * @param[in] in input sample to process\r
4970    * @return out processed output sample.\r
4971    *\r
4972    * <b>Scaling and Overflow Behavior:</b>\r
4973    * \par\r
4974    * The function is implemented using an internal 64-bit accumulator.\r
4975    * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.\r
4976    * Thus, if the accumulator result overflows it wraps around rather than clip.\r
4977    * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.\r
4978    * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.\r
4979    */\r
4980 \r
4981   static __INLINE q31_t arm_pid_q31(\r
4982   arm_pid_instance_q31 * S,\r
4983   q31_t in)\r
4984   {\r
4985     q63_t acc;\r
4986     q31_t out;\r
4987 \r
4988     /* acc = A0 * x[n]  */\r
4989     acc = (q63_t) S->A0 * in;\r
4990 \r
4991     /* acc += A1 * x[n-1] */\r
4992     acc += (q63_t) S->A1 * S->state[0];\r
4993 \r
4994     /* acc += A2 * x[n-2]  */\r
4995     acc += (q63_t) S->A2 * S->state[1];\r
4996 \r
4997     /* convert output to 1.31 format to add y[n-1] */\r
4998     out = (q31_t) (acc >> 31u);\r
4999 \r
5000     /* out += y[n-1] */\r
5001     out += S->state[2];\r
5002 \r
5003     /* Update state */\r
5004     S->state[1] = S->state[0];\r
5005     S->state[0] = in;\r
5006     S->state[2] = out;\r
5007 \r
5008     /* return to application */\r
5009     return (out);\r
5010 \r
5011   }\r
5012 \r
5013   /**\r
5014    * @brief  Process function for the Q15 PID Control.\r
5015    * @param[in,out] *S points to an instance of the Q15 PID Control structure\r
5016    * @param[in] in input sample to process\r
5017    * @return out processed output sample.\r
5018    *\r
5019    * <b>Scaling and Overflow Behavior:</b>\r
5020    * \par\r
5021    * The function is implemented using a 64-bit internal accumulator.\r
5022    * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.\r
5023    * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.\r
5024    * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.\r
5025    * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.\r
5026    * Lastly, the accumulator is saturated to yield a result in 1.15 format.\r
5027    */\r
5028 \r
5029   static __INLINE q15_t arm_pid_q15(\r
5030   arm_pid_instance_q15 * S,\r
5031   q15_t in)\r
5032   {\r
5033     q63_t acc;\r
5034     q15_t out;\r
5035 \r
5036 #ifndef ARM_MATH_CM0_FAMILY\r
5037     __SIMD32_TYPE *vstate;\r
5038 \r
5039     /* Implementation of PID controller */\r
5040 \r
5041     /* acc = A0 * x[n]  */\r
5042     acc = (q31_t) __SMUAD(S->A0, in);\r
5043 \r
5044     /* acc += A1 * x[n-1] + A2 * x[n-2]  */\r
5045     vstate = __SIMD32_CONST(S->state);\r
5046     acc = __SMLALD(S->A1, (q31_t) *vstate, acc);\r
5047 \r
5048 #else\r
5049     /* acc = A0 * x[n]  */\r
5050     acc = ((q31_t) S->A0) * in;\r
5051 \r
5052     /* acc += A1 * x[n-1] + A2 * x[n-2]  */\r
5053     acc += (q31_t) S->A1 * S->state[0];\r
5054     acc += (q31_t) S->A2 * S->state[1];\r
5055 \r
5056 #endif\r
5057 \r
5058     /* acc += y[n-1] */\r
5059     acc += (q31_t) S->state[2] << 15;\r
5060 \r
5061     /* saturate the output */\r
5062     out = (q15_t) (__SSAT((acc >> 15), 16));\r
5063 \r
5064     /* Update state */\r
5065     S->state[1] = S->state[0];\r
5066     S->state[0] = in;\r
5067     S->state[2] = out;\r
5068 \r
5069     /* return to application */\r
5070     return (out);\r
5071 \r
5072   }\r
5073 \r
5074   /**\r
5075    * @} end of PID group\r
5076    */\r
5077 \r
5078 \r
5079   /**\r
5080    * @brief Floating-point matrix inverse.\r
5081    * @param[in]  *src points to the instance of the input floating-point matrix structure.\r
5082    * @param[out] *dst points to the instance of the output floating-point matrix structure.\r
5083    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.\r
5084    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.\r
5085    */\r
5086 \r
5087   arm_status arm_mat_inverse_f32(\r
5088   const arm_matrix_instance_f32 * src,\r
5089   arm_matrix_instance_f32 * dst);\r
5090 \r
5091 \r
5092 \r
5093   /**\r
5094    * @ingroup groupController\r
5095    */\r
5096 \r
5097 \r
5098   /**\r
5099    * @defgroup clarke Vector Clarke Transform\r
5100    * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.\r
5101    * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents\r
5102    * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.\r
5103    * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below\r
5104    * \image html clarke.gif Stator current space vector and its components in (a,b).\r
5105    * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>\r
5106    * can be calculated using only <code>Ia</code> and <code>Ib</code>.\r
5107    *\r
5108    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5109    * The library provides separate functions for Q31 and floating-point data types.\r
5110    * \par Algorithm\r
5111    * \image html clarkeFormula.gif\r
5112    * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and\r
5113    * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.\r
5114    * \par Fixed-Point Behavior\r
5115    * Care must be taken when using the Q31 version of the Clarke transform.\r
5116    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5117    * Refer to the function specific documentation below for usage guidelines.\r
5118    */\r
5119 \r
5120   /**\r
5121    * @addtogroup clarke\r
5122    * @{\r
5123    */\r
5124 \r
5125   /**\r
5126    *\r
5127    * @brief  Floating-point Clarke transform\r
5128    * @param[in]       Ia       input three-phase coordinate <code>a</code>\r
5129    * @param[in]       Ib       input three-phase coordinate <code>b</code>\r
5130    * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha\r
5131    * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta\r
5132    * @return none.\r
5133    */\r
5134 \r
5135   static __INLINE void arm_clarke_f32(\r
5136   float32_t Ia,\r
5137   float32_t Ib,\r
5138   float32_t * pIalpha,\r
5139   float32_t * pIbeta)\r
5140   {\r
5141     /* Calculate pIalpha using the equation, pIalpha = Ia */\r
5142     *pIalpha = Ia;\r
5143 \r
5144     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */\r
5145     *pIbeta =\r
5146       ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);\r
5147 \r
5148   }\r
5149 \r
5150   /**\r
5151    * @brief  Clarke transform for Q31 version\r
5152    * @param[in]       Ia       input three-phase coordinate <code>a</code>\r
5153    * @param[in]       Ib       input three-phase coordinate <code>b</code>\r
5154    * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha\r
5155    * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta\r
5156    * @return none.\r
5157    *\r
5158    * <b>Scaling and Overflow Behavior:</b>\r
5159    * \par\r
5160    * The function is implemented using an internal 32-bit accumulator.\r
5161    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5162    * There is saturation on the addition, hence there is no risk of overflow.\r
5163    */\r
5164 \r
5165   static __INLINE void arm_clarke_q31(\r
5166   q31_t Ia,\r
5167   q31_t Ib,\r
5168   q31_t * pIalpha,\r
5169   q31_t * pIbeta)\r
5170   {\r
5171     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5172 \r
5173     /* Calculating pIalpha from Ia by equation pIalpha = Ia */\r
5174     *pIalpha = Ia;\r
5175 \r
5176     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */\r
5177     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);\r
5178 \r
5179     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */\r
5180     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);\r
5181 \r
5182     /* pIbeta is calculated by adding the intermediate products */\r
5183     *pIbeta = __QADD(product1, product2);\r
5184   }\r
5185 \r
5186   /**\r
5187    * @} end of clarke group\r
5188    */\r
5189 \r
5190   /**\r
5191    * @brief  Converts the elements of the Q7 vector to Q31 vector.\r
5192    * @param[in]  *pSrc     input pointer\r
5193    * @param[out]  *pDst    output pointer\r
5194    * @param[in]  blockSize number of samples to process\r
5195    * @return none.\r
5196    */\r
5197   void arm_q7_to_q31(\r
5198   q7_t * pSrc,\r
5199   q31_t * pDst,\r
5200   uint32_t blockSize);\r
5201 \r
5202 \r
5203 \r
5204 \r
5205   /**\r
5206    * @ingroup groupController\r
5207    */\r
5208 \r
5209   /**\r
5210    * @defgroup inv_clarke Vector Inverse Clarke Transform\r
5211    * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.\r
5212    *\r
5213    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5214    * The library provides separate functions for Q31 and floating-point data types.\r
5215    * \par Algorithm\r
5216    * \image html clarkeInvFormula.gif\r
5217    * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and\r
5218    * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.\r
5219    * \par Fixed-Point Behavior\r
5220    * Care must be taken when using the Q31 version of the Clarke transform.\r
5221    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5222    * Refer to the function specific documentation below for usage guidelines.\r
5223    */\r
5224 \r
5225   /**\r
5226    * @addtogroup inv_clarke\r
5227    * @{\r
5228    */\r
5229 \r
5230    /**\r
5231    * @brief  Floating-point Inverse Clarke transform\r
5232    * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha\r
5233    * @param[in]       Ibeta   input two-phase orthogonal vector axis beta\r
5234    * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>\r
5235    * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>\r
5236    * @return none.\r
5237    */\r
5238 \r
5239 \r
5240   static __INLINE void arm_inv_clarke_f32(\r
5241   float32_t Ialpha,\r
5242   float32_t Ibeta,\r
5243   float32_t * pIa,\r
5244   float32_t * pIb)\r
5245   {\r
5246     /* Calculating pIa from Ialpha by equation pIa = Ialpha */\r
5247     *pIa = Ialpha;\r
5248 \r
5249     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */\r
5250     *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;\r
5251 \r
5252   }\r
5253 \r
5254   /**\r
5255    * @brief  Inverse Clarke transform for Q31 version\r
5256    * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha\r
5257    * @param[in]       Ibeta   input two-phase orthogonal vector axis beta\r
5258    * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>\r
5259    * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>\r
5260    * @return none.\r
5261    *\r
5262    * <b>Scaling and Overflow Behavior:</b>\r
5263    * \par\r
5264    * The function is implemented using an internal 32-bit accumulator.\r
5265    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5266    * There is saturation on the subtraction, hence there is no risk of overflow.\r
5267    */\r
5268 \r
5269   static __INLINE void arm_inv_clarke_q31(\r
5270   q31_t Ialpha,\r
5271   q31_t Ibeta,\r
5272   q31_t * pIa,\r
5273   q31_t * pIb)\r
5274   {\r
5275     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5276 \r
5277     /* Calculating pIa from Ialpha by equation pIa = Ialpha */\r
5278     *pIa = Ialpha;\r
5279 \r
5280     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */\r
5281     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);\r
5282 \r
5283     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */\r
5284     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);\r
5285 \r
5286     /* pIb is calculated by subtracting the products */\r
5287     *pIb = __QSUB(product2, product1);\r
5288 \r
5289   }\r
5290 \r
5291   /**\r
5292    * @} end of inv_clarke group\r
5293    */\r
5294 \r
5295   /**\r
5296    * @brief  Converts the elements of the Q7 vector to Q15 vector.\r
5297    * @param[in]  *pSrc     input pointer\r
5298    * @param[out] *pDst     output pointer\r
5299    * @param[in]  blockSize number of samples to process\r
5300    * @return none.\r
5301    */\r
5302   void arm_q7_to_q15(\r
5303   q7_t * pSrc,\r
5304   q15_t * pDst,\r
5305   uint32_t blockSize);\r
5306 \r
5307 \r
5308 \r
5309   /**\r
5310    * @ingroup groupController\r
5311    */\r
5312 \r
5313   /**\r
5314    * @defgroup park Vector Park Transform\r
5315    *\r
5316    * Forward Park transform converts the input two-coordinate vector to flux and torque components.\r
5317    * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents\r
5318    * from the stationary to the moving reference frame and control the spatial relationship between\r
5319    * the stator vector current and rotor flux vector.\r
5320    * If we consider the d axis aligned with the rotor flux, the diagram below shows the\r
5321    * current vector and the relationship from the two reference frames:\r
5322    * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"\r
5323    *\r
5324    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5325    * The library provides separate functions for Q31 and floating-point data types.\r
5326    * \par Algorithm\r
5327    * \image html parkFormula.gif\r
5328    * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,\r
5329    * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the\r
5330    * cosine and sine values of theta (rotor flux position).\r
5331    * \par Fixed-Point Behavior\r
5332    * Care must be taken when using the Q31 version of the Park transform.\r
5333    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5334    * Refer to the function specific documentation below for usage guidelines.\r
5335    */\r
5336 \r
5337   /**\r
5338    * @addtogroup park\r
5339    * @{\r
5340    */\r
5341 \r
5342   /**\r
5343    * @brief Floating-point Park transform\r
5344    * @param[in]       Ialpha input two-phase vector coordinate alpha\r
5345    * @param[in]       Ibeta  input two-phase vector coordinate beta\r
5346    * @param[out]      *pId   points to output   rotor reference frame d\r
5347    * @param[out]      *pIq   points to output   rotor reference frame q\r
5348    * @param[in]       sinVal sine value of rotation angle theta\r
5349    * @param[in]       cosVal cosine value of rotation angle theta\r
5350    * @return none.\r
5351    *\r
5352    * The function implements the forward Park transform.\r
5353    *\r
5354    */\r
5355 \r
5356   static __INLINE void arm_park_f32(\r
5357   float32_t Ialpha,\r
5358   float32_t Ibeta,\r
5359   float32_t * pId,\r
5360   float32_t * pIq,\r
5361   float32_t sinVal,\r
5362   float32_t cosVal)\r
5363   {\r
5364     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */\r
5365     *pId = Ialpha * cosVal + Ibeta * sinVal;\r
5366 \r
5367     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */\r
5368     *pIq = -Ialpha * sinVal + Ibeta * cosVal;\r
5369 \r
5370   }\r
5371 \r
5372   /**\r
5373    * @brief  Park transform for Q31 version\r
5374    * @param[in]       Ialpha input two-phase vector coordinate alpha\r
5375    * @param[in]       Ibeta  input two-phase vector coordinate beta\r
5376    * @param[out]      *pId   points to output rotor reference frame d\r
5377    * @param[out]      *pIq   points to output rotor reference frame q\r
5378    * @param[in]       sinVal sine value of rotation angle theta\r
5379    * @param[in]       cosVal cosine value of rotation angle theta\r
5380    * @return none.\r
5381    *\r
5382    * <b>Scaling and Overflow Behavior:</b>\r
5383    * \par\r
5384    * The function is implemented using an internal 32-bit accumulator.\r
5385    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5386    * There is saturation on the addition and subtraction, hence there is no risk of overflow.\r
5387    */\r
5388 \r
5389 \r
5390   static __INLINE void arm_park_q31(\r
5391   q31_t Ialpha,\r
5392   q31_t Ibeta,\r
5393   q31_t * pId,\r
5394   q31_t * pIq,\r
5395   q31_t sinVal,\r
5396   q31_t cosVal)\r
5397   {\r
5398     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5399     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */\r
5400 \r
5401     /* Intermediate product is calculated by (Ialpha * cosVal) */\r
5402     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);\r
5403 \r
5404     /* Intermediate product is calculated by (Ibeta * sinVal) */\r
5405     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);\r
5406 \r
5407 \r
5408     /* Intermediate product is calculated by (Ialpha * sinVal) */\r
5409     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);\r
5410 \r
5411     /* Intermediate product is calculated by (Ibeta * cosVal) */\r
5412     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);\r
5413 \r
5414     /* Calculate pId by adding the two intermediate products 1 and 2 */\r
5415     *pId = __QADD(product1, product2);\r
5416 \r
5417     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */\r
5418     *pIq = __QSUB(product4, product3);\r
5419   }\r
5420 \r
5421   /**\r
5422    * @} end of park group\r
5423    */\r
5424 \r
5425   /**\r
5426    * @brief  Converts the elements of the Q7 vector to floating-point vector.\r
5427    * @param[in]  *pSrc is input pointer\r
5428    * @param[out]  *pDst is output pointer\r
5429    * @param[in]  blockSize is the number of samples to process\r
5430    * @return none.\r
5431    */\r
5432   void arm_q7_to_float(\r
5433   q7_t * pSrc,\r
5434   float32_t * pDst,\r
5435   uint32_t blockSize);\r
5436 \r
5437 \r
5438   /**\r
5439    * @ingroup groupController\r
5440    */\r
5441 \r
5442   /**\r
5443    * @defgroup inv_park Vector Inverse Park transform\r
5444    * Inverse Park transform converts the input flux and torque components to two-coordinate vector.\r
5445    *\r
5446    * The function operates on a single sample of data and each call to the function returns the processed output.\r
5447    * The library provides separate functions for Q31 and floating-point data types.\r
5448    * \par Algorithm\r
5449    * \image html parkInvFormula.gif\r
5450    * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,\r
5451    * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the\r
5452    * cosine and sine values of theta (rotor flux position).\r
5453    * \par Fixed-Point Behavior\r
5454    * Care must be taken when using the Q31 version of the Park transform.\r
5455    * In particular, the overflow and saturation behavior of the accumulator used must be considered.\r
5456    * Refer to the function specific documentation below for usage guidelines.\r
5457    */\r
5458 \r
5459   /**\r
5460    * @addtogroup inv_park\r
5461    * @{\r
5462    */\r
5463 \r
5464    /**\r
5465    * @brief  Floating-point Inverse Park transform\r
5466    * @param[in]       Id        input coordinate of rotor reference frame d\r
5467    * @param[in]       Iq        input coordinate of rotor reference frame q\r
5468    * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha\r
5469    * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta\r
5470    * @param[in]       sinVal    sine value of rotation angle theta\r
5471    * @param[in]       cosVal    cosine value of rotation angle theta\r
5472    * @return none.\r
5473    */\r
5474 \r
5475   static __INLINE void arm_inv_park_f32(\r
5476   float32_t Id,\r
5477   float32_t Iq,\r
5478   float32_t * pIalpha,\r
5479   float32_t * pIbeta,\r
5480   float32_t sinVal,\r
5481   float32_t cosVal)\r
5482   {\r
5483     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */\r
5484     *pIalpha = Id * cosVal - Iq * sinVal;\r
5485 \r
5486     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */\r
5487     *pIbeta = Id * sinVal + Iq * cosVal;\r
5488 \r
5489   }\r
5490 \r
5491 \r
5492   /**\r
5493    * @brief  Inverse Park transform for Q31 version\r
5494    * @param[in]       Id        input coordinate of rotor reference frame d\r
5495    * @param[in]       Iq        input coordinate of rotor reference frame q\r
5496    * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha\r
5497    * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta\r
5498    * @param[in]       sinVal    sine value of rotation angle theta\r
5499    * @param[in]       cosVal    cosine value of rotation angle theta\r
5500    * @return none.\r
5501    *\r
5502    * <b>Scaling and Overflow Behavior:</b>\r
5503    * \par\r
5504    * The function is implemented using an internal 32-bit accumulator.\r
5505    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.\r
5506    * There is saturation on the addition, hence there is no risk of overflow.\r
5507    */\r
5508 \r
5509 \r
5510   static __INLINE void arm_inv_park_q31(\r
5511   q31_t Id,\r
5512   q31_t Iq,\r
5513   q31_t * pIalpha,\r
5514   q31_t * pIbeta,\r
5515   q31_t sinVal,\r
5516   q31_t cosVal)\r
5517   {\r
5518     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */\r
5519     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */\r
5520 \r
5521     /* Intermediate product is calculated by (Id * cosVal) */\r
5522     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);\r
5523 \r
5524     /* Intermediate product is calculated by (Iq * sinVal) */\r
5525     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);\r
5526 \r
5527 \r
5528     /* Intermediate product is calculated by (Id * sinVal) */\r
5529     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);\r
5530 \r
5531     /* Intermediate product is calculated by (Iq * cosVal) */\r
5532     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);\r
5533 \r
5534     /* Calculate pIalpha by using the two intermediate products 1 and 2 */\r
5535     *pIalpha = __QSUB(product1, product2);\r
5536 \r
5537     /* Calculate pIbeta by using the two intermediate products 3 and 4 */\r
5538     *pIbeta = __QADD(product4, product3);\r
5539 \r
5540   }\r
5541 \r
5542   /**\r
5543    * @} end of Inverse park group\r
5544    */\r
5545 \r
5546 \r
5547   /**\r
5548    * @brief  Converts the elements of the Q31 vector to floating-point vector.\r
5549    * @param[in]  *pSrc is input pointer\r
5550    * @param[out]  *pDst is output pointer\r
5551    * @param[in]  blockSize is the number of samples to process\r
5552    * @return none.\r
5553    */\r
5554   void arm_q31_to_float(\r
5555   q31_t * pSrc,\r
5556   float32_t * pDst,\r
5557   uint32_t blockSize);\r
5558 \r
5559   /**\r
5560    * @ingroup groupInterpolation\r
5561    */\r
5562 \r
5563   /**\r
5564    * @defgroup LinearInterpolate Linear Interpolation\r
5565    *\r
5566    * Linear interpolation is a method of curve fitting using linear polynomials.\r
5567    * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line\r
5568    *\r
5569    * \par\r
5570    * \image html LinearInterp.gif "Linear interpolation"\r
5571    *\r
5572    * \par\r
5573    * A  Linear Interpolate function calculates an output value(y), for the input(x)\r
5574    * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)\r
5575    *\r
5576    * \par Algorithm:\r
5577    * <pre>\r
5578    *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))\r
5579    *       where x0, x1 are nearest values of input x\r
5580    *             y0, y1 are nearest values to output y\r
5581    * </pre>\r
5582    *\r
5583    * \par\r
5584    * This set of functions implements Linear interpolation process\r
5585    * for Q7, Q15, Q31, and floating-point data types.  The functions operate on a single\r
5586    * sample of data and each call to the function returns a single processed value.\r
5587    * <code>S</code> points to an instance of the Linear Interpolate function data structure.\r
5588    * <code>x</code> is the input sample value. The functions returns the output value.\r
5589    *\r
5590    * \par\r
5591    * if x is outside of the table boundary, Linear interpolation returns first value of the table\r
5592    * if x is below input range and returns last value of table if x is above range.\r
5593    */\r
5594 \r
5595   /**\r
5596    * @addtogroup LinearInterpolate\r
5597    * @{\r
5598    */\r
5599 \r
5600   /**\r
5601    * @brief  Process function for the floating-point Linear Interpolation Function.\r
5602    * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure\r
5603    * @param[in] x input sample to process\r
5604    * @return y processed output sample.\r
5605    *\r
5606    */\r
5607 \r
5608   static __INLINE float32_t arm_linear_interp_f32(\r
5609   arm_linear_interp_instance_f32 * S,\r
5610   float32_t x)\r
5611   {\r
5612 \r
5613     float32_t y;\r
5614     float32_t x0, x1;                            /* Nearest input values */\r
5615     float32_t y0, y1;                            /* Nearest output values */\r
5616     float32_t xSpacing = S->xSpacing;            /* spacing between input values */\r
5617     int32_t i;                                   /* Index variable */\r
5618     float32_t *pYData = S->pYData;               /* pointer to output table */\r
5619 \r
5620     /* Calculation of index */\r
5621     i = (int32_t) ((x - S->x1) / xSpacing);\r
5622 \r
5623     if(i < 0)\r
5624     {\r
5625       /* Iniatilize output for below specified range as least output value of table */\r
5626       y = pYData[0];\r
5627     }\r
5628     else if((uint32_t)i >= S->nValues)\r
5629     {\r
5630       /* Iniatilize output for above specified range as last output value of table */\r
5631       y = pYData[S->nValues - 1];\r
5632     }\r
5633     else\r
5634     {\r
5635       /* Calculation of nearest input values */\r
5636       x0 = S->x1 + i * xSpacing;\r
5637       x1 = S->x1 + (i + 1) * xSpacing;\r
5638 \r
5639       /* Read of nearest output values */\r
5640       y0 = pYData[i];\r
5641       y1 = pYData[i + 1];\r
5642 \r
5643       /* Calculation of output */\r
5644       y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));\r
5645 \r
5646     }\r
5647 \r
5648     /* returns output value */\r
5649     return (y);\r
5650   }\r
5651 \r
5652    /**\r
5653    *\r
5654    * @brief  Process function for the Q31 Linear Interpolation Function.\r
5655    * @param[in] *pYData  pointer to Q31 Linear Interpolation table\r
5656    * @param[in] x input sample to process\r
5657    * @param[in] nValues number of table values\r
5658    * @return y processed output sample.\r
5659    *\r
5660    * \par\r
5661    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5662    * This function can support maximum of table size 2^12.\r
5663    *\r
5664    */\r
5665 \r
5666 \r
5667   static __INLINE q31_t arm_linear_interp_q31(\r
5668   q31_t * pYData,\r
5669   q31_t x,\r
5670   uint32_t nValues)\r
5671   {\r
5672     q31_t y;                                     /* output */\r
5673     q31_t y0, y1;                                /* Nearest output values */\r
5674     q31_t fract;                                 /* fractional part */\r
5675     int32_t index;                               /* Index to read nearest output values */\r
5676 \r
5677     /* Input is in 12.20 format */\r
5678     /* 12 bits for the table index */\r
5679     /* Index value calculation */\r
5680     index = ((x & 0xFFF00000) >> 20);\r
5681 \r
5682     if(index >= (int32_t)(nValues - 1))\r
5683     {\r
5684       return (pYData[nValues - 1]);\r
5685     }\r
5686     else if(index < 0)\r
5687     {\r
5688       return (pYData[0]);\r
5689     }\r
5690     else\r
5691     {\r
5692 \r
5693       /* 20 bits for the fractional part */\r
5694       /* shift left by 11 to keep fract in 1.31 format */\r
5695       fract = (x & 0x000FFFFF) << 11;\r
5696 \r
5697       /* Read two nearest output values from the index in 1.31(q31) format */\r
5698       y0 = pYData[index];\r
5699       y1 = pYData[index + 1u];\r
5700 \r
5701       /* Calculation of y0 * (1-fract) and y is in 2.30 format */\r
5702       y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));\r
5703 \r
5704       /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */\r
5705       y += ((q31_t) (((q63_t) y1 * fract) >> 32));\r
5706 \r
5707       /* Convert y to 1.31 format */\r
5708       return (y << 1u);\r
5709 \r
5710     }\r
5711 \r
5712   }\r
5713 \r
5714   /**\r
5715    *\r
5716    * @brief  Process function for the Q15 Linear Interpolation Function.\r
5717    * @param[in] *pYData  pointer to Q15 Linear Interpolation table\r
5718    * @param[in] x input sample to process\r
5719    * @param[in] nValues number of table values\r
5720    * @return y processed output sample.\r
5721    *\r
5722    * \par\r
5723    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5724    * This function can support maximum of table size 2^12.\r
5725    *\r
5726    */\r
5727 \r
5728 \r
5729   static __INLINE q15_t arm_linear_interp_q15(\r
5730   q15_t * pYData,\r
5731   q31_t x,\r
5732   uint32_t nValues)\r
5733   {\r
5734     q63_t y;                                     /* output */\r
5735     q15_t y0, y1;                                /* Nearest output values */\r
5736     q31_t fract;                                 /* fractional part */\r
5737     int32_t index;                               /* Index to read nearest output values */\r
5738 \r
5739     /* Input is in 12.20 format */\r
5740     /* 12 bits for the table index */\r
5741     /* Index value calculation */\r
5742     index = ((x & 0xFFF00000) >> 20u);\r
5743 \r
5744     if(index >= (int32_t)(nValues - 1))\r
5745     {\r
5746       return (pYData[nValues - 1]);\r
5747     }\r
5748     else if(index < 0)\r
5749     {\r
5750       return (pYData[0]);\r
5751     }\r
5752     else\r
5753     {\r
5754       /* 20 bits for the fractional part */\r
5755       /* fract is in 12.20 format */\r
5756       fract = (x & 0x000FFFFF);\r
5757 \r
5758       /* Read two nearest output values from the index */\r
5759       y0 = pYData[index];\r
5760       y1 = pYData[index + 1u];\r
5761 \r
5762       /* Calculation of y0 * (1-fract) and y is in 13.35 format */\r
5763       y = ((q63_t) y0 * (0xFFFFF - fract));\r
5764 \r
5765       /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */\r
5766       y += ((q63_t) y1 * (fract));\r
5767 \r
5768       /* convert y to 1.15 format */\r
5769       return (y >> 20);\r
5770     }\r
5771 \r
5772 \r
5773   }\r
5774 \r
5775   /**\r
5776    *\r
5777    * @brief  Process function for the Q7 Linear Interpolation Function.\r
5778    * @param[in] *pYData  pointer to Q7 Linear Interpolation table\r
5779    * @param[in] x input sample to process\r
5780    * @param[in] nValues number of table values\r
5781    * @return y processed output sample.\r
5782    *\r
5783    * \par\r
5784    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.\r
5785    * This function can support maximum of table size 2^12.\r
5786    */\r
5787 \r
5788 \r
5789   static __INLINE q7_t arm_linear_interp_q7(\r
5790   q7_t * pYData,\r
5791   q31_t x,\r
5792   uint32_t nValues)\r
5793   {\r
5794     q31_t y;                                     /* output */\r
5795     q7_t y0, y1;                                 /* Nearest output values */\r
5796     q31_t fract;                                 /* fractional part */\r
5797     uint32_t index;                              /* Index to read nearest output values */\r
5798 \r
5799     /* Input is in 12.20 format */\r
5800     /* 12 bits for the table index */\r
5801     /* Index value calculation */\r
5802     if (x < 0)\r
5803     {\r
5804       return (pYData[0]);\r
5805     }\r
5806     index = (x >> 20) & 0xfff;\r
5807 \r
5808 \r
5809     if(index >= (nValues - 1))\r
5810     {\r
5811       return (pYData[nValues - 1]);\r
5812     }\r
5813     else\r
5814     {\r
5815 \r
5816       /* 20 bits for the fractional part */\r
5817       /* fract is in 12.20 format */\r
5818       fract = (x & 0x000FFFFF);\r
5819 \r
5820       /* Read two nearest output values from the index and are in 1.7(q7) format */\r
5821       y0 = pYData[index];\r
5822       y1 = pYData[index + 1u];\r
5823 \r
5824       /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */\r
5825       y = ((y0 * (0xFFFFF - fract)));\r
5826 \r
5827       /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */\r
5828       y += (y1 * fract);\r
5829 \r
5830       /* convert y to 1.7(q7) format */\r
5831       return (y >> 20u);\r
5832 \r
5833     }\r
5834 \r
5835   }\r
5836   /**\r
5837    * @} end of LinearInterpolate group\r
5838    */\r
5839 \r
5840   /**\r
5841    * @brief  Fast approximation to the trigonometric sine function for floating-point data.\r
5842    * @param[in] x input value in radians.\r
5843    * @return  sin(x).\r
5844    */\r
5845 \r
5846   float32_t arm_sin_f32(\r
5847   float32_t x);\r
5848 \r
5849   /**\r
5850    * @brief  Fast approximation to the trigonometric sine function for Q31 data.\r
5851    * @param[in] x Scaled input value in radians.\r
5852    * @return  sin(x).\r
5853    */\r
5854 \r
5855   q31_t arm_sin_q31(\r
5856   q31_t x);\r
5857 \r
5858   /**\r
5859    * @brief  Fast approximation to the trigonometric sine function for Q15 data.\r
5860    * @param[in] x Scaled input value in radians.\r
5861    * @return  sin(x).\r
5862    */\r
5863 \r
5864   q15_t arm_sin_q15(\r
5865   q15_t x);\r
5866 \r
5867   /**\r
5868    * @brief  Fast approximation to the trigonometric cosine function for floating-point data.\r
5869    * @param[in] x input value in radians.\r
5870    * @return  cos(x).\r
5871    */\r
5872 \r
5873   float32_t arm_cos_f32(\r
5874   float32_t x);\r
5875 \r
5876   /**\r
5877    * @brief Fast approximation to the trigonometric cosine function for Q31 data.\r
5878    * @param[in] x Scaled input value in radians.\r
5879    * @return  cos(x).\r
5880    */\r
5881 \r
5882   q31_t arm_cos_q31(\r
5883   q31_t x);\r
5884 \r
5885   /**\r
5886    * @brief  Fast approximation to the trigonometric cosine function for Q15 data.\r
5887    * @param[in] x Scaled input value in radians.\r
5888    * @return  cos(x).\r
5889    */\r
5890 \r
5891   q15_t arm_cos_q15(\r
5892   q15_t x);\r
5893 \r
5894 \r
5895   /**\r
5896    * @ingroup groupFastMath\r
5897    */\r
5898 \r
5899 \r
5900   /**\r
5901    * @defgroup SQRT Square Root\r
5902    *\r
5903    * Computes the square root of a number.\r
5904    * There are separate functions for Q15, Q31, and floating-point data types.\r
5905    * The square root function is computed using the Newton-Raphson algorithm.\r
5906    * This is an iterative algorithm of the form:\r
5907    * <pre>\r
5908    *      x1 = x0 - f(x0)/f'(x0)\r
5909    * </pre>\r
5910    * where <code>x1</code> is the current estimate,\r
5911    * <code>x0</code> is the previous estimate, and\r
5912    * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.\r
5913    * For the square root function, the algorithm reduces to:\r
5914    * <pre>\r
5915    *     x0 = in/2                         [initial guess]\r
5916    *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]\r
5917    * </pre>\r
5918    */\r
5919 \r
5920 \r
5921   /**\r
5922    * @addtogroup SQRT\r
5923    * @{\r
5924    */\r
5925 \r
5926   /**\r
5927    * @brief  Floating-point square root function.\r
5928    * @param[in]  in     input value.\r
5929    * @param[out] *pOut  square root of input value.\r
5930    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if\r
5931    * <code>in</code> is negative value and returns zero output for negative values.\r
5932    */\r
5933 \r
5934   static __INLINE arm_status arm_sqrt_f32(\r
5935   float32_t in,\r
5936   float32_t * pOut)\r
5937   {\r
5938     if(in > 0)\r
5939     {\r
5940 \r
5941 //      #if __FPU_USED\r
5942 #if (__FPU_USED == 1) && defined ( __CC_ARM   )\r
5943       *pOut = __sqrtf(in);\r
5944 #else\r
5945       *pOut = sqrtf(in);\r
5946 #endif\r
5947 \r
5948       return (ARM_MATH_SUCCESS);\r
5949     }\r
5950     else\r
5951     {\r
5952       *pOut = 0.0f;\r
5953       return (ARM_MATH_ARGUMENT_ERROR);\r
5954     }\r
5955 \r
5956   }\r
5957 \r
5958 \r
5959   /**\r
5960    * @brief Q31 square root function.\r
5961    * @param[in]   in    input value.  The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.\r
5962    * @param[out]  *pOut square root of input value.\r
5963    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if\r
5964    * <code>in</code> is negative value and returns zero output for negative values.\r
5965    */\r
5966   arm_status arm_sqrt_q31(\r
5967   q31_t in,\r
5968   q31_t * pOut);\r
5969 \r
5970   /**\r
5971    * @brief  Q15 square root function.\r
5972    * @param[in]   in     input value.  The range of the input value is [0 +1) or 0x0000 to 0x7FFF.\r
5973    * @param[out]  *pOut  square root of input value.\r
5974    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if\r
5975    * <code>in</code> is negative value and returns zero output for negative values.\r
5976    */\r
5977   arm_status arm_sqrt_q15(\r
5978   q15_t in,\r
5979   q15_t * pOut);\r
5980 \r
5981   /**\r
5982    * @} end of SQRT group\r
5983    */\r
5984 \r
5985 \r
5986 \r
5987 \r
5988 \r
5989 \r
5990   /**\r
5991    * @brief floating-point Circular write function.\r
5992    */\r
5993 \r
5994   static __INLINE void arm_circularWrite_f32(\r
5995   int32_t * circBuffer,\r
5996   int32_t L,\r
5997   uint16_t * writeOffset,\r
5998   int32_t bufferInc,\r
5999   const int32_t * src,\r
6000   int32_t srcInc,\r
6001   uint32_t blockSize)\r
6002   {\r
6003     uint32_t i = 0u;\r
6004     int32_t wOffset;\r
6005 \r
6006     /* Copy the value of Index pointer that points\r
6007      * to the current location where the input samples to be copied */\r
6008     wOffset = *writeOffset;\r
6009 \r
6010     /* Loop over the blockSize */\r
6011     i = blockSize;\r
6012 \r
6013     while(i > 0u)\r
6014     {\r
6015       /* copy the input sample to the circular buffer */\r
6016       circBuffer[wOffset] = *src;\r
6017 \r
6018       /* Update the input pointer */\r
6019       src += srcInc;\r
6020 \r
6021       /* Circularly update wOffset.  Watch out for positive and negative value */\r
6022       wOffset += bufferInc;\r
6023       if(wOffset >= L)\r
6024         wOffset -= L;\r
6025 \r
6026       /* Decrement the loop counter */\r
6027       i--;\r
6028     }\r
6029 \r
6030     /* Update the index pointer */\r
6031     *writeOffset = wOffset;\r
6032   }\r
6033 \r
6034 \r
6035 \r
6036   /**\r
6037    * @brief floating-point Circular Read function.\r
6038    */\r
6039   static __INLINE void arm_circularRead_f32(\r
6040   int32_t * circBuffer,\r
6041   int32_t L,\r
6042   int32_t * readOffset,\r
6043   int32_t bufferInc,\r
6044   int32_t * dst,\r
6045   int32_t * dst_base,\r
6046   int32_t dst_length,\r
6047   int32_t dstInc,\r
6048   uint32_t blockSize)\r
6049   {\r
6050     uint32_t i = 0u;\r
6051     int32_t rOffset, dst_end;\r
6052 \r
6053     /* Copy the value of Index pointer that points\r
6054      * to the current location from where the input samples to be read */\r
6055     rOffset = *readOffset;\r
6056     dst_end = (int32_t) (dst_base + dst_length);\r
6057 \r
6058     /* Loop over the blockSize */\r
6059     i = blockSize;\r
6060 \r
6061     while(i > 0u)\r
6062     {\r
6063       /* copy the sample from the circular buffer to the destination buffer */\r
6064       *dst = circBuffer[rOffset];\r
6065 \r
6066       /* Update the input pointer */\r
6067       dst += dstInc;\r
6068 \r
6069       if(dst == (int32_t *) dst_end)\r
6070       {\r
6071         dst = dst_base;\r
6072       }\r
6073 \r
6074       /* Circularly update rOffset.  Watch out for positive and negative value  */\r
6075       rOffset += bufferInc;\r
6076 \r
6077       if(rOffset >= L)\r
6078       {\r
6079         rOffset -= L;\r
6080       }\r
6081 \r
6082       /* Decrement the loop counter */\r
6083       i--;\r
6084     }\r
6085 \r
6086     /* Update the index pointer */\r
6087     *readOffset = rOffset;\r
6088   }\r
6089 \r
6090   /**\r
6091    * @brief Q15 Circular write function.\r
6092    */\r
6093 \r
6094   static __INLINE void arm_circularWrite_q15(\r
6095   q15_t * circBuffer,\r
6096   int32_t L,\r
6097   uint16_t * writeOffset,\r
6098   int32_t bufferInc,\r
6099   const q15_t * src,\r
6100   int32_t srcInc,\r
6101   uint32_t blockSize)\r
6102   {\r
6103     uint32_t i = 0u;\r
6104     int32_t wOffset;\r
6105 \r
6106     /* Copy the value of Index pointer that points\r
6107      * to the current location where the input samples to be copied */\r
6108     wOffset = *writeOffset;\r
6109 \r
6110     /* Loop over the blockSize */\r
6111     i = blockSize;\r
6112 \r
6113     while(i > 0u)\r
6114     {\r
6115       /* copy the input sample to the circular buffer */\r
6116       circBuffer[wOffset] = *src;\r
6117 \r
6118       /* Update the input pointer */\r
6119       src += srcInc;\r
6120 \r
6121       /* Circularly update wOffset.  Watch out for positive and negative value */\r
6122       wOffset += bufferInc;\r
6123       if(wOffset >= L)\r
6124         wOffset -= L;\r
6125 \r
6126       /* Decrement the loop counter */\r
6127       i--;\r
6128     }\r
6129 \r
6130     /* Update the index pointer */\r
6131     *writeOffset = wOffset;\r
6132   }\r
6133 \r
6134 \r
6135 \r
6136   /**\r
6137    * @brief Q15 Circular Read function.\r
6138    */\r
6139   static __INLINE void arm_circularRead_q15(\r
6140   q15_t * circBuffer,\r
6141   int32_t L,\r
6142   int32_t * readOffset,\r
6143   int32_t bufferInc,\r
6144   q15_t * dst,\r
6145   q15_t * dst_base,\r
6146   int32_t dst_length,\r
6147   int32_t dstInc,\r
6148   uint32_t blockSize)\r
6149   {\r
6150     uint32_t i = 0;\r
6151     int32_t rOffset, dst_end;\r
6152 \r
6153     /* Copy the value of Index pointer that points\r
6154      * to the current location from where the input samples to be read */\r
6155     rOffset = *readOffset;\r
6156 \r
6157     dst_end = (int32_t) (dst_base + dst_length);\r
6158 \r
6159     /* Loop over the blockSize */\r
6160     i = blockSize;\r
6161 \r
6162     while(i > 0u)\r
6163     {\r
6164       /* copy the sample from the circular buffer to the destination buffer */\r
6165       *dst = circBuffer[rOffset];\r
6166 \r
6167       /* Update the input pointer */\r
6168       dst += dstInc;\r
6169 \r
6170       if(dst == (q15_t *) dst_end)\r
6171       {\r
6172         dst = dst_base;\r
6173       }\r
6174 \r
6175       /* Circularly update wOffset.  Watch out for positive and negative value */\r
6176       rOffset += bufferInc;\r
6177 \r
6178       if(rOffset >= L)\r
6179       {\r
6180         rOffset -= L;\r
6181       }\r
6182 \r
6183       /* Decrement the loop counter */\r
6184       i--;\r
6185     }\r
6186 \r
6187     /* Update the index pointer */\r
6188     *readOffset = rOffset;\r
6189   }\r
6190 \r
6191 \r
6192   /**\r
6193    * @brief Q7 Circular write function.\r
6194    */\r
6195 \r
6196   static __INLINE void arm_circularWrite_q7(\r
6197   q7_t * circBuffer,\r
6198   int32_t L,\r
6199   uint16_t * writeOffset,\r
6200   int32_t bufferInc,\r
6201   const q7_t * src,\r
6202   int32_t srcInc,\r
6203   uint32_t blockSize)\r
6204   {\r
6205     uint32_t i = 0u;\r
6206     int32_t wOffset;\r
6207 \r
6208     /* Copy the value of Index pointer that points\r
6209      * to the current location where the input samples to be copied */\r
6210     wOffset = *writeOffset;\r
6211 \r
6212     /* Loop over the blockSize */\r
6213     i = blockSize;\r
6214 \r
6215     while(i > 0u)\r
6216     {\r
6217       /* copy the input sample to the circular buffer */\r
6218       circBuffer[wOffset] = *src;\r
6219 \r
6220       /* Update the input pointer */\r
6221       src += srcInc;\r
6222 \r
6223       /* Circularly update wOffset.  Watch out for positive and negative value */\r
6224       wOffset += bufferInc;\r
6225       if(wOffset >= L)\r
6226         wOffset -= L;\r
6227 \r
6228       /* Decrement the loop counter */\r
6229       i--;\r
6230     }\r
6231 \r
6232     /* Update the index pointer */\r
6233     *writeOffset = wOffset;\r
6234   }\r
6235 \r
6236 \r
6237 \r
6238   /**\r
6239    * @brief Q7 Circular Read function.\r
6240    */\r
6241   static __INLINE void arm_circularRead_q7(\r
6242   q7_t * circBuffer,\r
6243   int32_t L,\r
6244   int32_t * readOffset,\r
6245   int32_t bufferInc,\r
6246   q7_t * dst,\r
6247   q7_t * dst_base,\r
6248   int32_t dst_length,\r
6249   int32_t dstInc,\r
6250   uint32_t blockSize)\r
6251   {\r
6252     uint32_t i = 0;\r
6253     int32_t rOffset, dst_end;\r
6254 \r
6255     /* Copy the value of Index pointer that points\r
6256      * to the current location from where the input samples to be read */\r
6257     rOffset = *readOffset;\r
6258 \r
6259     dst_end = (int32_t) (dst_base + dst_length);\r
6260 \r
6261     /* Loop over the blockSize */\r
6262     i = blockSize;\r
6263 \r
6264     while(i > 0u)\r
6265     {\r
6266       /* copy the sample from the circular buffer to the destination buffer */\r
6267       *dst = circBuffer[rOffset];\r
6268 \r
6269       /* Update the input pointer */\r
6270       dst += dstInc;\r
6271 \r
6272       if(dst == (q7_t *) dst_end)\r
6273       {\r
6274         dst = dst_base;\r
6275       }\r
6276 \r
6277       /* Circularly update rOffset.  Watch out for positive and negative value */\r
6278       rOffset += bufferInc;\r
6279 \r
6280       if(rOffset >= L)\r
6281       {\r
6282         rOffset -= L;\r
6283       }\r
6284 \r
6285       /* Decrement the loop counter */\r
6286       i--;\r
6287     }\r
6288 \r
6289     /* Update the index pointer */\r
6290     *readOffset = rOffset;\r
6291   }\r
6292 \r
6293 \r
6294   /**\r
6295    * @brief  Sum of the squares of the elements of a Q31 vector.\r
6296    * @param[in]  *pSrc is input pointer\r
6297    * @param[in]  blockSize is the number of samples to process\r
6298    * @param[out]  *pResult is output value.\r
6299    * @return none.\r
6300    */\r
6301 \r
6302   void arm_power_q31(\r
6303   q31_t * pSrc,\r
6304   uint32_t blockSize,\r
6305   q63_t * pResult);\r
6306 \r
6307   /**\r
6308    * @brief  Sum of the squares of the elements of a floating-point vector.\r
6309    * @param[in]  *pSrc is input pointer\r
6310    * @param[in]  blockSize is the number of samples to process\r
6311    * @param[out]  *pResult is output value.\r
6312    * @return none.\r
6313    */\r
6314 \r
6315   void arm_power_f32(\r
6316   float32_t * pSrc,\r
6317   uint32_t blockSize,\r
6318   float32_t * pResult);\r
6319 \r
6320   /**\r
6321    * @brief  Sum of the squares of the elements of a Q15 vector.\r
6322    * @param[in]  *pSrc is input pointer\r
6323    * @param[in]  blockSize is the number of samples to process\r
6324    * @param[out]  *pResult is output value.\r
6325    * @return none.\r
6326    */\r
6327 \r
6328   void arm_power_q15(\r
6329   q15_t * pSrc,\r
6330   uint32_t blockSize,\r
6331   q63_t * pResult);\r
6332 \r
6333   /**\r
6334    * @brief  Sum of the squares of the elements of a Q7 vector.\r
6335    * @param[in]  *pSrc is input pointer\r
6336    * @param[in]  blockSize is the number of samples to process\r
6337    * @param[out]  *pResult is output value.\r
6338    * @return none.\r
6339    */\r
6340 \r
6341   void arm_power_q7(\r
6342   q7_t * pSrc,\r
6343   uint32_t blockSize,\r
6344   q31_t * pResult);\r
6345 \r
6346   /**\r
6347    * @brief  Mean value of a Q7 vector.\r
6348    * @param[in]  *pSrc is input pointer\r
6349    * @param[in]  blockSize is the number of samples to process\r
6350    * @param[out]  *pResult is output value.\r
6351    * @return none.\r
6352    */\r
6353 \r
6354   void arm_mean_q7(\r
6355   q7_t * pSrc,\r
6356   uint32_t blockSize,\r
6357   q7_t * pResult);\r
6358 \r
6359   /**\r
6360    * @brief  Mean value of a Q15 vector.\r
6361    * @param[in]  *pSrc is input pointer\r
6362    * @param[in]  blockSize is the number of samples to process\r
6363    * @param[out]  *pResult is output value.\r
6364    * @return none.\r
6365    */\r
6366   void arm_mean_q15(\r
6367   q15_t * pSrc,\r
6368   uint32_t blockSize,\r
6369   q15_t * pResult);\r
6370 \r
6371   /**\r
6372    * @brief  Mean value of a Q31 vector.\r
6373    * @param[in]  *pSrc is input pointer\r
6374    * @param[in]  blockSize is the number of samples to process\r
6375    * @param[out]  *pResult is output value.\r
6376    * @return none.\r
6377    */\r
6378   void arm_mean_q31(\r
6379   q31_t * pSrc,\r
6380   uint32_t blockSize,\r
6381   q31_t * pResult);\r
6382 \r
6383   /**\r
6384    * @brief  Mean value of a floating-point vector.\r
6385    * @param[in]  *pSrc is input pointer\r
6386    * @param[in]  blockSize is the number of samples to process\r
6387    * @param[out]  *pResult is output value.\r
6388    * @return none.\r
6389    */\r
6390   void arm_mean_f32(\r
6391   float32_t * pSrc,\r
6392   uint32_t blockSize,\r
6393   float32_t * pResult);\r
6394 \r
6395   /**\r
6396    * @brief  Variance of the elements of a floating-point vector.\r
6397    * @param[in]  *pSrc is input pointer\r
6398    * @param[in]  blockSize is the number of samples to process\r
6399    * @param[out]  *pResult is output value.\r
6400    * @return none.\r
6401    */\r
6402 \r
6403   void arm_var_f32(\r
6404   float32_t * pSrc,\r
6405   uint32_t blockSize,\r
6406   float32_t * pResult);\r
6407 \r
6408   /**\r
6409    * @brief  Variance of the elements of a Q31 vector.\r
6410    * @param[in]  *pSrc is input pointer\r
6411    * @param[in]  blockSize is the number of samples to process\r
6412    * @param[out]  *pResult is output value.\r
6413    * @return none.\r
6414    */\r
6415 \r
6416   void arm_var_q31(\r
6417   q31_t * pSrc,\r
6418   uint32_t blockSize,\r
6419   q31_t * pResult);\r
6420 \r
6421   /**\r
6422    * @brief  Variance of the elements of a Q15 vector.\r
6423    * @param[in]  *pSrc is input pointer\r
6424    * @param[in]  blockSize is the number of samples to process\r
6425    * @param[out]  *pResult is output value.\r
6426    * @return none.\r
6427    */\r
6428 \r
6429   void arm_var_q15(\r
6430   q15_t * pSrc,\r
6431   uint32_t blockSize,\r
6432   q15_t * pResult);\r
6433 \r
6434   /**\r
6435    * @brief  Root Mean Square of the elements of a floating-point vector.\r
6436    * @param[in]  *pSrc is input pointer\r
6437    * @param[in]  blockSize is the number of samples to process\r
6438    * @param[out]  *pResult is output value.\r
6439    * @return none.\r
6440    */\r
6441 \r
6442   void arm_rms_f32(\r
6443   float32_t * pSrc,\r
6444   uint32_t blockSize,\r
6445   float32_t * pResult);\r
6446 \r
6447   /**\r
6448    * @brief  Root Mean Square of the elements of a Q31 vector.\r
6449    * @param[in]  *pSrc is input pointer\r
6450    * @param[in]  blockSize is the number of samples to process\r
6451    * @param[out]  *pResult is output value.\r
6452    * @return none.\r
6453    */\r
6454 \r
6455   void arm_rms_q31(\r
6456   q31_t * pSrc,\r
6457   uint32_t blockSize,\r
6458   q31_t * pResult);\r
6459 \r
6460   /**\r
6461    * @brief  Root Mean Square of the elements of a Q15 vector.\r
6462    * @param[in]  *pSrc is input pointer\r
6463    * @param[in]  blockSize is the number of samples to process\r
6464    * @param[out]  *pResult is output value.\r
6465    * @return none.\r
6466    */\r
6467 \r
6468   void arm_rms_q15(\r
6469   q15_t * pSrc,\r
6470   uint32_t blockSize,\r
6471   q15_t * pResult);\r
6472 \r
6473   /**\r
6474    * @brief  Standard deviation of the elements of a floating-point vector.\r
6475    * @param[in]  *pSrc is input pointer\r
6476    * @param[in]  blockSize is the number of samples to process\r
6477    * @param[out]  *pResult is output value.\r
6478    * @return none.\r
6479    */\r
6480 \r
6481   void arm_std_f32(\r
6482   float32_t * pSrc,\r
6483   uint32_t blockSize,\r
6484   float32_t * pResult);\r
6485 \r
6486   /**\r
6487    * @brief  Standard deviation of the elements of a Q31 vector.\r
6488    * @param[in]  *pSrc is input pointer\r
6489    * @param[in]  blockSize is the number of samples to process\r
6490    * @param[out]  *pResult is output value.\r
6491    * @return none.\r
6492    */\r
6493 \r
6494   void arm_std_q31(\r
6495   q31_t * pSrc,\r
6496   uint32_t blockSize,\r
6497   q31_t * pResult);\r
6498 \r
6499   /**\r
6500    * @brief  Standard deviation of the elements of a Q15 vector.\r
6501    * @param[in]  *pSrc is input pointer\r
6502    * @param[in]  blockSize is the number of samples to process\r
6503    * @param[out]  *pResult is output value.\r
6504    * @return none.\r
6505    */\r
6506 \r
6507   void arm_std_q15(\r
6508   q15_t * pSrc,\r
6509   uint32_t blockSize,\r
6510   q15_t * pResult);\r
6511 \r
6512   /**\r
6513    * @brief  Floating-point complex magnitude\r
6514    * @param[in]  *pSrc points to the complex input vector\r
6515    * @param[out]  *pDst points to the real output vector\r
6516    * @param[in]  numSamples number of complex samples in the input vector\r
6517    * @return none.\r
6518    */\r
6519 \r
6520   void arm_cmplx_mag_f32(\r
6521   float32_t * pSrc,\r
6522   float32_t * pDst,\r
6523   uint32_t numSamples);\r
6524 \r
6525   /**\r
6526    * @brief  Q31 complex magnitude\r
6527    * @param[in]  *pSrc points to the complex input vector\r
6528    * @param[out]  *pDst points to the real output vector\r
6529    * @param[in]  numSamples number of complex samples in the input vector\r
6530    * @return none.\r
6531    */\r
6532 \r
6533   void arm_cmplx_mag_q31(\r
6534   q31_t * pSrc,\r
6535   q31_t * pDst,\r
6536   uint32_t numSamples);\r
6537 \r
6538   /**\r
6539    * @brief  Q15 complex magnitude\r
6540    * @param[in]  *pSrc points to the complex input vector\r
6541    * @param[out]  *pDst points to the real output vector\r
6542    * @param[in]  numSamples number of complex samples in the input vector\r
6543    * @return none.\r
6544    */\r
6545 \r
6546   void arm_cmplx_mag_q15(\r
6547   q15_t * pSrc,\r
6548   q15_t * pDst,\r
6549   uint32_t numSamples);\r
6550 \r
6551   /**\r
6552    * @brief  Q15 complex dot product\r
6553    * @param[in]  *pSrcA points to the first input vector\r
6554    * @param[in]  *pSrcB points to the second input vector\r
6555    * @param[in]  numSamples number of complex samples in each vector\r
6556    * @param[out]  *realResult real part of the result returned here\r
6557    * @param[out]  *imagResult imaginary part of the result returned here\r
6558    * @return none.\r
6559    */\r
6560 \r
6561   void arm_cmplx_dot_prod_q15(\r
6562   q15_t * pSrcA,\r
6563   q15_t * pSrcB,\r
6564   uint32_t numSamples,\r
6565   q31_t * realResult,\r
6566   q31_t * imagResult);\r
6567 \r
6568   /**\r
6569    * @brief  Q31 complex dot product\r
6570    * @param[in]  *pSrcA points to the first input vector\r
6571    * @param[in]  *pSrcB points to the second input vector\r
6572    * @param[in]  numSamples number of complex samples in each vector\r
6573    * @param[out]  *realResult real part of the result returned here\r
6574    * @param[out]  *imagResult imaginary part of the result returned here\r
6575    * @return none.\r
6576    */\r
6577 \r
6578   void arm_cmplx_dot_prod_q31(\r
6579   q31_t * pSrcA,\r
6580   q31_t * pSrcB,\r
6581   uint32_t numSamples,\r
6582   q63_t * realResult,\r
6583   q63_t * imagResult);\r
6584 \r
6585   /**\r
6586    * @brief  Floating-point complex dot product\r
6587    * @param[in]  *pSrcA points to the first input vector\r
6588    * @param[in]  *pSrcB points to the second input vector\r
6589    * @param[in]  numSamples number of complex samples in each vector\r
6590    * @param[out]  *realResult real part of the result returned here\r
6591    * @param[out]  *imagResult imaginary part of the result returned here\r
6592    * @return none.\r
6593    */\r
6594 \r
6595   void arm_cmplx_dot_prod_f32(\r
6596   float32_t * pSrcA,\r
6597   float32_t * pSrcB,\r
6598   uint32_t numSamples,\r
6599   float32_t * realResult,\r
6600   float32_t * imagResult);\r
6601 \r
6602   /**\r
6603    * @brief  Q15 complex-by-real multiplication\r
6604    * @param[in]  *pSrcCmplx points to the complex input vector\r
6605    * @param[in]  *pSrcReal points to the real input vector\r
6606    * @param[out]  *pCmplxDst points to the complex output vector\r
6607    * @param[in]  numSamples number of samples in each vector\r
6608    * @return none.\r
6609    */\r
6610 \r
6611   void arm_cmplx_mult_real_q15(\r
6612   q15_t * pSrcCmplx,\r
6613   q15_t * pSrcReal,\r
6614   q15_t * pCmplxDst,\r
6615   uint32_t numSamples);\r
6616 \r
6617   /**\r
6618    * @brief  Q31 complex-by-real multiplication\r
6619    * @param[in]  *pSrcCmplx points to the complex input vector\r
6620    * @param[in]  *pSrcReal points to the real input vector\r
6621    * @param[out]  *pCmplxDst points to the complex output vector\r
6622    * @param[in]  numSamples number of samples in each vector\r
6623    * @return none.\r
6624    */\r
6625 \r
6626   void arm_cmplx_mult_real_q31(\r
6627   q31_t * pSrcCmplx,\r
6628   q31_t * pSrcReal,\r
6629   q31_t * pCmplxDst,\r
6630   uint32_t numSamples);\r
6631 \r
6632   /**\r
6633    * @brief  Floating-point complex-by-real multiplication\r
6634    * @param[in]  *pSrcCmplx points to the complex input vector\r
6635    * @param[in]  *pSrcReal points to the real input vector\r
6636    * @param[out]  *pCmplxDst points to the complex output vector\r
6637    * @param[in]  numSamples number of samples in each vector\r
6638    * @return none.\r
6639    */\r
6640 \r
6641   void arm_cmplx_mult_real_f32(\r
6642   float32_t * pSrcCmplx,\r
6643   float32_t * pSrcReal,\r
6644   float32_t * pCmplxDst,\r
6645   uint32_t numSamples);\r
6646 \r
6647   /**\r
6648    * @brief  Minimum value of a Q7 vector.\r
6649    * @param[in]  *pSrc is input pointer\r
6650    * @param[in]  blockSize is the number of samples to process\r
6651    * @param[out]  *result is output pointer\r
6652    * @param[in]  index is the array index of the minimum value in the input buffer.\r
6653    * @return none.\r
6654    */\r
6655 \r
6656   void arm_min_q7(\r
6657   q7_t * pSrc,\r
6658   uint32_t blockSize,\r
6659   q7_t * result,\r
6660   uint32_t * index);\r
6661 \r
6662   /**\r
6663    * @brief  Minimum value of a Q15 vector.\r
6664    * @param[in]  *pSrc is input pointer\r
6665    * @param[in]  blockSize is the number of samples to process\r
6666    * @param[out]  *pResult is output pointer\r
6667    * @param[in]  *pIndex is the array index of the minimum value in the input buffer.\r
6668    * @return none.\r
6669    */\r
6670 \r
6671   void arm_min_q15(\r
6672   q15_t * pSrc,\r
6673   uint32_t blockSize,\r
6674   q15_t * pResult,\r
6675   uint32_t * pIndex);\r
6676 \r
6677   /**\r
6678    * @brief  Minimum value of a Q31 vector.\r
6679    * @param[in]  *pSrc is input pointer\r
6680    * @param[in]  blockSize is the number of samples to process\r
6681    * @param[out]  *pResult is output pointer\r
6682    * @param[out]  *pIndex is the array index of the minimum value in the input buffer.\r
6683    * @return none.\r
6684    */\r
6685   void arm_min_q31(\r
6686   q31_t * pSrc,\r
6687   uint32_t blockSize,\r
6688   q31_t * pResult,\r
6689   uint32_t * pIndex);\r
6690 \r
6691   /**\r
6692    * @brief  Minimum value of a floating-point vector.\r
6693    * @param[in]  *pSrc is input pointer\r
6694    * @param[in]  blockSize is the number of samples to process\r
6695    * @param[out]  *pResult is output pointer\r
6696    * @param[out]  *pIndex is the array index of the minimum value in the input buffer.\r
6697    * @return none.\r
6698    */\r
6699 \r
6700   void arm_min_f32(\r
6701   float32_t * pSrc,\r
6702   uint32_t blockSize,\r
6703   float32_t * pResult,\r
6704   uint32_t * pIndex);\r
6705 \r
6706 /**\r
6707  * @brief Maximum value of a Q7 vector.\r
6708  * @param[in]       *pSrc points to the input buffer\r
6709  * @param[in]       blockSize length of the input vector\r
6710  * @param[out]      *pResult maximum value returned here\r
6711  * @param[out]      *pIndex index of maximum value returned here\r
6712  * @return none.\r
6713  */\r
6714 \r
6715   void arm_max_q7(\r
6716   q7_t * pSrc,\r
6717   uint32_t blockSize,\r
6718   q7_t * pResult,\r
6719   uint32_t * pIndex);\r
6720 \r
6721 /**\r
6722  * @brief Maximum value of a Q15 vector.\r
6723  * @param[in]       *pSrc points to the input buffer\r
6724  * @param[in]       blockSize length of the input vector\r
6725  * @param[out]      *pResult maximum value returned here\r
6726  * @param[out]      *pIndex index of maximum value returned here\r
6727  * @return none.\r
6728  */\r
6729 \r
6730   void arm_max_q15(\r
6731   q15_t * pSrc,\r
6732   uint32_t blockSize,\r
6733   q15_t * pResult,\r
6734   uint32_t * pIndex);\r
6735 \r
6736 /**\r
6737  * @brief Maximum value of a Q31 vector.\r
6738  * @param[in]       *pSrc points to the input buffer\r
6739  * @param[in]       blockSize length of the input vector\r
6740  * @param[out]      *pResult maximum value returned here\r
6741  * @param[out]      *pIndex index of maximum value returned here\r
6742  * @return none.\r
6743  */\r
6744 \r
6745   void arm_max_q31(\r
6746   q31_t * pSrc,\r
6747   uint32_t blockSize,\r
6748   q31_t * pResult,\r
6749   uint32_t * pIndex);\r
6750 \r
6751 /**\r
6752  * @brief Maximum value of a floating-point vector.\r
6753  * @param[in]       *pSrc points to the input buffer\r
6754  * @param[in]       blockSize length of the input vector\r
6755  * @param[out]      *pResult maximum value returned here\r
6756  * @param[out]      *pIndex index of maximum value returned here\r
6757  * @return none.\r
6758  */\r
6759 \r
6760   void arm_max_f32(\r
6761   float32_t * pSrc,\r
6762   uint32_t blockSize,\r
6763   float32_t * pResult,\r
6764   uint32_t * pIndex);\r
6765 \r
6766   /**\r
6767    * @brief  Q15 complex-by-complex multiplication\r
6768    * @param[in]  *pSrcA points to the first input vector\r
6769    * @param[in]  *pSrcB points to the second input vector\r
6770    * @param[out]  *pDst  points to the output vector\r
6771    * @param[in]  numSamples number of complex samples in each vector\r
6772    * @return none.\r
6773    */\r
6774 \r
6775   void arm_cmplx_mult_cmplx_q15(\r
6776   q15_t * pSrcA,\r
6777   q15_t * pSrcB,\r
6778   q15_t * pDst,\r
6779   uint32_t numSamples);\r
6780 \r
6781   /**\r
6782    * @brief  Q31 complex-by-complex multiplication\r
6783    * @param[in]  *pSrcA points to the first input vector\r
6784    * @param[in]  *pSrcB points to the second input vector\r
6785    * @param[out]  *pDst  points to the output vector\r
6786    * @param[in]  numSamples number of complex samples in each vector\r
6787    * @return none.\r
6788    */\r
6789 \r
6790   void arm_cmplx_mult_cmplx_q31(\r
6791   q31_t * pSrcA,\r
6792   q31_t * pSrcB,\r
6793   q31_t * pDst,\r
6794   uint32_t numSamples);\r
6795 \r
6796   /**\r
6797    * @brief  Floating-point complex-by-complex multiplication\r
6798    * @param[in]  *pSrcA points to the first input vector\r
6799    * @param[in]  *pSrcB points to the second input vector\r
6800    * @param[out]  *pDst  points to the output vector\r
6801    * @param[in]  numSamples number of complex samples in each vector\r
6802    * @return none.\r
6803    */\r
6804 \r
6805   void arm_cmplx_mult_cmplx_f32(\r
6806   float32_t * pSrcA,\r
6807   float32_t * pSrcB,\r
6808   float32_t * pDst,\r
6809   uint32_t numSamples);\r
6810 \r
6811   /**\r
6812    * @brief Converts the elements of the floating-point vector to Q31 vector.\r
6813    * @param[in]       *pSrc points to the floating-point input vector\r
6814    * @param[out]      *pDst points to the Q31 output vector\r
6815    * @param[in]       blockSize length of the input vector\r
6816    * @return none.\r
6817    */\r
6818   void arm_float_to_q31(\r
6819   float32_t * pSrc,\r
6820   q31_t * pDst,\r
6821   uint32_t blockSize);\r
6822 \r
6823   /**\r
6824    * @brief Converts the elements of the floating-point vector to Q15 vector.\r
6825    * @param[in]       *pSrc points to the floating-point input vector\r
6826    * @param[out]      *pDst points to the Q15 output vector\r
6827    * @param[in]       blockSize length of the input vector\r
6828    * @return          none\r
6829    */\r
6830   void arm_float_to_q15(\r
6831   float32_t * pSrc,\r
6832   q15_t * pDst,\r
6833   uint32_t blockSize);\r
6834 \r
6835   /**\r
6836    * @brief Converts the elements of the floating-point vector to Q7 vector.\r
6837    * @param[in]       *pSrc points to the floating-point input vector\r
6838    * @param[out]      *pDst points to the Q7 output vector\r
6839    * @param[in]       blockSize length of the input vector\r
6840    * @return          none\r
6841    */\r
6842   void arm_float_to_q7(\r
6843   float32_t * pSrc,\r
6844   q7_t * pDst,\r
6845   uint32_t blockSize);\r
6846 \r
6847 \r
6848   /**\r
6849    * @brief  Converts the elements of the Q31 vector to Q15 vector.\r
6850    * @param[in]  *pSrc is input pointer\r
6851    * @param[out]  *pDst is output pointer\r
6852    * @param[in]  blockSize is the number of samples to process\r
6853    * @return none.\r
6854    */\r
6855   void arm_q31_to_q15(\r
6856   q31_t * pSrc,\r
6857   q15_t * pDst,\r
6858   uint32_t blockSize);\r
6859 \r
6860   /**\r
6861    * @brief  Converts the elements of the Q31 vector to Q7 vector.\r
6862    * @param[in]  *pSrc is input pointer\r
6863    * @param[out]  *pDst is output pointer\r
6864    * @param[in]  blockSize is the number of samples to process\r
6865    * @return none.\r
6866    */\r
6867   void arm_q31_to_q7(\r
6868   q31_t * pSrc,\r
6869   q7_t * pDst,\r
6870   uint32_t blockSize);\r
6871 \r
6872   /**\r
6873    * @brief  Converts the elements of the Q15 vector to floating-point vector.\r
6874    * @param[in]  *pSrc is input pointer\r
6875    * @param[out]  *pDst is output pointer\r
6876    * @param[in]  blockSize is the number of samples to process\r
6877    * @return none.\r
6878    */\r
6879   void arm_q15_to_float(\r
6880   q15_t * pSrc,\r
6881   float32_t * pDst,\r
6882   uint32_t blockSize);\r
6883 \r
6884 \r
6885   /**\r
6886    * @brief  Converts the elements of the Q15 vector to Q31 vector.\r
6887    * @param[in]  *pSrc is input pointer\r
6888    * @param[out]  *pDst is output pointer\r
6889    * @param[in]  blockSize is the number of samples to process\r
6890    * @return none.\r
6891    */\r
6892   void arm_q15_to_q31(\r
6893   q15_t * pSrc,\r
6894   q31_t * pDst,\r
6895   uint32_t blockSize);\r
6896 \r
6897 \r
6898   /**\r
6899    * @brief  Converts the elements of the Q15 vector to Q7 vector.\r
6900    * @param[in]  *pSrc is input pointer\r
6901    * @param[out]  *pDst is output pointer\r
6902    * @param[in]  blockSize is the number of samples to process\r
6903    * @return none.\r
6904    */\r
6905   void arm_q15_to_q7(\r
6906   q15_t * pSrc,\r
6907   q7_t * pDst,\r
6908   uint32_t blockSize);\r
6909 \r
6910 \r
6911   /**\r
6912    * @ingroup groupInterpolation\r
6913    */\r
6914 \r
6915   /**\r
6916    * @defgroup BilinearInterpolate Bilinear Interpolation\r
6917    *\r
6918    * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.\r
6919    * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process\r
6920    * determines values between the grid points.\r
6921    * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.\r
6922    * Bilinear interpolation is often used in image processing to rescale images.\r
6923    * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.\r
6924    *\r
6925    * <b>Algorithm</b>\r
6926    * \par\r
6927    * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.\r
6928    * For floating-point, the instance structure is defined as:\r
6929    * <pre>\r
6930    *   typedef struct\r
6931    *   {\r
6932    *     uint16_t numRows;\r
6933    *     uint16_t numCols;\r
6934    *     float32_t *pData;\r
6935    * } arm_bilinear_interp_instance_f32;\r
6936    * </pre>\r
6937    *\r
6938    * \par\r
6939    * where <code>numRows</code> specifies the number of rows in the table;\r
6940    * <code>numCols</code> specifies the number of columns in the table;\r
6941    * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.\r
6942    * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.\r
6943    * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.\r
6944    *\r
6945    * \par\r
6946    * Let <code>(x, y)</code> specify the desired interpolation point.  Then define:\r
6947    * <pre>\r
6948    *     XF = floor(x)\r
6949    *     YF = floor(y)\r
6950    * </pre>\r
6951    * \par\r
6952    * The interpolated output point is computed as:\r
6953    * <pre>\r
6954    *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))\r
6955    *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))\r
6956    *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)\r
6957    *           + f(XF+1, YF+1) * (x-XF)*(y-YF)\r
6958    * </pre>\r
6959    * Note that the coordinates (x, y) contain integer and fractional components.\r
6960    * The integer components specify which portion of the table to use while the\r
6961    * fractional components control the interpolation processor.\r
6962    *\r
6963    * \par\r
6964    * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.\r
6965    */\r
6966 \r
6967   /**\r
6968    * @addtogroup BilinearInterpolate\r
6969    * @{\r
6970    */\r
6971 \r
6972   /**\r
6973   *\r
6974   * @brief  Floating-point bilinear interpolation.\r
6975   * @param[in,out] *S points to an instance of the interpolation structure.\r
6976   * @param[in] X interpolation coordinate.\r
6977   * @param[in] Y interpolation coordinate.\r
6978   * @return out interpolated value.\r
6979   */\r
6980 \r
6981 \r
6982   static __INLINE float32_t arm_bilinear_interp_f32(\r
6983   const arm_bilinear_interp_instance_f32 * S,\r
6984   float32_t X,\r
6985   float32_t Y)\r
6986   {\r
6987     float32_t out;\r
6988     float32_t f00, f01, f10, f11;\r
6989     float32_t *pData = S->pData;\r
6990     int32_t xIndex, yIndex, index;\r
6991     float32_t xdiff, ydiff;\r
6992     float32_t b1, b2, b3, b4;\r
6993 \r
6994     xIndex = (int32_t) X;\r
6995     yIndex = (int32_t) Y;\r
6996 \r
6997     /* Care taken for table outside boundary */\r
6998     /* Returns zero output when values are outside table boundary */\r
6999     if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0\r
7000        || yIndex > (S->numCols - 1))\r
7001     {\r
7002       return (0);\r
7003     }\r
7004 \r
7005     /* Calculation of index for two nearest points in X-direction */\r
7006     index = (xIndex - 1) + (yIndex - 1) * S->numCols;\r
7007 \r
7008 \r
7009     /* Read two nearest points in X-direction */\r
7010     f00 = pData[index];\r
7011     f01 = pData[index + 1];\r
7012 \r
7013     /* Calculation of index for two nearest points in Y-direction */\r
7014     index = (xIndex - 1) + (yIndex) * S->numCols;\r
7015 \r
7016 \r
7017     /* Read two nearest points in Y-direction */\r
7018     f10 = pData[index];\r
7019     f11 = pData[index + 1];\r
7020 \r
7021     /* Calculation of intermediate values */\r
7022     b1 = f00;\r
7023     b2 = f01 - f00;\r
7024     b3 = f10 - f00;\r
7025     b4 = f00 - f01 - f10 + f11;\r
7026 \r
7027     /* Calculation of fractional part in X */\r
7028     xdiff = X - xIndex;\r
7029 \r
7030     /* Calculation of fractional part in Y */\r
7031     ydiff = Y - yIndex;\r
7032 \r
7033     /* Calculation of bi-linear interpolated output */\r
7034     out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;\r
7035 \r
7036     /* return to application */\r
7037     return (out);\r
7038 \r
7039   }\r
7040 \r
7041   /**\r
7042   *\r
7043   * @brief  Q31 bilinear interpolation.\r
7044   * @param[in,out] *S points to an instance of the interpolation structure.\r
7045   * @param[in] X interpolation coordinate in 12.20 format.\r
7046   * @param[in] Y interpolation coordinate in 12.20 format.\r
7047   * @return out interpolated value.\r
7048   */\r
7049 \r
7050   static __INLINE q31_t arm_bilinear_interp_q31(\r
7051   arm_bilinear_interp_instance_q31 * S,\r
7052   q31_t X,\r
7053   q31_t Y)\r
7054   {\r
7055     q31_t out;                                   /* Temporary output */\r
7056     q31_t acc = 0;                               /* output */\r
7057     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
7058     q31_t x1, x2, y1, y2;                        /* Nearest output values */\r
7059     int32_t rI, cI;                              /* Row and column indices */\r
7060     q31_t *pYData = S->pData;                    /* pointer to output table values */\r
7061     uint32_t nCols = S->numCols;                 /* num of rows */\r
7062 \r
7063 \r
7064     /* Input is in 12.20 format */\r
7065     /* 12 bits for the table index */\r
7066     /* Index value calculation */\r
7067     rI = ((X & 0xFFF00000) >> 20u);\r
7068 \r
7069     /* Input is in 12.20 format */\r
7070     /* 12 bits for the table index */\r
7071     /* Index value calculation */\r
7072     cI = ((Y & 0xFFF00000) >> 20u);\r
7073 \r
7074     /* Care taken for table outside boundary */\r
7075     /* Returns zero output when values are outside table boundary */\r
7076     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
7077     {\r
7078       return (0);\r
7079     }\r
7080 \r
7081     /* 20 bits for the fractional part */\r
7082     /* shift left xfract by 11 to keep 1.31 format */\r
7083     xfract = (X & 0x000FFFFF) << 11u;\r
7084 \r
7085     /* Read two nearest output values from the index */\r
7086     x1 = pYData[(rI) + nCols * (cI)];\r
7087     x2 = pYData[(rI) + nCols * (cI) + 1u];\r
7088 \r
7089     /* 20 bits for the fractional part */\r
7090     /* shift left yfract by 11 to keep 1.31 format */\r
7091     yfract = (Y & 0x000FFFFF) << 11u;\r
7092 \r
7093     /* Read two nearest output values from the index */\r
7094     y1 = pYData[(rI) + nCols * (cI + 1)];\r
7095     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];\r
7096 \r
7097     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */\r
7098     out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));\r
7099     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));\r
7100 \r
7101     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */\r
7102     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));\r
7103     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));\r
7104 \r
7105     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */\r
7106     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));\r
7107     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));\r
7108 \r
7109     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */\r
7110     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));\r
7111     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));\r
7112 \r
7113     /* Convert acc to 1.31(q31) format */\r
7114     return (acc << 2u);\r
7115 \r
7116   }\r
7117 \r
7118   /**\r
7119   * @brief  Q15 bilinear interpolation.\r
7120   * @param[in,out] *S points to an instance of the interpolation structure.\r
7121   * @param[in] X interpolation coordinate in 12.20 format.\r
7122   * @param[in] Y interpolation coordinate in 12.20 format.\r
7123   * @return out interpolated value.\r
7124   */\r
7125 \r
7126   static __INLINE q15_t arm_bilinear_interp_q15(\r
7127   arm_bilinear_interp_instance_q15 * S,\r
7128   q31_t X,\r
7129   q31_t Y)\r
7130   {\r
7131     q63_t acc = 0;                               /* output */\r
7132     q31_t out;                                   /* Temporary output */\r
7133     q15_t x1, x2, y1, y2;                        /* Nearest output values */\r
7134     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
7135     int32_t rI, cI;                              /* Row and column indices */\r
7136     q15_t *pYData = S->pData;                    /* pointer to output table values */\r
7137     uint32_t nCols = S->numCols;                 /* num of rows */\r
7138 \r
7139     /* Input is in 12.20 format */\r
7140     /* 12 bits for the table index */\r
7141     /* Index value calculation */\r
7142     rI = ((X & 0xFFF00000) >> 20);\r
7143 \r
7144     /* Input is in 12.20 format */\r
7145     /* 12 bits for the table index */\r
7146     /* Index value calculation */\r
7147     cI = ((Y & 0xFFF00000) >> 20);\r
7148 \r
7149     /* Care taken for table outside boundary */\r
7150     /* Returns zero output when values are outside table boundary */\r
7151     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
7152     {\r
7153       return (0);\r
7154     }\r
7155 \r
7156     /* 20 bits for the fractional part */\r
7157     /* xfract should be in 12.20 format */\r
7158     xfract = (X & 0x000FFFFF);\r
7159 \r
7160     /* Read two nearest output values from the index */\r
7161     x1 = pYData[(rI) + nCols * (cI)];\r
7162     x2 = pYData[(rI) + nCols * (cI) + 1u];\r
7163 \r
7164 \r
7165     /* 20 bits for the fractional part */\r
7166     /* yfract should be in 12.20 format */\r
7167     yfract = (Y & 0x000FFFFF);\r
7168 \r
7169     /* Read two nearest output values from the index */\r
7170     y1 = pYData[(rI) + nCols * (cI + 1)];\r
7171     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];\r
7172 \r
7173     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */\r
7174 \r
7175     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */\r
7176     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */\r
7177     out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);\r
7178     acc = ((q63_t) out * (0xFFFFF - yfract));\r
7179 \r
7180     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */\r
7181     out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);\r
7182     acc += ((q63_t) out * (xfract));\r
7183 \r
7184     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */\r
7185     out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);\r
7186     acc += ((q63_t) out * (yfract));\r
7187 \r
7188     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */\r
7189     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);\r
7190     acc += ((q63_t) out * (yfract));\r
7191 \r
7192     /* acc is in 13.51 format and down shift acc by 36 times */\r
7193     /* Convert out to 1.15 format */\r
7194     return (acc >> 36);\r
7195 \r
7196   }\r
7197 \r
7198   /**\r
7199   * @brief  Q7 bilinear interpolation.\r
7200   * @param[in,out] *S points to an instance of the interpolation structure.\r
7201   * @param[in] X interpolation coordinate in 12.20 format.\r
7202   * @param[in] Y interpolation coordinate in 12.20 format.\r
7203   * @return out interpolated value.\r
7204   */\r
7205 \r
7206   static __INLINE q7_t arm_bilinear_interp_q7(\r
7207   arm_bilinear_interp_instance_q7 * S,\r
7208   q31_t X,\r
7209   q31_t Y)\r
7210   {\r
7211     q63_t acc = 0;                               /* output */\r
7212     q31_t out;                                   /* Temporary output */\r
7213     q31_t xfract, yfract;                        /* X, Y fractional parts */\r
7214     q7_t x1, x2, y1, y2;                         /* Nearest output values */\r
7215     int32_t rI, cI;                              /* Row and column indices */\r
7216     q7_t *pYData = S->pData;                     /* pointer to output table values */\r
7217     uint32_t nCols = S->numCols;                 /* num of rows */\r
7218 \r
7219     /* Input is in 12.20 format */\r
7220     /* 12 bits for the table index */\r
7221     /* Index value calculation */\r
7222     rI = ((X & 0xFFF00000) >> 20);\r
7223 \r
7224     /* Input is in 12.20 format */\r
7225     /* 12 bits for the table index */\r
7226     /* Index value calculation */\r
7227     cI = ((Y & 0xFFF00000) >> 20);\r
7228 \r
7229     /* Care taken for table outside boundary */\r
7230     /* Returns zero output when values are outside table boundary */\r
7231     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))\r
7232     {\r
7233       return (0);\r
7234     }\r
7235 \r
7236     /* 20 bits for the fractional part */\r
7237     /* xfract should be in 12.20 format */\r
7238     xfract = (X & 0x000FFFFF);\r
7239 \r
7240     /* Read two nearest output values from the index */\r
7241     x1 = pYData[(rI) + nCols * (cI)];\r
7242     x2 = pYData[(rI) + nCols * (cI) + 1u];\r
7243 \r
7244 \r
7245     /* 20 bits for the fractional part */\r
7246     /* yfract should be in 12.20 format */\r
7247     yfract = (Y & 0x000FFFFF);\r
7248 \r
7249     /* Read two nearest output values from the index */\r
7250     y1 = pYData[(rI) + nCols * (cI + 1)];\r
7251     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];\r
7252 \r
7253     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */\r
7254     out = ((x1 * (0xFFFFF - xfract)));\r
7255     acc = (((q63_t) out * (0xFFFFF - yfract)));\r
7256 \r
7257     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */\r
7258     out = ((x2 * (0xFFFFF - yfract)));\r
7259     acc += (((q63_t) out * (xfract)));\r
7260 \r
7261     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */\r
7262     out = ((y1 * (0xFFFFF - xfract)));\r
7263     acc += (((q63_t) out * (yfract)));\r
7264 \r
7265     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */\r
7266     out = ((y2 * (yfract)));\r
7267     acc += (((q63_t) out * (xfract)));\r
7268 \r
7269     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */\r
7270     return (acc >> 40);\r
7271 \r
7272   }\r
7273 \r
7274   /**\r
7275    * @} end of BilinearInterpolate group\r
7276    */\r
7277 \r
7278 \r
7279 #if   defined ( __CC_ARM ) //Keil\r
7280 //SMMLAR\r
7281   #define multAcc_32x32_keep32_R(a, x, y) \\r
7282   a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)\r
7283 \r
7284 //SMMLSR\r
7285   #define multSub_32x32_keep32_R(a, x, y) \\r
7286   a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)\r
7287 \r
7288 //SMMULR\r
7289   #define mult_32x32_keep32_R(a, x, y) \\r
7290   a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)\r
7291 \r
7292 //Enter low optimization region - place directly above function definition\r
7293   #define LOW_OPTIMIZATION_ENTER \\r
7294      _Pragma ("push")         \\r
7295      _Pragma ("O1")\r
7296 \r
7297 //Exit low optimization region - place directly after end of function definition\r
7298   #define LOW_OPTIMIZATION_EXIT \\r
7299      _Pragma ("pop")\r
7300 \r
7301 //Enter low optimization region - place directly above function definition\r
7302   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7303 \r
7304 //Exit low optimization region - place directly after end of function definition\r
7305   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7306 \r
7307 #elif defined(__ICCARM__) //IAR\r
7308  //SMMLA\r
7309   #define multAcc_32x32_keep32_R(a, x, y) \\r
7310   a += (q31_t) (((q63_t) x * y) >> 32)\r
7311 \r
7312  //SMMLS\r
7313   #define multSub_32x32_keep32_R(a, x, y) \\r
7314   a -= (q31_t) (((q63_t) x * y) >> 32)\r
7315 \r
7316 //SMMUL\r
7317   #define mult_32x32_keep32_R(a, x, y) \\r
7318   a = (q31_t) (((q63_t) x * y ) >> 32)\r
7319 \r
7320 //Enter low optimization region - place directly above function definition\r
7321   #define LOW_OPTIMIZATION_ENTER \\r
7322      _Pragma ("optimize=low")\r
7323 \r
7324 //Exit low optimization region - place directly after end of function definition\r
7325   #define LOW_OPTIMIZATION_EXIT\r
7326 \r
7327 //Enter low optimization region - place directly above function definition\r
7328   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \\r
7329      _Pragma ("optimize=low")\r
7330 \r
7331 //Exit low optimization region - place directly after end of function definition\r
7332   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7333 \r
7334 #elif defined(__GNUC__)\r
7335  //SMMLA\r
7336   #define multAcc_32x32_keep32_R(a, x, y) \\r
7337   a += (q31_t) (((q63_t) x * y) >> 32)\r
7338 \r
7339  //SMMLS\r
7340   #define multSub_32x32_keep32_R(a, x, y) \\r
7341   a -= (q31_t) (((q63_t) x * y) >> 32)\r
7342 \r
7343 //SMMUL\r
7344   #define mult_32x32_keep32_R(a, x, y) \\r
7345   a = (q31_t) (((q63_t) x * y ) >> 32)\r
7346 \r
7347   #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))\r
7348 \r
7349   #define LOW_OPTIMIZATION_EXIT\r
7350 \r
7351   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7352 \r
7353   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7354 \r
7355 #elif defined(__CSMC__)         // Cosmic\r
7356 //SMMLA\r
7357    #define multAcc_32x32_keep32_R(a, x, y) \\r
7358    a += (q31_t) (((q63_t) x * y) >> 32)\r
7359 \r
7360  //SMMLS\r
7361    #define multSub_32x32_keep32_R(a, x, y) \\r
7362    a -= (q31_t) (((q63_t) x * y) >> 32)\r
7363 \r
7364 //SMMUL\r
7365    #define mult_32x32_keep32_R(a, x, y) \\r
7366    a = (q31_t) (((q63_t) x * y ) >> 32)\r
7367 \r
7368 #define LOW_OPTIMIZATION_ENTER\r
7369 #define LOW_OPTIMIZATION_EXIT\r
7370 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER\r
7371 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT\r
7372 \r
7373 #endif\r
7374 \r
7375 \r
7376 \r
7377 \r
7378 \r
7379 #ifdef  __cplusplus\r
7380 }\r
7381 #endif\r
7382 \r
7383 \r
7384 #endif /* _ARM_MATH_H */\r
7385 \r
7386 \r
7387 /**\r
7388  *\r
7389  * End of file.\r
7390  */\r