Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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