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

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

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

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emh203 0:3d9c67d97d6f 1 /* ----------------------------------------------------------------------
emh203 0:3d9c67d97d6f 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 3 *
emh203 0:3d9c67d97d6f 4 * $Date: 12. March 2014
emh203 0:3d9c67d97d6f 5 * $Revision: V1.4.3
emh203 0:3d9c67d97d6f 6 *
emh203 0:3d9c67d97d6f 7 * Project: CMSIS DSP Library
emh203 0:3d9c67d97d6f 8 * Title: arm_math.h
emh203 0:3d9c67d97d6f 9 *
emh203 0:3d9c67d97d6f 10 * Description: Public header file for CMSIS DSP Library
emh203 0:3d9c67d97d6f 11 *
emh203 0:3d9c67d97d6f 12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
emh203 0:3d9c67d97d6f 13 *
emh203 0:3d9c67d97d6f 14 * Redistribution and use in source and binary forms, with or without
emh203 0:3d9c67d97d6f 15 * modification, are permitted provided that the following conditions
emh203 0:3d9c67d97d6f 16 * are met:
emh203 0:3d9c67d97d6f 17 * - Redistributions of source code must retain the above copyright
emh203 0:3d9c67d97d6f 18 * notice, this list of conditions and the following disclaimer.
emh203 0:3d9c67d97d6f 19 * - Redistributions in binary form must reproduce the above copyright
emh203 0:3d9c67d97d6f 20 * notice, this list of conditions and the following disclaimer in
emh203 0:3d9c67d97d6f 21 * the documentation and/or other materials provided with the
emh203 0:3d9c67d97d6f 22 * distribution.
emh203 0:3d9c67d97d6f 23 * - Neither the name of ARM LIMITED nor the names of its contributors
emh203 0:3d9c67d97d6f 24 * may be used to endorse or promote products derived from this
emh203 0:3d9c67d97d6f 25 * software without specific prior written permission.
emh203 0:3d9c67d97d6f 26 *
emh203 0:3d9c67d97d6f 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
emh203 0:3d9c67d97d6f 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
emh203 0:3d9c67d97d6f 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
emh203 0:3d9c67d97d6f 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
emh203 0:3d9c67d97d6f 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
emh203 0:3d9c67d97d6f 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
emh203 0:3d9c67d97d6f 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
emh203 0:3d9c67d97d6f 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
emh203 0:3d9c67d97d6f 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
emh203 0:3d9c67d97d6f 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
emh203 0:3d9c67d97d6f 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emh203 0:3d9c67d97d6f 38 * POSSIBILITY OF SUCH DAMAGE.
emh203 0:3d9c67d97d6f 39 * -------------------------------------------------------------------- */
emh203 0:3d9c67d97d6f 40
emh203 0:3d9c67d97d6f 41 /**
emh203 0:3d9c67d97d6f 42 \mainpage CMSIS DSP Software Library
emh203 0:3d9c67d97d6f 43 *
emh203 0:3d9c67d97d6f 44 * Introduction
emh203 0:3d9c67d97d6f 45 * ------------
emh203 0:3d9c67d97d6f 46 *
emh203 0:3d9c67d97d6f 47 * This user manual describes the CMSIS DSP software library,
emh203 0:3d9c67d97d6f 48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
emh203 0:3d9c67d97d6f 49 *
emh203 0:3d9c67d97d6f 50 * The library is divided into a number of functions each covering a specific category:
emh203 0:3d9c67d97d6f 51 * - Basic math functions
emh203 0:3d9c67d97d6f 52 * - Fast math functions
emh203 0:3d9c67d97d6f 53 * - Complex math functions
emh203 0:3d9c67d97d6f 54 * - Filters
emh203 0:3d9c67d97d6f 55 * - Matrix functions
emh203 0:3d9c67d97d6f 56 * - Transforms
emh203 0:3d9c67d97d6f 57 * - Motor control functions
emh203 0:3d9c67d97d6f 58 * - Statistical functions
emh203 0:3d9c67d97d6f 59 * - Support functions
emh203 0:3d9c67d97d6f 60 * - Interpolation functions
emh203 0:3d9c67d97d6f 61 *
emh203 0:3d9c67d97d6f 62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
emh203 0:3d9c67d97d6f 63 * 32-bit integer and 32-bit floating-point values.
emh203 0:3d9c67d97d6f 64 *
emh203 0:3d9c67d97d6f 65 * Using the Library
emh203 0:3d9c67d97d6f 66 * ------------
emh203 0:3d9c67d97d6f 67 *
emh203 0:3d9c67d97d6f 68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
emh203 0:3d9c67d97d6f 69 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
emh203 0:3d9c67d97d6f 70 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
emh203 0:3d9c67d97d6f 71 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
emh203 0:3d9c67d97d6f 72 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
emh203 0:3d9c67d97d6f 73 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
emh203 0:3d9c67d97d6f 74 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
emh203 0:3d9c67d97d6f 75 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0)
emh203 0:3d9c67d97d6f 76 * - arm_cortexM0b_math.lib (Big endian on Cortex-M3)
emh203 0:3d9c67d97d6f 77 *
emh203 0:3d9c67d97d6f 78 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
emh203 0:3d9c67d97d6f 79 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
emh203 0:3d9c67d97d6f 80 * public header file <code> arm_math.h</code> for Cortex-M4/M3/M0 with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
emh203 0:3d9c67d97d6f 81 * Define the appropriate pre processor MACRO ARM_MATH_CM4 or ARM_MATH_CM3 or
emh203 0:3d9c67d97d6f 82 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
emh203 0:3d9c67d97d6f 83 *
emh203 0:3d9c67d97d6f 84 * Examples
emh203 0:3d9c67d97d6f 85 * --------
emh203 0:3d9c67d97d6f 86 *
emh203 0:3d9c67d97d6f 87 * The library ships with a number of examples which demonstrate how to use the library functions.
emh203 0:3d9c67d97d6f 88 *
emh203 0:3d9c67d97d6f 89 * Toolchain Support
emh203 0:3d9c67d97d6f 90 * ------------
emh203 0:3d9c67d97d6f 91 *
emh203 0:3d9c67d97d6f 92 * The library has been developed and tested with MDK-ARM version 4.60.
emh203 0:3d9c67d97d6f 93 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
emh203 0:3d9c67d97d6f 94 *
emh203 0:3d9c67d97d6f 95 * Building the Library
emh203 0:3d9c67d97d6f 96 * ------------
emh203 0:3d9c67d97d6f 97 *
emh203 0:3d9c67d97d6f 98 * The library installer contains a project file to re build libraries on MDK-ARM Tool chain in the <code>CMSIS\\DSP_Lib\\Source\\ARM</code> folder.
emh203 0:3d9c67d97d6f 99 * - arm_cortexM_math.uvproj
emh203 0:3d9c67d97d6f 100 *
emh203 0:3d9c67d97d6f 101 *
emh203 0:3d9c67d97d6f 102 * The libraries can be built by opening the arm_cortexM_math.uvproj project in MDK-ARM, selecting a specific target, and defining the optional pre processor MACROs detailed above.
emh203 0:3d9c67d97d6f 103 *
emh203 0:3d9c67d97d6f 104 * Pre-processor Macros
emh203 0:3d9c67d97d6f 105 * ------------
emh203 0:3d9c67d97d6f 106 *
emh203 0:3d9c67d97d6f 107 * Each library project have differant pre-processor macros.
emh203 0:3d9c67d97d6f 108 *
emh203 0:3d9c67d97d6f 109 * - UNALIGNED_SUPPORT_DISABLE:
emh203 0:3d9c67d97d6f 110 *
emh203 0:3d9c67d97d6f 111 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
emh203 0:3d9c67d97d6f 112 *
emh203 0:3d9c67d97d6f 113 * - ARM_MATH_BIG_ENDIAN:
emh203 0:3d9c67d97d6f 114 *
emh203 0:3d9c67d97d6f 115 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
emh203 0:3d9c67d97d6f 116 *
emh203 0:3d9c67d97d6f 117 * - ARM_MATH_MATRIX_CHECK:
emh203 0:3d9c67d97d6f 118 *
emh203 0:3d9c67d97d6f 119 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
emh203 0:3d9c67d97d6f 120 *
emh203 0:3d9c67d97d6f 121 * - ARM_MATH_ROUNDING:
emh203 0:3d9c67d97d6f 122 *
emh203 0:3d9c67d97d6f 123 * Define macro ARM_MATH_ROUNDING for rounding on support functions
emh203 0:3d9c67d97d6f 124 *
emh203 0:3d9c67d97d6f 125 * - ARM_MATH_CMx:
emh203 0:3d9c67d97d6f 126 *
emh203 0:3d9c67d97d6f 127 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
emh203 0:3d9c67d97d6f 128 * and ARM_MATH_CM0 for building library on cortex-M0 target, ARM_MATH_CM0PLUS for building library on cortex-M0+ target.
emh203 0:3d9c67d97d6f 129 *
emh203 0:3d9c67d97d6f 130 * - __FPU_PRESENT:
emh203 0:3d9c67d97d6f 131 *
emh203 0:3d9c67d97d6f 132 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
emh203 0:3d9c67d97d6f 133 *
emh203 0:3d9c67d97d6f 134 * <hr>
emh203 0:3d9c67d97d6f 135 * CMSIS-DSP in ARM::CMSIS Pack
emh203 0:3d9c67d97d6f 136 * -----------------------------
emh203 0:3d9c67d97d6f 137 *
emh203 0:3d9c67d97d6f 138 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
emh203 0:3d9c67d97d6f 139 * |File/Folder |Content |
emh203 0:3d9c67d97d6f 140 * |------------------------------|------------------------------------------------------------------------|
emh203 0:3d9c67d97d6f 141 * |\b CMSIS\\Documentation\\DSP | This documentation |
emh203 0:3d9c67d97d6f 142 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
emh203 0:3d9c67d97d6f 143 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
emh203 0:3d9c67d97d6f 144 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
emh203 0:3d9c67d97d6f 145 *
emh203 0:3d9c67d97d6f 146 * <hr>
emh203 0:3d9c67d97d6f 147 * Revision History of CMSIS-DSP
emh203 0:3d9c67d97d6f 148 * ------------
emh203 0:3d9c67d97d6f 149 * Please refer to \ref ChangeLog_pg.
emh203 0:3d9c67d97d6f 150 *
emh203 0:3d9c67d97d6f 151 * Copyright Notice
emh203 0:3d9c67d97d6f 152 * ------------
emh203 0:3d9c67d97d6f 153 *
emh203 0:3d9c67d97d6f 154 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
emh203 0:3d9c67d97d6f 155 */
emh203 0:3d9c67d97d6f 156
emh203 0:3d9c67d97d6f 157
emh203 0:3d9c67d97d6f 158 /**
emh203 0:3d9c67d97d6f 159 * @defgroup groupMath Basic Math Functions
emh203 0:3d9c67d97d6f 160 */
emh203 0:3d9c67d97d6f 161
emh203 0:3d9c67d97d6f 162 /**
emh203 0:3d9c67d97d6f 163 * @defgroup groupFastMath Fast Math Functions
emh203 0:3d9c67d97d6f 164 * This set of functions provides a fast approximation to sine, cosine, and square root.
emh203 0:3d9c67d97d6f 165 * As compared to most of the other functions in the CMSIS math library, the fast math functions
emh203 0:3d9c67d97d6f 166 * operate on individual values and not arrays.
emh203 0:3d9c67d97d6f 167 * There are separate functions for Q15, Q31, and floating-point data.
emh203 0:3d9c67d97d6f 168 *
emh203 0:3d9c67d97d6f 169 */
emh203 0:3d9c67d97d6f 170
emh203 0:3d9c67d97d6f 171 /**
emh203 0:3d9c67d97d6f 172 * @defgroup groupCmplxMath Complex Math Functions
emh203 0:3d9c67d97d6f 173 * This set of functions operates on complex data vectors.
emh203 0:3d9c67d97d6f 174 * The data in the complex arrays is stored in an interleaved fashion
emh203 0:3d9c67d97d6f 175 * (real, imag, real, imag, ...).
emh203 0:3d9c67d97d6f 176 * In the API functions, the number of samples in a complex array refers
emh203 0:3d9c67d97d6f 177 * to the number of complex values; the array contains twice this number of
emh203 0:3d9c67d97d6f 178 * real values.
emh203 0:3d9c67d97d6f 179 */
emh203 0:3d9c67d97d6f 180
emh203 0:3d9c67d97d6f 181 /**
emh203 0:3d9c67d97d6f 182 * @defgroup groupFilters Filtering Functions
emh203 0:3d9c67d97d6f 183 */
emh203 0:3d9c67d97d6f 184
emh203 0:3d9c67d97d6f 185 /**
emh203 0:3d9c67d97d6f 186 * @defgroup groupMatrix Matrix Functions
emh203 0:3d9c67d97d6f 187 *
emh203 0:3d9c67d97d6f 188 * This set of functions provides basic matrix math operations.
emh203 0:3d9c67d97d6f 189 * The functions operate on matrix data structures. For example,
emh203 0:3d9c67d97d6f 190 * the type
emh203 0:3d9c67d97d6f 191 * definition for the floating-point matrix structure is shown
emh203 0:3d9c67d97d6f 192 * below:
emh203 0:3d9c67d97d6f 193 * <pre>
emh203 0:3d9c67d97d6f 194 * typedef struct
emh203 0:3d9c67d97d6f 195 * {
emh203 0:3d9c67d97d6f 196 * uint16_t numRows; // number of rows of the matrix.
emh203 0:3d9c67d97d6f 197 * uint16_t numCols; // number of columns of the matrix.
emh203 0:3d9c67d97d6f 198 * float32_t *pData; // points to the data of the matrix.
emh203 0:3d9c67d97d6f 199 * } arm_matrix_instance_f32;
emh203 0:3d9c67d97d6f 200 * </pre>
emh203 0:3d9c67d97d6f 201 * There are similar definitions for Q15 and Q31 data types.
emh203 0:3d9c67d97d6f 202 *
emh203 0:3d9c67d97d6f 203 * The structure specifies the size of the matrix and then points to
emh203 0:3d9c67d97d6f 204 * an array of data. The array is of size <code>numRows X numCols</code>
emh203 0:3d9c67d97d6f 205 * and the values are arranged in row order. That is, the
emh203 0:3d9c67d97d6f 206 * matrix element (i, j) is stored at:
emh203 0:3d9c67d97d6f 207 * <pre>
emh203 0:3d9c67d97d6f 208 * pData[i*numCols + j]
emh203 0:3d9c67d97d6f 209 * </pre>
emh203 0:3d9c67d97d6f 210 *
emh203 0:3d9c67d97d6f 211 * \par Init Functions
emh203 0:3d9c67d97d6f 212 * There is an associated initialization function for each type of matrix
emh203 0:3d9c67d97d6f 213 * data structure.
emh203 0:3d9c67d97d6f 214 * The initialization function sets the values of the internal structure fields.
emh203 0:3d9c67d97d6f 215 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
emh203 0:3d9c67d97d6f 216 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
emh203 0:3d9c67d97d6f 217 *
emh203 0:3d9c67d97d6f 218 * \par
emh203 0:3d9c67d97d6f 219 * Use of the initialization function is optional. However, if initialization function is used
emh203 0:3d9c67d97d6f 220 * then the instance structure cannot be placed into a const data section.
emh203 0:3d9c67d97d6f 221 * To place the instance structure in a const data
emh203 0:3d9c67d97d6f 222 * section, manually initialize the data structure. For example:
emh203 0:3d9c67d97d6f 223 * <pre>
emh203 0:3d9c67d97d6f 224 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
emh203 0:3d9c67d97d6f 225 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
emh203 0:3d9c67d97d6f 226 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
emh203 0:3d9c67d97d6f 227 * </pre>
emh203 0:3d9c67d97d6f 228 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
emh203 0:3d9c67d97d6f 229 * specifies the number of columns, and <code>pData</code> points to the
emh203 0:3d9c67d97d6f 230 * data array.
emh203 0:3d9c67d97d6f 231 *
emh203 0:3d9c67d97d6f 232 * \par Size Checking
emh203 0:3d9c67d97d6f 233 * By default all of the matrix functions perform size checking on the input and
emh203 0:3d9c67d97d6f 234 * output matrices. For example, the matrix addition function verifies that the
emh203 0:3d9c67d97d6f 235 * two input matrices and the output matrix all have the same number of rows and
emh203 0:3d9c67d97d6f 236 * columns. If the size check fails the functions return:
emh203 0:3d9c67d97d6f 237 * <pre>
emh203 0:3d9c67d97d6f 238 * ARM_MATH_SIZE_MISMATCH
emh203 0:3d9c67d97d6f 239 * </pre>
emh203 0:3d9c67d97d6f 240 * Otherwise the functions return
emh203 0:3d9c67d97d6f 241 * <pre>
emh203 0:3d9c67d97d6f 242 * ARM_MATH_SUCCESS
emh203 0:3d9c67d97d6f 243 * </pre>
emh203 0:3d9c67d97d6f 244 * There is some overhead associated with this matrix size checking.
emh203 0:3d9c67d97d6f 245 * The matrix size checking is enabled via the \#define
emh203 0:3d9c67d97d6f 246 * <pre>
emh203 0:3d9c67d97d6f 247 * ARM_MATH_MATRIX_CHECK
emh203 0:3d9c67d97d6f 248 * </pre>
emh203 0:3d9c67d97d6f 249 * within the library project settings. By default this macro is defined
emh203 0:3d9c67d97d6f 250 * and size checking is enabled. By changing the project settings and
emh203 0:3d9c67d97d6f 251 * undefining this macro size checking is eliminated and the functions
emh203 0:3d9c67d97d6f 252 * run a bit faster. With size checking disabled the functions always
emh203 0:3d9c67d97d6f 253 * return <code>ARM_MATH_SUCCESS</code>.
emh203 0:3d9c67d97d6f 254 */
emh203 0:3d9c67d97d6f 255
emh203 0:3d9c67d97d6f 256 /**
emh203 0:3d9c67d97d6f 257 * @defgroup groupTransforms Transform Functions
emh203 0:3d9c67d97d6f 258 */
emh203 0:3d9c67d97d6f 259
emh203 0:3d9c67d97d6f 260 /**
emh203 0:3d9c67d97d6f 261 * @defgroup groupController Controller Functions
emh203 0:3d9c67d97d6f 262 */
emh203 0:3d9c67d97d6f 263
emh203 0:3d9c67d97d6f 264 /**
emh203 0:3d9c67d97d6f 265 * @defgroup groupStats Statistics Functions
emh203 0:3d9c67d97d6f 266 */
emh203 0:3d9c67d97d6f 267 /**
emh203 0:3d9c67d97d6f 268 * @defgroup groupSupport Support Functions
emh203 0:3d9c67d97d6f 269 */
emh203 0:3d9c67d97d6f 270
emh203 0:3d9c67d97d6f 271 /**
emh203 0:3d9c67d97d6f 272 * @defgroup groupInterpolation Interpolation Functions
emh203 0:3d9c67d97d6f 273 * These functions perform 1- and 2-dimensional interpolation of data.
emh203 0:3d9c67d97d6f 274 * Linear interpolation is used for 1-dimensional data and
emh203 0:3d9c67d97d6f 275 * bilinear interpolation is used for 2-dimensional data.
emh203 0:3d9c67d97d6f 276 */
emh203 0:3d9c67d97d6f 277
emh203 0:3d9c67d97d6f 278 /**
emh203 0:3d9c67d97d6f 279 * @defgroup groupExamples Examples
emh203 0:3d9c67d97d6f 280 */
emh203 0:3d9c67d97d6f 281 #ifndef _ARM_MATH_H
emh203 0:3d9c67d97d6f 282 #define _ARM_MATH_H
emh203 0:3d9c67d97d6f 283
emh203 0:3d9c67d97d6f 284 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
emh203 0:3d9c67d97d6f 285
emh203 0:3d9c67d97d6f 286 #if defined (ARM_MATH_CM4)
emh203 0:3d9c67d97d6f 287 #include "core_cm4.h"
emh203 0:3d9c67d97d6f 288 #elif defined (ARM_MATH_CM3)
emh203 0:3d9c67d97d6f 289 #include "core_cm3.h"
emh203 0:3d9c67d97d6f 290 #elif defined (ARM_MATH_CM0)
emh203 0:3d9c67d97d6f 291 #include "core_cm0.h"
emh203 0:3d9c67d97d6f 292 #define ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 293 #elif defined (ARM_MATH_CM0PLUS)
emh203 0:3d9c67d97d6f 294 #include "core_cm0plus.h"
emh203 0:3d9c67d97d6f 295 #define ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 296 #else
emh203 0:3d9c67d97d6f 297 #include "ARMCM4.h"
emh203 0:3d9c67d97d6f 298 #warning "Define either ARM_MATH_CM4 OR ARM_MATH_CM3...By Default building on ARM_MATH_CM4....."
emh203 0:3d9c67d97d6f 299 #endif
emh203 0:3d9c67d97d6f 300
emh203 0:3d9c67d97d6f 301 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
emh203 0:3d9c67d97d6f 302 #include "string.h"
emh203 0:3d9c67d97d6f 303 #include "math.h"
emh203 0:3d9c67d97d6f 304 #ifdef __cplusplus
emh203 0:3d9c67d97d6f 305 extern "C"
emh203 0:3d9c67d97d6f 306 {
emh203 0:3d9c67d97d6f 307 #endif
emh203 0:3d9c67d97d6f 308
emh203 0:3d9c67d97d6f 309
emh203 0:3d9c67d97d6f 310 /**
emh203 0:3d9c67d97d6f 311 * @brief Macros required for reciprocal calculation in Normalized LMS
emh203 0:3d9c67d97d6f 312 */
emh203 0:3d9c67d97d6f 313
emh203 0:3d9c67d97d6f 314 #define DELTA_Q31 (0x100)
emh203 0:3d9c67d97d6f 315 #define DELTA_Q15 0x5
emh203 0:3d9c67d97d6f 316 #define INDEX_MASK 0x0000003F
emh203 0:3d9c67d97d6f 317 #ifndef PI
emh203 0:3d9c67d97d6f 318 #define PI 3.14159265358979f
emh203 0:3d9c67d97d6f 319 #endif
emh203 0:3d9c67d97d6f 320
emh203 0:3d9c67d97d6f 321 /**
emh203 0:3d9c67d97d6f 322 * @brief Macros required for SINE and COSINE Fast math approximations
emh203 0:3d9c67d97d6f 323 */
emh203 0:3d9c67d97d6f 324
emh203 0:3d9c67d97d6f 325 #define FAST_MATH_TABLE_SIZE 512
emh203 0:3d9c67d97d6f 326 #define FAST_MATH_Q31_SHIFT (32 - 10)
emh203 0:3d9c67d97d6f 327 #define FAST_MATH_Q15_SHIFT (16 - 10)
emh203 0:3d9c67d97d6f 328 #define CONTROLLER_Q31_SHIFT (32 - 9)
emh203 0:3d9c67d97d6f 329 #define TABLE_SIZE 256
emh203 0:3d9c67d97d6f 330 #define TABLE_SPACING_Q31 0x400000
emh203 0:3d9c67d97d6f 331 #define TABLE_SPACING_Q15 0x80
emh203 0:3d9c67d97d6f 332
emh203 0:3d9c67d97d6f 333 /**
emh203 0:3d9c67d97d6f 334 * @brief Macros required for SINE and COSINE Controller functions
emh203 0:3d9c67d97d6f 335 */
emh203 0:3d9c67d97d6f 336 /* 1.31(q31) Fixed value of 2/360 */
emh203 0:3d9c67d97d6f 337 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
emh203 0:3d9c67d97d6f 338 #define INPUT_SPACING 0xB60B61
emh203 0:3d9c67d97d6f 339
emh203 0:3d9c67d97d6f 340 /**
emh203 0:3d9c67d97d6f 341 * @brief Macro for Unaligned Support
emh203 0:3d9c67d97d6f 342 */
emh203 0:3d9c67d97d6f 343 #ifndef UNALIGNED_SUPPORT_DISABLE
emh203 0:3d9c67d97d6f 344 #define ALIGN4
emh203 0:3d9c67d97d6f 345 #else
emh203 0:3d9c67d97d6f 346 #if defined (__GNUC__)
emh203 0:3d9c67d97d6f 347 #define ALIGN4 __attribute__((aligned(4)))
emh203 0:3d9c67d97d6f 348 #else
emh203 0:3d9c67d97d6f 349 #define ALIGN4 __align(4)
emh203 0:3d9c67d97d6f 350 #endif
emh203 0:3d9c67d97d6f 351 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
emh203 0:3d9c67d97d6f 352
emh203 0:3d9c67d97d6f 353 /**
emh203 0:3d9c67d97d6f 354 * @brief Error status returned by some functions in the library.
emh203 0:3d9c67d97d6f 355 */
emh203 0:3d9c67d97d6f 356
emh203 0:3d9c67d97d6f 357 typedef enum
emh203 0:3d9c67d97d6f 358 {
emh203 0:3d9c67d97d6f 359 ARM_MATH_SUCCESS = 0, /**< No error */
emh203 0:3d9c67d97d6f 360 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
emh203 0:3d9c67d97d6f 361 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
emh203 0:3d9c67d97d6f 362 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
emh203 0:3d9c67d97d6f 363 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
emh203 0:3d9c67d97d6f 364 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
emh203 0:3d9c67d97d6f 365 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
emh203 0:3d9c67d97d6f 366 } arm_status;
emh203 0:3d9c67d97d6f 367
emh203 0:3d9c67d97d6f 368 /**
emh203 0:3d9c67d97d6f 369 * @brief 8-bit fractional data type in 1.7 format.
emh203 0:3d9c67d97d6f 370 */
emh203 0:3d9c67d97d6f 371 typedef int8_t q7_t;
emh203 0:3d9c67d97d6f 372
emh203 0:3d9c67d97d6f 373 /**
emh203 0:3d9c67d97d6f 374 * @brief 16-bit fractional data type in 1.15 format.
emh203 0:3d9c67d97d6f 375 */
emh203 0:3d9c67d97d6f 376 typedef int16_t q15_t;
emh203 0:3d9c67d97d6f 377
emh203 0:3d9c67d97d6f 378 /**
emh203 0:3d9c67d97d6f 379 * @brief 32-bit fractional data type in 1.31 format.
emh203 0:3d9c67d97d6f 380 */
emh203 0:3d9c67d97d6f 381 typedef int32_t q31_t;
emh203 0:3d9c67d97d6f 382
emh203 0:3d9c67d97d6f 383 /**
emh203 0:3d9c67d97d6f 384 * @brief 64-bit fractional data type in 1.63 format.
emh203 0:3d9c67d97d6f 385 */
emh203 0:3d9c67d97d6f 386 typedef int64_t q63_t;
emh203 0:3d9c67d97d6f 387
emh203 0:3d9c67d97d6f 388 /**
emh203 0:3d9c67d97d6f 389 * @brief 32-bit floating-point type definition.
emh203 0:3d9c67d97d6f 390 */
emh203 0:3d9c67d97d6f 391 typedef float float32_t;
emh203 0:3d9c67d97d6f 392
emh203 0:3d9c67d97d6f 393 /**
emh203 0:3d9c67d97d6f 394 * @brief 64-bit floating-point type definition.
emh203 0:3d9c67d97d6f 395 */
emh203 0:3d9c67d97d6f 396 typedef double float64_t;
emh203 0:3d9c67d97d6f 397
emh203 0:3d9c67d97d6f 398 /**
emh203 0:3d9c67d97d6f 399 * @brief definition to read/write two 16 bit values.
emh203 0:3d9c67d97d6f 400 */
emh203 0:3d9c67d97d6f 401 #if defined __CC_ARM
emh203 0:3d9c67d97d6f 402 #define __SIMD32_TYPE int32_t __packed
emh203 0:3d9c67d97d6f 403 #define CMSIS_UNUSED __attribute__((unused))
emh203 0:3d9c67d97d6f 404 #elif defined __ICCARM__
emh203 0:3d9c67d97d6f 405 #define CMSIS_UNUSED
emh203 0:3d9c67d97d6f 406 #define __SIMD32_TYPE int32_t __packed
emh203 0:3d9c67d97d6f 407 #elif defined __GNUC__
emh203 0:3d9c67d97d6f 408 #define __SIMD32_TYPE int32_t
emh203 0:3d9c67d97d6f 409 #define CMSIS_UNUSED __attribute__((unused))
emh203 0:3d9c67d97d6f 410 #elif defined __CSMC__ /* Cosmic */
emh203 0:3d9c67d97d6f 411 #define CMSIS_UNUSED
emh203 0:3d9c67d97d6f 412 #define __SIMD32_TYPE int32_t
emh203 0:3d9c67d97d6f 413 #else
emh203 0:3d9c67d97d6f 414 #error Unknown compiler
emh203 0:3d9c67d97d6f 415 #endif
emh203 0:3d9c67d97d6f 416
emh203 0:3d9c67d97d6f 417 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
emh203 0:3d9c67d97d6f 418 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
emh203 0:3d9c67d97d6f 419
emh203 0:3d9c67d97d6f 420 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
emh203 0:3d9c67d97d6f 421
emh203 0:3d9c67d97d6f 422 #define __SIMD64(addr) (*(int64_t **) & (addr))
emh203 0:3d9c67d97d6f 423
emh203 0:3d9c67d97d6f 424 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
emh203 0:3d9c67d97d6f 425 /**
emh203 0:3d9c67d97d6f 426 * @brief definition to pack two 16 bit values.
emh203 0:3d9c67d97d6f 427 */
emh203 0:3d9c67d97d6f 428 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
emh203 0:3d9c67d97d6f 429 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
emh203 0:3d9c67d97d6f 430 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
emh203 0:3d9c67d97d6f 431 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
emh203 0:3d9c67d97d6f 432
emh203 0:3d9c67d97d6f 433 #endif
emh203 0:3d9c67d97d6f 434
emh203 0:3d9c67d97d6f 435
emh203 0:3d9c67d97d6f 436 /**
emh203 0:3d9c67d97d6f 437 * @brief definition to pack four 8 bit values.
emh203 0:3d9c67d97d6f 438 */
emh203 0:3d9c67d97d6f 439 #ifndef ARM_MATH_BIG_ENDIAN
emh203 0:3d9c67d97d6f 440
emh203 0:3d9c67d97d6f 441 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
emh203 0:3d9c67d97d6f 442 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
emh203 0:3d9c67d97d6f 443 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
emh203 0:3d9c67d97d6f 444 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
emh203 0:3d9c67d97d6f 445 #else
emh203 0:3d9c67d97d6f 446
emh203 0:3d9c67d97d6f 447 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
emh203 0:3d9c67d97d6f 448 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
emh203 0:3d9c67d97d6f 449 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
emh203 0:3d9c67d97d6f 450 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
emh203 0:3d9c67d97d6f 451
emh203 0:3d9c67d97d6f 452 #endif
emh203 0:3d9c67d97d6f 453
emh203 0:3d9c67d97d6f 454
emh203 0:3d9c67d97d6f 455 /**
emh203 0:3d9c67d97d6f 456 * @brief Clips Q63 to Q31 values.
emh203 0:3d9c67d97d6f 457 */
emh203 0:3d9c67d97d6f 458 static __INLINE q31_t clip_q63_to_q31(
emh203 0:3d9c67d97d6f 459 q63_t x)
emh203 0:3d9c67d97d6f 460 {
emh203 0:3d9c67d97d6f 461 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
emh203 0:3d9c67d97d6f 462 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
emh203 0:3d9c67d97d6f 463 }
emh203 0:3d9c67d97d6f 464
emh203 0:3d9c67d97d6f 465 /**
emh203 0:3d9c67d97d6f 466 * @brief Clips Q63 to Q15 values.
emh203 0:3d9c67d97d6f 467 */
emh203 0:3d9c67d97d6f 468 static __INLINE q15_t clip_q63_to_q15(
emh203 0:3d9c67d97d6f 469 q63_t x)
emh203 0:3d9c67d97d6f 470 {
emh203 0:3d9c67d97d6f 471 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
emh203 0:3d9c67d97d6f 472 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
emh203 0:3d9c67d97d6f 473 }
emh203 0:3d9c67d97d6f 474
emh203 0:3d9c67d97d6f 475 /**
emh203 0:3d9c67d97d6f 476 * @brief Clips Q31 to Q7 values.
emh203 0:3d9c67d97d6f 477 */
emh203 0:3d9c67d97d6f 478 static __INLINE q7_t clip_q31_to_q7(
emh203 0:3d9c67d97d6f 479 q31_t x)
emh203 0:3d9c67d97d6f 480 {
emh203 0:3d9c67d97d6f 481 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
emh203 0:3d9c67d97d6f 482 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
emh203 0:3d9c67d97d6f 483 }
emh203 0:3d9c67d97d6f 484
emh203 0:3d9c67d97d6f 485 /**
emh203 0:3d9c67d97d6f 486 * @brief Clips Q31 to Q15 values.
emh203 0:3d9c67d97d6f 487 */
emh203 0:3d9c67d97d6f 488 static __INLINE q15_t clip_q31_to_q15(
emh203 0:3d9c67d97d6f 489 q31_t x)
emh203 0:3d9c67d97d6f 490 {
emh203 0:3d9c67d97d6f 491 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
emh203 0:3d9c67d97d6f 492 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
emh203 0:3d9c67d97d6f 493 }
emh203 0:3d9c67d97d6f 494
emh203 0:3d9c67d97d6f 495 /**
emh203 0:3d9c67d97d6f 496 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
emh203 0:3d9c67d97d6f 497 */
emh203 0:3d9c67d97d6f 498
emh203 0:3d9c67d97d6f 499 static __INLINE q63_t mult32x64(
emh203 0:3d9c67d97d6f 500 q63_t x,
emh203 0:3d9c67d97d6f 501 q31_t y)
emh203 0:3d9c67d97d6f 502 {
emh203 0:3d9c67d97d6f 503 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
emh203 0:3d9c67d97d6f 504 (((q63_t) (x >> 32) * y)));
emh203 0:3d9c67d97d6f 505 }
emh203 0:3d9c67d97d6f 506
emh203 0:3d9c67d97d6f 507
emh203 0:3d9c67d97d6f 508 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
emh203 0:3d9c67d97d6f 509 #define __CLZ __clz
emh203 0:3d9c67d97d6f 510 #endif
emh203 0:3d9c67d97d6f 511
emh203 0:3d9c67d97d6f 512 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ||(defined (__GNUC__)) || defined (__TASKING__) )
emh203 0:3d9c67d97d6f 513
emh203 0:3d9c67d97d6f 514 static __INLINE uint32_t __CLZ(
emh203 0:3d9c67d97d6f 515 q31_t data);
emh203 0:3d9c67d97d6f 516
emh203 0:3d9c67d97d6f 517
emh203 0:3d9c67d97d6f 518 static __INLINE uint32_t __CLZ(
emh203 0:3d9c67d97d6f 519 q31_t data)
emh203 0:3d9c67d97d6f 520 {
emh203 0:3d9c67d97d6f 521 uint32_t count = 0;
emh203 0:3d9c67d97d6f 522 uint32_t mask = 0x80000000;
emh203 0:3d9c67d97d6f 523
emh203 0:3d9c67d97d6f 524 while((data & mask) == 0)
emh203 0:3d9c67d97d6f 525 {
emh203 0:3d9c67d97d6f 526 count += 1u;
emh203 0:3d9c67d97d6f 527 mask = mask >> 1u;
emh203 0:3d9c67d97d6f 528 }
emh203 0:3d9c67d97d6f 529
emh203 0:3d9c67d97d6f 530 return (count);
emh203 0:3d9c67d97d6f 531
emh203 0:3d9c67d97d6f 532 }
emh203 0:3d9c67d97d6f 533
emh203 0:3d9c67d97d6f 534 #endif
emh203 0:3d9c67d97d6f 535
emh203 0:3d9c67d97d6f 536 /**
emh203 0:3d9c67d97d6f 537 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
emh203 0:3d9c67d97d6f 538 */
emh203 0:3d9c67d97d6f 539
emh203 0:3d9c67d97d6f 540 static __INLINE uint32_t arm_recip_q31(
emh203 0:3d9c67d97d6f 541 q31_t in,
emh203 0:3d9c67d97d6f 542 q31_t * dst,
emh203 0:3d9c67d97d6f 543 q31_t * pRecipTable)
emh203 0:3d9c67d97d6f 544 {
emh203 0:3d9c67d97d6f 545
emh203 0:3d9c67d97d6f 546 uint32_t out, tempVal;
emh203 0:3d9c67d97d6f 547 uint32_t index, i;
emh203 0:3d9c67d97d6f 548 uint32_t signBits;
emh203 0:3d9c67d97d6f 549
emh203 0:3d9c67d97d6f 550 if(in > 0)
emh203 0:3d9c67d97d6f 551 {
emh203 0:3d9c67d97d6f 552 signBits = __CLZ(in) - 1;
emh203 0:3d9c67d97d6f 553 }
emh203 0:3d9c67d97d6f 554 else
emh203 0:3d9c67d97d6f 555 {
emh203 0:3d9c67d97d6f 556 signBits = __CLZ(-in) - 1;
emh203 0:3d9c67d97d6f 557 }
emh203 0:3d9c67d97d6f 558
emh203 0:3d9c67d97d6f 559 /* Convert input sample to 1.31 format */
emh203 0:3d9c67d97d6f 560 in = in << signBits;
emh203 0:3d9c67d97d6f 561
emh203 0:3d9c67d97d6f 562 /* calculation of index for initial approximated Val */
emh203 0:3d9c67d97d6f 563 index = (uint32_t) (in >> 24u);
emh203 0:3d9c67d97d6f 564 index = (index & INDEX_MASK);
emh203 0:3d9c67d97d6f 565
emh203 0:3d9c67d97d6f 566 /* 1.31 with exp 1 */
emh203 0:3d9c67d97d6f 567 out = pRecipTable[index];
emh203 0:3d9c67d97d6f 568
emh203 0:3d9c67d97d6f 569 /* calculation of reciprocal value */
emh203 0:3d9c67d97d6f 570 /* running approximation for two iterations */
emh203 0:3d9c67d97d6f 571 for (i = 0u; i < 2u; i++)
emh203 0:3d9c67d97d6f 572 {
emh203 0:3d9c67d97d6f 573 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
emh203 0:3d9c67d97d6f 574 tempVal = 0x7FFFFFFF - tempVal;
emh203 0:3d9c67d97d6f 575 /* 1.31 with exp 1 */
emh203 0:3d9c67d97d6f 576 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
emh203 0:3d9c67d97d6f 577 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
emh203 0:3d9c67d97d6f 578 }
emh203 0:3d9c67d97d6f 579
emh203 0:3d9c67d97d6f 580 /* write output */
emh203 0:3d9c67d97d6f 581 *dst = out;
emh203 0:3d9c67d97d6f 582
emh203 0:3d9c67d97d6f 583 /* return num of signbits of out = 1/in value */
emh203 0:3d9c67d97d6f 584 return (signBits + 1u);
emh203 0:3d9c67d97d6f 585
emh203 0:3d9c67d97d6f 586 }
emh203 0:3d9c67d97d6f 587
emh203 0:3d9c67d97d6f 588 /**
emh203 0:3d9c67d97d6f 589 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
emh203 0:3d9c67d97d6f 590 */
emh203 0:3d9c67d97d6f 591 static __INLINE uint32_t arm_recip_q15(
emh203 0:3d9c67d97d6f 592 q15_t in,
emh203 0:3d9c67d97d6f 593 q15_t * dst,
emh203 0:3d9c67d97d6f 594 q15_t * pRecipTable)
emh203 0:3d9c67d97d6f 595 {
emh203 0:3d9c67d97d6f 596
emh203 0:3d9c67d97d6f 597 uint32_t out = 0, tempVal = 0;
emh203 0:3d9c67d97d6f 598 uint32_t index = 0, i = 0;
emh203 0:3d9c67d97d6f 599 uint32_t signBits = 0;
emh203 0:3d9c67d97d6f 600
emh203 0:3d9c67d97d6f 601 if(in > 0)
emh203 0:3d9c67d97d6f 602 {
emh203 0:3d9c67d97d6f 603 signBits = __CLZ(in) - 17;
emh203 0:3d9c67d97d6f 604 }
emh203 0:3d9c67d97d6f 605 else
emh203 0:3d9c67d97d6f 606 {
emh203 0:3d9c67d97d6f 607 signBits = __CLZ(-in) - 17;
emh203 0:3d9c67d97d6f 608 }
emh203 0:3d9c67d97d6f 609
emh203 0:3d9c67d97d6f 610 /* Convert input sample to 1.15 format */
emh203 0:3d9c67d97d6f 611 in = in << signBits;
emh203 0:3d9c67d97d6f 612
emh203 0:3d9c67d97d6f 613 /* calculation of index for initial approximated Val */
emh203 0:3d9c67d97d6f 614 index = in >> 8;
emh203 0:3d9c67d97d6f 615 index = (index & INDEX_MASK);
emh203 0:3d9c67d97d6f 616
emh203 0:3d9c67d97d6f 617 /* 1.15 with exp 1 */
emh203 0:3d9c67d97d6f 618 out = pRecipTable[index];
emh203 0:3d9c67d97d6f 619
emh203 0:3d9c67d97d6f 620 /* calculation of reciprocal value */
emh203 0:3d9c67d97d6f 621 /* running approximation for two iterations */
emh203 0:3d9c67d97d6f 622 for (i = 0; i < 2; i++)
emh203 0:3d9c67d97d6f 623 {
emh203 0:3d9c67d97d6f 624 tempVal = (q15_t) (((q31_t) in * out) >> 15);
emh203 0:3d9c67d97d6f 625 tempVal = 0x7FFF - tempVal;
emh203 0:3d9c67d97d6f 626 /* 1.15 with exp 1 */
emh203 0:3d9c67d97d6f 627 out = (q15_t) (((q31_t) out * tempVal) >> 14);
emh203 0:3d9c67d97d6f 628 }
emh203 0:3d9c67d97d6f 629
emh203 0:3d9c67d97d6f 630 /* write output */
emh203 0:3d9c67d97d6f 631 *dst = out;
emh203 0:3d9c67d97d6f 632
emh203 0:3d9c67d97d6f 633 /* return num of signbits of out = 1/in value */
emh203 0:3d9c67d97d6f 634 return (signBits + 1);
emh203 0:3d9c67d97d6f 635
emh203 0:3d9c67d97d6f 636 }
emh203 0:3d9c67d97d6f 637
emh203 0:3d9c67d97d6f 638
emh203 0:3d9c67d97d6f 639 /*
emh203 0:3d9c67d97d6f 640 * @brief C custom defined intrinisic function for only M0 processors
emh203 0:3d9c67d97d6f 641 */
emh203 0:3d9c67d97d6f 642 #if defined(ARM_MATH_CM0_FAMILY)
emh203 0:3d9c67d97d6f 643
emh203 0:3d9c67d97d6f 644 static __INLINE q31_t __SSAT(
emh203 0:3d9c67d97d6f 645 q31_t x,
emh203 0:3d9c67d97d6f 646 uint32_t y)
emh203 0:3d9c67d97d6f 647 {
emh203 0:3d9c67d97d6f 648 int32_t posMax, negMin;
emh203 0:3d9c67d97d6f 649 uint32_t i;
emh203 0:3d9c67d97d6f 650
emh203 0:3d9c67d97d6f 651 posMax = 1;
emh203 0:3d9c67d97d6f 652 for (i = 0; i < (y - 1); i++)
emh203 0:3d9c67d97d6f 653 {
emh203 0:3d9c67d97d6f 654 posMax = posMax * 2;
emh203 0:3d9c67d97d6f 655 }
emh203 0:3d9c67d97d6f 656
emh203 0:3d9c67d97d6f 657 if(x > 0)
emh203 0:3d9c67d97d6f 658 {
emh203 0:3d9c67d97d6f 659 posMax = (posMax - 1);
emh203 0:3d9c67d97d6f 660
emh203 0:3d9c67d97d6f 661 if(x > posMax)
emh203 0:3d9c67d97d6f 662 {
emh203 0:3d9c67d97d6f 663 x = posMax;
emh203 0:3d9c67d97d6f 664 }
emh203 0:3d9c67d97d6f 665 }
emh203 0:3d9c67d97d6f 666 else
emh203 0:3d9c67d97d6f 667 {
emh203 0:3d9c67d97d6f 668 negMin = -posMax;
emh203 0:3d9c67d97d6f 669
emh203 0:3d9c67d97d6f 670 if(x < negMin)
emh203 0:3d9c67d97d6f 671 {
emh203 0:3d9c67d97d6f 672 x = negMin;
emh203 0:3d9c67d97d6f 673 }
emh203 0:3d9c67d97d6f 674 }
emh203 0:3d9c67d97d6f 675 return (x);
emh203 0:3d9c67d97d6f 676
emh203 0:3d9c67d97d6f 677
emh203 0:3d9c67d97d6f 678 }
emh203 0:3d9c67d97d6f 679
emh203 0:3d9c67d97d6f 680 #endif /* end of ARM_MATH_CM0_FAMILY */
emh203 0:3d9c67d97d6f 681
emh203 0:3d9c67d97d6f 682
emh203 0:3d9c67d97d6f 683
emh203 0:3d9c67d97d6f 684 /*
emh203 0:3d9c67d97d6f 685 * @brief C custom defined intrinsic function for M3 and M0 processors
emh203 0:3d9c67d97d6f 686 */
emh203 0:3d9c67d97d6f 687 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
emh203 0:3d9c67d97d6f 688
emh203 0:3d9c67d97d6f 689 /*
emh203 0:3d9c67d97d6f 690 * @brief C custom defined QADD8 for M3 and M0 processors
emh203 0:3d9c67d97d6f 691 */
emh203 0:3d9c67d97d6f 692 static __INLINE q31_t __QADD8(
emh203 0:3d9c67d97d6f 693 q31_t x,
emh203 0:3d9c67d97d6f 694 q31_t y)
emh203 0:3d9c67d97d6f 695 {
emh203 0:3d9c67d97d6f 696
emh203 0:3d9c67d97d6f 697 q31_t sum;
emh203 0:3d9c67d97d6f 698 q7_t r, s, t, u;
emh203 0:3d9c67d97d6f 699
emh203 0:3d9c67d97d6f 700 r = (q7_t) x;
emh203 0:3d9c67d97d6f 701 s = (q7_t) y;
emh203 0:3d9c67d97d6f 702
emh203 0:3d9c67d97d6f 703 r = __SSAT((q31_t) (r + s), 8);
emh203 0:3d9c67d97d6f 704 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
emh203 0:3d9c67d97d6f 705 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
emh203 0:3d9c67d97d6f 706 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
emh203 0:3d9c67d97d6f 707
emh203 0:3d9c67d97d6f 708 sum =
emh203 0:3d9c67d97d6f 709 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
emh203 0:3d9c67d97d6f 710 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
emh203 0:3d9c67d97d6f 711
emh203 0:3d9c67d97d6f 712 return sum;
emh203 0:3d9c67d97d6f 713
emh203 0:3d9c67d97d6f 714 }
emh203 0:3d9c67d97d6f 715
emh203 0:3d9c67d97d6f 716 /*
emh203 0:3d9c67d97d6f 717 * @brief C custom defined QSUB8 for M3 and M0 processors
emh203 0:3d9c67d97d6f 718 */
emh203 0:3d9c67d97d6f 719 static __INLINE q31_t __QSUB8(
emh203 0:3d9c67d97d6f 720 q31_t x,
emh203 0:3d9c67d97d6f 721 q31_t y)
emh203 0:3d9c67d97d6f 722 {
emh203 0:3d9c67d97d6f 723
emh203 0:3d9c67d97d6f 724 q31_t sum;
emh203 0:3d9c67d97d6f 725 q31_t r, s, t, u;
emh203 0:3d9c67d97d6f 726
emh203 0:3d9c67d97d6f 727 r = (q7_t) x;
emh203 0:3d9c67d97d6f 728 s = (q7_t) y;
emh203 0:3d9c67d97d6f 729
emh203 0:3d9c67d97d6f 730 r = __SSAT((r - s), 8);
emh203 0:3d9c67d97d6f 731 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
emh203 0:3d9c67d97d6f 732 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
emh203 0:3d9c67d97d6f 733 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
emh203 0:3d9c67d97d6f 734
emh203 0:3d9c67d97d6f 735 sum =
emh203 0:3d9c67d97d6f 736 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
emh203 0:3d9c67d97d6f 737 0x000000FF);
emh203 0:3d9c67d97d6f 738
emh203 0:3d9c67d97d6f 739 return sum;
emh203 0:3d9c67d97d6f 740 }
emh203 0:3d9c67d97d6f 741
emh203 0:3d9c67d97d6f 742 /*
emh203 0:3d9c67d97d6f 743 * @brief C custom defined QADD16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 744 */
emh203 0:3d9c67d97d6f 745
emh203 0:3d9c67d97d6f 746 /*
emh203 0:3d9c67d97d6f 747 * @brief C custom defined QADD16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 748 */
emh203 0:3d9c67d97d6f 749 static __INLINE q31_t __QADD16(
emh203 0:3d9c67d97d6f 750 q31_t x,
emh203 0:3d9c67d97d6f 751 q31_t y)
emh203 0:3d9c67d97d6f 752 {
emh203 0:3d9c67d97d6f 753
emh203 0:3d9c67d97d6f 754 q31_t sum;
emh203 0:3d9c67d97d6f 755 q31_t r, s;
emh203 0:3d9c67d97d6f 756
emh203 0:3d9c67d97d6f 757 r = (q15_t) x;
emh203 0:3d9c67d97d6f 758 s = (q15_t) y;
emh203 0:3d9c67d97d6f 759
emh203 0:3d9c67d97d6f 760 r = __SSAT(r + s, 16);
emh203 0:3d9c67d97d6f 761 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
emh203 0:3d9c67d97d6f 762
emh203 0:3d9c67d97d6f 763 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 764
emh203 0:3d9c67d97d6f 765 return sum;
emh203 0:3d9c67d97d6f 766
emh203 0:3d9c67d97d6f 767 }
emh203 0:3d9c67d97d6f 768
emh203 0:3d9c67d97d6f 769 /*
emh203 0:3d9c67d97d6f 770 * @brief C custom defined SHADD16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 771 */
emh203 0:3d9c67d97d6f 772 static __INLINE q31_t __SHADD16(
emh203 0:3d9c67d97d6f 773 q31_t x,
emh203 0:3d9c67d97d6f 774 q31_t y)
emh203 0:3d9c67d97d6f 775 {
emh203 0:3d9c67d97d6f 776
emh203 0:3d9c67d97d6f 777 q31_t sum;
emh203 0:3d9c67d97d6f 778 q31_t r, s;
emh203 0:3d9c67d97d6f 779
emh203 0:3d9c67d97d6f 780 r = (q15_t) x;
emh203 0:3d9c67d97d6f 781 s = (q15_t) y;
emh203 0:3d9c67d97d6f 782
emh203 0:3d9c67d97d6f 783 r = ((r >> 1) + (s >> 1));
emh203 0:3d9c67d97d6f 784 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
emh203 0:3d9c67d97d6f 785
emh203 0:3d9c67d97d6f 786 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 787
emh203 0:3d9c67d97d6f 788 return sum;
emh203 0:3d9c67d97d6f 789
emh203 0:3d9c67d97d6f 790 }
emh203 0:3d9c67d97d6f 791
emh203 0:3d9c67d97d6f 792 /*
emh203 0:3d9c67d97d6f 793 * @brief C custom defined QSUB16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 794 */
emh203 0:3d9c67d97d6f 795 static __INLINE q31_t __QSUB16(
emh203 0:3d9c67d97d6f 796 q31_t x,
emh203 0:3d9c67d97d6f 797 q31_t y)
emh203 0:3d9c67d97d6f 798 {
emh203 0:3d9c67d97d6f 799
emh203 0:3d9c67d97d6f 800 q31_t sum;
emh203 0:3d9c67d97d6f 801 q31_t r, s;
emh203 0:3d9c67d97d6f 802
emh203 0:3d9c67d97d6f 803 r = (q15_t) x;
emh203 0:3d9c67d97d6f 804 s = (q15_t) y;
emh203 0:3d9c67d97d6f 805
emh203 0:3d9c67d97d6f 806 r = __SSAT(r - s, 16);
emh203 0:3d9c67d97d6f 807 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
emh203 0:3d9c67d97d6f 808
emh203 0:3d9c67d97d6f 809 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 810
emh203 0:3d9c67d97d6f 811 return sum;
emh203 0:3d9c67d97d6f 812 }
emh203 0:3d9c67d97d6f 813
emh203 0:3d9c67d97d6f 814 /*
emh203 0:3d9c67d97d6f 815 * @brief C custom defined SHSUB16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 816 */
emh203 0:3d9c67d97d6f 817 static __INLINE q31_t __SHSUB16(
emh203 0:3d9c67d97d6f 818 q31_t x,
emh203 0:3d9c67d97d6f 819 q31_t y)
emh203 0:3d9c67d97d6f 820 {
emh203 0:3d9c67d97d6f 821
emh203 0:3d9c67d97d6f 822 q31_t diff;
emh203 0:3d9c67d97d6f 823 q31_t r, s;
emh203 0:3d9c67d97d6f 824
emh203 0:3d9c67d97d6f 825 r = (q15_t) x;
emh203 0:3d9c67d97d6f 826 s = (q15_t) y;
emh203 0:3d9c67d97d6f 827
emh203 0:3d9c67d97d6f 828 r = ((r >> 1) - (s >> 1));
emh203 0:3d9c67d97d6f 829 s = (((x >> 17) - (y >> 17)) << 16);
emh203 0:3d9c67d97d6f 830
emh203 0:3d9c67d97d6f 831 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 832
emh203 0:3d9c67d97d6f 833 return diff;
emh203 0:3d9c67d97d6f 834 }
emh203 0:3d9c67d97d6f 835
emh203 0:3d9c67d97d6f 836 /*
emh203 0:3d9c67d97d6f 837 * @brief C custom defined QASX for M3 and M0 processors
emh203 0:3d9c67d97d6f 838 */
emh203 0:3d9c67d97d6f 839 static __INLINE q31_t __QASX(
emh203 0:3d9c67d97d6f 840 q31_t x,
emh203 0:3d9c67d97d6f 841 q31_t y)
emh203 0:3d9c67d97d6f 842 {
emh203 0:3d9c67d97d6f 843
emh203 0:3d9c67d97d6f 844 q31_t sum = 0;
emh203 0:3d9c67d97d6f 845
emh203 0:3d9c67d97d6f 846 sum =
emh203 0:3d9c67d97d6f 847 ((sum +
emh203 0:3d9c67d97d6f 848 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
emh203 0:3d9c67d97d6f 849 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
emh203 0:3d9c67d97d6f 850
emh203 0:3d9c67d97d6f 851 return sum;
emh203 0:3d9c67d97d6f 852 }
emh203 0:3d9c67d97d6f 853
emh203 0:3d9c67d97d6f 854 /*
emh203 0:3d9c67d97d6f 855 * @brief C custom defined SHASX for M3 and M0 processors
emh203 0:3d9c67d97d6f 856 */
emh203 0:3d9c67d97d6f 857 static __INLINE q31_t __SHASX(
emh203 0:3d9c67d97d6f 858 q31_t x,
emh203 0:3d9c67d97d6f 859 q31_t y)
emh203 0:3d9c67d97d6f 860 {
emh203 0:3d9c67d97d6f 861
emh203 0:3d9c67d97d6f 862 q31_t sum;
emh203 0:3d9c67d97d6f 863 q31_t r, s;
emh203 0:3d9c67d97d6f 864
emh203 0:3d9c67d97d6f 865 r = (q15_t) x;
emh203 0:3d9c67d97d6f 866 s = (q15_t) y;
emh203 0:3d9c67d97d6f 867
emh203 0:3d9c67d97d6f 868 r = ((r >> 1) - (y >> 17));
emh203 0:3d9c67d97d6f 869 s = (((x >> 17) + (s >> 1)) << 16);
emh203 0:3d9c67d97d6f 870
emh203 0:3d9c67d97d6f 871 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 872
emh203 0:3d9c67d97d6f 873 return sum;
emh203 0:3d9c67d97d6f 874 }
emh203 0:3d9c67d97d6f 875
emh203 0:3d9c67d97d6f 876
emh203 0:3d9c67d97d6f 877 /*
emh203 0:3d9c67d97d6f 878 * @brief C custom defined QSAX for M3 and M0 processors
emh203 0:3d9c67d97d6f 879 */
emh203 0:3d9c67d97d6f 880 static __INLINE q31_t __QSAX(
emh203 0:3d9c67d97d6f 881 q31_t x,
emh203 0:3d9c67d97d6f 882 q31_t y)
emh203 0:3d9c67d97d6f 883 {
emh203 0:3d9c67d97d6f 884
emh203 0:3d9c67d97d6f 885 q31_t sum = 0;
emh203 0:3d9c67d97d6f 886
emh203 0:3d9c67d97d6f 887 sum =
emh203 0:3d9c67d97d6f 888 ((sum +
emh203 0:3d9c67d97d6f 889 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
emh203 0:3d9c67d97d6f 890 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
emh203 0:3d9c67d97d6f 891
emh203 0:3d9c67d97d6f 892 return sum;
emh203 0:3d9c67d97d6f 893 }
emh203 0:3d9c67d97d6f 894
emh203 0:3d9c67d97d6f 895 /*
emh203 0:3d9c67d97d6f 896 * @brief C custom defined SHSAX for M3 and M0 processors
emh203 0:3d9c67d97d6f 897 */
emh203 0:3d9c67d97d6f 898 static __INLINE q31_t __SHSAX(
emh203 0:3d9c67d97d6f 899 q31_t x,
emh203 0:3d9c67d97d6f 900 q31_t y)
emh203 0:3d9c67d97d6f 901 {
emh203 0:3d9c67d97d6f 902
emh203 0:3d9c67d97d6f 903 q31_t sum;
emh203 0:3d9c67d97d6f 904 q31_t r, s;
emh203 0:3d9c67d97d6f 905
emh203 0:3d9c67d97d6f 906 r = (q15_t) x;
emh203 0:3d9c67d97d6f 907 s = (q15_t) y;
emh203 0:3d9c67d97d6f 908
emh203 0:3d9c67d97d6f 909 r = ((r >> 1) + (y >> 17));
emh203 0:3d9c67d97d6f 910 s = (((x >> 17) - (s >> 1)) << 16);
emh203 0:3d9c67d97d6f 911
emh203 0:3d9c67d97d6f 912 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
emh203 0:3d9c67d97d6f 913
emh203 0:3d9c67d97d6f 914 return sum;
emh203 0:3d9c67d97d6f 915 }
emh203 0:3d9c67d97d6f 916
emh203 0:3d9c67d97d6f 917 /*
emh203 0:3d9c67d97d6f 918 * @brief C custom defined SMUSDX for M3 and M0 processors
emh203 0:3d9c67d97d6f 919 */
emh203 0:3d9c67d97d6f 920 static __INLINE q31_t __SMUSDX(
emh203 0:3d9c67d97d6f 921 q31_t x,
emh203 0:3d9c67d97d6f 922 q31_t y)
emh203 0:3d9c67d97d6f 923 {
emh203 0:3d9c67d97d6f 924
emh203 0:3d9c67d97d6f 925 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
emh203 0:3d9c67d97d6f 926 ((q15_t) (x >> 16) * (q15_t) y)));
emh203 0:3d9c67d97d6f 927 }
emh203 0:3d9c67d97d6f 928
emh203 0:3d9c67d97d6f 929 /*
emh203 0:3d9c67d97d6f 930 * @brief C custom defined SMUADX for M3 and M0 processors
emh203 0:3d9c67d97d6f 931 */
emh203 0:3d9c67d97d6f 932 static __INLINE q31_t __SMUADX(
emh203 0:3d9c67d97d6f 933 q31_t x,
emh203 0:3d9c67d97d6f 934 q31_t y)
emh203 0:3d9c67d97d6f 935 {
emh203 0:3d9c67d97d6f 936
emh203 0:3d9c67d97d6f 937 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
emh203 0:3d9c67d97d6f 938 ((q15_t) (x >> 16) * (q15_t) y)));
emh203 0:3d9c67d97d6f 939 }
emh203 0:3d9c67d97d6f 940
emh203 0:3d9c67d97d6f 941 /*
emh203 0:3d9c67d97d6f 942 * @brief C custom defined QADD for M3 and M0 processors
emh203 0:3d9c67d97d6f 943 */
emh203 0:3d9c67d97d6f 944 static __INLINE q31_t __QADD(
emh203 0:3d9c67d97d6f 945 q31_t x,
emh203 0:3d9c67d97d6f 946 q31_t y)
emh203 0:3d9c67d97d6f 947 {
emh203 0:3d9c67d97d6f 948 return clip_q63_to_q31((q63_t) x + y);
emh203 0:3d9c67d97d6f 949 }
emh203 0:3d9c67d97d6f 950
emh203 0:3d9c67d97d6f 951 /*
emh203 0:3d9c67d97d6f 952 * @brief C custom defined QSUB for M3 and M0 processors
emh203 0:3d9c67d97d6f 953 */
emh203 0:3d9c67d97d6f 954 static __INLINE q31_t __QSUB(
emh203 0:3d9c67d97d6f 955 q31_t x,
emh203 0:3d9c67d97d6f 956 q31_t y)
emh203 0:3d9c67d97d6f 957 {
emh203 0:3d9c67d97d6f 958 return clip_q63_to_q31((q63_t) x - y);
emh203 0:3d9c67d97d6f 959 }
emh203 0:3d9c67d97d6f 960
emh203 0:3d9c67d97d6f 961 /*
emh203 0:3d9c67d97d6f 962 * @brief C custom defined SMLAD for M3 and M0 processors
emh203 0:3d9c67d97d6f 963 */
emh203 0:3d9c67d97d6f 964 static __INLINE q31_t __SMLAD(
emh203 0:3d9c67d97d6f 965 q31_t x,
emh203 0:3d9c67d97d6f 966 q31_t y,
emh203 0:3d9c67d97d6f 967 q31_t sum)
emh203 0:3d9c67d97d6f 968 {
emh203 0:3d9c67d97d6f 969
emh203 0:3d9c67d97d6f 970 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
emh203 0:3d9c67d97d6f 971 ((q15_t) x * (q15_t) y));
emh203 0:3d9c67d97d6f 972 }
emh203 0:3d9c67d97d6f 973
emh203 0:3d9c67d97d6f 974 /*
emh203 0:3d9c67d97d6f 975 * @brief C custom defined SMLADX for M3 and M0 processors
emh203 0:3d9c67d97d6f 976 */
emh203 0:3d9c67d97d6f 977 static __INLINE q31_t __SMLADX(
emh203 0:3d9c67d97d6f 978 q31_t x,
emh203 0:3d9c67d97d6f 979 q31_t y,
emh203 0:3d9c67d97d6f 980 q31_t sum)
emh203 0:3d9c67d97d6f 981 {
emh203 0:3d9c67d97d6f 982
emh203 0:3d9c67d97d6f 983 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
emh203 0:3d9c67d97d6f 984 ((q15_t) x * (q15_t) (y >> 16)));
emh203 0:3d9c67d97d6f 985 }
emh203 0:3d9c67d97d6f 986
emh203 0:3d9c67d97d6f 987 /*
emh203 0:3d9c67d97d6f 988 * @brief C custom defined SMLSDX for M3 and M0 processors
emh203 0:3d9c67d97d6f 989 */
emh203 0:3d9c67d97d6f 990 static __INLINE q31_t __SMLSDX(
emh203 0:3d9c67d97d6f 991 q31_t x,
emh203 0:3d9c67d97d6f 992 q31_t y,
emh203 0:3d9c67d97d6f 993 q31_t sum)
emh203 0:3d9c67d97d6f 994 {
emh203 0:3d9c67d97d6f 995
emh203 0:3d9c67d97d6f 996 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
emh203 0:3d9c67d97d6f 997 ((q15_t) x * (q15_t) (y >> 16)));
emh203 0:3d9c67d97d6f 998 }
emh203 0:3d9c67d97d6f 999
emh203 0:3d9c67d97d6f 1000 /*
emh203 0:3d9c67d97d6f 1001 * @brief C custom defined SMLALD for M3 and M0 processors
emh203 0:3d9c67d97d6f 1002 */
emh203 0:3d9c67d97d6f 1003 static __INLINE q63_t __SMLALD(
emh203 0:3d9c67d97d6f 1004 q31_t x,
emh203 0:3d9c67d97d6f 1005 q31_t y,
emh203 0:3d9c67d97d6f 1006 q63_t sum)
emh203 0:3d9c67d97d6f 1007 {
emh203 0:3d9c67d97d6f 1008
emh203 0:3d9c67d97d6f 1009 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
emh203 0:3d9c67d97d6f 1010 ((q15_t) x * (q15_t) y));
emh203 0:3d9c67d97d6f 1011 }
emh203 0:3d9c67d97d6f 1012
emh203 0:3d9c67d97d6f 1013 /*
emh203 0:3d9c67d97d6f 1014 * @brief C custom defined SMLALDX for M3 and M0 processors
emh203 0:3d9c67d97d6f 1015 */
emh203 0:3d9c67d97d6f 1016 static __INLINE q63_t __SMLALDX(
emh203 0:3d9c67d97d6f 1017 q31_t x,
emh203 0:3d9c67d97d6f 1018 q31_t y,
emh203 0:3d9c67d97d6f 1019 q63_t sum)
emh203 0:3d9c67d97d6f 1020 {
emh203 0:3d9c67d97d6f 1021
emh203 0:3d9c67d97d6f 1022 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
emh203 0:3d9c67d97d6f 1023 ((q15_t) x * (q15_t) (y >> 16));
emh203 0:3d9c67d97d6f 1024 }
emh203 0:3d9c67d97d6f 1025
emh203 0:3d9c67d97d6f 1026 /*
emh203 0:3d9c67d97d6f 1027 * @brief C custom defined SMUAD for M3 and M0 processors
emh203 0:3d9c67d97d6f 1028 */
emh203 0:3d9c67d97d6f 1029 static __INLINE q31_t __SMUAD(
emh203 0:3d9c67d97d6f 1030 q31_t x,
emh203 0:3d9c67d97d6f 1031 q31_t y)
emh203 0:3d9c67d97d6f 1032 {
emh203 0:3d9c67d97d6f 1033
emh203 0:3d9c67d97d6f 1034 return (((x >> 16) * (y >> 16)) +
emh203 0:3d9c67d97d6f 1035 (((x << 16) >> 16) * ((y << 16) >> 16)));
emh203 0:3d9c67d97d6f 1036 }
emh203 0:3d9c67d97d6f 1037
emh203 0:3d9c67d97d6f 1038 /*
emh203 0:3d9c67d97d6f 1039 * @brief C custom defined SMUSD for M3 and M0 processors
emh203 0:3d9c67d97d6f 1040 */
emh203 0:3d9c67d97d6f 1041 static __INLINE q31_t __SMUSD(
emh203 0:3d9c67d97d6f 1042 q31_t x,
emh203 0:3d9c67d97d6f 1043 q31_t y)
emh203 0:3d9c67d97d6f 1044 {
emh203 0:3d9c67d97d6f 1045
emh203 0:3d9c67d97d6f 1046 return (-((x >> 16) * (y >> 16)) +
emh203 0:3d9c67d97d6f 1047 (((x << 16) >> 16) * ((y << 16) >> 16)));
emh203 0:3d9c67d97d6f 1048 }
emh203 0:3d9c67d97d6f 1049
emh203 0:3d9c67d97d6f 1050
emh203 0:3d9c67d97d6f 1051 /*
emh203 0:3d9c67d97d6f 1052 * @brief C custom defined SXTB16 for M3 and M0 processors
emh203 0:3d9c67d97d6f 1053 */
emh203 0:3d9c67d97d6f 1054 static __INLINE q31_t __SXTB16(
emh203 0:3d9c67d97d6f 1055 q31_t x)
emh203 0:3d9c67d97d6f 1056 {
emh203 0:3d9c67d97d6f 1057
emh203 0:3d9c67d97d6f 1058 return ((((x << 24) >> 24) & 0x0000FFFF) |
emh203 0:3d9c67d97d6f 1059 (((x << 8) >> 8) & 0xFFFF0000));
emh203 0:3d9c67d97d6f 1060 }
emh203 0:3d9c67d97d6f 1061
emh203 0:3d9c67d97d6f 1062
emh203 0:3d9c67d97d6f 1063 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
emh203 0:3d9c67d97d6f 1064
emh203 0:3d9c67d97d6f 1065
emh203 0:3d9c67d97d6f 1066 /**
emh203 0:3d9c67d97d6f 1067 * @brief Instance structure for the Q7 FIR filter.
emh203 0:3d9c67d97d6f 1068 */
emh203 0:3d9c67d97d6f 1069 typedef struct
emh203 0:3d9c67d97d6f 1070 {
emh203 0:3d9c67d97d6f 1071 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emh203 0:3d9c67d97d6f 1072 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emh203 0:3d9c67d97d6f 1073 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
emh203 0:3d9c67d97d6f 1074 } arm_fir_instance_q7;
emh203 0:3d9c67d97d6f 1075
emh203 0:3d9c67d97d6f 1076 /**
emh203 0:3d9c67d97d6f 1077 * @brief Instance structure for the Q15 FIR filter.
emh203 0:3d9c67d97d6f 1078 */
emh203 0:3d9c67d97d6f 1079 typedef struct
emh203 0:3d9c67d97d6f 1080 {
emh203 0:3d9c67d97d6f 1081 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emh203 0:3d9c67d97d6f 1082 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emh203 0:3d9c67d97d6f 1083 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
emh203 0:3d9c67d97d6f 1084 } arm_fir_instance_q15;
emh203 0:3d9c67d97d6f 1085
emh203 0:3d9c67d97d6f 1086 /**
emh203 0:3d9c67d97d6f 1087 * @brief Instance structure for the Q31 FIR filter.
emh203 0:3d9c67d97d6f 1088 */
emh203 0:3d9c67d97d6f 1089 typedef struct
emh203 0:3d9c67d97d6f 1090 {
emh203 0:3d9c67d97d6f 1091 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emh203 0:3d9c67d97d6f 1092 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emh203 0:3d9c67d97d6f 1093 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
emh203 0:3d9c67d97d6f 1094 } arm_fir_instance_q31;
emh203 0:3d9c67d97d6f 1095
emh203 0:3d9c67d97d6f 1096 /**
emh203 0:3d9c67d97d6f 1097 * @brief Instance structure for the floating-point FIR filter.
emh203 0:3d9c67d97d6f 1098 */
emh203 0:3d9c67d97d6f 1099 typedef struct
emh203 0:3d9c67d97d6f 1100 {
emh203 0:3d9c67d97d6f 1101 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emh203 0:3d9c67d97d6f 1102 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emh203 0:3d9c67d97d6f 1103 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
emh203 0:3d9c67d97d6f 1104 } arm_fir_instance_f32;
emh203 0:3d9c67d97d6f 1105
emh203 0:3d9c67d97d6f 1106
emh203 0:3d9c67d97d6f 1107 /**
emh203 0:3d9c67d97d6f 1108 * @brief Processing function for the Q7 FIR filter.
emh203 0:3d9c67d97d6f 1109 * @param[in] *S points to an instance of the Q7 FIR filter structure.
emh203 0:3d9c67d97d6f 1110 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1111 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1112 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1113 * @return none.
emh203 0:3d9c67d97d6f 1114 */
emh203 0:3d9c67d97d6f 1115 void arm_fir_q7(
emh203 0:3d9c67d97d6f 1116 const arm_fir_instance_q7 * S,
emh203 0:3d9c67d97d6f 1117 q7_t * pSrc,
emh203 0:3d9c67d97d6f 1118 q7_t * pDst,
emh203 0:3d9c67d97d6f 1119 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1120
emh203 0:3d9c67d97d6f 1121
emh203 0:3d9c67d97d6f 1122 /**
emh203 0:3d9c67d97d6f 1123 * @brief Initialization function for the Q7 FIR filter.
emh203 0:3d9c67d97d6f 1124 * @param[in,out] *S points to an instance of the Q7 FIR structure.
emh203 0:3d9c67d97d6f 1125 * @param[in] numTaps Number of filter coefficients in the filter.
emh203 0:3d9c67d97d6f 1126 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1127 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1128 * @param[in] blockSize number of samples that are processed.
emh203 0:3d9c67d97d6f 1129 * @return none
emh203 0:3d9c67d97d6f 1130 */
emh203 0:3d9c67d97d6f 1131 void arm_fir_init_q7(
emh203 0:3d9c67d97d6f 1132 arm_fir_instance_q7 * S,
emh203 0:3d9c67d97d6f 1133 uint16_t numTaps,
emh203 0:3d9c67d97d6f 1134 q7_t * pCoeffs,
emh203 0:3d9c67d97d6f 1135 q7_t * pState,
emh203 0:3d9c67d97d6f 1136 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1137
emh203 0:3d9c67d97d6f 1138
emh203 0:3d9c67d97d6f 1139 /**
emh203 0:3d9c67d97d6f 1140 * @brief Processing function for the Q15 FIR filter.
emh203 0:3d9c67d97d6f 1141 * @param[in] *S points to an instance of the Q15 FIR structure.
emh203 0:3d9c67d97d6f 1142 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1143 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1144 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1145 * @return none.
emh203 0:3d9c67d97d6f 1146 */
emh203 0:3d9c67d97d6f 1147 void arm_fir_q15(
emh203 0:3d9c67d97d6f 1148 const arm_fir_instance_q15 * S,
emh203 0:3d9c67d97d6f 1149 q15_t * pSrc,
emh203 0:3d9c67d97d6f 1150 q15_t * pDst,
emh203 0:3d9c67d97d6f 1151 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1152
emh203 0:3d9c67d97d6f 1153 /**
emh203 0:3d9c67d97d6f 1154 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
emh203 0:3d9c67d97d6f 1155 * @param[in] *S points to an instance of the Q15 FIR filter structure.
emh203 0:3d9c67d97d6f 1156 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1157 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1158 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1159 * @return none.
emh203 0:3d9c67d97d6f 1160 */
emh203 0:3d9c67d97d6f 1161 void arm_fir_fast_q15(
emh203 0:3d9c67d97d6f 1162 const arm_fir_instance_q15 * S,
emh203 0:3d9c67d97d6f 1163 q15_t * pSrc,
emh203 0:3d9c67d97d6f 1164 q15_t * pDst,
emh203 0:3d9c67d97d6f 1165 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1166
emh203 0:3d9c67d97d6f 1167 /**
emh203 0:3d9c67d97d6f 1168 * @brief Initialization function for the Q15 FIR filter.
emh203 0:3d9c67d97d6f 1169 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
emh203 0:3d9c67d97d6f 1170 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
emh203 0:3d9c67d97d6f 1171 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1172 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1173 * @param[in] blockSize number of samples that are processed at a time.
emh203 0:3d9c67d97d6f 1174 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
emh203 0:3d9c67d97d6f 1175 * <code>numTaps</code> is not a supported value.
emh203 0:3d9c67d97d6f 1176 */
emh203 0:3d9c67d97d6f 1177
emh203 0:3d9c67d97d6f 1178 arm_status arm_fir_init_q15(
emh203 0:3d9c67d97d6f 1179 arm_fir_instance_q15 * S,
emh203 0:3d9c67d97d6f 1180 uint16_t numTaps,
emh203 0:3d9c67d97d6f 1181 q15_t * pCoeffs,
emh203 0:3d9c67d97d6f 1182 q15_t * pState,
emh203 0:3d9c67d97d6f 1183 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1184
emh203 0:3d9c67d97d6f 1185 /**
emh203 0:3d9c67d97d6f 1186 * @brief Processing function for the Q31 FIR filter.
emh203 0:3d9c67d97d6f 1187 * @param[in] *S points to an instance of the Q31 FIR filter structure.
emh203 0:3d9c67d97d6f 1188 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1189 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1190 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1191 * @return none.
emh203 0:3d9c67d97d6f 1192 */
emh203 0:3d9c67d97d6f 1193 void arm_fir_q31(
emh203 0:3d9c67d97d6f 1194 const arm_fir_instance_q31 * S,
emh203 0:3d9c67d97d6f 1195 q31_t * pSrc,
emh203 0:3d9c67d97d6f 1196 q31_t * pDst,
emh203 0:3d9c67d97d6f 1197 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1198
emh203 0:3d9c67d97d6f 1199 /**
emh203 0:3d9c67d97d6f 1200 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
emh203 0:3d9c67d97d6f 1201 * @param[in] *S points to an instance of the Q31 FIR structure.
emh203 0:3d9c67d97d6f 1202 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1203 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1204 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1205 * @return none.
emh203 0:3d9c67d97d6f 1206 */
emh203 0:3d9c67d97d6f 1207 void arm_fir_fast_q31(
emh203 0:3d9c67d97d6f 1208 const arm_fir_instance_q31 * S,
emh203 0:3d9c67d97d6f 1209 q31_t * pSrc,
emh203 0:3d9c67d97d6f 1210 q31_t * pDst,
emh203 0:3d9c67d97d6f 1211 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1212
emh203 0:3d9c67d97d6f 1213 /**
emh203 0:3d9c67d97d6f 1214 * @brief Initialization function for the Q31 FIR filter.
emh203 0:3d9c67d97d6f 1215 * @param[in,out] *S points to an instance of the Q31 FIR structure.
emh203 0:3d9c67d97d6f 1216 * @param[in] numTaps Number of filter coefficients in the filter.
emh203 0:3d9c67d97d6f 1217 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1218 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1219 * @param[in] blockSize number of samples that are processed at a time.
emh203 0:3d9c67d97d6f 1220 * @return none.
emh203 0:3d9c67d97d6f 1221 */
emh203 0:3d9c67d97d6f 1222 void arm_fir_init_q31(
emh203 0:3d9c67d97d6f 1223 arm_fir_instance_q31 * S,
emh203 0:3d9c67d97d6f 1224 uint16_t numTaps,
emh203 0:3d9c67d97d6f 1225 q31_t * pCoeffs,
emh203 0:3d9c67d97d6f 1226 q31_t * pState,
emh203 0:3d9c67d97d6f 1227 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1228
emh203 0:3d9c67d97d6f 1229 /**
emh203 0:3d9c67d97d6f 1230 * @brief Processing function for the floating-point FIR filter.
emh203 0:3d9c67d97d6f 1231 * @param[in] *S points to an instance of the floating-point FIR structure.
emh203 0:3d9c67d97d6f 1232 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1233 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1234 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1235 * @return none.
emh203 0:3d9c67d97d6f 1236 */
emh203 0:3d9c67d97d6f 1237 void arm_fir_f32(
emh203 0:3d9c67d97d6f 1238 const arm_fir_instance_f32 * S,
emh203 0:3d9c67d97d6f 1239 float32_t * pSrc,
emh203 0:3d9c67d97d6f 1240 float32_t * pDst,
emh203 0:3d9c67d97d6f 1241 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1242
emh203 0:3d9c67d97d6f 1243 /**
emh203 0:3d9c67d97d6f 1244 * @brief Initialization function for the floating-point FIR filter.
emh203 0:3d9c67d97d6f 1245 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
emh203 0:3d9c67d97d6f 1246 * @param[in] numTaps Number of filter coefficients in the filter.
emh203 0:3d9c67d97d6f 1247 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1248 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1249 * @param[in] blockSize number of samples that are processed at a time.
emh203 0:3d9c67d97d6f 1250 * @return none.
emh203 0:3d9c67d97d6f 1251 */
emh203 0:3d9c67d97d6f 1252 void arm_fir_init_f32(
emh203 0:3d9c67d97d6f 1253 arm_fir_instance_f32 * S,
emh203 0:3d9c67d97d6f 1254 uint16_t numTaps,
emh203 0:3d9c67d97d6f 1255 float32_t * pCoeffs,
emh203 0:3d9c67d97d6f 1256 float32_t * pState,
emh203 0:3d9c67d97d6f 1257 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1258
emh203 0:3d9c67d97d6f 1259
emh203 0:3d9c67d97d6f 1260 /**
emh203 0:3d9c67d97d6f 1261 * @brief Instance structure for the Q15 Biquad cascade filter.
emh203 0:3d9c67d97d6f 1262 */
emh203 0:3d9c67d97d6f 1263 typedef struct
emh203 0:3d9c67d97d6f 1264 {
emh203 0:3d9c67d97d6f 1265 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
emh203 0:3d9c67d97d6f 1266 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
emh203 0:3d9c67d97d6f 1267 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
emh203 0:3d9c67d97d6f 1268 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
emh203 0:3d9c67d97d6f 1269
emh203 0:3d9c67d97d6f 1270 } arm_biquad_casd_df1_inst_q15;
emh203 0:3d9c67d97d6f 1271
emh203 0:3d9c67d97d6f 1272
emh203 0:3d9c67d97d6f 1273 /**
emh203 0:3d9c67d97d6f 1274 * @brief Instance structure for the Q31 Biquad cascade filter.
emh203 0:3d9c67d97d6f 1275 */
emh203 0:3d9c67d97d6f 1276 typedef struct
emh203 0:3d9c67d97d6f 1277 {
emh203 0:3d9c67d97d6f 1278 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
emh203 0:3d9c67d97d6f 1279 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
emh203 0:3d9c67d97d6f 1280 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
emh203 0:3d9c67d97d6f 1281 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
emh203 0:3d9c67d97d6f 1282
emh203 0:3d9c67d97d6f 1283 } arm_biquad_casd_df1_inst_q31;
emh203 0:3d9c67d97d6f 1284
emh203 0:3d9c67d97d6f 1285 /**
emh203 0:3d9c67d97d6f 1286 * @brief Instance structure for the floating-point Biquad cascade filter.
emh203 0:3d9c67d97d6f 1287 */
emh203 0:3d9c67d97d6f 1288 typedef struct
emh203 0:3d9c67d97d6f 1289 {
emh203 0:3d9c67d97d6f 1290 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
emh203 0:3d9c67d97d6f 1291 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
emh203 0:3d9c67d97d6f 1292 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
emh203 0:3d9c67d97d6f 1293
emh203 0:3d9c67d97d6f 1294
emh203 0:3d9c67d97d6f 1295 } arm_biquad_casd_df1_inst_f32;
emh203 0:3d9c67d97d6f 1296
emh203 0:3d9c67d97d6f 1297
emh203 0:3d9c67d97d6f 1298
emh203 0:3d9c67d97d6f 1299 /**
emh203 0:3d9c67d97d6f 1300 * @brief Processing function for the Q15 Biquad cascade filter.
emh203 0:3d9c67d97d6f 1301 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1302 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1303 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1304 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1305 * @return none.
emh203 0:3d9c67d97d6f 1306 */
emh203 0:3d9c67d97d6f 1307
emh203 0:3d9c67d97d6f 1308 void arm_biquad_cascade_df1_q15(
emh203 0:3d9c67d97d6f 1309 const arm_biquad_casd_df1_inst_q15 * S,
emh203 0:3d9c67d97d6f 1310 q15_t * pSrc,
emh203 0:3d9c67d97d6f 1311 q15_t * pDst,
emh203 0:3d9c67d97d6f 1312 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1313
emh203 0:3d9c67d97d6f 1314 /**
emh203 0:3d9c67d97d6f 1315 * @brief Initialization function for the Q15 Biquad cascade filter.
emh203 0:3d9c67d97d6f 1316 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1317 * @param[in] numStages number of 2nd order stages in the filter.
emh203 0:3d9c67d97d6f 1318 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1319 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1320 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
emh203 0:3d9c67d97d6f 1321 * @return none
emh203 0:3d9c67d97d6f 1322 */
emh203 0:3d9c67d97d6f 1323
emh203 0:3d9c67d97d6f 1324 void arm_biquad_cascade_df1_init_q15(
emh203 0:3d9c67d97d6f 1325 arm_biquad_casd_df1_inst_q15 * S,
emh203 0:3d9c67d97d6f 1326 uint8_t numStages,
emh203 0:3d9c67d97d6f 1327 q15_t * pCoeffs,
emh203 0:3d9c67d97d6f 1328 q15_t * pState,
emh203 0:3d9c67d97d6f 1329 int8_t postShift);
emh203 0:3d9c67d97d6f 1330
emh203 0:3d9c67d97d6f 1331
emh203 0:3d9c67d97d6f 1332 /**
emh203 0:3d9c67d97d6f 1333 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
emh203 0:3d9c67d97d6f 1334 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1335 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1336 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1337 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1338 * @return none.
emh203 0:3d9c67d97d6f 1339 */
emh203 0:3d9c67d97d6f 1340
emh203 0:3d9c67d97d6f 1341 void arm_biquad_cascade_df1_fast_q15(
emh203 0:3d9c67d97d6f 1342 const arm_biquad_casd_df1_inst_q15 * S,
emh203 0:3d9c67d97d6f 1343 q15_t * pSrc,
emh203 0:3d9c67d97d6f 1344 q15_t * pDst,
emh203 0:3d9c67d97d6f 1345 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1346
emh203 0:3d9c67d97d6f 1347
emh203 0:3d9c67d97d6f 1348 /**
emh203 0:3d9c67d97d6f 1349 * @brief Processing function for the Q31 Biquad cascade filter
emh203 0:3d9c67d97d6f 1350 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1351 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1352 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1353 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1354 * @return none.
emh203 0:3d9c67d97d6f 1355 */
emh203 0:3d9c67d97d6f 1356
emh203 0:3d9c67d97d6f 1357 void arm_biquad_cascade_df1_q31(
emh203 0:3d9c67d97d6f 1358 const arm_biquad_casd_df1_inst_q31 * S,
emh203 0:3d9c67d97d6f 1359 q31_t * pSrc,
emh203 0:3d9c67d97d6f 1360 q31_t * pDst,
emh203 0:3d9c67d97d6f 1361 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1362
emh203 0:3d9c67d97d6f 1363 /**
emh203 0:3d9c67d97d6f 1364 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
emh203 0:3d9c67d97d6f 1365 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1366 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1367 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1368 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1369 * @return none.
emh203 0:3d9c67d97d6f 1370 */
emh203 0:3d9c67d97d6f 1371
emh203 0:3d9c67d97d6f 1372 void arm_biquad_cascade_df1_fast_q31(
emh203 0:3d9c67d97d6f 1373 const arm_biquad_casd_df1_inst_q31 * S,
emh203 0:3d9c67d97d6f 1374 q31_t * pSrc,
emh203 0:3d9c67d97d6f 1375 q31_t * pDst,
emh203 0:3d9c67d97d6f 1376 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1377
emh203 0:3d9c67d97d6f 1378 /**
emh203 0:3d9c67d97d6f 1379 * @brief Initialization function for the Q31 Biquad cascade filter.
emh203 0:3d9c67d97d6f 1380 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
emh203 0:3d9c67d97d6f 1381 * @param[in] numStages number of 2nd order stages in the filter.
emh203 0:3d9c67d97d6f 1382 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1383 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1384 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
emh203 0:3d9c67d97d6f 1385 * @return none
emh203 0:3d9c67d97d6f 1386 */
emh203 0:3d9c67d97d6f 1387
emh203 0:3d9c67d97d6f 1388 void arm_biquad_cascade_df1_init_q31(
emh203 0:3d9c67d97d6f 1389 arm_biquad_casd_df1_inst_q31 * S,
emh203 0:3d9c67d97d6f 1390 uint8_t numStages,
emh203 0:3d9c67d97d6f 1391 q31_t * pCoeffs,
emh203 0:3d9c67d97d6f 1392 q31_t * pState,
emh203 0:3d9c67d97d6f 1393 int8_t postShift);
emh203 0:3d9c67d97d6f 1394
emh203 0:3d9c67d97d6f 1395 /**
emh203 0:3d9c67d97d6f 1396 * @brief Processing function for the floating-point Biquad cascade filter.
emh203 0:3d9c67d97d6f 1397 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
emh203 0:3d9c67d97d6f 1398 * @param[in] *pSrc points to the block of input data.
emh203 0:3d9c67d97d6f 1399 * @param[out] *pDst points to the block of output data.
emh203 0:3d9c67d97d6f 1400 * @param[in] blockSize number of samples to process.
emh203 0:3d9c67d97d6f 1401 * @return none.
emh203 0:3d9c67d97d6f 1402 */
emh203 0:3d9c67d97d6f 1403
emh203 0:3d9c67d97d6f 1404 void arm_biquad_cascade_df1_f32(
emh203 0:3d9c67d97d6f 1405 const arm_biquad_casd_df1_inst_f32 * S,
emh203 0:3d9c67d97d6f 1406 float32_t * pSrc,
emh203 0:3d9c67d97d6f 1407 float32_t * pDst,
emh203 0:3d9c67d97d6f 1408 uint32_t blockSize);
emh203 0:3d9c67d97d6f 1409
emh203 0:3d9c67d97d6f 1410 /**
emh203 0:3d9c67d97d6f 1411 * @brief Initialization function for the floating-point Biquad cascade filter.
emh203 0:3d9c67d97d6f 1412 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
emh203 0:3d9c67d97d6f 1413 * @param[in] numStages number of 2nd order stages in the filter.
emh203 0:3d9c67d97d6f 1414 * @param[in] *pCoeffs points to the filter coefficients.
emh203 0:3d9c67d97d6f 1415 * @param[in] *pState points to the state buffer.
emh203 0:3d9c67d97d6f 1416 * @return none
emh203 0:3d9c67d97d6f 1417 */
emh203 0:3d9c67d97d6f 1418
emh203 0:3d9c67d97d6f 1419 void arm_biquad_cascade_df1_init_f32(
emh203 0:3d9c67d97d6f 1420 arm_biquad_casd_df1_inst_f32 * S,
emh203 0:3d9c67d97d6f 1421 uint8_t numStages,
emh203 0:3d9c67d97d6f 1422 float32_t * pCoeffs,
emh203 0:3d9c67d97d6f 1423 float32_t * pState);
emh203 0:3d9c67d97d6f 1424
emh203 0:3d9c67d97d6f 1425
emh203 0:3d9c67d97d6f 1426 /**
emh203 0:3d9c67d97d6f 1427 * @brief Instance structure for the floating-point matrix structure.
emh203 0:3d9c67d97d6f 1428 */
emh203 0:3d9c67d97d6f 1429
emh203 0:3d9c67d97d6f 1430 typedef struct
emh203 0:3d9c67d97d6f 1431 {
emh203 0:3d9c67d97d6f 1432 uint16_t numRows; /**< number of rows of the matrix. */
emh203 0:3d9c67d97d6f 1433 uint16_t numCols; /**< number of columns of the matrix. */
emh203 0:3d9c67d97d6f 1434 float32_t *pData; /**< points to the data of the matrix. */
emh203 0:3d9c67d97d6f 1435 } arm_matrix_instance_f32;
emh203 0:3d9c67d97d6f 1436
emh203 0:3d9c67d97d6f 1437 /**
emh203 0:3d9c67d97d6f 1438 * @brief Instance structure for the Q15 matrix structure.
emh203 0:3d9c67d97d6f 1439 */
emh203 0:3d9c67d97d6f 1440
emh203 0:3d9c67d97d6f 1441 typedef struct
emh203 0:3d9c67d97d6f 1442 {
emh203 0:3d9c67d97d6f 1443 uint16_t numRows; /**< number of rows of the matrix. */
emh203 0:3d9c67d97d6f 1444 uint16_t numCols; /**< number of columns of the matrix. */
emh203 0:3d9c67d97d6f 1445 q15_t *pData; /**< points to the data of the matrix. */
emh203 0:3d9c67d97d6f 1446
emh203 0:3d9c67d97d6f 1447 } arm_matrix_instance_q15;
emh203 0:3d9c67d97d6f 1448
emh203 0:3d9c67d97d6f 1449 /**
emh203 0:3d9c67d97d6f 1450 * @brief Instance structure for the Q31 matrix structure.
emh203 0:3d9c67d97d6f 1451 */
emh203 0:3d9c67d97d6f 1452
emh203 0:3d9c67d97d6f 1453 typedef struct
emh203 0:3d9c67d97d6f 1454 {
emh203 0:3d9c67d97d6f 1455 uint16_t numRows; /**< number of rows of the matrix. */
emh203 0:3d9c67d97d6f 1456 uint16_t numCols; /**< number of columns of the matrix. */
emh203 0:3d9c67d97d6f 1457 q31_t *pData; /**< points to the data of the matrix. */
emh203 0:3d9c67d97d6f 1458
emh203 0:3d9c67d97d6f 1459 } arm_matrix_instance_q31;
emh203 0:3d9c67d97d6f 1460
emh203 0:3d9c67d97d6f 1461
emh203 0:3d9c67d97d6f 1462
emh203 0:3d9c67d97d6f 1463 /**
emh203 0:3d9c67d97d6f 1464 * @brief Floating-point matrix addition.
emh203 0:3d9c67d97d6f 1465 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1466 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1467 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1468 * @return The function returns either
emh203 0:3d9c67d97d6f 1469 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1470 */
emh203 0:3d9c67d97d6f 1471
emh203 0:3d9c67d97d6f 1472 arm_status arm_mat_add_f32(
emh203 0:3d9c67d97d6f 1473 const arm_matrix_instance_f32 * pSrcA,
emh203 0:3d9c67d97d6f 1474 const arm_matrix_instance_f32 * pSrcB,
emh203 0:3d9c67d97d6f 1475 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1476
emh203 0:3d9c67d97d6f 1477 /**
emh203 0:3d9c67d97d6f 1478 * @brief Q15 matrix addition.
emh203 0:3d9c67d97d6f 1479 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1480 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1481 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1482 * @return The function returns either
emh203 0:3d9c67d97d6f 1483 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1484 */
emh203 0:3d9c67d97d6f 1485
emh203 0:3d9c67d97d6f 1486 arm_status arm_mat_add_q15(
emh203 0:3d9c67d97d6f 1487 const arm_matrix_instance_q15 * pSrcA,
emh203 0:3d9c67d97d6f 1488 const arm_matrix_instance_q15 * pSrcB,
emh203 0:3d9c67d97d6f 1489 arm_matrix_instance_q15 * pDst);
emh203 0:3d9c67d97d6f 1490
emh203 0:3d9c67d97d6f 1491 /**
emh203 0:3d9c67d97d6f 1492 * @brief Q31 matrix addition.
emh203 0:3d9c67d97d6f 1493 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1494 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1495 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1496 * @return The function returns either
emh203 0:3d9c67d97d6f 1497 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1498 */
emh203 0:3d9c67d97d6f 1499
emh203 0:3d9c67d97d6f 1500 arm_status arm_mat_add_q31(
emh203 0:3d9c67d97d6f 1501 const arm_matrix_instance_q31 * pSrcA,
emh203 0:3d9c67d97d6f 1502 const arm_matrix_instance_q31 * pSrcB,
emh203 0:3d9c67d97d6f 1503 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1504
emh203 0:3d9c67d97d6f 1505 /**
emh203 0:3d9c67d97d6f 1506 * @brief Floating-point, complex, matrix multiplication.
emh203 0:3d9c67d97d6f 1507 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1508 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1509 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1510 * @return The function returns either
emh203 0:3d9c67d97d6f 1511 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1512 */
emh203 0:3d9c67d97d6f 1513
emh203 0:3d9c67d97d6f 1514 arm_status arm_mat_cmplx_mult_f32(
emh203 0:3d9c67d97d6f 1515 const arm_matrix_instance_f32 * pSrcA,
emh203 0:3d9c67d97d6f 1516 const arm_matrix_instance_f32 * pSrcB,
emh203 0:3d9c67d97d6f 1517 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1518
emh203 0:3d9c67d97d6f 1519 /**
emh203 0:3d9c67d97d6f 1520 * @brief Q15, complex, matrix multiplication.
emh203 0:3d9c67d97d6f 1521 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1522 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1523 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1524 * @return The function returns either
emh203 0:3d9c67d97d6f 1525 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1526 */
emh203 0:3d9c67d97d6f 1527
emh203 0:3d9c67d97d6f 1528 arm_status arm_mat_cmplx_mult_q15(
emh203 0:3d9c67d97d6f 1529 const arm_matrix_instance_q15 * pSrcA,
emh203 0:3d9c67d97d6f 1530 const arm_matrix_instance_q15 * pSrcB,
emh203 0:3d9c67d97d6f 1531 arm_matrix_instance_q15 * pDst,
emh203 0:3d9c67d97d6f 1532 q15_t * pScratch);
emh203 0:3d9c67d97d6f 1533
emh203 0:3d9c67d97d6f 1534 /**
emh203 0:3d9c67d97d6f 1535 * @brief Q31, complex, matrix multiplication.
emh203 0:3d9c67d97d6f 1536 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1537 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1538 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1539 * @return The function returns either
emh203 0:3d9c67d97d6f 1540 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1541 */
emh203 0:3d9c67d97d6f 1542
emh203 0:3d9c67d97d6f 1543 arm_status arm_mat_cmplx_mult_q31(
emh203 0:3d9c67d97d6f 1544 const arm_matrix_instance_q31 * pSrcA,
emh203 0:3d9c67d97d6f 1545 const arm_matrix_instance_q31 * pSrcB,
emh203 0:3d9c67d97d6f 1546 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1547
emh203 0:3d9c67d97d6f 1548
emh203 0:3d9c67d97d6f 1549 /**
emh203 0:3d9c67d97d6f 1550 * @brief Floating-point matrix transpose.
emh203 0:3d9c67d97d6f 1551 * @param[in] *pSrc points to the input matrix
emh203 0:3d9c67d97d6f 1552 * @param[out] *pDst points to the output matrix
emh203 0:3d9c67d97d6f 1553 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emh203 0:3d9c67d97d6f 1554 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1555 */
emh203 0:3d9c67d97d6f 1556
emh203 0:3d9c67d97d6f 1557 arm_status arm_mat_trans_f32(
emh203 0:3d9c67d97d6f 1558 const arm_matrix_instance_f32 * pSrc,
emh203 0:3d9c67d97d6f 1559 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1560
emh203 0:3d9c67d97d6f 1561
emh203 0:3d9c67d97d6f 1562 /**
emh203 0:3d9c67d97d6f 1563 * @brief Q15 matrix transpose.
emh203 0:3d9c67d97d6f 1564 * @param[in] *pSrc points to the input matrix
emh203 0:3d9c67d97d6f 1565 * @param[out] *pDst points to the output matrix
emh203 0:3d9c67d97d6f 1566 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emh203 0:3d9c67d97d6f 1567 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1568 */
emh203 0:3d9c67d97d6f 1569
emh203 0:3d9c67d97d6f 1570 arm_status arm_mat_trans_q15(
emh203 0:3d9c67d97d6f 1571 const arm_matrix_instance_q15 * pSrc,
emh203 0:3d9c67d97d6f 1572 arm_matrix_instance_q15 * pDst);
emh203 0:3d9c67d97d6f 1573
emh203 0:3d9c67d97d6f 1574 /**
emh203 0:3d9c67d97d6f 1575 * @brief Q31 matrix transpose.
emh203 0:3d9c67d97d6f 1576 * @param[in] *pSrc points to the input matrix
emh203 0:3d9c67d97d6f 1577 * @param[out] *pDst points to the output matrix
emh203 0:3d9c67d97d6f 1578 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emh203 0:3d9c67d97d6f 1579 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1580 */
emh203 0:3d9c67d97d6f 1581
emh203 0:3d9c67d97d6f 1582 arm_status arm_mat_trans_q31(
emh203 0:3d9c67d97d6f 1583 const arm_matrix_instance_q31 * pSrc,
emh203 0:3d9c67d97d6f 1584 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1585
emh203 0:3d9c67d97d6f 1586
emh203 0:3d9c67d97d6f 1587 /**
emh203 0:3d9c67d97d6f 1588 * @brief Floating-point matrix multiplication
emh203 0:3d9c67d97d6f 1589 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1590 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1591 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1592 * @return The function returns either
emh203 0:3d9c67d97d6f 1593 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1594 */
emh203 0:3d9c67d97d6f 1595
emh203 0:3d9c67d97d6f 1596 arm_status arm_mat_mult_f32(
emh203 0:3d9c67d97d6f 1597 const arm_matrix_instance_f32 * pSrcA,
emh203 0:3d9c67d97d6f 1598 const arm_matrix_instance_f32 * pSrcB,
emh203 0:3d9c67d97d6f 1599 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1600
emh203 0:3d9c67d97d6f 1601 /**
emh203 0:3d9c67d97d6f 1602 * @brief Q15 matrix multiplication
emh203 0:3d9c67d97d6f 1603 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1604 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1605 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1606 * @param[in] *pState points to the array for storing intermediate results
emh203 0:3d9c67d97d6f 1607 * @return The function returns either
emh203 0:3d9c67d97d6f 1608 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1609 */
emh203 0:3d9c67d97d6f 1610
emh203 0:3d9c67d97d6f 1611 arm_status arm_mat_mult_q15(
emh203 0:3d9c67d97d6f 1612 const arm_matrix_instance_q15 * pSrcA,
emh203 0:3d9c67d97d6f 1613 const arm_matrix_instance_q15 * pSrcB,
emh203 0:3d9c67d97d6f 1614 arm_matrix_instance_q15 * pDst,
emh203 0:3d9c67d97d6f 1615 q15_t * pState);
emh203 0:3d9c67d97d6f 1616
emh203 0:3d9c67d97d6f 1617 /**
emh203 0:3d9c67d97d6f 1618 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
emh203 0:3d9c67d97d6f 1619 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1620 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1621 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1622 * @param[in] *pState points to the array for storing intermediate results
emh203 0:3d9c67d97d6f 1623 * @return The function returns either
emh203 0:3d9c67d97d6f 1624 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1625 */
emh203 0:3d9c67d97d6f 1626
emh203 0:3d9c67d97d6f 1627 arm_status arm_mat_mult_fast_q15(
emh203 0:3d9c67d97d6f 1628 const arm_matrix_instance_q15 * pSrcA,
emh203 0:3d9c67d97d6f 1629 const arm_matrix_instance_q15 * pSrcB,
emh203 0:3d9c67d97d6f 1630 arm_matrix_instance_q15 * pDst,
emh203 0:3d9c67d97d6f 1631 q15_t * pState);
emh203 0:3d9c67d97d6f 1632
emh203 0:3d9c67d97d6f 1633 /**
emh203 0:3d9c67d97d6f 1634 * @brief Q31 matrix multiplication
emh203 0:3d9c67d97d6f 1635 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1636 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1637 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1638 * @return The function returns either
emh203 0:3d9c67d97d6f 1639 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1640 */
emh203 0:3d9c67d97d6f 1641
emh203 0:3d9c67d97d6f 1642 arm_status arm_mat_mult_q31(
emh203 0:3d9c67d97d6f 1643 const arm_matrix_instance_q31 * pSrcA,
emh203 0:3d9c67d97d6f 1644 const arm_matrix_instance_q31 * pSrcB,
emh203 0:3d9c67d97d6f 1645 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1646
emh203 0:3d9c67d97d6f 1647 /**
emh203 0:3d9c67d97d6f 1648 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
emh203 0:3d9c67d97d6f 1649 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1650 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1651 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1652 * @return The function returns either
emh203 0:3d9c67d97d6f 1653 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1654 */
emh203 0:3d9c67d97d6f 1655
emh203 0:3d9c67d97d6f 1656 arm_status arm_mat_mult_fast_q31(
emh203 0:3d9c67d97d6f 1657 const arm_matrix_instance_q31 * pSrcA,
emh203 0:3d9c67d97d6f 1658 const arm_matrix_instance_q31 * pSrcB,
emh203 0:3d9c67d97d6f 1659 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1660
emh203 0:3d9c67d97d6f 1661
emh203 0:3d9c67d97d6f 1662 /**
emh203 0:3d9c67d97d6f 1663 * @brief Floating-point matrix subtraction
emh203 0:3d9c67d97d6f 1664 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1665 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1666 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1667 * @return The function returns either
emh203 0:3d9c67d97d6f 1668 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1669 */
emh203 0:3d9c67d97d6f 1670
emh203 0:3d9c67d97d6f 1671 arm_status arm_mat_sub_f32(
emh203 0:3d9c67d97d6f 1672 const arm_matrix_instance_f32 * pSrcA,
emh203 0:3d9c67d97d6f 1673 const arm_matrix_instance_f32 * pSrcB,
emh203 0:3d9c67d97d6f 1674 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1675
emh203 0:3d9c67d97d6f 1676 /**
emh203 0:3d9c67d97d6f 1677 * @brief Q15 matrix subtraction
emh203 0:3d9c67d97d6f 1678 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1679 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1680 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1681 * @return The function returns either
emh203 0:3d9c67d97d6f 1682 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1683 */
emh203 0:3d9c67d97d6f 1684
emh203 0:3d9c67d97d6f 1685 arm_status arm_mat_sub_q15(
emh203 0:3d9c67d97d6f 1686 const arm_matrix_instance_q15 * pSrcA,
emh203 0:3d9c67d97d6f 1687 const arm_matrix_instance_q15 * pSrcB,
emh203 0:3d9c67d97d6f 1688 arm_matrix_instance_q15 * pDst);
emh203 0:3d9c67d97d6f 1689
emh203 0:3d9c67d97d6f 1690 /**
emh203 0:3d9c67d97d6f 1691 * @brief Q31 matrix subtraction
emh203 0:3d9c67d97d6f 1692 * @param[in] *pSrcA points to the first input matrix structure
emh203 0:3d9c67d97d6f 1693 * @param[in] *pSrcB points to the second input matrix structure
emh203 0:3d9c67d97d6f 1694 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1695 * @return The function returns either
emh203 0:3d9c67d97d6f 1696 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1697 */
emh203 0:3d9c67d97d6f 1698
emh203 0:3d9c67d97d6f 1699 arm_status arm_mat_sub_q31(
emh203 0:3d9c67d97d6f 1700 const arm_matrix_instance_q31 * pSrcA,
emh203 0:3d9c67d97d6f 1701 const arm_matrix_instance_q31 * pSrcB,
emh203 0:3d9c67d97d6f 1702 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1703
emh203 0:3d9c67d97d6f 1704 /**
emh203 0:3d9c67d97d6f 1705 * @brief Floating-point matrix scaling.
emh203 0:3d9c67d97d6f 1706 * @param[in] *pSrc points to the input matrix
emh203 0:3d9c67d97d6f 1707 * @param[in] scale scale factor
emh203 0:3d9c67d97d6f 1708 * @param[out] *pDst points to the output matrix
emh203 0:3d9c67d97d6f 1709 * @return The function returns either
emh203 0:3d9c67d97d6f 1710 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1711 */
emh203 0:3d9c67d97d6f 1712
emh203 0:3d9c67d97d6f 1713 arm_status arm_mat_scale_f32(
emh203 0:3d9c67d97d6f 1714 const arm_matrix_instance_f32 * pSrc,
emh203 0:3d9c67d97d6f 1715 float32_t scale,
emh203 0:3d9c67d97d6f 1716 arm_matrix_instance_f32 * pDst);
emh203 0:3d9c67d97d6f 1717
emh203 0:3d9c67d97d6f 1718 /**
emh203 0:3d9c67d97d6f 1719 * @brief Q15 matrix scaling.
emh203 0:3d9c67d97d6f 1720 * @param[in] *pSrc points to input matrix
emh203 0:3d9c67d97d6f 1721 * @param[in] scaleFract fractional portion of the scale factor
emh203 0:3d9c67d97d6f 1722 * @param[in] shift number of bits to shift the result by
emh203 0:3d9c67d97d6f 1723 * @param[out] *pDst points to output matrix
emh203 0:3d9c67d97d6f 1724 * @return The function returns either
emh203 0:3d9c67d97d6f 1725 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1726 */
emh203 0:3d9c67d97d6f 1727
emh203 0:3d9c67d97d6f 1728 arm_status arm_mat_scale_q15(
emh203 0:3d9c67d97d6f 1729 const arm_matrix_instance_q15 * pSrc,
emh203 0:3d9c67d97d6f 1730 q15_t scaleFract,
emh203 0:3d9c67d97d6f 1731 int32_t shift,
emh203 0:3d9c67d97d6f 1732 arm_matrix_instance_q15 * pDst);
emh203 0:3d9c67d97d6f 1733
emh203 0:3d9c67d97d6f 1734 /**
emh203 0:3d9c67d97d6f 1735 * @brief Q31 matrix scaling.
emh203 0:3d9c67d97d6f 1736 * @param[in] *pSrc points to input matrix
emh203 0:3d9c67d97d6f 1737 * @param[in] scaleFract fractional portion of the scale factor
emh203 0:3d9c67d97d6f 1738 * @param[in] shift number of bits to shift the result by
emh203 0:3d9c67d97d6f 1739 * @param[out] *pDst points to output matrix structure
emh203 0:3d9c67d97d6f 1740 * @return The function returns either
emh203 0:3d9c67d97d6f 1741 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emh203 0:3d9c67d97d6f 1742 */
emh203 0:3d9c67d97d6f 1743
emh203 0:3d9c67d97d6f 1744 arm_status arm_mat_scale_q31(
emh203 0:3d9c67d97d6f 1745 const arm_matrix_instance_q31 * pSrc,
emh203 0:3d9c67d97d6f 1746 q31_t scaleFract,
emh203 0:3d9c67d97d6f 1747 int32_t shift,
emh203 0:3d9c67d97d6f 1748 arm_matrix_instance_q31 * pDst);
emh203 0:3d9c67d97d6f 1749
emh203 0:3d9c67d97d6f 1750
emh203 0:3d9c67d97d6f 1751 /**
emh203 0:3d9c67d97d6f 1752 * @brief Q31 matrix initialization.
emh203 0:3d9c67d97d6f 1753 * @param[in,out] *S points to an instance of the floating-point matrix structure.
emh203 0:3d9c67d97d6f 1754 * @param[in] nRows number of rows in the matrix.
emh203 0:3d9c67d97d6f 1755 * @param[in] nColumns number of columns in the matrix.
emh203 0:3d9c67d97d6f 1756 * @param[in] *pData points to the matrix data array.
emh203 0:3d9c67d97d6f 1757 * @return none
emh203 0:3d9c67d97d6f 1758 */
emh203 0:3d9c67d97d6f 1759
emh203 0:3d9c67d97d6f 1760 void arm_mat_init_q31(
emh203 0:3d9c67d97d6f 1761 arm_matrix_instance_q31 * S,
emh203 0:3d9c67d97d6f 1762 uint16_t nRows,
emh203 0:3d9c67d97d6f 1763 uint16_t nColumns,
emh203 0:3d9c67d97d6f 1764 q31_t * pData);
emh203 0:3d9c67d97d6f 1765
emh203 0:3d9c67d97d6f 1766 /**
emh203 0:3d9c67d97d6f 1767 * @brief Q15 matrix initialization.
emh203 0:3d9c67d97d6f 1768 * @param[in,out] *S points to an instance of the floating-point matrix structure.
emh203 0:3d9c67d97d6f 1769 * @param[in] nRows number of rows in the matrix.
emh203 0:3d9c67d97d6f 1770 * @param[in] nColumns number of columns in the matrix.
emh203 0:3d9c67d97d6f 1771 * @param[in] *pData points to the matrix data array.
emh203 0:3d9c67d97d6f 1772 * @return none
emh203 0:3d9c67d97d6f 1773 */
emh203 0:3d9c67d97d6f 1774
emh203 0:3d9c67d97d6f 1775 void arm_mat_init_q15(
emh203 0:3d9c67d97d6f 1776 arm_matrix_instance_q15 * S,
emh203 0:3d9c67d97d6f 1777 uint16_t nRows,
emh203 0:3d9c67d97d6f 1778 uint16_t nColumns,
emh203 0:3d9c67d97d6f 1779 q15_t * pData);
emh203 0:3d9c67d97d6f 1780
emh203 0:3d9c67d97d6f 1781 /**
emh203 0:3d9c67d97d6f 1782 * @brief Floating-point matrix initialization.
emh203 0:3d9c67d97d6f 1783 * @param[in,out] *S points to an instance of the floating-point matrix structure.
emh203 0:3d9c67d97d6f 1784 * @param[in] nRows number of rows in the matrix.
emh203 0:3d9c67d97d6f 1785 * @param[in] nColumns number of columns in the matrix.
emh203 0:3d9c67d97d6f 1786 * @param[in] *pData points to the matrix data array.
emh203 0:3d9c67d97d6f 1787 * @return none
emh203 0:3d9c67d97d6f 1788 */
emh203 0:3d9c67d97d6f 1789
emh203 0:3d9c67d97d6f 1790 void arm_mat_init_f32(
emh203 0:3d9c67d97d6f 1791 arm_matrix_instance_f32 * S,
emh203 0:3d9c67d97d6f 1792 uint16_t nRows,
emh203 0:3d9c67d97d6f 1793 uint16_t nColumns,
emh203 0:3d9c67d97d6f 1794 float32_t * pData);
emh203 0:3d9c67d97d6f 1795
emh203 0:3d9c67d97d6f 1796
emh203 0:3d9c67d97d6f 1797
emh203 0:3d9c67d97d6f 1798 /**
emh203 0:3d9c67d97d6f 1799 * @brief Instance structure for the Q15 PID Control.
emh203 0:3d9c67d97d6f 1800 */
emh203 0:3d9c67d97d6f 1801 typedef struct
emh203 0:3d9c67d97d6f 1802 {
emh203 0:3d9c67d97d6f 1803 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
emh203 0:3d9c67d97d6f 1804 #ifdef ARM_MATH_CM0_FAMILY
emh203 0:3d9c67d97d6f 1805 q15_t A1;
emh203 0:3d9c67d97d6f 1806 q15_t A2;
emh203 0:3d9c67d97d6f 1807 #else
emh203 0:3d9c67d97d6f 1808 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
emh203 0:3d9c67d97d6f 1809 #endif
emh203 0:3d9c67d97d6f 1810 q15_t state[3]; /**< The state array of length 3. */
emh203 0:3d9c67d97d6f 1811 q15_t Kp; /**< The proportional gain. */
emh203 0:3d9c67d97d6f 1812 q15_t Ki; /**< The integral gain. */
emh203 0:3d9c67d97d6f 1813 q15_t Kd; /**< The derivative gain. */
emh203 0:3d9c67d97d6f 1814 } arm_pid_instance_q15;
emh203 0:3d9c67d97d6f 1815
emh203 0:3d9c67d97d6f 1816 /**
emh203 0:3d9c67d97d6f 1817 * @brief Instance structure for the Q31 PID Control.
emh203 0:3d9c67d97d6f 1818 */
emh203 0:3d9c67d97d6f 1819 typedef struct
emh203 0:3d9c67d97d6f 1820 {
emh203 0:3d9c67d97d6f 1821 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
emh203 0:3d9c67d97d6f 1822 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
emh203 0:3d9c67d97d6f 1823 q31_t A2; /**< The derived gain, A2 = Kd . */
emh203 0:3d9c67d97d6f 1824 q31_t state[3]; /**< The state array of length 3. */
emh203 0:3d9c67d97d6f 1825 q31_t Kp; /**< The proportional gain. */
emh203 0:3d9c67d97d6f 1826 q31_t Ki; /**< The integral gain. */
emh203 0:3d9c67d97d6f 1827 q31_t Kd; /**< The derivative gain. */
emh203 0:3d9c67d97d6f 1828
emh203 0:3d9c67d97d6f 1829 } arm_pid_instance_q31;
emh203 0:3d9c67d97d6f 1830
emh203 0:3d9c67d97d6f 1831 /**
emh203 0:3d9c67d97d6f 1832 * @brief Instance structure for the floating-point PID Control.
emh203 0:3d9c67d97d6f 1833 */
emh203 0:3d9c67d97d6f 1834 typedef struct
emh203 0:3d9c67d97d6f 1835 {
emh203 0:3d9c67d97d6f 1836 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
emh203 0:3d9c67d97d6f 1837 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
emh203 0:3d9c67d97d6f 1838 float32_t A2; /**< The derived gain, A2 = Kd . */
emh203 0:3d9c67d97d6f 1839 float32_t state[3]; /**< The state array of length 3. */
emh203 0:3d9c67d97d6f 1840 float32_t Kp; /**< The proportional gain. */
emh203 0:3d9c67d97d6f 1841 float32_t Ki; /**< The integral gain. */
emh203 0:3d9c67d97d6f 1842 float32_t Kd; /**< The derivative gain. */
emh203 0:3d9c67d97d6f 1843 } arm_pid_instance_f32;
emh203 0:3d9c67d97d6f 1844
emh203 0:3d9c67d97d6f 1845
emh203 0:3d9c67d97d6f 1846
emh203 0:3d9c67d97d6f 1847 /**
emh203 0:3d9c67d97d6f 1848 * @brief Initialization function for the floating-point PID Control.
emh203 0:3d9c67d97d6f 1849 * @param[in,out] *S points to an instance of the PID structure.
emh203 0:3d9c67d97d6f 1850 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emh203 0:3d9c67d97d6f 1851 * @return none.
emh203 0:3d9c67d97d6f 1852 */
emh203 0:3d9c67d97d6f 1853 void arm_pid_init_f32(
emh203 0:3d9c67d97d6f 1854 arm_pid_instance_f32 * S,
emh203 0:3d9c67d97d6f 1855 int32_t resetStateFlag);
emh203 0:3d9c67d97d6f 1856
emh203 0:3d9c67d97d6f 1857 /**
emh203 0:3d9c67d97d6f 1858 * @brief Reset function for the floating-point PID Control.
emh203 0:3d9c67d97d6f 1859 * @param[in,out] *S is an instance of the floating-point PID Control structure
emh203 0:3d9c67d97d6f 1860 * @return none
emh203 0:3d9c67d97d6f 1861 */
emh203 0:3d9c67d97d6f 1862 void arm_pid_reset_f32(
emh203 0:3d9c67d97d6f 1863 arm_pid_instance_f32 * S);
emh203 0:3d9c67d97d6f 1864
emh203 0:3d9c67d97d6f 1865
emh203 0:3d9c67d97d6f 1866 /**
emh203 0:3d9c67d97d6f 1867 * @brief Initialization function for the Q31 PID Control.
emh203 0:3d9c67d97d6f 1868 * @param[in,out] *S points to an instance of the Q15 PID structure.
emh203 0:3d9c67d97d6f 1869 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emh203 0:3d9c67d97d6f 1870 * @return none.
emh203 0:3d9c67d97d6f 1871 */
emh203 0:3d9c67d97d6f 1872 void arm_pid_init_q31(
emh203 0:3d9c67d97d6f 1873 arm_pid_instance_q31 * S,
emh203 0:3d9c67d97d6f 1874 int32_t resetStateFlag);
emh203 0:3d9c67d97d6f 1875
emh203 0:3d9c67d97d6f 1876
emh203 0:3d9c67d97d6f 1877 /**
emh203 0:3d9c67d97d6f 1878 * @brief Reset function for the Q31 PID Control.
emh203 0:3d9c67d97d6f 1879 * @param[in,out] *S points to an instance of the Q31 PID Control structure
emh203 0:3d9c67d97d6f 1880 * @return none
emh203 0:3d9c67d97d6f 1881 */
emh203 0:3d9c67d97d6f 1882
emh203 0:3d9c67d97d6f 1883 void arm_pid_reset_q31(
emh203 0:3d9c67d97d6f 1884 arm_pid_instance_q31 * S);
emh203 0:3d9c67d97d6f 1885
emh203 0:3d9c67d97d6f 1886 /**
emh203 0:3d9c67d97d6f 1887 * @brief Initialization function for the Q15 PID Control.
emh203 0:3d9c67d97d6f 1888 * @param[in,out] *S points to an instance of the Q15 PID structure.
emh203 0:3d9c67d97d6f 1889 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emh203 0:3d9c67d97d6f 1890 * @return none.
emh203 0:3d9c67d97d6f 1891 */
emh203 0:3d9c67d97d6f 1892 void arm_pid_init_q15(
emh203 0:3d9c67d97d6f 1893 arm_pid_instance_q15 * S,
emh203 0:3d9c67d97d6f 1894 int32_t resetStateFlag);
emh203 0:3d9c67d97d6f 1895
emh203 0:3d9c67d97d6f 1896 /**
emh203 0:3d9c67d97d6f 1897 * @brief Reset function for the Q15 PID Control.
emh203 0:3d9c67d97d6f 1898 * @param[in,out] *S points to an instance of the q15 PID Control structure
emh203 0:3d9c67d97d6f 1899 * @return none
emh203 0:3d9c67d97d6f 1900 */
emh203 0:3d9c67d97d6f 1901 void arm_pid_reset_q15(
emh203 0:3d9c67d97d6f 1902 arm_pid_instance_q15 * S);
emh203 0:3d9c67d97d6f 1903
emh203 0:3d9c67d97d6f 1904
emh203 0:3d9c67d97d6f 1905 /**
emh203 0:3d9c67d97d6f 1906 * @brief Instance structure for the floating-point Linear Interpolate function.
emh203 0:3d9c67d97d6f 1907 */
emh203 0:3d9c67d97d6f 1908 typedef struct
emh203 0:3d9c67d97d6f 1909 {
emh203 0:3d9c67d97d6f 1910 uint32_t nValues; /**< nValues */
emh203 0:3d9c67d97d6f 1911 float32_t x1; /**< x1 */
emh203 0:3d9c67d97d6f 1912 float32_t xSpacing; /**< xSpacing */
emh203 0:3d9c67d97d6f 1913 float32_t *pYData; /**< pointer to the table of Y values */
emh203 0:3d9c67d97d6f 1914 } arm_linear_interp_instance_f32;
emh203 0:3d9c67d97d6f 1915
emh203 0:3d9c67d97d6f 1916 /**
emh203 0:3d9c67d97d6f 1917 * @brief Instance structure for the floating-point bilinear interpolation function.
emh203 0:3d9c67d97d6f 1918 */
emh203 0:3d9c67d97d6f 1919
emh203 0:3d9c67d97d6f 1920 typedef struct
emh203 0:3d9c67d97d6f 1921 {
emh203 0:3d9c67d97d6f 1922 uint16_t numRows; /**< number of rows in the data table. */
emh203 0:3d9c67d97d6f 1923 uint16_t numCols; /**< number of columns in the data table. */
emh203 0:3d9c67d97d6f 1924 float32_t *pData; /**< points to the data table. */
emh203 0:3d9c67d97d6f 1925 } arm_bilinear_interp_instance_f32;
emh203 0:3d9c67d97d6f 1926
emh203 0:3d9c67d97d6f 1927 /**
emh203 0:3d9c67d97d6f 1928 * @brief Instance structure for the Q31 bilinear interpolation function.
emh203 0:3d9c67d97d6f 1929 */
emh203 0:3d9c67d97d6f 1930
emh203 0:3d9c67d97d6f 1931 typedef struct
emh203 0:3d9c67d97d6f 1932 {
emh203 0:3d9c67d97d6f 1933 uint16_t numRows; /**< number of rows in the data table. */
emh203 0:3d9c67d97d6f 1934 uint16_t numCols; /**< number of columns in the data table. */
emh203 0:3d9c67d97d6f 1935 q31_t *pData; /**< points to the data table. */
emh203 0:3d9c67d97d6f 1936 } arm_bilinear_interp_instance_q31;
emh203 0:3d9c67d97d6f 1937
emh203 0:3d9c67d97d6f 1938 /**
emh203 0:3d9c67d97d6f 1939 * @brief Instance structure for the Q15 bilinear interpolation function.
emh203 0:3d9c67d97d6f 1940 */
emh203 0:3d9c67d97d6f 1941
emh203 0:3d9c67d97d6f 1942 typedef struct
emh203 0:3d9c67d97d6f 1943 {
emh203 0:3d9c67d97d6f 1944 uint16_t numRows; /**< number of rows in the data table. */
emh203 0:3d9c67d97d6f 1945 uint16_t numCols; /**< number of columns in the data table. */
emh203 0:3d9c67d97d6f 1946 q15_t *pData; /**< points to the data table. */
emh203 0:3d9c67d97d6f 1947 } arm_bilinear_interp_instance_q15;
emh203 0:3d9c67d97d6f 1948
emh203 0:3d9c67d97d6f 1949 /**
emh203 0:3d9c67d97d6f 1950 * @brief Instance structure for the Q15 bilinear interpolation function.
emh203 0:3d9c67d97d6f 1951 */
emh203 0:3d9c67d97d6f 1952
emh203 0:3d9c67d97d6f 1953 typedef struct
emh203 0:3d9c67d97d6f 1954 {
emh203 0:3d9c67d97d6f 1955 uint16_t numRows; /**< number of rows in the data table. */
emh203 0:3d9c67d97d6f 1956 uint16_t numCols; /**< number of columns in the data table. */
emh203 0:3d9c67d97d6f 1957 q7_t *pData; /**< points to the data table. */
emh203 0:3d9c67d97d6f 1958 } arm_bilinear_interp_instance_q7;
emh203 0:3d9c67d97d6f 1959
emh203 0:3d9c67d97d6f 1960
emh203 0:3d9c67d97d6f 1961 /**
emh203 0:3d9c67d97d6f 1962 * @brief Q7 vector multiplication.
emh203 0:3d9c67d97d6f 1963 * @param[in] *pSrcA points to the first input vector
emh203 0:3d9c67d97d6f 1964 * @param[in] *pSrcB points to the second input vector
emh203 0:3d9c67d97d6f 1965 * @param[out] *pDst points to the output vector
emh203 0:3d9c67d97d6f 1966 * @param[in] blockSize number of samples in each vector
emh203 0:3d9c67d97d6f 1967 * @return none.
emh203 0:3d9c67d97d6f 1968 */
emh203 0:3d9c67d97d6f 1969
emh203 0:3d9c67d97d6f 1970 void arm_mult_q7(
emh203 0:3d9c67d97d6f 1971 q7_t * pSrcA,
emh203 0:3d9c67d97d6f 1972 q7_t * pSrcB,
emh203 0:3d9c67d97d6f 1973 q7_t * pDst,
emh203