This is the final version of Mini Gateway for Automation and Security desgined for Renesas GR Peach Design Contest

Dependencies:   GR-PEACH_video GraphicsFramework HTTPServer R_BSP mbed-rpc mbed-rtos Socket lwip-eth lwip-sys lwip FATFileSystem

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_math.h Source File

arm_math.h

00001 /* ----------------------------------------------------------------------
00002 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
00003 *
00004 * $Date:        19. March 2015
00005 * $Revision:    V.1.4.5
00006 *
00007 * Project:      CMSIS DSP Library
00008 * Title:        arm_math.h
00009 *
00010 * Description:  Public header file for CMSIS DSP Library
00011 *
00012 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
00013 *
00014 * Redistribution and use in source and binary forms, with or without
00015 * modification, are permitted provided that the following conditions
00016 * are met:
00017 *   - Redistributions of source code must retain the above copyright
00018 *     notice, this list of conditions and the following disclaimer.
00019 *   - Redistributions in binary form must reproduce the above copyright
00020 *     notice, this list of conditions and the following disclaimer in
00021 *     the documentation and/or other materials provided with the
00022 *     distribution.
00023 *   - Neither the name of ARM LIMITED nor the names of its contributors
00024 *     may be used to endorse or promote products derived from this
00025 *     software without specific prior written permission.
00026 *
00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00028 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00029 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00030 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00031 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00032 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00033 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00034 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00035 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00036 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00037 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00038 * POSSIBILITY OF SUCH DAMAGE.
00039  * -------------------------------------------------------------------- */
00040 
00041 /**
00042    \mainpage CMSIS DSP Software Library
00043    *
00044    * Introduction
00045    * ------------
00046    *
00047    * This user manual describes the CMSIS DSP software library,
00048    * a suite of common signal processing functions for use on Cortex-M processor based devices.
00049    *
00050    * The library is divided into a number of functions each covering a specific category:
00051    * - Basic math functions
00052    * - Fast math functions
00053    * - Complex math functions
00054    * - Filters
00055    * - Matrix functions
00056    * - Transforms
00057    * - Motor control functions
00058    * - Statistical functions
00059    * - Support functions
00060    * - Interpolation functions
00061    *
00062    * The library has separate functions for operating on 8-bit integers, 16-bit integers,
00063    * 32-bit integer and 32-bit floating-point values.
00064    *
00065    * Using the Library
00066    * ------------
00067    *
00068    * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
00069    * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
00070    * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
00071    * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
00072    * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
00073    * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
00074    * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
00075    * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
00076    * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
00077    * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
00078    * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
00079    * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
00080    * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
00081    * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
00082    * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
00083    *
00084    * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
00085    * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
00086    * public header file <code> arm_math.h</code> for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
00087    * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or  ARM_MATH_CM3 or
00088    * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
00089    *
00090    * Examples
00091    * --------
00092    *
00093    * The library ships with a number of examples which demonstrate how to use the library functions.
00094    *
00095    * Toolchain Support
00096    * ------------
00097    *
00098    * The library has been developed and tested with MDK-ARM version 5.14.0.0
00099    * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
00100    *
00101    * Building the Library
00102    * ------------
00103    *
00104    * 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.
00105    * - arm_cortexM_math.uvprojx
00106    *
00107    *
00108    * The libraries can be built by opening the arm_cortexM_math.uvprojx project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
00109    *
00110    * Pre-processor Macros
00111    * ------------
00112    *
00113    * Each library project have differant pre-processor macros.
00114    *
00115    * - UNALIGNED_SUPPORT_DISABLE:
00116    *
00117    * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
00118    *
00119    * - ARM_MATH_BIG_ENDIAN:
00120    *
00121    * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
00122    *
00123    * - ARM_MATH_MATRIX_CHECK:
00124    *
00125    * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
00126    *
00127    * - ARM_MATH_ROUNDING:
00128    *
00129    * Define macro ARM_MATH_ROUNDING for rounding on support functions
00130    *
00131    * - ARM_MATH_CMx:
00132    *
00133    * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
00134    * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
00135    * ARM_MATH_CM7 for building the library on cortex-M7.
00136    *
00137    * - __FPU_PRESENT:
00138    *
00139    * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
00140    *
00141    * <hr>
00142    * CMSIS-DSP in ARM::CMSIS Pack
00143    * -----------------------------
00144    * 
00145    * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
00146    * |File/Folder                   |Content                                                                 |
00147    * |------------------------------|------------------------------------------------------------------------|
00148    * |\b CMSIS\\Documentation\\DSP  | This documentation                                                     |
00149    * |\b CMSIS\\DSP_Lib             | Software license agreement (license.txt)                               |
00150    * |\b CMSIS\\DSP_Lib\\Examples   | Example projects demonstrating the usage of the library functions      |
00151    * |\b CMSIS\\DSP_Lib\\Source     | Source files for rebuilding the library                                |
00152    * 
00153    * <hr>
00154    * Revision History of CMSIS-DSP
00155    * ------------
00156    * Please refer to \ref ChangeLog_pg.
00157    *
00158    * Copyright Notice
00159    * ------------
00160    *
00161    * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
00162    */
00163 
00164 
00165 /**
00166  * @defgroup groupMath Basic Math Functions
00167  */
00168 
00169 /**
00170  * @defgroup groupFastMath Fast Math Functions
00171  * This set of functions provides a fast approximation to sine, cosine, and square root.
00172  * As compared to most of the other functions in the CMSIS math library, the fast math functions
00173  * operate on individual values and not arrays.
00174  * There are separate functions for Q15, Q31, and floating-point data.
00175  *
00176  */
00177 
00178 /**
00179  * @defgroup groupCmplxMath Complex Math Functions
00180  * This set of functions operates on complex data vectors.
00181  * The data in the complex arrays is stored in an interleaved fashion
00182  * (real, imag, real, imag, ...).
00183  * In the API functions, the number of samples in a complex array refers
00184  * to the number of complex values; the array contains twice this number of
00185  * real values.
00186  */
00187 
00188 /**
00189  * @defgroup groupFilters Filtering Functions
00190  */
00191 
00192 /**
00193  * @defgroup groupMatrix Matrix Functions
00194  *
00195  * This set of functions provides basic matrix math operations.
00196  * The functions operate on matrix data structures.  For example,
00197  * the type
00198  * definition for the floating-point matrix structure is shown
00199  * below:
00200  * <pre>
00201  *     typedef struct
00202  *     {
00203  *       uint16_t numRows;     // number of rows of the matrix.
00204  *       uint16_t numCols;     // number of columns of the matrix.
00205  *       float32_t *pData;     // points to the data of the matrix.
00206  *     } arm_matrix_instance_f32;
00207  * </pre>
00208  * There are similar definitions for Q15 and Q31 data types.
00209  *
00210  * The structure specifies the size of the matrix and then points to
00211  * an array of data.  The array is of size <code>numRows X numCols</code>
00212  * and the values are arranged in row order.  That is, the
00213  * matrix element (i, j) is stored at:
00214  * <pre>
00215  *     pData[i*numCols + j]
00216  * </pre>
00217  *
00218  * \par Init Functions
00219  * There is an associated initialization function for each type of matrix
00220  * data structure.
00221  * The initialization function sets the values of the internal structure fields.
00222  * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
00223  * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types,  respectively.
00224  *
00225  * \par
00226  * Use of the initialization function is optional. However, if initialization function is used
00227  * then the instance structure cannot be placed into a const data section.
00228  * To place the instance structure in a const data
00229  * section, manually initialize the data structure.  For example:
00230  * <pre>
00231  * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
00232  * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
00233  * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
00234  * </pre>
00235  * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
00236  * specifies the number of columns, and <code>pData</code> points to the
00237  * data array.
00238  *
00239  * \par Size Checking
00240  * By default all of the matrix functions perform size checking on the input and
00241  * output matrices.  For example, the matrix addition function verifies that the
00242  * two input matrices and the output matrix all have the same number of rows and
00243  * columns.  If the size check fails the functions return:
00244  * <pre>
00245  *     ARM_MATH_SIZE_MISMATCH
00246  * </pre>
00247  * Otherwise the functions return
00248  * <pre>
00249  *     ARM_MATH_SUCCESS
00250  * </pre>
00251  * There is some overhead associated with this matrix size checking.
00252  * The matrix size checking is enabled via the \#define
00253  * <pre>
00254  *     ARM_MATH_MATRIX_CHECK
00255  * </pre>
00256  * within the library project settings.  By default this macro is defined
00257  * and size checking is enabled.  By changing the project settings and
00258  * undefining this macro size checking is eliminated and the functions
00259  * run a bit faster.  With size checking disabled the functions always
00260  * return <code>ARM_MATH_SUCCESS</code>.
00261  */
00262 
00263 /**
00264  * @defgroup groupTransforms Transform Functions
00265  */
00266 
00267 /**
00268  * @defgroup groupController Controller Functions
00269  */
00270 
00271 /**
00272  * @defgroup groupStats Statistics Functions
00273  */
00274 /**
00275  * @defgroup groupSupport Support Functions
00276  */
00277 
00278 /**
00279  * @defgroup groupInterpolation Interpolation Functions
00280  * These functions perform 1- and 2-dimensional interpolation of data.
00281  * Linear interpolation is used for 1-dimensional data and
00282  * bilinear interpolation is used for 2-dimensional data.
00283  */
00284 
00285 /**
00286  * @defgroup groupExamples Examples
00287  */
00288 #ifndef _ARM_MATH_H
00289 #define _ARM_MATH_H
00290 
00291 #define __CMSIS_GENERIC         /* disable NVIC and Systick functions */
00292 
00293 #if defined(ARM_MATH_CM7)
00294   #include "core_cm7.h"
00295 #elif defined (ARM_MATH_CM4)
00296   #include "core_cm4.h"
00297 #elif defined (ARM_MATH_CM3)
00298   #include "core_cm3.h"
00299 #elif defined (ARM_MATH_CM0)
00300   #include "core_cm0.h"
00301 #define ARM_MATH_CM0_FAMILY
00302   #elif defined (ARM_MATH_CM0PLUS)
00303 #include "core_cm0plus.h"
00304   #define ARM_MATH_CM0_FAMILY
00305 #else
00306   #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
00307 #endif
00308 
00309 #undef  __CMSIS_GENERIC         /* enable NVIC and Systick functions */
00310 #include "string.h"
00311 #include "math.h"
00312 #ifdef  __cplusplus
00313 extern "C"
00314 {
00315 #endif
00316 
00317 
00318   /**
00319    * @brief Macros required for reciprocal calculation in Normalized LMS
00320    */
00321 
00322 #define DELTA_Q31           (0x100)
00323 #define DELTA_Q15           0x5
00324 #define INDEX_MASK          0x0000003F
00325 #ifndef PI
00326 #define PI                  3.14159265358979f
00327 #endif
00328 
00329   /**
00330    * @brief Macros required for SINE and COSINE Fast math approximations
00331    */
00332 
00333 #define FAST_MATH_TABLE_SIZE  512
00334 #define FAST_MATH_Q31_SHIFT   (32 - 10)
00335 #define FAST_MATH_Q15_SHIFT   (16 - 10)
00336 #define CONTROLLER_Q31_SHIFT  (32 - 9)
00337 #define TABLE_SIZE  256
00338 #define TABLE_SPACING_Q31      0x400000
00339 #define TABLE_SPACING_Q15      0x80
00340 
00341   /**
00342    * @brief Macros required for SINE and COSINE Controller functions
00343    */
00344   /* 1.31(q31) Fixed value of 2/360 */
00345   /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
00346 #define INPUT_SPACING           0xB60B61
00347 
00348   /**
00349    * @brief Macro for Unaligned Support
00350    */
00351 #ifndef UNALIGNED_SUPPORT_DISABLE
00352     #define ALIGN4
00353 #else
00354   #if defined  (__GNUC__)
00355     #define ALIGN4 __attribute__((aligned(4)))
00356   #else
00357     #define ALIGN4 __align(4)
00358   #endif
00359 #endif  /*  #ifndef UNALIGNED_SUPPORT_DISABLE   */
00360 
00361   /**
00362    * @brief Error status returned by some functions in the library.
00363    */
00364 
00365   typedef enum
00366   {
00367     ARM_MATH_SUCCESS = 0,                /**< No error */
00368     ARM_MATH_ARGUMENT_ERROR = -1,        /**< One or more arguments are incorrect */
00369     ARM_MATH_LENGTH_ERROR = -2,          /**< Length of data buffer is incorrect */
00370     ARM_MATH_SIZE_MISMATCH = -3,         /**< Size of matrices is not compatible with the operation. */
00371     ARM_MATH_NANINF = -4,                /**< Not-a-number (NaN) or infinity is generated */
00372     ARM_MATH_SINGULAR = -5,              /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
00373     ARM_MATH_TEST_FAILURE = -6           /**< Test Failed  */
00374   } arm_status;
00375 
00376   /**
00377    * @brief 8-bit fractional data type in 1.7 format.
00378    */
00379   typedef int8_t q7_t;
00380 
00381   /**
00382    * @brief 16-bit fractional data type in 1.15 format.
00383    */
00384   typedef int16_t q15_t;
00385 
00386   /**
00387    * @brief 32-bit fractional data type in 1.31 format.
00388    */
00389   typedef int32_t q31_t;
00390 
00391   /**
00392    * @brief 64-bit fractional data type in 1.63 format.
00393    */
00394   typedef int64_t q63_t;
00395 
00396   /**
00397    * @brief 32-bit floating-point type definition.
00398    */
00399   typedef float float32_t;
00400 
00401   /**
00402    * @brief 64-bit floating-point type definition.
00403    */
00404   typedef double float64_t;
00405 
00406   /**
00407    * @brief definition to read/write two 16 bit values.
00408    */
00409 #if defined __CC_ARM
00410   #define __SIMD32_TYPE int32_t __packed
00411   #define CMSIS_UNUSED __attribute__((unused))
00412 #elif defined __ICCARM__
00413   #define __SIMD32_TYPE int32_t __packed
00414   #define CMSIS_UNUSED
00415 #elif defined __GNUC__
00416   #define __SIMD32_TYPE int32_t
00417   #define CMSIS_UNUSED __attribute__((unused))
00418 #elif defined __CSMC__          /* Cosmic */
00419   #define __SIMD32_TYPE int32_t
00420   #define CMSIS_UNUSED
00421 #elif defined __TASKING__
00422   #define __SIMD32_TYPE __unaligned int32_t
00423   #define CMSIS_UNUSED
00424 #else
00425   #error Unknown compiler
00426 #endif
00427 
00428 #define __SIMD32(addr)  (*(__SIMD32_TYPE **) & (addr))
00429 #define __SIMD32_CONST(addr)  ((__SIMD32_TYPE *)(addr))
00430 
00431 #define _SIMD32_OFFSET(addr)  (*(__SIMD32_TYPE *)  (addr))
00432 
00433 #define __SIMD64(addr)  (*(int64_t **) & (addr))
00434 
00435 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
00436   /**
00437    * @brief definition to pack two 16 bit values.
00438    */
00439 #define __PKHBT(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0x0000FFFF) | \
00440                                          (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000)  )
00441 #define __PKHTB(ARG1, ARG2, ARG3)      ( (((int32_t)(ARG1) <<  0) & (int32_t)0xFFFF0000) | \
00442                                          (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF)  )
00443 
00444 #endif
00445 
00446 
00447    /**
00448    * @brief definition to pack four 8 bit values.
00449    */
00450 #ifndef ARM_MATH_BIG_ENDIAN
00451 
00452 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) <<  0) & (int32_t)0x000000FF) | \
00453                                 (((int32_t)(v1) <<  8) & (int32_t)0x0000FF00) | \
00454                                 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
00455                                 (((int32_t)(v3) << 24) & (int32_t)0xFF000000)  )
00456 #else
00457 
00458 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) <<  0) & (int32_t)0x000000FF) | \
00459                                 (((int32_t)(v2) <<  8) & (int32_t)0x0000FF00) | \
00460                                 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
00461                                 (((int32_t)(v0) << 24) & (int32_t)0xFF000000)  )
00462 
00463 #endif
00464 
00465 
00466   /**
00467    * @brief Clips Q63 to Q31 values.
00468    */
00469   static __INLINE q31_t clip_q63_to_q31(
00470   q63_t x)
00471   {
00472     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
00473       ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
00474   }
00475 
00476   /**
00477    * @brief Clips Q63 to Q15 values.
00478    */
00479   static __INLINE q15_t clip_q63_to_q15(
00480   q63_t x)
00481   {
00482     return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
00483       ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
00484   }
00485 
00486   /**
00487    * @brief Clips Q31 to Q7 values.
00488    */
00489   static __INLINE q7_t clip_q31_to_q7(
00490   q31_t x)
00491   {
00492     return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
00493       ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
00494   }
00495 
00496   /**
00497    * @brief Clips Q31 to Q15 values.
00498    */
00499   static __INLINE q15_t clip_q31_to_q15(
00500   q31_t x)
00501   {
00502     return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
00503       ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
00504   }
00505 
00506   /**
00507    * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
00508    */
00509 
00510   static __INLINE q63_t mult32x64(
00511   q63_t x,
00512   q31_t y)
00513   {
00514     return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
00515             (((q63_t) (x >> 32) * y)));
00516   }
00517 
00518 
00519 //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM   )
00520 //#define __CLZ __clz
00521 //#endif
00522 
00523 //note: function can be removed when all toolchain support __CLZ for Cortex-M0
00524 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__))  )
00525 
00526   static __INLINE uint32_t __CLZ(
00527   q31_t data);
00528 
00529 
00530   static __INLINE uint32_t __CLZ(
00531   q31_t data)
00532   {
00533     uint32_t count = 0;
00534     uint32_t mask = 0x80000000;
00535 
00536     while((data & mask) == 0)
00537     {
00538       count += 1u;
00539       mask = mask >> 1u;
00540     }
00541 
00542     return (count);
00543 
00544   }
00545 
00546 #endif
00547 
00548   /**
00549    * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
00550    */
00551 
00552   static __INLINE uint32_t arm_recip_q31(
00553   q31_t in,
00554   q31_t * dst,
00555   q31_t * pRecipTable)
00556   {
00557 
00558     uint32_t out, tempVal;
00559     uint32_t index, i;
00560     uint32_t signBits;
00561 
00562     if(in > 0)
00563     {
00564       signBits = __CLZ(in) - 1;
00565     }
00566     else
00567     {
00568       signBits = __CLZ(-in) - 1;
00569     }
00570 
00571     /* Convert input sample to 1.31 format */
00572     in = in << signBits;
00573 
00574     /* calculation of index for initial approximated Val */
00575     index = (uint32_t) (in >> 24u);
00576     index = (index & INDEX_MASK);
00577 
00578     /* 1.31 with exp 1 */
00579     out = pRecipTable[index];
00580 
00581     /* calculation of reciprocal value */
00582     /* running approximation for two iterations */
00583     for (i = 0u; i < 2u; i++)
00584     {
00585       tempVal = (q31_t) (((q63_t) in * out) >> 31u);
00586       tempVal = 0x7FFFFFFF - tempVal;
00587       /*      1.31 with exp 1 */
00588       //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
00589       out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
00590     }
00591 
00592     /* write output */
00593     *dst = out;
00594 
00595     /* return num of signbits of out = 1/in value */
00596     return (signBits + 1u);
00597 
00598   }
00599 
00600   /**
00601    * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
00602    */
00603   static __INLINE uint32_t arm_recip_q15(
00604   q15_t in,
00605   q15_t * dst,
00606   q15_t * pRecipTable)
00607   {
00608 
00609     uint32_t out = 0, tempVal = 0;
00610     uint32_t index = 0, i = 0;
00611     uint32_t signBits = 0;
00612 
00613     if(in > 0)
00614     {
00615       signBits = __CLZ(in) - 17;
00616     }
00617     else
00618     {
00619       signBits = __CLZ(-in) - 17;
00620     }
00621 
00622     /* Convert input sample to 1.15 format */
00623     in = in << signBits;
00624 
00625     /* calculation of index for initial approximated Val */
00626     index = in >> 8;
00627     index = (index & INDEX_MASK);
00628 
00629     /*      1.15 with exp 1  */
00630     out = pRecipTable[index];
00631 
00632     /* calculation of reciprocal value */
00633     /* running approximation for two iterations */
00634     for (i = 0; i < 2; i++)
00635     {
00636       tempVal = (q15_t) (((q31_t) in * out) >> 15);
00637       tempVal = 0x7FFF - tempVal;
00638       /*      1.15 with exp 1 */
00639       out = (q15_t) (((q31_t) out * tempVal) >> 14);
00640     }
00641 
00642     /* write output */
00643     *dst = out;
00644 
00645     /* return num of signbits of out = 1/in value */
00646     return (signBits + 1);
00647 
00648   }
00649 
00650 
00651   /*
00652    * @brief C custom defined intrinisic function for only M0 processors
00653    */
00654 #if defined(ARM_MATH_CM0_FAMILY)
00655 
00656   static __INLINE q31_t __SSAT(
00657   q31_t x,
00658   uint32_t y)
00659   {
00660     int32_t posMax, negMin;
00661     uint32_t i;
00662 
00663     posMax = 1;
00664     for (i = 0; i < (y - 1); i++)
00665     {
00666       posMax = posMax * 2;
00667     }
00668 
00669     if(x > 0)
00670     {
00671       posMax = (posMax - 1);
00672 
00673       if(x > posMax)
00674       {
00675         x = posMax;
00676       }
00677     }
00678     else
00679     {
00680       negMin = -posMax;
00681 
00682       if(x < negMin)
00683       {
00684         x = negMin;
00685       }
00686     }
00687     return (x);
00688 
00689 
00690   }
00691 
00692 #endif /* end of ARM_MATH_CM0_FAMILY */
00693 
00694 
00695 
00696   /*
00697    * @brief C custom defined intrinsic function for M3 and M0 processors
00698    */
00699 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
00700 
00701   /*
00702    * @brief C custom defined QADD8 for M3 and M0 processors
00703    */
00704   static __INLINE q31_t __QADD8(
00705   q31_t x,
00706   q31_t y)
00707   {
00708 
00709     q31_t sum;
00710     q7_t r, s, t, u;
00711 
00712     r = (q7_t) x;
00713     s = (q7_t) y;
00714 
00715     r = __SSAT((q31_t) (r + s), 8);
00716     s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
00717     t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
00718     u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
00719 
00720     sum =
00721       (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
00722       (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
00723 
00724     return sum;
00725 
00726   }
00727 
00728   /*
00729    * @brief C custom defined QSUB8 for M3 and M0 processors
00730    */
00731   static __INLINE q31_t __QSUB8(
00732   q31_t x,
00733   q31_t y)
00734   {
00735 
00736     q31_t sum;
00737     q31_t r, s, t, u;
00738 
00739     r = (q7_t) x;
00740     s = (q7_t) y;
00741 
00742     r = __SSAT((r - s), 8);
00743     s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
00744     t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
00745     u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
00746 
00747     sum =
00748       (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
00749                                                                 0x000000FF);
00750 
00751     return sum;
00752   }
00753 
00754   /*
00755    * @brief C custom defined QADD16 for M3 and M0 processors
00756    */
00757 
00758   /*
00759    * @brief C custom defined QADD16 for M3 and M0 processors
00760    */
00761   static __INLINE q31_t __QADD16(
00762   q31_t x,
00763   q31_t y)
00764   {
00765 
00766     q31_t sum;
00767     q31_t r, s;
00768 
00769     r = (q15_t) x;
00770     s = (q15_t) y;
00771 
00772     r = __SSAT(r + s, 16);
00773     s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
00774 
00775     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00776 
00777     return sum;
00778 
00779   }
00780 
00781   /*
00782    * @brief C custom defined SHADD16 for M3 and M0 processors
00783    */
00784   static __INLINE q31_t __SHADD16(
00785   q31_t x,
00786   q31_t y)
00787   {
00788 
00789     q31_t sum;
00790     q31_t r, s;
00791 
00792     r = (q15_t) x;
00793     s = (q15_t) y;
00794 
00795     r = ((r >> 1) + (s >> 1));
00796     s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
00797 
00798     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00799 
00800     return sum;
00801 
00802   }
00803 
00804   /*
00805    * @brief C custom defined QSUB16 for M3 and M0 processors
00806    */
00807   static __INLINE q31_t __QSUB16(
00808   q31_t x,
00809   q31_t y)
00810   {
00811 
00812     q31_t sum;
00813     q31_t r, s;
00814 
00815     r = (q15_t) x;
00816     s = (q15_t) y;
00817 
00818     r = __SSAT(r - s, 16);
00819     s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
00820 
00821     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00822 
00823     return sum;
00824   }
00825 
00826   /*
00827    * @brief C custom defined SHSUB16 for M3 and M0 processors
00828    */
00829   static __INLINE q31_t __SHSUB16(
00830   q31_t x,
00831   q31_t y)
00832   {
00833 
00834     q31_t diff;
00835     q31_t r, s;
00836 
00837     r = (q15_t) x;
00838     s = (q15_t) y;
00839 
00840     r = ((r >> 1) - (s >> 1));
00841     s = (((x >> 17) - (y >> 17)) << 16);
00842 
00843     diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00844 
00845     return diff;
00846   }
00847 
00848   /*
00849    * @brief C custom defined QASX for M3 and M0 processors
00850    */
00851   static __INLINE q31_t __QASX(
00852   q31_t x,
00853   q31_t y)
00854   {
00855 
00856     q31_t sum = 0;
00857 
00858     sum =
00859       ((sum +
00860         clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
00861       clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
00862 
00863     return sum;
00864   }
00865 
00866   /*
00867    * @brief C custom defined SHASX for M3 and M0 processors
00868    */
00869   static __INLINE q31_t __SHASX(
00870   q31_t x,
00871   q31_t y)
00872   {
00873 
00874     q31_t sum;
00875     q31_t r, s;
00876 
00877     r = (q15_t) x;
00878     s = (q15_t) y;
00879 
00880     r = ((r >> 1) - (y >> 17));
00881     s = (((x >> 17) + (s >> 1)) << 16);
00882 
00883     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00884 
00885     return sum;
00886   }
00887 
00888 
00889   /*
00890    * @brief C custom defined QSAX for M3 and M0 processors
00891    */
00892   static __INLINE q31_t __QSAX(
00893   q31_t x,
00894   q31_t y)
00895   {
00896 
00897     q31_t sum = 0;
00898 
00899     sum =
00900       ((sum +
00901         clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
00902       clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
00903 
00904     return sum;
00905   }
00906 
00907   /*
00908    * @brief C custom defined SHSAX for M3 and M0 processors
00909    */
00910   static __INLINE q31_t __SHSAX(
00911   q31_t x,
00912   q31_t y)
00913   {
00914 
00915     q31_t sum;
00916     q31_t r, s;
00917 
00918     r = (q15_t) x;
00919     s = (q15_t) y;
00920 
00921     r = ((r >> 1) + (y >> 17));
00922     s = (((x >> 17) - (s >> 1)) << 16);
00923 
00924     sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
00925 
00926     return sum;
00927   }
00928 
00929   /*
00930    * @brief C custom defined SMUSDX for M3 and M0 processors
00931    */
00932   static __INLINE q31_t __SMUSDX(
00933   q31_t x,
00934   q31_t y)
00935   {
00936 
00937     return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
00938                      ((q15_t) (x >> 16) * (q15_t) y)));
00939   }
00940 
00941   /*
00942    * @brief C custom defined SMUADX for M3 and M0 processors
00943    */
00944   static __INLINE q31_t __SMUADX(
00945   q31_t x,
00946   q31_t y)
00947   {
00948 
00949     return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
00950                      ((q15_t) (x >> 16) * (q15_t) y)));
00951   }
00952 
00953   /*
00954    * @brief C custom defined QADD for M3 and M0 processors
00955    */
00956   static __INLINE q31_t __QADD(
00957   q31_t x,
00958   q31_t y)
00959   {
00960     return clip_q63_to_q31((q63_t) x + y);
00961   }
00962 
00963   /*
00964    * @brief C custom defined QSUB for M3 and M0 processors
00965    */
00966   static __INLINE q31_t __QSUB(
00967   q31_t x,
00968   q31_t y)
00969   {
00970     return clip_q63_to_q31((q63_t) x - y);
00971   }
00972 
00973   /*
00974    * @brief C custom defined SMLAD for M3 and M0 processors
00975    */
00976   static __INLINE q31_t __SMLAD(
00977   q31_t x,
00978   q31_t y,
00979   q31_t sum)
00980   {
00981 
00982     return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
00983             ((q15_t) x * (q15_t) y));
00984   }
00985 
00986   /*
00987    * @brief C custom defined SMLADX for M3 and M0 processors
00988    */
00989   static __INLINE q31_t __SMLADX(
00990   q31_t x,
00991   q31_t y,
00992   q31_t sum)
00993   {
00994 
00995     return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
00996             ((q15_t) x * (q15_t) (y >> 16)));
00997   }
00998 
00999   /*
01000    * @brief C custom defined SMLSDX for M3 and M0 processors
01001    */
01002   static __INLINE q31_t __SMLSDX(
01003   q31_t x,
01004   q31_t y,
01005   q31_t sum)
01006   {
01007 
01008     return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
01009             ((q15_t) x * (q15_t) (y >> 16)));
01010   }
01011 
01012   /*
01013    * @brief C custom defined SMLALD for M3 and M0 processors
01014    */
01015   static __INLINE q63_t __SMLALD(
01016   q31_t x,
01017   q31_t y,
01018   q63_t sum)
01019   {
01020 
01021     return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
01022             ((q15_t) x * (q15_t) y));
01023   }
01024 
01025   /*
01026    * @brief C custom defined SMLALDX for M3 and M0 processors
01027    */
01028   static __INLINE q63_t __SMLALDX(
01029   q31_t x,
01030   q31_t y,
01031   q63_t sum)
01032   {
01033 
01034     return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
01035       ((q15_t) x * (q15_t) (y >> 16));
01036   }
01037 
01038   /*
01039    * @brief C custom defined SMUAD for M3 and M0 processors
01040    */
01041   static __INLINE q31_t __SMUAD(
01042   q31_t x,
01043   q31_t y)
01044   {
01045 
01046     return (((x >> 16) * (y >> 16)) +
01047             (((x << 16) >> 16) * ((y << 16) >> 16)));
01048   }
01049 
01050   /*
01051    * @brief C custom defined SMUSD for M3 and M0 processors
01052    */
01053   static __INLINE q31_t __SMUSD(
01054   q31_t x,
01055   q31_t y)
01056   {
01057 
01058     return (-((x >> 16) * (y >> 16)) +
01059             (((x << 16) >> 16) * ((y << 16) >> 16)));
01060   }
01061 
01062 
01063   /*
01064    * @brief C custom defined SXTB16 for M3 and M0 processors
01065    */
01066   static __INLINE q31_t __SXTB16(
01067   q31_t x)
01068   {
01069 
01070     return ((((x << 24) >> 24) & 0x0000FFFF) |
01071             (((x << 8) >> 8) & 0xFFFF0000));
01072   }
01073 
01074 
01075 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
01076 
01077 
01078   /**
01079    * @brief Instance structure for the Q7 FIR filter.
01080    */
01081   typedef struct
01082   {
01083     uint16_t numTaps;        /**< number of filter coefficients in the filter. */
01084     q7_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01085     q7_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
01086   } arm_fir_instance_q7;
01087 
01088   /**
01089    * @brief Instance structure for the Q15 FIR filter.
01090    */
01091   typedef struct
01092   {
01093     uint16_t numTaps;         /**< number of filter coefficients in the filter. */
01094     q15_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01095     q15_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
01096   } arm_fir_instance_q15;
01097 
01098   /**
01099    * @brief Instance structure for the Q31 FIR filter.
01100    */
01101   typedef struct
01102   {
01103     uint16_t numTaps;         /**< number of filter coefficients in the filter. */
01104     q31_t *pState;            /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01105     q31_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps. */
01106   } arm_fir_instance_q31;
01107 
01108   /**
01109    * @brief Instance structure for the floating-point FIR filter.
01110    */
01111   typedef struct
01112   {
01113     uint16_t numTaps;     /**< number of filter coefficients in the filter. */
01114     float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
01115     float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
01116   } arm_fir_instance_f32;
01117 
01118 
01119   /**
01120    * @brief Processing function for the Q7 FIR filter.
01121    * @param[in] *S points to an instance of the Q7 FIR filter structure.
01122    * @param[in] *pSrc points to the block of input data.
01123    * @param[out] *pDst points to the block of output data.
01124    * @param[in] blockSize number of samples to process.
01125    * @return none.
01126    */
01127   void arm_fir_q7(
01128   const arm_fir_instance_q7 * S,
01129   q7_t * pSrc,
01130   q7_t * pDst,
01131   uint32_t blockSize);
01132 
01133 
01134   /**
01135    * @brief  Initialization function for the Q7 FIR filter.
01136    * @param[in,out] *S points to an instance of the Q7 FIR structure.
01137    * @param[in] numTaps  Number of filter coefficients in the filter.
01138    * @param[in] *pCoeffs points to the filter coefficients.
01139    * @param[in] *pState points to the state buffer.
01140    * @param[in] blockSize number of samples that are processed.
01141    * @return none
01142    */
01143   void arm_fir_init_q7(
01144   arm_fir_instance_q7 * S,
01145   uint16_t numTaps,
01146   q7_t * pCoeffs,
01147   q7_t * pState,
01148   uint32_t blockSize);
01149 
01150 
01151   /**
01152    * @brief Processing function for the Q15 FIR filter.
01153    * @param[in] *S points to an instance of the Q15 FIR structure.
01154    * @param[in] *pSrc points to the block of input data.
01155    * @param[out] *pDst points to the block of output data.
01156    * @param[in] blockSize number of samples to process.
01157    * @return none.
01158    */
01159   void arm_fir_q15(
01160   const arm_fir_instance_q15 * S,
01161   q15_t * pSrc,
01162   q15_t * pDst,
01163   uint32_t blockSize);
01164 
01165   /**
01166    * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
01167    * @param[in] *S points to an instance of the Q15 FIR filter structure.
01168    * @param[in] *pSrc points to the block of input data.
01169    * @param[out] *pDst points to the block of output data.
01170    * @param[in] blockSize number of samples to process.
01171    * @return none.
01172    */
01173   void arm_fir_fast_q15(
01174   const arm_fir_instance_q15 * S,
01175   q15_t * pSrc,
01176   q15_t * pDst,
01177   uint32_t blockSize);
01178 
01179   /**
01180    * @brief  Initialization function for the Q15 FIR filter.
01181    * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
01182    * @param[in] numTaps  Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
01183    * @param[in] *pCoeffs points to the filter coefficients.
01184    * @param[in] *pState points to the state buffer.
01185    * @param[in] blockSize number of samples that are processed at a time.
01186    * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
01187    * <code>numTaps</code> is not a supported value.
01188    */
01189 
01190   arm_status arm_fir_init_q15(
01191   arm_fir_instance_q15 * S,
01192   uint16_t numTaps,
01193   q15_t * pCoeffs,
01194   q15_t * pState,
01195   uint32_t blockSize);
01196 
01197   /**
01198    * @brief Processing function for the Q31 FIR filter.
01199    * @param[in] *S points to an instance of the Q31 FIR filter structure.
01200    * @param[in] *pSrc points to the block of input data.
01201    * @param[out] *pDst points to the block of output data.
01202    * @param[in] blockSize number of samples to process.
01203    * @return none.
01204    */
01205   void arm_fir_q31(
01206   const arm_fir_instance_q31 * S,
01207   q31_t * pSrc,
01208   q31_t * pDst,
01209   uint32_t blockSize);
01210 
01211   /**
01212    * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
01213    * @param[in] *S points to an instance of the Q31 FIR structure.
01214    * @param[in] *pSrc points to the block of input data.
01215    * @param[out] *pDst points to the block of output data.
01216    * @param[in] blockSize number of samples to process.
01217    * @return none.
01218    */
01219   void arm_fir_fast_q31(
01220   const arm_fir_instance_q31 * S,
01221   q31_t * pSrc,
01222   q31_t * pDst,
01223   uint32_t blockSize);
01224 
01225   /**
01226    * @brief  Initialization function for the Q31 FIR filter.
01227    * @param[in,out] *S points to an instance of the Q31 FIR structure.
01228    * @param[in]     numTaps  Number of filter coefficients in the filter.
01229    * @param[in]     *pCoeffs points to the filter coefficients.
01230    * @param[in]     *pState points to the state buffer.
01231    * @param[in]     blockSize number of samples that are processed at a time.
01232    * @return        none.
01233    */
01234   void arm_fir_init_q31(
01235   arm_fir_instance_q31 * S,
01236   uint16_t numTaps,
01237   q31_t * pCoeffs,
01238   q31_t * pState,
01239   uint32_t blockSize);
01240 
01241   /**
01242    * @brief Processing function for the floating-point FIR filter.
01243    * @param[in] *S points to an instance of the floating-point FIR structure.
01244    * @param[in] *pSrc points to the block of input data.
01245    * @param[out] *pDst points to the block of output data.
01246    * @param[in] blockSize number of samples to process.
01247    * @return none.
01248    */
01249   void arm_fir_f32(
01250   const arm_fir_instance_f32 * S,
01251   float32_t * pSrc,
01252   float32_t * pDst,
01253   uint32_t blockSize);
01254 
01255   /**
01256    * @brief  Initialization function for the floating-point FIR filter.
01257    * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
01258    * @param[in]     numTaps  Number of filter coefficients in the filter.
01259    * @param[in]     *pCoeffs points to the filter coefficients.
01260    * @param[in]     *pState points to the state buffer.
01261    * @param[in]     blockSize number of samples that are processed at a time.
01262    * @return        none.
01263    */
01264   void arm_fir_init_f32(
01265   arm_fir_instance_f32 * S,
01266   uint16_t numTaps,
01267   float32_t * pCoeffs,
01268   float32_t * pState,
01269   uint32_t blockSize);
01270 
01271 
01272   /**
01273    * @brief Instance structure for the Q15 Biquad cascade filter.
01274    */
01275   typedef struct
01276   {
01277     int8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01278     q15_t *pState;            /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01279     q15_t *pCoeffs;           /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01280     int8_t postShift;         /**< Additional shift, in bits, applied to each output sample. */
01281 
01282   } arm_biquad_casd_df1_inst_q15;
01283 
01284 
01285   /**
01286    * @brief Instance structure for the Q31 Biquad cascade filter.
01287    */
01288   typedef struct
01289   {
01290     uint32_t numStages;      /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01291     q31_t *pState;           /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01292     q31_t *pCoeffs;          /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01293     uint8_t postShift;       /**< Additional shift, in bits, applied to each output sample. */
01294 
01295   } arm_biquad_casd_df1_inst_q31;
01296 
01297   /**
01298    * @brief Instance structure for the floating-point Biquad cascade filter.
01299    */
01300   typedef struct
01301   {
01302     uint32_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
01303     float32_t *pState;          /**< Points to the array of state coefficients.  The array is of length 4*numStages. */
01304     float32_t *pCoeffs;         /**< Points to the array of coefficients.  The array is of length 5*numStages. */
01305 
01306 
01307   } arm_biquad_casd_df1_inst_f32;
01308 
01309 
01310 
01311   /**
01312    * @brief Processing function for the Q15 Biquad cascade filter.
01313    * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.
01314    * @param[in]  *pSrc points to the block of input data.
01315    * @param[out] *pDst points to the block of output data.
01316    * @param[in]  blockSize number of samples to process.
01317    * @return     none.
01318    */
01319 
01320   void arm_biquad_cascade_df1_q15(
01321   const arm_biquad_casd_df1_inst_q15 * S,
01322   q15_t * pSrc,
01323   q15_t * pDst,
01324   uint32_t blockSize);
01325 
01326   /**
01327    * @brief  Initialization function for the Q15 Biquad cascade filter.
01328    * @param[in,out] *S           points to an instance of the Q15 Biquad cascade structure.
01329    * @param[in]     numStages    number of 2nd order stages in the filter.
01330    * @param[in]     *pCoeffs     points to the filter coefficients.
01331    * @param[in]     *pState      points to the state buffer.
01332    * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format
01333    * @return        none
01334    */
01335 
01336   void arm_biquad_cascade_df1_init_q15(
01337   arm_biquad_casd_df1_inst_q15 * S,
01338   uint8_t numStages,
01339   q15_t * pCoeffs,
01340   q15_t * pState,
01341   int8_t postShift);
01342 
01343 
01344   /**
01345    * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
01346    * @param[in]  *S points to an instance of the Q15 Biquad cascade structure.
01347    * @param[in]  *pSrc points to the block of input data.
01348    * @param[out] *pDst points to the block of output data.
01349    * @param[in]  blockSize number of samples to process.
01350    * @return     none.
01351    */
01352 
01353   void arm_biquad_cascade_df1_fast_q15(
01354   const arm_biquad_casd_df1_inst_q15 * S,
01355   q15_t * pSrc,
01356   q15_t * pDst,
01357   uint32_t blockSize);
01358 
01359 
01360   /**
01361    * @brief Processing function for the Q31 Biquad cascade filter
01362    * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.
01363    * @param[in]  *pSrc      points to the block of input data.
01364    * @param[out] *pDst      points to the block of output data.
01365    * @param[in]  blockSize  number of samples to process.
01366    * @return     none.
01367    */
01368 
01369   void arm_biquad_cascade_df1_q31(
01370   const arm_biquad_casd_df1_inst_q31 * S,
01371   q31_t * pSrc,
01372   q31_t * pDst,
01373   uint32_t blockSize);
01374 
01375   /**
01376    * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
01377    * @param[in]  *S         points to an instance of the Q31 Biquad cascade structure.
01378    * @param[in]  *pSrc      points to the block of input data.
01379    * @param[out] *pDst      points to the block of output data.
01380    * @param[in]  blockSize  number of samples to process.
01381    * @return     none.
01382    */
01383 
01384   void arm_biquad_cascade_df1_fast_q31(
01385   const arm_biquad_casd_df1_inst_q31 * S,
01386   q31_t * pSrc,
01387   q31_t * pDst,
01388   uint32_t blockSize);
01389 
01390   /**
01391    * @brief  Initialization function for the Q31 Biquad cascade filter.
01392    * @param[in,out] *S           points to an instance of the Q31 Biquad cascade structure.
01393    * @param[in]     numStages      number of 2nd order stages in the filter.
01394    * @param[in]     *pCoeffs     points to the filter coefficients.
01395    * @param[in]     *pState      points to the state buffer.
01396    * @param[in]     postShift    Shift to be applied to the output. Varies according to the coefficients format
01397    * @return        none
01398    */
01399 
01400   void arm_biquad_cascade_df1_init_q31(
01401   arm_biquad_casd_df1_inst_q31 * S,
01402   uint8_t numStages,
01403   q31_t * pCoeffs,
01404   q31_t * pState,
01405   int8_t postShift);
01406 
01407   /**
01408    * @brief Processing function for the floating-point Biquad cascade filter.
01409    * @param[in]  *S         points to an instance of the floating-point Biquad cascade structure.
01410    * @param[in]  *pSrc      points to the block of input data.
01411    * @param[out] *pDst      points to the block of output data.
01412    * @param[in]  blockSize  number of samples to process.
01413    * @return     none.
01414    */
01415 
01416   void arm_biquad_cascade_df1_f32(
01417   const arm_biquad_casd_df1_inst_f32 * S,
01418   float32_t * pSrc,
01419   float32_t * pDst,
01420   uint32_t blockSize);
01421 
01422   /**
01423    * @brief  Initialization function for the floating-point Biquad cascade filter.
01424    * @param[in,out] *S           points to an instance of the floating-point Biquad cascade structure.
01425    * @param[in]     numStages    number of 2nd order stages in the filter.
01426    * @param[in]     *pCoeffs     points to the filter coefficients.
01427    * @param[in]     *pState      points to the state buffer.
01428    * @return        none
01429    */
01430 
01431   void arm_biquad_cascade_df1_init_f32(
01432   arm_biquad_casd_df1_inst_f32 * S,
01433   uint8_t numStages,
01434   float32_t * pCoeffs,
01435   float32_t * pState);
01436 
01437 
01438   /**
01439    * @brief Instance structure for the floating-point matrix structure.
01440    */
01441 
01442   typedef struct
01443   {
01444     uint16_t numRows;     /**< number of rows of the matrix.     */
01445     uint16_t numCols;     /**< number of columns of the matrix.  */
01446     float32_t *pData;     /**< points to the data of the matrix. */
01447   } arm_matrix_instance_f32;
01448 
01449 
01450   /**
01451    * @brief Instance structure for the floating-point matrix structure.
01452    */
01453 
01454   typedef struct
01455   {
01456     uint16_t numRows;     /**< number of rows of the matrix.     */
01457     uint16_t numCols;     /**< number of columns of the matrix.  */
01458     float64_t *pData;     /**< points to the data of the matrix. */
01459   } arm_matrix_instance_f64;
01460 
01461   /**
01462    * @brief Instance structure for the Q15 matrix structure.
01463    */
01464 
01465   typedef struct
01466   {
01467     uint16_t numRows;     /**< number of rows of the matrix.     */
01468     uint16_t numCols;     /**< number of columns of the matrix.  */
01469     q15_t *pData;         /**< points to the data of the matrix. */
01470 
01471   } arm_matrix_instance_q15;
01472 
01473   /**
01474    * @brief Instance structure for the Q31 matrix structure.
01475    */
01476 
01477   typedef struct
01478   {
01479     uint16_t numRows;     /**< number of rows of the matrix.     */
01480     uint16_t numCols;     /**< number of columns of the matrix.  */
01481     q31_t *pData;         /**< points to the data of the matrix. */
01482 
01483   } arm_matrix_instance_q31;
01484 
01485 
01486 
01487   /**
01488    * @brief Floating-point matrix addition.
01489    * @param[in]       *pSrcA points to the first input matrix structure
01490    * @param[in]       *pSrcB points to the second input matrix structure
01491    * @param[out]      *pDst points to output matrix structure
01492    * @return     The function returns either
01493    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01494    */
01495 
01496   arm_status arm_mat_add_f32(
01497   const arm_matrix_instance_f32 * pSrcA,
01498   const arm_matrix_instance_f32 * pSrcB,
01499   arm_matrix_instance_f32 * pDst);
01500 
01501   /**
01502    * @brief Q15 matrix addition.
01503    * @param[in]       *pSrcA points to the first input matrix structure
01504    * @param[in]       *pSrcB points to the second input matrix structure
01505    * @param[out]      *pDst points to output matrix structure
01506    * @return     The function returns either
01507    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01508    */
01509 
01510   arm_status arm_mat_add_q15(
01511   const arm_matrix_instance_q15 * pSrcA,
01512   const arm_matrix_instance_q15 * pSrcB,
01513   arm_matrix_instance_q15 * pDst);
01514 
01515   /**
01516    * @brief Q31 matrix addition.
01517    * @param[in]       *pSrcA points to the first input matrix structure
01518    * @param[in]       *pSrcB points to the second input matrix structure
01519    * @param[out]      *pDst points to output matrix structure
01520    * @return     The function returns either
01521    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01522    */
01523 
01524   arm_status arm_mat_add_q31(
01525   const arm_matrix_instance_q31 * pSrcA,
01526   const arm_matrix_instance_q31 * pSrcB,
01527   arm_matrix_instance_q31 * pDst);
01528 
01529   /**
01530    * @brief Floating-point, complex, matrix multiplication.
01531    * @param[in]       *pSrcA points to the first input matrix structure
01532    * @param[in]       *pSrcB points to the second input matrix structure
01533    * @param[out]      *pDst points to output matrix structure
01534    * @return     The function returns either
01535    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01536    */
01537 
01538   arm_status arm_mat_cmplx_mult_f32(
01539   const arm_matrix_instance_f32 * pSrcA,
01540   const arm_matrix_instance_f32 * pSrcB,
01541   arm_matrix_instance_f32 * pDst);
01542 
01543   /**
01544    * @brief Q15, complex,  matrix multiplication.
01545    * @param[in]       *pSrcA points to the first input matrix structure
01546    * @param[in]       *pSrcB points to the second input matrix structure
01547    * @param[out]      *pDst points to output matrix structure
01548    * @return     The function returns either
01549    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01550    */
01551 
01552   arm_status arm_mat_cmplx_mult_q15(
01553   const arm_matrix_instance_q15 * pSrcA,
01554   const arm_matrix_instance_q15 * pSrcB,
01555   arm_matrix_instance_q15 * pDst,
01556   q15_t * pScratch);
01557 
01558   /**
01559    * @brief Q31, complex, matrix multiplication.
01560    * @param[in]       *pSrcA points to the first input matrix structure
01561    * @param[in]       *pSrcB points to the second input matrix structure
01562    * @param[out]      *pDst points to output matrix structure
01563    * @return     The function returns either
01564    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01565    */
01566 
01567   arm_status arm_mat_cmplx_mult_q31(
01568   const arm_matrix_instance_q31 * pSrcA,
01569   const arm_matrix_instance_q31 * pSrcB,
01570   arm_matrix_instance_q31 * pDst);
01571 
01572 
01573   /**
01574    * @brief Floating-point matrix transpose.
01575    * @param[in]  *pSrc points to the input matrix
01576    * @param[out] *pDst points to the output matrix
01577    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
01578    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01579    */
01580 
01581   arm_status arm_mat_trans_f32(
01582   const arm_matrix_instance_f32 * pSrc,
01583   arm_matrix_instance_f32 * pDst);
01584 
01585 
01586   /**
01587    * @brief Q15 matrix transpose.
01588    * @param[in]  *pSrc points to the input matrix
01589    * @param[out] *pDst points to the output matrix
01590    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
01591    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01592    */
01593 
01594   arm_status arm_mat_trans_q15(
01595   const arm_matrix_instance_q15 * pSrc,
01596   arm_matrix_instance_q15 * pDst);
01597 
01598   /**
01599    * @brief Q31 matrix transpose.
01600    * @param[in]  *pSrc points to the input matrix
01601    * @param[out] *pDst points to the output matrix
01602    * @return    The function returns either  <code>ARM_MATH_SIZE_MISMATCH</code>
01603    * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01604    */
01605 
01606   arm_status arm_mat_trans_q31(
01607   const arm_matrix_instance_q31 * pSrc,
01608   arm_matrix_instance_q31 * pDst);
01609 
01610 
01611   /**
01612    * @brief Floating-point matrix multiplication
01613    * @param[in]       *pSrcA points to the first input matrix structure
01614    * @param[in]       *pSrcB points to the second input matrix structure
01615    * @param[out]      *pDst points to output matrix structure
01616    * @return     The function returns either
01617    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01618    */
01619 
01620   arm_status arm_mat_mult_f32(
01621   const arm_matrix_instance_f32 * pSrcA,
01622   const arm_matrix_instance_f32 * pSrcB,
01623   arm_matrix_instance_f32 * pDst);
01624 
01625   /**
01626    * @brief Q15 matrix multiplication
01627    * @param[in]       *pSrcA points to the first input matrix structure
01628    * @param[in]       *pSrcB points to the second input matrix structure
01629    * @param[out]      *pDst points to output matrix structure
01630    * @param[in]      *pState points to the array for storing intermediate results
01631    * @return     The function returns either
01632    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01633    */
01634 
01635   arm_status arm_mat_mult_q15(
01636   const arm_matrix_instance_q15 * pSrcA,
01637   const arm_matrix_instance_q15 * pSrcB,
01638   arm_matrix_instance_q15 * pDst,
01639   q15_t * pState);
01640 
01641   /**
01642    * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
01643    * @param[in]       *pSrcA  points to the first input matrix structure
01644    * @param[in]       *pSrcB  points to the second input matrix structure
01645    * @param[out]      *pDst   points to output matrix structure
01646    * @param[in]       *pState points to the array for storing intermediate results
01647    * @return     The function returns either
01648    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01649    */
01650 
01651   arm_status arm_mat_mult_fast_q15(
01652   const arm_matrix_instance_q15 * pSrcA,
01653   const arm_matrix_instance_q15 * pSrcB,
01654   arm_matrix_instance_q15 * pDst,
01655   q15_t * pState);
01656 
01657   /**
01658    * @brief Q31 matrix multiplication
01659    * @param[in]       *pSrcA points to the first input matrix structure
01660    * @param[in]       *pSrcB points to the second input matrix structure
01661    * @param[out]      *pDst points to output matrix structure
01662    * @return     The function returns either
01663    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01664    */
01665 
01666   arm_status arm_mat_mult_q31(
01667   const arm_matrix_instance_q31 * pSrcA,
01668   const arm_matrix_instance_q31 * pSrcB,
01669   arm_matrix_instance_q31 * pDst);
01670 
01671   /**
01672    * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
01673    * @param[in]       *pSrcA points to the first input matrix structure
01674    * @param[in]       *pSrcB points to the second input matrix structure
01675    * @param[out]      *pDst points to output matrix structure
01676    * @return     The function returns either
01677    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01678    */
01679 
01680   arm_status arm_mat_mult_fast_q31(
01681   const arm_matrix_instance_q31 * pSrcA,
01682   const arm_matrix_instance_q31 * pSrcB,
01683   arm_matrix_instance_q31 * pDst);
01684 
01685 
01686   /**
01687    * @brief Floating-point matrix subtraction
01688    * @param[in]       *pSrcA points to the first input matrix structure
01689    * @param[in]       *pSrcB points to the second input matrix structure
01690    * @param[out]      *pDst points to output matrix structure
01691    * @return     The function returns either
01692    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01693    */
01694 
01695   arm_status arm_mat_sub_f32(
01696   const arm_matrix_instance_f32 * pSrcA,
01697   const arm_matrix_instance_f32 * pSrcB,
01698   arm_matrix_instance_f32 * pDst);
01699 
01700   /**
01701    * @brief Q15 matrix subtraction
01702    * @param[in]       *pSrcA points to the first input matrix structure
01703    * @param[in]       *pSrcB points to the second input matrix structure
01704    * @param[out]      *pDst points to output matrix structure
01705    * @return     The function returns either
01706    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01707    */
01708 
01709   arm_status arm_mat_sub_q15(
01710   const arm_matrix_instance_q15 * pSrcA,
01711   const arm_matrix_instance_q15 * pSrcB,
01712   arm_matrix_instance_q15 * pDst);
01713 
01714   /**
01715    * @brief Q31 matrix subtraction
01716    * @param[in]       *pSrcA points to the first input matrix structure
01717    * @param[in]       *pSrcB points to the second input matrix structure
01718    * @param[out]      *pDst points to output matrix structure
01719    * @return     The function returns either
01720    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01721    */
01722 
01723   arm_status arm_mat_sub_q31(
01724   const arm_matrix_instance_q31 * pSrcA,
01725   const arm_matrix_instance_q31 * pSrcB,
01726   arm_matrix_instance_q31 * pDst);
01727 
01728   /**
01729    * @brief Floating-point matrix scaling.
01730    * @param[in]  *pSrc points to the input matrix
01731    * @param[in]  scale scale factor
01732    * @param[out] *pDst points to the output matrix
01733    * @return     The function returns either
01734    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01735    */
01736 
01737   arm_status arm_mat_scale_f32(
01738   const arm_matrix_instance_f32 * pSrc,
01739   float32_t scale,
01740   arm_matrix_instance_f32 * pDst);
01741 
01742   /**
01743    * @brief Q15 matrix scaling.
01744    * @param[in]       *pSrc points to input matrix
01745    * @param[in]       scaleFract fractional portion of the scale factor
01746    * @param[in]       shift number of bits to shift the result by
01747    * @param[out]      *pDst points to output matrix
01748    * @return     The function returns either
01749    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01750    */
01751 
01752   arm_status arm_mat_scale_q15(
01753   const arm_matrix_instance_q15 * pSrc,
01754   q15_t scaleFract,
01755   int32_t shift,
01756   arm_matrix_instance_q15 * pDst);
01757 
01758   /**
01759    * @brief Q31 matrix scaling.
01760    * @param[in]       *pSrc points to input matrix
01761    * @param[in]       scaleFract fractional portion of the scale factor
01762    * @param[in]       shift number of bits to shift the result by
01763    * @param[out]      *pDst points to output matrix structure
01764    * @return     The function returns either
01765    * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
01766    */
01767 
01768   arm_status arm_mat_scale_q31(
01769   const arm_matrix_instance_q31 * pSrc,
01770   q31_t scaleFract,
01771   int32_t shift,
01772   arm_matrix_instance_q31 * pDst);
01773 
01774 
01775   /**
01776    * @brief  Q31 matrix initialization.
01777    * @param[in,out] *S             points to an instance of the floating-point matrix structure.
01778    * @param[in]     nRows          number of rows in the matrix.
01779    * @param[in]     nColumns       number of columns in the matrix.
01780    * @param[in]     *pData         points to the matrix data array.
01781    * @return        none
01782    */
01783 
01784   void arm_mat_init_q31(
01785   arm_matrix_instance_q31 * S,
01786   uint16_t nRows,
01787   uint16_t nColumns,
01788   q31_t * pData);
01789 
01790   /**
01791    * @brief  Q15 matrix initialization.
01792    * @param[in,out] *S             points to an instance of the floating-point matrix structure.
01793    * @param[in]     nRows          number of rows in the matrix.
01794    * @param[in]     nColumns       number of columns in the matrix.
01795    * @param[in]     *pData         points to the matrix data array.
01796    * @return        none
01797    */
01798 
01799   void arm_mat_init_q15(
01800   arm_matrix_instance_q15 * S,
01801   uint16_t nRows,
01802   uint16_t nColumns,
01803   q15_t * pData);
01804 
01805   /**
01806    * @brief  Floating-point matrix initialization.
01807    * @param[in,out] *S             points to an instance of the floating-point matrix structure.
01808    * @param[in]     nRows          number of rows in the matrix.
01809    * @param[in]     nColumns       number of columns in the matrix.
01810    * @param[in]     *pData         points to the matrix data array.
01811    * @return        none
01812    */
01813 
01814   void arm_mat_init_f32(
01815   arm_matrix_instance_f32 * S,
01816   uint16_t nRows,
01817   uint16_t nColumns,
01818   float32_t * pData);
01819 
01820 
01821 
01822   /**
01823    * @brief Instance structure for the Q15 PID Control.
01824    */
01825   typedef struct
01826   {
01827     q15_t A0;    /**< The derived gain, A0 = Kp + Ki + Kd . */
01828 #ifdef ARM_MATH_CM0_FAMILY
01829     q15_t A1;
01830     q15_t A2;
01831 #else
01832     q31_t A1;           /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
01833 #endif
01834     q15_t state[3];       /**< The state array of length 3. */
01835     q15_t Kp;           /**< The proportional gain. */
01836     q15_t Ki;           /**< The integral gain. */
01837     q15_t Kd;           /**< The derivative gain. */
01838   } arm_pid_instance_q15;
01839 
01840   /**
01841    * @brief Instance structure for the Q31 PID Control.
01842    */
01843   typedef struct
01844   {
01845     q31_t A0;            /**< The derived gain, A0 = Kp + Ki + Kd . */
01846     q31_t A1;            /**< The derived gain, A1 = -Kp - 2Kd. */
01847     q31_t A2;            /**< The derived gain, A2 = Kd . */
01848     q31_t state[3];      /**< The state array of length 3. */
01849     q31_t Kp;            /**< The proportional gain. */
01850     q31_t Ki;            /**< The integral gain. */
01851     q31_t Kd;            /**< The derivative gain. */
01852 
01853   } arm_pid_instance_q31;
01854 
01855   /**
01856    * @brief Instance structure for the floating-point PID Control.
01857    */
01858   typedef struct
01859   {
01860     float32_t A0;          /**< The derived gain, A0 = Kp + Ki + Kd . */
01861     float32_t A1;          /**< The derived gain, A1 = -Kp - 2Kd. */
01862     float32_t A2;          /**< The derived gain, A2 = Kd . */
01863     float32_t state[3];    /**< The state array of length 3. */
01864     float32_t Kp;               /**< The proportional gain. */
01865     float32_t Ki;               /**< The integral gain. */
01866     float32_t Kd;               /**< The derivative gain. */
01867   } arm_pid_instance_f32;
01868 
01869 
01870 
01871   /**
01872    * @brief  Initialization function for the floating-point PID Control.
01873    * @param[in,out] *S      points to an instance of the PID structure.
01874    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
01875    * @return none.
01876    */
01877   void arm_pid_init_f32(
01878   arm_pid_instance_f32 * S,
01879   int32_t resetStateFlag);
01880 
01881   /**
01882    * @brief  Reset function for the floating-point PID Control.
01883    * @param[in,out] *S is an instance of the floating-point PID Control structure
01884    * @return none
01885    */
01886   void arm_pid_reset_f32(
01887   arm_pid_instance_f32 * S);
01888 
01889 
01890   /**
01891    * @brief  Initialization function for the Q31 PID Control.
01892    * @param[in,out] *S points to an instance of the Q15 PID structure.
01893    * @param[in]     resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
01894    * @return none.
01895    */
01896   void arm_pid_init_q31(
01897   arm_pid_instance_q31 * S,
01898   int32_t resetStateFlag);
01899 
01900 
01901   /**
01902    * @brief  Reset function for the Q31 PID Control.
01903    * @param[in,out] *S points to an instance of the Q31 PID Control structure
01904    * @return none
01905    */
01906 
01907   void arm_pid_reset_q31(
01908   arm_pid_instance_q31 * S);
01909 
01910   /**
01911    * @brief  Initialization function for the Q15 PID Control.
01912    * @param[in,out] *S points to an instance of the Q15 PID structure.
01913    * @param[in] resetStateFlag  flag to reset the state. 0 = no change in state 1 = reset the state.
01914    * @return none.
01915    */
01916   void arm_pid_init_q15(
01917   arm_pid_instance_q15 * S,
01918   int32_t resetStateFlag);
01919 
01920   /**
01921    * @brief  Reset function for the Q15 PID Control.
01922    * @param[in,out] *S points to an instance of the q15 PID Control structure
01923    * @return none
01924    */
01925   void arm_pid_reset_q15(
01926   arm_pid_instance_q15 * S);
01927 
01928 
01929   /**
01930    * @brief Instance structure for the floating-point Linear Interpolate function.
01931    */
01932   typedef struct
01933   {
01934     uint32_t nValues;           /**< nValues */
01935     float32_t x1;               /**< x1 */
01936     float32_t xSpacing;         /**< xSpacing */
01937     float32_t *pYData;          /**< pointer to the table of Y values */
01938   } arm_linear_interp_instance_f32;
01939 
01940   /**
01941    * @brief Instance structure for the floating-point bilinear interpolation function.
01942    */
01943 
01944   typedef struct
01945   {
01946     uint16_t numRows;   /**< number of rows in the data table. */
01947     uint16_t numCols;   /**< number of columns in the data table. */
01948     float32_t *pData;   /**< points to the data table. */
01949   } arm_bilinear_interp_instance_f32;
01950 
01951    /**
01952    * @brief Instance structure for the Q31 bilinear interpolation function.
01953    */
01954 
01955   typedef struct
01956   {
01957     uint16_t numRows;   /**< number of rows in the data table. */
01958     uint16_t numCols;   /**< number of columns in the data table. */
01959     q31_t *pData;       /**< points to the data table. */
01960   } arm_bilinear_interp_instance_q31;
01961 
01962    /**
01963    * @brief Instance structure for the Q15 bilinear interpolation function.
01964    */
01965 
01966   typedef struct
01967   {
01968     uint16_t numRows;   /**< number of rows in the data table. */
01969     uint16_t numCols;   /**< number of columns in the data table. */
01970     q15_t *pData;       /**< points to the data table. */
01971   } arm_bilinear_interp_instance_q15;
01972 
01973    /**
01974    * @brief Instance structure for the Q15 bilinear interpolation function.
01975    */
01976 
01977   typedef struct
01978   {
01979     uint16_t numRows;   /**< number of rows in the data table. */
01980     uint16_t numCols;   /**< number of columns in the data table. */
01981     q7_t *pData;                /**< points to the data table. */
01982   } arm_bilinear_interp_instance_q7;
01983 
01984 
01985   /**
01986    * @brief Q7 vector multiplication.
01987    * @param[in]       *pSrcA points to the first input vector
01988    * @param[in]       *pSrcB points to the second input vector
01989    * @param[out]      *pDst  points to the output vector
01990    * @param[in]       blockSize number of samples in each vector
01991    * @return none.
01992    */
01993 
01994   void arm_mult_q7(
01995   q7_t * pSrcA,
01996   q7_t * pSrcB,
01997   q7_t * pDst,
01998   uint32_t blockSize);
01999 
02000   /**
02001    * @brief Q15 vector multiplication.
02002    * @param[in]       *pSrcA points to the first input vector
02003    * @param[in]       *pSrcB points to the second input vector
02004    * @param[out]      *pDst  points to the output vector
02005    * @param[in]       blockSize number of samples in each vector
02006    * @return none.
02007    */
02008 
02009   void arm_mult_q15(
02010   q15_t * pSrcA,
02011   q15_t * pSrcB,
02012   q15_t * pDst,
02013   uint32_t blockSize);
02014 
02015   /**
02016    * @brief Q31 vector multiplication.
02017    * @param[in]       *pSrcA points to the first input vector
02018    * @param[in]       *pSrcB points to the second input vector
02019    * @param[out]      *pDst points to the output vector
02020    * @param[in]       blockSize number of samples in each vector
02021    * @return none.
02022    */
02023 
02024   void arm_mult_q31(
02025   q31_t * pSrcA,
02026   q31_t * pSrcB,
02027   q31_t * pDst,
02028   uint32_t blockSize);
02029 
02030   /**
02031    * @brief Floating-point vector multiplication.
02032    * @param[in]       *pSrcA points to the first input vector
02033    * @param[in]       *pSrcB points to the second input vector
02034    * @param[out]      *pDst points to the output vector
02035    * @param[in]       blockSize number of samples in each vector
02036    * @return none.
02037    */
02038 
02039   void arm_mult_f32(
02040   float32_t * pSrcA,
02041   float32_t * pSrcB,
02042   float32_t * pDst,
02043   uint32_t blockSize);
02044 
02045 
02046 
02047 
02048 
02049 
02050   /**
02051    * @brief Instance structure for the Q15 CFFT/CIFFT function.
02052    */
02053 
02054   typedef struct
02055   {
02056     uint16_t fftLen;                 /**< length of the FFT. */
02057     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02058     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02059     q15_t *pTwiddle;                     /**< points to the Sin twiddle factor table. */
02060     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02061     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02062     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02063   } arm_cfft_radix2_instance_q15;
02064 
02065 /* Deprecated */
02066   arm_status arm_cfft_radix2_init_q15(
02067   arm_cfft_radix2_instance_q15 * S,
02068   uint16_t fftLen,
02069   uint8_t ifftFlag,
02070   uint8_t bitReverseFlag);
02071 
02072 /* Deprecated */
02073   void arm_cfft_radix2_q15(
02074   const arm_cfft_radix2_instance_q15 * S,
02075   q15_t * pSrc);
02076 
02077 
02078 
02079   /**
02080    * @brief Instance structure for the Q15 CFFT/CIFFT function.
02081    */
02082 
02083   typedef struct
02084   {
02085     uint16_t fftLen;                 /**< length of the FFT. */
02086     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02087     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02088     q15_t *pTwiddle;                 /**< points to the twiddle factor table. */
02089     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02090     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02091     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02092   } arm_cfft_radix4_instance_q15;
02093 
02094 /* Deprecated */
02095   arm_status arm_cfft_radix4_init_q15(
02096   arm_cfft_radix4_instance_q15 * S,
02097   uint16_t fftLen,
02098   uint8_t ifftFlag,
02099   uint8_t bitReverseFlag);
02100 
02101 /* Deprecated */
02102   void arm_cfft_radix4_q15(
02103   const arm_cfft_radix4_instance_q15 * S,
02104   q15_t * pSrc);
02105 
02106   /**
02107    * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
02108    */
02109 
02110   typedef struct
02111   {
02112     uint16_t fftLen;                 /**< length of the FFT. */
02113     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02114     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02115     q31_t *pTwiddle;                     /**< points to the Twiddle factor table. */
02116     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02117     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02118     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02119   } arm_cfft_radix2_instance_q31;
02120 
02121 /* Deprecated */
02122   arm_status arm_cfft_radix2_init_q31(
02123   arm_cfft_radix2_instance_q31 * S,
02124   uint16_t fftLen,
02125   uint8_t ifftFlag,
02126   uint8_t bitReverseFlag);
02127 
02128 /* Deprecated */
02129   void arm_cfft_radix2_q31(
02130   const arm_cfft_radix2_instance_q31 * S,
02131   q31_t * pSrc);
02132 
02133   /**
02134    * @brief Instance structure for the Q31 CFFT/CIFFT function.
02135    */
02136 
02137   typedef struct
02138   {
02139     uint16_t fftLen;                 /**< length of the FFT. */
02140     uint8_t ifftFlag;                /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02141     uint8_t bitReverseFlag;          /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02142     q31_t *pTwiddle;                 /**< points to the twiddle factor table. */
02143     uint16_t *pBitRevTable;          /**< points to the bit reversal table. */
02144     uint16_t twidCoefModifier;       /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02145     uint16_t bitRevFactor;           /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02146   } arm_cfft_radix4_instance_q31;
02147 
02148 /* Deprecated */
02149   void arm_cfft_radix4_q31(
02150   const arm_cfft_radix4_instance_q31 * S,
02151   q31_t * pSrc);
02152 
02153 /* Deprecated */
02154   arm_status arm_cfft_radix4_init_q31(
02155   arm_cfft_radix4_instance_q31 * S,
02156   uint16_t fftLen,
02157   uint8_t ifftFlag,
02158   uint8_t bitReverseFlag);
02159 
02160   /**
02161    * @brief Instance structure for the floating-point CFFT/CIFFT function.
02162    */
02163 
02164   typedef struct
02165   {
02166     uint16_t fftLen;                   /**< length of the FFT. */
02167     uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02168     uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02169     float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
02170     uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
02171     uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02172     uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02173     float32_t onebyfftLen;                 /**< value of 1/fftLen. */
02174   } arm_cfft_radix2_instance_f32;
02175 
02176 /* Deprecated */
02177   arm_status arm_cfft_radix2_init_f32(
02178   arm_cfft_radix2_instance_f32 * S,
02179   uint16_t fftLen,
02180   uint8_t ifftFlag,
02181   uint8_t bitReverseFlag);
02182 
02183 /* Deprecated */
02184   void arm_cfft_radix2_f32(
02185   const arm_cfft_radix2_instance_f32 * S,
02186   float32_t * pSrc);
02187 
02188   /**
02189    * @brief Instance structure for the floating-point CFFT/CIFFT function.
02190    */
02191 
02192   typedef struct
02193   {
02194     uint16_t fftLen;                   /**< length of the FFT. */
02195     uint8_t ifftFlag;                  /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
02196     uint8_t bitReverseFlag;            /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
02197     float32_t *pTwiddle;               /**< points to the Twiddle factor table. */
02198     uint16_t *pBitRevTable;            /**< points to the bit reversal table. */
02199     uint16_t twidCoefModifier;         /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02200     uint16_t bitRevFactor;             /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
02201     float32_t onebyfftLen;                 /**< value of 1/fftLen. */
02202   } arm_cfft_radix4_instance_f32;
02203 
02204 /* Deprecated */
02205   arm_status arm_cfft_radix4_init_f32(
02206   arm_cfft_radix4_instance_f32 * S,
02207   uint16_t fftLen,
02208   uint8_t ifftFlag,
02209   uint8_t bitReverseFlag);
02210 
02211 /* Deprecated */
02212   void arm_cfft_radix4_f32(
02213   const arm_cfft_radix4_instance_f32 * S,
02214   float32_t * pSrc);
02215 
02216   /**
02217    * @brief Instance structure for the fixed-point CFFT/CIFFT function.
02218    */
02219 
02220   typedef struct
02221   {
02222     uint16_t fftLen;                   /**< length of the FFT. */
02223     const q15_t *pTwiddle;             /**< points to the Twiddle factor table. */
02224     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
02225     uint16_t bitRevLength;             /**< bit reversal table length. */
02226   } arm_cfft_instance_q15;
02227 
02228 void arm_cfft_q15( 
02229     const arm_cfft_instance_q15 * S, 
02230     q15_t * p1,
02231     uint8_t ifftFlag,
02232     uint8_t bitReverseFlag);  
02233 
02234   /**
02235    * @brief Instance structure for the fixed-point CFFT/CIFFT function.
02236    */
02237 
02238   typedef struct
02239   {
02240     uint16_t fftLen;                   /**< length of the FFT. */
02241     const q31_t *pTwiddle;             /**< points to the Twiddle factor table. */
02242     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
02243     uint16_t bitRevLength;             /**< bit reversal table length. */
02244   } arm_cfft_instance_q31;
02245 
02246 void arm_cfft_q31( 
02247     const arm_cfft_instance_q31 * S, 
02248     q31_t * p1,
02249     uint8_t ifftFlag,
02250     uint8_t bitReverseFlag);  
02251   
02252   /**
02253    * @brief Instance structure for the floating-point CFFT/CIFFT function.
02254    */
02255 
02256   typedef struct
02257   {
02258     uint16_t fftLen;                   /**< length of the FFT. */
02259     const float32_t *pTwiddle;         /**< points to the Twiddle factor table. */
02260     const uint16_t *pBitRevTable;      /**< points to the bit reversal table. */
02261     uint16_t bitRevLength;             /**< bit reversal table length. */
02262   } arm_cfft_instance_f32;
02263 
02264   void arm_cfft_f32(
02265   const arm_cfft_instance_f32 * S,
02266   float32_t * p1,
02267   uint8_t ifftFlag,
02268   uint8_t bitReverseFlag);
02269 
02270   /**
02271    * @brief Instance structure for the Q15 RFFT/RIFFT function.
02272    */
02273 
02274   typedef struct
02275   {
02276     uint32_t fftLenReal;                      /**< length of the real FFT. */
02277     uint8_t ifftFlagR;                        /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
02278     uint8_t bitReverseFlagR;                  /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
02279     uint32_t twidCoefRModifier;               /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02280     q15_t *pTwiddleAReal;                     /**< points to the real twiddle factor table. */
02281     q15_t *pTwiddleBReal;                     /**< points to the imag twiddle factor table. */
02282     const arm_cfft_instance_q15 *pCfft;       /**< points to the complex FFT instance. */
02283   } arm_rfft_instance_q15;
02284 
02285   arm_status arm_rfft_init_q15(
02286   arm_rfft_instance_q15 * S,
02287   uint32_t fftLenReal,
02288   uint32_t ifftFlagR,
02289   uint32_t bitReverseFlag);
02290 
02291   void arm_rfft_q15(
02292   const arm_rfft_instance_q15 * S,
02293   q15_t * pSrc,
02294   q15_t * pDst);
02295 
02296   /**
02297    * @brief Instance structure for the Q31 RFFT/RIFFT function.
02298    */
02299 
02300   typedef struct
02301   {
02302     uint32_t fftLenReal;                        /**< length of the real FFT. */
02303     uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
02304     uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
02305     uint32_t twidCoefRModifier;                 /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02306     q31_t *pTwiddleAReal;                       /**< points to the real twiddle factor table. */
02307     q31_t *pTwiddleBReal;                       /**< points to the imag twiddle factor table. */
02308     const arm_cfft_instance_q31 *pCfft;         /**< points to the complex FFT instance. */
02309   } arm_rfft_instance_q31;
02310 
02311   arm_status arm_rfft_init_q31(
02312   arm_rfft_instance_q31 * S,
02313   uint32_t fftLenReal,
02314   uint32_t ifftFlagR,
02315   uint32_t bitReverseFlag);
02316 
02317   void arm_rfft_q31(
02318   const arm_rfft_instance_q31 * S,
02319   q31_t * pSrc,
02320   q31_t * pDst);
02321 
02322   /**
02323    * @brief Instance structure for the floating-point RFFT/RIFFT function.
02324    */
02325 
02326   typedef struct
02327   {
02328     uint32_t fftLenReal;                        /**< length of the real FFT. */
02329     uint16_t fftLenBy2;                         /**< length of the complex FFT. */
02330     uint8_t ifftFlagR;                          /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
02331     uint8_t bitReverseFlagR;                    /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
02332     uint32_t twidCoefRModifier;                     /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
02333     float32_t *pTwiddleAReal;                   /**< points to the real twiddle factor table. */
02334     float32_t *pTwiddleBReal;                   /**< points to the imag twiddle factor table. */
02335     arm_cfft_radix4_instance_f32 *pCfft;        /**< points to the complex FFT instance. */
02336   } arm_rfft_instance_f32;
02337 
02338   arm_status arm_rfft_init_f32(
02339   arm_rfft_instance_f32 * S,
02340   arm_cfft_radix4_instance_f32 * S_CFFT,
02341   uint32_t fftLenReal,
02342   uint32_t ifftFlagR,
02343   uint32_t bitReverseFlag);
02344 
02345   void arm_rfft_f32(
02346   const arm_rfft_instance_f32 * S,
02347   float32_t * pSrc,
02348   float32_t * pDst);
02349 
02350   /**
02351    * @brief Instance structure for the floating-point RFFT/RIFFT function.
02352    */
02353 
02354 typedef struct
02355   {
02356     arm_cfft_instance_f32 Sint;      /**< Internal CFFT structure. */
02357     uint16_t fftLenRFFT;                        /**< length of the real sequence */
02358     float32_t * pTwiddleRFFT;                   /**< Twiddle factors real stage  */
02359   } arm_rfft_fast_instance_f32 ;
02360 
02361 arm_status arm_rfft_fast_init_f32 (
02362     arm_rfft_fast_instance_f32 * S,
02363     uint16_t fftLen);
02364 
02365 void arm_rfft_fast_f32(
02366   arm_rfft_fast_instance_f32 * S,
02367   float32_t * p, float32_t * pOut,
02368   uint8_t ifftFlag);
02369 
02370   /**
02371    * @brief Instance structure for the floating-point DCT4/IDCT4 function.
02372    */
02373 
02374   typedef struct
02375   {
02376     uint16_t N;                         /**< length of the DCT4. */
02377     uint16_t Nby2;                      /**< half of the length of the DCT4. */
02378     float32_t normalize;                /**< normalizing factor. */
02379     float32_t *pTwiddle;                /**< points to the twiddle factor table. */
02380     float32_t *pCosFactor;              /**< points to the cosFactor table. */
02381     arm_rfft_instance_f32 *pRfft;        /**< points to the real FFT instance. */
02382     arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
02383   } arm_dct4_instance_f32;
02384 
02385   /**
02386    * @brief  Initialization function for the floating-point DCT4/IDCT4.
02387    * @param[in,out] *S         points to an instance of floating-point DCT4/IDCT4 structure.
02388    * @param[in]     *S_RFFT    points to an instance of floating-point RFFT/RIFFT structure.
02389    * @param[in]     *S_CFFT    points to an instance of floating-point CFFT/CIFFT structure.
02390    * @param[in]     N          length of the DCT4.
02391    * @param[in]     Nby2       half of the length of the DCT4.
02392    * @param[in]     normalize  normalizing factor.
02393    * @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.
02394    */
02395 
02396   arm_status arm_dct4_init_f32(
02397   arm_dct4_instance_f32 * S,
02398   arm_rfft_instance_f32 * S_RFFT,
02399   arm_cfft_radix4_instance_f32 * S_CFFT,
02400   uint16_t N,
02401   uint16_t Nby2,
02402   float32_t normalize);
02403 
02404   /**
02405    * @brief Processing function for the floating-point DCT4/IDCT4.
02406    * @param[in]       *S             points to an instance of the floating-point DCT4/IDCT4 structure.
02407    * @param[in]       *pState        points to state buffer.
02408    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
02409    * @return none.
02410    */
02411 
02412   void arm_dct4_f32(
02413   const arm_dct4_instance_f32 * S,
02414   float32_t * pState,
02415   float32_t * pInlineBuffer);
02416 
02417   /**
02418    * @brief Instance structure for the Q31 DCT4/IDCT4 function.
02419    */
02420 
02421   typedef struct
02422   {
02423     uint16_t N;                         /**< length of the DCT4. */
02424     uint16_t Nby2;                      /**< half of the length of the DCT4. */
02425     q31_t normalize;                    /**< normalizing factor. */
02426     q31_t *pTwiddle;                    /**< points to the twiddle factor table. */
02427     q31_t *pCosFactor;                  /**< points to the cosFactor table. */
02428     arm_rfft_instance_q31 *pRfft;        /**< points to the real FFT instance. */
02429     arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
02430   } arm_dct4_instance_q31;
02431 
02432   /**
02433    * @brief  Initialization function for the Q31 DCT4/IDCT4.
02434    * @param[in,out] *S         points to an instance of Q31 DCT4/IDCT4 structure.
02435    * @param[in]     *S_RFFT    points to an instance of Q31 RFFT/RIFFT structure
02436    * @param[in]     *S_CFFT    points to an instance of Q31 CFFT/CIFFT structure
02437    * @param[in]     N          length of the DCT4.
02438    * @param[in]     Nby2       half of the length of the DCT4.
02439    * @param[in]     normalize  normalizing factor.
02440    * @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.
02441    */
02442 
02443   arm_status arm_dct4_init_q31(
02444   arm_dct4_instance_q31 * S,
02445   arm_rfft_instance_q31 * S_RFFT,
02446   arm_cfft_radix4_instance_q31 * S_CFFT,
02447   uint16_t N,
02448   uint16_t Nby2,
02449   q31_t normalize);
02450 
02451   /**
02452    * @brief Processing function for the Q31 DCT4/IDCT4.
02453    * @param[in]       *S             points to an instance of the Q31 DCT4 structure.
02454    * @param[in]       *pState        points to state buffer.
02455    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
02456    * @return none.
02457    */
02458 
02459   void arm_dct4_q31(
02460   const arm_dct4_instance_q31 * S,
02461   q31_t * pState,
02462   q31_t * pInlineBuffer);
02463 
02464   /**
02465    * @brief Instance structure for the Q15 DCT4/IDCT4 function.
02466    */
02467 
02468   typedef struct
02469   {
02470     uint16_t N;                         /**< length of the DCT4. */
02471     uint16_t Nby2;                      /**< half of the length of the DCT4. */
02472     q15_t normalize;                    /**< normalizing factor. */
02473     q15_t *pTwiddle;                    /**< points to the twiddle factor table. */
02474     q15_t *pCosFactor;                  /**< points to the cosFactor table. */
02475     arm_rfft_instance_q15 *pRfft;        /**< points to the real FFT instance. */
02476     arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
02477   } arm_dct4_instance_q15;
02478 
02479   /**
02480    * @brief  Initialization function for the Q15 DCT4/IDCT4.
02481    * @param[in,out] *S         points to an instance of Q15 DCT4/IDCT4 structure.
02482    * @param[in]     *S_RFFT    points to an instance of Q15 RFFT/RIFFT structure.
02483    * @param[in]     *S_CFFT    points to an instance of Q15 CFFT/CIFFT structure.
02484    * @param[in]     N          length of the DCT4.
02485    * @param[in]     Nby2       half of the length of the DCT4.
02486    * @param[in]     normalize  normalizing factor.
02487    * @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.
02488    */
02489 
02490   arm_status arm_dct4_init_q15(
02491   arm_dct4_instance_q15 * S,
02492   arm_rfft_instance_q15 * S_RFFT,
02493   arm_cfft_radix4_instance_q15 * S_CFFT,
02494   uint16_t N,
02495   uint16_t Nby2,
02496   q15_t normalize);
02497 
02498   /**
02499    * @brief Processing function for the Q15 DCT4/IDCT4.
02500    * @param[in]       *S             points to an instance of the Q15 DCT4 structure.
02501    * @param[in]       *pState        points to state buffer.
02502    * @param[in,out]   *pInlineBuffer points to the in-place input and output buffer.
02503    * @return none.
02504    */
02505 
02506   void arm_dct4_q15(
02507   const arm_dct4_instance_q15 * S,
02508   q15_t * pState,
02509   q15_t * pInlineBuffer);
02510 
02511   /**
02512    * @brief Floating-point vector addition.
02513    * @param[in]       *pSrcA points to the first input vector
02514    * @param[in]       *pSrcB points to the second input vector
02515    * @param[out]      *pDst points to the output vector
02516    * @param[in]       blockSize number of samples in each vector
02517    * @return none.
02518    */
02519 
02520   void arm_add_f32(
02521   float32_t * pSrcA,
02522   float32_t * pSrcB,
02523   float32_t * pDst,
02524   uint32_t blockSize);
02525 
02526   /**
02527    * @brief Q7 vector addition.
02528    * @param[in]       *pSrcA points to the first input vector
02529    * @param[in]       *pSrcB points to the second input vector
02530    * @param[out]      *pDst points to the output vector
02531    * @param[in]       blockSize number of samples in each vector
02532    * @return none.
02533    */
02534 
02535   void arm_add_q7(
02536   q7_t * pSrcA,
02537   q7_t * pSrcB,
02538   q7_t * pDst,
02539   uint32_t blockSize);
02540 
02541   /**
02542    * @brief Q15 vector addition.
02543    * @param[in]       *pSrcA points to the first input vector
02544    * @param[in]       *pSrcB points to the second input vector
02545    * @param[out]      *pDst points to the output vector
02546    * @param[in]       blockSize number of samples in each vector
02547    * @return none.
02548    */
02549 
02550   void arm_add_q15(
02551   q15_t * pSrcA,
02552   q15_t * pSrcB,
02553   q15_t * pDst,
02554   uint32_t blockSize);
02555 
02556   /**
02557    * @brief Q31 vector addition.
02558    * @param[in]       *pSrcA points to the first input vector
02559    * @param[in]       *pSrcB points to the second input vector
02560    * @param[out]      *pDst points to the output vector
02561    * @param[in]       blockSize number of samples in each vector
02562    * @return none.
02563    */
02564 
02565   void arm_add_q31(
02566   q31_t * pSrcA,
02567   q31_t * pSrcB,
02568   q31_t * pDst,
02569   uint32_t blockSize);
02570 
02571   /**
02572    * @brief Floating-point vector subtraction.
02573    * @param[in]       *pSrcA points to the first input vector
02574    * @param[in]       *pSrcB points to the second input vector
02575    * @param[out]      *pDst points to the output vector
02576    * @param[in]       blockSize number of samples in each vector
02577    * @return none.
02578    */
02579 
02580   void arm_sub_f32(
02581   float32_t * pSrcA,
02582   float32_t * pSrcB,
02583   float32_t * pDst,
02584   uint32_t blockSize);
02585 
02586   /**
02587    * @brief Q7 vector subtraction.
02588    * @param[in]       *pSrcA points to the first input vector
02589    * @param[in]       *pSrcB points to the second input vector
02590    * @param[out]      *pDst points to the output vector
02591    * @param[in]       blockSize number of samples in each vector
02592    * @return none.
02593    */
02594 
02595   void arm_sub_q7(
02596   q7_t * pSrcA,
02597   q7_t * pSrcB,
02598   q7_t * pDst,
02599   uint32_t blockSize);
02600 
02601   /**
02602    * @brief Q15 vector subtraction.
02603    * @param[in]       *pSrcA points to the first input vector
02604    * @param[in]       *pSrcB points to the second input vector
02605    * @param[out]      *pDst points to the output vector
02606    * @param[in]       blockSize number of samples in each vector
02607    * @return none.
02608    */
02609 
02610   void arm_sub_q15(
02611   q15_t * pSrcA,
02612   q15_t * pSrcB,
02613   q15_t * pDst,
02614   uint32_t blockSize);
02615 
02616   /**
02617    * @brief Q31 vector subtraction.
02618    * @param[in]       *pSrcA points to the first input vector
02619    * @param[in]       *pSrcB points to the second input vector
02620    * @param[out]      *pDst points to the output vector
02621    * @param[in]       blockSize number of samples in each vector
02622    * @return none.
02623    */
02624 
02625   void arm_sub_q31(
02626   q31_t * pSrcA,
02627   q31_t * pSrcB,
02628   q31_t * pDst,
02629   uint32_t blockSize);
02630 
02631   /**
02632    * @brief Multiplies a floating-point vector by a scalar.
02633    * @param[in]       *pSrc points to the input vector
02634    * @param[in]       scale scale factor to be applied
02635    * @param[out]      *pDst points to the output vector
02636    * @param[in]       blockSize number of samples in the vector
02637    * @return none.
02638    */
02639 
02640   void arm_scale_f32(
02641   float32_t * pSrc,
02642   float32_t scale,
02643   float32_t * pDst,
02644   uint32_t blockSize);
02645 
02646   /**
02647    * @brief Multiplies a Q7 vector by a scalar.
02648    * @param[in]       *pSrc points to the input vector
02649    * @param[in]       scaleFract fractional portion of the scale value
02650    * @param[in]       shift number of bits to shift the result by
02651    * @param[out]      *pDst points to the output vector
02652    * @param[in]       blockSize number of samples in the vector
02653    * @return none.
02654    */
02655 
02656   void arm_scale_q7(
02657   q7_t * pSrc,
02658   q7_t scaleFract,
02659   int8_t shift,
02660   q7_t * pDst,
02661   uint32_t blockSize);
02662 
02663   /**
02664    * @brief Multiplies a Q15 vector by a scalar.
02665    * @param[in]       *pSrc points to the input vector
02666    * @param[in]       scaleFract fractional portion of the scale value
02667    * @param[in]       shift number of bits to shift the result by
02668    * @param[out]      *pDst points to the output vector
02669    * @param[in]       blockSize number of samples in the vector
02670    * @return none.
02671    */
02672 
02673   void arm_scale_q15(
02674   q15_t * pSrc,
02675   q15_t scaleFract,
02676   int8_t shift,
02677   q15_t * pDst,
02678   uint32_t blockSize);
02679 
02680   /**
02681    * @brief Multiplies a Q31 vector by a scalar.
02682    * @param[in]       *pSrc points to the input vector
02683    * @param[in]       scaleFract fractional portion of the scale value
02684    * @param[in]       shift number of bits to shift the result by
02685    * @param[out]      *pDst points to the output vector
02686    * @param[in]       blockSize number of samples in the vector
02687    * @return none.
02688    */
02689 
02690   void arm_scale_q31(
02691   q31_t * pSrc,
02692   q31_t scaleFract,
02693   int8_t shift,
02694   q31_t * pDst,
02695   uint32_t blockSize);
02696 
02697   /**
02698    * @brief Q7 vector absolute value.
02699    * @param[in]       *pSrc points to the input buffer
02700    * @param[out]      *pDst points to the output buffer
02701    * @param[in]       blockSize number of samples in each vector
02702    * @return none.
02703    */
02704 
02705   void arm_abs_q7(
02706   q7_t * pSrc,
02707   q7_t * pDst,
02708   uint32_t blockSize);
02709 
02710   /**
02711    * @brief Floating-point vector absolute value.
02712    * @param[in]       *pSrc points to the input buffer
02713    * @param[out]      *pDst points to the output buffer
02714    * @param[in]       blockSize number of samples in each vector
02715    * @return none.
02716    */
02717 
02718   void arm_abs_f32(
02719   float32_t * pSrc,
02720   float32_t * pDst,
02721   uint32_t blockSize);
02722 
02723   /**
02724    * @brief Q15 vector absolute value.
02725    * @param[in]       *pSrc points to the input buffer
02726    * @param[out]      *pDst points to the output buffer
02727    * @param[in]       blockSize number of samples in each vector
02728    * @return none.
02729    */
02730 
02731   void arm_abs_q15(
02732   q15_t * pSrc,
02733   q15_t * pDst,
02734   uint32_t blockSize);
02735 
02736   /**
02737    * @brief Q31 vector absolute value.
02738    * @param[in]       *pSrc points to the input buffer
02739    * @param[out]      *pDst points to the output buffer
02740    * @param[in]       blockSize number of samples in each vector
02741    * @return none.
02742    */
02743 
02744   void arm_abs_q31(
02745   q31_t * pSrc,
02746   q31_t * pDst,
02747   uint32_t blockSize);
02748 
02749   /**
02750    * @brief Dot product of floating-point vectors.
02751    * @param[in]       *pSrcA points to the first input vector
02752    * @param[in]       *pSrcB points to the second input vector
02753    * @param[in]       blockSize number of samples in each vector
02754    * @param[out]      *result output result returned here
02755    * @return none.
02756    */
02757 
02758   void arm_dot_prod_f32(
02759   float32_t * pSrcA,
02760   float32_t * pSrcB,
02761   uint32_t blockSize,
02762   float32_t * result);
02763 
02764   /**
02765    * @brief Dot product of Q7 vectors.
02766    * @param[in]       *pSrcA points to the first input vector
02767    * @param[in]       *pSrcB points to the second input vector
02768    * @param[in]       blockSize number of samples in each vector
02769    * @param[out]      *result output result returned here
02770    * @return none.
02771    */
02772 
02773   void arm_dot_prod_q7(
02774   q7_t * pSrcA,
02775   q7_t * pSrcB,
02776   uint32_t blockSize,
02777   q31_t * result);
02778 
02779   /**
02780    * @brief Dot product of Q15 vectors.
02781    * @param[in]       *pSrcA points to the first input vector
02782    * @param[in]       *pSrcB points to the second input vector
02783    * @param[in]       blockSize number of samples in each vector
02784    * @param[out]      *result output result returned here
02785    * @return none.
02786    */
02787 
02788   void arm_dot_prod_q15(
02789   q15_t * pSrcA,
02790   q15_t * pSrcB,
02791   uint32_t blockSize,
02792   q63_t * result);
02793 
02794   /**
02795    * @brief Dot product of Q31 vectors.
02796    * @param[in]       *pSrcA points to the first input vector
02797    * @param[in]       *pSrcB points to the second input vector
02798    * @param[in]       blockSize number of samples in each vector
02799    * @param[out]      *result output result returned here
02800    * @return none.
02801    */
02802 
02803   void arm_dot_prod_q31(
02804   q31_t * pSrcA,
02805   q31_t * pSrcB,
02806   uint32_t blockSize,
02807   q63_t * result);
02808 
02809   /**
02810    * @brief  Shifts the elements of a Q7 vector a specified number of bits.
02811    * @param[in]  *pSrc points to the input vector
02812    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
02813    * @param[out]  *pDst points to the output vector
02814    * @param[in]  blockSize number of samples in the vector
02815    * @return none.
02816    */
02817 
02818   void arm_shift_q7(
02819   q7_t * pSrc,
02820   int8_t shiftBits,
02821   q7_t * pDst,
02822   uint32_t blockSize);
02823 
02824   /**
02825    * @brief  Shifts the elements of a Q15 vector a specified number of bits.
02826    * @param[in]  *pSrc points to the input vector
02827    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
02828    * @param[out]  *pDst points to the output vector
02829    * @param[in]  blockSize number of samples in the vector
02830    * @return none.
02831    */
02832 
02833   void arm_shift_q15(
02834   q15_t * pSrc,
02835   int8_t shiftBits,
02836   q15_t * pDst,
02837   uint32_t blockSize);
02838 
02839   /**
02840    * @brief  Shifts the elements of a Q31 vector a specified number of bits.
02841    * @param[in]  *pSrc points to the input vector
02842    * @param[in]  shiftBits number of bits to shift.  A positive value shifts left; a negative value shifts right.
02843    * @param[out]  *pDst points to the output vector
02844    * @param[in]  blockSize number of samples in the vector
02845    * @return none.
02846    */
02847 
02848   void arm_shift_q31(
02849   q31_t * pSrc,
02850   int8_t shiftBits,
02851   q31_t * pDst,
02852   uint32_t blockSize);
02853 
02854   /**
02855    * @brief  Adds a constant offset to a floating-point vector.
02856    * @param[in]  *pSrc points to the input vector
02857    * @param[in]  offset is the offset to be added
02858    * @param[out]  *pDst points to the output vector
02859    * @param[in]  blockSize number of samples in the vector
02860    * @return none.
02861    */
02862 
02863   void arm_offset_f32(
02864   float32_t * pSrc,
02865   float32_t offset,
02866   float32_t * pDst,
02867   uint32_t blockSize);
02868 
02869   /**
02870    * @brief  Adds a constant offset to a Q7 vector.
02871    * @param[in]  *pSrc points to the input vector
02872    * @param[in]  offset is the offset to be added
02873    * @param[out]  *pDst points to the output vector
02874    * @param[in]  blockSize number of samples in the vector
02875    * @return none.
02876    */
02877 
02878   void arm_offset_q7(
02879   q7_t * pSrc,
02880   q7_t offset,
02881   q7_t * pDst,
02882   uint32_t blockSize);
02883 
02884   /**
02885    * @brief  Adds a constant offset to a Q15 vector.
02886    * @param[in]  *pSrc points to the input vector
02887    * @param[in]  offset is the offset to be added
02888    * @param[out]  *pDst points to the output vector
02889    * @param[in]  blockSize number of samples in the vector
02890    * @return none.
02891    */
02892 
02893   void arm_offset_q15(
02894   q15_t * pSrc,
02895   q15_t offset,
02896   q15_t * pDst,
02897   uint32_t blockSize);
02898 
02899   /**
02900    * @brief  Adds a constant offset to a Q31 vector.
02901    * @param[in]  *pSrc points to the input vector
02902    * @param[in]  offset is the offset to be added
02903    * @param[out]  *pDst points to the output vector
02904    * @param[in]  blockSize number of samples in the vector
02905    * @return none.
02906    */
02907 
02908   void arm_offset_q31(
02909   q31_t * pSrc,
02910   q31_t offset,
02911   q31_t * pDst,
02912   uint32_t blockSize);
02913 
02914   /**
02915    * @brief  Negates the elements of a floating-point vector.
02916    * @param[in]  *pSrc points to the input vector
02917    * @param[out]  *pDst points to the output vector
02918    * @param[in]  blockSize number of samples in the vector
02919    * @return none.
02920    */
02921 
02922   void arm_negate_f32(
02923   float32_t * pSrc,
02924   float32_t * pDst,
02925   uint32_t blockSize);
02926 
02927   /**
02928    * @brief  Negates the elements of a Q7 vector.
02929    * @param[in]  *pSrc points to the input vector
02930    * @param[out]  *pDst points to the output vector
02931    * @param[in]  blockSize number of samples in the vector
02932    * @return none.
02933    */
02934 
02935   void arm_negate_q7(
02936   q7_t * pSrc,
02937   q7_t * pDst,
02938   uint32_t blockSize);
02939 
02940   /**
02941    * @brief  Negates the elements of a Q15 vector.
02942    * @param[in]  *pSrc points to the input vector
02943    * @param[out]  *pDst points to the output vector
02944    * @param[in]  blockSize number of samples in the vector
02945    * @return none.
02946    */
02947 
02948   void arm_negate_q15(
02949   q15_t * pSrc,
02950   q15_t * pDst,
02951   uint32_t blockSize);
02952 
02953   /**
02954    * @brief  Negates the elements of a Q31 vector.
02955    * @param[in]  *pSrc points to the input vector
02956    * @param[out]  *pDst points to the output vector
02957    * @param[in]  blockSize number of samples in the vector
02958    * @return none.
02959    */
02960 
02961   void arm_negate_q31(
02962   q31_t * pSrc,
02963   q31_t * pDst,
02964   uint32_t blockSize);
02965   /**
02966    * @brief  Copies the elements of a floating-point vector.
02967    * @param[in]  *pSrc input pointer
02968    * @param[out]  *pDst output pointer
02969    * @param[in]  blockSize number of samples to process
02970    * @return none.
02971    */
02972   void arm_copy_f32(
02973   float32_t * pSrc,
02974   float32_t * pDst,
02975   uint32_t blockSize);
02976 
02977   /**
02978    * @brief  Copies the elements of a Q7 vector.
02979    * @param[in]  *pSrc input pointer
02980    * @param[out]  *pDst output pointer
02981    * @param[in]  blockSize number of samples to process
02982    * @return none.
02983    */
02984   void arm_copy_q7(
02985   q7_t * pSrc,
02986   q7_t * pDst,
02987   uint32_t blockSize);
02988 
02989   /**
02990    * @brief  Copies the elements of a Q15 vector.
02991    * @param[in]  *pSrc input pointer
02992    * @param[out]  *pDst output pointer
02993    * @param[in]  blockSize number of samples to process
02994    * @return none.
02995    */
02996   void arm_copy_q15(
02997   q15_t * pSrc,
02998   q15_t * pDst,
02999   uint32_t blockSize);
03000 
03001   /**
03002    * @brief  Copies the elements of a Q31 vector.
03003    * @param[in]  *pSrc input pointer
03004    * @param[out]  *pDst output pointer
03005    * @param[in]  blockSize number of samples to process
03006    * @return none.
03007    */
03008   void arm_copy_q31(
03009   q31_t * pSrc,
03010   q31_t * pDst,
03011   uint32_t blockSize);
03012   /**
03013    * @brief  Fills a constant value into a floating-point vector.
03014    * @param[in]  value input value to be filled
03015    * @param[out]  *pDst output pointer
03016    * @param[in]  blockSize number of samples to process
03017    * @return none.
03018    */
03019   void arm_fill_f32(
03020   float32_t value,
03021   float32_t * pDst,
03022   uint32_t blockSize);
03023 
03024   /**
03025    * @brief  Fills a constant value into a Q7 vector.
03026    * @param[in]  value input value to be filled
03027    * @param[out]  *pDst output pointer
03028    * @param[in]  blockSize number of samples to process
03029    * @return none.
03030    */
03031   void arm_fill_q7(
03032   q7_t value,
03033   q7_t * pDst,
03034   uint32_t blockSize);
03035 
03036   /**
03037    * @brief  Fills a constant value into a Q15 vector.
03038    * @param[in]  value input value to be filled
03039    * @param[out]  *pDst output pointer
03040    * @param[in]  blockSize number of samples to process
03041    * @return none.
03042    */
03043   void arm_fill_q15(
03044   q15_t value,
03045   q15_t * pDst,
03046   uint32_t blockSize);
03047 
03048   /**
03049    * @brief  Fills a constant value into a Q31 vector.
03050    * @param[in]  value input value to be filled
03051    * @param[out]  *pDst output pointer
03052    * @param[in]  blockSize number of samples to process
03053    * @return none.
03054    */
03055   void arm_fill_q31(
03056   q31_t value,
03057   q31_t * pDst,
03058   uint32_t blockSize);
03059 
03060 /**
03061  * @brief Convolution of floating-point sequences.
03062  * @param[in] *pSrcA points to the first input sequence.
03063  * @param[in] srcALen length of the first input sequence.
03064  * @param[in] *pSrcB points to the second input sequence.
03065  * @param[in] srcBLen length of the second input sequence.
03066  * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.
03067  * @return none.
03068  */
03069 
03070   void arm_conv_f32(
03071   float32_t * pSrcA,
03072   uint32_t srcALen,
03073   float32_t * pSrcB,
03074   uint32_t srcBLen,
03075   float32_t * pDst);
03076 
03077 
03078   /**
03079    * @brief Convolution of Q15 sequences.
03080    * @param[in] *pSrcA points to the first input sequence.
03081    * @param[in] srcALen length of the first input sequence.
03082    * @param[in] *pSrcB points to the second input sequence.
03083    * @param[in] srcBLen length of the second input sequence.
03084    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03085    * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03086    * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
03087    * @return none.
03088    */
03089 
03090 
03091   void arm_conv_opt_q15(
03092   q15_t * pSrcA,
03093   uint32_t srcALen,
03094   q15_t * pSrcB,
03095   uint32_t srcBLen,
03096   q15_t * pDst,
03097   q15_t * pScratch1,
03098   q15_t * pScratch2);
03099 
03100 
03101 /**
03102  * @brief Convolution of Q15 sequences.
03103  * @param[in] *pSrcA points to the first input sequence.
03104  * @param[in] srcALen length of the first input sequence.
03105  * @param[in] *pSrcB points to the second input sequence.
03106  * @param[in] srcBLen length of the second input sequence.
03107  * @param[out] *pDst points to the location where the output result is written.  Length srcALen+srcBLen-1.
03108  * @return none.
03109  */
03110 
03111   void arm_conv_q15(
03112   q15_t * pSrcA,
03113   uint32_t srcALen,
03114   q15_t * pSrcB,
03115   uint32_t srcBLen,
03116   q15_t * pDst);
03117 
03118   /**
03119    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
03120    * @param[in] *pSrcA points to the first input sequence.
03121    * @param[in] srcALen length of the first input sequence.
03122    * @param[in] *pSrcB points to the second input sequence.
03123    * @param[in] srcBLen length of the second input sequence.
03124    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03125    * @return none.
03126    */
03127 
03128   void arm_conv_fast_q15(
03129               q15_t * pSrcA,
03130              uint32_t srcALen,
03131               q15_t * pSrcB,
03132              uint32_t srcBLen,
03133              q15_t * pDst);
03134 
03135   /**
03136    * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
03137    * @param[in] *pSrcA points to the first input sequence.
03138    * @param[in] srcALen length of the first input sequence.
03139    * @param[in] *pSrcB points to the second input sequence.
03140    * @param[in] srcBLen length of the second input sequence.
03141    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03142    * @param[in]  *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03143    * @param[in]  *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
03144    * @return none.
03145    */
03146 
03147   void arm_conv_fast_opt_q15(
03148   q15_t * pSrcA,
03149   uint32_t srcALen,
03150   q15_t * pSrcB,
03151   uint32_t srcBLen,
03152   q15_t * pDst,
03153   q15_t * pScratch1,
03154   q15_t * pScratch2);
03155 
03156 
03157 
03158   /**
03159    * @brief Convolution of Q31 sequences.
03160    * @param[in] *pSrcA points to the first input sequence.
03161    * @param[in] srcALen length of the first input sequence.
03162    * @param[in] *pSrcB points to the second input sequence.
03163    * @param[in] srcBLen length of the second input sequence.
03164    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03165    * @return none.
03166    */
03167 
03168   void arm_conv_q31(
03169   q31_t * pSrcA,
03170   uint32_t srcALen,
03171   q31_t * pSrcB,
03172   uint32_t srcBLen,
03173   q31_t * pDst);
03174 
03175   /**
03176    * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
03177    * @param[in] *pSrcA points to the first input sequence.
03178    * @param[in] srcALen length of the first input sequence.
03179    * @param[in] *pSrcB points to the second input sequence.
03180    * @param[in] srcBLen length of the second input sequence.
03181    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03182    * @return none.
03183    */
03184 
03185   void arm_conv_fast_q31(
03186   q31_t * pSrcA,
03187   uint32_t srcALen,
03188   q31_t * pSrcB,
03189   uint32_t srcBLen,
03190   q31_t * pDst);
03191 
03192 
03193     /**
03194    * @brief Convolution of Q7 sequences.
03195    * @param[in] *pSrcA points to the first input sequence.
03196    * @param[in] srcALen length of the first input sequence.
03197    * @param[in] *pSrcB points to the second input sequence.
03198    * @param[in] srcBLen length of the second input sequence.
03199    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03200    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03201    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
03202    * @return none.
03203    */
03204 
03205   void arm_conv_opt_q7(
03206   q7_t * pSrcA,
03207   uint32_t srcALen,
03208   q7_t * pSrcB,
03209   uint32_t srcBLen,
03210   q7_t * pDst,
03211   q15_t * pScratch1,
03212   q15_t * pScratch2);
03213 
03214 
03215 
03216   /**
03217    * @brief Convolution of Q7 sequences.
03218    * @param[in] *pSrcA points to the first input sequence.
03219    * @param[in] srcALen length of the first input sequence.
03220    * @param[in] *pSrcB points to the second input sequence.
03221    * @param[in] srcBLen length of the second input sequence.
03222    * @param[out] *pDst points to the block of output data  Length srcALen+srcBLen-1.
03223    * @return none.
03224    */
03225 
03226   void arm_conv_q7(
03227   q7_t * pSrcA,
03228   uint32_t srcALen,
03229   q7_t * pSrcB,
03230   uint32_t srcBLen,
03231   q7_t * pDst);
03232 
03233 
03234   /**
03235    * @brief Partial convolution of floating-point sequences.
03236    * @param[in]       *pSrcA points to the first input sequence.
03237    * @param[in]       srcALen length of the first input sequence.
03238    * @param[in]       *pSrcB points to the second input sequence.
03239    * @param[in]       srcBLen length of the second input sequence.
03240    * @param[out]      *pDst points to the block of output data
03241    * @param[in]       firstIndex is the first output sample to start with.
03242    * @param[in]       numPoints is the number of output points to be computed.
03243    * @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].
03244    */
03245 
03246   arm_status arm_conv_partial_f32(
03247   float32_t * pSrcA,
03248   uint32_t srcALen,
03249   float32_t * pSrcB,
03250   uint32_t srcBLen,
03251   float32_t * pDst,
03252   uint32_t firstIndex,
03253   uint32_t numPoints);
03254 
03255     /**
03256    * @brief Partial convolution of Q15 sequences.
03257    * @param[in]       *pSrcA points to the first input sequence.
03258    * @param[in]       srcALen length of the first input sequence.
03259    * @param[in]       *pSrcB points to the second input sequence.
03260    * @param[in]       srcBLen length of the second input sequence.
03261    * @param[out]      *pDst points to the block of output data
03262    * @param[in]       firstIndex is the first output sample to start with.
03263    * @param[in]       numPoints is the number of output points to be computed.
03264    * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03265    * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
03266    * @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].
03267    */
03268 
03269   arm_status arm_conv_partial_opt_q15(
03270   q15_t * pSrcA,
03271   uint32_t srcALen,
03272   q15_t * pSrcB,
03273   uint32_t srcBLen,
03274   q15_t * pDst,
03275   uint32_t firstIndex,
03276   uint32_t numPoints,
03277   q15_t * pScratch1,
03278   q15_t * pScratch2);
03279 
03280 
03281 /**
03282    * @brief Partial convolution of Q15 sequences.
03283    * @param[in]       *pSrcA points to the first input sequence.
03284    * @param[in]       srcALen length of the first input sequence.
03285    * @param[in]       *pSrcB points to the second input sequence.
03286    * @param[in]       srcBLen length of the second input sequence.
03287    * @param[out]      *pDst points to the block of output data
03288    * @param[in]       firstIndex is the first output sample to start with.
03289    * @param[in]       numPoints is the number of output points to be computed.
03290    * @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].
03291    */
03292 
03293   arm_status arm_conv_partial_q15(
03294   q15_t * pSrcA,
03295   uint32_t srcALen,
03296   q15_t * pSrcB,
03297   uint32_t srcBLen,
03298   q15_t * pDst,
03299   uint32_t firstIndex,
03300   uint32_t numPoints);
03301 
03302   /**
03303    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
03304    * @param[in]       *pSrcA points to the first input sequence.
03305    * @param[in]       srcALen length of the first input sequence.
03306    * @param[in]       *pSrcB points to the second input sequence.
03307    * @param[in]       srcBLen length of the second input sequence.
03308    * @param[out]      *pDst points to the block of output data
03309    * @param[in]       firstIndex is the first output sample to start with.
03310    * @param[in]       numPoints is the number of output points to be computed.
03311    * @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].
03312    */
03313 
03314   arm_status arm_conv_partial_fast_q15(
03315                         q15_t * pSrcA,
03316                        uint32_t srcALen,
03317                         q15_t * pSrcB,
03318                        uint32_t srcBLen,
03319                        q15_t * pDst,
03320                        uint32_t firstIndex,
03321                        uint32_t numPoints);
03322 
03323 
03324   /**
03325    * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
03326    * @param[in]       *pSrcA points to the first input sequence.
03327    * @param[in]       srcALen length of the first input sequence.
03328    * @param[in]       *pSrcB points to the second input sequence.
03329    * @param[in]       srcBLen length of the second input sequence.
03330    * @param[out]      *pDst points to the block of output data
03331    * @param[in]       firstIndex is the first output sample to start with.
03332    * @param[in]       numPoints is the number of output points to be computed.
03333    * @param[in]       * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03334    * @param[in]       * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
03335    * @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].
03336    */
03337 
03338   arm_status arm_conv_partial_fast_opt_q15(
03339   q15_t * pSrcA,
03340   uint32_t srcALen,
03341   q15_t * pSrcB,
03342   uint32_t srcBLen,
03343   q15_t * pDst,
03344   uint32_t firstIndex,
03345   uint32_t numPoints,
03346   q15_t * pScratch1,
03347   q15_t * pScratch2);
03348 
03349 
03350   /**
03351    * @brief Partial convolution of Q31 sequences.
03352    * @param[in]       *pSrcA points to the first input sequence.
03353    * @param[in]       srcALen length of the first input sequence.
03354    * @param[in]       *pSrcB points to the second input sequence.
03355    * @param[in]       srcBLen length of the second input sequence.
03356    * @param[out]      *pDst points to the block of output data
03357    * @param[in]       firstIndex is the first output sample to start with.
03358    * @param[in]       numPoints is the number of output points to be computed.
03359    * @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].
03360    */
03361 
03362   arm_status arm_conv_partial_q31(
03363   q31_t * pSrcA,
03364   uint32_t srcALen,
03365   q31_t * pSrcB,
03366   uint32_t srcBLen,
03367   q31_t * pDst,
03368   uint32_t firstIndex,
03369   uint32_t numPoints);
03370 
03371 
03372   /**
03373    * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
03374    * @param[in]       *pSrcA points to the first input sequence.
03375    * @param[in]       srcALen length of the first input sequence.
03376    * @param[in]       *pSrcB points to the second input sequence.
03377    * @param[in]       srcBLen length of the second input sequence.
03378    * @param[out]      *pDst points to the block of output data
03379    * @param[in]       firstIndex is the first output sample to start with.
03380    * @param[in]       numPoints is the number of output points to be computed.
03381    * @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].
03382    */
03383 
03384   arm_status arm_conv_partial_fast_q31(
03385   q31_t * pSrcA,
03386   uint32_t srcALen,
03387   q31_t * pSrcB,
03388   uint32_t srcBLen,
03389   q31_t * pDst,
03390   uint32_t firstIndex,
03391   uint32_t numPoints);
03392 
03393 
03394   /**
03395    * @brief Partial convolution of Q7 sequences
03396    * @param[in]       *pSrcA points to the first input sequence.
03397    * @param[in]       srcALen length of the first input sequence.
03398    * @param[in]       *pSrcB points to the second input sequence.
03399    * @param[in]       srcBLen length of the second input sequence.
03400    * @param[out]      *pDst points to the block of output data
03401    * @param[in]       firstIndex is the first output sample to start with.
03402    * @param[in]       numPoints is the number of output points to be computed.
03403    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
03404    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
03405    * @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].
03406    */
03407 
03408   arm_status arm_conv_partial_opt_q7(
03409   q7_t * pSrcA,
03410   uint32_t srcALen,
03411   q7_t * pSrcB,
03412   uint32_t srcBLen,
03413   q7_t * pDst,
03414   uint32_t firstIndex,
03415   uint32_t numPoints,
03416   q15_t * pScratch1,
03417   q15_t * pScratch2);
03418 
03419 
03420 /**
03421    * @brief Partial convolution of Q7 sequences.
03422    * @param[in]       *pSrcA points to the first input sequence.
03423    * @param[in]       srcALen length of the first input sequence.
03424    * @param[in]       *pSrcB points to the second input sequence.
03425    * @param[in]       srcBLen length of the second input sequence.
03426    * @param[out]      *pDst points to the block of output data
03427    * @param[in]       firstIndex is the first output sample to start with.
03428    * @param[in]       numPoints is the number of output points to be computed.
03429    * @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].
03430    */
03431 
03432   arm_status arm_conv_partial_q7(
03433   q7_t * pSrcA,
03434   uint32_t srcALen,
03435   q7_t * pSrcB,
03436   uint32_t srcBLen,
03437   q7_t * pDst,
03438   uint32_t firstIndex,
03439   uint32_t numPoints);
03440 
03441 
03442 
03443   /**
03444    * @brief Instance structure for the Q15 FIR decimator.
03445    */
03446 
03447   typedef struct
03448   {
03449     uint8_t M;                      /**< decimation factor. */
03450     uint16_t numTaps;               /**< number of coefficients in the filter. */
03451     q15_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/
03452     q15_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
03453   } arm_fir_decimate_instance_q15;
03454 
03455   /**
03456    * @brief Instance structure for the Q31 FIR decimator.
03457    */
03458 
03459   typedef struct
03460   {
03461     uint8_t M;                  /**< decimation factor. */
03462     uint16_t numTaps;           /**< number of coefficients in the filter. */
03463     q31_t *pCoeffs;              /**< points to the coefficient array. The array is of length numTaps.*/
03464     q31_t *pState;               /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
03465 
03466   } arm_fir_decimate_instance_q31;
03467 
03468   /**
03469    * @brief Instance structure for the floating-point FIR decimator.
03470    */
03471 
03472   typedef struct
03473   {
03474     uint8_t M;                          /**< decimation factor. */
03475     uint16_t numTaps;                   /**< number of coefficients in the filter. */
03476     float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numTaps.*/
03477     float32_t *pState;                   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
03478 
03479   } arm_fir_decimate_instance_f32;
03480 
03481 
03482 
03483   /**
03484    * @brief Processing function for the floating-point FIR decimator.
03485    * @param[in] *S points to an instance of the floating-point FIR decimator structure.
03486    * @param[in] *pSrc points to the block of input data.
03487    * @param[out] *pDst points to the block of output data
03488    * @param[in] blockSize number of input samples to process per call.
03489    * @return none
03490    */
03491 
03492   void arm_fir_decimate_f32(
03493   const arm_fir_decimate_instance_f32 * S,
03494   float32_t * pSrc,
03495   float32_t * pDst,
03496   uint32_t blockSize);
03497 
03498 
03499   /**
03500    * @brief  Initialization function for the floating-point FIR decimator.
03501    * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
03502    * @param[in] numTaps  number of coefficients in the filter.
03503    * @param[in] M  decimation factor.
03504    * @param[in] *pCoeffs points to the filter coefficients.
03505    * @param[in] *pState points to the state buffer.
03506    * @param[in] blockSize number of input samples to process per call.
03507    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03508    * <code>blockSize</code> is not a multiple of <code>M</code>.
03509    */
03510 
03511   arm_status arm_fir_decimate_init_f32(
03512   arm_fir_decimate_instance_f32 * S,
03513   uint16_t numTaps,
03514   uint8_t M,
03515   float32_t * pCoeffs,
03516   float32_t * pState,
03517   uint32_t blockSize);
03518 
03519   /**
03520    * @brief Processing function for the Q15 FIR decimator.
03521    * @param[in] *S points to an instance of the Q15 FIR decimator structure.
03522    * @param[in] *pSrc points to the block of input data.
03523    * @param[out] *pDst points to the block of output data
03524    * @param[in] blockSize number of input samples to process per call.
03525    * @return none
03526    */
03527 
03528   void arm_fir_decimate_q15(
03529   const arm_fir_decimate_instance_q15 * S,
03530   q15_t * pSrc,
03531   q15_t * pDst,
03532   uint32_t blockSize);
03533 
03534   /**
03535    * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
03536    * @param[in] *S points to an instance of the Q15 FIR decimator structure.
03537    * @param[in] *pSrc points to the block of input data.
03538    * @param[out] *pDst points to the block of output data
03539    * @param[in] blockSize number of input samples to process per call.
03540    * @return none
03541    */
03542 
03543   void arm_fir_decimate_fast_q15(
03544   const arm_fir_decimate_instance_q15 * S,
03545   q15_t * pSrc,
03546   q15_t * pDst,
03547   uint32_t blockSize);
03548 
03549 
03550 
03551   /**
03552    * @brief  Initialization function for the Q15 FIR decimator.
03553    * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
03554    * @param[in] numTaps  number of coefficients in the filter.
03555    * @param[in] M  decimation factor.
03556    * @param[in] *pCoeffs points to the filter coefficients.
03557    * @param[in] *pState points to the state buffer.
03558    * @param[in] blockSize number of input samples to process per call.
03559    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03560    * <code>blockSize</code> is not a multiple of <code>M</code>.
03561    */
03562 
03563   arm_status arm_fir_decimate_init_q15(
03564   arm_fir_decimate_instance_q15 * S,
03565   uint16_t numTaps,
03566   uint8_t M,
03567   q15_t * pCoeffs,
03568   q15_t * pState,
03569   uint32_t blockSize);
03570 
03571   /**
03572    * @brief Processing function for the Q31 FIR decimator.
03573    * @param[in] *S points to an instance of the Q31 FIR decimator structure.
03574    * @param[in] *pSrc points to the block of input data.
03575    * @param[out] *pDst points to the block of output data
03576    * @param[in] blockSize number of input samples to process per call.
03577    * @return none
03578    */
03579 
03580   void arm_fir_decimate_q31(
03581   const arm_fir_decimate_instance_q31 * S,
03582   q31_t * pSrc,
03583   q31_t * pDst,
03584   uint32_t blockSize);
03585 
03586   /**
03587    * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
03588    * @param[in] *S points to an instance of the Q31 FIR decimator structure.
03589    * @param[in] *pSrc points to the block of input data.
03590    * @param[out] *pDst points to the block of output data
03591    * @param[in] blockSize number of input samples to process per call.
03592    * @return none
03593    */
03594 
03595   void arm_fir_decimate_fast_q31(
03596   arm_fir_decimate_instance_q31 * S,
03597   q31_t * pSrc,
03598   q31_t * pDst,
03599   uint32_t blockSize);
03600 
03601 
03602   /**
03603    * @brief  Initialization function for the Q31 FIR decimator.
03604    * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
03605    * @param[in] numTaps  number of coefficients in the filter.
03606    * @param[in] M  decimation factor.
03607    * @param[in] *pCoeffs points to the filter coefficients.
03608    * @param[in] *pState points to the state buffer.
03609    * @param[in] blockSize number of input samples to process per call.
03610    * @return    The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03611    * <code>blockSize</code> is not a multiple of <code>M</code>.
03612    */
03613 
03614   arm_status arm_fir_decimate_init_q31(
03615   arm_fir_decimate_instance_q31 * S,
03616   uint16_t numTaps,
03617   uint8_t M,
03618   q31_t * pCoeffs,
03619   q31_t * pState,
03620   uint32_t blockSize);
03621 
03622 
03623 
03624   /**
03625    * @brief Instance structure for the Q15 FIR interpolator.
03626    */
03627 
03628   typedef struct
03629   {
03630     uint8_t L;                      /**< upsample factor. */
03631     uint16_t phaseLength;           /**< length of each polyphase filter component. */
03632     q15_t *pCoeffs;                 /**< points to the coefficient array. The array is of length L*phaseLength. */
03633     q15_t *pState;                  /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
03634   } arm_fir_interpolate_instance_q15;
03635 
03636   /**
03637    * @brief Instance structure for the Q31 FIR interpolator.
03638    */
03639 
03640   typedef struct
03641   {
03642     uint8_t L;                      /**< upsample factor. */
03643     uint16_t phaseLength;           /**< length of each polyphase filter component. */
03644     q31_t *pCoeffs;                  /**< points to the coefficient array. The array is of length L*phaseLength. */
03645     q31_t *pState;                   /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
03646   } arm_fir_interpolate_instance_q31;
03647 
03648   /**
03649    * @brief Instance structure for the floating-point FIR interpolator.
03650    */
03651 
03652   typedef struct
03653   {
03654     uint8_t L;                     /**< upsample factor. */
03655     uint16_t phaseLength;          /**< length of each polyphase filter component. */
03656     float32_t *pCoeffs;             /**< points to the coefficient array. The array is of length L*phaseLength. */
03657     float32_t *pState;              /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
03658   } arm_fir_interpolate_instance_f32;
03659 
03660 
03661   /**
03662    * @brief Processing function for the Q15 FIR interpolator.
03663    * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.
03664    * @param[in] *pSrc     points to the block of input data.
03665    * @param[out] *pDst    points to the block of output data.
03666    * @param[in] blockSize number of input samples to process per call.
03667    * @return none.
03668    */
03669 
03670   void arm_fir_interpolate_q15(
03671   const arm_fir_interpolate_instance_q15 * S,
03672   q15_t * pSrc,
03673   q15_t * pDst,
03674   uint32_t blockSize);
03675 
03676 
03677   /**
03678    * @brief  Initialization function for the Q15 FIR interpolator.
03679    * @param[in,out] *S        points to an instance of the Q15 FIR interpolator structure.
03680    * @param[in]     L         upsample factor.
03681    * @param[in]     numTaps   number of filter coefficients in the filter.
03682    * @param[in]     *pCoeffs  points to the filter coefficient buffer.
03683    * @param[in]     *pState   points to the state buffer.
03684    * @param[in]     blockSize number of input samples to process per call.
03685    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03686    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
03687    */
03688 
03689   arm_status arm_fir_interpolate_init_q15(
03690   arm_fir_interpolate_instance_q15 * S,
03691   uint8_t L,
03692   uint16_t numTaps,
03693   q15_t * pCoeffs,
03694   q15_t * pState,
03695   uint32_t blockSize);
03696 
03697   /**
03698    * @brief Processing function for the Q31 FIR interpolator.
03699    * @param[in] *S        points to an instance of the Q15 FIR interpolator structure.
03700    * @param[in] *pSrc     points to the block of input data.
03701    * @param[out] *pDst    points to the block of output data.
03702    * @param[in] blockSize number of input samples to process per call.
03703    * @return none.
03704    */
03705 
03706   void arm_fir_interpolate_q31(
03707   const arm_fir_interpolate_instance_q31 * S,
03708   q31_t * pSrc,
03709   q31_t * pDst,
03710   uint32_t blockSize);
03711 
03712   /**
03713    * @brief  Initialization function for the Q31 FIR interpolator.
03714    * @param[in,out] *S        points to an instance of the Q31 FIR interpolator structure.
03715    * @param[in]     L         upsample factor.
03716    * @param[in]     numTaps   number of filter coefficients in the filter.
03717    * @param[in]     *pCoeffs  points to the filter coefficient buffer.
03718    * @param[in]     *pState   points to the state buffer.
03719    * @param[in]     blockSize number of input samples to process per call.
03720    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03721    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
03722    */
03723 
03724   arm_status arm_fir_interpolate_init_q31(
03725   arm_fir_interpolate_instance_q31 * S,
03726   uint8_t L,
03727   uint16_t numTaps,
03728   q31_t * pCoeffs,
03729   q31_t * pState,
03730   uint32_t blockSize);
03731 
03732 
03733   /**
03734    * @brief Processing function for the floating-point FIR interpolator.
03735    * @param[in] *S        points to an instance of the floating-point FIR interpolator structure.
03736    * @param[in] *pSrc     points to the block of input data.
03737    * @param[out] *pDst    points to the block of output data.
03738    * @param[in] blockSize number of input samples to process per call.
03739    * @return none.
03740    */
03741 
03742   void arm_fir_interpolate_f32(
03743   const arm_fir_interpolate_instance_f32 * S,
03744   float32_t * pSrc,
03745   float32_t * pDst,
03746   uint32_t blockSize);
03747 
03748   /**
03749    * @brief  Initialization function for the floating-point FIR interpolator.
03750    * @param[in,out] *S        points to an instance of the floating-point FIR interpolator structure.
03751    * @param[in]     L         upsample factor.
03752    * @param[in]     numTaps   number of filter coefficients in the filter.
03753    * @param[in]     *pCoeffs  points to the filter coefficient buffer.
03754    * @param[in]     *pState   points to the state buffer.
03755    * @param[in]     blockSize number of input samples to process per call.
03756    * @return        The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
03757    * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
03758    */
03759 
03760   arm_status arm_fir_interpolate_init_f32(
03761   arm_fir_interpolate_instance_f32 * S,
03762   uint8_t L,
03763   uint16_t numTaps,
03764   float32_t * pCoeffs,
03765   float32_t * pState,
03766   uint32_t blockSize);
03767 
03768   /**
03769    * @brief Instance structure for the high precision Q31 Biquad cascade filter.
03770    */
03771 
03772   typedef struct
03773   {
03774     uint8_t numStages;       /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
03775     q63_t *pState;           /**< points to the array of state coefficients.  The array is of length 4*numStages. */
03776     q31_t *pCoeffs;          /**< points to the array of coefficients.  The array is of length 5*numStages. */
03777     uint8_t postShift;       /**< additional shift, in bits, applied to each output sample. */
03778 
03779   } arm_biquad_cas_df1_32x64_ins_q31;
03780 
03781 
03782   /**
03783    * @param[in]  *S        points to an instance of the high precision Q31 Biquad cascade filter structure.
03784    * @param[in]  *pSrc     points to the block of input data.
03785    * @param[out] *pDst     points to the block of output data
03786    * @param[in]  blockSize number of samples to process.
03787    * @return none.
03788    */
03789 
03790   void arm_biquad_cas_df1_32x64_q31(
03791   const arm_biquad_cas_df1_32x64_ins_q31 * S,
03792   q31_t * pSrc,
03793   q31_t * pDst,
03794   uint32_t blockSize);
03795 
03796 
03797   /**
03798    * @param[in,out] *S           points to an instance of the high precision Q31 Biquad cascade filter structure.
03799    * @param[in]     numStages    number of 2nd order stages in the filter.
03800    * @param[in]     *pCoeffs     points to the filter coefficients.
03801    * @param[in]     *pState      points to the state buffer.
03802    * @param[in]     postShift    shift to be applied to the output. Varies according to the coefficients format
03803    * @return        none
03804    */
03805 
03806   void arm_biquad_cas_df1_32x64_init_q31(
03807   arm_biquad_cas_df1_32x64_ins_q31 * S,
03808   uint8_t numStages,
03809   q31_t * pCoeffs,
03810   q63_t * pState,
03811   uint8_t postShift);
03812 
03813 
03814 
03815   /**
03816    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
03817    */
03818 
03819   typedef struct
03820   {
03821     uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
03822     float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
03823     float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
03824   } arm_biquad_cascade_df2T_instance_f32;
03825 
03826 
03827 
03828   /**
03829    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
03830    */
03831 
03832   typedef struct
03833   {
03834     uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
03835     float32_t *pState;         /**< points to the array of state coefficients.  The array is of length 4*numStages. */
03836     float32_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
03837   } arm_biquad_cascade_stereo_df2T_instance_f32;
03838 
03839 
03840 
03841   /**
03842    * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
03843    */
03844 
03845   typedef struct
03846   {
03847     uint8_t numStages;         /**< number of 2nd order stages in the filter.  Overall order is 2*numStages. */
03848     float64_t *pState;         /**< points to the array of state coefficients.  The array is of length 2*numStages. */
03849     float64_t *pCoeffs;        /**< points to the array of coefficients.  The array is of length 5*numStages. */
03850   } arm_biquad_cascade_df2T_instance_f64;
03851 
03852 
03853   /**
03854    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
03855    * @param[in]  *S        points to an instance of the filter data structure.
03856    * @param[in]  *pSrc     points to the block of input data.
03857    * @param[out] *pDst     points to the block of output data
03858    * @param[in]  blockSize number of samples to process.
03859    * @return none.
03860    */
03861 
03862   void arm_biquad_cascade_df2T_f32(
03863   const arm_biquad_cascade_df2T_instance_f32 * S,
03864   float32_t * pSrc,
03865   float32_t * pDst,
03866   uint32_t blockSize);
03867 
03868 
03869   /**
03870    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
03871    * @param[in]  *S        points to an instance of the filter data structure.
03872    * @param[in]  *pSrc     points to the block of input data.
03873    * @param[out] *pDst     points to the block of output data
03874    * @param[in]  blockSize number of samples to process.
03875    * @return none.
03876    */
03877 
03878   void arm_biquad_cascade_stereo_df2T_f32(
03879   const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
03880   float32_t * pSrc,
03881   float32_t * pDst,
03882   uint32_t blockSize);
03883 
03884   /**
03885    * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
03886    * @param[in]  *S        points to an instance of the filter data structure.
03887    * @param[in]  *pSrc     points to the block of input data.
03888    * @param[out] *pDst     points to the block of output data
03889    * @param[in]  blockSize number of samples to process.
03890    * @return none.
03891    */
03892 
03893   void arm_biquad_cascade_df2T_f64(
03894   const arm_biquad_cascade_df2T_instance_f64 * S,
03895   float64_t * pSrc,
03896   float64_t * pDst,
03897   uint32_t blockSize);
03898 
03899 
03900   /**
03901    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
03902    * @param[in,out] *S           points to an instance of the filter data structure.
03903    * @param[in]     numStages    number of 2nd order stages in the filter.
03904    * @param[in]     *pCoeffs     points to the filter coefficients.
03905    * @param[in]     *pState      points to the state buffer.
03906    * @return        none
03907    */
03908 
03909   void arm_biquad_cascade_df2T_init_f32(
03910   arm_biquad_cascade_df2T_instance_f32 * S,
03911   uint8_t numStages,
03912   float32_t * pCoeffs,
03913   float32_t * pState);
03914 
03915 
03916   /**
03917    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
03918    * @param[in,out] *S           points to an instance of the filter data structure.
03919    * @param[in]     numStages    number of 2nd order stages in the filter.
03920    * @param[in]     *pCoeffs     points to the filter coefficients.
03921    * @param[in]     *pState      points to the state buffer.
03922    * @return        none
03923    */
03924 
03925   void arm_biquad_cascade_stereo_df2T_init_f32(
03926   arm_biquad_cascade_stereo_df2T_instance_f32 * S,
03927   uint8_t numStages,
03928   float32_t * pCoeffs,
03929   float32_t * pState);
03930 
03931 
03932   /**
03933    * @brief  Initialization function for the floating-point transposed direct form II Biquad cascade filter.
03934    * @param[in,out] *S           points to an instance of the filter data structure.
03935    * @param[in]     numStages    number of 2nd order stages in the filter.
03936    * @param[in]     *pCoeffs     points to the filter coefficients.
03937    * @param[in]     *pState      points to the state buffer.
03938    * @return        none
03939    */
03940 
03941   void arm_biquad_cascade_df2T_init_f64(
03942   arm_biquad_cascade_df2T_instance_f64 * S,
03943   uint8_t numStages,
03944   float64_t * pCoeffs,
03945   float64_t * pState);
03946 
03947 
03948 
03949   /**
03950    * @brief Instance structure for the Q15 FIR lattice filter.
03951    */
03952 
03953   typedef struct
03954   {
03955     uint16_t numStages;                          /**< number of filter stages. */
03956     q15_t *pState;                               /**< points to the state variable array. The array is of length numStages. */
03957     q15_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */
03958   } arm_fir_lattice_instance_q15;
03959 
03960   /**
03961    * @brief Instance structure for the Q31 FIR lattice filter.
03962    */
03963 
03964   typedef struct
03965   {
03966     uint16_t numStages;                          /**< number of filter stages. */
03967     q31_t *pState;                               /**< points to the state variable array. The array is of length numStages. */
03968     q31_t *pCoeffs;                              /**< points to the coefficient array. The array is of length numStages. */
03969   } arm_fir_lattice_instance_q31;
03970 
03971   /**
03972    * @brief Instance structure for the floating-point FIR lattice filter.
03973    */
03974 
03975   typedef struct
03976   {
03977     uint16_t numStages;                  /**< number of filter stages. */
03978     float32_t *pState;                   /**< points to the state variable array. The array is of length numStages. */
03979     float32_t *pCoeffs;                  /**< points to the coefficient array. The array is of length numStages. */
03980   } arm_fir_lattice_instance_f32;
03981 
03982   /**
03983    * @brief Initialization function for the Q15 FIR lattice filter.
03984    * @param[in] *S points to an instance of the Q15 FIR lattice structure.
03985    * @param[in] numStages  number of filter stages.
03986    * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
03987    * @param[in] *pState points to the state buffer.  The array is of length numStages.
03988    * @return none.
03989    */
03990 
03991   void arm_fir_lattice_init_q15(
03992   arm_fir_lattice_instance_q15 * S,
03993   uint16_t numStages,
03994   q15_t * pCoeffs,
03995   q15_t * pState);
03996 
03997 
03998   /**
03999    * @brief Processing function for the Q15 FIR lattice filter.
04000    * @param[in] *S points to an instance of the Q15 FIR lattice structure.
04001    * @param[in] *pSrc points to the block of input data.
04002    * @param[out] *pDst points to the block of output data.
04003    * @param[in] blockSize number of samples to process.
04004    * @return none.
04005    */
04006   void arm_fir_lattice_q15(
04007   const arm_fir_lattice_instance_q15 * S,
04008   q15_t * pSrc,
04009   q15_t * pDst,
04010   uint32_t blockSize);
04011 
04012   /**
04013    * @brief Initialization function for the Q31 FIR lattice filter.
04014    * @param[in] *S points to an instance of the Q31 FIR lattice structure.
04015    * @param[in] numStages  number of filter stages.
04016    * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
04017    * @param[in] *pState points to the state buffer.   The array is of length numStages.
04018    * @return none.
04019    */
04020 
04021   void arm_fir_lattice_init_q31(
04022   arm_fir_lattice_instance_q31 * S,
04023   uint16_t numStages,
04024   q31_t * pCoeffs,
04025   q31_t * pState);
04026 
04027 
04028   /**
04029    * @brief Processing function for the Q31 FIR lattice filter.
04030    * @param[in]  *S        points to an instance of the Q31 FIR lattice structure.
04031    * @param[in]  *pSrc     points to the block of input data.
04032    * @param[out] *pDst     points to the block of output data
04033    * @param[in]  blockSize number of samples to process.
04034    * @return none.
04035    */
04036 
04037   void arm_fir_lattice_q31(
04038   const arm_fir_lattice_instance_q31 * S,
04039   q31_t * pSrc,
04040   q31_t * pDst,
04041   uint32_t blockSize);
04042 
04043 /**
04044  * @brief Initialization function for the floating-point FIR lattice filter.
04045  * @param[in] *S points to an instance of the floating-point FIR lattice structure.
04046  * @param[in] numStages  number of filter stages.
04047  * @param[in] *pCoeffs points to the coefficient buffer.  The array is of length numStages.
04048  * @param[in] *pState points to the state buffer.  The array is of length numStages.
04049  * @return none.
04050  */
04051 
04052   void arm_fir_lattice_init_f32(
04053   arm_fir_lattice_instance_f32 * S,
04054   uint16_t numStages,
04055   float32_t * pCoeffs,
04056   float32_t * pState);
04057 
04058   /**
04059    * @brief Processing function for the floating-point FIR lattice filter.
04060    * @param[in]  *S        points to an instance of the floating-point FIR lattice structure.
04061    * @param[in]  *pSrc     points to the block of input data.
04062    * @param[out] *pDst     points to the block of output data
04063    * @param[in]  blockSize number of samples to process.
04064    * @return none.
04065    */
04066 
04067   void arm_fir_lattice_f32(
04068   const arm_fir_lattice_instance_f32 * S,
04069   float32_t * pSrc,
04070   float32_t * pDst,
04071   uint32_t blockSize);
04072 
04073   /**
04074    * @brief Instance structure for the Q15 IIR lattice filter.
04075    */
04076   typedef struct
04077   {
04078     uint16_t numStages;                         /**< number of stages in the filter. */
04079     q15_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */
04080     q15_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */
04081     q15_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */
04082   } arm_iir_lattice_instance_q15;
04083 
04084   /**
04085    * @brief Instance structure for the Q31 IIR lattice filter.
04086    */
04087   typedef struct
04088   {
04089     uint16_t numStages;                         /**< number of stages in the filter. */
04090     q31_t *pState;                              /**< points to the state variable array. The array is of length numStages+blockSize. */
04091     q31_t *pkCoeffs;                            /**< points to the reflection coefficient array. The array is of length numStages. */
04092     q31_t *pvCoeffs;                            /**< points to the ladder coefficient array. The array is of length numStages+1. */
04093   } arm_iir_lattice_instance_q31;
04094 
04095   /**
04096    * @brief Instance structure for the floating-point IIR lattice filter.
04097    */
04098   typedef struct
04099   {
04100     uint16_t numStages;                         /**< number of stages in the filter. */
04101     float32_t *pState;                          /**< points to the state variable array. The array is of length numStages+blockSize. */
04102     float32_t *pkCoeffs;                        /**< points to the reflection coefficient array. The array is of length numStages. */
04103     float32_t *pvCoeffs;                        /**< points to the ladder coefficient array. The array is of length numStages+1. */
04104   } arm_iir_lattice_instance_f32;
04105 
04106   /**
04107    * @brief Processing function for the floating-point IIR lattice filter.
04108    * @param[in] *S points to an instance of the floating-point IIR lattice structure.
04109    * @param[in] *pSrc points to the block of input data.
04110    * @param[out] *pDst points to the block of output data.
04111    * @param[in] blockSize number of samples to process.
04112    * @return none.
04113    */
04114 
04115   void arm_iir_lattice_f32(
04116   const arm_iir_lattice_instance_f32 * S,
04117   float32_t * pSrc,
04118   float32_t * pDst,
04119   uint32_t blockSize);
04120 
04121   /**
04122    * @brief Initialization function for the floating-point IIR lattice filter.
04123    * @param[in] *S points to an instance of the floating-point IIR lattice structure.
04124    * @param[in] numStages number of stages in the filter.
04125    * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.
04126    * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.
04127    * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize-1.
04128    * @param[in] blockSize number of samples to process.
04129    * @return none.
04130    */
04131 
04132   void arm_iir_lattice_init_f32(
04133   arm_iir_lattice_instance_f32 * S,
04134   uint16_t numStages,
04135   float32_t * pkCoeffs,
04136   float32_t * pvCoeffs,
04137   float32_t * pState,
04138   uint32_t blockSize);
04139 
04140 
04141   /**
04142    * @brief Processing function for the Q31 IIR lattice filter.
04143    * @param[in] *S points to an instance of the Q31 IIR lattice structure.
04144    * @param[in] *pSrc points to the block of input data.
04145    * @param[out] *pDst points to the block of output data.
04146    * @param[in] blockSize number of samples to process.
04147    * @return none.
04148    */
04149 
04150   void arm_iir_lattice_q31(
04151   const arm_iir_lattice_instance_q31 * S,
04152   q31_t * pSrc,
04153   q31_t * pDst,
04154   uint32_t blockSize);
04155 
04156 
04157   /**
04158    * @brief Initialization function for the Q31 IIR lattice filter.
04159    * @param[in] *S points to an instance of the Q31 IIR lattice structure.
04160    * @param[in] numStages number of stages in the filter.
04161    * @param[in] *pkCoeffs points to the reflection coefficient buffer.  The array is of length numStages.
04162    * @param[in] *pvCoeffs points to the ladder coefficient buffer.  The array is of length numStages+1.
04163    * @param[in] *pState points to the state buffer.  The array is of length numStages+blockSize.
04164    * @param[in] blockSize number of samples to process.
04165    * @return none.
04166    */
04167 
04168   void arm_iir_lattice_init_q31(
04169   arm_iir_lattice_instance_q31 * S,
04170   uint16_t numStages,
04171   q31_t * pkCoeffs,
04172   q31_t * pvCoeffs,
04173   q31_t * pState,
04174   uint32_t blockSize);
04175 
04176 
04177   /**
04178    * @brief Processing function for the Q15 IIR lattice filter.
04179    * @param[in] *S points to an instance of the Q15 IIR lattice structure.
04180    * @param[in] *pSrc points to the block of input data.
04181    * @param[out] *pDst points to the block of output data.
04182    * @param[in] blockSize number of samples to process.
04183    * @return none.
04184    */
04185 
04186   void arm_iir_lattice_q15(
04187   const arm_iir_lattice_instance_q15 * S,
04188   q15_t * pSrc,
04189   q15_t * pDst,
04190   uint32_t blockSize);
04191 
04192 
04193 /**
04194  * @brief Initialization function for the Q15 IIR lattice filter.
04195  * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
04196  * @param[in] numStages  number of stages in the filter.
04197  * @param[in] *pkCoeffs points to reflection coefficient buffer.  The array is of length numStages.
04198  * @param[in] *pvCoeffs points to ladder coefficient buffer.  The array is of length numStages+1.
04199  * @param[in] *pState points to state buffer.  The array is of length numStages+blockSize.
04200  * @param[in] blockSize number of samples to process per call.
04201  * @return none.
04202  */
04203 
04204   void arm_iir_lattice_init_q15(
04205   arm_iir_lattice_instance_q15 * S,
04206   uint16_t numStages,
04207   q15_t * pkCoeffs,
04208   q15_t * pvCoeffs,
04209   q15_t * pState,
04210   uint32_t blockSize);
04211 
04212   /**
04213    * @brief Instance structure for the floating-point LMS filter.
04214    */
04215 
04216   typedef struct
04217   {
04218     uint16_t numTaps;    /**< number of coefficients in the filter. */
04219     float32_t *pState;   /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04220     float32_t *pCoeffs;  /**< points to the coefficient array. The array is of length numTaps. */
04221     float32_t mu;        /**< step size that controls filter coefficient updates. */
04222   } arm_lms_instance_f32;
04223 
04224   /**
04225    * @brief Processing function for floating-point LMS filter.
04226    * @param[in]  *S points to an instance of the floating-point LMS filter structure.
04227    * @param[in]  *pSrc points to the block of input data.
04228    * @param[in]  *pRef points to the block of reference data.
04229    * @param[out] *pOut points to the block of output data.
04230    * @param[out] *pErr points to the block of error data.
04231    * @param[in]  blockSize number of samples to process.
04232    * @return     none.
04233    */
04234 
04235   void arm_lms_f32(
04236   const arm_lms_instance_f32 * S,
04237   float32_t * pSrc,
04238   float32_t * pRef,
04239   float32_t * pOut,
04240   float32_t * pErr,
04241   uint32_t blockSize);
04242 
04243   /**
04244    * @brief Initialization function for floating-point LMS filter.
04245    * @param[in] *S points to an instance of the floating-point LMS filter structure.
04246    * @param[in] numTaps  number of filter coefficients.
04247    * @param[in] *pCoeffs points to the coefficient buffer.
04248    * @param[in] *pState points to state buffer.
04249    * @param[in] mu step size that controls filter coefficient updates.
04250    * @param[in] blockSize number of samples to process.
04251    * @return none.
04252    */
04253 
04254   void arm_lms_init_f32(
04255   arm_lms_instance_f32 * S,
04256   uint16_t numTaps,
04257   float32_t * pCoeffs,
04258   float32_t * pState,
04259   float32_t mu,
04260   uint32_t blockSize);
04261 
04262   /**
04263    * @brief Instance structure for the Q15 LMS filter.
04264    */
04265 
04266   typedef struct
04267   {
04268     uint16_t numTaps;    /**< number of coefficients in the filter. */
04269     q15_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04270     q15_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
04271     q15_t mu;            /**< step size that controls filter coefficient updates. */
04272     uint32_t postShift;  /**< bit shift applied to coefficients. */
04273   } arm_lms_instance_q15;
04274 
04275 
04276   /**
04277    * @brief Initialization function for the Q15 LMS filter.
04278    * @param[in] *S points to an instance of the Q15 LMS filter structure.
04279    * @param[in] numTaps  number of filter coefficients.
04280    * @param[in] *pCoeffs points to the coefficient buffer.
04281    * @param[in] *pState points to the state buffer.
04282    * @param[in] mu step size that controls filter coefficient updates.
04283    * @param[in] blockSize number of samples to process.
04284    * @param[in] postShift bit shift applied to coefficients.
04285    * @return    none.
04286    */
04287 
04288   void arm_lms_init_q15(
04289   arm_lms_instance_q15 * S,
04290   uint16_t numTaps,
04291   q15_t * pCoeffs,
04292   q15_t * pState,
04293   q15_t mu,
04294   uint32_t blockSize,
04295   uint32_t postShift);
04296 
04297   /**
04298    * @brief Processing function for Q15 LMS filter.
04299    * @param[in] *S points to an instance of the Q15 LMS filter structure.
04300    * @param[in] *pSrc points to the block of input data.
04301    * @param[in] *pRef points to the block of reference data.
04302    * @param[out] *pOut points to the block of output data.
04303    * @param[out] *pErr points to the block of error data.
04304    * @param[in] blockSize number of samples to process.
04305    * @return none.
04306    */
04307 
04308   void arm_lms_q15(
04309   const arm_lms_instance_q15 * S,
04310   q15_t * pSrc,
04311   q15_t * pRef,
04312   q15_t * pOut,
04313   q15_t * pErr,
04314   uint32_t blockSize);
04315 
04316 
04317   /**
04318    * @brief Instance structure for the Q31 LMS filter.
04319    */
04320 
04321   typedef struct
04322   {
04323     uint16_t numTaps;    /**< number of coefficients in the filter. */
04324     q31_t *pState;       /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04325     q31_t *pCoeffs;      /**< points to the coefficient array. The array is of length numTaps. */
04326     q31_t mu;            /**< step size that controls filter coefficient updates. */
04327     uint32_t postShift;  /**< bit shift applied to coefficients. */
04328 
04329   } arm_lms_instance_q31;
04330 
04331   /**
04332    * @brief Processing function for Q31 LMS filter.
04333    * @param[in]  *S points to an instance of the Q15 LMS filter structure.
04334    * @param[in]  *pSrc points to the block of input data.
04335    * @param[in]  *pRef points to the block of reference data.
04336    * @param[out] *pOut points to the block of output data.
04337    * @param[out] *pErr points to the block of error data.
04338    * @param[in]  blockSize number of samples to process.
04339    * @return     none.
04340    */
04341 
04342   void arm_lms_q31(
04343   const arm_lms_instance_q31 * S,
04344   q31_t * pSrc,
04345   q31_t * pRef,
04346   q31_t * pOut,
04347   q31_t * pErr,
04348   uint32_t blockSize);
04349 
04350   /**
04351    * @brief Initialization function for Q31 LMS filter.
04352    * @param[in] *S points to an instance of the Q31 LMS filter structure.
04353    * @param[in] numTaps  number of filter coefficients.
04354    * @param[in] *pCoeffs points to coefficient buffer.
04355    * @param[in] *pState points to state buffer.
04356    * @param[in] mu step size that controls filter coefficient updates.
04357    * @param[in] blockSize number of samples to process.
04358    * @param[in] postShift bit shift applied to coefficients.
04359    * @return none.
04360    */
04361 
04362   void arm_lms_init_q31(
04363   arm_lms_instance_q31 * S,
04364   uint16_t numTaps,
04365   q31_t * pCoeffs,
04366   q31_t * pState,
04367   q31_t mu,
04368   uint32_t blockSize,
04369   uint32_t postShift);
04370 
04371   /**
04372    * @brief Instance structure for the floating-point normalized LMS filter.
04373    */
04374 
04375   typedef struct
04376   {
04377     uint16_t numTaps;     /**< number of coefficients in the filter. */
04378     float32_t *pState;    /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04379     float32_t *pCoeffs;   /**< points to the coefficient array. The array is of length numTaps. */
04380     float32_t mu;        /**< step size that control filter coefficient updates. */
04381     float32_t energy;    /**< saves previous frame energy. */
04382     float32_t x0;        /**< saves previous input sample. */
04383   } arm_lms_norm_instance_f32;
04384 
04385   /**
04386    * @brief Processing function for floating-point normalized LMS filter.
04387    * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
04388    * @param[in] *pSrc points to the block of input data.
04389    * @param[in] *pRef points to the block of reference data.
04390    * @param[out] *pOut points to the block of output data.
04391    * @param[out] *pErr points to the block of error data.
04392    * @param[in] blockSize number of samples to process.
04393    * @return none.
04394    */
04395 
04396   void arm_lms_norm_f32(
04397   arm_lms_norm_instance_f32 * S,
04398   float32_t * pSrc,
04399   float32_t * pRef,
04400   float32_t * pOut,
04401   float32_t * pErr,
04402   uint32_t blockSize);
04403 
04404   /**
04405    * @brief Initialization function for floating-point normalized LMS filter.
04406    * @param[in] *S points to an instance of the floating-point LMS filter structure.
04407    * @param[in] numTaps  number of filter coefficients.
04408    * @param[in] *pCoeffs points to coefficient buffer.
04409    * @param[in] *pState points to state buffer.
04410    * @param[in] mu step size that controls filter coefficient updates.
04411    * @param[in] blockSize number of samples to process.
04412    * @return none.
04413    */
04414 
04415   void arm_lms_norm_init_f32(
04416   arm_lms_norm_instance_f32 * S,
04417   uint16_t numTaps,
04418   float32_t * pCoeffs,
04419   float32_t * pState,
04420   float32_t mu,
04421   uint32_t blockSize);
04422 
04423 
04424   /**
04425    * @brief Instance structure for the Q31 normalized LMS filter.
04426    */
04427   typedef struct
04428   {
04429     uint16_t numTaps;     /**< number of coefficients in the filter. */
04430     q31_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04431     q31_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
04432     q31_t mu;             /**< step size that controls filter coefficient updates. */
04433     uint8_t postShift;    /**< bit shift applied to coefficients. */
04434     q31_t *recipTable;    /**< points to the reciprocal initial value table. */
04435     q31_t energy;         /**< saves previous frame energy. */
04436     q31_t x0;             /**< saves previous input sample. */
04437   } arm_lms_norm_instance_q31;
04438 
04439   /**
04440    * @brief Processing function for Q31 normalized LMS filter.
04441    * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
04442    * @param[in] *pSrc points to the block of input data.
04443    * @param[in] *pRef points to the block of reference data.
04444    * @param[out] *pOut points to the block of output data.
04445    * @param[out] *pErr points to the block of error data.
04446    * @param[in] blockSize number of samples to process.
04447    * @return none.
04448    */
04449 
04450   void arm_lms_norm_q31(
04451   arm_lms_norm_instance_q31 * S,
04452   q31_t * pSrc,
04453   q31_t * pRef,
04454   q31_t * pOut,
04455   q31_t * pErr,
04456   uint32_t blockSize);
04457 
04458   /**
04459    * @brief Initialization function for Q31 normalized LMS filter.
04460    * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
04461    * @param[in] numTaps  number of filter coefficients.
04462    * @param[in] *pCoeffs points to coefficient buffer.
04463    * @param[in] *pState points to state buffer.
04464    * @param[in] mu step size that controls filter coefficient updates.
04465    * @param[in] blockSize number of samples to process.
04466    * @param[in] postShift bit shift applied to coefficients.
04467    * @return none.
04468    */
04469 
04470   void arm_lms_norm_init_q31(
04471   arm_lms_norm_instance_q31 * S,
04472   uint16_t numTaps,
04473   q31_t * pCoeffs,
04474   q31_t * pState,
04475   q31_t mu,
04476   uint32_t blockSize,
04477   uint8_t postShift);
04478 
04479   /**
04480    * @brief Instance structure for the Q15 normalized LMS filter.
04481    */
04482 
04483   typedef struct
04484   {
04485     uint16_t numTaps;    /**< Number of coefficients in the filter. */
04486     q15_t *pState;        /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
04487     q15_t *pCoeffs;       /**< points to the coefficient array. The array is of length numTaps. */
04488     q15_t mu;            /**< step size that controls filter coefficient updates. */
04489     uint8_t postShift;   /**< bit shift applied to coefficients. */
04490     q15_t *recipTable;   /**< Points to the reciprocal initial value table. */
04491     q15_t energy;        /**< saves previous frame energy. */
04492     q15_t x0;            /**< saves previous input sample. */
04493   } arm_lms_norm_instance_q15;
04494 
04495   /**
04496    * @brief Processing function for Q15 normalized LMS filter.
04497    * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
04498    * @param[in] *pSrc points to the block of input data.
04499    * @param[in] *pRef points to the block of reference data.
04500    * @param[out] *pOut points to the block of output data.
04501    * @param[out] *pErr points to the block of error data.
04502    * @param[in] blockSize number of samples to process.
04503    * @return none.
04504    */
04505 
04506   void arm_lms_norm_q15(
04507   arm_lms_norm_instance_q15 * S,
04508   q15_t * pSrc,
04509   q15_t * pRef,
04510   q15_t * pOut,
04511   q15_t * pErr,
04512   uint32_t blockSize);
04513 
04514 
04515   /**
04516    * @brief Initialization function for Q15 normalized LMS filter.
04517    * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
04518    * @param[in] numTaps  number of filter coefficients.
04519    * @param[in] *pCoeffs points to coefficient buffer.
04520    * @param[in] *pState points to state buffer.
04521    * @param[in] mu step size that controls filter coefficient updates.
04522    * @param[in] blockSize number of samples to process.
04523    * @param[in] postShift bit shift applied to coefficients.
04524    * @return none.
04525    */
04526 
04527   void arm_lms_norm_init_q15(
04528   arm_lms_norm_instance_q15 * S,
04529   uint16_t numTaps,
04530   q15_t * pCoeffs,
04531   q15_t * pState,
04532   q15_t mu,
04533   uint32_t blockSize,
04534   uint8_t postShift);
04535 
04536   /**
04537    * @brief Correlation of floating-point sequences.
04538    * @param[in] *pSrcA points to the first input sequence.
04539    * @param[in] srcALen length of the first input sequence.
04540    * @param[in] *pSrcB points to the second input sequence.
04541    * @param[in] srcBLen length of the second input sequence.
04542    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04543    * @return none.
04544    */
04545 
04546   void arm_correlate_f32(
04547   float32_t * pSrcA,
04548   uint32_t srcALen,
04549   float32_t * pSrcB,
04550   uint32_t srcBLen,
04551   float32_t * pDst);
04552 
04553 
04554    /**
04555    * @brief Correlation of Q15 sequences
04556    * @param[in] *pSrcA points to the first input sequence.
04557    * @param[in] srcALen length of the first input sequence.
04558    * @param[in] *pSrcB points to the second input sequence.
04559    * @param[in] srcBLen length of the second input sequence.
04560    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04561    * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04562    * @return none.
04563    */
04564   void arm_correlate_opt_q15(
04565   q15_t * pSrcA,
04566   uint32_t srcALen,
04567   q15_t * pSrcB,
04568   uint32_t srcBLen,
04569   q15_t * pDst,
04570   q15_t * pScratch);
04571 
04572 
04573   /**
04574    * @brief Correlation of Q15 sequences.
04575    * @param[in] *pSrcA points to the first input sequence.
04576    * @param[in] srcALen length of the first input sequence.
04577    * @param[in] *pSrcB points to the second input sequence.
04578    * @param[in] srcBLen length of the second input sequence.
04579    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04580    * @return none.
04581    */
04582 
04583   void arm_correlate_q15(
04584   q15_t * pSrcA,
04585   uint32_t srcALen,
04586   q15_t * pSrcB,
04587   uint32_t srcBLen,
04588   q15_t * pDst);
04589 
04590   /**
04591    * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
04592    * @param[in] *pSrcA points to the first input sequence.
04593    * @param[in] srcALen length of the first input sequence.
04594    * @param[in] *pSrcB points to the second input sequence.
04595    * @param[in] srcBLen length of the second input sequence.
04596    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04597    * @return none.
04598    */
04599 
04600   void arm_correlate_fast_q15(
04601                    q15_t * pSrcA,
04602                   uint32_t srcALen,
04603                    q15_t * pSrcB,
04604                   uint32_t srcBLen,
04605                   q15_t * pDst);
04606 
04607 
04608 
04609   /**
04610    * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
04611    * @param[in] *pSrcA points to the first input sequence.
04612    * @param[in] srcALen length of the first input sequence.
04613    * @param[in] *pSrcB points to the second input sequence.
04614    * @param[in] srcBLen length of the second input sequence.
04615    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04616    * @param[in]  *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04617    * @return none.
04618    */
04619 
04620   void arm_correlate_fast_opt_q15(
04621   q15_t * pSrcA,
04622   uint32_t srcALen,
04623   q15_t * pSrcB,
04624   uint32_t srcBLen,
04625   q15_t * pDst,
04626   q15_t * pScratch);
04627 
04628   /**
04629    * @brief Correlation of Q31 sequences.
04630    * @param[in] *pSrcA points to the first input sequence.
04631    * @param[in] srcALen length of the first input sequence.
04632    * @param[in] *pSrcB points to the second input sequence.
04633    * @param[in] srcBLen length of the second input sequence.
04634    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04635    * @return none.
04636    */
04637 
04638   void arm_correlate_q31(
04639   q31_t * pSrcA,
04640   uint32_t srcALen,
04641   q31_t * pSrcB,
04642   uint32_t srcBLen,
04643   q31_t * pDst);
04644 
04645   /**
04646    * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
04647    * @param[in] *pSrcA points to the first input sequence.
04648    * @param[in] srcALen length of the first input sequence.
04649    * @param[in] *pSrcB points to the second input sequence.
04650    * @param[in] srcBLen length of the second input sequence.
04651    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04652    * @return none.
04653    */
04654 
04655   void arm_correlate_fast_q31(
04656   q31_t * pSrcA,
04657   uint32_t srcALen,
04658   q31_t * pSrcB,
04659   uint32_t srcBLen,
04660   q31_t * pDst);
04661 
04662 
04663 
04664  /**
04665    * @brief Correlation of Q7 sequences.
04666    * @param[in] *pSrcA points to the first input sequence.
04667    * @param[in] srcALen length of the first input sequence.
04668    * @param[in] *pSrcB points to the second input sequence.
04669    * @param[in] srcBLen length of the second input sequence.
04670    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04671    * @param[in]  *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
04672    * @param[in]  *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
04673    * @return none.
04674    */
04675 
04676   void arm_correlate_opt_q7(
04677   q7_t * pSrcA,
04678   uint32_t srcALen,
04679   q7_t * pSrcB,
04680   uint32_t srcBLen,
04681   q7_t * pDst,
04682   q15_t * pScratch1,
04683   q15_t * pScratch2);
04684 
04685 
04686   /**
04687    * @brief Correlation of Q7 sequences.
04688    * @param[in] *pSrcA points to the first input sequence.
04689    * @param[in] srcALen length of the first input sequence.
04690    * @param[in] *pSrcB points to the second input sequence.
04691    * @param[in] srcBLen length of the second input sequence.
04692    * @param[out] *pDst points to the block of output data  Length 2 * max(srcALen, srcBLen) - 1.
04693    * @return none.
04694    */
04695 
04696   void arm_correlate_q7(
04697   q7_t * pSrcA,
04698   uint32_t srcALen,
04699   q7_t * pSrcB,
04700   uint32_t srcBLen,
04701   q7_t * pDst);
04702 
04703 
04704   /**
04705    * @brief Instance structure for the floating-point sparse FIR filter.
04706    */
04707   typedef struct
04708   {
04709     uint16_t numTaps;             /**< number of coefficients in the filter. */
04710     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
04711     float32_t *pState;            /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
04712     float32_t *pCoeffs;           /**< points to the coefficient array. The array is of length numTaps.*/
04713     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
04714     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
04715   } arm_fir_sparse_instance_f32;
04716 
04717   /**
04718    * @brief Instance structure for the Q31 sparse FIR filter.
04719    */
04720 
04721   typedef struct
04722   {
04723     uint16_t numTaps;             /**< number of coefficients in the filter. */
04724     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
04725     q31_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
04726     q31_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
04727     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
04728     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
04729   } arm_fir_sparse_instance_q31;
04730 
04731   /**
04732    * @brief Instance structure for the Q15 sparse FIR filter.
04733    */
04734 
04735   typedef struct
04736   {
04737     uint16_t numTaps;             /**< number of coefficients in the filter. */
04738     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
04739     q15_t *pState;                /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
04740     q15_t *pCoeffs;               /**< points to the coefficient array. The array is of length numTaps.*/
04741     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
04742     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
04743   } arm_fir_sparse_instance_q15;
04744 
04745   /**
04746    * @brief Instance structure for the Q7 sparse FIR filter.
04747    */
04748 
04749   typedef struct
04750   {
04751     uint16_t numTaps;             /**< number of coefficients in the filter. */
04752     uint16_t stateIndex;          /**< state buffer index.  Points to the oldest sample in the state buffer. */
04753     q7_t *pState;                 /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
04754     q7_t *pCoeffs;                /**< points to the coefficient array. The array is of length numTaps.*/
04755     uint16_t maxDelay;            /**< maximum offset specified by the pTapDelay array. */
04756     int32_t *pTapDelay;           /**< points to the array of delay values.  The array is of length numTaps. */
04757   } arm_fir_sparse_instance_q7;
04758 
04759   /**
04760    * @brief Processing function for the floating-point sparse FIR filter.
04761    * @param[in]  *S          points to an instance of the floating-point sparse FIR structure.
04762    * @param[in]  *pSrc       points to the block of input data.
04763    * @param[out] *pDst       points to the block of output data
04764    * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.
04765    * @param[in]  blockSize   number of input samples to process per call.
04766    * @return none.
04767    */
04768 
04769   void arm_fir_sparse_f32(
04770   arm_fir_sparse_instance_f32 * S,
04771   float32_t * pSrc,
04772   float32_t * pDst,
04773   float32_t * pScratchIn,
04774   uint32_t blockSize);
04775 
04776   /**
04777    * @brief  Initialization function for the floating-point sparse FIR filter.
04778    * @param[in,out] *S         points to an instance of the floating-point sparse FIR structure.
04779    * @param[in]     numTaps    number of nonzero coefficients in the filter.
04780    * @param[in]     *pCoeffs   points to the array of filter coefficients.
04781    * @param[in]     *pState    points to the state buffer.
04782    * @param[in]     *pTapDelay points to the array of offset times.
04783    * @param[in]     maxDelay   maximum offset time supported.
04784    * @param[in]     blockSize  number of samples that will be processed per block.
04785    * @return none
04786    */
04787 
04788   void arm_fir_sparse_init_f32(
04789   arm_fir_sparse_instance_f32 * S,
04790   uint16_t numTaps,
04791   float32_t * pCoeffs,
04792   float32_t * pState,
04793   int32_t * pTapDelay,
04794   uint16_t maxDelay,
04795   uint32_t blockSize);
04796 
04797   /**
04798    * @brief Processing function for the Q31 sparse FIR filter.
04799    * @param[in]  *S          points to an instance of the Q31 sparse FIR structure.
04800    * @param[in]  *pSrc       points to the block of input data.
04801    * @param[out] *pDst       points to the block of output data
04802    * @param[in]  *pScratchIn points to a temporary buffer of size blockSize.
04803    * @param[in]  blockSize   number of input samples to process per call.
04804    * @return none.
04805    */
04806 
04807   void arm_fir_sparse_q31(
04808   arm_fir_sparse_instance_q31 * S,
04809   q31_t * pSrc,
04810   q31_t * pDst,
04811   q31_t * pScratchIn,
04812   uint32_t blockSize);
04813 
04814   /**
04815    * @brief  Initialization function for the Q31 sparse FIR filter.
04816    * @param[in,out] *S         points to an instance of the Q31 sparse FIR structure.
04817    * @param[in]     numTaps    number of nonzero coefficients in the filter.
04818    * @param[in]     *pCoeffs   points to the array of filter coefficients.
04819    * @param[in]     *pState    points to the state buffer.
04820    * @param[in]     *pTapDelay points to the array of offset times.
04821    * @param[in]     maxDelay   maximum offset time supported.
04822    * @param[in]     blockSize  number of samples that will be processed per block.
04823    * @return none
04824    */
04825 
04826   void arm_fir_sparse_init_q31(
04827   arm_fir_sparse_instance_q31 * S,
04828   uint16_t numTaps,
04829   q31_t * pCoeffs,
04830   q31_t * pState,
04831   int32_t * pTapDelay,
04832   uint16_t maxDelay,
04833   uint32_t blockSize);
04834 
04835   /**
04836    * @brief Processing function for the Q15 sparse FIR filter.
04837    * @param[in]  *S           points to an instance of the Q15 sparse FIR structure.
04838    * @param[in]  *pSrc        points to the block of input data.
04839    * @param[out] *pDst        points to the block of output data
04840    * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.
04841    * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.
04842    * @param[in]  blockSize    number of input samples to process per call.
04843    * @return none.
04844    */
04845 
04846   void arm_fir_sparse_q15(
04847   arm_fir_sparse_instance_q15 * S,
04848   q15_t * pSrc,
04849   q15_t * pDst,
04850   q15_t * pScratchIn,
04851   q31_t * pScratchOut,
04852   uint32_t blockSize);
04853 
04854 
04855   /**
04856    * @brief  Initialization function for the Q15 sparse FIR filter.
04857    * @param[in,out] *S         points to an instance of the Q15 sparse FIR structure.
04858    * @param[in]     numTaps    number of nonzero coefficients in the filter.
04859    * @param[in]     *pCoeffs   points to the array of filter coefficients.
04860    * @param[in]     *pState    points to the state buffer.
04861    * @param[in]     *pTapDelay points to the array of offset times.
04862    * @param[in]     maxDelay   maximum offset time supported.
04863    * @param[in]     blockSize  number of samples that will be processed per block.
04864    * @return none
04865    */
04866 
04867   void arm_fir_sparse_init_q15(
04868   arm_fir_sparse_instance_q15 * S,
04869   uint16_t numTaps,
04870   q15_t * pCoeffs,
04871   q15_t * pState,
04872   int32_t * pTapDelay,
04873   uint16_t maxDelay,
04874   uint32_t blockSize);
04875 
04876   /**
04877    * @brief Processing function for the Q7 sparse FIR filter.
04878    * @param[in]  *S           points to an instance of the Q7 sparse FIR structure.
04879    * @param[in]  *pSrc        points to the block of input data.
04880    * @param[out] *pDst        points to the block of output data
04881    * @param[in]  *pScratchIn  points to a temporary buffer of size blockSize.
04882    * @param[in]  *pScratchOut points to a temporary buffer of size blockSize.
04883    * @param[in]  blockSize    number of input samples to process per call.
04884    * @return none.
04885    */
04886 
04887   void arm_fir_sparse_q7(
04888   arm_fir_sparse_instance_q7 * S,
04889   q7_t * pSrc,
04890   q7_t * pDst,
04891   q7_t * pScratchIn,
04892   q31_t * pScratchOut,
04893   uint32_t blockSize);
04894 
04895   /**
04896    * @brief  Initialization function for the Q7 sparse FIR filter.
04897    * @param[in,out] *S         points to an instance of the Q7 sparse FIR structure.
04898    * @param[in]     numTaps    number of nonzero coefficients in the filter.
04899    * @param[in]     *pCoeffs   points to the array of filter coefficients.
04900    * @param[in]     *pState    points to the state buffer.
04901    * @param[in]     *pTapDelay points to the array of offset times.
04902    * @param[in]     maxDelay   maximum offset time supported.
04903    * @param[in]     blockSize  number of samples that will be processed per block.
04904    * @return none
04905    */
04906 
04907   void arm_fir_sparse_init_q7(
04908   arm_fir_sparse_instance_q7 * S,
04909   uint16_t numTaps,
04910   q7_t * pCoeffs,
04911   q7_t * pState,
04912   int32_t * pTapDelay,
04913   uint16_t maxDelay,
04914   uint32_t blockSize);
04915 
04916 
04917   /*
04918    * @brief  Floating-point sin_cos function.
04919    * @param[in]  theta    input value in degrees
04920    * @param[out] *pSinVal points to the processed sine output.
04921    * @param[out] *pCosVal points to the processed cos output.
04922    * @return none.
04923    */
04924 
04925   void arm_sin_cos_f32(
04926   float32_t theta,
04927   float32_t * pSinVal,
04928   float32_t * pCcosVal);
04929 
04930   /*
04931    * @brief  Q31 sin_cos function.
04932    * @param[in]  theta    scaled input value in degrees
04933    * @param[out] *pSinVal points to the processed sine output.
04934    * @param[out] *pCosVal points to the processed cosine output.
04935    * @return none.
04936    */
04937 
04938   void arm_sin_cos_q31(
04939   q31_t theta,
04940   q31_t * pSinVal,
04941   q31_t * pCosVal);
04942 
04943 
04944   /**
04945    * @brief  Floating-point complex conjugate.
04946    * @param[in]  *pSrc points to the input vector
04947    * @param[out]  *pDst points to the output vector
04948    * @param[in]  numSamples number of complex samples in each vector
04949    * @return none.
04950    */
04951 
04952   void arm_cmplx_conj_f32(
04953   float32_t * pSrc,
04954   float32_t * pDst,
04955   uint32_t numSamples);
04956 
04957   /**
04958    * @brief  Q31 complex conjugate.
04959    * @param[in]  *pSrc points to the input vector
04960    * @param[out]  *pDst points to the output vector
04961    * @param[in]  numSamples number of complex samples in each vector
04962    * @return none.
04963    */
04964 
04965   void arm_cmplx_conj_q31(
04966   q31_t * pSrc,
04967   q31_t * pDst,
04968   uint32_t numSamples);
04969 
04970   /**
04971    * @brief  Q15 complex conjugate.
04972    * @param[in]  *pSrc points to the input vector
04973    * @param[out]  *pDst points to the output vector
04974    * @param[in]  numSamples number of complex samples in each vector
04975    * @return none.
04976    */
04977 
04978   void arm_cmplx_conj_q15(
04979   q15_t * pSrc,
04980   q15_t * pDst,
04981   uint32_t numSamples);
04982 
04983 
04984 
04985   /**
04986    * @brief  Floating-point complex magnitude squared
04987    * @param[in]  *pSrc points to the complex input vector
04988    * @param[out]  *pDst points to the real output vector
04989    * @param[in]  numSamples number of complex samples in the input vector
04990    * @return none.
04991    */
04992 
04993   void arm_cmplx_mag_squared_f32(
04994   float32_t * pSrc,
04995   float32_t * pDst,
04996   uint32_t numSamples);
04997 
04998   /**
04999    * @brief  Q31 complex magnitude squared
05000    * @param[in]  *pSrc points to the complex input vector
05001    * @param[out]  *pDst points to the real output vector
05002    * @param[in]  numSamples number of complex samples in the input vector
05003    * @return none.
05004    */
05005 
05006   void arm_cmplx_mag_squared_q31(
05007   q31_t * pSrc,
05008   q31_t * pDst,
05009   uint32_t numSamples);
05010 
05011   /**
05012    * @brief  Q15 complex magnitude squared
05013    * @param[in]  *pSrc points to the complex input vector
05014    * @param[out]  *pDst points to the real output vector
05015    * @param[in]  numSamples number of complex samples in the input vector
05016    * @return none.
05017    */
05018 
05019   void arm_cmplx_mag_squared_q15(
05020   q15_t * pSrc,
05021   q15_t * pDst,
05022   uint32_t numSamples);
05023 
05024 
05025  /**
05026    * @ingroup groupController
05027    */
05028 
05029   /**
05030    * @defgroup PID PID Motor Control
05031    *
05032    * A Proportional Integral Derivative (PID) controller is a generic feedback control
05033    * loop mechanism widely used in industrial control systems.
05034    * A PID controller is the most commonly used type of feedback controller.
05035    *
05036    * This set of functions implements (PID) controllers
05037    * for Q15, Q31, and floating-point data types.  The functions operate on a single sample
05038    * of data and each call to the function returns a single processed value.
05039    * <code>S</code> points to an instance of the PID control data structure.  <code>in</code>
05040    * is the input sample value. The functions return the output value.
05041    *
05042    * \par Algorithm:
05043    * <pre>
05044    *    y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
05045    *    A0 = Kp + Ki + Kd
05046    *    A1 = (-Kp ) - (2 * Kd )
05047    *    A2 = Kd  </pre>
05048    *
05049    * \par
05050    * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
05051    *
05052    * \par
05053    * \image html PID.gif "Proportional Integral Derivative Controller"
05054    *
05055    * \par
05056    * The PID controller calculates an "error" value as the difference between
05057    * the measured output and the reference input.
05058    * The controller attempts to minimize the error by adjusting the process control inputs.
05059    * The proportional value determines the reaction to the current error,
05060    * the integral value determines the reaction based on the sum of recent errors,
05061    * and the derivative value determines the reaction based on the rate at which the error has been changing.
05062    *
05063    * \par Instance Structure
05064    * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
05065    * A separate instance structure must be defined for each PID Controller.
05066    * There are separate instance structure declarations for each of the 3 supported data types.
05067    *
05068    * \par Reset Functions
05069    * There is also an associated reset function for each data type which clears the state array.
05070    *
05071    * \par Initialization Functions
05072    * There is also an associated initialization function for each data type.
05073    * The initialization function performs the following operations:
05074    * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
05075    * - Zeros out the values in the state buffer.
05076    *
05077    * \par
05078    * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
05079    *
05080    * \par Fixed-Point Behavior
05081    * Care must be taken when using the fixed-point versions of the PID Controller functions.
05082    * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
05083    * Refer to the function specific documentation below for usage guidelines.
05084    */
05085 
05086   /**
05087    * @addtogroup PID
05088    * @{
05089    */
05090 
05091   /**
05092    * @brief  Process function for the floating-point PID Control.
05093    * @param[in,out] *S is an instance of the floating-point PID Control structure
05094    * @param[in] in input sample to process
05095    * @return out processed output sample.
05096    */
05097 
05098 
05099   static __INLINE float32_t arm_pid_f32(
05100   arm_pid_instance_f32 * S,
05101   float32_t in)
05102   {
05103     float32_t out;
05104 
05105     /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]  */
05106     out = (S->A0 * in) +
05107       (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
05108 
05109     /* Update state */
05110     S->state[1] = S->state[0];
05111     S->state[0] = in;
05112     S->state[2] = out;
05113 
05114     /* return to application */
05115     return (out);
05116 
05117   }
05118 
05119   /**
05120    * @brief  Process function for the Q31 PID Control.
05121    * @param[in,out] *S points to an instance of the Q31 PID Control structure
05122    * @param[in] in input sample to process
05123    * @return out processed output sample.
05124    *
05125    * <b>Scaling and Overflow Behavior:</b>
05126    * \par
05127    * The function is implemented using an internal 64-bit accumulator.
05128    * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
05129    * Thus, if the accumulator result overflows it wraps around rather than clip.
05130    * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
05131    * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
05132    */
05133 
05134   static __INLINE q31_t arm_pid_q31(
05135   arm_pid_instance_q31 * S,
05136   q31_t in)
05137   {
05138     q63_t acc;
05139     q31_t out;
05140 
05141     /* acc = A0 * x[n]  */
05142     acc = (q63_t) S->A0 * in;
05143 
05144     /* acc += A1 * x[n-1] */
05145     acc += (q63_t) S->A1 * S->state[0];
05146 
05147     /* acc += A2 * x[n-2]  */
05148     acc += (q63_t) S->A2 * S->state[1];
05149 
05150     /* convert output to 1.31 format to add y[n-1] */
05151     out = (q31_t) (acc >> 31u);
05152 
05153     /* out += y[n-1] */
05154     out += S->state[2];
05155 
05156     /* Update state */
05157     S->state[1] = S->state[0];
05158     S->state[0] = in;
05159     S->state[2] = out;
05160 
05161     /* return to application */
05162     return (out);
05163 
05164   }
05165 
05166   /**
05167    * @brief  Process function for the Q15 PID Control.
05168    * @param[in,out] *S points to an instance of the Q15 PID Control structure
05169    * @param[in] in input sample to process
05170    * @return out processed output sample.
05171    *
05172    * <b>Scaling and Overflow Behavior:</b>
05173    * \par
05174    * The function is implemented using a 64-bit internal accumulator.
05175    * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
05176    * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
05177    * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
05178    * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
05179    * Lastly, the accumulator is saturated to yield a result in 1.15 format.
05180    */
05181 
05182   static __INLINE q15_t arm_pid_q15(
05183   arm_pid_instance_q15 * S,
05184   q15_t in)
05185   {
05186     q63_t acc;
05187     q15_t out;
05188 
05189 #ifndef ARM_MATH_CM0_FAMILY
05190     __SIMD32_TYPE *vstate;
05191 
05192     /* Implementation of PID controller */
05193 
05194     /* acc = A0 * x[n]  */
05195     acc = (q31_t) __SMUAD(S->A0, in);
05196 
05197     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
05198     vstate = __SIMD32_CONST(S->state);
05199     acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
05200 
05201 #else
05202     /* acc = A0 * x[n]  */
05203     acc = ((q31_t) S->A0) * in;
05204 
05205     /* acc += A1 * x[n-1] + A2 * x[n-2]  */
05206     acc += (q31_t) S->A1 * S->state[0];
05207     acc += (q31_t) S->A2 * S->state[1];
05208 
05209 #endif
05210 
05211     /* acc += y[n-1] */
05212     acc += (q31_t) S->state[2] << 15;
05213 
05214     /* saturate the output */
05215     out = (q15_t) (__SSAT((acc >> 15), 16));
05216 
05217     /* Update state */
05218     S->state[1] = S->state[0];
05219     S->state[0] = in;
05220     S->state[2] = out;
05221 
05222     /* return to application */
05223     return (out);
05224 
05225   }
05226 
05227   /**
05228    * @} end of PID group
05229    */
05230 
05231 
05232   /**
05233    * @brief Floating-point matrix inverse.
05234    * @param[in]  *src points to the instance of the input floating-point matrix structure.
05235    * @param[out] *dst points to the instance of the output floating-point matrix structure.
05236    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
05237    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
05238    */
05239 
05240   arm_status arm_mat_inverse_f32(
05241   const arm_matrix_instance_f32 * src,
05242   arm_matrix_instance_f32 * dst);
05243 
05244 
05245   /**
05246    * @brief Floating-point matrix inverse.
05247    * @param[in]  *src points to the instance of the input floating-point matrix structure.
05248    * @param[out] *dst points to the instance of the output floating-point matrix structure.
05249    * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
05250    * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
05251    */
05252 
05253   arm_status arm_mat_inverse_f64(
05254   const arm_matrix_instance_f64 * src,
05255   arm_matrix_instance_f64 * dst);
05256 
05257 
05258 
05259   /**
05260    * @ingroup groupController
05261    */
05262 
05263 
05264   /**
05265    * @defgroup clarke Vector Clarke Transform
05266    * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
05267    * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
05268    * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
05269    * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
05270    * \image html clarke.gif Stator current space vector and its components in (a,b).
05271    * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
05272    * can be calculated using only <code>Ia</code> and <code>Ib</code>.
05273    *
05274    * The function operates on a single sample of data and each call to the function returns the processed output.
05275    * The library provides separate functions for Q31 and floating-point data types.
05276    * \par Algorithm
05277    * \image html clarkeFormula.gif
05278    * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
05279    * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
05280    * \par Fixed-Point Behavior
05281    * Care must be taken when using the Q31 version of the Clarke transform.
05282    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
05283    * Refer to the function specific documentation below for usage guidelines.
05284    */
05285 
05286   /**
05287    * @addtogroup clarke
05288    * @{
05289    */
05290 
05291   /**
05292    *
05293    * @brief  Floating-point Clarke transform
05294    * @param[in]       Ia       input three-phase coordinate <code>a</code>
05295    * @param[in]       Ib       input three-phase coordinate <code>b</code>
05296    * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha
05297    * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta
05298    * @return none.
05299    */
05300 
05301   static __INLINE void arm_clarke_f32(
05302   float32_t Ia,
05303   float32_t Ib,
05304   float32_t * pIalpha,
05305   float32_t * pIbeta)
05306   {
05307     /* Calculate pIalpha using the equation, pIalpha = Ia */
05308     *pIalpha = Ia;
05309 
05310     /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
05311     *pIbeta =
05312       ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
05313 
05314   }
05315 
05316   /**
05317    * @brief  Clarke transform for Q31 version
05318    * @param[in]       Ia       input three-phase coordinate <code>a</code>
05319    * @param[in]       Ib       input three-phase coordinate <code>b</code>
05320    * @param[out]      *pIalpha points to output two-phase orthogonal vector axis alpha
05321    * @param[out]      *pIbeta  points to output two-phase orthogonal vector axis beta
05322    * @return none.
05323    *
05324    * <b>Scaling and Overflow Behavior:</b>
05325    * \par
05326    * The function is implemented using an internal 32-bit accumulator.
05327    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
05328    * There is saturation on the addition, hence there is no risk of overflow.
05329    */
05330 
05331   static __INLINE void arm_clarke_q31(
05332   q31_t Ia,
05333   q31_t Ib,
05334   q31_t * pIalpha,
05335   q31_t * pIbeta)
05336   {
05337     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
05338 
05339     /* Calculating pIalpha from Ia by equation pIalpha = Ia */
05340     *pIalpha = Ia;
05341 
05342     /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
05343     product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
05344 
05345     /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
05346     product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
05347 
05348     /* pIbeta is calculated by adding the intermediate products */
05349     *pIbeta = __QADD(product1, product2);
05350   }
05351 
05352   /**
05353    * @} end of clarke group
05354    */
05355 
05356   /**
05357    * @brief  Converts the elements of the Q7 vector to Q31 vector.
05358    * @param[in]  *pSrc     input pointer
05359    * @param[out]  *pDst    output pointer
05360    * @param[in]  blockSize number of samples to process
05361    * @return none.
05362    */
05363   void arm_q7_to_q31(
05364   q7_t * pSrc,
05365   q31_t * pDst,
05366   uint32_t blockSize);
05367 
05368 
05369 
05370 
05371   /**
05372    * @ingroup groupController
05373    */
05374 
05375   /**
05376    * @defgroup inv_clarke Vector Inverse Clarke Transform
05377    * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
05378    *
05379    * The function operates on a single sample of data and each call to the function returns the processed output.
05380    * The library provides separate functions for Q31 and floating-point data types.
05381    * \par Algorithm
05382    * \image html clarkeInvFormula.gif
05383    * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
05384    * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
05385    * \par Fixed-Point Behavior
05386    * Care must be taken when using the Q31 version of the Clarke transform.
05387    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
05388    * Refer to the function specific documentation below for usage guidelines.
05389    */
05390 
05391   /**
05392    * @addtogroup inv_clarke
05393    * @{
05394    */
05395 
05396    /**
05397    * @brief  Floating-point Inverse Clarke transform
05398    * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha
05399    * @param[in]       Ibeta   input two-phase orthogonal vector axis beta
05400    * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>
05401    * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>
05402    * @return none.
05403    */
05404 
05405 
05406   static __INLINE void arm_inv_clarke_f32(
05407   float32_t Ialpha,
05408   float32_t Ibeta,
05409   float32_t * pIa,
05410   float32_t * pIb)
05411   {
05412     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
05413     *pIa = Ialpha;
05414 
05415     /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
05416     *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
05417 
05418   }
05419 
05420   /**
05421    * @brief  Inverse Clarke transform for Q31 version
05422    * @param[in]       Ialpha  input two-phase orthogonal vector axis alpha
05423    * @param[in]       Ibeta   input two-phase orthogonal vector axis beta
05424    * @param[out]      *pIa    points to output three-phase coordinate <code>a</code>
05425    * @param[out]      *pIb    points to output three-phase coordinate <code>b</code>
05426    * @return none.
05427    *
05428    * <b>Scaling and Overflow Behavior:</b>
05429    * \par
05430    * The function is implemented using an internal 32-bit accumulator.
05431    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
05432    * There is saturation on the subtraction, hence there is no risk of overflow.
05433    */
05434 
05435   static __INLINE void arm_inv_clarke_q31(
05436   q31_t Ialpha,
05437   q31_t Ibeta,
05438   q31_t * pIa,
05439   q31_t * pIb)
05440   {
05441     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
05442 
05443     /* Calculating pIa from Ialpha by equation pIa = Ialpha */
05444     *pIa = Ialpha;
05445 
05446     /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
05447     product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
05448 
05449     /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
05450     product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
05451 
05452     /* pIb is calculated by subtracting the products */
05453     *pIb = __QSUB(product2, product1);
05454 
05455   }
05456 
05457   /**
05458    * @} end of inv_clarke group
05459    */
05460 
05461   /**
05462    * @brief  Converts the elements of the Q7 vector to Q15 vector.
05463    * @param[in]  *pSrc     input pointer
05464    * @param[out] *pDst     output pointer
05465    * @param[in]  blockSize number of samples to process
05466    * @return none.
05467    */
05468   void arm_q7_to_q15(
05469   q7_t * pSrc,
05470   q15_t * pDst,
05471   uint32_t blockSize);
05472 
05473 
05474 
05475   /**
05476    * @ingroup groupController
05477    */
05478 
05479   /**
05480    * @defgroup park Vector Park Transform
05481    *
05482    * Forward Park transform converts the input two-coordinate vector to flux and torque components.
05483    * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
05484    * from the stationary to the moving reference frame and control the spatial relationship between
05485    * the stator vector current and rotor flux vector.
05486    * If we consider the d axis aligned with the rotor flux, the diagram below shows the
05487    * current vector and the relationship from the two reference frames:
05488    * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
05489    *
05490    * The function operates on a single sample of data and each call to the function returns the processed output.
05491    * The library provides separate functions for Q31 and floating-point data types.
05492    * \par Algorithm
05493    * \image html parkFormula.gif
05494    * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
05495    * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
05496    * cosine and sine values of theta (rotor flux position).
05497    * \par Fixed-Point Behavior
05498    * Care must be taken when using the Q31 version of the Park transform.
05499    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
05500    * Refer to the function specific documentation below for usage guidelines.
05501    */
05502 
05503   /**
05504    * @addtogroup park
05505    * @{
05506    */
05507 
05508   /**
05509    * @brief Floating-point Park transform
05510    * @param[in]       Ialpha input two-phase vector coordinate alpha
05511    * @param[in]       Ibeta  input two-phase vector coordinate beta
05512    * @param[out]      *pId   points to output   rotor reference frame d
05513    * @param[out]      *pIq   points to output   rotor reference frame q
05514    * @param[in]       sinVal sine value of rotation angle theta
05515    * @param[in]       cosVal cosine value of rotation angle theta
05516    * @return none.
05517    *
05518    * The function implements the forward Park transform.
05519    *
05520    */
05521 
05522   static __INLINE void arm_park_f32(
05523   float32_t Ialpha,
05524   float32_t Ibeta,
05525   float32_t * pId,
05526   float32_t * pIq,
05527   float32_t sinVal,
05528   float32_t cosVal)
05529   {
05530     /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
05531     *pId = Ialpha * cosVal + Ibeta * sinVal;
05532 
05533     /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
05534     *pIq = -Ialpha * sinVal + Ibeta * cosVal;
05535 
05536   }
05537 
05538   /**
05539    * @brief  Park transform for Q31 version
05540    * @param[in]       Ialpha input two-phase vector coordinate alpha
05541    * @param[in]       Ibeta  input two-phase vector coordinate beta
05542    * @param[out]      *pId   points to output rotor reference frame d
05543    * @param[out]      *pIq   points to output rotor reference frame q
05544    * @param[in]       sinVal sine value of rotation angle theta
05545    * @param[in]       cosVal cosine value of rotation angle theta
05546    * @return none.
05547    *
05548    * <b>Scaling and Overflow Behavior:</b>
05549    * \par
05550    * The function is implemented using an internal 32-bit accumulator.
05551    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
05552    * There is saturation on the addition and subtraction, hence there is no risk of overflow.
05553    */
05554 
05555 
05556   static __INLINE void arm_park_q31(
05557   q31_t Ialpha,
05558   q31_t Ibeta,
05559   q31_t * pId,
05560   q31_t * pIq,
05561   q31_t sinVal,
05562   q31_t cosVal)
05563   {
05564     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
05565     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
05566 
05567     /* Intermediate product is calculated by (Ialpha * cosVal) */
05568     product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
05569 
05570     /* Intermediate product is calculated by (Ibeta * sinVal) */
05571     product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
05572 
05573 
05574     /* Intermediate product is calculated by (Ialpha * sinVal) */
05575     product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
05576 
05577     /* Intermediate product is calculated by (Ibeta * cosVal) */
05578     product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
05579 
05580     /* Calculate pId by adding the two intermediate products 1 and 2 */
05581     *pId = __QADD(product1, product2);
05582 
05583     /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
05584     *pIq = __QSUB(product4, product3);
05585   }
05586 
05587   /**
05588    * @} end of park group
05589    */
05590 
05591   /**
05592    * @brief  Converts the elements of the Q7 vector to floating-point vector.
05593    * @param[in]  *pSrc is input pointer
05594    * @param[out]  *pDst is output pointer
05595    * @param[in]  blockSize is the number of samples to process
05596    * @return none.
05597    */
05598   void arm_q7_to_float(
05599   q7_t * pSrc,
05600   float32_t * pDst,
05601   uint32_t blockSize);
05602 
05603 
05604   /**
05605    * @ingroup groupController
05606    */
05607 
05608   /**
05609    * @defgroup inv_park Vector Inverse Park transform
05610    * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
05611    *
05612    * The function operates on a single sample of data and each call to the function returns the processed output.
05613    * The library provides separate functions for Q31 and floating-point data types.
05614    * \par Algorithm
05615    * \image html parkInvFormula.gif
05616    * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
05617    * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
05618    * cosine and sine values of theta (rotor flux position).
05619    * \par Fixed-Point Behavior
05620    * Care must be taken when using the Q31 version of the Park transform.
05621    * In particular, the overflow and saturation behavior of the accumulator used must be considered.
05622    * Refer to the function specific documentation below for usage guidelines.
05623    */
05624 
05625   /**
05626    * @addtogroup inv_park
05627    * @{
05628    */
05629 
05630    /**
05631    * @brief  Floating-point Inverse Park transform
05632    * @param[in]       Id        input coordinate of rotor reference frame d
05633    * @param[in]       Iq        input coordinate of rotor reference frame q
05634    * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha
05635    * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta
05636    * @param[in]       sinVal    sine value of rotation angle theta
05637    * @param[in]       cosVal    cosine value of rotation angle theta
05638    * @return none.
05639    */
05640 
05641   static __INLINE void arm_inv_park_f32(
05642   float32_t Id,
05643   float32_t Iq,
05644   float32_t * pIalpha,
05645   float32_t * pIbeta,
05646   float32_t sinVal,
05647   float32_t cosVal)
05648   {
05649     /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
05650     *pIalpha = Id * cosVal - Iq * sinVal;
05651 
05652     /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
05653     *pIbeta = Id * sinVal + Iq * cosVal;
05654 
05655   }
05656 
05657 
05658   /**
05659    * @brief  Inverse Park transform for Q31 version
05660    * @param[in]       Id        input coordinate of rotor reference frame d
05661    * @param[in]       Iq        input coordinate of rotor reference frame q
05662    * @param[out]      *pIalpha  points to output two-phase orthogonal vector axis alpha
05663    * @param[out]      *pIbeta   points to output two-phase orthogonal vector axis beta
05664    * @param[in]       sinVal    sine value of rotation angle theta
05665    * @param[in]       cosVal    cosine value of rotation angle theta
05666    * @return none.
05667    *
05668    * <b>Scaling and Overflow Behavior:</b>
05669    * \par
05670    * The function is implemented using an internal 32-bit accumulator.
05671    * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
05672    * There is saturation on the addition, hence there is no risk of overflow.
05673    */
05674 
05675 
05676   static __INLINE void arm_inv_park_q31(
05677   q31_t Id,
05678   q31_t Iq,
05679   q31_t * pIalpha,
05680   q31_t * pIbeta,
05681   q31_t sinVal,
05682   q31_t cosVal)
05683   {
05684     q31_t product1, product2;                    /* Temporary variables used to store intermediate results */
05685     q31_t product3, product4;                    /* Temporary variables used to store intermediate results */
05686 
05687     /* Intermediate product is calculated by (Id * cosVal) */
05688     product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
05689 
05690     /* Intermediate product is calculated by (Iq * sinVal) */
05691     product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
05692 
05693 
05694     /* Intermediate product is calculated by (Id * sinVal) */
05695     product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
05696 
05697     /* Intermediate product is calculated by (Iq * cosVal) */
05698     product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
05699 
05700     /* Calculate pIalpha by using the two intermediate products 1 and 2 */
05701     *pIalpha = __QSUB(product1, product2);
05702 
05703     /* Calculate pIbeta by using the two intermediate products 3 and 4 */
05704     *pIbeta = __QADD(product4, product3);
05705 
05706   }
05707 
05708   /**
05709    * @} end of Inverse park group
05710    */
05711 
05712 
05713   /**
05714    * @brief  Converts the elements of the Q31 vector to floating-point vector.
05715    * @param[in]  *pSrc is input pointer
05716    * @param[out]  *pDst is output pointer
05717    * @param[in]  blockSize is the number of samples to process
05718    * @return none.
05719    */
05720   void arm_q31_to_float(
05721   q31_t * pSrc,
05722   float32_t * pDst,
05723   uint32_t blockSize);
05724 
05725   /**
05726    * @ingroup groupInterpolation
05727    */
05728 
05729   /**
05730    * @defgroup LinearInterpolate Linear Interpolation
05731    *
05732    * Linear interpolation is a method of curve fitting using linear polynomials.
05733    * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
05734    *
05735    * \par
05736    * \image html LinearInterp.gif "Linear interpolation"
05737    *
05738    * \par
05739    * A  Linear Interpolate function calculates an output value(y), for the input(x)
05740    * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
05741    *
05742    * \par Algorithm:
05743    * <pre>
05744    *       y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
05745    *       where x0, x1 are nearest values of input x
05746    *             y0, y1 are nearest values to output y
05747    * </pre>
05748    *
05749    * \par
05750    * This set of functions implements Linear interpolation process
05751    * for Q7, Q15, Q31, and floating-point data types.  The functions operate on a single
05752    * sample of data and each call to the function returns a single processed value.
05753    * <code>S</code> points to an instance of the Linear Interpolate function data structure.
05754    * <code>x</code> is the input sample value. The functions returns the output value.
05755    *
05756    * \par
05757    * if x is outside of the table boundary, Linear interpolation returns first value of the table
05758    * if x is below input range and returns last value of table if x is above range.
05759    */
05760 
05761   /**
05762    * @addtogroup LinearInterpolate
05763    * @{
05764    */
05765 
05766   /**
05767    * @brief  Process function for the floating-point Linear Interpolation Function.
05768    * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
05769    * @param[in] x input sample to process
05770    * @return y processed output sample.
05771    *
05772    */
05773 
05774   static __INLINE float32_t arm_linear_interp_f32(
05775   arm_linear_interp_instance_f32 * S,
05776   float32_t x)
05777   {
05778 
05779     float32_t y;
05780     float32_t x0, x1;                            /* Nearest input values */
05781     float32_t y0, y1;                            /* Nearest output values */
05782     float32_t xSpacing = S->xSpacing;            /* spacing between input values */
05783     int32_t i;                                   /* Index variable */
05784     float32_t *pYData = S->pYData;               /* pointer to output table */
05785 
05786     /* Calculation of index */
05787     i = (int32_t) ((x - S->x1) / xSpacing);
05788 
05789     if(i < 0)
05790     {
05791       /* Iniatilize output for below specified range as least output value of table */
05792       y = pYData[0];
05793     }
05794     else if((uint32_t)i >= S->nValues)
05795     {
05796       /* Iniatilize output for above specified range as last output value of table */
05797       y = pYData[S->nValues - 1];
05798     }
05799     else
05800     {
05801       /* Calculation of nearest input values */
05802       x0 = S->x1 + i * xSpacing;
05803       x1 = S->x1 + (i + 1) * xSpacing;
05804 
05805       /* Read of nearest output values */
05806       y0 = pYData[i];
05807       y1 = pYData[i + 1];
05808 
05809       /* Calculation of output */
05810       y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
05811 
05812     }
05813 
05814     /* returns output value */
05815     return (y);
05816   }
05817 
05818    /**
05819    *
05820    * @brief  Process function for the Q31 Linear Interpolation Function.
05821    * @param[in] *pYData  pointer to Q31 Linear Interpolation table
05822    * @param[in] x input sample to process
05823    * @param[in] nValues number of table values
05824    * @return y processed output sample.
05825    *
05826    * \par
05827    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
05828    * This function can support maximum of table size 2^12.
05829    *
05830    */
05831 
05832 
05833   static __INLINE q31_t arm_linear_interp_q31(
05834   q31_t * pYData,
05835   q31_t x,
05836   uint32_t nValues)
05837   {
05838     q31_t y;                                     /* output */
05839     q31_t y0, y1;                                /* Nearest output values */
05840     q31_t fract;                                 /* fractional part */
05841     int32_t index;                               /* Index to read nearest output values */
05842 
05843     /* Input is in 12.20 format */
05844     /* 12 bits for the table index */
05845     /* Index value calculation */
05846     index = ((x & 0xFFF00000) >> 20);
05847 
05848     if(index >= (int32_t)(nValues - 1))
05849     {
05850       return (pYData[nValues - 1]);
05851     }
05852     else if(index < 0)
05853     {
05854       return (pYData[0]);
05855     }
05856     else
05857     {
05858 
05859       /* 20 bits for the fractional part */
05860       /* shift left by 11 to keep fract in 1.31 format */
05861       fract = (x & 0x000FFFFF) << 11;
05862 
05863       /* Read two nearest output values from the index in 1.31(q31) format */
05864       y0 = pYData[index];
05865       y1 = pYData[index + 1u];
05866 
05867       /* Calculation of y0 * (1-fract) and y is in 2.30 format */
05868       y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
05869 
05870       /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
05871       y += ((q31_t) (((q63_t) y1 * fract) >> 32));
05872 
05873       /* Convert y to 1.31 format */
05874       return (y << 1u);
05875 
05876     }
05877 
05878   }
05879 
05880   /**
05881    *
05882    * @brief  Process function for the Q15 Linear Interpolation Function.
05883    * @param[in] *pYData  pointer to Q15 Linear Interpolation table
05884    * @param[in] x input sample to process
05885    * @param[in] nValues number of table values
05886    * @return y processed output sample.
05887    *
05888    * \par
05889    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
05890    * This function can support maximum of table size 2^12.
05891    *
05892    */
05893 
05894 
05895   static __INLINE q15_t arm_linear_interp_q15(
05896   q15_t * pYData,
05897   q31_t x,
05898   uint32_t nValues)
05899   {
05900     q63_t y;                                     /* output */
05901     q15_t y0, y1;                                /* Nearest output values */
05902     q31_t fract;                                 /* fractional part */
05903     int32_t index;                               /* Index to read nearest output values */
05904 
05905     /* Input is in 12.20 format */
05906     /* 12 bits for the table index */
05907     /* Index value calculation */
05908     index = ((x & 0xFFF00000) >> 20u);
05909 
05910     if(index >= (int32_t)(nValues - 1))
05911     {
05912       return (pYData[nValues - 1]);
05913     }
05914     else if(index < 0)
05915     {
05916       return (pYData[0]);
05917     }
05918     else
05919     {
05920       /* 20 bits for the fractional part */
05921       /* fract is in 12.20 format */
05922       fract = (x & 0x000FFFFF);
05923 
05924       /* Read two nearest output values from the index */
05925       y0 = pYData[index];
05926       y1 = pYData[index + 1u];
05927 
05928       /* Calculation of y0 * (1-fract) and y is in 13.35 format */
05929       y = ((q63_t) y0 * (0xFFFFF - fract));
05930 
05931       /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
05932       y += ((q63_t) y1 * (fract));
05933 
05934       /* convert y to 1.15 format */
05935       return (y >> 20);
05936     }
05937 
05938 
05939   }
05940 
05941   /**
05942    *
05943    * @brief  Process function for the Q7 Linear Interpolation Function.
05944    * @param[in] *pYData  pointer to Q7 Linear Interpolation table
05945    * @param[in] x input sample to process
05946    * @param[in] nValues number of table values
05947    * @return y processed output sample.
05948    *
05949    * \par
05950    * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
05951    * This function can support maximum of table size 2^12.
05952    */
05953 
05954 
05955   static __INLINE q7_t arm_linear_interp_q7(
05956   q7_t * pYData,
05957   q31_t x,
05958   uint32_t nValues)
05959   {
05960     q31_t y;                                     /* output */
05961     q7_t y0, y1;                                 /* Nearest output values */
05962     q31_t fract;                                 /* fractional part */
05963     uint32_t index;                              /* Index to read nearest output values */
05964 
05965     /* Input is in 12.20 format */
05966     /* 12 bits for the table index */
05967     /* Index value calculation */
05968     if (x < 0)
05969     {
05970       return (pYData[0]);
05971     }
05972     index = (x >> 20) & 0xfff;
05973 
05974 
05975     if(index >= (nValues - 1))
05976     {
05977       return (pYData[nValues - 1]);
05978     }
05979     else
05980     {
05981 
05982       /* 20 bits for the fractional part */
05983       /* fract is in 12.20 format */
05984       fract = (x & 0x000FFFFF);
05985 
05986       /* Read two nearest output values from the index and are in 1.7(q7) format */
05987       y0 = pYData[index];
05988       y1 = pYData[index + 1u];
05989 
05990       /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
05991       y = ((y0 * (0xFFFFF - fract)));
05992 
05993       /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
05994       y += (y1 * fract);
05995 
05996       /* convert y to 1.7(q7) format */
05997       return (y >> 20u);
05998 
05999     }
06000 
06001   }
06002   /**
06003    * @} end of LinearInterpolate group
06004    */
06005 
06006   /**
06007    * @brief  Fast approximation to the trigonometric sine function for floating-point data.
06008    * @param[in] x input value in radians.
06009    * @return  sin(x).
06010    */
06011 
06012   float32_t arm_sin_f32(
06013   float32_t x);
06014 
06015   /**
06016    * @brief  Fast approximation to the trigonometric sine function for Q31 data.
06017    * @param[in] x Scaled input value in radians.
06018    * @return  sin(x).
06019    */
06020 
06021   q31_t arm_sin_q31(
06022   q31_t x);
06023 
06024   /**
06025    * @brief  Fast approximation to the trigonometric sine function for Q15 data.
06026    * @param[in] x Scaled input value in radians.
06027    * @return  sin(x).
06028    */
06029 
06030   q15_t arm_sin_q15(
06031   q15_t x);
06032 
06033   /**
06034    * @brief  Fast approximation to the trigonometric cosine function for floating-point data.
06035    * @param[in] x input value in radians.
06036    * @return  cos(x).
06037    */
06038 
06039   float32_t arm_cos_f32(
06040   float32_t x);
06041 
06042   /**
06043    * @brief Fast approximation to the trigonometric cosine function for Q31 data.
06044    * @param[in] x Scaled input value in radians.
06045    * @return  cos(x).
06046    */
06047 
06048   q31_t arm_cos_q31(
06049   q31_t x);
06050 
06051   /**
06052    * @brief  Fast approximation to the trigonometric cosine function for Q15 data.
06053    * @param[in] x Scaled input value in radians.
06054    * @return  cos(x).
06055    */
06056 
06057   q15_t arm_cos_q15(
06058   q15_t x);
06059 
06060 
06061   /**
06062    * @ingroup groupFastMath
06063    */
06064 
06065 
06066   /**
06067    * @defgroup SQRT Square Root
06068    *
06069    * Computes the square root of a number.
06070    * There are separate functions for Q15, Q31, and floating-point data types.
06071    * The square root function is computed using the Newton-Raphson algorithm.
06072    * This is an iterative algorithm of the form:
06073    * <pre>
06074    *      x1 = x0 - f(x0)/f'(x0)
06075    * </pre>
06076    * where <code>x1</code> is the current estimate,
06077    * <code>x0</code> is the previous estimate, and
06078    * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
06079    * For the square root function, the algorithm reduces to:
06080    * <pre>
06081    *     x0 = in/2                         [initial guess]
06082    *     x1 = 1/2 * ( x0 + in / x0)        [each iteration]
06083    * </pre>
06084    */
06085 
06086 
06087   /**
06088    * @addtogroup SQRT
06089    * @{
06090    */
06091 
06092   /**
06093    * @brief  Floating-point square root function.
06094    * @param[in]  in     input value.
06095    * @param[out] *pOut  square root of input value.
06096    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
06097    * <code>in</code> is negative value and returns zero output for negative values.
06098    */
06099 
06100   static __INLINE arm_status arm_sqrt_f32(
06101   float32_t in,
06102   float32_t * pOut)
06103   {
06104     if(in >= 0.0f)
06105     {
06106 
06107 //      #if __FPU_USED
06108 #if (__FPU_USED == 1) && defined ( __CC_ARM   )
06109       *pOut = __sqrtf(in);
06110 #else
06111       *pOut = sqrtf(in);
06112 #endif
06113 
06114       return (ARM_MATH_SUCCESS);
06115     }
06116     else
06117     {
06118       *pOut = 0.0f;
06119       return (ARM_MATH_ARGUMENT_ERROR);
06120     }
06121 
06122   }
06123 
06124 
06125   /**
06126    * @brief Q31 square root function.
06127    * @param[in]   in    input value.  The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
06128    * @param[out]  *pOut square root of input value.
06129    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
06130    * <code>in</code> is negative value and returns zero output for negative values.
06131    */
06132   arm_status arm_sqrt_q31(
06133   q31_t in,
06134   q31_t * pOut);
06135 
06136   /**
06137    * @brief  Q15 square root function.
06138    * @param[in]   in     input value.  The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
06139    * @param[out]  *pOut  square root of input value.
06140    * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
06141    * <code>in</code> is negative value and returns zero output for negative values.
06142    */
06143   arm_status arm_sqrt_q15(
06144   q15_t in,
06145   q15_t * pOut);
06146 
06147   /**
06148    * @} end of SQRT group
06149    */
06150 
06151 
06152 
06153 
06154 
06155 
06156   /**
06157    * @brief floating-point Circular write function.
06158    */
06159 
06160   static __INLINE void arm_circularWrite_f32(
06161   int32_t * circBuffer,
06162   int32_t L,
06163   uint16_t * writeOffset,
06164   int32_t bufferInc,
06165   const int32_t * src,
06166   int32_t srcInc,
06167   uint32_t blockSize)
06168   {
06169     uint32_t i = 0u;
06170     int32_t wOffset;
06171 
06172     /* Copy the value of Index pointer that points
06173      * to the current location where the input samples to be copied */
06174     wOffset = *writeOffset;
06175 
06176     /* Loop over the blockSize */
06177     i = blockSize;
06178 
06179     while(i > 0u)
06180     {
06181       /* copy the input sample to the circular buffer */
06182       circBuffer[wOffset] = *src;
06183 
06184       /* Update the input pointer */
06185       src += srcInc;
06186 
06187       /* Circularly update wOffset.  Watch out for positive and negative value */
06188       wOffset += bufferInc;
06189       if(wOffset >= L)
06190         wOffset -= L;
06191 
06192       /* Decrement the loop counter */
06193       i--;
06194     }
06195 
06196     /* Update the index pointer */
06197     *writeOffset = wOffset;
06198   }
06199 
06200 
06201 
06202   /**
06203    * @brief floating-point Circular Read function.
06204    */
06205   static __INLINE void arm_circularRead_f32(
06206   int32_t * circBuffer,
06207   int32_t L,
06208   int32_t * readOffset,
06209   int32_t bufferInc,
06210   int32_t * dst,
06211   int32_t * dst_base,
06212   int32_t dst_length,
06213   int32_t dstInc,
06214   uint32_t blockSize)
06215   {
06216     uint32_t i = 0u;
06217     int32_t rOffset, dst_end;
06218 
06219     /* Copy the value of Index pointer that points
06220      * to the current location from where the input samples to be read */
06221     rOffset = *readOffset;
06222     dst_end = (int32_t) (dst_base + dst_length);
06223 
06224     /* Loop over the blockSize */
06225     i = blockSize;
06226 
06227     while(i > 0u)
06228     {
06229       /* copy the sample from the circular buffer to the destination buffer */
06230       *dst = circBuffer[rOffset];
06231 
06232       /* Update the input pointer */
06233       dst += dstInc;
06234 
06235       if(dst == (int32_t *) dst_end)
06236       {
06237         dst = dst_base;
06238       }
06239 
06240       /* Circularly update rOffset.  Watch out for positive and negative value  */
06241       rOffset += bufferInc;
06242 
06243       if(rOffset >= L)
06244       {
06245         rOffset -= L;
06246       }
06247 
06248       /* Decrement the loop counter */
06249       i--;
06250     }
06251 
06252     /* Update the index pointer */
06253     *readOffset = rOffset;
06254   }
06255 
06256   /**
06257    * @brief Q15 Circular write function.
06258    */
06259 
06260   static __INLINE void arm_circularWrite_q15(
06261   q15_t * circBuffer,
06262   int32_t L,
06263   uint16_t * writeOffset,
06264   int32_t bufferInc,
06265   const q15_t * src,
06266   int32_t srcInc,
06267   uint32_t blockSize)
06268   {
06269     uint32_t i = 0u;
06270     int32_t wOffset;
06271 
06272     /* Copy the value of Index pointer that points
06273      * to the current location where the input samples to be copied */
06274     wOffset = *writeOffset;
06275 
06276     /* Loop over the blockSize */
06277     i = blockSize;
06278 
06279     while(i > 0u)
06280     {
06281       /* copy the input sample to the circular buffer */
06282       circBuffer[wOffset] = *src;
06283 
06284       /* Update the input pointer */
06285       src += srcInc;
06286 
06287       /* Circularly update wOffset.  Watch out for positive and negative value */
06288       wOffset += bufferInc;
06289       if(wOffset >= L)
06290         wOffset -= L;
06291 
06292       /* Decrement the loop counter */
06293       i--;
06294     }
06295 
06296     /* Update the index pointer */
06297     *writeOffset = wOffset;
06298   }
06299 
06300 
06301 
06302   /**
06303    * @brief Q15 Circular Read function.
06304    */
06305   static __INLINE void arm_circularRead_q15(
06306   q15_t * circBuffer,
06307   int32_t L,
06308   int32_t * readOffset,
06309   int32_t bufferInc,
06310   q15_t * dst,
06311   q15_t * dst_base,
06312   int32_t dst_length,
06313   int32_t dstInc,
06314   uint32_t blockSize)
06315   {
06316     uint32_t i = 0;
06317     int32_t rOffset, dst_end;
06318 
06319     /* Copy the value of Index pointer that points
06320      * to the current location from where the input samples to be read */
06321     rOffset = *readOffset;
06322 
06323     dst_end = (int32_t) (dst_base + dst_length);
06324 
06325     /* Loop over the blockSize */
06326     i = blockSize;
06327 
06328     while(i > 0u)
06329     {
06330       /* copy the sample from the circular buffer to the destination buffer */
06331       *dst = circBuffer[rOffset];
06332 
06333       /* Update the input pointer */
06334       dst += dstInc;
06335 
06336       if(dst == (q15_t *) dst_end)
06337       {
06338         dst = dst_base;
06339       }
06340 
06341       /* Circularly update wOffset.  Watch out for positive and negative value */
06342       rOffset += bufferInc;
06343 
06344       if(rOffset >= L)
06345       {
06346         rOffset -= L;
06347       }
06348 
06349       /* Decrement the loop counter */
06350       i--;
06351     }
06352 
06353     /* Update the index pointer */
06354     *readOffset = rOffset;
06355   }
06356 
06357 
06358   /**
06359    * @brief Q7 Circular write function.
06360    */
06361 
06362   static __INLINE void arm_circularWrite_q7(
06363   q7_t * circBuffer,
06364   int32_t L,
06365   uint16_t * writeOffset,
06366   int32_t bufferInc,
06367   const q7_t * src,
06368   int32_t srcInc,
06369   uint32_t blockSize)
06370   {
06371     uint32_t i = 0u;
06372     int32_t wOffset;
06373 
06374     /* Copy the value of Index pointer that points
06375      * to the current location where the input samples to be copied */
06376     wOffset = *writeOffset;
06377 
06378     /* Loop over the blockSize */
06379     i = blockSize;
06380 
06381     while(i > 0u)
06382     {
06383       /* copy the input sample to the circular buffer */
06384       circBuffer[wOffset] = *src;
06385 
06386       /* Update the input pointer */
06387       src += srcInc;
06388 
06389       /* Circularly update wOffset.  Watch out for positive and negative value */
06390       wOffset += bufferInc;
06391       if(wOffset >= L)
06392         wOffset -= L;
06393 
06394       /* Decrement the loop counter */
06395       i--;
06396     }
06397 
06398     /* Update the index pointer */
06399     *writeOffset = wOffset;
06400   }
06401 
06402 
06403 
06404   /**
06405    * @brief Q7 Circular Read function.
06406    */
06407   static __INLINE void arm_circularRead_q7(
06408   q7_t * circBuffer,
06409   int32_t L,
06410   int32_t * readOffset,
06411   int32_t bufferInc,
06412   q7_t * dst,
06413   q7_t * dst_base,
06414   int32_t dst_length,
06415   int32_t dstInc,
06416   uint32_t blockSize)
06417   {
06418     uint32_t i = 0;
06419     int32_t rOffset, dst_end;
06420 
06421     /* Copy the value of Index pointer that points
06422      * to the current location from where the input samples to be read */
06423     rOffset = *readOffset;
06424 
06425     dst_end = (int32_t) (dst_base + dst_length);
06426 
06427     /* Loop over the blockSize */
06428     i = blockSize;
06429 
06430     while(i > 0u)
06431     {
06432       /* copy the sample from the circular buffer to the destination buffer */
06433       *dst = circBuffer[rOffset];
06434 
06435       /* Update the input pointer */
06436       dst += dstInc;
06437 
06438       if(dst == (q7_t *) dst_end)
06439       {
06440         dst = dst_base;
06441       }
06442 
06443       /* Circularly update rOffset.  Watch out for positive and negative value */
06444       rOffset += bufferInc;
06445 
06446       if(rOffset >= L)
06447       {
06448         rOffset -= L;
06449       }
06450 
06451       /* Decrement the loop counter */
06452       i--;
06453     }
06454 
06455     /* Update the index pointer */
06456     *readOffset = rOffset;
06457   }
06458 
06459 
06460   /**
06461    * @brief  Sum of the squares of the elements of a Q31 vector.
06462    * @param[in]  *pSrc is input pointer
06463    * @param[in]  blockSize is the number of samples to process
06464    * @param[out]  *pResult is output value.
06465    * @return none.
06466    */
06467 
06468   void arm_power_q31(
06469   q31_t * pSrc,
06470   uint32_t blockSize,
06471   q63_t * pResult);
06472 
06473   /**
06474    * @brief  Sum of the squares of the elements of a floating-point vector.
06475    * @param[in]  *pSrc is input pointer
06476    * @param[in]  blockSize is the number of samples to process
06477    * @param[out]  *pResult is output value.
06478    * @return none.
06479    */
06480 
06481   void arm_power_f32(
06482   float32_t * pSrc,
06483   uint32_t blockSize,
06484   float32_t * pResult);
06485 
06486   /**
06487    * @brief  Sum of the squares of the elements of a Q15 vector.
06488    * @param[in]  *pSrc is input pointer
06489    * @param[in]  blockSize is the number of samples to process
06490    * @param[out]  *pResult is output value.
06491    * @return none.
06492    */
06493 
06494   void arm_power_q15(
06495   q15_t * pSrc,
06496   uint32_t blockSize,
06497   q63_t * pResult);
06498 
06499   /**
06500    * @brief  Sum of the squares of the elements of a Q7 vector.
06501    * @param[in]  *pSrc is input pointer
06502    * @param[in]  blockSize is the number of samples to process
06503    * @param[out]  *pResult is output value.
06504    * @return none.
06505    */
06506 
06507   void arm_power_q7(
06508   q7_t * pSrc,
06509   uint32_t blockSize,
06510   q31_t * pResult);
06511 
06512   /**
06513    * @brief  Mean value of a Q7 vector.
06514    * @param[in]  *pSrc is input pointer
06515    * @param[in]  blockSize is the number of samples to process
06516    * @param[out]  *pResult is output value.
06517    * @return none.
06518    */
06519 
06520   void arm_mean_q7(
06521   q7_t * pSrc,
06522   uint32_t blockSize,
06523   q7_t * pResult);
06524 
06525   /**
06526    * @brief  Mean value of a Q15 vector.
06527    * @param[in]  *pSrc is input pointer
06528    * @param[in]  blockSize is the number of samples to process
06529    * @param[out]  *pResult is output value.
06530    * @return none.
06531    */
06532   void arm_mean_q15(
06533   q15_t * pSrc,
06534   uint32_t blockSize,
06535   q15_t * pResult);
06536 
06537   /**
06538    * @brief  Mean value of a Q31 vector.
06539    * @param[in]  *pSrc is input pointer
06540    * @param[in]  blockSize is the number of samples to process
06541    * @param[out]  *pResult is output value.
06542    * @return none.
06543    */
06544   void arm_mean_q31(
06545   q31_t * pSrc,
06546   uint32_t blockSize,
06547   q31_t * pResult);
06548 
06549   /**
06550    * @brief  Mean value of a floating-point vector.
06551    * @param[in]  *pSrc is input pointer
06552    * @param[in]  blockSize is the number of samples to process
06553    * @param[out]  *pResult is output value.
06554    * @return none.
06555    */
06556   void arm_mean_f32(
06557   float32_t * pSrc,
06558   uint32_t blockSize,
06559   float32_t * pResult);
06560 
06561   /**
06562    * @brief  Variance of the elements of a floating-point vector.
06563    * @param[in]  *pSrc is input pointer
06564    * @param[in]  blockSize is the number of samples to process
06565    * @param[out]  *pResult is output value.
06566    * @return none.
06567    */
06568 
06569   void arm_var_f32(
06570   float32_t * pSrc,
06571   uint32_t blockSize,
06572   float32_t * pResult);
06573 
06574   /**
06575    * @brief  Variance of the elements of a Q31 vector.
06576    * @param[in]  *pSrc is input pointer
06577    * @param[in]  blockSize is the number of samples to process
06578    * @param[out]  *pResult is output value.
06579    * @return none.
06580    */
06581 
06582   void arm_var_q31(
06583   q31_t * pSrc,
06584   uint32_t blockSize,
06585   q31_t * pResult);
06586 
06587   /**
06588    * @brief  Variance of the elements of a Q15 vector.
06589    * @param[in]  *pSrc is input pointer
06590    * @param[in]  blockSize is the number of samples to process
06591    * @param[out]  *pResult is output value.
06592    * @return none.
06593    */
06594 
06595   void arm_var_q15(
06596   q15_t * pSrc,
06597   uint32_t blockSize,
06598   q15_t * pResult);
06599 
06600   /**
06601    * @brief  Root Mean Square of the elements of a floating-point vector.
06602    * @param[in]  *pSrc is input pointer
06603    * @param[in]  blockSize is the number of samples to process
06604    * @param[out]  *pResult is output value.
06605    * @return none.
06606    */
06607 
06608   void arm_rms_f32(
06609   float32_t * pSrc,
06610   uint32_t blockSize,
06611   float32_t * pResult);
06612 
06613   /**
06614    * @brief  Root Mean Square of the elements of a Q31 vector.
06615    * @param[in]  *pSrc is input pointer
06616    * @param[in]  blockSize is the number of samples to process
06617    * @param[out]  *pResult is output value.
06618    * @return none.
06619    */
06620 
06621   void arm_rms_q31(
06622   q31_t * pSrc,
06623   uint32_t blockSize,
06624   q31_t * pResult);
06625 
06626   /**
06627    * @brief  Root Mean Square of the elements of a Q15 vector.
06628    * @param[in]  *pSrc is input pointer
06629    * @param[in]  blockSize is the number of samples to process
06630    * @param[out]  *pResult is output value.
06631    * @return none.
06632    */
06633 
06634   void arm_rms_q15(
06635   q15_t * pSrc,
06636   uint32_t blockSize,
06637   q15_t * pResult);
06638 
06639   /**
06640    * @brief  Standard deviation of the elements of a floating-point vector.
06641    * @param[in]  *pSrc is input pointer
06642    * @param[in]  blockSize is the number of samples to process
06643    * @param[out]  *pResult is output value.
06644    * @return none.
06645    */
06646 
06647   void arm_std_f32(
06648   float32_t * pSrc,
06649   uint32_t blockSize,
06650   float32_t * pResult);
06651 
06652   /**
06653    * @brief  Standard deviation of the elements of a Q31 vector.
06654    * @param[in]  *pSrc is input pointer
06655    * @param[in]  blockSize is the number of samples to process
06656    * @param[out]  *pResult is output value.
06657    * @return none.
06658    */
06659 
06660   void arm_std_q31(
06661   q31_t * pSrc,
06662   uint32_t blockSize,
06663   q31_t * pResult);
06664 
06665   /**
06666    * @brief  Standard deviation of the elements of a Q15 vector.
06667    * @param[in]  *pSrc is input pointer
06668    * @param[in]  blockSize is the number of samples to process
06669    * @param[out]  *pResult is output value.
06670    * @return none.
06671    */
06672 
06673   void arm_std_q15(
06674   q15_t * pSrc,
06675   uint32_t blockSize,
06676   q15_t * pResult);
06677 
06678   /**
06679    * @brief  Floating-point complex magnitude
06680    * @param[in]  *pSrc points to the complex input vector
06681    * @param[out]  *pDst points to the real output vector
06682    * @param[in]  numSamples number of complex samples in the input vector
06683    * @return none.
06684    */
06685 
06686   void arm_cmplx_mag_f32(
06687   float32_t * pSrc,
06688   float32_t * pDst,
06689   uint32_t numSamples);
06690 
06691   /**
06692    * @brief  Q31 complex magnitude
06693    * @param[in]  *pSrc points to the complex input vector
06694    * @param[out]  *pDst points to the real output vector
06695    * @param[in]  numSamples number of complex samples in the input vector
06696    * @return none.
06697    */
06698 
06699   void arm_cmplx_mag_q31(
06700   q31_t * pSrc,
06701   q31_t * pDst,
06702   uint32_t numSamples);
06703 
06704   /**
06705    * @brief  Q15 complex magnitude
06706    * @param[in]  *pSrc points to the complex input vector
06707    * @param[out]  *pDst points to the real output vector
06708    * @param[in]  numSamples number of complex samples in the input vector
06709    * @return none.
06710    */
06711 
06712   void arm_cmplx_mag_q15(
06713   q15_t * pSrc,
06714   q15_t * pDst,
06715   uint32_t numSamples);
06716 
06717   /**
06718    * @brief  Q15 complex dot product
06719    * @param[in]  *pSrcA points to the first input vector
06720    * @param[in]  *pSrcB points to the second input vector
06721    * @param[in]  numSamples number of complex samples in each vector
06722    * @param[out]  *realResult real part of the result returned here
06723    * @param[out]  *imagResult imaginary part of the result returned here
06724    * @return none.
06725    */
06726 
06727   void arm_cmplx_dot_prod_q15(
06728   q15_t * pSrcA,
06729   q15_t * pSrcB,
06730   uint32_t numSamples,
06731   q31_t * realResult,
06732   q31_t * imagResult);
06733 
06734   /**
06735    * @brief  Q31 complex dot product
06736    * @param[in]  *pSrcA points to the first input vector
06737    * @param[in]  *pSrcB points to the second input vector
06738    * @param[in]  numSamples number of complex samples in each vector
06739    * @param[out]  *realResult real part of the result returned here
06740    * @param[out]  *imagResult imaginary part of the result returned here
06741    * @return none.
06742    */
06743 
06744   void arm_cmplx_dot_prod_q31(
06745   q31_t * pSrcA,
06746   q31_t * pSrcB,
06747   uint32_t numSamples,
06748   q63_t * realResult,
06749   q63_t * imagResult);
06750 
06751   /**
06752    * @brief  Floating-point complex dot product
06753    * @param[in]  *pSrcA points to the first input vector
06754    * @param[in]  *pSrcB points to the second input vector
06755    * @param[in]  numSamples number of complex samples in each vector
06756    * @param[out]  *realResult real part of the result returned here
06757    * @param[out]  *imagResult imaginary part of the result returned here
06758    * @return none.
06759    */
06760 
06761   void arm_cmplx_dot_prod_f32(
06762   float32_t * pSrcA,
06763   float32_t * pSrcB,
06764   uint32_t numSamples,
06765   float32_t * realResult,
06766   float32_t * imagResult);
06767 
06768   /**
06769    * @brief  Q15 complex-by-real multiplication
06770    * @param[in]  *pSrcCmplx points to the complex input vector
06771    * @param[in]  *pSrcReal points to the real input vector
06772    * @param[out]  *pCmplxDst points to the complex output vector
06773    * @param[in]  numSamples number of samples in each vector
06774    * @return none.
06775    */
06776 
06777   void arm_cmplx_mult_real_q15(
06778   q15_t * pSrcCmplx,
06779   q15_t * pSrcReal,
06780   q15_t * pCmplxDst,
06781   uint32_t numSamples);
06782 
06783   /**
06784    * @brief  Q31 complex-by-real multiplication
06785    * @param[in]  *pSrcCmplx points to the complex input vector
06786    * @param[in]  *pSrcReal points to the real input vector
06787    * @param[out]  *pCmplxDst points to the complex output vector
06788    * @param[in]  numSamples number of samples in each vector
06789    * @return none.
06790    */
06791 
06792   void arm_cmplx_mult_real_q31(
06793   q31_t * pSrcCmplx,
06794   q31_t * pSrcReal,
06795   q31_t * pCmplxDst,
06796   uint32_t numSamples);
06797 
06798   /**
06799    * @brief  Floating-point complex-by-real multiplication
06800    * @param[in]  *pSrcCmplx points to the complex input vector
06801    * @param[in]  *pSrcReal points to the real input vector
06802    * @param[out]  *pCmplxDst points to the complex output vector
06803    * @param[in]  numSamples number of samples in each vector
06804    * @return none.
06805    */
06806 
06807   void arm_cmplx_mult_real_f32(
06808   float32_t * pSrcCmplx,
06809   float32_t * pSrcReal,
06810   float32_t * pCmplxDst,
06811   uint32_t numSamples);
06812 
06813   /**
06814    * @brief  Minimum value of a Q7 vector.
06815    * @param[in]  *pSrc is input pointer
06816    * @param[in]  blockSize is the number of samples to process
06817    * @param[out]  *result is output pointer
06818    * @param[in]  index is the array index of the minimum value in the input buffer.
06819    * @return none.
06820    */
06821 
06822   void arm_min_q7(
06823   q7_t * pSrc,
06824   uint32_t blockSize,
06825   q7_t * result,
06826   uint32_t * index);
06827 
06828   /**
06829    * @brief  Minimum value of a Q15 vector.
06830    * @param[in]  *pSrc is input pointer
06831    * @param[in]  blockSize is the number of samples to process
06832    * @param[out]  *pResult is output pointer
06833    * @param[in]  *pIndex is the array index of the minimum value in the input buffer.
06834    * @return none.
06835    */
06836 
06837   void arm_min_q15(
06838   q15_t * pSrc,
06839   uint32_t blockSize,
06840   q15_t * pResult,
06841   uint32_t * pIndex);
06842 
06843   /**
06844    * @brief  Minimum value of a Q31 vector.
06845    * @param[in]  *pSrc is input pointer
06846    * @param[in]  blockSize is the number of samples to process
06847    * @param[out]  *pResult is output pointer
06848    * @param[out]  *pIndex is the array index of the minimum value in the input buffer.
06849    * @return none.
06850    */
06851   void arm_min_q31(
06852   q31_t * pSrc,
06853   uint32_t blockSize,
06854   q31_t * pResult,
06855   uint32_t * pIndex);
06856 
06857   /**
06858    * @brief  Minimum value of a floating-point vector.
06859    * @param[in]  *pSrc is input pointer
06860    * @param[in]  blockSize is the number of samples to process
06861    * @param[out]  *pResult is output pointer
06862    * @param[out]  *pIndex is the array index of the minimum value in the input buffer.
06863    * @return none.
06864    */
06865 
06866   void arm_min_f32(
06867   float32_t * pSrc,
06868   uint32_t blockSize,
06869   float32_t * pResult,
06870   uint32_t * pIndex);
06871 
06872 /**
06873  * @brief Maximum value of a Q7 vector.
06874  * @param[in]       *pSrc points to the input buffer
06875  * @param[in]       blockSize length of the input vector
06876  * @param[out]      *pResult maximum value returned here
06877  * @param[out]      *pIndex index of maximum value returned here
06878  * @return none.
06879  */
06880 
06881   void arm_max_q7(
06882   q7_t * pSrc,
06883   uint32_t blockSize,
06884   q7_t * pResult,
06885   uint32_t * pIndex);
06886 
06887 /**
06888  * @brief Maximum value of a Q15 vector.
06889  * @param[in]       *pSrc points to the input buffer
06890  * @param[in]       blockSize length of the input vector
06891  * @param[out]      *pResult maximum value returned here
06892  * @param[out]      *pIndex index of maximum value returned here
06893  * @return none.
06894  */
06895 
06896   void arm_max_q15(
06897   q15_t * pSrc,
06898   uint32_t blockSize,
06899   q15_t * pResult,
06900   uint32_t * pIndex);
06901 
06902 /**
06903  * @brief Maximum value of a Q31 vector.
06904  * @param[in]       *pSrc points to the input buffer
06905  * @param[in]       blockSize length of the input vector
06906  * @param[out]      *pResult maximum value returned here
06907  * @param[out]      *pIndex index of maximum value returned here
06908  * @return none.
06909  */
06910 
06911   void arm_max_q31(
06912   q31_t * pSrc,
06913   uint32_t blockSize,
06914   q31_t * pResult,
06915   uint32_t * pIndex);
06916 
06917 /**
06918  * @brief Maximum value of a floating-point vector.
06919  * @param[in]       *pSrc points to the input buffer
06920  * @param[in]       blockSize length of the input vector
06921  * @param[out]      *pResult maximum value returned here
06922  * @param[out]      *pIndex index of maximum value returned here
06923  * @return none.
06924  */
06925 
06926   void arm_max_f32(
06927   float32_t * pSrc,
06928   uint32_t blockSize,
06929   float32_t * pResult,
06930   uint32_t * pIndex);
06931 
06932   /**
06933    * @brief  Q15 complex-by-complex multiplication
06934    * @param[in]  *pSrcA points to the first input vector
06935    * @param[in]  *pSrcB points to the second input vector
06936    * @param[out]  *pDst  points to the output vector
06937    * @param[in]  numSamples number of complex samples in each vector
06938    * @return none.
06939    */
06940 
06941   void arm_cmplx_mult_cmplx_q15(
06942   q15_t * pSrcA,
06943   q15_t * pSrcB,
06944   q15_t * pDst,
06945   uint32_t numSamples);
06946 
06947   /**
06948    * @brief  Q31 complex-by-complex multiplication
06949    * @param[in]  *pSrcA points to the first input vector
06950    * @param[in]  *pSrcB points to the second input vector
06951    * @param[out]  *pDst  points to the output vector
06952    * @param[in]  numSamples number of complex samples in each vector
06953    * @return none.
06954    */
06955 
06956   void arm_cmplx_mult_cmplx_q31(
06957   q31_t * pSrcA,
06958   q31_t * pSrcB,
06959   q31_t * pDst,
06960   uint32_t numSamples);
06961 
06962   /**
06963    * @brief  Floating-point complex-by-complex multiplication
06964    * @param[in]  *pSrcA points to the first input vector
06965    * @param[in]  *pSrcB points to the second input vector
06966    * @param[out]  *pDst  points to the output vector
06967    * @param[in]  numSamples number of complex samples in each vector
06968    * @return none.
06969    */
06970 
06971   void arm_cmplx_mult_cmplx_f32(
06972   float32_t * pSrcA,
06973   float32_t * pSrcB,
06974   float32_t * pDst,
06975   uint32_t numSamples);
06976 
06977   /**
06978    * @brief Converts the elements of the floating-point vector to Q31 vector.
06979    * @param[in]       *pSrc points to the floating-point input vector
06980    * @param[out]      *pDst points to the Q31 output vector
06981    * @param[in]       blockSize length of the input vector
06982    * @return none.
06983    */
06984   void arm_float_to_q31(
06985   float32_t * pSrc,
06986   q31_t * pDst,
06987   uint32_t blockSize);
06988 
06989   /**
06990    * @brief Converts the elements of the floating-point vector to Q15 vector.
06991    * @param[in]       *pSrc points to the floating-point input vector
06992    * @param[out]      *pDst points to the Q15 output vector
06993    * @param[in]       blockSize length of the input vector
06994    * @return          none
06995    */
06996   void arm_float_to_q15(
06997   float32_t * pSrc,
06998   q15_t * pDst,
06999   uint32_t blockSize);
07000 
07001   /**
07002    * @brief Converts the elements of the floating-point vector to Q7 vector.
07003    * @param[in]       *pSrc points to the floating-point input vector
07004    * @param[out]      *pDst points to the Q7 output vector
07005    * @param[in]       blockSize length of the input vector
07006    * @return          none
07007    */
07008   void arm_float_to_q7(
07009   float32_t * pSrc,
07010   q7_t * pDst,
07011   uint32_t blockSize);
07012 
07013 
07014   /**
07015    * @brief  Converts the elements of the Q31 vector to Q15 vector.
07016    * @param[in]  *pSrc is input pointer
07017    * @param[out]  *pDst is output pointer
07018    * @param[in]  blockSize is the number of samples to process
07019    * @return none.
07020    */
07021   void arm_q31_to_q15(
07022   q31_t * pSrc,
07023   q15_t * pDst,
07024   uint32_t blockSize);
07025 
07026   /**
07027    * @brief  Converts the elements of the Q31 vector to Q7 vector.
07028    * @param[in]  *pSrc is input pointer
07029    * @param[out]  *pDst is output pointer
07030    * @param[in]  blockSize is the number of samples to process
07031    * @return none.
07032    */
07033   void arm_q31_to_q7(
07034   q31_t * pSrc,
07035   q7_t * pDst,
07036   uint32_t blockSize);
07037 
07038   /**
07039    * @brief  Converts the elements of the Q15 vector to floating-point vector.
07040    * @param[in]  *pSrc is input pointer
07041    * @param[out]  *pDst is output pointer
07042    * @param[in]  blockSize is the number of samples to process
07043    * @return none.
07044    */
07045   void arm_q15_to_float(
07046   q15_t * pSrc,
07047   float32_t * pDst,
07048   uint32_t blockSize);
07049 
07050 
07051   /**
07052    * @brief  Converts the elements of the Q15 vector to Q31 vector.
07053    * @param[in]  *pSrc is input pointer
07054    * @param[out]  *pDst is output pointer
07055    * @param[in]  blockSize is the number of samples to process
07056    * @return none.
07057    */
07058   void arm_q15_to_q31(
07059   q15_t * pSrc,
07060   q31_t * pDst,
07061   uint32_t blockSize);
07062 
07063 
07064   /**
07065    * @brief  Converts the elements of the Q15 vector to Q7 vector.
07066    * @param[in]  *pSrc is input pointer
07067    * @param[out]  *pDst is output pointer
07068    * @param[in]  blockSize is the number of samples to process
07069    * @return none.
07070    */
07071   void arm_q15_to_q7(
07072   q15_t * pSrc,
07073   q7_t * pDst,
07074   uint32_t blockSize);
07075 
07076 
07077   /**
07078    * @ingroup groupInterpolation
07079    */
07080 
07081   /**
07082    * @defgroup BilinearInterpolate Bilinear Interpolation
07083    *
07084    * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
07085    * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
07086    * determines values between the grid points.
07087    * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
07088    * Bilinear interpolation is often used in image processing to rescale images.
07089    * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
07090    *
07091    * <b>Algorithm</b>
07092    * \par
07093    * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
07094    * For floating-point, the instance structure is defined as:
07095    * <pre>
07096    *   typedef struct
07097    *   {
07098    *     uint16_t numRows;
07099    *     uint16_t numCols;
07100    *     float32_t *pData;
07101    * } arm_bilinear_interp_instance_f32;
07102    * </pre>
07103    *
07104    * \par
07105    * where <code>numRows</code> specifies the number of rows in the table;
07106    * <code>numCols</code> specifies the number of columns in the table;
07107    * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
07108    * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
07109    * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
07110    *
07111    * \par
07112    * Let <code>(x, y)</code> specify the desired interpolation point.  Then define:
07113    * <pre>
07114    *     XF = floor(x)
07115    *     YF = floor(y)
07116    * </pre>
07117    * \par
07118    * The interpolated output point is computed as:
07119    * <pre>
07120    *  f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
07121    *           + f(XF+1, YF) * (x-XF)*(1-(y-YF))
07122    *           + f(XF, YF+1) * (1-(x-XF))*(y-YF)
07123    *           + f(XF+1, YF+1) * (x-XF)*(y-YF)
07124    * </pre>
07125    * Note that the coordinates (x, y) contain integer and fractional components.
07126    * The integer components specify which portion of the table to use while the
07127    * fractional components control the interpolation processor.
07128    *
07129    * \par
07130    * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
07131    */
07132 
07133   /**
07134    * @addtogroup BilinearInterpolate
07135    * @{
07136    */
07137 
07138   /**
07139   *
07140   * @brief  Floating-point bilinear interpolation.
07141   * @param[in,out] *S points to an instance of the interpolation structure.
07142   * @param[in] X interpolation coordinate.
07143   * @param[in] Y interpolation coordinate.
07144   * @return out interpolated value.
07145   */
07146 
07147 
07148   static __INLINE float32_t arm_bilinear_interp_f32(
07149   const arm_bilinear_interp_instance_f32 * S,
07150   float32_t X,
07151   float32_t Y)
07152   {
07153     float32_t out;
07154     float32_t f00, f01, f10, f11;
07155     float32_t *pData = S->pData;
07156     int32_t xIndex, yIndex, index;
07157     float32_t xdiff, ydiff;
07158     float32_t b1, b2, b3, b4;
07159 
07160     xIndex = (int32_t) X;
07161     yIndex = (int32_t) Y;
07162 
07163     /* Care taken for table outside boundary */
07164     /* Returns zero output when values are outside table boundary */
07165     if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
07166        || yIndex > (S->numCols - 1))
07167     {
07168       return (0);
07169     }
07170 
07171     /* Calculation of index for two nearest points in X-direction */
07172     index = (xIndex - 1) + (yIndex - 1) * S->numCols;
07173 
07174 
07175     /* Read two nearest points in X-direction */
07176     f00 = pData[index];
07177     f01 = pData[index + 1];
07178 
07179     /* Calculation of index for two nearest points in Y-direction */
07180     index = (xIndex - 1) + (yIndex) * S->numCols;
07181 
07182 
07183     /* Read two nearest points in Y-direction */
07184     f10 = pData[index];
07185     f11 = pData[index + 1];
07186 
07187     /* Calculation of intermediate values */
07188     b1 = f00;
07189     b2 = f01 - f00;
07190     b3 = f10 - f00;
07191     b4 = f00 - f01 - f10 + f11;
07192 
07193     /* Calculation of fractional part in X */
07194     xdiff = X - xIndex;
07195 
07196     /* Calculation of fractional part in Y */
07197     ydiff = Y - yIndex;
07198 
07199     /* Calculation of bi-linear interpolated output */
07200     out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
07201 
07202     /* return to application */
07203     return (out);
07204 
07205   }
07206 
07207   /**
07208   *
07209   * @brief  Q31 bilinear interpolation.
07210   * @param[in,out] *S points to an instance of the interpolation structure.
07211   * @param[in] X interpolation coordinate in 12.20 format.
07212   * @param[in] Y interpolation coordinate in 12.20 format.
07213   * @return out interpolated value.
07214   */
07215 
07216   static __INLINE q31_t arm_bilinear_interp_q31(
07217   arm_bilinear_interp_instance_q31 * S,
07218   q31_t X,
07219   q31_t Y)
07220   {
07221     q31_t out;                                   /* Temporary output */
07222     q31_t acc = 0;                               /* output */
07223     q31_t xfract, yfract;                        /* X, Y fractional parts */
07224     q31_t x1, x2, y1, y2;                        /* Nearest output values */
07225     int32_t rI, cI;                              /* Row and column indices */
07226     q31_t *pYData = S->pData;                    /* pointer to output table values */
07227     uint32_t nCols = S->numCols;                 /* num of rows */
07228 
07229 
07230     /* Input is in 12.20 format */
07231     /* 12 bits for the table index */
07232     /* Index value calculation */
07233     rI = ((X & 0xFFF00000) >> 20u);
07234 
07235     /* Input is in 12.20 format */
07236     /* 12 bits for the table index */
07237     /* Index value calculation */
07238     cI = ((Y & 0xFFF00000) >> 20u);
07239 
07240     /* Care taken for table outside boundary */
07241     /* Returns zero output when values are outside table boundary */
07242     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
07243     {
07244       return (0);
07245     }
07246 
07247     /* 20 bits for the fractional part */
07248     /* shift left xfract by 11 to keep 1.31 format */
07249     xfract = (X & 0x000FFFFF) << 11u;
07250 
07251     /* Read two nearest output values from the index */
07252     x1 = pYData[(rI) + nCols * (cI)];
07253     x2 = pYData[(rI) + nCols * (cI) + 1u];
07254 
07255     /* 20 bits for the fractional part */
07256     /* shift left yfract by 11 to keep 1.31 format */
07257     yfract = (Y & 0x000FFFFF) << 11u;
07258 
07259     /* Read two nearest output values from the index */
07260     y1 = pYData[(rI) + nCols * (cI + 1)];
07261     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
07262 
07263     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
07264     out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
07265     acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
07266 
07267     /* x2 * (xfract) * (1-yfract)  in 3.29(q29) and adding to acc */
07268     out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
07269     acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
07270 
07271     /* y1 * (1 - xfract) * (yfract)  in 3.29(q29) and adding to acc */
07272     out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
07273     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
07274 
07275     /* y2 * (xfract) * (yfract)  in 3.29(q29) and adding to acc */
07276     out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
07277     acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
07278 
07279     /* Convert acc to 1.31(q31) format */
07280     return (acc << 2u);
07281 
07282   }
07283 
07284   /**
07285   * @brief  Q15 bilinear interpolation.
07286   * @param[in,out] *S points to an instance of the interpolation structure.
07287   * @param[in] X interpolation coordinate in 12.20 format.
07288   * @param[in] Y interpolation coordinate in 12.20 format.
07289   * @return out interpolated value.
07290   */
07291 
07292   static __INLINE q15_t arm_bilinear_interp_q15(
07293   arm_bilinear_interp_instance_q15 * S,
07294   q31_t X,
07295   q31_t Y)
07296   {
07297     q63_t acc = 0;                               /* output */
07298     q31_t out;                                   /* Temporary output */
07299     q15_t x1, x2, y1, y2;                        /* Nearest output values */
07300     q31_t xfract, yfract;                        /* X, Y fractional parts */
07301     int32_t rI, cI;                              /* Row and column indices */
07302     q15_t *pYData = S->pData;                    /* pointer to output table values */
07303     uint32_t nCols = S->numCols;                 /* num of rows */
07304 
07305     /* Input is in 12.20 format */
07306     /* 12 bits for the table index */
07307     /* Index value calculation */
07308     rI = ((X & 0xFFF00000) >> 20);
07309 
07310     /* Input is in 12.20 format */
07311     /* 12 bits for the table index */
07312     /* Index value calculation */
07313     cI = ((Y & 0xFFF00000) >> 20);
07314 
07315     /* Care taken for table outside boundary */
07316     /* Returns zero output when values are outside table boundary */
07317     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
07318     {
07319       return (0);
07320     }
07321 
07322     /* 20 bits for the fractional part */
07323     /* xfract should be in 12.20 format */
07324     xfract = (X & 0x000FFFFF);
07325 
07326     /* Read two nearest output values from the index */
07327     x1 = pYData[(rI) + nCols * (cI)];
07328     x2 = pYData[(rI) + nCols * (cI) + 1u];
07329 
07330 
07331     /* 20 bits for the fractional part */
07332     /* yfract should be in 12.20 format */
07333     yfract = (Y & 0x000FFFFF);
07334 
07335     /* Read two nearest output values from the index */
07336     y1 = pYData[(rI) + nCols * (cI + 1)];
07337     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
07338 
07339     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
07340 
07341     /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
07342     /* convert 13.35 to 13.31 by right shifting  and out is in 1.31 */
07343     out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
07344     acc = ((q63_t) out * (0xFFFFF - yfract));
07345 
07346     /* x2 * (xfract) * (1-yfract)  in 1.51 and adding to acc */
07347     out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
07348     acc += ((q63_t) out * (xfract));
07349 
07350     /* y1 * (1 - xfract) * (yfract)  in 1.51 and adding to acc */
07351     out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
07352     acc += ((q63_t) out * (yfract));
07353 
07354     /* y2 * (xfract) * (yfract)  in 1.51 and adding to acc */
07355     out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
07356     acc += ((q63_t) out * (yfract));
07357 
07358     /* acc is in 13.51 format and down shift acc by 36 times */
07359     /* Convert out to 1.15 format */
07360     return (acc >> 36);
07361 
07362   }
07363 
07364   /**
07365   * @brief  Q7 bilinear interpolation.
07366   * @param[in,out] *S points to an instance of the interpolation structure.
07367   * @param[in] X interpolation coordinate in 12.20 format.
07368   * @param[in] Y interpolation coordinate in 12.20 format.
07369   * @return out interpolated value.
07370   */
07371 
07372   static __INLINE q7_t arm_bilinear_interp_q7(
07373   arm_bilinear_interp_instance_q7 * S,
07374   q31_t X,
07375   q31_t Y)
07376   {
07377     q63_t acc = 0;                               /* output */
07378     q31_t out;                                   /* Temporary output */
07379     q31_t xfract, yfract;                        /* X, Y fractional parts */
07380     q7_t x1, x2, y1, y2;                         /* Nearest output values */
07381     int32_t rI, cI;                              /* Row and column indices */
07382     q7_t *pYData = S->pData;                     /* pointer to output table values */
07383     uint32_t nCols = S->numCols;                 /* num of rows */
07384 
07385     /* Input is in 12.20 format */
07386     /* 12 bits for the table index */
07387     /* Index value calculation */
07388     rI = ((X & 0xFFF00000) >> 20);
07389 
07390     /* Input is in 12.20 format */
07391     /* 12 bits for the table index */
07392     /* Index value calculation */
07393     cI = ((Y & 0xFFF00000) >> 20);
07394 
07395     /* Care taken for table outside boundary */
07396     /* Returns zero output when values are outside table boundary */
07397     if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
07398     {
07399       return (0);
07400     }
07401 
07402     /* 20 bits for the fractional part */
07403     /* xfract should be in 12.20 format */
07404     xfract = (X & 0x000FFFFF);
07405 
07406     /* Read two nearest output values from the index */
07407     x1 = pYData[(rI) + nCols * (cI)];
07408     x2 = pYData[(rI) + nCols * (cI) + 1u];
07409 
07410 
07411     /* 20 bits for the fractional part */
07412     /* yfract should be in 12.20 format */
07413     yfract = (Y & 0x000FFFFF);
07414 
07415     /* Read two nearest output values from the index */
07416     y1 = pYData[(rI) + nCols * (cI + 1)];
07417     y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
07418 
07419     /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
07420     out = ((x1 * (0xFFFFF - xfract)));
07421     acc = (((q63_t) out * (0xFFFFF - yfract)));
07422 
07423     /* x2 * (xfract) * (1-yfract)  in 2.22 and adding to acc */
07424     out = ((x2 * (0xFFFFF - yfract)));
07425     acc += (((q63_t) out * (xfract)));
07426 
07427     /* y1 * (1 - xfract) * (yfract)  in 2.22 and adding to acc */
07428     out = ((y1 * (0xFFFFF - xfract)));
07429     acc += (((q63_t) out * (yfract)));
07430 
07431     /* y2 * (xfract) * (yfract)  in 2.22 and adding to acc */
07432     out = ((y2 * (yfract)));
07433     acc += (((q63_t) out * (xfract)));
07434 
07435     /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
07436     return (acc >> 40);
07437 
07438   }
07439 
07440   /**
07441    * @} end of BilinearInterpolate group
07442    */
07443    
07444 
07445 //SMMLAR
07446 #define multAcc_32x32_keep32_R(a, x, y) \
07447     a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
07448 
07449 //SMMLSR
07450 #define multSub_32x32_keep32_R(a, x, y) \
07451     a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
07452 
07453 //SMMULR
07454 #define mult_32x32_keep32_R(a, x, y) \
07455     a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
07456 
07457 //SMMLA
07458 #define multAcc_32x32_keep32(a, x, y) \
07459     a += (q31_t) (((q63_t) x * y) >> 32)
07460 
07461 //SMMLS
07462 #define multSub_32x32_keep32(a, x, y) \
07463     a -= (q31_t) (((q63_t) x * y) >> 32)
07464 
07465 //SMMUL
07466 #define mult_32x32_keep32(a, x, y) \
07467     a = (q31_t) (((q63_t) x * y ) >> 32)
07468 
07469 
07470 #if defined ( __CC_ARM ) //Keil
07471 
07472 //Enter low optimization region - place directly above function definition
07473     #ifdef ARM_MATH_CM4
07474       #define LOW_OPTIMIZATION_ENTER \
07475          _Pragma ("push")         \
07476          _Pragma ("O1")
07477     #else
07478       #define LOW_OPTIMIZATION_ENTER 
07479     #endif
07480 
07481 //Exit low optimization region - place directly after end of function definition
07482     #ifdef ARM_MATH_CM4
07483       #define LOW_OPTIMIZATION_EXIT \
07484          _Pragma ("pop")
07485     #else
07486       #define LOW_OPTIMIZATION_EXIT  
07487     #endif
07488 
07489 //Enter low optimization region - place directly above function definition
07490   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
07491 
07492 //Exit low optimization region - place directly after end of function definition
07493   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
07494 
07495 #elif defined(__ICCARM__) //IAR
07496 
07497 //Enter low optimization region - place directly above function definition
07498     #ifdef ARM_MATH_CM4
07499       #define LOW_OPTIMIZATION_ENTER \
07500          _Pragma ("optimize=low")
07501     #else
07502       #define LOW_OPTIMIZATION_ENTER   
07503     #endif
07504 
07505 //Exit low optimization region - place directly after end of function definition
07506   #define LOW_OPTIMIZATION_EXIT
07507 
07508 //Enter low optimization region - place directly above function definition
07509     #ifdef ARM_MATH_CM4
07510       #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
07511          _Pragma ("optimize=low")
07512     #else
07513       #define IAR_ONLY_LOW_OPTIMIZATION_ENTER   
07514     #endif
07515 
07516 //Exit low optimization region - place directly after end of function definition
07517   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
07518 
07519 #elif defined(__GNUC__)
07520 
07521   #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
07522 
07523   #define LOW_OPTIMIZATION_EXIT
07524 
07525   #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
07526 
07527   #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
07528 
07529 #elif defined(__CSMC__)     // Cosmic
07530 
07531 #define LOW_OPTIMIZATION_ENTER
07532 #define LOW_OPTIMIZATION_EXIT
07533 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
07534 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
07535 
07536 #elif defined(__TASKING__)      // TASKING
07537 
07538 #define LOW_OPTIMIZATION_ENTER
07539 #define LOW_OPTIMIZATION_EXIT
07540 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
07541 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
07542 
07543 #endif
07544 
07545 
07546 #ifdef  __cplusplus
07547 }
07548 #endif
07549 
07550 
07551 #endif /* _ARM_MATH_H */
07552 
07553 /**
07554  *
07555  * End of file.
07556  */