5.2.1 - Updated I2C files

Dependents:   mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510

Committer:
jacobjohnson
Date:
Mon Feb 27 17:45:05 2017 +0000
Revision:
1:f30bdcd2b33b
Parent:
0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c.  This will need to be changed later, and accessed from the main level, but for now this allows the  adc to read a value from 0 to 3.7V, instead of just up to 1V.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
group-onsemi 0:098463de4c5d 1 /* ----------------------------------------------------------------------
group-onsemi 0:098463de4c5d 2 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
group-onsemi 0:098463de4c5d 3 *
group-onsemi 0:098463de4c5d 4 * $Date: 19. March 2015
group-onsemi 0:098463de4c5d 5 * $Revision: V.1.4.5
group-onsemi 0:098463de4c5d 6 *
group-onsemi 0:098463de4c5d 7 * Project: CMSIS DSP Library
group-onsemi 0:098463de4c5d 8 * Title: arm_math.h
group-onsemi 0:098463de4c5d 9 *
group-onsemi 0:098463de4c5d 10 * Description: Public header file for CMSIS DSP Library
group-onsemi 0:098463de4c5d 11 *
group-onsemi 0:098463de4c5d 12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
group-onsemi 0:098463de4c5d 13 *
group-onsemi 0:098463de4c5d 14 * Redistribution and use in source and binary forms, with or without
group-onsemi 0:098463de4c5d 15 * modification, are permitted provided that the following conditions
group-onsemi 0:098463de4c5d 16 * are met:
group-onsemi 0:098463de4c5d 17 * - Redistributions of source code must retain the above copyright
group-onsemi 0:098463de4c5d 18 * notice, this list of conditions and the following disclaimer.
group-onsemi 0:098463de4c5d 19 * - Redistributions in binary form must reproduce the above copyright
group-onsemi 0:098463de4c5d 20 * notice, this list of conditions and the following disclaimer in
group-onsemi 0:098463de4c5d 21 * the documentation and/or other materials provided with the
group-onsemi 0:098463de4c5d 22 * distribution.
group-onsemi 0:098463de4c5d 23 * - Neither the name of ARM LIMITED nor the names of its contributors
group-onsemi 0:098463de4c5d 24 * may be used to endorse or promote products derived from this
group-onsemi 0:098463de4c5d 25 * software without specific prior written permission.
group-onsemi 0:098463de4c5d 26 *
group-onsemi 0:098463de4c5d 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
group-onsemi 0:098463de4c5d 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
group-onsemi 0:098463de4c5d 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
group-onsemi 0:098463de4c5d 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
group-onsemi 0:098463de4c5d 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
group-onsemi 0:098463de4c5d 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
group-onsemi 0:098463de4c5d 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
group-onsemi 0:098463de4c5d 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
group-onsemi 0:098463de4c5d 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
group-onsemi 0:098463de4c5d 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
group-onsemi 0:098463de4c5d 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
group-onsemi 0:098463de4c5d 38 * POSSIBILITY OF SUCH DAMAGE.
group-onsemi 0:098463de4c5d 39 * -------------------------------------------------------------------- */
group-onsemi 0:098463de4c5d 40
group-onsemi 0:098463de4c5d 41 /**
group-onsemi 0:098463de4c5d 42 \mainpage CMSIS DSP Software Library
group-onsemi 0:098463de4c5d 43 *
group-onsemi 0:098463de4c5d 44 * Introduction
group-onsemi 0:098463de4c5d 45 * ------------
group-onsemi 0:098463de4c5d 46 *
group-onsemi 0:098463de4c5d 47 * This user manual describes the CMSIS DSP software library,
group-onsemi 0:098463de4c5d 48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
group-onsemi 0:098463de4c5d 49 *
group-onsemi 0:098463de4c5d 50 * The library is divided into a number of functions each covering a specific category:
group-onsemi 0:098463de4c5d 51 * - Basic math functions
group-onsemi 0:098463de4c5d 52 * - Fast math functions
group-onsemi 0:098463de4c5d 53 * - Complex math functions
group-onsemi 0:098463de4c5d 54 * - Filters
group-onsemi 0:098463de4c5d 55 * - Matrix functions
group-onsemi 0:098463de4c5d 56 * - Transforms
group-onsemi 0:098463de4c5d 57 * - Motor control functions
group-onsemi 0:098463de4c5d 58 * - Statistical functions
group-onsemi 0:098463de4c5d 59 * - Support functions
group-onsemi 0:098463de4c5d 60 * - Interpolation functions
group-onsemi 0:098463de4c5d 61 *
group-onsemi 0:098463de4c5d 62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
group-onsemi 0:098463de4c5d 63 * 32-bit integer and 32-bit floating-point values.
group-onsemi 0:098463de4c5d 64 *
group-onsemi 0:098463de4c5d 65 * Using the Library
group-onsemi 0:098463de4c5d 66 * ------------
group-onsemi 0:098463de4c5d 67 *
group-onsemi 0:098463de4c5d 68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
group-onsemi 0:098463de4c5d 69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
group-onsemi 0:098463de4c5d 70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
group-onsemi 0:098463de4c5d 71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
group-onsemi 0:098463de4c5d 72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
group-onsemi 0:098463de4c5d 73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
group-onsemi 0:098463de4c5d 74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
group-onsemi 0:098463de4c5d 75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
group-onsemi 0:098463de4c5d 76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
group-onsemi 0:098463de4c5d 77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
group-onsemi 0:098463de4c5d 78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
group-onsemi 0:098463de4c5d 79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
group-onsemi 0:098463de4c5d 80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
group-onsemi 0:098463de4c5d 81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
group-onsemi 0:098463de4c5d 82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
group-onsemi 0:098463de4c5d 83 *
group-onsemi 0:098463de4c5d 84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
group-onsemi 0:098463de4c5d 85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
group-onsemi 0:098463de4c5d 86 * public header file <code> arm_math.h</code> for Cortex-M7/M4/M3/M0/M0+ with little endian and big endian. Same header file will be used for floating point unit(FPU) variants.
group-onsemi 0:098463de4c5d 87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
group-onsemi 0:098463de4c5d 88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
group-onsemi 0:098463de4c5d 89 *
group-onsemi 0:098463de4c5d 90 * Examples
group-onsemi 0:098463de4c5d 91 * --------
group-onsemi 0:098463de4c5d 92 *
group-onsemi 0:098463de4c5d 93 * The library ships with a number of examples which demonstrate how to use the library functions.
group-onsemi 0:098463de4c5d 94 *
group-onsemi 0:098463de4c5d 95 * Toolchain Support
group-onsemi 0:098463de4c5d 96 * ------------
group-onsemi 0:098463de4c5d 97 *
group-onsemi 0:098463de4c5d 98 * The library has been developed and tested with MDK-ARM version 5.14.0.0
group-onsemi 0:098463de4c5d 99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
group-onsemi 0:098463de4c5d 100 *
group-onsemi 0:098463de4c5d 101 * Building the Library
group-onsemi 0:098463de4c5d 102 * ------------
group-onsemi 0:098463de4c5d 103 *
group-onsemi 0:098463de4c5d 104 * 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.
group-onsemi 0:098463de4c5d 105 * - arm_cortexM_math.uvprojx
group-onsemi 0:098463de4c5d 106 *
group-onsemi 0:098463de4c5d 107 *
group-onsemi 0:098463de4c5d 108 * 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.
group-onsemi 0:098463de4c5d 109 *
group-onsemi 0:098463de4c5d 110 * Pre-processor Macros
group-onsemi 0:098463de4c5d 111 * ------------
group-onsemi 0:098463de4c5d 112 *
group-onsemi 0:098463de4c5d 113 * Each library project have differant pre-processor macros.
group-onsemi 0:098463de4c5d 114 *
group-onsemi 0:098463de4c5d 115 * - UNALIGNED_SUPPORT_DISABLE:
group-onsemi 0:098463de4c5d 116 *
group-onsemi 0:098463de4c5d 117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
group-onsemi 0:098463de4c5d 118 *
group-onsemi 0:098463de4c5d 119 * - ARM_MATH_BIG_ENDIAN:
group-onsemi 0:098463de4c5d 120 *
group-onsemi 0:098463de4c5d 121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
group-onsemi 0:098463de4c5d 122 *
group-onsemi 0:098463de4c5d 123 * - ARM_MATH_MATRIX_CHECK:
group-onsemi 0:098463de4c5d 124 *
group-onsemi 0:098463de4c5d 125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
group-onsemi 0:098463de4c5d 126 *
group-onsemi 0:098463de4c5d 127 * - ARM_MATH_ROUNDING:
group-onsemi 0:098463de4c5d 128 *
group-onsemi 0:098463de4c5d 129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
group-onsemi 0:098463de4c5d 130 *
group-onsemi 0:098463de4c5d 131 * - ARM_MATH_CMx:
group-onsemi 0:098463de4c5d 132 *
group-onsemi 0:098463de4c5d 133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
group-onsemi 0:098463de4c5d 134 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
group-onsemi 0:098463de4c5d 135 * ARM_MATH_CM7 for building the library on cortex-M7.
group-onsemi 0:098463de4c5d 136 *
group-onsemi 0:098463de4c5d 137 * - __FPU_PRESENT:
group-onsemi 0:098463de4c5d 138 *
group-onsemi 0:098463de4c5d 139 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
group-onsemi 0:098463de4c5d 140 *
group-onsemi 0:098463de4c5d 141 * <hr>
group-onsemi 0:098463de4c5d 142 * CMSIS-DSP in ARM::CMSIS Pack
group-onsemi 0:098463de4c5d 143 * -----------------------------
group-onsemi 0:098463de4c5d 144 *
group-onsemi 0:098463de4c5d 145 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
group-onsemi 0:098463de4c5d 146 * |File/Folder |Content |
group-onsemi 0:098463de4c5d 147 * |------------------------------|------------------------------------------------------------------------|
group-onsemi 0:098463de4c5d 148 * |\b CMSIS\\Documentation\\DSP | This documentation |
group-onsemi 0:098463de4c5d 149 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
group-onsemi 0:098463de4c5d 150 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
group-onsemi 0:098463de4c5d 151 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
group-onsemi 0:098463de4c5d 152 *
group-onsemi 0:098463de4c5d 153 * <hr>
group-onsemi 0:098463de4c5d 154 * Revision History of CMSIS-DSP
group-onsemi 0:098463de4c5d 155 * ------------
group-onsemi 0:098463de4c5d 156 * Please refer to \ref ChangeLog_pg.
group-onsemi 0:098463de4c5d 157 *
group-onsemi 0:098463de4c5d 158 * Copyright Notice
group-onsemi 0:098463de4c5d 159 * ------------
group-onsemi 0:098463de4c5d 160 *
group-onsemi 0:098463de4c5d 161 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
group-onsemi 0:098463de4c5d 162 */
group-onsemi 0:098463de4c5d 163
group-onsemi 0:098463de4c5d 164
group-onsemi 0:098463de4c5d 165 /**
group-onsemi 0:098463de4c5d 166 * @defgroup groupMath Basic Math Functions
group-onsemi 0:098463de4c5d 167 */
group-onsemi 0:098463de4c5d 168
group-onsemi 0:098463de4c5d 169 /**
group-onsemi 0:098463de4c5d 170 * @defgroup groupFastMath Fast Math Functions
group-onsemi 0:098463de4c5d 171 * This set of functions provides a fast approximation to sine, cosine, and square root.
group-onsemi 0:098463de4c5d 172 * As compared to most of the other functions in the CMSIS math library, the fast math functions
group-onsemi 0:098463de4c5d 173 * operate on individual values and not arrays.
group-onsemi 0:098463de4c5d 174 * There are separate functions for Q15, Q31, and floating-point data.
group-onsemi 0:098463de4c5d 175 *
group-onsemi 0:098463de4c5d 176 */
group-onsemi 0:098463de4c5d 177
group-onsemi 0:098463de4c5d 178 /**
group-onsemi 0:098463de4c5d 179 * @defgroup groupCmplxMath Complex Math Functions
group-onsemi 0:098463de4c5d 180 * This set of functions operates on complex data vectors.
group-onsemi 0:098463de4c5d 181 * The data in the complex arrays is stored in an interleaved fashion
group-onsemi 0:098463de4c5d 182 * (real, imag, real, imag, ...).
group-onsemi 0:098463de4c5d 183 * In the API functions, the number of samples in a complex array refers
group-onsemi 0:098463de4c5d 184 * to the number of complex values; the array contains twice this number of
group-onsemi 0:098463de4c5d 185 * real values.
group-onsemi 0:098463de4c5d 186 */
group-onsemi 0:098463de4c5d 187
group-onsemi 0:098463de4c5d 188 /**
group-onsemi 0:098463de4c5d 189 * @defgroup groupFilters Filtering Functions
group-onsemi 0:098463de4c5d 190 */
group-onsemi 0:098463de4c5d 191
group-onsemi 0:098463de4c5d 192 /**
group-onsemi 0:098463de4c5d 193 * @defgroup groupMatrix Matrix Functions
group-onsemi 0:098463de4c5d 194 *
group-onsemi 0:098463de4c5d 195 * This set of functions provides basic matrix math operations.
group-onsemi 0:098463de4c5d 196 * The functions operate on matrix data structures. For example,
group-onsemi 0:098463de4c5d 197 * the type
group-onsemi 0:098463de4c5d 198 * definition for the floating-point matrix structure is shown
group-onsemi 0:098463de4c5d 199 * below:
group-onsemi 0:098463de4c5d 200 * <pre>
group-onsemi 0:098463de4c5d 201 * typedef struct
group-onsemi 0:098463de4c5d 202 * {
group-onsemi 0:098463de4c5d 203 * uint16_t numRows; // number of rows of the matrix.
group-onsemi 0:098463de4c5d 204 * uint16_t numCols; // number of columns of the matrix.
group-onsemi 0:098463de4c5d 205 * float32_t *pData; // points to the data of the matrix.
group-onsemi 0:098463de4c5d 206 * } arm_matrix_instance_f32;
group-onsemi 0:098463de4c5d 207 * </pre>
group-onsemi 0:098463de4c5d 208 * There are similar definitions for Q15 and Q31 data types.
group-onsemi 0:098463de4c5d 209 *
group-onsemi 0:098463de4c5d 210 * The structure specifies the size of the matrix and then points to
group-onsemi 0:098463de4c5d 211 * an array of data. The array is of size <code>numRows X numCols</code>
group-onsemi 0:098463de4c5d 212 * and the values are arranged in row order. That is, the
group-onsemi 0:098463de4c5d 213 * matrix element (i, j) is stored at:
group-onsemi 0:098463de4c5d 214 * <pre>
group-onsemi 0:098463de4c5d 215 * pData[i*numCols + j]
group-onsemi 0:098463de4c5d 216 * </pre>
group-onsemi 0:098463de4c5d 217 *
group-onsemi 0:098463de4c5d 218 * \par Init Functions
group-onsemi 0:098463de4c5d 219 * There is an associated initialization function for each type of matrix
group-onsemi 0:098463de4c5d 220 * data structure.
group-onsemi 0:098463de4c5d 221 * The initialization function sets the values of the internal structure fields.
group-onsemi 0:098463de4c5d 222 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
group-onsemi 0:098463de4c5d 223 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
group-onsemi 0:098463de4c5d 224 *
group-onsemi 0:098463de4c5d 225 * \par
group-onsemi 0:098463de4c5d 226 * Use of the initialization function is optional. However, if initialization function is used
group-onsemi 0:098463de4c5d 227 * then the instance structure cannot be placed into a const data section.
group-onsemi 0:098463de4c5d 228 * To place the instance structure in a const data
group-onsemi 0:098463de4c5d 229 * section, manually initialize the data structure. For example:
group-onsemi 0:098463de4c5d 230 * <pre>
group-onsemi 0:098463de4c5d 231 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
group-onsemi 0:098463de4c5d 232 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
group-onsemi 0:098463de4c5d 233 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
group-onsemi 0:098463de4c5d 234 * </pre>
group-onsemi 0:098463de4c5d 235 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
group-onsemi 0:098463de4c5d 236 * specifies the number of columns, and <code>pData</code> points to the
group-onsemi 0:098463de4c5d 237 * data array.
group-onsemi 0:098463de4c5d 238 *
group-onsemi 0:098463de4c5d 239 * \par Size Checking
group-onsemi 0:098463de4c5d 240 * By default all of the matrix functions perform size checking on the input and
group-onsemi 0:098463de4c5d 241 * output matrices. For example, the matrix addition function verifies that the
group-onsemi 0:098463de4c5d 242 * two input matrices and the output matrix all have the same number of rows and
group-onsemi 0:098463de4c5d 243 * columns. If the size check fails the functions return:
group-onsemi 0:098463de4c5d 244 * <pre>
group-onsemi 0:098463de4c5d 245 * ARM_MATH_SIZE_MISMATCH
group-onsemi 0:098463de4c5d 246 * </pre>
group-onsemi 0:098463de4c5d 247 * Otherwise the functions return
group-onsemi 0:098463de4c5d 248 * <pre>
group-onsemi 0:098463de4c5d 249 * ARM_MATH_SUCCESS
group-onsemi 0:098463de4c5d 250 * </pre>
group-onsemi 0:098463de4c5d 251 * There is some overhead associated with this matrix size checking.
group-onsemi 0:098463de4c5d 252 * The matrix size checking is enabled via the \#define
group-onsemi 0:098463de4c5d 253 * <pre>
group-onsemi 0:098463de4c5d 254 * ARM_MATH_MATRIX_CHECK
group-onsemi 0:098463de4c5d 255 * </pre>
group-onsemi 0:098463de4c5d 256 * within the library project settings. By default this macro is defined
group-onsemi 0:098463de4c5d 257 * and size checking is enabled. By changing the project settings and
group-onsemi 0:098463de4c5d 258 * undefining this macro size checking is eliminated and the functions
group-onsemi 0:098463de4c5d 259 * run a bit faster. With size checking disabled the functions always
group-onsemi 0:098463de4c5d 260 * return <code>ARM_MATH_SUCCESS</code>.
group-onsemi 0:098463de4c5d 261 */
group-onsemi 0:098463de4c5d 262
group-onsemi 0:098463de4c5d 263 /**
group-onsemi 0:098463de4c5d 264 * @defgroup groupTransforms Transform Functions
group-onsemi 0:098463de4c5d 265 */
group-onsemi 0:098463de4c5d 266
group-onsemi 0:098463de4c5d 267 /**
group-onsemi 0:098463de4c5d 268 * @defgroup groupController Controller Functions
group-onsemi 0:098463de4c5d 269 */
group-onsemi 0:098463de4c5d 270
group-onsemi 0:098463de4c5d 271 /**
group-onsemi 0:098463de4c5d 272 * @defgroup groupStats Statistics Functions
group-onsemi 0:098463de4c5d 273 */
group-onsemi 0:098463de4c5d 274 /**
group-onsemi 0:098463de4c5d 275 * @defgroup groupSupport Support Functions
group-onsemi 0:098463de4c5d 276 */
group-onsemi 0:098463de4c5d 277
group-onsemi 0:098463de4c5d 278 /**
group-onsemi 0:098463de4c5d 279 * @defgroup groupInterpolation Interpolation Functions
group-onsemi 0:098463de4c5d 280 * These functions perform 1- and 2-dimensional interpolation of data.
group-onsemi 0:098463de4c5d 281 * Linear interpolation is used for 1-dimensional data and
group-onsemi 0:098463de4c5d 282 * bilinear interpolation is used for 2-dimensional data.
group-onsemi 0:098463de4c5d 283 */
group-onsemi 0:098463de4c5d 284
group-onsemi 0:098463de4c5d 285 /**
group-onsemi 0:098463de4c5d 286 * @defgroup groupExamples Examples
group-onsemi 0:098463de4c5d 287 */
group-onsemi 0:098463de4c5d 288 #ifndef _ARM_MATH_H
group-onsemi 0:098463de4c5d 289 #define _ARM_MATH_H
group-onsemi 0:098463de4c5d 290
group-onsemi 0:098463de4c5d 291 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
group-onsemi 0:098463de4c5d 292
group-onsemi 0:098463de4c5d 293 #if defined(ARM_MATH_CM7)
group-onsemi 0:098463de4c5d 294 #include "core_cm7.h"
group-onsemi 0:098463de4c5d 295 #elif defined (ARM_MATH_CM4)
group-onsemi 0:098463de4c5d 296 #include "core_cm4.h"
group-onsemi 0:098463de4c5d 297 #elif defined (ARM_MATH_CM3)
group-onsemi 0:098463de4c5d 298 #include "core_cm3.h"
group-onsemi 0:098463de4c5d 299 #elif defined (ARM_MATH_CM0)
group-onsemi 0:098463de4c5d 300 #include "core_cm0.h"
group-onsemi 0:098463de4c5d 301 #define ARM_MATH_CM0_FAMILY
group-onsemi 0:098463de4c5d 302 #elif defined (ARM_MATH_CM0PLUS)
group-onsemi 0:098463de4c5d 303 #include "core_cm0plus.h"
group-onsemi 0:098463de4c5d 304 #define ARM_MATH_CM0_FAMILY
group-onsemi 0:098463de4c5d 305 #else
group-onsemi 0:098463de4c5d 306 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
group-onsemi 0:098463de4c5d 307 #endif
group-onsemi 0:098463de4c5d 308
group-onsemi 0:098463de4c5d 309 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
group-onsemi 0:098463de4c5d 310 #include "string.h"
group-onsemi 0:098463de4c5d 311 #include "math.h"
group-onsemi 0:098463de4c5d 312 #ifdef __cplusplus
group-onsemi 0:098463de4c5d 313 extern "C"
group-onsemi 0:098463de4c5d 314 {
group-onsemi 0:098463de4c5d 315 #endif
group-onsemi 0:098463de4c5d 316
group-onsemi 0:098463de4c5d 317
group-onsemi 0:098463de4c5d 318 /**
group-onsemi 0:098463de4c5d 319 * @brief Macros required for reciprocal calculation in Normalized LMS
group-onsemi 0:098463de4c5d 320 */
group-onsemi 0:098463de4c5d 321
group-onsemi 0:098463de4c5d 322 #define DELTA_Q31 (0x100)
group-onsemi 0:098463de4c5d 323 #define DELTA_Q15 0x5
group-onsemi 0:098463de4c5d 324 #define INDEX_MASK 0x0000003F
group-onsemi 0:098463de4c5d 325 #ifndef PI
group-onsemi 0:098463de4c5d 326 #define PI 3.14159265358979f
group-onsemi 0:098463de4c5d 327 #endif
group-onsemi 0:098463de4c5d 328
group-onsemi 0:098463de4c5d 329 /**
group-onsemi 0:098463de4c5d 330 * @brief Macros required for SINE and COSINE Fast math approximations
group-onsemi 0:098463de4c5d 331 */
group-onsemi 0:098463de4c5d 332
group-onsemi 0:098463de4c5d 333 #define FAST_MATH_TABLE_SIZE 512
group-onsemi 0:098463de4c5d 334 #define FAST_MATH_Q31_SHIFT (32 - 10)
group-onsemi 0:098463de4c5d 335 #define FAST_MATH_Q15_SHIFT (16 - 10)
group-onsemi 0:098463de4c5d 336 #define CONTROLLER_Q31_SHIFT (32 - 9)
group-onsemi 0:098463de4c5d 337 #define TABLE_SIZE 256
group-onsemi 0:098463de4c5d 338 #define TABLE_SPACING_Q31 0x400000
group-onsemi 0:098463de4c5d 339 #define TABLE_SPACING_Q15 0x80
group-onsemi 0:098463de4c5d 340
group-onsemi 0:098463de4c5d 341 /**
group-onsemi 0:098463de4c5d 342 * @brief Macros required for SINE and COSINE Controller functions
group-onsemi 0:098463de4c5d 343 */
group-onsemi 0:098463de4c5d 344 /* 1.31(q31) Fixed value of 2/360 */
group-onsemi 0:098463de4c5d 345 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
group-onsemi 0:098463de4c5d 346 #define INPUT_SPACING 0xB60B61
group-onsemi 0:098463de4c5d 347
group-onsemi 0:098463de4c5d 348 /**
group-onsemi 0:098463de4c5d 349 * @brief Macro for Unaligned Support
group-onsemi 0:098463de4c5d 350 */
group-onsemi 0:098463de4c5d 351 #ifndef UNALIGNED_SUPPORT_DISABLE
group-onsemi 0:098463de4c5d 352 #define ALIGN4
group-onsemi 0:098463de4c5d 353 #else
group-onsemi 0:098463de4c5d 354 #if defined (__GNUC__)
group-onsemi 0:098463de4c5d 355 #define ALIGN4 __attribute__((aligned(4)))
group-onsemi 0:098463de4c5d 356 #else
group-onsemi 0:098463de4c5d 357 #define ALIGN4 __align(4)
group-onsemi 0:098463de4c5d 358 #endif
group-onsemi 0:098463de4c5d 359 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
group-onsemi 0:098463de4c5d 360
group-onsemi 0:098463de4c5d 361 /**
group-onsemi 0:098463de4c5d 362 * @brief Error status returned by some functions in the library.
group-onsemi 0:098463de4c5d 363 */
group-onsemi 0:098463de4c5d 364
group-onsemi 0:098463de4c5d 365 typedef enum
group-onsemi 0:098463de4c5d 366 {
group-onsemi 0:098463de4c5d 367 ARM_MATH_SUCCESS = 0, /**< No error */
group-onsemi 0:098463de4c5d 368 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
group-onsemi 0:098463de4c5d 369 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
group-onsemi 0:098463de4c5d 370 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
group-onsemi 0:098463de4c5d 371 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
group-onsemi 0:098463de4c5d 372 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
group-onsemi 0:098463de4c5d 373 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
group-onsemi 0:098463de4c5d 374 } arm_status;
group-onsemi 0:098463de4c5d 375
group-onsemi 0:098463de4c5d 376 /**
group-onsemi 0:098463de4c5d 377 * @brief 8-bit fractional data type in 1.7 format.
group-onsemi 0:098463de4c5d 378 */
group-onsemi 0:098463de4c5d 379 typedef int8_t q7_t;
group-onsemi 0:098463de4c5d 380
group-onsemi 0:098463de4c5d 381 /**
group-onsemi 0:098463de4c5d 382 * @brief 16-bit fractional data type in 1.15 format.
group-onsemi 0:098463de4c5d 383 */
group-onsemi 0:098463de4c5d 384 typedef int16_t q15_t;
group-onsemi 0:098463de4c5d 385
group-onsemi 0:098463de4c5d 386 /**
group-onsemi 0:098463de4c5d 387 * @brief 32-bit fractional data type in 1.31 format.
group-onsemi 0:098463de4c5d 388 */
group-onsemi 0:098463de4c5d 389 typedef int32_t q31_t;
group-onsemi 0:098463de4c5d 390
group-onsemi 0:098463de4c5d 391 /**
group-onsemi 0:098463de4c5d 392 * @brief 64-bit fractional data type in 1.63 format.
group-onsemi 0:098463de4c5d 393 */
group-onsemi 0:098463de4c5d 394 typedef int64_t q63_t;
group-onsemi 0:098463de4c5d 395
group-onsemi 0:098463de4c5d 396 /**
group-onsemi 0:098463de4c5d 397 * @brief 32-bit floating-point type definition.
group-onsemi 0:098463de4c5d 398 */
group-onsemi 0:098463de4c5d 399 typedef float float32_t;
group-onsemi 0:098463de4c5d 400
group-onsemi 0:098463de4c5d 401 /**
group-onsemi 0:098463de4c5d 402 * @brief 64-bit floating-point type definition.
group-onsemi 0:098463de4c5d 403 */
group-onsemi 0:098463de4c5d 404 typedef double float64_t;
group-onsemi 0:098463de4c5d 405
group-onsemi 0:098463de4c5d 406 /**
group-onsemi 0:098463de4c5d 407 * @brief definition to read/write two 16 bit values.
group-onsemi 0:098463de4c5d 408 */
group-onsemi 0:098463de4c5d 409 #if defined __CC_ARM
group-onsemi 0:098463de4c5d 410 #define __SIMD32_TYPE int32_t __packed
group-onsemi 0:098463de4c5d 411 #define CMSIS_UNUSED __attribute__((unused))
group-onsemi 0:098463de4c5d 412 #elif defined __ICCARM__
group-onsemi 0:098463de4c5d 413 #define __SIMD32_TYPE int32_t __packed
group-onsemi 0:098463de4c5d 414 #define CMSIS_UNUSED
group-onsemi 0:098463de4c5d 415 #elif defined __GNUC__
group-onsemi 0:098463de4c5d 416 #define __SIMD32_TYPE int32_t
group-onsemi 0:098463de4c5d 417 #define CMSIS_UNUSED __attribute__((unused))
group-onsemi 0:098463de4c5d 418 #elif defined __CSMC__ /* Cosmic */
group-onsemi 0:098463de4c5d 419 #define __SIMD32_TYPE int32_t
group-onsemi 0:098463de4c5d 420 #define CMSIS_UNUSED
group-onsemi 0:098463de4c5d 421 #elif defined __TASKING__
group-onsemi 0:098463de4c5d 422 #define __SIMD32_TYPE __unaligned int32_t
group-onsemi 0:098463de4c5d 423 #define CMSIS_UNUSED
group-onsemi 0:098463de4c5d 424 #else
group-onsemi 0:098463de4c5d 425 #error Unknown compiler
group-onsemi 0:098463de4c5d 426 #endif
group-onsemi 0:098463de4c5d 427
group-onsemi 0:098463de4c5d 428 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
group-onsemi 0:098463de4c5d 429 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
group-onsemi 0:098463de4c5d 430
group-onsemi 0:098463de4c5d 431 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
group-onsemi 0:098463de4c5d 432
group-onsemi 0:098463de4c5d 433 #define __SIMD64(addr) (*(int64_t **) & (addr))
group-onsemi 0:098463de4c5d 434
group-onsemi 0:098463de4c5d 435 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
group-onsemi 0:098463de4c5d 436 /**
group-onsemi 0:098463de4c5d 437 * @brief definition to pack two 16 bit values.
group-onsemi 0:098463de4c5d 438 */
group-onsemi 0:098463de4c5d 439 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
group-onsemi 0:098463de4c5d 440 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
group-onsemi 0:098463de4c5d 441 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
group-onsemi 0:098463de4c5d 442 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
group-onsemi 0:098463de4c5d 443
group-onsemi 0:098463de4c5d 444 #endif
group-onsemi 0:098463de4c5d 445
group-onsemi 0:098463de4c5d 446
group-onsemi 0:098463de4c5d 447 /**
group-onsemi 0:098463de4c5d 448 * @brief definition to pack four 8 bit values.
group-onsemi 0:098463de4c5d 449 */
group-onsemi 0:098463de4c5d 450 #ifndef ARM_MATH_BIG_ENDIAN
group-onsemi 0:098463de4c5d 451
group-onsemi 0:098463de4c5d 452 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
group-onsemi 0:098463de4c5d 453 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
group-onsemi 0:098463de4c5d 454 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
group-onsemi 0:098463de4c5d 455 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
group-onsemi 0:098463de4c5d 456 #else
group-onsemi 0:098463de4c5d 457
group-onsemi 0:098463de4c5d 458 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
group-onsemi 0:098463de4c5d 459 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
group-onsemi 0:098463de4c5d 460 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
group-onsemi 0:098463de4c5d 461 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
group-onsemi 0:098463de4c5d 462
group-onsemi 0:098463de4c5d 463 #endif
group-onsemi 0:098463de4c5d 464
group-onsemi 0:098463de4c5d 465
group-onsemi 0:098463de4c5d 466 /**
group-onsemi 0:098463de4c5d 467 * @brief Clips Q63 to Q31 values.
group-onsemi 0:098463de4c5d 468 */
group-onsemi 0:098463de4c5d 469 static __INLINE q31_t clip_q63_to_q31(
group-onsemi 0:098463de4c5d 470 q63_t x)
group-onsemi 0:098463de4c5d 471 {
group-onsemi 0:098463de4c5d 472 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
group-onsemi 0:098463de4c5d 473 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
group-onsemi 0:098463de4c5d 474 }
group-onsemi 0:098463de4c5d 475
group-onsemi 0:098463de4c5d 476 /**
group-onsemi 0:098463de4c5d 477 * @brief Clips Q63 to Q15 values.
group-onsemi 0:098463de4c5d 478 */
group-onsemi 0:098463de4c5d 479 static __INLINE q15_t clip_q63_to_q15(
group-onsemi 0:098463de4c5d 480 q63_t x)
group-onsemi 0:098463de4c5d 481 {
group-onsemi 0:098463de4c5d 482 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
group-onsemi 0:098463de4c5d 483 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
group-onsemi 0:098463de4c5d 484 }
group-onsemi 0:098463de4c5d 485
group-onsemi 0:098463de4c5d 486 /**
group-onsemi 0:098463de4c5d 487 * @brief Clips Q31 to Q7 values.
group-onsemi 0:098463de4c5d 488 */
group-onsemi 0:098463de4c5d 489 static __INLINE q7_t clip_q31_to_q7(
group-onsemi 0:098463de4c5d 490 q31_t x)
group-onsemi 0:098463de4c5d 491 {
group-onsemi 0:098463de4c5d 492 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
group-onsemi 0:098463de4c5d 493 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
group-onsemi 0:098463de4c5d 494 }
group-onsemi 0:098463de4c5d 495
group-onsemi 0:098463de4c5d 496 /**
group-onsemi 0:098463de4c5d 497 * @brief Clips Q31 to Q15 values.
group-onsemi 0:098463de4c5d 498 */
group-onsemi 0:098463de4c5d 499 static __INLINE q15_t clip_q31_to_q15(
group-onsemi 0:098463de4c5d 500 q31_t x)
group-onsemi 0:098463de4c5d 501 {
group-onsemi 0:098463de4c5d 502 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
group-onsemi 0:098463de4c5d 503 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
group-onsemi 0:098463de4c5d 504 }
group-onsemi 0:098463de4c5d 505
group-onsemi 0:098463de4c5d 506 /**
group-onsemi 0:098463de4c5d 507 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
group-onsemi 0:098463de4c5d 508 */
group-onsemi 0:098463de4c5d 509
group-onsemi 0:098463de4c5d 510 static __INLINE q63_t mult32x64(
group-onsemi 0:098463de4c5d 511 q63_t x,
group-onsemi 0:098463de4c5d 512 q31_t y)
group-onsemi 0:098463de4c5d 513 {
group-onsemi 0:098463de4c5d 514 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
group-onsemi 0:098463de4c5d 515 (((q63_t) (x >> 32) * y)));
group-onsemi 0:098463de4c5d 516 }
group-onsemi 0:098463de4c5d 517
group-onsemi 0:098463de4c5d 518
group-onsemi 0:098463de4c5d 519 //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
group-onsemi 0:098463de4c5d 520 //#define __CLZ __clz
group-onsemi 0:098463de4c5d 521 //#endif
group-onsemi 0:098463de4c5d 522
group-onsemi 0:098463de4c5d 523 //note: function can be removed when all toolchain support __CLZ for Cortex-M0
group-onsemi 0:098463de4c5d 524 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
group-onsemi 0:098463de4c5d 525
group-onsemi 0:098463de4c5d 526 static __INLINE uint32_t __CLZ(
group-onsemi 0:098463de4c5d 527 q31_t data);
group-onsemi 0:098463de4c5d 528
group-onsemi 0:098463de4c5d 529
group-onsemi 0:098463de4c5d 530 static __INLINE uint32_t __CLZ(
group-onsemi 0:098463de4c5d 531 q31_t data)
group-onsemi 0:098463de4c5d 532 {
group-onsemi 0:098463de4c5d 533 uint32_t count = 0;
group-onsemi 0:098463de4c5d 534 uint32_t mask = 0x80000000;
group-onsemi 0:098463de4c5d 535
group-onsemi 0:098463de4c5d 536 while((data & mask) == 0)
group-onsemi 0:098463de4c5d 537 {
group-onsemi 0:098463de4c5d 538 count += 1u;
group-onsemi 0:098463de4c5d 539 mask = mask >> 1u;
group-onsemi 0:098463de4c5d 540 }
group-onsemi 0:098463de4c5d 541
group-onsemi 0:098463de4c5d 542 return (count);
group-onsemi 0:098463de4c5d 543
group-onsemi 0:098463de4c5d 544 }
group-onsemi 0:098463de4c5d 545
group-onsemi 0:098463de4c5d 546 #endif
group-onsemi 0:098463de4c5d 547
group-onsemi 0:098463de4c5d 548 /**
group-onsemi 0:098463de4c5d 549 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
group-onsemi 0:098463de4c5d 550 */
group-onsemi 0:098463de4c5d 551
group-onsemi 0:098463de4c5d 552 static __INLINE uint32_t arm_recip_q31(
group-onsemi 0:098463de4c5d 553 q31_t in,
group-onsemi 0:098463de4c5d 554 q31_t * dst,
group-onsemi 0:098463de4c5d 555 q31_t * pRecipTable)
group-onsemi 0:098463de4c5d 556 {
group-onsemi 0:098463de4c5d 557
group-onsemi 0:098463de4c5d 558 uint32_t out, tempVal;
group-onsemi 0:098463de4c5d 559 uint32_t index, i;
group-onsemi 0:098463de4c5d 560 uint32_t signBits;
group-onsemi 0:098463de4c5d 561
group-onsemi 0:098463de4c5d 562 if(in > 0)
group-onsemi 0:098463de4c5d 563 {
group-onsemi 0:098463de4c5d 564 signBits = __CLZ(in) - 1;
group-onsemi 0:098463de4c5d 565 }
group-onsemi 0:098463de4c5d 566 else
group-onsemi 0:098463de4c5d 567 {
group-onsemi 0:098463de4c5d 568 signBits = __CLZ(-in) - 1;
group-onsemi 0:098463de4c5d 569 }
group-onsemi 0:098463de4c5d 570
group-onsemi 0:098463de4c5d 571 /* Convert input sample to 1.31 format */
group-onsemi 0:098463de4c5d 572 in = in << signBits;
group-onsemi 0:098463de4c5d 573
group-onsemi 0:098463de4c5d 574 /* calculation of index for initial approximated Val */
group-onsemi 0:098463de4c5d 575 index = (uint32_t) (in >> 24u);
group-onsemi 0:098463de4c5d 576 index = (index & INDEX_MASK);
group-onsemi 0:098463de4c5d 577
group-onsemi 0:098463de4c5d 578 /* 1.31 with exp 1 */
group-onsemi 0:098463de4c5d 579 out = pRecipTable[index];
group-onsemi 0:098463de4c5d 580
group-onsemi 0:098463de4c5d 581 /* calculation of reciprocal value */
group-onsemi 0:098463de4c5d 582 /* running approximation for two iterations */
group-onsemi 0:098463de4c5d 583 for (i = 0u; i < 2u; i++)
group-onsemi 0:098463de4c5d 584 {
group-onsemi 0:098463de4c5d 585 tempVal = (q31_t) (((q63_t) in * out) >> 31u);
group-onsemi 0:098463de4c5d 586 tempVal = 0x7FFFFFFF - tempVal;
group-onsemi 0:098463de4c5d 587 /* 1.31 with exp 1 */
group-onsemi 0:098463de4c5d 588 //out = (q31_t) (((q63_t) out * tempVal) >> 30u);
group-onsemi 0:098463de4c5d 589 out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u);
group-onsemi 0:098463de4c5d 590 }
group-onsemi 0:098463de4c5d 591
group-onsemi 0:098463de4c5d 592 /* write output */
group-onsemi 0:098463de4c5d 593 *dst = out;
group-onsemi 0:098463de4c5d 594
group-onsemi 0:098463de4c5d 595 /* return num of signbits of out = 1/in value */
group-onsemi 0:098463de4c5d 596 return (signBits + 1u);
group-onsemi 0:098463de4c5d 597
group-onsemi 0:098463de4c5d 598 }
group-onsemi 0:098463de4c5d 599
group-onsemi 0:098463de4c5d 600 /**
group-onsemi 0:098463de4c5d 601 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
group-onsemi 0:098463de4c5d 602 */
group-onsemi 0:098463de4c5d 603 static __INLINE uint32_t arm_recip_q15(
group-onsemi 0:098463de4c5d 604 q15_t in,
group-onsemi 0:098463de4c5d 605 q15_t * dst,
group-onsemi 0:098463de4c5d 606 q15_t * pRecipTable)
group-onsemi 0:098463de4c5d 607 {
group-onsemi 0:098463de4c5d 608
group-onsemi 0:098463de4c5d 609 uint32_t out = 0, tempVal = 0;
group-onsemi 0:098463de4c5d 610 uint32_t index = 0, i = 0;
group-onsemi 0:098463de4c5d 611 uint32_t signBits = 0;
group-onsemi 0:098463de4c5d 612
group-onsemi 0:098463de4c5d 613 if(in > 0)
group-onsemi 0:098463de4c5d 614 {
group-onsemi 0:098463de4c5d 615 signBits = __CLZ(in) - 17;
group-onsemi 0:098463de4c5d 616 }
group-onsemi 0:098463de4c5d 617 else
group-onsemi 0:098463de4c5d 618 {
group-onsemi 0:098463de4c5d 619 signBits = __CLZ(-in) - 17;
group-onsemi 0:098463de4c5d 620 }
group-onsemi 0:098463de4c5d 621
group-onsemi 0:098463de4c5d 622 /* Convert input sample to 1.15 format */
group-onsemi 0:098463de4c5d 623 in = in << signBits;
group-onsemi 0:098463de4c5d 624
group-onsemi 0:098463de4c5d 625 /* calculation of index for initial approximated Val */
group-onsemi 0:098463de4c5d 626 index = in >> 8;
group-onsemi 0:098463de4c5d 627 index = (index & INDEX_MASK);
group-onsemi 0:098463de4c5d 628
group-onsemi 0:098463de4c5d 629 /* 1.15 with exp 1 */
group-onsemi 0:098463de4c5d 630 out = pRecipTable[index];
group-onsemi 0:098463de4c5d 631
group-onsemi 0:098463de4c5d 632 /* calculation of reciprocal value */
group-onsemi 0:098463de4c5d 633 /* running approximation for two iterations */
group-onsemi 0:098463de4c5d 634 for (i = 0; i < 2; i++)
group-onsemi 0:098463de4c5d 635 {
group-onsemi 0:098463de4c5d 636 tempVal = (q15_t) (((q31_t) in * out) >> 15);
group-onsemi 0:098463de4c5d 637 tempVal = 0x7FFF - tempVal;
group-onsemi 0:098463de4c5d 638 /* 1.15 with exp 1 */
group-onsemi 0:098463de4c5d 639 out = (q15_t) (((q31_t) out * tempVal) >> 14);
group-onsemi 0:098463de4c5d 640 }
group-onsemi 0:098463de4c5d 641
group-onsemi 0:098463de4c5d 642 /* write output */
group-onsemi 0:098463de4c5d 643 *dst = out;
group-onsemi 0:098463de4c5d 644
group-onsemi 0:098463de4c5d 645 /* return num of signbits of out = 1/in value */
group-onsemi 0:098463de4c5d 646 return (signBits + 1);
group-onsemi 0:098463de4c5d 647
group-onsemi 0:098463de4c5d 648 }
group-onsemi 0:098463de4c5d 649
group-onsemi 0:098463de4c5d 650
group-onsemi 0:098463de4c5d 651 /*
group-onsemi 0:098463de4c5d 652 * @brief C custom defined intrinisic function for only M0 processors
group-onsemi 0:098463de4c5d 653 */
group-onsemi 0:098463de4c5d 654 #if defined(ARM_MATH_CM0_FAMILY)
group-onsemi 0:098463de4c5d 655
group-onsemi 0:098463de4c5d 656 static __INLINE q31_t __SSAT(
group-onsemi 0:098463de4c5d 657 q31_t x,
group-onsemi 0:098463de4c5d 658 uint32_t y)
group-onsemi 0:098463de4c5d 659 {
group-onsemi 0:098463de4c5d 660 int32_t posMax, negMin;
group-onsemi 0:098463de4c5d 661 uint32_t i;
group-onsemi 0:098463de4c5d 662
group-onsemi 0:098463de4c5d 663 posMax = 1;
group-onsemi 0:098463de4c5d 664 for (i = 0; i < (y - 1); i++)
group-onsemi 0:098463de4c5d 665 {
group-onsemi 0:098463de4c5d 666 posMax = posMax * 2;
group-onsemi 0:098463de4c5d 667 }
group-onsemi 0:098463de4c5d 668
group-onsemi 0:098463de4c5d 669 if(x > 0)
group-onsemi 0:098463de4c5d 670 {
group-onsemi 0:098463de4c5d 671 posMax = (posMax - 1);
group-onsemi 0:098463de4c5d 672
group-onsemi 0:098463de4c5d 673 if(x > posMax)
group-onsemi 0:098463de4c5d 674 {
group-onsemi 0:098463de4c5d 675 x = posMax;
group-onsemi 0:098463de4c5d 676 }
group-onsemi 0:098463de4c5d 677 }
group-onsemi 0:098463de4c5d 678 else
group-onsemi 0:098463de4c5d 679 {
group-onsemi 0:098463de4c5d 680 negMin = -posMax;
group-onsemi 0:098463de4c5d 681
group-onsemi 0:098463de4c5d 682 if(x < negMin)
group-onsemi 0:098463de4c5d 683 {
group-onsemi 0:098463de4c5d 684 x = negMin;
group-onsemi 0:098463de4c5d 685 }
group-onsemi 0:098463de4c5d 686 }
group-onsemi 0:098463de4c5d 687 return (x);
group-onsemi 0:098463de4c5d 688
group-onsemi 0:098463de4c5d 689
group-onsemi 0:098463de4c5d 690 }
group-onsemi 0:098463de4c5d 691
group-onsemi 0:098463de4c5d 692 #endif /* end of ARM_MATH_CM0_FAMILY */
group-onsemi 0:098463de4c5d 693
group-onsemi 0:098463de4c5d 694
group-onsemi 0:098463de4c5d 695
group-onsemi 0:098463de4c5d 696 /*
group-onsemi 0:098463de4c5d 697 * @brief C custom defined intrinsic function for M3 and M0 processors
group-onsemi 0:098463de4c5d 698 */
group-onsemi 0:098463de4c5d 699 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
group-onsemi 0:098463de4c5d 700
group-onsemi 0:098463de4c5d 701 /*
group-onsemi 0:098463de4c5d 702 * @brief C custom defined QADD8 for M3 and M0 processors
group-onsemi 0:098463de4c5d 703 */
group-onsemi 0:098463de4c5d 704 static __INLINE q31_t __QADD8(
group-onsemi 0:098463de4c5d 705 q31_t x,
group-onsemi 0:098463de4c5d 706 q31_t y)
group-onsemi 0:098463de4c5d 707 {
group-onsemi 0:098463de4c5d 708
group-onsemi 0:098463de4c5d 709 q31_t sum;
group-onsemi 0:098463de4c5d 710 q7_t r, s, t, u;
group-onsemi 0:098463de4c5d 711
group-onsemi 0:098463de4c5d 712 r = (q7_t) x;
group-onsemi 0:098463de4c5d 713 s = (q7_t) y;
group-onsemi 0:098463de4c5d 714
group-onsemi 0:098463de4c5d 715 r = __SSAT((q31_t) (r + s), 8);
group-onsemi 0:098463de4c5d 716 s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8);
group-onsemi 0:098463de4c5d 717 t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8);
group-onsemi 0:098463de4c5d 718 u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8);
group-onsemi 0:098463de4c5d 719
group-onsemi 0:098463de4c5d 720 sum =
group-onsemi 0:098463de4c5d 721 (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) |
group-onsemi 0:098463de4c5d 722 (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF);
group-onsemi 0:098463de4c5d 723
group-onsemi 0:098463de4c5d 724 return sum;
group-onsemi 0:098463de4c5d 725
group-onsemi 0:098463de4c5d 726 }
group-onsemi 0:098463de4c5d 727
group-onsemi 0:098463de4c5d 728 /*
group-onsemi 0:098463de4c5d 729 * @brief C custom defined QSUB8 for M3 and M0 processors
group-onsemi 0:098463de4c5d 730 */
group-onsemi 0:098463de4c5d 731 static __INLINE q31_t __QSUB8(
group-onsemi 0:098463de4c5d 732 q31_t x,
group-onsemi 0:098463de4c5d 733 q31_t y)
group-onsemi 0:098463de4c5d 734 {
group-onsemi 0:098463de4c5d 735
group-onsemi 0:098463de4c5d 736 q31_t sum;
group-onsemi 0:098463de4c5d 737 q31_t r, s, t, u;
group-onsemi 0:098463de4c5d 738
group-onsemi 0:098463de4c5d 739 r = (q7_t) x;
group-onsemi 0:098463de4c5d 740 s = (q7_t) y;
group-onsemi 0:098463de4c5d 741
group-onsemi 0:098463de4c5d 742 r = __SSAT((r - s), 8);
group-onsemi 0:098463de4c5d 743 s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8;
group-onsemi 0:098463de4c5d 744 t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16;
group-onsemi 0:098463de4c5d 745 u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24;
group-onsemi 0:098463de4c5d 746
group-onsemi 0:098463de4c5d 747 sum =
group-onsemi 0:098463de4c5d 748 (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r &
group-onsemi 0:098463de4c5d 749 0x000000FF);
group-onsemi 0:098463de4c5d 750
group-onsemi 0:098463de4c5d 751 return sum;
group-onsemi 0:098463de4c5d 752 }
group-onsemi 0:098463de4c5d 753
group-onsemi 0:098463de4c5d 754 /*
group-onsemi 0:098463de4c5d 755 * @brief C custom defined QADD16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 756 */
group-onsemi 0:098463de4c5d 757
group-onsemi 0:098463de4c5d 758 /*
group-onsemi 0:098463de4c5d 759 * @brief C custom defined QADD16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 760 */
group-onsemi 0:098463de4c5d 761 static __INLINE q31_t __QADD16(
group-onsemi 0:098463de4c5d 762 q31_t x,
group-onsemi 0:098463de4c5d 763 q31_t y)
group-onsemi 0:098463de4c5d 764 {
group-onsemi 0:098463de4c5d 765
group-onsemi 0:098463de4c5d 766 q31_t sum;
group-onsemi 0:098463de4c5d 767 q31_t r, s;
group-onsemi 0:098463de4c5d 768
group-onsemi 0:098463de4c5d 769 r = (q15_t) x;
group-onsemi 0:098463de4c5d 770 s = (q15_t) y;
group-onsemi 0:098463de4c5d 771
group-onsemi 0:098463de4c5d 772 r = __SSAT(r + s, 16);
group-onsemi 0:098463de4c5d 773 s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16;
group-onsemi 0:098463de4c5d 774
group-onsemi 0:098463de4c5d 775 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 776
group-onsemi 0:098463de4c5d 777 return sum;
group-onsemi 0:098463de4c5d 778
group-onsemi 0:098463de4c5d 779 }
group-onsemi 0:098463de4c5d 780
group-onsemi 0:098463de4c5d 781 /*
group-onsemi 0:098463de4c5d 782 * @brief C custom defined SHADD16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 783 */
group-onsemi 0:098463de4c5d 784 static __INLINE q31_t __SHADD16(
group-onsemi 0:098463de4c5d 785 q31_t x,
group-onsemi 0:098463de4c5d 786 q31_t y)
group-onsemi 0:098463de4c5d 787 {
group-onsemi 0:098463de4c5d 788
group-onsemi 0:098463de4c5d 789 q31_t sum;
group-onsemi 0:098463de4c5d 790 q31_t r, s;
group-onsemi 0:098463de4c5d 791
group-onsemi 0:098463de4c5d 792 r = (q15_t) x;
group-onsemi 0:098463de4c5d 793 s = (q15_t) y;
group-onsemi 0:098463de4c5d 794
group-onsemi 0:098463de4c5d 795 r = ((r >> 1) + (s >> 1));
group-onsemi 0:098463de4c5d 796 s = ((q31_t) ((x >> 17) + (y >> 17))) << 16;
group-onsemi 0:098463de4c5d 797
group-onsemi 0:098463de4c5d 798 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 799
group-onsemi 0:098463de4c5d 800 return sum;
group-onsemi 0:098463de4c5d 801
group-onsemi 0:098463de4c5d 802 }
group-onsemi 0:098463de4c5d 803
group-onsemi 0:098463de4c5d 804 /*
group-onsemi 0:098463de4c5d 805 * @brief C custom defined QSUB16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 806 */
group-onsemi 0:098463de4c5d 807 static __INLINE q31_t __QSUB16(
group-onsemi 0:098463de4c5d 808 q31_t x,
group-onsemi 0:098463de4c5d 809 q31_t y)
group-onsemi 0:098463de4c5d 810 {
group-onsemi 0:098463de4c5d 811
group-onsemi 0:098463de4c5d 812 q31_t sum;
group-onsemi 0:098463de4c5d 813 q31_t r, s;
group-onsemi 0:098463de4c5d 814
group-onsemi 0:098463de4c5d 815 r = (q15_t) x;
group-onsemi 0:098463de4c5d 816 s = (q15_t) y;
group-onsemi 0:098463de4c5d 817
group-onsemi 0:098463de4c5d 818 r = __SSAT(r - s, 16);
group-onsemi 0:098463de4c5d 819 s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16;
group-onsemi 0:098463de4c5d 820
group-onsemi 0:098463de4c5d 821 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 822
group-onsemi 0:098463de4c5d 823 return sum;
group-onsemi 0:098463de4c5d 824 }
group-onsemi 0:098463de4c5d 825
group-onsemi 0:098463de4c5d 826 /*
group-onsemi 0:098463de4c5d 827 * @brief C custom defined SHSUB16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 828 */
group-onsemi 0:098463de4c5d 829 static __INLINE q31_t __SHSUB16(
group-onsemi 0:098463de4c5d 830 q31_t x,
group-onsemi 0:098463de4c5d 831 q31_t y)
group-onsemi 0:098463de4c5d 832 {
group-onsemi 0:098463de4c5d 833
group-onsemi 0:098463de4c5d 834 q31_t diff;
group-onsemi 0:098463de4c5d 835 q31_t r, s;
group-onsemi 0:098463de4c5d 836
group-onsemi 0:098463de4c5d 837 r = (q15_t) x;
group-onsemi 0:098463de4c5d 838 s = (q15_t) y;
group-onsemi 0:098463de4c5d 839
group-onsemi 0:098463de4c5d 840 r = ((r >> 1) - (s >> 1));
group-onsemi 0:098463de4c5d 841 s = (((x >> 17) - (y >> 17)) << 16);
group-onsemi 0:098463de4c5d 842
group-onsemi 0:098463de4c5d 843 diff = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 844
group-onsemi 0:098463de4c5d 845 return diff;
group-onsemi 0:098463de4c5d 846 }
group-onsemi 0:098463de4c5d 847
group-onsemi 0:098463de4c5d 848 /*
group-onsemi 0:098463de4c5d 849 * @brief C custom defined QASX for M3 and M0 processors
group-onsemi 0:098463de4c5d 850 */
group-onsemi 0:098463de4c5d 851 static __INLINE q31_t __QASX(
group-onsemi 0:098463de4c5d 852 q31_t x,
group-onsemi 0:098463de4c5d 853 q31_t y)
group-onsemi 0:098463de4c5d 854 {
group-onsemi 0:098463de4c5d 855
group-onsemi 0:098463de4c5d 856 q31_t sum = 0;
group-onsemi 0:098463de4c5d 857
group-onsemi 0:098463de4c5d 858 sum =
group-onsemi 0:098463de4c5d 859 ((sum +
group-onsemi 0:098463de4c5d 860 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) +
group-onsemi 0:098463de4c5d 861 clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16)));
group-onsemi 0:098463de4c5d 862
group-onsemi 0:098463de4c5d 863 return sum;
group-onsemi 0:098463de4c5d 864 }
group-onsemi 0:098463de4c5d 865
group-onsemi 0:098463de4c5d 866 /*
group-onsemi 0:098463de4c5d 867 * @brief C custom defined SHASX for M3 and M0 processors
group-onsemi 0:098463de4c5d 868 */
group-onsemi 0:098463de4c5d 869 static __INLINE q31_t __SHASX(
group-onsemi 0:098463de4c5d 870 q31_t x,
group-onsemi 0:098463de4c5d 871 q31_t y)
group-onsemi 0:098463de4c5d 872 {
group-onsemi 0:098463de4c5d 873
group-onsemi 0:098463de4c5d 874 q31_t sum;
group-onsemi 0:098463de4c5d 875 q31_t r, s;
group-onsemi 0:098463de4c5d 876
group-onsemi 0:098463de4c5d 877 r = (q15_t) x;
group-onsemi 0:098463de4c5d 878 s = (q15_t) y;
group-onsemi 0:098463de4c5d 879
group-onsemi 0:098463de4c5d 880 r = ((r >> 1) - (y >> 17));
group-onsemi 0:098463de4c5d 881 s = (((x >> 17) + (s >> 1)) << 16);
group-onsemi 0:098463de4c5d 882
group-onsemi 0:098463de4c5d 883 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 884
group-onsemi 0:098463de4c5d 885 return sum;
group-onsemi 0:098463de4c5d 886 }
group-onsemi 0:098463de4c5d 887
group-onsemi 0:098463de4c5d 888
group-onsemi 0:098463de4c5d 889 /*
group-onsemi 0:098463de4c5d 890 * @brief C custom defined QSAX for M3 and M0 processors
group-onsemi 0:098463de4c5d 891 */
group-onsemi 0:098463de4c5d 892 static __INLINE q31_t __QSAX(
group-onsemi 0:098463de4c5d 893 q31_t x,
group-onsemi 0:098463de4c5d 894 q31_t y)
group-onsemi 0:098463de4c5d 895 {
group-onsemi 0:098463de4c5d 896
group-onsemi 0:098463de4c5d 897 q31_t sum = 0;
group-onsemi 0:098463de4c5d 898
group-onsemi 0:098463de4c5d 899 sum =
group-onsemi 0:098463de4c5d 900 ((sum +
group-onsemi 0:098463de4c5d 901 clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) +
group-onsemi 0:098463de4c5d 902 clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16)));
group-onsemi 0:098463de4c5d 903
group-onsemi 0:098463de4c5d 904 return sum;
group-onsemi 0:098463de4c5d 905 }
group-onsemi 0:098463de4c5d 906
group-onsemi 0:098463de4c5d 907 /*
group-onsemi 0:098463de4c5d 908 * @brief C custom defined SHSAX for M3 and M0 processors
group-onsemi 0:098463de4c5d 909 */
group-onsemi 0:098463de4c5d 910 static __INLINE q31_t __SHSAX(
group-onsemi 0:098463de4c5d 911 q31_t x,
group-onsemi 0:098463de4c5d 912 q31_t y)
group-onsemi 0:098463de4c5d 913 {
group-onsemi 0:098463de4c5d 914
group-onsemi 0:098463de4c5d 915 q31_t sum;
group-onsemi 0:098463de4c5d 916 q31_t r, s;
group-onsemi 0:098463de4c5d 917
group-onsemi 0:098463de4c5d 918 r = (q15_t) x;
group-onsemi 0:098463de4c5d 919 s = (q15_t) y;
group-onsemi 0:098463de4c5d 920
group-onsemi 0:098463de4c5d 921 r = ((r >> 1) + (y >> 17));
group-onsemi 0:098463de4c5d 922 s = (((x >> 17) - (s >> 1)) << 16);
group-onsemi 0:098463de4c5d 923
group-onsemi 0:098463de4c5d 924 sum = (s & 0xFFFF0000) | (r & 0x0000FFFF);
group-onsemi 0:098463de4c5d 925
group-onsemi 0:098463de4c5d 926 return sum;
group-onsemi 0:098463de4c5d 927 }
group-onsemi 0:098463de4c5d 928
group-onsemi 0:098463de4c5d 929 /*
group-onsemi 0:098463de4c5d 930 * @brief C custom defined SMUSDX for M3 and M0 processors
group-onsemi 0:098463de4c5d 931 */
group-onsemi 0:098463de4c5d 932 static __INLINE q31_t __SMUSDX(
group-onsemi 0:098463de4c5d 933 q31_t x,
group-onsemi 0:098463de4c5d 934 q31_t y)
group-onsemi 0:098463de4c5d 935 {
group-onsemi 0:098463de4c5d 936
group-onsemi 0:098463de4c5d 937 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) -
group-onsemi 0:098463de4c5d 938 ((q15_t) (x >> 16) * (q15_t) y)));
group-onsemi 0:098463de4c5d 939 }
group-onsemi 0:098463de4c5d 940
group-onsemi 0:098463de4c5d 941 /*
group-onsemi 0:098463de4c5d 942 * @brief C custom defined SMUADX for M3 and M0 processors
group-onsemi 0:098463de4c5d 943 */
group-onsemi 0:098463de4c5d 944 static __INLINE q31_t __SMUADX(
group-onsemi 0:098463de4c5d 945 q31_t x,
group-onsemi 0:098463de4c5d 946 q31_t y)
group-onsemi 0:098463de4c5d 947 {
group-onsemi 0:098463de4c5d 948
group-onsemi 0:098463de4c5d 949 return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) +
group-onsemi 0:098463de4c5d 950 ((q15_t) (x >> 16) * (q15_t) y)));
group-onsemi 0:098463de4c5d 951 }
group-onsemi 0:098463de4c5d 952
group-onsemi 0:098463de4c5d 953 /*
group-onsemi 0:098463de4c5d 954 * @brief C custom defined QADD for M3 and M0 processors
group-onsemi 0:098463de4c5d 955 */
group-onsemi 0:098463de4c5d 956 static __INLINE q31_t __QADD(
group-onsemi 0:098463de4c5d 957 q31_t x,
group-onsemi 0:098463de4c5d 958 q31_t y)
group-onsemi 0:098463de4c5d 959 {
group-onsemi 0:098463de4c5d 960 return clip_q63_to_q31((q63_t) x + y);
group-onsemi 0:098463de4c5d 961 }
group-onsemi 0:098463de4c5d 962
group-onsemi 0:098463de4c5d 963 /*
group-onsemi 0:098463de4c5d 964 * @brief C custom defined QSUB for M3 and M0 processors
group-onsemi 0:098463de4c5d 965 */
group-onsemi 0:098463de4c5d 966 static __INLINE q31_t __QSUB(
group-onsemi 0:098463de4c5d 967 q31_t x,
group-onsemi 0:098463de4c5d 968 q31_t y)
group-onsemi 0:098463de4c5d 969 {
group-onsemi 0:098463de4c5d 970 return clip_q63_to_q31((q63_t) x - y);
group-onsemi 0:098463de4c5d 971 }
group-onsemi 0:098463de4c5d 972
group-onsemi 0:098463de4c5d 973 /*
group-onsemi 0:098463de4c5d 974 * @brief C custom defined SMLAD for M3 and M0 processors
group-onsemi 0:098463de4c5d 975 */
group-onsemi 0:098463de4c5d 976 static __INLINE q31_t __SMLAD(
group-onsemi 0:098463de4c5d 977 q31_t x,
group-onsemi 0:098463de4c5d 978 q31_t y,
group-onsemi 0:098463de4c5d 979 q31_t sum)
group-onsemi 0:098463de4c5d 980 {
group-onsemi 0:098463de4c5d 981
group-onsemi 0:098463de4c5d 982 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
group-onsemi 0:098463de4c5d 983 ((q15_t) x * (q15_t) y));
group-onsemi 0:098463de4c5d 984 }
group-onsemi 0:098463de4c5d 985
group-onsemi 0:098463de4c5d 986 /*
group-onsemi 0:098463de4c5d 987 * @brief C custom defined SMLADX for M3 and M0 processors
group-onsemi 0:098463de4c5d 988 */
group-onsemi 0:098463de4c5d 989 static __INLINE q31_t __SMLADX(
group-onsemi 0:098463de4c5d 990 q31_t x,
group-onsemi 0:098463de4c5d 991 q31_t y,
group-onsemi 0:098463de4c5d 992 q31_t sum)
group-onsemi 0:098463de4c5d 993 {
group-onsemi 0:098463de4c5d 994
group-onsemi 0:098463de4c5d 995 return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) +
group-onsemi 0:098463de4c5d 996 ((q15_t) x * (q15_t) (y >> 16)));
group-onsemi 0:098463de4c5d 997 }
group-onsemi 0:098463de4c5d 998
group-onsemi 0:098463de4c5d 999 /*
group-onsemi 0:098463de4c5d 1000 * @brief C custom defined SMLSDX for M3 and M0 processors
group-onsemi 0:098463de4c5d 1001 */
group-onsemi 0:098463de4c5d 1002 static __INLINE q31_t __SMLSDX(
group-onsemi 0:098463de4c5d 1003 q31_t x,
group-onsemi 0:098463de4c5d 1004 q31_t y,
group-onsemi 0:098463de4c5d 1005 q31_t sum)
group-onsemi 0:098463de4c5d 1006 {
group-onsemi 0:098463de4c5d 1007
group-onsemi 0:098463de4c5d 1008 return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) +
group-onsemi 0:098463de4c5d 1009 ((q15_t) x * (q15_t) (y >> 16)));
group-onsemi 0:098463de4c5d 1010 }
group-onsemi 0:098463de4c5d 1011
group-onsemi 0:098463de4c5d 1012 /*
group-onsemi 0:098463de4c5d 1013 * @brief C custom defined SMLALD for M3 and M0 processors
group-onsemi 0:098463de4c5d 1014 */
group-onsemi 0:098463de4c5d 1015 static __INLINE q63_t __SMLALD(
group-onsemi 0:098463de4c5d 1016 q31_t x,
group-onsemi 0:098463de4c5d 1017 q31_t y,
group-onsemi 0:098463de4c5d 1018 q63_t sum)
group-onsemi 0:098463de4c5d 1019 {
group-onsemi 0:098463de4c5d 1020
group-onsemi 0:098463de4c5d 1021 return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) +
group-onsemi 0:098463de4c5d 1022 ((q15_t) x * (q15_t) y));
group-onsemi 0:098463de4c5d 1023 }
group-onsemi 0:098463de4c5d 1024
group-onsemi 0:098463de4c5d 1025 /*
group-onsemi 0:098463de4c5d 1026 * @brief C custom defined SMLALDX for M3 and M0 processors
group-onsemi 0:098463de4c5d 1027 */
group-onsemi 0:098463de4c5d 1028 static __INLINE q63_t __SMLALDX(
group-onsemi 0:098463de4c5d 1029 q31_t x,
group-onsemi 0:098463de4c5d 1030 q31_t y,
group-onsemi 0:098463de4c5d 1031 q63_t sum)
group-onsemi 0:098463de4c5d 1032 {
group-onsemi 0:098463de4c5d 1033
group-onsemi 0:098463de4c5d 1034 return (sum + ((q15_t) (x >> 16) * (q15_t) y)) +
group-onsemi 0:098463de4c5d 1035 ((q15_t) x * (q15_t) (y >> 16));
group-onsemi 0:098463de4c5d 1036 }
group-onsemi 0:098463de4c5d 1037
group-onsemi 0:098463de4c5d 1038 /*
group-onsemi 0:098463de4c5d 1039 * @brief C custom defined SMUAD for M3 and M0 processors
group-onsemi 0:098463de4c5d 1040 */
group-onsemi 0:098463de4c5d 1041 static __INLINE q31_t __SMUAD(
group-onsemi 0:098463de4c5d 1042 q31_t x,
group-onsemi 0:098463de4c5d 1043 q31_t y)
group-onsemi 0:098463de4c5d 1044 {
group-onsemi 0:098463de4c5d 1045
group-onsemi 0:098463de4c5d 1046 return (((x >> 16) * (y >> 16)) +
group-onsemi 0:098463de4c5d 1047 (((x << 16) >> 16) * ((y << 16) >> 16)));
group-onsemi 0:098463de4c5d 1048 }
group-onsemi 0:098463de4c5d 1049
group-onsemi 0:098463de4c5d 1050 /*
group-onsemi 0:098463de4c5d 1051 * @brief C custom defined SMUSD for M3 and M0 processors
group-onsemi 0:098463de4c5d 1052 */
group-onsemi 0:098463de4c5d 1053 static __INLINE q31_t __SMUSD(
group-onsemi 0:098463de4c5d 1054 q31_t x,
group-onsemi 0:098463de4c5d 1055 q31_t y)
group-onsemi 0:098463de4c5d 1056 {
group-onsemi 0:098463de4c5d 1057
group-onsemi 0:098463de4c5d 1058 return (-((x >> 16) * (y >> 16)) +
group-onsemi 0:098463de4c5d 1059 (((x << 16) >> 16) * ((y << 16) >> 16)));
group-onsemi 0:098463de4c5d 1060 }
group-onsemi 0:098463de4c5d 1061
group-onsemi 0:098463de4c5d 1062
group-onsemi 0:098463de4c5d 1063 /*
group-onsemi 0:098463de4c5d 1064 * @brief C custom defined SXTB16 for M3 and M0 processors
group-onsemi 0:098463de4c5d 1065 */
group-onsemi 0:098463de4c5d 1066 static __INLINE q31_t __SXTB16(
group-onsemi 0:098463de4c5d 1067 q31_t x)
group-onsemi 0:098463de4c5d 1068 {
group-onsemi 0:098463de4c5d 1069
group-onsemi 0:098463de4c5d 1070 return ((((x << 24) >> 24) & 0x0000FFFF) |
group-onsemi 0:098463de4c5d 1071 (((x << 8) >> 8) & 0xFFFF0000));
group-onsemi 0:098463de4c5d 1072 }
group-onsemi 0:098463de4c5d 1073
group-onsemi 0:098463de4c5d 1074
group-onsemi 0:098463de4c5d 1075 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
group-onsemi 0:098463de4c5d 1076
group-onsemi 0:098463de4c5d 1077
group-onsemi 0:098463de4c5d 1078 /**
group-onsemi 0:098463de4c5d 1079 * @brief Instance structure for the Q7 FIR filter.
group-onsemi 0:098463de4c5d 1080 */
group-onsemi 0:098463de4c5d 1081 typedef struct
group-onsemi 0:098463de4c5d 1082 {
group-onsemi 0:098463de4c5d 1083 uint16_t numTaps; /**< number of filter coefficients in the filter. */
group-onsemi 0:098463de4c5d 1084 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 1085 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 1086 } arm_fir_instance_q7;
group-onsemi 0:098463de4c5d 1087
group-onsemi 0:098463de4c5d 1088 /**
group-onsemi 0:098463de4c5d 1089 * @brief Instance structure for the Q15 FIR filter.
group-onsemi 0:098463de4c5d 1090 */
group-onsemi 0:098463de4c5d 1091 typedef struct
group-onsemi 0:098463de4c5d 1092 {
group-onsemi 0:098463de4c5d 1093 uint16_t numTaps; /**< number of filter coefficients in the filter. */
group-onsemi 0:098463de4c5d 1094 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 1095 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 1096 } arm_fir_instance_q15;
group-onsemi 0:098463de4c5d 1097
group-onsemi 0:098463de4c5d 1098 /**
group-onsemi 0:098463de4c5d 1099 * @brief Instance structure for the Q31 FIR filter.
group-onsemi 0:098463de4c5d 1100 */
group-onsemi 0:098463de4c5d 1101 typedef struct
group-onsemi 0:098463de4c5d 1102 {
group-onsemi 0:098463de4c5d 1103 uint16_t numTaps; /**< number of filter coefficients in the filter. */
group-onsemi 0:098463de4c5d 1104 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 1105 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 1106 } arm_fir_instance_q31;
group-onsemi 0:098463de4c5d 1107
group-onsemi 0:098463de4c5d 1108 /**
group-onsemi 0:098463de4c5d 1109 * @brief Instance structure for the floating-point FIR filter.
group-onsemi 0:098463de4c5d 1110 */
group-onsemi 0:098463de4c5d 1111 typedef struct
group-onsemi 0:098463de4c5d 1112 {
group-onsemi 0:098463de4c5d 1113 uint16_t numTaps; /**< number of filter coefficients in the filter. */
group-onsemi 0:098463de4c5d 1114 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 1115 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 1116 } arm_fir_instance_f32;
group-onsemi 0:098463de4c5d 1117
group-onsemi 0:098463de4c5d 1118
group-onsemi 0:098463de4c5d 1119 /**
group-onsemi 0:098463de4c5d 1120 * @brief Processing function for the Q7 FIR filter.
group-onsemi 0:098463de4c5d 1121 * @param[in] *S points to an instance of the Q7 FIR filter structure.
group-onsemi 0:098463de4c5d 1122 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1123 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1124 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1125 * @return none.
group-onsemi 0:098463de4c5d 1126 */
group-onsemi 0:098463de4c5d 1127 void arm_fir_q7(
group-onsemi 0:098463de4c5d 1128 const arm_fir_instance_q7 * S,
group-onsemi 0:098463de4c5d 1129 q7_t * pSrc,
group-onsemi 0:098463de4c5d 1130 q7_t * pDst,
group-onsemi 0:098463de4c5d 1131 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1132
group-onsemi 0:098463de4c5d 1133
group-onsemi 0:098463de4c5d 1134 /**
group-onsemi 0:098463de4c5d 1135 * @brief Initialization function for the Q7 FIR filter.
group-onsemi 0:098463de4c5d 1136 * @param[in,out] *S points to an instance of the Q7 FIR structure.
group-onsemi 0:098463de4c5d 1137 * @param[in] numTaps Number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 1138 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1139 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1140 * @param[in] blockSize number of samples that are processed.
group-onsemi 0:098463de4c5d 1141 * @return none
group-onsemi 0:098463de4c5d 1142 */
group-onsemi 0:098463de4c5d 1143 void arm_fir_init_q7(
group-onsemi 0:098463de4c5d 1144 arm_fir_instance_q7 * S,
group-onsemi 0:098463de4c5d 1145 uint16_t numTaps,
group-onsemi 0:098463de4c5d 1146 q7_t * pCoeffs,
group-onsemi 0:098463de4c5d 1147 q7_t * pState,
group-onsemi 0:098463de4c5d 1148 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1149
group-onsemi 0:098463de4c5d 1150
group-onsemi 0:098463de4c5d 1151 /**
group-onsemi 0:098463de4c5d 1152 * @brief Processing function for the Q15 FIR filter.
group-onsemi 0:098463de4c5d 1153 * @param[in] *S points to an instance of the Q15 FIR structure.
group-onsemi 0:098463de4c5d 1154 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1155 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1156 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1157 * @return none.
group-onsemi 0:098463de4c5d 1158 */
group-onsemi 0:098463de4c5d 1159 void arm_fir_q15(
group-onsemi 0:098463de4c5d 1160 const arm_fir_instance_q15 * S,
group-onsemi 0:098463de4c5d 1161 q15_t * pSrc,
group-onsemi 0:098463de4c5d 1162 q15_t * pDst,
group-onsemi 0:098463de4c5d 1163 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1164
group-onsemi 0:098463de4c5d 1165 /**
group-onsemi 0:098463de4c5d 1166 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 1167 * @param[in] *S points to an instance of the Q15 FIR filter structure.
group-onsemi 0:098463de4c5d 1168 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1169 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1170 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1171 * @return none.
group-onsemi 0:098463de4c5d 1172 */
group-onsemi 0:098463de4c5d 1173 void arm_fir_fast_q15(
group-onsemi 0:098463de4c5d 1174 const arm_fir_instance_q15 * S,
group-onsemi 0:098463de4c5d 1175 q15_t * pSrc,
group-onsemi 0:098463de4c5d 1176 q15_t * pDst,
group-onsemi 0:098463de4c5d 1177 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1178
group-onsemi 0:098463de4c5d 1179 /**
group-onsemi 0:098463de4c5d 1180 * @brief Initialization function for the Q15 FIR filter.
group-onsemi 0:098463de4c5d 1181 * @param[in,out] *S points to an instance of the Q15 FIR filter structure.
group-onsemi 0:098463de4c5d 1182 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
group-onsemi 0:098463de4c5d 1183 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1184 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1185 * @param[in] blockSize number of samples that are processed at a time.
group-onsemi 0:098463de4c5d 1186 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
group-onsemi 0:098463de4c5d 1187 * <code>numTaps</code> is not a supported value.
group-onsemi 0:098463de4c5d 1188 */
group-onsemi 0:098463de4c5d 1189
group-onsemi 0:098463de4c5d 1190 arm_status arm_fir_init_q15(
group-onsemi 0:098463de4c5d 1191 arm_fir_instance_q15 * S,
group-onsemi 0:098463de4c5d 1192 uint16_t numTaps,
group-onsemi 0:098463de4c5d 1193 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 1194 q15_t * pState,
group-onsemi 0:098463de4c5d 1195 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1196
group-onsemi 0:098463de4c5d 1197 /**
group-onsemi 0:098463de4c5d 1198 * @brief Processing function for the Q31 FIR filter.
group-onsemi 0:098463de4c5d 1199 * @param[in] *S points to an instance of the Q31 FIR filter structure.
group-onsemi 0:098463de4c5d 1200 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1201 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1202 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1203 * @return none.
group-onsemi 0:098463de4c5d 1204 */
group-onsemi 0:098463de4c5d 1205 void arm_fir_q31(
group-onsemi 0:098463de4c5d 1206 const arm_fir_instance_q31 * S,
group-onsemi 0:098463de4c5d 1207 q31_t * pSrc,
group-onsemi 0:098463de4c5d 1208 q31_t * pDst,
group-onsemi 0:098463de4c5d 1209 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1210
group-onsemi 0:098463de4c5d 1211 /**
group-onsemi 0:098463de4c5d 1212 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 1213 * @param[in] *S points to an instance of the Q31 FIR structure.
group-onsemi 0:098463de4c5d 1214 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1215 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1216 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1217 * @return none.
group-onsemi 0:098463de4c5d 1218 */
group-onsemi 0:098463de4c5d 1219 void arm_fir_fast_q31(
group-onsemi 0:098463de4c5d 1220 const arm_fir_instance_q31 * S,
group-onsemi 0:098463de4c5d 1221 q31_t * pSrc,
group-onsemi 0:098463de4c5d 1222 q31_t * pDst,
group-onsemi 0:098463de4c5d 1223 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1224
group-onsemi 0:098463de4c5d 1225 /**
group-onsemi 0:098463de4c5d 1226 * @brief Initialization function for the Q31 FIR filter.
group-onsemi 0:098463de4c5d 1227 * @param[in,out] *S points to an instance of the Q31 FIR structure.
group-onsemi 0:098463de4c5d 1228 * @param[in] numTaps Number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 1229 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1230 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1231 * @param[in] blockSize number of samples that are processed at a time.
group-onsemi 0:098463de4c5d 1232 * @return none.
group-onsemi 0:098463de4c5d 1233 */
group-onsemi 0:098463de4c5d 1234 void arm_fir_init_q31(
group-onsemi 0:098463de4c5d 1235 arm_fir_instance_q31 * S,
group-onsemi 0:098463de4c5d 1236 uint16_t numTaps,
group-onsemi 0:098463de4c5d 1237 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 1238 q31_t * pState,
group-onsemi 0:098463de4c5d 1239 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1240
group-onsemi 0:098463de4c5d 1241 /**
group-onsemi 0:098463de4c5d 1242 * @brief Processing function for the floating-point FIR filter.
group-onsemi 0:098463de4c5d 1243 * @param[in] *S points to an instance of the floating-point FIR structure.
group-onsemi 0:098463de4c5d 1244 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1245 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1246 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1247 * @return none.
group-onsemi 0:098463de4c5d 1248 */
group-onsemi 0:098463de4c5d 1249 void arm_fir_f32(
group-onsemi 0:098463de4c5d 1250 const arm_fir_instance_f32 * S,
group-onsemi 0:098463de4c5d 1251 float32_t * pSrc,
group-onsemi 0:098463de4c5d 1252 float32_t * pDst,
group-onsemi 0:098463de4c5d 1253 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1254
group-onsemi 0:098463de4c5d 1255 /**
group-onsemi 0:098463de4c5d 1256 * @brief Initialization function for the floating-point FIR filter.
group-onsemi 0:098463de4c5d 1257 * @param[in,out] *S points to an instance of the floating-point FIR filter structure.
group-onsemi 0:098463de4c5d 1258 * @param[in] numTaps Number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 1259 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1260 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1261 * @param[in] blockSize number of samples that are processed at a time.
group-onsemi 0:098463de4c5d 1262 * @return none.
group-onsemi 0:098463de4c5d 1263 */
group-onsemi 0:098463de4c5d 1264 void arm_fir_init_f32(
group-onsemi 0:098463de4c5d 1265 arm_fir_instance_f32 * S,
group-onsemi 0:098463de4c5d 1266 uint16_t numTaps,
group-onsemi 0:098463de4c5d 1267 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 1268 float32_t * pState,
group-onsemi 0:098463de4c5d 1269 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1270
group-onsemi 0:098463de4c5d 1271
group-onsemi 0:098463de4c5d 1272 /**
group-onsemi 0:098463de4c5d 1273 * @brief Instance structure for the Q15 Biquad cascade filter.
group-onsemi 0:098463de4c5d 1274 */
group-onsemi 0:098463de4c5d 1275 typedef struct
group-onsemi 0:098463de4c5d 1276 {
group-onsemi 0:098463de4c5d 1277 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 1278 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
group-onsemi 0:098463de4c5d 1279 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 1280 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
group-onsemi 0:098463de4c5d 1281
group-onsemi 0:098463de4c5d 1282 } arm_biquad_casd_df1_inst_q15;
group-onsemi 0:098463de4c5d 1283
group-onsemi 0:098463de4c5d 1284
group-onsemi 0:098463de4c5d 1285 /**
group-onsemi 0:098463de4c5d 1286 * @brief Instance structure for the Q31 Biquad cascade filter.
group-onsemi 0:098463de4c5d 1287 */
group-onsemi 0:098463de4c5d 1288 typedef struct
group-onsemi 0:098463de4c5d 1289 {
group-onsemi 0:098463de4c5d 1290 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 1291 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
group-onsemi 0:098463de4c5d 1292 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 1293 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
group-onsemi 0:098463de4c5d 1294
group-onsemi 0:098463de4c5d 1295 } arm_biquad_casd_df1_inst_q31;
group-onsemi 0:098463de4c5d 1296
group-onsemi 0:098463de4c5d 1297 /**
group-onsemi 0:098463de4c5d 1298 * @brief Instance structure for the floating-point Biquad cascade filter.
group-onsemi 0:098463de4c5d 1299 */
group-onsemi 0:098463de4c5d 1300 typedef struct
group-onsemi 0:098463de4c5d 1301 {
group-onsemi 0:098463de4c5d 1302 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 1303 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
group-onsemi 0:098463de4c5d 1304 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 1305
group-onsemi 0:098463de4c5d 1306
group-onsemi 0:098463de4c5d 1307 } arm_biquad_casd_df1_inst_f32;
group-onsemi 0:098463de4c5d 1308
group-onsemi 0:098463de4c5d 1309
group-onsemi 0:098463de4c5d 1310
group-onsemi 0:098463de4c5d 1311 /**
group-onsemi 0:098463de4c5d 1312 * @brief Processing function for the Q15 Biquad cascade filter.
group-onsemi 0:098463de4c5d 1313 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1314 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1315 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1316 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1317 * @return none.
group-onsemi 0:098463de4c5d 1318 */
group-onsemi 0:098463de4c5d 1319
group-onsemi 0:098463de4c5d 1320 void arm_biquad_cascade_df1_q15(
group-onsemi 0:098463de4c5d 1321 const arm_biquad_casd_df1_inst_q15 * S,
group-onsemi 0:098463de4c5d 1322 q15_t * pSrc,
group-onsemi 0:098463de4c5d 1323 q15_t * pDst,
group-onsemi 0:098463de4c5d 1324 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1325
group-onsemi 0:098463de4c5d 1326 /**
group-onsemi 0:098463de4c5d 1327 * @brief Initialization function for the Q15 Biquad cascade filter.
group-onsemi 0:098463de4c5d 1328 * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1329 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 1330 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1331 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1332 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
group-onsemi 0:098463de4c5d 1333 * @return none
group-onsemi 0:098463de4c5d 1334 */
group-onsemi 0:098463de4c5d 1335
group-onsemi 0:098463de4c5d 1336 void arm_biquad_cascade_df1_init_q15(
group-onsemi 0:098463de4c5d 1337 arm_biquad_casd_df1_inst_q15 * S,
group-onsemi 0:098463de4c5d 1338 uint8_t numStages,
group-onsemi 0:098463de4c5d 1339 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 1340 q15_t * pState,
group-onsemi 0:098463de4c5d 1341 int8_t postShift);
group-onsemi 0:098463de4c5d 1342
group-onsemi 0:098463de4c5d 1343
group-onsemi 0:098463de4c5d 1344 /**
group-onsemi 0:098463de4c5d 1345 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 1346 * @param[in] *S points to an instance of the Q15 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1347 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1348 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1349 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1350 * @return none.
group-onsemi 0:098463de4c5d 1351 */
group-onsemi 0:098463de4c5d 1352
group-onsemi 0:098463de4c5d 1353 void arm_biquad_cascade_df1_fast_q15(
group-onsemi 0:098463de4c5d 1354 const arm_biquad_casd_df1_inst_q15 * S,
group-onsemi 0:098463de4c5d 1355 q15_t * pSrc,
group-onsemi 0:098463de4c5d 1356 q15_t * pDst,
group-onsemi 0:098463de4c5d 1357 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1358
group-onsemi 0:098463de4c5d 1359
group-onsemi 0:098463de4c5d 1360 /**
group-onsemi 0:098463de4c5d 1361 * @brief Processing function for the Q31 Biquad cascade filter
group-onsemi 0:098463de4c5d 1362 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1363 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1364 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1365 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1366 * @return none.
group-onsemi 0:098463de4c5d 1367 */
group-onsemi 0:098463de4c5d 1368
group-onsemi 0:098463de4c5d 1369 void arm_biquad_cascade_df1_q31(
group-onsemi 0:098463de4c5d 1370 const arm_biquad_casd_df1_inst_q31 * S,
group-onsemi 0:098463de4c5d 1371 q31_t * pSrc,
group-onsemi 0:098463de4c5d 1372 q31_t * pDst,
group-onsemi 0:098463de4c5d 1373 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1374
group-onsemi 0:098463de4c5d 1375 /**
group-onsemi 0:098463de4c5d 1376 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 1377 * @param[in] *S points to an instance of the Q31 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1378 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1379 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1380 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1381 * @return none.
group-onsemi 0:098463de4c5d 1382 */
group-onsemi 0:098463de4c5d 1383
group-onsemi 0:098463de4c5d 1384 void arm_biquad_cascade_df1_fast_q31(
group-onsemi 0:098463de4c5d 1385 const arm_biquad_casd_df1_inst_q31 * S,
group-onsemi 0:098463de4c5d 1386 q31_t * pSrc,
group-onsemi 0:098463de4c5d 1387 q31_t * pDst,
group-onsemi 0:098463de4c5d 1388 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1389
group-onsemi 0:098463de4c5d 1390 /**
group-onsemi 0:098463de4c5d 1391 * @brief Initialization function for the Q31 Biquad cascade filter.
group-onsemi 0:098463de4c5d 1392 * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure.
group-onsemi 0:098463de4c5d 1393 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 1394 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1395 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1396 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
group-onsemi 0:098463de4c5d 1397 * @return none
group-onsemi 0:098463de4c5d 1398 */
group-onsemi 0:098463de4c5d 1399
group-onsemi 0:098463de4c5d 1400 void arm_biquad_cascade_df1_init_q31(
group-onsemi 0:098463de4c5d 1401 arm_biquad_casd_df1_inst_q31 * S,
group-onsemi 0:098463de4c5d 1402 uint8_t numStages,
group-onsemi 0:098463de4c5d 1403 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 1404 q31_t * pState,
group-onsemi 0:098463de4c5d 1405 int8_t postShift);
group-onsemi 0:098463de4c5d 1406
group-onsemi 0:098463de4c5d 1407 /**
group-onsemi 0:098463de4c5d 1408 * @brief Processing function for the floating-point Biquad cascade filter.
group-onsemi 0:098463de4c5d 1409 * @param[in] *S points to an instance of the floating-point Biquad cascade structure.
group-onsemi 0:098463de4c5d 1410 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 1411 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 1412 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 1413 * @return none.
group-onsemi 0:098463de4c5d 1414 */
group-onsemi 0:098463de4c5d 1415
group-onsemi 0:098463de4c5d 1416 void arm_biquad_cascade_df1_f32(
group-onsemi 0:098463de4c5d 1417 const arm_biquad_casd_df1_inst_f32 * S,
group-onsemi 0:098463de4c5d 1418 float32_t * pSrc,
group-onsemi 0:098463de4c5d 1419 float32_t * pDst,
group-onsemi 0:098463de4c5d 1420 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1421
group-onsemi 0:098463de4c5d 1422 /**
group-onsemi 0:098463de4c5d 1423 * @brief Initialization function for the floating-point Biquad cascade filter.
group-onsemi 0:098463de4c5d 1424 * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure.
group-onsemi 0:098463de4c5d 1425 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 1426 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 1427 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 1428 * @return none
group-onsemi 0:098463de4c5d 1429 */
group-onsemi 0:098463de4c5d 1430
group-onsemi 0:098463de4c5d 1431 void arm_biquad_cascade_df1_init_f32(
group-onsemi 0:098463de4c5d 1432 arm_biquad_casd_df1_inst_f32 * S,
group-onsemi 0:098463de4c5d 1433 uint8_t numStages,
group-onsemi 0:098463de4c5d 1434 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 1435 float32_t * pState);
group-onsemi 0:098463de4c5d 1436
group-onsemi 0:098463de4c5d 1437
group-onsemi 0:098463de4c5d 1438 /**
group-onsemi 0:098463de4c5d 1439 * @brief Instance structure for the floating-point matrix structure.
group-onsemi 0:098463de4c5d 1440 */
group-onsemi 0:098463de4c5d 1441
group-onsemi 0:098463de4c5d 1442 typedef struct
group-onsemi 0:098463de4c5d 1443 {
group-onsemi 0:098463de4c5d 1444 uint16_t numRows; /**< number of rows of the matrix. */
group-onsemi 0:098463de4c5d 1445 uint16_t numCols; /**< number of columns of the matrix. */
group-onsemi 0:098463de4c5d 1446 float32_t *pData; /**< points to the data of the matrix. */
group-onsemi 0:098463de4c5d 1447 } arm_matrix_instance_f32;
group-onsemi 0:098463de4c5d 1448
group-onsemi 0:098463de4c5d 1449
group-onsemi 0:098463de4c5d 1450 /**
group-onsemi 0:098463de4c5d 1451 * @brief Instance structure for the floating-point matrix structure.
group-onsemi 0:098463de4c5d 1452 */
group-onsemi 0:098463de4c5d 1453
group-onsemi 0:098463de4c5d 1454 typedef struct
group-onsemi 0:098463de4c5d 1455 {
group-onsemi 0:098463de4c5d 1456 uint16_t numRows; /**< number of rows of the matrix. */
group-onsemi 0:098463de4c5d 1457 uint16_t numCols; /**< number of columns of the matrix. */
group-onsemi 0:098463de4c5d 1458 float64_t *pData; /**< points to the data of the matrix. */
group-onsemi 0:098463de4c5d 1459 } arm_matrix_instance_f64;
group-onsemi 0:098463de4c5d 1460
group-onsemi 0:098463de4c5d 1461 /**
group-onsemi 0:098463de4c5d 1462 * @brief Instance structure for the Q15 matrix structure.
group-onsemi 0:098463de4c5d 1463 */
group-onsemi 0:098463de4c5d 1464
group-onsemi 0:098463de4c5d 1465 typedef struct
group-onsemi 0:098463de4c5d 1466 {
group-onsemi 0:098463de4c5d 1467 uint16_t numRows; /**< number of rows of the matrix. */
group-onsemi 0:098463de4c5d 1468 uint16_t numCols; /**< number of columns of the matrix. */
group-onsemi 0:098463de4c5d 1469 q15_t *pData; /**< points to the data of the matrix. */
group-onsemi 0:098463de4c5d 1470
group-onsemi 0:098463de4c5d 1471 } arm_matrix_instance_q15;
group-onsemi 0:098463de4c5d 1472
group-onsemi 0:098463de4c5d 1473 /**
group-onsemi 0:098463de4c5d 1474 * @brief Instance structure for the Q31 matrix structure.
group-onsemi 0:098463de4c5d 1475 */
group-onsemi 0:098463de4c5d 1476
group-onsemi 0:098463de4c5d 1477 typedef struct
group-onsemi 0:098463de4c5d 1478 {
group-onsemi 0:098463de4c5d 1479 uint16_t numRows; /**< number of rows of the matrix. */
group-onsemi 0:098463de4c5d 1480 uint16_t numCols; /**< number of columns of the matrix. */
group-onsemi 0:098463de4c5d 1481 q31_t *pData; /**< points to the data of the matrix. */
group-onsemi 0:098463de4c5d 1482
group-onsemi 0:098463de4c5d 1483 } arm_matrix_instance_q31;
group-onsemi 0:098463de4c5d 1484
group-onsemi 0:098463de4c5d 1485
group-onsemi 0:098463de4c5d 1486
group-onsemi 0:098463de4c5d 1487 /**
group-onsemi 0:098463de4c5d 1488 * @brief Floating-point matrix addition.
group-onsemi 0:098463de4c5d 1489 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1490 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1491 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1492 * @return The function returns either
group-onsemi 0:098463de4c5d 1493 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1494 */
group-onsemi 0:098463de4c5d 1495
group-onsemi 0:098463de4c5d 1496 arm_status arm_mat_add_f32(
group-onsemi 0:098463de4c5d 1497 const arm_matrix_instance_f32 * pSrcA,
group-onsemi 0:098463de4c5d 1498 const arm_matrix_instance_f32 * pSrcB,
group-onsemi 0:098463de4c5d 1499 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1500
group-onsemi 0:098463de4c5d 1501 /**
group-onsemi 0:098463de4c5d 1502 * @brief Q15 matrix addition.
group-onsemi 0:098463de4c5d 1503 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1504 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1505 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1506 * @return The function returns either
group-onsemi 0:098463de4c5d 1507 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1508 */
group-onsemi 0:098463de4c5d 1509
group-onsemi 0:098463de4c5d 1510 arm_status arm_mat_add_q15(
group-onsemi 0:098463de4c5d 1511 const arm_matrix_instance_q15 * pSrcA,
group-onsemi 0:098463de4c5d 1512 const arm_matrix_instance_q15 * pSrcB,
group-onsemi 0:098463de4c5d 1513 arm_matrix_instance_q15 * pDst);
group-onsemi 0:098463de4c5d 1514
group-onsemi 0:098463de4c5d 1515 /**
group-onsemi 0:098463de4c5d 1516 * @brief Q31 matrix addition.
group-onsemi 0:098463de4c5d 1517 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1518 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1519 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1520 * @return The function returns either
group-onsemi 0:098463de4c5d 1521 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1522 */
group-onsemi 0:098463de4c5d 1523
group-onsemi 0:098463de4c5d 1524 arm_status arm_mat_add_q31(
group-onsemi 0:098463de4c5d 1525 const arm_matrix_instance_q31 * pSrcA,
group-onsemi 0:098463de4c5d 1526 const arm_matrix_instance_q31 * pSrcB,
group-onsemi 0:098463de4c5d 1527 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1528
group-onsemi 0:098463de4c5d 1529 /**
group-onsemi 0:098463de4c5d 1530 * @brief Floating-point, complex, matrix multiplication.
group-onsemi 0:098463de4c5d 1531 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1532 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1533 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1534 * @return The function returns either
group-onsemi 0:098463de4c5d 1535 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1536 */
group-onsemi 0:098463de4c5d 1537
group-onsemi 0:098463de4c5d 1538 arm_status arm_mat_cmplx_mult_f32(
group-onsemi 0:098463de4c5d 1539 const arm_matrix_instance_f32 * pSrcA,
group-onsemi 0:098463de4c5d 1540 const arm_matrix_instance_f32 * pSrcB,
group-onsemi 0:098463de4c5d 1541 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1542
group-onsemi 0:098463de4c5d 1543 /**
group-onsemi 0:098463de4c5d 1544 * @brief Q15, complex, matrix multiplication.
group-onsemi 0:098463de4c5d 1545 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1546 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1547 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1548 * @return The function returns either
group-onsemi 0:098463de4c5d 1549 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1550 */
group-onsemi 0:098463de4c5d 1551
group-onsemi 0:098463de4c5d 1552 arm_status arm_mat_cmplx_mult_q15(
group-onsemi 0:098463de4c5d 1553 const arm_matrix_instance_q15 * pSrcA,
group-onsemi 0:098463de4c5d 1554 const arm_matrix_instance_q15 * pSrcB,
group-onsemi 0:098463de4c5d 1555 arm_matrix_instance_q15 * pDst,
group-onsemi 0:098463de4c5d 1556 q15_t * pScratch);
group-onsemi 0:098463de4c5d 1557
group-onsemi 0:098463de4c5d 1558 /**
group-onsemi 0:098463de4c5d 1559 * @brief Q31, complex, matrix multiplication.
group-onsemi 0:098463de4c5d 1560 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1561 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1562 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1563 * @return The function returns either
group-onsemi 0:098463de4c5d 1564 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1565 */
group-onsemi 0:098463de4c5d 1566
group-onsemi 0:098463de4c5d 1567 arm_status arm_mat_cmplx_mult_q31(
group-onsemi 0:098463de4c5d 1568 const arm_matrix_instance_q31 * pSrcA,
group-onsemi 0:098463de4c5d 1569 const arm_matrix_instance_q31 * pSrcB,
group-onsemi 0:098463de4c5d 1570 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1571
group-onsemi 0:098463de4c5d 1572
group-onsemi 0:098463de4c5d 1573 /**
group-onsemi 0:098463de4c5d 1574 * @brief Floating-point matrix transpose.
group-onsemi 0:098463de4c5d 1575 * @param[in] *pSrc points to the input matrix
group-onsemi 0:098463de4c5d 1576 * @param[out] *pDst points to the output matrix
group-onsemi 0:098463de4c5d 1577 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
group-onsemi 0:098463de4c5d 1578 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1579 */
group-onsemi 0:098463de4c5d 1580
group-onsemi 0:098463de4c5d 1581 arm_status arm_mat_trans_f32(
group-onsemi 0:098463de4c5d 1582 const arm_matrix_instance_f32 * pSrc,
group-onsemi 0:098463de4c5d 1583 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1584
group-onsemi 0:098463de4c5d 1585
group-onsemi 0:098463de4c5d 1586 /**
group-onsemi 0:098463de4c5d 1587 * @brief Q15 matrix transpose.
group-onsemi 0:098463de4c5d 1588 * @param[in] *pSrc points to the input matrix
group-onsemi 0:098463de4c5d 1589 * @param[out] *pDst points to the output matrix
group-onsemi 0:098463de4c5d 1590 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
group-onsemi 0:098463de4c5d 1591 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1592 */
group-onsemi 0:098463de4c5d 1593
group-onsemi 0:098463de4c5d 1594 arm_status arm_mat_trans_q15(
group-onsemi 0:098463de4c5d 1595 const arm_matrix_instance_q15 * pSrc,
group-onsemi 0:098463de4c5d 1596 arm_matrix_instance_q15 * pDst);
group-onsemi 0:098463de4c5d 1597
group-onsemi 0:098463de4c5d 1598 /**
group-onsemi 0:098463de4c5d 1599 * @brief Q31 matrix transpose.
group-onsemi 0:098463de4c5d 1600 * @param[in] *pSrc points to the input matrix
group-onsemi 0:098463de4c5d 1601 * @param[out] *pDst points to the output matrix
group-onsemi 0:098463de4c5d 1602 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
group-onsemi 0:098463de4c5d 1603 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1604 */
group-onsemi 0:098463de4c5d 1605
group-onsemi 0:098463de4c5d 1606 arm_status arm_mat_trans_q31(
group-onsemi 0:098463de4c5d 1607 const arm_matrix_instance_q31 * pSrc,
group-onsemi 0:098463de4c5d 1608 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1609
group-onsemi 0:098463de4c5d 1610
group-onsemi 0:098463de4c5d 1611 /**
group-onsemi 0:098463de4c5d 1612 * @brief Floating-point matrix multiplication
group-onsemi 0:098463de4c5d 1613 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1614 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1615 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1616 * @return The function returns either
group-onsemi 0:098463de4c5d 1617 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1618 */
group-onsemi 0:098463de4c5d 1619
group-onsemi 0:098463de4c5d 1620 arm_status arm_mat_mult_f32(
group-onsemi 0:098463de4c5d 1621 const arm_matrix_instance_f32 * pSrcA,
group-onsemi 0:098463de4c5d 1622 const arm_matrix_instance_f32 * pSrcB,
group-onsemi 0:098463de4c5d 1623 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1624
group-onsemi 0:098463de4c5d 1625 /**
group-onsemi 0:098463de4c5d 1626 * @brief Q15 matrix multiplication
group-onsemi 0:098463de4c5d 1627 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1628 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1629 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1630 * @param[in] *pState points to the array for storing intermediate results
group-onsemi 0:098463de4c5d 1631 * @return The function returns either
group-onsemi 0:098463de4c5d 1632 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1633 */
group-onsemi 0:098463de4c5d 1634
group-onsemi 0:098463de4c5d 1635 arm_status arm_mat_mult_q15(
group-onsemi 0:098463de4c5d 1636 const arm_matrix_instance_q15 * pSrcA,
group-onsemi 0:098463de4c5d 1637 const arm_matrix_instance_q15 * pSrcB,
group-onsemi 0:098463de4c5d 1638 arm_matrix_instance_q15 * pDst,
group-onsemi 0:098463de4c5d 1639 q15_t * pState);
group-onsemi 0:098463de4c5d 1640
group-onsemi 0:098463de4c5d 1641 /**
group-onsemi 0:098463de4c5d 1642 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 1643 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1644 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1645 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1646 * @param[in] *pState points to the array for storing intermediate results
group-onsemi 0:098463de4c5d 1647 * @return The function returns either
group-onsemi 0:098463de4c5d 1648 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1649 */
group-onsemi 0:098463de4c5d 1650
group-onsemi 0:098463de4c5d 1651 arm_status arm_mat_mult_fast_q15(
group-onsemi 0:098463de4c5d 1652 const arm_matrix_instance_q15 * pSrcA,
group-onsemi 0:098463de4c5d 1653 const arm_matrix_instance_q15 * pSrcB,
group-onsemi 0:098463de4c5d 1654 arm_matrix_instance_q15 * pDst,
group-onsemi 0:098463de4c5d 1655 q15_t * pState);
group-onsemi 0:098463de4c5d 1656
group-onsemi 0:098463de4c5d 1657 /**
group-onsemi 0:098463de4c5d 1658 * @brief Q31 matrix multiplication
group-onsemi 0:098463de4c5d 1659 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1660 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1661 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1662 * @return The function returns either
group-onsemi 0:098463de4c5d 1663 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1664 */
group-onsemi 0:098463de4c5d 1665
group-onsemi 0:098463de4c5d 1666 arm_status arm_mat_mult_q31(
group-onsemi 0:098463de4c5d 1667 const arm_matrix_instance_q31 * pSrcA,
group-onsemi 0:098463de4c5d 1668 const arm_matrix_instance_q31 * pSrcB,
group-onsemi 0:098463de4c5d 1669 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1670
group-onsemi 0:098463de4c5d 1671 /**
group-onsemi 0:098463de4c5d 1672 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 1673 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1674 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1675 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1676 * @return The function returns either
group-onsemi 0:098463de4c5d 1677 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1678 */
group-onsemi 0:098463de4c5d 1679
group-onsemi 0:098463de4c5d 1680 arm_status arm_mat_mult_fast_q31(
group-onsemi 0:098463de4c5d 1681 const arm_matrix_instance_q31 * pSrcA,
group-onsemi 0:098463de4c5d 1682 const arm_matrix_instance_q31 * pSrcB,
group-onsemi 0:098463de4c5d 1683 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1684
group-onsemi 0:098463de4c5d 1685
group-onsemi 0:098463de4c5d 1686 /**
group-onsemi 0:098463de4c5d 1687 * @brief Floating-point matrix subtraction
group-onsemi 0:098463de4c5d 1688 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1689 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1690 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1691 * @return The function returns either
group-onsemi 0:098463de4c5d 1692 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1693 */
group-onsemi 0:098463de4c5d 1694
group-onsemi 0:098463de4c5d 1695 arm_status arm_mat_sub_f32(
group-onsemi 0:098463de4c5d 1696 const arm_matrix_instance_f32 * pSrcA,
group-onsemi 0:098463de4c5d 1697 const arm_matrix_instance_f32 * pSrcB,
group-onsemi 0:098463de4c5d 1698 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1699
group-onsemi 0:098463de4c5d 1700 /**
group-onsemi 0:098463de4c5d 1701 * @brief Q15 matrix subtraction
group-onsemi 0:098463de4c5d 1702 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1703 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1704 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1705 * @return The function returns either
group-onsemi 0:098463de4c5d 1706 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1707 */
group-onsemi 0:098463de4c5d 1708
group-onsemi 0:098463de4c5d 1709 arm_status arm_mat_sub_q15(
group-onsemi 0:098463de4c5d 1710 const arm_matrix_instance_q15 * pSrcA,
group-onsemi 0:098463de4c5d 1711 const arm_matrix_instance_q15 * pSrcB,
group-onsemi 0:098463de4c5d 1712 arm_matrix_instance_q15 * pDst);
group-onsemi 0:098463de4c5d 1713
group-onsemi 0:098463de4c5d 1714 /**
group-onsemi 0:098463de4c5d 1715 * @brief Q31 matrix subtraction
group-onsemi 0:098463de4c5d 1716 * @param[in] *pSrcA points to the first input matrix structure
group-onsemi 0:098463de4c5d 1717 * @param[in] *pSrcB points to the second input matrix structure
group-onsemi 0:098463de4c5d 1718 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1719 * @return The function returns either
group-onsemi 0:098463de4c5d 1720 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1721 */
group-onsemi 0:098463de4c5d 1722
group-onsemi 0:098463de4c5d 1723 arm_status arm_mat_sub_q31(
group-onsemi 0:098463de4c5d 1724 const arm_matrix_instance_q31 * pSrcA,
group-onsemi 0:098463de4c5d 1725 const arm_matrix_instance_q31 * pSrcB,
group-onsemi 0:098463de4c5d 1726 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1727
group-onsemi 0:098463de4c5d 1728 /**
group-onsemi 0:098463de4c5d 1729 * @brief Floating-point matrix scaling.
group-onsemi 0:098463de4c5d 1730 * @param[in] *pSrc points to the input matrix
group-onsemi 0:098463de4c5d 1731 * @param[in] scale scale factor
group-onsemi 0:098463de4c5d 1732 * @param[out] *pDst points to the output matrix
group-onsemi 0:098463de4c5d 1733 * @return The function returns either
group-onsemi 0:098463de4c5d 1734 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1735 */
group-onsemi 0:098463de4c5d 1736
group-onsemi 0:098463de4c5d 1737 arm_status arm_mat_scale_f32(
group-onsemi 0:098463de4c5d 1738 const arm_matrix_instance_f32 * pSrc,
group-onsemi 0:098463de4c5d 1739 float32_t scale,
group-onsemi 0:098463de4c5d 1740 arm_matrix_instance_f32 * pDst);
group-onsemi 0:098463de4c5d 1741
group-onsemi 0:098463de4c5d 1742 /**
group-onsemi 0:098463de4c5d 1743 * @brief Q15 matrix scaling.
group-onsemi 0:098463de4c5d 1744 * @param[in] *pSrc points to input matrix
group-onsemi 0:098463de4c5d 1745 * @param[in] scaleFract fractional portion of the scale factor
group-onsemi 0:098463de4c5d 1746 * @param[in] shift number of bits to shift the result by
group-onsemi 0:098463de4c5d 1747 * @param[out] *pDst points to output matrix
group-onsemi 0:098463de4c5d 1748 * @return The function returns either
group-onsemi 0:098463de4c5d 1749 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1750 */
group-onsemi 0:098463de4c5d 1751
group-onsemi 0:098463de4c5d 1752 arm_status arm_mat_scale_q15(
group-onsemi 0:098463de4c5d 1753 const arm_matrix_instance_q15 * pSrc,
group-onsemi 0:098463de4c5d 1754 q15_t scaleFract,
group-onsemi 0:098463de4c5d 1755 int32_t shift,
group-onsemi 0:098463de4c5d 1756 arm_matrix_instance_q15 * pDst);
group-onsemi 0:098463de4c5d 1757
group-onsemi 0:098463de4c5d 1758 /**
group-onsemi 0:098463de4c5d 1759 * @brief Q31 matrix scaling.
group-onsemi 0:098463de4c5d 1760 * @param[in] *pSrc points to input matrix
group-onsemi 0:098463de4c5d 1761 * @param[in] scaleFract fractional portion of the scale factor
group-onsemi 0:098463de4c5d 1762 * @param[in] shift number of bits to shift the result by
group-onsemi 0:098463de4c5d 1763 * @param[out] *pDst points to output matrix structure
group-onsemi 0:098463de4c5d 1764 * @return The function returns either
group-onsemi 0:098463de4c5d 1765 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
group-onsemi 0:098463de4c5d 1766 */
group-onsemi 0:098463de4c5d 1767
group-onsemi 0:098463de4c5d 1768 arm_status arm_mat_scale_q31(
group-onsemi 0:098463de4c5d 1769 const arm_matrix_instance_q31 * pSrc,
group-onsemi 0:098463de4c5d 1770 q31_t scaleFract,
group-onsemi 0:098463de4c5d 1771 int32_t shift,
group-onsemi 0:098463de4c5d 1772 arm_matrix_instance_q31 * pDst);
group-onsemi 0:098463de4c5d 1773
group-onsemi 0:098463de4c5d 1774
group-onsemi 0:098463de4c5d 1775 /**
group-onsemi 0:098463de4c5d 1776 * @brief Q31 matrix initialization.
group-onsemi 0:098463de4c5d 1777 * @param[in,out] *S points to an instance of the floating-point matrix structure.
group-onsemi 0:098463de4c5d 1778 * @param[in] nRows number of rows in the matrix.
group-onsemi 0:098463de4c5d 1779 * @param[in] nColumns number of columns in the matrix.
group-onsemi 0:098463de4c5d 1780 * @param[in] *pData points to the matrix data array.
group-onsemi 0:098463de4c5d 1781 * @return none
group-onsemi 0:098463de4c5d 1782 */
group-onsemi 0:098463de4c5d 1783
group-onsemi 0:098463de4c5d 1784 void arm_mat_init_q31(
group-onsemi 0:098463de4c5d 1785 arm_matrix_instance_q31 * S,
group-onsemi 0:098463de4c5d 1786 uint16_t nRows,
group-onsemi 0:098463de4c5d 1787 uint16_t nColumns,
group-onsemi 0:098463de4c5d 1788 q31_t * pData);
group-onsemi 0:098463de4c5d 1789
group-onsemi 0:098463de4c5d 1790 /**
group-onsemi 0:098463de4c5d 1791 * @brief Q15 matrix initialization.
group-onsemi 0:098463de4c5d 1792 * @param[in,out] *S points to an instance of the floating-point matrix structure.
group-onsemi 0:098463de4c5d 1793 * @param[in] nRows number of rows in the matrix.
group-onsemi 0:098463de4c5d 1794 * @param[in] nColumns number of columns in the matrix.
group-onsemi 0:098463de4c5d 1795 * @param[in] *pData points to the matrix data array.
group-onsemi 0:098463de4c5d 1796 * @return none
group-onsemi 0:098463de4c5d 1797 */
group-onsemi 0:098463de4c5d 1798
group-onsemi 0:098463de4c5d 1799 void arm_mat_init_q15(
group-onsemi 0:098463de4c5d 1800 arm_matrix_instance_q15 * S,
group-onsemi 0:098463de4c5d 1801 uint16_t nRows,
group-onsemi 0:098463de4c5d 1802 uint16_t nColumns,
group-onsemi 0:098463de4c5d 1803 q15_t * pData);
group-onsemi 0:098463de4c5d 1804
group-onsemi 0:098463de4c5d 1805 /**
group-onsemi 0:098463de4c5d 1806 * @brief Floating-point matrix initialization.
group-onsemi 0:098463de4c5d 1807 * @param[in,out] *S points to an instance of the floating-point matrix structure.
group-onsemi 0:098463de4c5d 1808 * @param[in] nRows number of rows in the matrix.
group-onsemi 0:098463de4c5d 1809 * @param[in] nColumns number of columns in the matrix.
group-onsemi 0:098463de4c5d 1810 * @param[in] *pData points to the matrix data array.
group-onsemi 0:098463de4c5d 1811 * @return none
group-onsemi 0:098463de4c5d 1812 */
group-onsemi 0:098463de4c5d 1813
group-onsemi 0:098463de4c5d 1814 void arm_mat_init_f32(
group-onsemi 0:098463de4c5d 1815 arm_matrix_instance_f32 * S,
group-onsemi 0:098463de4c5d 1816 uint16_t nRows,
group-onsemi 0:098463de4c5d 1817 uint16_t nColumns,
group-onsemi 0:098463de4c5d 1818 float32_t * pData);
group-onsemi 0:098463de4c5d 1819
group-onsemi 0:098463de4c5d 1820
group-onsemi 0:098463de4c5d 1821
group-onsemi 0:098463de4c5d 1822 /**
group-onsemi 0:098463de4c5d 1823 * @brief Instance structure for the Q15 PID Control.
group-onsemi 0:098463de4c5d 1824 */
group-onsemi 0:098463de4c5d 1825 typedef struct
group-onsemi 0:098463de4c5d 1826 {
group-onsemi 0:098463de4c5d 1827 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
group-onsemi 0:098463de4c5d 1828 #ifdef ARM_MATH_CM0_FAMILY
group-onsemi 0:098463de4c5d 1829 q15_t A1;
group-onsemi 0:098463de4c5d 1830 q15_t A2;
group-onsemi 0:098463de4c5d 1831 #else
group-onsemi 0:098463de4c5d 1832 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
group-onsemi 0:098463de4c5d 1833 #endif
group-onsemi 0:098463de4c5d 1834 q15_t state[3]; /**< The state array of length 3. */
group-onsemi 0:098463de4c5d 1835 q15_t Kp; /**< The proportional gain. */
group-onsemi 0:098463de4c5d 1836 q15_t Ki; /**< The integral gain. */
group-onsemi 0:098463de4c5d 1837 q15_t Kd; /**< The derivative gain. */
group-onsemi 0:098463de4c5d 1838 } arm_pid_instance_q15;
group-onsemi 0:098463de4c5d 1839
group-onsemi 0:098463de4c5d 1840 /**
group-onsemi 0:098463de4c5d 1841 * @brief Instance structure for the Q31 PID Control.
group-onsemi 0:098463de4c5d 1842 */
group-onsemi 0:098463de4c5d 1843 typedef struct
group-onsemi 0:098463de4c5d 1844 {
group-onsemi 0:098463de4c5d 1845 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
group-onsemi 0:098463de4c5d 1846 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
group-onsemi 0:098463de4c5d 1847 q31_t A2; /**< The derived gain, A2 = Kd . */
group-onsemi 0:098463de4c5d 1848 q31_t state[3]; /**< The state array of length 3. */
group-onsemi 0:098463de4c5d 1849 q31_t Kp; /**< The proportional gain. */
group-onsemi 0:098463de4c5d 1850 q31_t Ki; /**< The integral gain. */
group-onsemi 0:098463de4c5d 1851 q31_t Kd; /**< The derivative gain. */
group-onsemi 0:098463de4c5d 1852
group-onsemi 0:098463de4c5d 1853 } arm_pid_instance_q31;
group-onsemi 0:098463de4c5d 1854
group-onsemi 0:098463de4c5d 1855 /**
group-onsemi 0:098463de4c5d 1856 * @brief Instance structure for the floating-point PID Control.
group-onsemi 0:098463de4c5d 1857 */
group-onsemi 0:098463de4c5d 1858 typedef struct
group-onsemi 0:098463de4c5d 1859 {
group-onsemi 0:098463de4c5d 1860 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
group-onsemi 0:098463de4c5d 1861 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
group-onsemi 0:098463de4c5d 1862 float32_t A2; /**< The derived gain, A2 = Kd . */
group-onsemi 0:098463de4c5d 1863 float32_t state[3]; /**< The state array of length 3. */
group-onsemi 0:098463de4c5d 1864 float32_t Kp; /**< The proportional gain. */
group-onsemi 0:098463de4c5d 1865 float32_t Ki; /**< The integral gain. */
group-onsemi 0:098463de4c5d 1866 float32_t Kd; /**< The derivative gain. */
group-onsemi 0:098463de4c5d 1867 } arm_pid_instance_f32;
group-onsemi 0:098463de4c5d 1868
group-onsemi 0:098463de4c5d 1869
group-onsemi 0:098463de4c5d 1870
group-onsemi 0:098463de4c5d 1871 /**
group-onsemi 0:098463de4c5d 1872 * @brief Initialization function for the floating-point PID Control.
group-onsemi 0:098463de4c5d 1873 * @param[in,out] *S points to an instance of the PID structure.
group-onsemi 0:098463de4c5d 1874 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
group-onsemi 0:098463de4c5d 1875 * @return none.
group-onsemi 0:098463de4c5d 1876 */
group-onsemi 0:098463de4c5d 1877 void arm_pid_init_f32(
group-onsemi 0:098463de4c5d 1878 arm_pid_instance_f32 * S,
group-onsemi 0:098463de4c5d 1879 int32_t resetStateFlag);
group-onsemi 0:098463de4c5d 1880
group-onsemi 0:098463de4c5d 1881 /**
group-onsemi 0:098463de4c5d 1882 * @brief Reset function for the floating-point PID Control.
group-onsemi 0:098463de4c5d 1883 * @param[in,out] *S is an instance of the floating-point PID Control structure
group-onsemi 0:098463de4c5d 1884 * @return none
group-onsemi 0:098463de4c5d 1885 */
group-onsemi 0:098463de4c5d 1886 void arm_pid_reset_f32(
group-onsemi 0:098463de4c5d 1887 arm_pid_instance_f32 * S);
group-onsemi 0:098463de4c5d 1888
group-onsemi 0:098463de4c5d 1889
group-onsemi 0:098463de4c5d 1890 /**
group-onsemi 0:098463de4c5d 1891 * @brief Initialization function for the Q31 PID Control.
group-onsemi 0:098463de4c5d 1892 * @param[in,out] *S points to an instance of the Q15 PID structure.
group-onsemi 0:098463de4c5d 1893 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
group-onsemi 0:098463de4c5d 1894 * @return none.
group-onsemi 0:098463de4c5d 1895 */
group-onsemi 0:098463de4c5d 1896 void arm_pid_init_q31(
group-onsemi 0:098463de4c5d 1897 arm_pid_instance_q31 * S,
group-onsemi 0:098463de4c5d 1898 int32_t resetStateFlag);
group-onsemi 0:098463de4c5d 1899
group-onsemi 0:098463de4c5d 1900
group-onsemi 0:098463de4c5d 1901 /**
group-onsemi 0:098463de4c5d 1902 * @brief Reset function for the Q31 PID Control.
group-onsemi 0:098463de4c5d 1903 * @param[in,out] *S points to an instance of the Q31 PID Control structure
group-onsemi 0:098463de4c5d 1904 * @return none
group-onsemi 0:098463de4c5d 1905 */
group-onsemi 0:098463de4c5d 1906
group-onsemi 0:098463de4c5d 1907 void arm_pid_reset_q31(
group-onsemi 0:098463de4c5d 1908 arm_pid_instance_q31 * S);
group-onsemi 0:098463de4c5d 1909
group-onsemi 0:098463de4c5d 1910 /**
group-onsemi 0:098463de4c5d 1911 * @brief Initialization function for the Q15 PID Control.
group-onsemi 0:098463de4c5d 1912 * @param[in,out] *S points to an instance of the Q15 PID structure.
group-onsemi 0:098463de4c5d 1913 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
group-onsemi 0:098463de4c5d 1914 * @return none.
group-onsemi 0:098463de4c5d 1915 */
group-onsemi 0:098463de4c5d 1916 void arm_pid_init_q15(
group-onsemi 0:098463de4c5d 1917 arm_pid_instance_q15 * S,
group-onsemi 0:098463de4c5d 1918 int32_t resetStateFlag);
group-onsemi 0:098463de4c5d 1919
group-onsemi 0:098463de4c5d 1920 /**
group-onsemi 0:098463de4c5d 1921 * @brief Reset function for the Q15 PID Control.
group-onsemi 0:098463de4c5d 1922 * @param[in,out] *S points to an instance of the q15 PID Control structure
group-onsemi 0:098463de4c5d 1923 * @return none
group-onsemi 0:098463de4c5d 1924 */
group-onsemi 0:098463de4c5d 1925 void arm_pid_reset_q15(
group-onsemi 0:098463de4c5d 1926 arm_pid_instance_q15 * S);
group-onsemi 0:098463de4c5d 1927
group-onsemi 0:098463de4c5d 1928
group-onsemi 0:098463de4c5d 1929 /**
group-onsemi 0:098463de4c5d 1930 * @brief Instance structure for the floating-point Linear Interpolate function.
group-onsemi 0:098463de4c5d 1931 */
group-onsemi 0:098463de4c5d 1932 typedef struct
group-onsemi 0:098463de4c5d 1933 {
group-onsemi 0:098463de4c5d 1934 uint32_t nValues; /**< nValues */
group-onsemi 0:098463de4c5d 1935 float32_t x1; /**< x1 */
group-onsemi 0:098463de4c5d 1936 float32_t xSpacing; /**< xSpacing */
group-onsemi 0:098463de4c5d 1937 float32_t *pYData; /**< pointer to the table of Y values */
group-onsemi 0:098463de4c5d 1938 } arm_linear_interp_instance_f32;
group-onsemi 0:098463de4c5d 1939
group-onsemi 0:098463de4c5d 1940 /**
group-onsemi 0:098463de4c5d 1941 * @brief Instance structure for the floating-point bilinear interpolation function.
group-onsemi 0:098463de4c5d 1942 */
group-onsemi 0:098463de4c5d 1943
group-onsemi 0:098463de4c5d 1944 typedef struct
group-onsemi 0:098463de4c5d 1945 {
group-onsemi 0:098463de4c5d 1946 uint16_t numRows; /**< number of rows in the data table. */
group-onsemi 0:098463de4c5d 1947 uint16_t numCols; /**< number of columns in the data table. */
group-onsemi 0:098463de4c5d 1948 float32_t *pData; /**< points to the data table. */
group-onsemi 0:098463de4c5d 1949 } arm_bilinear_interp_instance_f32;
group-onsemi 0:098463de4c5d 1950
group-onsemi 0:098463de4c5d 1951 /**
group-onsemi 0:098463de4c5d 1952 * @brief Instance structure for the Q31 bilinear interpolation function.
group-onsemi 0:098463de4c5d 1953 */
group-onsemi 0:098463de4c5d 1954
group-onsemi 0:098463de4c5d 1955 typedef struct
group-onsemi 0:098463de4c5d 1956 {
group-onsemi 0:098463de4c5d 1957 uint16_t numRows; /**< number of rows in the data table. */
group-onsemi 0:098463de4c5d 1958 uint16_t numCols; /**< number of columns in the data table. */
group-onsemi 0:098463de4c5d 1959 q31_t *pData; /**< points to the data table. */
group-onsemi 0:098463de4c5d 1960 } arm_bilinear_interp_instance_q31;
group-onsemi 0:098463de4c5d 1961
group-onsemi 0:098463de4c5d 1962 /**
group-onsemi 0:098463de4c5d 1963 * @brief Instance structure for the Q15 bilinear interpolation function.
group-onsemi 0:098463de4c5d 1964 */
group-onsemi 0:098463de4c5d 1965
group-onsemi 0:098463de4c5d 1966 typedef struct
group-onsemi 0:098463de4c5d 1967 {
group-onsemi 0:098463de4c5d 1968 uint16_t numRows; /**< number of rows in the data table. */
group-onsemi 0:098463de4c5d 1969 uint16_t numCols; /**< number of columns in the data table. */
group-onsemi 0:098463de4c5d 1970 q15_t *pData; /**< points to the data table. */
group-onsemi 0:098463de4c5d 1971 } arm_bilinear_interp_instance_q15;
group-onsemi 0:098463de4c5d 1972
group-onsemi 0:098463de4c5d 1973 /**
group-onsemi 0:098463de4c5d 1974 * @brief Instance structure for the Q15 bilinear interpolation function.
group-onsemi 0:098463de4c5d 1975 */
group-onsemi 0:098463de4c5d 1976
group-onsemi 0:098463de4c5d 1977 typedef struct
group-onsemi 0:098463de4c5d 1978 {
group-onsemi 0:098463de4c5d 1979 uint16_t numRows; /**< number of rows in the data table. */
group-onsemi 0:098463de4c5d 1980 uint16_t numCols; /**< number of columns in the data table. */
group-onsemi 0:098463de4c5d 1981 q7_t *pData; /**< points to the data table. */
group-onsemi 0:098463de4c5d 1982 } arm_bilinear_interp_instance_q7;
group-onsemi 0:098463de4c5d 1983
group-onsemi 0:098463de4c5d 1984
group-onsemi 0:098463de4c5d 1985 /**
group-onsemi 0:098463de4c5d 1986 * @brief Q7 vector multiplication.
group-onsemi 0:098463de4c5d 1987 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 1988 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 1989 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 1990 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 1991 * @return none.
group-onsemi 0:098463de4c5d 1992 */
group-onsemi 0:098463de4c5d 1993
group-onsemi 0:098463de4c5d 1994 void arm_mult_q7(
group-onsemi 0:098463de4c5d 1995 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 1996 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 1997 q7_t * pDst,
group-onsemi 0:098463de4c5d 1998 uint32_t blockSize);
group-onsemi 0:098463de4c5d 1999
group-onsemi 0:098463de4c5d 2000 /**
group-onsemi 0:098463de4c5d 2001 * @brief Q15 vector multiplication.
group-onsemi 0:098463de4c5d 2002 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2003 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2004 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2005 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2006 * @return none.
group-onsemi 0:098463de4c5d 2007 */
group-onsemi 0:098463de4c5d 2008
group-onsemi 0:098463de4c5d 2009 void arm_mult_q15(
group-onsemi 0:098463de4c5d 2010 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 2011 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 2012 q15_t * pDst,
group-onsemi 0:098463de4c5d 2013 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2014
group-onsemi 0:098463de4c5d 2015 /**
group-onsemi 0:098463de4c5d 2016 * @brief Q31 vector multiplication.
group-onsemi 0:098463de4c5d 2017 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2018 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2019 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2020 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2021 * @return none.
group-onsemi 0:098463de4c5d 2022 */
group-onsemi 0:098463de4c5d 2023
group-onsemi 0:098463de4c5d 2024 void arm_mult_q31(
group-onsemi 0:098463de4c5d 2025 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 2026 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 2027 q31_t * pDst,
group-onsemi 0:098463de4c5d 2028 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2029
group-onsemi 0:098463de4c5d 2030 /**
group-onsemi 0:098463de4c5d 2031 * @brief Floating-point vector multiplication.
group-onsemi 0:098463de4c5d 2032 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2033 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2034 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2035 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2036 * @return none.
group-onsemi 0:098463de4c5d 2037 */
group-onsemi 0:098463de4c5d 2038
group-onsemi 0:098463de4c5d 2039 void arm_mult_f32(
group-onsemi 0:098463de4c5d 2040 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 2041 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 2042 float32_t * pDst,
group-onsemi 0:098463de4c5d 2043 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2044
group-onsemi 0:098463de4c5d 2045
group-onsemi 0:098463de4c5d 2046
group-onsemi 0:098463de4c5d 2047
group-onsemi 0:098463de4c5d 2048
group-onsemi 0:098463de4c5d 2049
group-onsemi 0:098463de4c5d 2050 /**
group-onsemi 0:098463de4c5d 2051 * @brief Instance structure for the Q15 CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2052 */
group-onsemi 0:098463de4c5d 2053
group-onsemi 0:098463de4c5d 2054 typedef struct
group-onsemi 0:098463de4c5d 2055 {
group-onsemi 0:098463de4c5d 2056 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2057 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2058 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2059 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
group-onsemi 0:098463de4c5d 2060 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2061 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2062 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2063 } arm_cfft_radix2_instance_q15;
group-onsemi 0:098463de4c5d 2064
group-onsemi 0:098463de4c5d 2065 /* Deprecated */
group-onsemi 0:098463de4c5d 2066 arm_status arm_cfft_radix2_init_q15(
group-onsemi 0:098463de4c5d 2067 arm_cfft_radix2_instance_q15 * S,
group-onsemi 0:098463de4c5d 2068 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2069 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2070 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2071
group-onsemi 0:098463de4c5d 2072 /* Deprecated */
group-onsemi 0:098463de4c5d 2073 void arm_cfft_radix2_q15(
group-onsemi 0:098463de4c5d 2074 const arm_cfft_radix2_instance_q15 * S,
group-onsemi 0:098463de4c5d 2075 q15_t * pSrc);
group-onsemi 0:098463de4c5d 2076
group-onsemi 0:098463de4c5d 2077
group-onsemi 0:098463de4c5d 2078
group-onsemi 0:098463de4c5d 2079 /**
group-onsemi 0:098463de4c5d 2080 * @brief Instance structure for the Q15 CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2081 */
group-onsemi 0:098463de4c5d 2082
group-onsemi 0:098463de4c5d 2083 typedef struct
group-onsemi 0:098463de4c5d 2084 {
group-onsemi 0:098463de4c5d 2085 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2086 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2087 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2088 q15_t *pTwiddle; /**< points to the twiddle factor table. */
group-onsemi 0:098463de4c5d 2089 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2090 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2091 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2092 } arm_cfft_radix4_instance_q15;
group-onsemi 0:098463de4c5d 2093
group-onsemi 0:098463de4c5d 2094 /* Deprecated */
group-onsemi 0:098463de4c5d 2095 arm_status arm_cfft_radix4_init_q15(
group-onsemi 0:098463de4c5d 2096 arm_cfft_radix4_instance_q15 * S,
group-onsemi 0:098463de4c5d 2097 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2098 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2099 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2100
group-onsemi 0:098463de4c5d 2101 /* Deprecated */
group-onsemi 0:098463de4c5d 2102 void arm_cfft_radix4_q15(
group-onsemi 0:098463de4c5d 2103 const arm_cfft_radix4_instance_q15 * S,
group-onsemi 0:098463de4c5d 2104 q15_t * pSrc);
group-onsemi 0:098463de4c5d 2105
group-onsemi 0:098463de4c5d 2106 /**
group-onsemi 0:098463de4c5d 2107 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2108 */
group-onsemi 0:098463de4c5d 2109
group-onsemi 0:098463de4c5d 2110 typedef struct
group-onsemi 0:098463de4c5d 2111 {
group-onsemi 0:098463de4c5d 2112 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2113 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2114 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2115 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2116 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2117 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2118 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2119 } arm_cfft_radix2_instance_q31;
group-onsemi 0:098463de4c5d 2120
group-onsemi 0:098463de4c5d 2121 /* Deprecated */
group-onsemi 0:098463de4c5d 2122 arm_status arm_cfft_radix2_init_q31(
group-onsemi 0:098463de4c5d 2123 arm_cfft_radix2_instance_q31 * S,
group-onsemi 0:098463de4c5d 2124 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2125 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2126 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2127
group-onsemi 0:098463de4c5d 2128 /* Deprecated */
group-onsemi 0:098463de4c5d 2129 void arm_cfft_radix2_q31(
group-onsemi 0:098463de4c5d 2130 const arm_cfft_radix2_instance_q31 * S,
group-onsemi 0:098463de4c5d 2131 q31_t * pSrc);
group-onsemi 0:098463de4c5d 2132
group-onsemi 0:098463de4c5d 2133 /**
group-onsemi 0:098463de4c5d 2134 * @brief Instance structure for the Q31 CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2135 */
group-onsemi 0:098463de4c5d 2136
group-onsemi 0:098463de4c5d 2137 typedef struct
group-onsemi 0:098463de4c5d 2138 {
group-onsemi 0:098463de4c5d 2139 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2140 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2141 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2142 q31_t *pTwiddle; /**< points to the twiddle factor table. */
group-onsemi 0:098463de4c5d 2143 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2144 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2145 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2146 } arm_cfft_radix4_instance_q31;
group-onsemi 0:098463de4c5d 2147
group-onsemi 0:098463de4c5d 2148 /* Deprecated */
group-onsemi 0:098463de4c5d 2149 void arm_cfft_radix4_q31(
group-onsemi 0:098463de4c5d 2150 const arm_cfft_radix4_instance_q31 * S,
group-onsemi 0:098463de4c5d 2151 q31_t * pSrc);
group-onsemi 0:098463de4c5d 2152
group-onsemi 0:098463de4c5d 2153 /* Deprecated */
group-onsemi 0:098463de4c5d 2154 arm_status arm_cfft_radix4_init_q31(
group-onsemi 0:098463de4c5d 2155 arm_cfft_radix4_instance_q31 * S,
group-onsemi 0:098463de4c5d 2156 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2157 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2158 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2159
group-onsemi 0:098463de4c5d 2160 /**
group-onsemi 0:098463de4c5d 2161 * @brief Instance structure for the floating-point CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2162 */
group-onsemi 0:098463de4c5d 2163
group-onsemi 0:098463de4c5d 2164 typedef struct
group-onsemi 0:098463de4c5d 2165 {
group-onsemi 0:098463de4c5d 2166 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2167 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2168 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2169 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2170 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2171 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2172 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2173 float32_t onebyfftLen; /**< value of 1/fftLen. */
group-onsemi 0:098463de4c5d 2174 } arm_cfft_radix2_instance_f32;
group-onsemi 0:098463de4c5d 2175
group-onsemi 0:098463de4c5d 2176 /* Deprecated */
group-onsemi 0:098463de4c5d 2177 arm_status arm_cfft_radix2_init_f32(
group-onsemi 0:098463de4c5d 2178 arm_cfft_radix2_instance_f32 * S,
group-onsemi 0:098463de4c5d 2179 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2180 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2181 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2182
group-onsemi 0:098463de4c5d 2183 /* Deprecated */
group-onsemi 0:098463de4c5d 2184 void arm_cfft_radix2_f32(
group-onsemi 0:098463de4c5d 2185 const arm_cfft_radix2_instance_f32 * S,
group-onsemi 0:098463de4c5d 2186 float32_t * pSrc);
group-onsemi 0:098463de4c5d 2187
group-onsemi 0:098463de4c5d 2188 /**
group-onsemi 0:098463de4c5d 2189 * @brief Instance structure for the floating-point CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2190 */
group-onsemi 0:098463de4c5d 2191
group-onsemi 0:098463de4c5d 2192 typedef struct
group-onsemi 0:098463de4c5d 2193 {
group-onsemi 0:098463de4c5d 2194 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2195 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
group-onsemi 0:098463de4c5d 2196 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2197 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2198 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2199 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2200 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
group-onsemi 0:098463de4c5d 2201 float32_t onebyfftLen; /**< value of 1/fftLen. */
group-onsemi 0:098463de4c5d 2202 } arm_cfft_radix4_instance_f32;
group-onsemi 0:098463de4c5d 2203
group-onsemi 0:098463de4c5d 2204 /* Deprecated */
group-onsemi 0:098463de4c5d 2205 arm_status arm_cfft_radix4_init_f32(
group-onsemi 0:098463de4c5d 2206 arm_cfft_radix4_instance_f32 * S,
group-onsemi 0:098463de4c5d 2207 uint16_t fftLen,
group-onsemi 0:098463de4c5d 2208 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2209 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2210
group-onsemi 0:098463de4c5d 2211 /* Deprecated */
group-onsemi 0:098463de4c5d 2212 void arm_cfft_radix4_f32(
group-onsemi 0:098463de4c5d 2213 const arm_cfft_radix4_instance_f32 * S,
group-onsemi 0:098463de4c5d 2214 float32_t * pSrc);
group-onsemi 0:098463de4c5d 2215
group-onsemi 0:098463de4c5d 2216 /**
group-onsemi 0:098463de4c5d 2217 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2218 */
group-onsemi 0:098463de4c5d 2219
group-onsemi 0:098463de4c5d 2220 typedef struct
group-onsemi 0:098463de4c5d 2221 {
group-onsemi 0:098463de4c5d 2222 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2223 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2224 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2225 uint16_t bitRevLength; /**< bit reversal table length. */
group-onsemi 0:098463de4c5d 2226 } arm_cfft_instance_q15;
group-onsemi 0:098463de4c5d 2227
group-onsemi 0:098463de4c5d 2228 void arm_cfft_q15(
group-onsemi 0:098463de4c5d 2229 const arm_cfft_instance_q15 * S,
group-onsemi 0:098463de4c5d 2230 q15_t * p1,
group-onsemi 0:098463de4c5d 2231 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2232 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2233
group-onsemi 0:098463de4c5d 2234 /**
group-onsemi 0:098463de4c5d 2235 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2236 */
group-onsemi 0:098463de4c5d 2237
group-onsemi 0:098463de4c5d 2238 typedef struct
group-onsemi 0:098463de4c5d 2239 {
group-onsemi 0:098463de4c5d 2240 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2241 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2242 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2243 uint16_t bitRevLength; /**< bit reversal table length. */
group-onsemi 0:098463de4c5d 2244 } arm_cfft_instance_q31;
group-onsemi 0:098463de4c5d 2245
group-onsemi 0:098463de4c5d 2246 void arm_cfft_q31(
group-onsemi 0:098463de4c5d 2247 const arm_cfft_instance_q31 * S,
group-onsemi 0:098463de4c5d 2248 q31_t * p1,
group-onsemi 0:098463de4c5d 2249 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2250 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2251
group-onsemi 0:098463de4c5d 2252 /**
group-onsemi 0:098463de4c5d 2253 * @brief Instance structure for the floating-point CFFT/CIFFT function.
group-onsemi 0:098463de4c5d 2254 */
group-onsemi 0:098463de4c5d 2255
group-onsemi 0:098463de4c5d 2256 typedef struct
group-onsemi 0:098463de4c5d 2257 {
group-onsemi 0:098463de4c5d 2258 uint16_t fftLen; /**< length of the FFT. */
group-onsemi 0:098463de4c5d 2259 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
group-onsemi 0:098463de4c5d 2260 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
group-onsemi 0:098463de4c5d 2261 uint16_t bitRevLength; /**< bit reversal table length. */
group-onsemi 0:098463de4c5d 2262 } arm_cfft_instance_f32;
group-onsemi 0:098463de4c5d 2263
group-onsemi 0:098463de4c5d 2264 void arm_cfft_f32(
group-onsemi 0:098463de4c5d 2265 const arm_cfft_instance_f32 * S,
group-onsemi 0:098463de4c5d 2266 float32_t * p1,
group-onsemi 0:098463de4c5d 2267 uint8_t ifftFlag,
group-onsemi 0:098463de4c5d 2268 uint8_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2269
group-onsemi 0:098463de4c5d 2270 /**
group-onsemi 0:098463de4c5d 2271 * @brief Instance structure for the Q15 RFFT/RIFFT function.
group-onsemi 0:098463de4c5d 2272 */
group-onsemi 0:098463de4c5d 2273
group-onsemi 0:098463de4c5d 2274 typedef struct
group-onsemi 0:098463de4c5d 2275 {
group-onsemi 0:098463de4c5d 2276 uint32_t fftLenReal; /**< length of the real FFT. */
group-onsemi 0:098463de4c5d 2277 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
group-onsemi 0:098463de4c5d 2278 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2279 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2280 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
group-onsemi 0:098463de4c5d 2281 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
group-onsemi 0:098463de4c5d 2282 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2283 } arm_rfft_instance_q15;
group-onsemi 0:098463de4c5d 2284
group-onsemi 0:098463de4c5d 2285 arm_status arm_rfft_init_q15(
group-onsemi 0:098463de4c5d 2286 arm_rfft_instance_q15 * S,
group-onsemi 0:098463de4c5d 2287 uint32_t fftLenReal,
group-onsemi 0:098463de4c5d 2288 uint32_t ifftFlagR,
group-onsemi 0:098463de4c5d 2289 uint32_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2290
group-onsemi 0:098463de4c5d 2291 void arm_rfft_q15(
group-onsemi 0:098463de4c5d 2292 const arm_rfft_instance_q15 * S,
group-onsemi 0:098463de4c5d 2293 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2294 q15_t * pDst);
group-onsemi 0:098463de4c5d 2295
group-onsemi 0:098463de4c5d 2296 /**
group-onsemi 0:098463de4c5d 2297 * @brief Instance structure for the Q31 RFFT/RIFFT function.
group-onsemi 0:098463de4c5d 2298 */
group-onsemi 0:098463de4c5d 2299
group-onsemi 0:098463de4c5d 2300 typedef struct
group-onsemi 0:098463de4c5d 2301 {
group-onsemi 0:098463de4c5d 2302 uint32_t fftLenReal; /**< length of the real FFT. */
group-onsemi 0:098463de4c5d 2303 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
group-onsemi 0:098463de4c5d 2304 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2305 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2306 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
group-onsemi 0:098463de4c5d 2307 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
group-onsemi 0:098463de4c5d 2308 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2309 } arm_rfft_instance_q31;
group-onsemi 0:098463de4c5d 2310
group-onsemi 0:098463de4c5d 2311 arm_status arm_rfft_init_q31(
group-onsemi 0:098463de4c5d 2312 arm_rfft_instance_q31 * S,
group-onsemi 0:098463de4c5d 2313 uint32_t fftLenReal,
group-onsemi 0:098463de4c5d 2314 uint32_t ifftFlagR,
group-onsemi 0:098463de4c5d 2315 uint32_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2316
group-onsemi 0:098463de4c5d 2317 void arm_rfft_q31(
group-onsemi 0:098463de4c5d 2318 const arm_rfft_instance_q31 * S,
group-onsemi 0:098463de4c5d 2319 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2320 q31_t * pDst);
group-onsemi 0:098463de4c5d 2321
group-onsemi 0:098463de4c5d 2322 /**
group-onsemi 0:098463de4c5d 2323 * @brief Instance structure for the floating-point RFFT/RIFFT function.
group-onsemi 0:098463de4c5d 2324 */
group-onsemi 0:098463de4c5d 2325
group-onsemi 0:098463de4c5d 2326 typedef struct
group-onsemi 0:098463de4c5d 2327 {
group-onsemi 0:098463de4c5d 2328 uint32_t fftLenReal; /**< length of the real FFT. */
group-onsemi 0:098463de4c5d 2329 uint16_t fftLenBy2; /**< length of the complex FFT. */
group-onsemi 0:098463de4c5d 2330 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
group-onsemi 0:098463de4c5d 2331 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
group-onsemi 0:098463de4c5d 2332 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
group-onsemi 0:098463de4c5d 2333 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
group-onsemi 0:098463de4c5d 2334 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
group-onsemi 0:098463de4c5d 2335 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2336 } arm_rfft_instance_f32;
group-onsemi 0:098463de4c5d 2337
group-onsemi 0:098463de4c5d 2338 arm_status arm_rfft_init_f32(
group-onsemi 0:098463de4c5d 2339 arm_rfft_instance_f32 * S,
group-onsemi 0:098463de4c5d 2340 arm_cfft_radix4_instance_f32 * S_CFFT,
group-onsemi 0:098463de4c5d 2341 uint32_t fftLenReal,
group-onsemi 0:098463de4c5d 2342 uint32_t ifftFlagR,
group-onsemi 0:098463de4c5d 2343 uint32_t bitReverseFlag);
group-onsemi 0:098463de4c5d 2344
group-onsemi 0:098463de4c5d 2345 void arm_rfft_f32(
group-onsemi 0:098463de4c5d 2346 const arm_rfft_instance_f32 * S,
group-onsemi 0:098463de4c5d 2347 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2348 float32_t * pDst);
group-onsemi 0:098463de4c5d 2349
group-onsemi 0:098463de4c5d 2350 /**
group-onsemi 0:098463de4c5d 2351 * @brief Instance structure for the floating-point RFFT/RIFFT function.
group-onsemi 0:098463de4c5d 2352 */
group-onsemi 0:098463de4c5d 2353
group-onsemi 0:098463de4c5d 2354 typedef struct
group-onsemi 0:098463de4c5d 2355 {
group-onsemi 0:098463de4c5d 2356 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
group-onsemi 0:098463de4c5d 2357 uint16_t fftLenRFFT; /**< length of the real sequence */
group-onsemi 0:098463de4c5d 2358 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
group-onsemi 0:098463de4c5d 2359 } arm_rfft_fast_instance_f32 ;
group-onsemi 0:098463de4c5d 2360
group-onsemi 0:098463de4c5d 2361 arm_status arm_rfft_fast_init_f32 (
group-onsemi 0:098463de4c5d 2362 arm_rfft_fast_instance_f32 * S,
group-onsemi 0:098463de4c5d 2363 uint16_t fftLen);
group-onsemi 0:098463de4c5d 2364
group-onsemi 0:098463de4c5d 2365 void arm_rfft_fast_f32(
group-onsemi 0:098463de4c5d 2366 arm_rfft_fast_instance_f32 * S,
group-onsemi 0:098463de4c5d 2367 float32_t * p, float32_t * pOut,
group-onsemi 0:098463de4c5d 2368 uint8_t ifftFlag);
group-onsemi 0:098463de4c5d 2369
group-onsemi 0:098463de4c5d 2370 /**
group-onsemi 0:098463de4c5d 2371 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
group-onsemi 0:098463de4c5d 2372 */
group-onsemi 0:098463de4c5d 2373
group-onsemi 0:098463de4c5d 2374 typedef struct
group-onsemi 0:098463de4c5d 2375 {
group-onsemi 0:098463de4c5d 2376 uint16_t N; /**< length of the DCT4. */
group-onsemi 0:098463de4c5d 2377 uint16_t Nby2; /**< half of the length of the DCT4. */
group-onsemi 0:098463de4c5d 2378 float32_t normalize; /**< normalizing factor. */
group-onsemi 0:098463de4c5d 2379 float32_t *pTwiddle; /**< points to the twiddle factor table. */
group-onsemi 0:098463de4c5d 2380 float32_t *pCosFactor; /**< points to the cosFactor table. */
group-onsemi 0:098463de4c5d 2381 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
group-onsemi 0:098463de4c5d 2382 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2383 } arm_dct4_instance_f32;
group-onsemi 0:098463de4c5d 2384
group-onsemi 0:098463de4c5d 2385 /**
group-onsemi 0:098463de4c5d 2386 * @brief Initialization function for the floating-point DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2387 * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure.
group-onsemi 0:098463de4c5d 2388 * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
group-onsemi 0:098463de4c5d 2389 * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
group-onsemi 0:098463de4c5d 2390 * @param[in] N length of the DCT4.
group-onsemi 0:098463de4c5d 2391 * @param[in] Nby2 half of the length of the DCT4.
group-onsemi 0:098463de4c5d 2392 * @param[in] normalize normalizing factor.
group-onsemi 0:098463de4c5d 2393 * @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.
group-onsemi 0:098463de4c5d 2394 */
group-onsemi 0:098463de4c5d 2395
group-onsemi 0:098463de4c5d 2396 arm_status arm_dct4_init_f32(
group-onsemi 0:098463de4c5d 2397 arm_dct4_instance_f32 * S,
group-onsemi 0:098463de4c5d 2398 arm_rfft_instance_f32 * S_RFFT,
group-onsemi 0:098463de4c5d 2399 arm_cfft_radix4_instance_f32 * S_CFFT,
group-onsemi 0:098463de4c5d 2400 uint16_t N,
group-onsemi 0:098463de4c5d 2401 uint16_t Nby2,
group-onsemi 0:098463de4c5d 2402 float32_t normalize);
group-onsemi 0:098463de4c5d 2403
group-onsemi 0:098463de4c5d 2404 /**
group-onsemi 0:098463de4c5d 2405 * @brief Processing function for the floating-point DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2406 * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure.
group-onsemi 0:098463de4c5d 2407 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 2408 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
group-onsemi 0:098463de4c5d 2409 * @return none.
group-onsemi 0:098463de4c5d 2410 */
group-onsemi 0:098463de4c5d 2411
group-onsemi 0:098463de4c5d 2412 void arm_dct4_f32(
group-onsemi 0:098463de4c5d 2413 const arm_dct4_instance_f32 * S,
group-onsemi 0:098463de4c5d 2414 float32_t * pState,
group-onsemi 0:098463de4c5d 2415 float32_t * pInlineBuffer);
group-onsemi 0:098463de4c5d 2416
group-onsemi 0:098463de4c5d 2417 /**
group-onsemi 0:098463de4c5d 2418 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
group-onsemi 0:098463de4c5d 2419 */
group-onsemi 0:098463de4c5d 2420
group-onsemi 0:098463de4c5d 2421 typedef struct
group-onsemi 0:098463de4c5d 2422 {
group-onsemi 0:098463de4c5d 2423 uint16_t N; /**< length of the DCT4. */
group-onsemi 0:098463de4c5d 2424 uint16_t Nby2; /**< half of the length of the DCT4. */
group-onsemi 0:098463de4c5d 2425 q31_t normalize; /**< normalizing factor. */
group-onsemi 0:098463de4c5d 2426 q31_t *pTwiddle; /**< points to the twiddle factor table. */
group-onsemi 0:098463de4c5d 2427 q31_t *pCosFactor; /**< points to the cosFactor table. */
group-onsemi 0:098463de4c5d 2428 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
group-onsemi 0:098463de4c5d 2429 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2430 } arm_dct4_instance_q31;
group-onsemi 0:098463de4c5d 2431
group-onsemi 0:098463de4c5d 2432 /**
group-onsemi 0:098463de4c5d 2433 * @brief Initialization function for the Q31 DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2434 * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure.
group-onsemi 0:098463de4c5d 2435 * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure
group-onsemi 0:098463de4c5d 2436 * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure
group-onsemi 0:098463de4c5d 2437 * @param[in] N length of the DCT4.
group-onsemi 0:098463de4c5d 2438 * @param[in] Nby2 half of the length of the DCT4.
group-onsemi 0:098463de4c5d 2439 * @param[in] normalize normalizing factor.
group-onsemi 0:098463de4c5d 2440 * @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.
group-onsemi 0:098463de4c5d 2441 */
group-onsemi 0:098463de4c5d 2442
group-onsemi 0:098463de4c5d 2443 arm_status arm_dct4_init_q31(
group-onsemi 0:098463de4c5d 2444 arm_dct4_instance_q31 * S,
group-onsemi 0:098463de4c5d 2445 arm_rfft_instance_q31 * S_RFFT,
group-onsemi 0:098463de4c5d 2446 arm_cfft_radix4_instance_q31 * S_CFFT,
group-onsemi 0:098463de4c5d 2447 uint16_t N,
group-onsemi 0:098463de4c5d 2448 uint16_t Nby2,
group-onsemi 0:098463de4c5d 2449 q31_t normalize);
group-onsemi 0:098463de4c5d 2450
group-onsemi 0:098463de4c5d 2451 /**
group-onsemi 0:098463de4c5d 2452 * @brief Processing function for the Q31 DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2453 * @param[in] *S points to an instance of the Q31 DCT4 structure.
group-onsemi 0:098463de4c5d 2454 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 2455 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
group-onsemi 0:098463de4c5d 2456 * @return none.
group-onsemi 0:098463de4c5d 2457 */
group-onsemi 0:098463de4c5d 2458
group-onsemi 0:098463de4c5d 2459 void arm_dct4_q31(
group-onsemi 0:098463de4c5d 2460 const arm_dct4_instance_q31 * S,
group-onsemi 0:098463de4c5d 2461 q31_t * pState,
group-onsemi 0:098463de4c5d 2462 q31_t * pInlineBuffer);
group-onsemi 0:098463de4c5d 2463
group-onsemi 0:098463de4c5d 2464 /**
group-onsemi 0:098463de4c5d 2465 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
group-onsemi 0:098463de4c5d 2466 */
group-onsemi 0:098463de4c5d 2467
group-onsemi 0:098463de4c5d 2468 typedef struct
group-onsemi 0:098463de4c5d 2469 {
group-onsemi 0:098463de4c5d 2470 uint16_t N; /**< length of the DCT4. */
group-onsemi 0:098463de4c5d 2471 uint16_t Nby2; /**< half of the length of the DCT4. */
group-onsemi 0:098463de4c5d 2472 q15_t normalize; /**< normalizing factor. */
group-onsemi 0:098463de4c5d 2473 q15_t *pTwiddle; /**< points to the twiddle factor table. */
group-onsemi 0:098463de4c5d 2474 q15_t *pCosFactor; /**< points to the cosFactor table. */
group-onsemi 0:098463de4c5d 2475 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
group-onsemi 0:098463de4c5d 2476 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
group-onsemi 0:098463de4c5d 2477 } arm_dct4_instance_q15;
group-onsemi 0:098463de4c5d 2478
group-onsemi 0:098463de4c5d 2479 /**
group-onsemi 0:098463de4c5d 2480 * @brief Initialization function for the Q15 DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2481 * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure.
group-onsemi 0:098463de4c5d 2482 * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
group-onsemi 0:098463de4c5d 2483 * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
group-onsemi 0:098463de4c5d 2484 * @param[in] N length of the DCT4.
group-onsemi 0:098463de4c5d 2485 * @param[in] Nby2 half of the length of the DCT4.
group-onsemi 0:098463de4c5d 2486 * @param[in] normalize normalizing factor.
group-onsemi 0:098463de4c5d 2487 * @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.
group-onsemi 0:098463de4c5d 2488 */
group-onsemi 0:098463de4c5d 2489
group-onsemi 0:098463de4c5d 2490 arm_status arm_dct4_init_q15(
group-onsemi 0:098463de4c5d 2491 arm_dct4_instance_q15 * S,
group-onsemi 0:098463de4c5d 2492 arm_rfft_instance_q15 * S_RFFT,
group-onsemi 0:098463de4c5d 2493 arm_cfft_radix4_instance_q15 * S_CFFT,
group-onsemi 0:098463de4c5d 2494 uint16_t N,
group-onsemi 0:098463de4c5d 2495 uint16_t Nby2,
group-onsemi 0:098463de4c5d 2496 q15_t normalize);
group-onsemi 0:098463de4c5d 2497
group-onsemi 0:098463de4c5d 2498 /**
group-onsemi 0:098463de4c5d 2499 * @brief Processing function for the Q15 DCT4/IDCT4.
group-onsemi 0:098463de4c5d 2500 * @param[in] *S points to an instance of the Q15 DCT4 structure.
group-onsemi 0:098463de4c5d 2501 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 2502 * @param[in,out] *pInlineBuffer points to the in-place input and output buffer.
group-onsemi 0:098463de4c5d 2503 * @return none.
group-onsemi 0:098463de4c5d 2504 */
group-onsemi 0:098463de4c5d 2505
group-onsemi 0:098463de4c5d 2506 void arm_dct4_q15(
group-onsemi 0:098463de4c5d 2507 const arm_dct4_instance_q15 * S,
group-onsemi 0:098463de4c5d 2508 q15_t * pState,
group-onsemi 0:098463de4c5d 2509 q15_t * pInlineBuffer);
group-onsemi 0:098463de4c5d 2510
group-onsemi 0:098463de4c5d 2511 /**
group-onsemi 0:098463de4c5d 2512 * @brief Floating-point vector addition.
group-onsemi 0:098463de4c5d 2513 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2514 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2515 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2516 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2517 * @return none.
group-onsemi 0:098463de4c5d 2518 */
group-onsemi 0:098463de4c5d 2519
group-onsemi 0:098463de4c5d 2520 void arm_add_f32(
group-onsemi 0:098463de4c5d 2521 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 2522 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 2523 float32_t * pDst,
group-onsemi 0:098463de4c5d 2524 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2525
group-onsemi 0:098463de4c5d 2526 /**
group-onsemi 0:098463de4c5d 2527 * @brief Q7 vector addition.
group-onsemi 0:098463de4c5d 2528 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2529 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2530 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2531 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2532 * @return none.
group-onsemi 0:098463de4c5d 2533 */
group-onsemi 0:098463de4c5d 2534
group-onsemi 0:098463de4c5d 2535 void arm_add_q7(
group-onsemi 0:098463de4c5d 2536 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 2537 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 2538 q7_t * pDst,
group-onsemi 0:098463de4c5d 2539 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2540
group-onsemi 0:098463de4c5d 2541 /**
group-onsemi 0:098463de4c5d 2542 * @brief Q15 vector addition.
group-onsemi 0:098463de4c5d 2543 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2544 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2545 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2546 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2547 * @return none.
group-onsemi 0:098463de4c5d 2548 */
group-onsemi 0:098463de4c5d 2549
group-onsemi 0:098463de4c5d 2550 void arm_add_q15(
group-onsemi 0:098463de4c5d 2551 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 2552 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 2553 q15_t * pDst,
group-onsemi 0:098463de4c5d 2554 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2555
group-onsemi 0:098463de4c5d 2556 /**
group-onsemi 0:098463de4c5d 2557 * @brief Q31 vector addition.
group-onsemi 0:098463de4c5d 2558 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2559 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2560 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2561 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2562 * @return none.
group-onsemi 0:098463de4c5d 2563 */
group-onsemi 0:098463de4c5d 2564
group-onsemi 0:098463de4c5d 2565 void arm_add_q31(
group-onsemi 0:098463de4c5d 2566 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 2567 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 2568 q31_t * pDst,
group-onsemi 0:098463de4c5d 2569 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2570
group-onsemi 0:098463de4c5d 2571 /**
group-onsemi 0:098463de4c5d 2572 * @brief Floating-point vector subtraction.
group-onsemi 0:098463de4c5d 2573 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2574 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2575 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2576 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2577 * @return none.
group-onsemi 0:098463de4c5d 2578 */
group-onsemi 0:098463de4c5d 2579
group-onsemi 0:098463de4c5d 2580 void arm_sub_f32(
group-onsemi 0:098463de4c5d 2581 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 2582 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 2583 float32_t * pDst,
group-onsemi 0:098463de4c5d 2584 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2585
group-onsemi 0:098463de4c5d 2586 /**
group-onsemi 0:098463de4c5d 2587 * @brief Q7 vector subtraction.
group-onsemi 0:098463de4c5d 2588 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2589 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2590 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2591 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2592 * @return none.
group-onsemi 0:098463de4c5d 2593 */
group-onsemi 0:098463de4c5d 2594
group-onsemi 0:098463de4c5d 2595 void arm_sub_q7(
group-onsemi 0:098463de4c5d 2596 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 2597 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 2598 q7_t * pDst,
group-onsemi 0:098463de4c5d 2599 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2600
group-onsemi 0:098463de4c5d 2601 /**
group-onsemi 0:098463de4c5d 2602 * @brief Q15 vector subtraction.
group-onsemi 0:098463de4c5d 2603 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2604 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2605 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2606 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2607 * @return none.
group-onsemi 0:098463de4c5d 2608 */
group-onsemi 0:098463de4c5d 2609
group-onsemi 0:098463de4c5d 2610 void arm_sub_q15(
group-onsemi 0:098463de4c5d 2611 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 2612 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 2613 q15_t * pDst,
group-onsemi 0:098463de4c5d 2614 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2615
group-onsemi 0:098463de4c5d 2616 /**
group-onsemi 0:098463de4c5d 2617 * @brief Q31 vector subtraction.
group-onsemi 0:098463de4c5d 2618 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2619 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2620 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2621 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2622 * @return none.
group-onsemi 0:098463de4c5d 2623 */
group-onsemi 0:098463de4c5d 2624
group-onsemi 0:098463de4c5d 2625 void arm_sub_q31(
group-onsemi 0:098463de4c5d 2626 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 2627 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 2628 q31_t * pDst,
group-onsemi 0:098463de4c5d 2629 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2630
group-onsemi 0:098463de4c5d 2631 /**
group-onsemi 0:098463de4c5d 2632 * @brief Multiplies a floating-point vector by a scalar.
group-onsemi 0:098463de4c5d 2633 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2634 * @param[in] scale scale factor to be applied
group-onsemi 0:098463de4c5d 2635 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2636 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2637 * @return none.
group-onsemi 0:098463de4c5d 2638 */
group-onsemi 0:098463de4c5d 2639
group-onsemi 0:098463de4c5d 2640 void arm_scale_f32(
group-onsemi 0:098463de4c5d 2641 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2642 float32_t scale,
group-onsemi 0:098463de4c5d 2643 float32_t * pDst,
group-onsemi 0:098463de4c5d 2644 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2645
group-onsemi 0:098463de4c5d 2646 /**
group-onsemi 0:098463de4c5d 2647 * @brief Multiplies a Q7 vector by a scalar.
group-onsemi 0:098463de4c5d 2648 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2649 * @param[in] scaleFract fractional portion of the scale value
group-onsemi 0:098463de4c5d 2650 * @param[in] shift number of bits to shift the result by
group-onsemi 0:098463de4c5d 2651 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2652 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2653 * @return none.
group-onsemi 0:098463de4c5d 2654 */
group-onsemi 0:098463de4c5d 2655
group-onsemi 0:098463de4c5d 2656 void arm_scale_q7(
group-onsemi 0:098463de4c5d 2657 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2658 q7_t scaleFract,
group-onsemi 0:098463de4c5d 2659 int8_t shift,
group-onsemi 0:098463de4c5d 2660 q7_t * pDst,
group-onsemi 0:098463de4c5d 2661 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2662
group-onsemi 0:098463de4c5d 2663 /**
group-onsemi 0:098463de4c5d 2664 * @brief Multiplies a Q15 vector by a scalar.
group-onsemi 0:098463de4c5d 2665 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2666 * @param[in] scaleFract fractional portion of the scale value
group-onsemi 0:098463de4c5d 2667 * @param[in] shift number of bits to shift the result by
group-onsemi 0:098463de4c5d 2668 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2669 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2670 * @return none.
group-onsemi 0:098463de4c5d 2671 */
group-onsemi 0:098463de4c5d 2672
group-onsemi 0:098463de4c5d 2673 void arm_scale_q15(
group-onsemi 0:098463de4c5d 2674 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2675 q15_t scaleFract,
group-onsemi 0:098463de4c5d 2676 int8_t shift,
group-onsemi 0:098463de4c5d 2677 q15_t * pDst,
group-onsemi 0:098463de4c5d 2678 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2679
group-onsemi 0:098463de4c5d 2680 /**
group-onsemi 0:098463de4c5d 2681 * @brief Multiplies a Q31 vector by a scalar.
group-onsemi 0:098463de4c5d 2682 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2683 * @param[in] scaleFract fractional portion of the scale value
group-onsemi 0:098463de4c5d 2684 * @param[in] shift number of bits to shift the result by
group-onsemi 0:098463de4c5d 2685 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2686 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2687 * @return none.
group-onsemi 0:098463de4c5d 2688 */
group-onsemi 0:098463de4c5d 2689
group-onsemi 0:098463de4c5d 2690 void arm_scale_q31(
group-onsemi 0:098463de4c5d 2691 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2692 q31_t scaleFract,
group-onsemi 0:098463de4c5d 2693 int8_t shift,
group-onsemi 0:098463de4c5d 2694 q31_t * pDst,
group-onsemi 0:098463de4c5d 2695 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2696
group-onsemi 0:098463de4c5d 2697 /**
group-onsemi 0:098463de4c5d 2698 * @brief Q7 vector absolute value.
group-onsemi 0:098463de4c5d 2699 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 2700 * @param[out] *pDst points to the output buffer
group-onsemi 0:098463de4c5d 2701 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2702 * @return none.
group-onsemi 0:098463de4c5d 2703 */
group-onsemi 0:098463de4c5d 2704
group-onsemi 0:098463de4c5d 2705 void arm_abs_q7(
group-onsemi 0:098463de4c5d 2706 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2707 q7_t * pDst,
group-onsemi 0:098463de4c5d 2708 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2709
group-onsemi 0:098463de4c5d 2710 /**
group-onsemi 0:098463de4c5d 2711 * @brief Floating-point vector absolute value.
group-onsemi 0:098463de4c5d 2712 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 2713 * @param[out] *pDst points to the output buffer
group-onsemi 0:098463de4c5d 2714 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2715 * @return none.
group-onsemi 0:098463de4c5d 2716 */
group-onsemi 0:098463de4c5d 2717
group-onsemi 0:098463de4c5d 2718 void arm_abs_f32(
group-onsemi 0:098463de4c5d 2719 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2720 float32_t * pDst,
group-onsemi 0:098463de4c5d 2721 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2722
group-onsemi 0:098463de4c5d 2723 /**
group-onsemi 0:098463de4c5d 2724 * @brief Q15 vector absolute value.
group-onsemi 0:098463de4c5d 2725 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 2726 * @param[out] *pDst points to the output buffer
group-onsemi 0:098463de4c5d 2727 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2728 * @return none.
group-onsemi 0:098463de4c5d 2729 */
group-onsemi 0:098463de4c5d 2730
group-onsemi 0:098463de4c5d 2731 void arm_abs_q15(
group-onsemi 0:098463de4c5d 2732 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2733 q15_t * pDst,
group-onsemi 0:098463de4c5d 2734 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2735
group-onsemi 0:098463de4c5d 2736 /**
group-onsemi 0:098463de4c5d 2737 * @brief Q31 vector absolute value.
group-onsemi 0:098463de4c5d 2738 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 2739 * @param[out] *pDst points to the output buffer
group-onsemi 0:098463de4c5d 2740 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2741 * @return none.
group-onsemi 0:098463de4c5d 2742 */
group-onsemi 0:098463de4c5d 2743
group-onsemi 0:098463de4c5d 2744 void arm_abs_q31(
group-onsemi 0:098463de4c5d 2745 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2746 q31_t * pDst,
group-onsemi 0:098463de4c5d 2747 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2748
group-onsemi 0:098463de4c5d 2749 /**
group-onsemi 0:098463de4c5d 2750 * @brief Dot product of floating-point vectors.
group-onsemi 0:098463de4c5d 2751 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2752 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2753 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2754 * @param[out] *result output result returned here
group-onsemi 0:098463de4c5d 2755 * @return none.
group-onsemi 0:098463de4c5d 2756 */
group-onsemi 0:098463de4c5d 2757
group-onsemi 0:098463de4c5d 2758 void arm_dot_prod_f32(
group-onsemi 0:098463de4c5d 2759 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 2760 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 2761 uint32_t blockSize,
group-onsemi 0:098463de4c5d 2762 float32_t * result);
group-onsemi 0:098463de4c5d 2763
group-onsemi 0:098463de4c5d 2764 /**
group-onsemi 0:098463de4c5d 2765 * @brief Dot product of Q7 vectors.
group-onsemi 0:098463de4c5d 2766 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2767 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2768 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2769 * @param[out] *result output result returned here
group-onsemi 0:098463de4c5d 2770 * @return none.
group-onsemi 0:098463de4c5d 2771 */
group-onsemi 0:098463de4c5d 2772
group-onsemi 0:098463de4c5d 2773 void arm_dot_prod_q7(
group-onsemi 0:098463de4c5d 2774 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 2775 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 2776 uint32_t blockSize,
group-onsemi 0:098463de4c5d 2777 q31_t * result);
group-onsemi 0:098463de4c5d 2778
group-onsemi 0:098463de4c5d 2779 /**
group-onsemi 0:098463de4c5d 2780 * @brief Dot product of Q15 vectors.
group-onsemi 0:098463de4c5d 2781 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2782 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2783 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2784 * @param[out] *result output result returned here
group-onsemi 0:098463de4c5d 2785 * @return none.
group-onsemi 0:098463de4c5d 2786 */
group-onsemi 0:098463de4c5d 2787
group-onsemi 0:098463de4c5d 2788 void arm_dot_prod_q15(
group-onsemi 0:098463de4c5d 2789 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 2790 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 2791 uint32_t blockSize,
group-onsemi 0:098463de4c5d 2792 q63_t * result);
group-onsemi 0:098463de4c5d 2793
group-onsemi 0:098463de4c5d 2794 /**
group-onsemi 0:098463de4c5d 2795 * @brief Dot product of Q31 vectors.
group-onsemi 0:098463de4c5d 2796 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 2797 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 2798 * @param[in] blockSize number of samples in each vector
group-onsemi 0:098463de4c5d 2799 * @param[out] *result output result returned here
group-onsemi 0:098463de4c5d 2800 * @return none.
group-onsemi 0:098463de4c5d 2801 */
group-onsemi 0:098463de4c5d 2802
group-onsemi 0:098463de4c5d 2803 void arm_dot_prod_q31(
group-onsemi 0:098463de4c5d 2804 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 2805 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 2806 uint32_t blockSize,
group-onsemi 0:098463de4c5d 2807 q63_t * result);
group-onsemi 0:098463de4c5d 2808
group-onsemi 0:098463de4c5d 2809 /**
group-onsemi 0:098463de4c5d 2810 * @brief Shifts the elements of a Q7 vector a specified number of bits.
group-onsemi 0:098463de4c5d 2811 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2812 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
group-onsemi 0:098463de4c5d 2813 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2814 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2815 * @return none.
group-onsemi 0:098463de4c5d 2816 */
group-onsemi 0:098463de4c5d 2817
group-onsemi 0:098463de4c5d 2818 void arm_shift_q7(
group-onsemi 0:098463de4c5d 2819 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2820 int8_t shiftBits,
group-onsemi 0:098463de4c5d 2821 q7_t * pDst,
group-onsemi 0:098463de4c5d 2822 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2823
group-onsemi 0:098463de4c5d 2824 /**
group-onsemi 0:098463de4c5d 2825 * @brief Shifts the elements of a Q15 vector a specified number of bits.
group-onsemi 0:098463de4c5d 2826 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2827 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
group-onsemi 0:098463de4c5d 2828 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2829 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2830 * @return none.
group-onsemi 0:098463de4c5d 2831 */
group-onsemi 0:098463de4c5d 2832
group-onsemi 0:098463de4c5d 2833 void arm_shift_q15(
group-onsemi 0:098463de4c5d 2834 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2835 int8_t shiftBits,
group-onsemi 0:098463de4c5d 2836 q15_t * pDst,
group-onsemi 0:098463de4c5d 2837 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2838
group-onsemi 0:098463de4c5d 2839 /**
group-onsemi 0:098463de4c5d 2840 * @brief Shifts the elements of a Q31 vector a specified number of bits.
group-onsemi 0:098463de4c5d 2841 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2842 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
group-onsemi 0:098463de4c5d 2843 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2844 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2845 * @return none.
group-onsemi 0:098463de4c5d 2846 */
group-onsemi 0:098463de4c5d 2847
group-onsemi 0:098463de4c5d 2848 void arm_shift_q31(
group-onsemi 0:098463de4c5d 2849 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2850 int8_t shiftBits,
group-onsemi 0:098463de4c5d 2851 q31_t * pDst,
group-onsemi 0:098463de4c5d 2852 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2853
group-onsemi 0:098463de4c5d 2854 /**
group-onsemi 0:098463de4c5d 2855 * @brief Adds a constant offset to a floating-point vector.
group-onsemi 0:098463de4c5d 2856 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2857 * @param[in] offset is the offset to be added
group-onsemi 0:098463de4c5d 2858 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2859 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2860 * @return none.
group-onsemi 0:098463de4c5d 2861 */
group-onsemi 0:098463de4c5d 2862
group-onsemi 0:098463de4c5d 2863 void arm_offset_f32(
group-onsemi 0:098463de4c5d 2864 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2865 float32_t offset,
group-onsemi 0:098463de4c5d 2866 float32_t * pDst,
group-onsemi 0:098463de4c5d 2867 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2868
group-onsemi 0:098463de4c5d 2869 /**
group-onsemi 0:098463de4c5d 2870 * @brief Adds a constant offset to a Q7 vector.
group-onsemi 0:098463de4c5d 2871 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2872 * @param[in] offset is the offset to be added
group-onsemi 0:098463de4c5d 2873 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2874 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2875 * @return none.
group-onsemi 0:098463de4c5d 2876 */
group-onsemi 0:098463de4c5d 2877
group-onsemi 0:098463de4c5d 2878 void arm_offset_q7(
group-onsemi 0:098463de4c5d 2879 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2880 q7_t offset,
group-onsemi 0:098463de4c5d 2881 q7_t * pDst,
group-onsemi 0:098463de4c5d 2882 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2883
group-onsemi 0:098463de4c5d 2884 /**
group-onsemi 0:098463de4c5d 2885 * @brief Adds a constant offset to a Q15 vector.
group-onsemi 0:098463de4c5d 2886 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2887 * @param[in] offset is the offset to be added
group-onsemi 0:098463de4c5d 2888 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2889 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2890 * @return none.
group-onsemi 0:098463de4c5d 2891 */
group-onsemi 0:098463de4c5d 2892
group-onsemi 0:098463de4c5d 2893 void arm_offset_q15(
group-onsemi 0:098463de4c5d 2894 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2895 q15_t offset,
group-onsemi 0:098463de4c5d 2896 q15_t * pDst,
group-onsemi 0:098463de4c5d 2897 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2898
group-onsemi 0:098463de4c5d 2899 /**
group-onsemi 0:098463de4c5d 2900 * @brief Adds a constant offset to a Q31 vector.
group-onsemi 0:098463de4c5d 2901 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2902 * @param[in] offset is the offset to be added
group-onsemi 0:098463de4c5d 2903 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2904 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2905 * @return none.
group-onsemi 0:098463de4c5d 2906 */
group-onsemi 0:098463de4c5d 2907
group-onsemi 0:098463de4c5d 2908 void arm_offset_q31(
group-onsemi 0:098463de4c5d 2909 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2910 q31_t offset,
group-onsemi 0:098463de4c5d 2911 q31_t * pDst,
group-onsemi 0:098463de4c5d 2912 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2913
group-onsemi 0:098463de4c5d 2914 /**
group-onsemi 0:098463de4c5d 2915 * @brief Negates the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 2916 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2917 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2918 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2919 * @return none.
group-onsemi 0:098463de4c5d 2920 */
group-onsemi 0:098463de4c5d 2921
group-onsemi 0:098463de4c5d 2922 void arm_negate_f32(
group-onsemi 0:098463de4c5d 2923 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2924 float32_t * pDst,
group-onsemi 0:098463de4c5d 2925 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2926
group-onsemi 0:098463de4c5d 2927 /**
group-onsemi 0:098463de4c5d 2928 * @brief Negates the elements of a Q7 vector.
group-onsemi 0:098463de4c5d 2929 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2930 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2931 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2932 * @return none.
group-onsemi 0:098463de4c5d 2933 */
group-onsemi 0:098463de4c5d 2934
group-onsemi 0:098463de4c5d 2935 void arm_negate_q7(
group-onsemi 0:098463de4c5d 2936 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2937 q7_t * pDst,
group-onsemi 0:098463de4c5d 2938 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2939
group-onsemi 0:098463de4c5d 2940 /**
group-onsemi 0:098463de4c5d 2941 * @brief Negates the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 2942 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2943 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2944 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2945 * @return none.
group-onsemi 0:098463de4c5d 2946 */
group-onsemi 0:098463de4c5d 2947
group-onsemi 0:098463de4c5d 2948 void arm_negate_q15(
group-onsemi 0:098463de4c5d 2949 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2950 q15_t * pDst,
group-onsemi 0:098463de4c5d 2951 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2952
group-onsemi 0:098463de4c5d 2953 /**
group-onsemi 0:098463de4c5d 2954 * @brief Negates the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 2955 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 2956 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 2957 * @param[in] blockSize number of samples in the vector
group-onsemi 0:098463de4c5d 2958 * @return none.
group-onsemi 0:098463de4c5d 2959 */
group-onsemi 0:098463de4c5d 2960
group-onsemi 0:098463de4c5d 2961 void arm_negate_q31(
group-onsemi 0:098463de4c5d 2962 q31_t * pSrc,
group-onsemi 0:098463de4c5d 2963 q31_t * pDst,
group-onsemi 0:098463de4c5d 2964 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2965 /**
group-onsemi 0:098463de4c5d 2966 * @brief Copies the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 2967 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 2968 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 2969 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 2970 * @return none.
group-onsemi 0:098463de4c5d 2971 */
group-onsemi 0:098463de4c5d 2972 void arm_copy_f32(
group-onsemi 0:098463de4c5d 2973 float32_t * pSrc,
group-onsemi 0:098463de4c5d 2974 float32_t * pDst,
group-onsemi 0:098463de4c5d 2975 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2976
group-onsemi 0:098463de4c5d 2977 /**
group-onsemi 0:098463de4c5d 2978 * @brief Copies the elements of a Q7 vector.
group-onsemi 0:098463de4c5d 2979 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 2980 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 2981 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 2982 * @return none.
group-onsemi 0:098463de4c5d 2983 */
group-onsemi 0:098463de4c5d 2984 void arm_copy_q7(
group-onsemi 0:098463de4c5d 2985 q7_t * pSrc,
group-onsemi 0:098463de4c5d 2986 q7_t * pDst,
group-onsemi 0:098463de4c5d 2987 uint32_t blockSize);
group-onsemi 0:098463de4c5d 2988
group-onsemi 0:098463de4c5d 2989 /**
group-onsemi 0:098463de4c5d 2990 * @brief Copies the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 2991 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 2992 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 2993 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 2994 * @return none.
group-onsemi 0:098463de4c5d 2995 */
group-onsemi 0:098463de4c5d 2996 void arm_copy_q15(
group-onsemi 0:098463de4c5d 2997 q15_t * pSrc,
group-onsemi 0:098463de4c5d 2998 q15_t * pDst,
group-onsemi 0:098463de4c5d 2999 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3000
group-onsemi 0:098463de4c5d 3001 /**
group-onsemi 0:098463de4c5d 3002 * @brief Copies the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 3003 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 3004 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 3005 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 3006 * @return none.
group-onsemi 0:098463de4c5d 3007 */
group-onsemi 0:098463de4c5d 3008 void arm_copy_q31(
group-onsemi 0:098463de4c5d 3009 q31_t * pSrc,
group-onsemi 0:098463de4c5d 3010 q31_t * pDst,
group-onsemi 0:098463de4c5d 3011 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3012 /**
group-onsemi 0:098463de4c5d 3013 * @brief Fills a constant value into a floating-point vector.
group-onsemi 0:098463de4c5d 3014 * @param[in] value input value to be filled
group-onsemi 0:098463de4c5d 3015 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 3016 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 3017 * @return none.
group-onsemi 0:098463de4c5d 3018 */
group-onsemi 0:098463de4c5d 3019 void arm_fill_f32(
group-onsemi 0:098463de4c5d 3020 float32_t value,
group-onsemi 0:098463de4c5d 3021 float32_t * pDst,
group-onsemi 0:098463de4c5d 3022 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3023
group-onsemi 0:098463de4c5d 3024 /**
group-onsemi 0:098463de4c5d 3025 * @brief Fills a constant value into a Q7 vector.
group-onsemi 0:098463de4c5d 3026 * @param[in] value input value to be filled
group-onsemi 0:098463de4c5d 3027 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 3028 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 3029 * @return none.
group-onsemi 0:098463de4c5d 3030 */
group-onsemi 0:098463de4c5d 3031 void arm_fill_q7(
group-onsemi 0:098463de4c5d 3032 q7_t value,
group-onsemi 0:098463de4c5d 3033 q7_t * pDst,
group-onsemi 0:098463de4c5d 3034 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3035
group-onsemi 0:098463de4c5d 3036 /**
group-onsemi 0:098463de4c5d 3037 * @brief Fills a constant value into a Q15 vector.
group-onsemi 0:098463de4c5d 3038 * @param[in] value input value to be filled
group-onsemi 0:098463de4c5d 3039 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 3040 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 3041 * @return none.
group-onsemi 0:098463de4c5d 3042 */
group-onsemi 0:098463de4c5d 3043 void arm_fill_q15(
group-onsemi 0:098463de4c5d 3044 q15_t value,
group-onsemi 0:098463de4c5d 3045 q15_t * pDst,
group-onsemi 0:098463de4c5d 3046 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3047
group-onsemi 0:098463de4c5d 3048 /**
group-onsemi 0:098463de4c5d 3049 * @brief Fills a constant value into a Q31 vector.
group-onsemi 0:098463de4c5d 3050 * @param[in] value input value to be filled
group-onsemi 0:098463de4c5d 3051 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 3052 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 3053 * @return none.
group-onsemi 0:098463de4c5d 3054 */
group-onsemi 0:098463de4c5d 3055 void arm_fill_q31(
group-onsemi 0:098463de4c5d 3056 q31_t value,
group-onsemi 0:098463de4c5d 3057 q31_t * pDst,
group-onsemi 0:098463de4c5d 3058 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3059
group-onsemi 0:098463de4c5d 3060 /**
group-onsemi 0:098463de4c5d 3061 * @brief Convolution of floating-point sequences.
group-onsemi 0:098463de4c5d 3062 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3063 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3064 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3065 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3066 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3067 * @return none.
group-onsemi 0:098463de4c5d 3068 */
group-onsemi 0:098463de4c5d 3069
group-onsemi 0:098463de4c5d 3070 void arm_conv_f32(
group-onsemi 0:098463de4c5d 3071 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 3072 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3073 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 3074 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3075 float32_t * pDst);
group-onsemi 0:098463de4c5d 3076
group-onsemi 0:098463de4c5d 3077
group-onsemi 0:098463de4c5d 3078 /**
group-onsemi 0:098463de4c5d 3079 * @brief Convolution of Q15 sequences.
group-onsemi 0:098463de4c5d 3080 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3081 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3082 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3083 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3084 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3085 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3086 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3087 * @return none.
group-onsemi 0:098463de4c5d 3088 */
group-onsemi 0:098463de4c5d 3089
group-onsemi 0:098463de4c5d 3090
group-onsemi 0:098463de4c5d 3091 void arm_conv_opt_q15(
group-onsemi 0:098463de4c5d 3092 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3093 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3094 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3095 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3096 q15_t * pDst,
group-onsemi 0:098463de4c5d 3097 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3098 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3099
group-onsemi 0:098463de4c5d 3100
group-onsemi 0:098463de4c5d 3101 /**
group-onsemi 0:098463de4c5d 3102 * @brief Convolution of Q15 sequences.
group-onsemi 0:098463de4c5d 3103 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3104 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3105 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3106 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3107 * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3108 * @return none.
group-onsemi 0:098463de4c5d 3109 */
group-onsemi 0:098463de4c5d 3110
group-onsemi 0:098463de4c5d 3111 void arm_conv_q15(
group-onsemi 0:098463de4c5d 3112 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3113 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3114 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3115 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3116 q15_t * pDst);
group-onsemi 0:098463de4c5d 3117
group-onsemi 0:098463de4c5d 3118 /**
group-onsemi 0:098463de4c5d 3119 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3120 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3121 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3122 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3123 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3124 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3125 * @return none.
group-onsemi 0:098463de4c5d 3126 */
group-onsemi 0:098463de4c5d 3127
group-onsemi 0:098463de4c5d 3128 void arm_conv_fast_q15(
group-onsemi 0:098463de4c5d 3129 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3130 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3131 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3132 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3133 q15_t * pDst);
group-onsemi 0:098463de4c5d 3134
group-onsemi 0:098463de4c5d 3135 /**
group-onsemi 0:098463de4c5d 3136 * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3137 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3138 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3139 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3140 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3141 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3142 * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3143 * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3144 * @return none.
group-onsemi 0:098463de4c5d 3145 */
group-onsemi 0:098463de4c5d 3146
group-onsemi 0:098463de4c5d 3147 void arm_conv_fast_opt_q15(
group-onsemi 0:098463de4c5d 3148 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3149 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3150 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3151 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3152 q15_t * pDst,
group-onsemi 0:098463de4c5d 3153 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3154 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3155
group-onsemi 0:098463de4c5d 3156
group-onsemi 0:098463de4c5d 3157
group-onsemi 0:098463de4c5d 3158 /**
group-onsemi 0:098463de4c5d 3159 * @brief Convolution of Q31 sequences.
group-onsemi 0:098463de4c5d 3160 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3161 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3162 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3163 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3164 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3165 * @return none.
group-onsemi 0:098463de4c5d 3166 */
group-onsemi 0:098463de4c5d 3167
group-onsemi 0:098463de4c5d 3168 void arm_conv_q31(
group-onsemi 0:098463de4c5d 3169 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 3170 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3171 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 3172 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3173 q31_t * pDst);
group-onsemi 0:098463de4c5d 3174
group-onsemi 0:098463de4c5d 3175 /**
group-onsemi 0:098463de4c5d 3176 * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3177 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3178 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3179 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3180 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3181 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3182 * @return none.
group-onsemi 0:098463de4c5d 3183 */
group-onsemi 0:098463de4c5d 3184
group-onsemi 0:098463de4c5d 3185 void arm_conv_fast_q31(
group-onsemi 0:098463de4c5d 3186 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 3187 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3188 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 3189 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3190 q31_t * pDst);
group-onsemi 0:098463de4c5d 3191
group-onsemi 0:098463de4c5d 3192
group-onsemi 0:098463de4c5d 3193 /**
group-onsemi 0:098463de4c5d 3194 * @brief Convolution of Q7 sequences.
group-onsemi 0:098463de4c5d 3195 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3196 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3197 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3198 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3199 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3200 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3201 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3202 * @return none.
group-onsemi 0:098463de4c5d 3203 */
group-onsemi 0:098463de4c5d 3204
group-onsemi 0:098463de4c5d 3205 void arm_conv_opt_q7(
group-onsemi 0:098463de4c5d 3206 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 3207 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3208 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 3209 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3210 q7_t * pDst,
group-onsemi 0:098463de4c5d 3211 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3212 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3213
group-onsemi 0:098463de4c5d 3214
group-onsemi 0:098463de4c5d 3215
group-onsemi 0:098463de4c5d 3216 /**
group-onsemi 0:098463de4c5d 3217 * @brief Convolution of Q7 sequences.
group-onsemi 0:098463de4c5d 3218 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3219 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3220 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3221 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3222 * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1.
group-onsemi 0:098463de4c5d 3223 * @return none.
group-onsemi 0:098463de4c5d 3224 */
group-onsemi 0:098463de4c5d 3225
group-onsemi 0:098463de4c5d 3226 void arm_conv_q7(
group-onsemi 0:098463de4c5d 3227 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 3228 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3229 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 3230 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3231 q7_t * pDst);
group-onsemi 0:098463de4c5d 3232
group-onsemi 0:098463de4c5d 3233
group-onsemi 0:098463de4c5d 3234 /**
group-onsemi 0:098463de4c5d 3235 * @brief Partial convolution of floating-point sequences.
group-onsemi 0:098463de4c5d 3236 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3237 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3238 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3239 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3240 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3241 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3242 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3243 * @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].
group-onsemi 0:098463de4c5d 3244 */
group-onsemi 0:098463de4c5d 3245
group-onsemi 0:098463de4c5d 3246 arm_status arm_conv_partial_f32(
group-onsemi 0:098463de4c5d 3247 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 3248 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3249 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 3250 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3251 float32_t * pDst,
group-onsemi 0:098463de4c5d 3252 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3253 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3254
group-onsemi 0:098463de4c5d 3255 /**
group-onsemi 0:098463de4c5d 3256 * @brief Partial convolution of Q15 sequences.
group-onsemi 0:098463de4c5d 3257 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3258 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3259 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3260 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3261 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3262 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3263 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3264 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3265 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3266 * @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].
group-onsemi 0:098463de4c5d 3267 */
group-onsemi 0:098463de4c5d 3268
group-onsemi 0:098463de4c5d 3269 arm_status arm_conv_partial_opt_q15(
group-onsemi 0:098463de4c5d 3270 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3271 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3272 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3273 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3274 q15_t * pDst,
group-onsemi 0:098463de4c5d 3275 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3276 uint32_t numPoints,
group-onsemi 0:098463de4c5d 3277 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3278 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3279
group-onsemi 0:098463de4c5d 3280
group-onsemi 0:098463de4c5d 3281 /**
group-onsemi 0:098463de4c5d 3282 * @brief Partial convolution of Q15 sequences.
group-onsemi 0:098463de4c5d 3283 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3284 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3285 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3286 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3287 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3288 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3289 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3290 * @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].
group-onsemi 0:098463de4c5d 3291 */
group-onsemi 0:098463de4c5d 3292
group-onsemi 0:098463de4c5d 3293 arm_status arm_conv_partial_q15(
group-onsemi 0:098463de4c5d 3294 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3295 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3296 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3297 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3298 q15_t * pDst,
group-onsemi 0:098463de4c5d 3299 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3300 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3301
group-onsemi 0:098463de4c5d 3302 /**
group-onsemi 0:098463de4c5d 3303 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3304 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3305 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3306 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3307 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3308 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3309 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3310 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3311 * @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].
group-onsemi 0:098463de4c5d 3312 */
group-onsemi 0:098463de4c5d 3313
group-onsemi 0:098463de4c5d 3314 arm_status arm_conv_partial_fast_q15(
group-onsemi 0:098463de4c5d 3315 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3316 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3317 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3318 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3319 q15_t * pDst,
group-onsemi 0:098463de4c5d 3320 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3321 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3322
group-onsemi 0:098463de4c5d 3323
group-onsemi 0:098463de4c5d 3324 /**
group-onsemi 0:098463de4c5d 3325 * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3326 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3327 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3328 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3329 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3330 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3331 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3332 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3333 * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3334 * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3335 * @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].
group-onsemi 0:098463de4c5d 3336 */
group-onsemi 0:098463de4c5d 3337
group-onsemi 0:098463de4c5d 3338 arm_status arm_conv_partial_fast_opt_q15(
group-onsemi 0:098463de4c5d 3339 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 3340 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3341 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 3342 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3343 q15_t * pDst,
group-onsemi 0:098463de4c5d 3344 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3345 uint32_t numPoints,
group-onsemi 0:098463de4c5d 3346 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3347 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3348
group-onsemi 0:098463de4c5d 3349
group-onsemi 0:098463de4c5d 3350 /**
group-onsemi 0:098463de4c5d 3351 * @brief Partial convolution of Q31 sequences.
group-onsemi 0:098463de4c5d 3352 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3353 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3354 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3355 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3356 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3357 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3358 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3359 * @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].
group-onsemi 0:098463de4c5d 3360 */
group-onsemi 0:098463de4c5d 3361
group-onsemi 0:098463de4c5d 3362 arm_status arm_conv_partial_q31(
group-onsemi 0:098463de4c5d 3363 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 3364 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3365 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 3366 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3367 q31_t * pDst,
group-onsemi 0:098463de4c5d 3368 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3369 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3370
group-onsemi 0:098463de4c5d 3371
group-onsemi 0:098463de4c5d 3372 /**
group-onsemi 0:098463de4c5d 3373 * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 3374 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3375 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3376 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3377 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3378 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3379 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3380 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3381 * @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].
group-onsemi 0:098463de4c5d 3382 */
group-onsemi 0:098463de4c5d 3383
group-onsemi 0:098463de4c5d 3384 arm_status arm_conv_partial_fast_q31(
group-onsemi 0:098463de4c5d 3385 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 3386 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3387 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 3388 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3389 q31_t * pDst,
group-onsemi 0:098463de4c5d 3390 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3391 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3392
group-onsemi 0:098463de4c5d 3393
group-onsemi 0:098463de4c5d 3394 /**
group-onsemi 0:098463de4c5d 3395 * @brief Partial convolution of Q7 sequences
group-onsemi 0:098463de4c5d 3396 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3397 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3398 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3399 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3400 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3401 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3402 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3403 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 3404 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 3405 * @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].
group-onsemi 0:098463de4c5d 3406 */
group-onsemi 0:098463de4c5d 3407
group-onsemi 0:098463de4c5d 3408 arm_status arm_conv_partial_opt_q7(
group-onsemi 0:098463de4c5d 3409 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 3410 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3411 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 3412 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3413 q7_t * pDst,
group-onsemi 0:098463de4c5d 3414 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3415 uint32_t numPoints,
group-onsemi 0:098463de4c5d 3416 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 3417 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 3418
group-onsemi 0:098463de4c5d 3419
group-onsemi 0:098463de4c5d 3420 /**
group-onsemi 0:098463de4c5d 3421 * @brief Partial convolution of Q7 sequences.
group-onsemi 0:098463de4c5d 3422 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 3423 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 3424 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 3425 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 3426 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3427 * @param[in] firstIndex is the first output sample to start with.
group-onsemi 0:098463de4c5d 3428 * @param[in] numPoints is the number of output points to be computed.
group-onsemi 0:098463de4c5d 3429 * @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].
group-onsemi 0:098463de4c5d 3430 */
group-onsemi 0:098463de4c5d 3431
group-onsemi 0:098463de4c5d 3432 arm_status arm_conv_partial_q7(
group-onsemi 0:098463de4c5d 3433 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 3434 uint32_t srcALen,
group-onsemi 0:098463de4c5d 3435 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 3436 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 3437 q7_t * pDst,
group-onsemi 0:098463de4c5d 3438 uint32_t firstIndex,
group-onsemi 0:098463de4c5d 3439 uint32_t numPoints);
group-onsemi 0:098463de4c5d 3440
group-onsemi 0:098463de4c5d 3441
group-onsemi 0:098463de4c5d 3442
group-onsemi 0:098463de4c5d 3443 /**
group-onsemi 0:098463de4c5d 3444 * @brief Instance structure for the Q15 FIR decimator.
group-onsemi 0:098463de4c5d 3445 */
group-onsemi 0:098463de4c5d 3446
group-onsemi 0:098463de4c5d 3447 typedef struct
group-onsemi 0:098463de4c5d 3448 {
group-onsemi 0:098463de4c5d 3449 uint8_t M; /**< decimation factor. */
group-onsemi 0:098463de4c5d 3450 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 3451 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 3452 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 3453 } arm_fir_decimate_instance_q15;
group-onsemi 0:098463de4c5d 3454
group-onsemi 0:098463de4c5d 3455 /**
group-onsemi 0:098463de4c5d 3456 * @brief Instance structure for the Q31 FIR decimator.
group-onsemi 0:098463de4c5d 3457 */
group-onsemi 0:098463de4c5d 3458
group-onsemi 0:098463de4c5d 3459 typedef struct
group-onsemi 0:098463de4c5d 3460 {
group-onsemi 0:098463de4c5d 3461 uint8_t M; /**< decimation factor. */
group-onsemi 0:098463de4c5d 3462 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 3463 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 3464 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 3465
group-onsemi 0:098463de4c5d 3466 } arm_fir_decimate_instance_q31;
group-onsemi 0:098463de4c5d 3467
group-onsemi 0:098463de4c5d 3468 /**
group-onsemi 0:098463de4c5d 3469 * @brief Instance structure for the floating-point FIR decimator.
group-onsemi 0:098463de4c5d 3470 */
group-onsemi 0:098463de4c5d 3471
group-onsemi 0:098463de4c5d 3472 typedef struct
group-onsemi 0:098463de4c5d 3473 {
group-onsemi 0:098463de4c5d 3474 uint8_t M; /**< decimation factor. */
group-onsemi 0:098463de4c5d 3475 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 3476 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 3477 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 3478
group-onsemi 0:098463de4c5d 3479 } arm_fir_decimate_instance_f32;
group-onsemi 0:098463de4c5d 3480
group-onsemi 0:098463de4c5d 3481
group-onsemi 0:098463de4c5d 3482
group-onsemi 0:098463de4c5d 3483 /**
group-onsemi 0:098463de4c5d 3484 * @brief Processing function for the floating-point FIR decimator.
group-onsemi 0:098463de4c5d 3485 * @param[in] *S points to an instance of the floating-point FIR decimator structure.
group-onsemi 0:098463de4c5d 3486 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3487 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3488 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3489 * @return none
group-onsemi 0:098463de4c5d 3490 */
group-onsemi 0:098463de4c5d 3491
group-onsemi 0:098463de4c5d 3492 void arm_fir_decimate_f32(
group-onsemi 0:098463de4c5d 3493 const arm_fir_decimate_instance_f32 * S,
group-onsemi 0:098463de4c5d 3494 float32_t * pSrc,
group-onsemi 0:098463de4c5d 3495 float32_t * pDst,
group-onsemi 0:098463de4c5d 3496 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3497
group-onsemi 0:098463de4c5d 3498
group-onsemi 0:098463de4c5d 3499 /**
group-onsemi 0:098463de4c5d 3500 * @brief Initialization function for the floating-point FIR decimator.
group-onsemi 0:098463de4c5d 3501 * @param[in,out] *S points to an instance of the floating-point FIR decimator structure.
group-onsemi 0:098463de4c5d 3502 * @param[in] numTaps number of coefficients in the filter.
group-onsemi 0:098463de4c5d 3503 * @param[in] M decimation factor.
group-onsemi 0:098463de4c5d 3504 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3505 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3506 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3507 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3508 * <code>blockSize</code> is not a multiple of <code>M</code>.
group-onsemi 0:098463de4c5d 3509 */
group-onsemi 0:098463de4c5d 3510
group-onsemi 0:098463de4c5d 3511 arm_status arm_fir_decimate_init_f32(
group-onsemi 0:098463de4c5d 3512 arm_fir_decimate_instance_f32 * S,
group-onsemi 0:098463de4c5d 3513 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3514 uint8_t M,
group-onsemi 0:098463de4c5d 3515 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 3516 float32_t * pState,
group-onsemi 0:098463de4c5d 3517 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3518
group-onsemi 0:098463de4c5d 3519 /**
group-onsemi 0:098463de4c5d 3520 * @brief Processing function for the Q15 FIR decimator.
group-onsemi 0:098463de4c5d 3521 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
group-onsemi 0:098463de4c5d 3522 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3523 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3524 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3525 * @return none
group-onsemi 0:098463de4c5d 3526 */
group-onsemi 0:098463de4c5d 3527
group-onsemi 0:098463de4c5d 3528 void arm_fir_decimate_q15(
group-onsemi 0:098463de4c5d 3529 const arm_fir_decimate_instance_q15 * S,
group-onsemi 0:098463de4c5d 3530 q15_t * pSrc,
group-onsemi 0:098463de4c5d 3531 q15_t * pDst,
group-onsemi 0:098463de4c5d 3532 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3533
group-onsemi 0:098463de4c5d 3534 /**
group-onsemi 0:098463de4c5d 3535 * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 3536 * @param[in] *S points to an instance of the Q15 FIR decimator structure.
group-onsemi 0:098463de4c5d 3537 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3538 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3539 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3540 * @return none
group-onsemi 0:098463de4c5d 3541 */
group-onsemi 0:098463de4c5d 3542
group-onsemi 0:098463de4c5d 3543 void arm_fir_decimate_fast_q15(
group-onsemi 0:098463de4c5d 3544 const arm_fir_decimate_instance_q15 * S,
group-onsemi 0:098463de4c5d 3545 q15_t * pSrc,
group-onsemi 0:098463de4c5d 3546 q15_t * pDst,
group-onsemi 0:098463de4c5d 3547 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3548
group-onsemi 0:098463de4c5d 3549
group-onsemi 0:098463de4c5d 3550
group-onsemi 0:098463de4c5d 3551 /**
group-onsemi 0:098463de4c5d 3552 * @brief Initialization function for the Q15 FIR decimator.
group-onsemi 0:098463de4c5d 3553 * @param[in,out] *S points to an instance of the Q15 FIR decimator structure.
group-onsemi 0:098463de4c5d 3554 * @param[in] numTaps number of coefficients in the filter.
group-onsemi 0:098463de4c5d 3555 * @param[in] M decimation factor.
group-onsemi 0:098463de4c5d 3556 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3557 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3558 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3559 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3560 * <code>blockSize</code> is not a multiple of <code>M</code>.
group-onsemi 0:098463de4c5d 3561 */
group-onsemi 0:098463de4c5d 3562
group-onsemi 0:098463de4c5d 3563 arm_status arm_fir_decimate_init_q15(
group-onsemi 0:098463de4c5d 3564 arm_fir_decimate_instance_q15 * S,
group-onsemi 0:098463de4c5d 3565 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3566 uint8_t M,
group-onsemi 0:098463de4c5d 3567 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 3568 q15_t * pState,
group-onsemi 0:098463de4c5d 3569 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3570
group-onsemi 0:098463de4c5d 3571 /**
group-onsemi 0:098463de4c5d 3572 * @brief Processing function for the Q31 FIR decimator.
group-onsemi 0:098463de4c5d 3573 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
group-onsemi 0:098463de4c5d 3574 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3575 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3576 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3577 * @return none
group-onsemi 0:098463de4c5d 3578 */
group-onsemi 0:098463de4c5d 3579
group-onsemi 0:098463de4c5d 3580 void arm_fir_decimate_q31(
group-onsemi 0:098463de4c5d 3581 const arm_fir_decimate_instance_q31 * S,
group-onsemi 0:098463de4c5d 3582 q31_t * pSrc,
group-onsemi 0:098463de4c5d 3583 q31_t * pDst,
group-onsemi 0:098463de4c5d 3584 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3585
group-onsemi 0:098463de4c5d 3586 /**
group-onsemi 0:098463de4c5d 3587 * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 3588 * @param[in] *S points to an instance of the Q31 FIR decimator structure.
group-onsemi 0:098463de4c5d 3589 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3590 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3591 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3592 * @return none
group-onsemi 0:098463de4c5d 3593 */
group-onsemi 0:098463de4c5d 3594
group-onsemi 0:098463de4c5d 3595 void arm_fir_decimate_fast_q31(
group-onsemi 0:098463de4c5d 3596 arm_fir_decimate_instance_q31 * S,
group-onsemi 0:098463de4c5d 3597 q31_t * pSrc,
group-onsemi 0:098463de4c5d 3598 q31_t * pDst,
group-onsemi 0:098463de4c5d 3599 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3600
group-onsemi 0:098463de4c5d 3601
group-onsemi 0:098463de4c5d 3602 /**
group-onsemi 0:098463de4c5d 3603 * @brief Initialization function for the Q31 FIR decimator.
group-onsemi 0:098463de4c5d 3604 * @param[in,out] *S points to an instance of the Q31 FIR decimator structure.
group-onsemi 0:098463de4c5d 3605 * @param[in] numTaps number of coefficients in the filter.
group-onsemi 0:098463de4c5d 3606 * @param[in] M decimation factor.
group-onsemi 0:098463de4c5d 3607 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3608 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3609 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3610 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3611 * <code>blockSize</code> is not a multiple of <code>M</code>.
group-onsemi 0:098463de4c5d 3612 */
group-onsemi 0:098463de4c5d 3613
group-onsemi 0:098463de4c5d 3614 arm_status arm_fir_decimate_init_q31(
group-onsemi 0:098463de4c5d 3615 arm_fir_decimate_instance_q31 * S,
group-onsemi 0:098463de4c5d 3616 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3617 uint8_t M,
group-onsemi 0:098463de4c5d 3618 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 3619 q31_t * pState,
group-onsemi 0:098463de4c5d 3620 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3621
group-onsemi 0:098463de4c5d 3622
group-onsemi 0:098463de4c5d 3623
group-onsemi 0:098463de4c5d 3624 /**
group-onsemi 0:098463de4c5d 3625 * @brief Instance structure for the Q15 FIR interpolator.
group-onsemi 0:098463de4c5d 3626 */
group-onsemi 0:098463de4c5d 3627
group-onsemi 0:098463de4c5d 3628 typedef struct
group-onsemi 0:098463de4c5d 3629 {
group-onsemi 0:098463de4c5d 3630 uint8_t L; /**< upsample factor. */
group-onsemi 0:098463de4c5d 3631 uint16_t phaseLength; /**< length of each polyphase filter component. */
group-onsemi 0:098463de4c5d 3632 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
group-onsemi 0:098463de4c5d 3633 q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
group-onsemi 0:098463de4c5d 3634 } arm_fir_interpolate_instance_q15;
group-onsemi 0:098463de4c5d 3635
group-onsemi 0:098463de4c5d 3636 /**
group-onsemi 0:098463de4c5d 3637 * @brief Instance structure for the Q31 FIR interpolator.
group-onsemi 0:098463de4c5d 3638 */
group-onsemi 0:098463de4c5d 3639
group-onsemi 0:098463de4c5d 3640 typedef struct
group-onsemi 0:098463de4c5d 3641 {
group-onsemi 0:098463de4c5d 3642 uint8_t L; /**< upsample factor. */
group-onsemi 0:098463de4c5d 3643 uint16_t phaseLength; /**< length of each polyphase filter component. */
group-onsemi 0:098463de4c5d 3644 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
group-onsemi 0:098463de4c5d 3645 q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */
group-onsemi 0:098463de4c5d 3646 } arm_fir_interpolate_instance_q31;
group-onsemi 0:098463de4c5d 3647
group-onsemi 0:098463de4c5d 3648 /**
group-onsemi 0:098463de4c5d 3649 * @brief Instance structure for the floating-point FIR interpolator.
group-onsemi 0:098463de4c5d 3650 */
group-onsemi 0:098463de4c5d 3651
group-onsemi 0:098463de4c5d 3652 typedef struct
group-onsemi 0:098463de4c5d 3653 {
group-onsemi 0:098463de4c5d 3654 uint8_t L; /**< upsample factor. */
group-onsemi 0:098463de4c5d 3655 uint16_t phaseLength; /**< length of each polyphase filter component. */
group-onsemi 0:098463de4c5d 3656 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */
group-onsemi 0:098463de4c5d 3657 float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */
group-onsemi 0:098463de4c5d 3658 } arm_fir_interpolate_instance_f32;
group-onsemi 0:098463de4c5d 3659
group-onsemi 0:098463de4c5d 3660
group-onsemi 0:098463de4c5d 3661 /**
group-onsemi 0:098463de4c5d 3662 * @brief Processing function for the Q15 FIR interpolator.
group-onsemi 0:098463de4c5d 3663 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
group-onsemi 0:098463de4c5d 3664 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3665 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 3666 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3667 * @return none.
group-onsemi 0:098463de4c5d 3668 */
group-onsemi 0:098463de4c5d 3669
group-onsemi 0:098463de4c5d 3670 void arm_fir_interpolate_q15(
group-onsemi 0:098463de4c5d 3671 const arm_fir_interpolate_instance_q15 * S,
group-onsemi 0:098463de4c5d 3672 q15_t * pSrc,
group-onsemi 0:098463de4c5d 3673 q15_t * pDst,
group-onsemi 0:098463de4c5d 3674 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3675
group-onsemi 0:098463de4c5d 3676
group-onsemi 0:098463de4c5d 3677 /**
group-onsemi 0:098463de4c5d 3678 * @brief Initialization function for the Q15 FIR interpolator.
group-onsemi 0:098463de4c5d 3679 * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure.
group-onsemi 0:098463de4c5d 3680 * @param[in] L upsample factor.
group-onsemi 0:098463de4c5d 3681 * @param[in] numTaps number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 3682 * @param[in] *pCoeffs points to the filter coefficient buffer.
group-onsemi 0:098463de4c5d 3683 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3684 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3685 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3686 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
group-onsemi 0:098463de4c5d 3687 */
group-onsemi 0:098463de4c5d 3688
group-onsemi 0:098463de4c5d 3689 arm_status arm_fir_interpolate_init_q15(
group-onsemi 0:098463de4c5d 3690 arm_fir_interpolate_instance_q15 * S,
group-onsemi 0:098463de4c5d 3691 uint8_t L,
group-onsemi 0:098463de4c5d 3692 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3693 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 3694 q15_t * pState,
group-onsemi 0:098463de4c5d 3695 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3696
group-onsemi 0:098463de4c5d 3697 /**
group-onsemi 0:098463de4c5d 3698 * @brief Processing function for the Q31 FIR interpolator.
group-onsemi 0:098463de4c5d 3699 * @param[in] *S points to an instance of the Q15 FIR interpolator structure.
group-onsemi 0:098463de4c5d 3700 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3701 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 3702 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3703 * @return none.
group-onsemi 0:098463de4c5d 3704 */
group-onsemi 0:098463de4c5d 3705
group-onsemi 0:098463de4c5d 3706 void arm_fir_interpolate_q31(
group-onsemi 0:098463de4c5d 3707 const arm_fir_interpolate_instance_q31 * S,
group-onsemi 0:098463de4c5d 3708 q31_t * pSrc,
group-onsemi 0:098463de4c5d 3709 q31_t * pDst,
group-onsemi 0:098463de4c5d 3710 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3711
group-onsemi 0:098463de4c5d 3712 /**
group-onsemi 0:098463de4c5d 3713 * @brief Initialization function for the Q31 FIR interpolator.
group-onsemi 0:098463de4c5d 3714 * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure.
group-onsemi 0:098463de4c5d 3715 * @param[in] L upsample factor.
group-onsemi 0:098463de4c5d 3716 * @param[in] numTaps number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 3717 * @param[in] *pCoeffs points to the filter coefficient buffer.
group-onsemi 0:098463de4c5d 3718 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3719 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3720 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3721 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
group-onsemi 0:098463de4c5d 3722 */
group-onsemi 0:098463de4c5d 3723
group-onsemi 0:098463de4c5d 3724 arm_status arm_fir_interpolate_init_q31(
group-onsemi 0:098463de4c5d 3725 arm_fir_interpolate_instance_q31 * S,
group-onsemi 0:098463de4c5d 3726 uint8_t L,
group-onsemi 0:098463de4c5d 3727 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3728 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 3729 q31_t * pState,
group-onsemi 0:098463de4c5d 3730 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3731
group-onsemi 0:098463de4c5d 3732
group-onsemi 0:098463de4c5d 3733 /**
group-onsemi 0:098463de4c5d 3734 * @brief Processing function for the floating-point FIR interpolator.
group-onsemi 0:098463de4c5d 3735 * @param[in] *S points to an instance of the floating-point FIR interpolator structure.
group-onsemi 0:098463de4c5d 3736 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3737 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 3738 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3739 * @return none.
group-onsemi 0:098463de4c5d 3740 */
group-onsemi 0:098463de4c5d 3741
group-onsemi 0:098463de4c5d 3742 void arm_fir_interpolate_f32(
group-onsemi 0:098463de4c5d 3743 const arm_fir_interpolate_instance_f32 * S,
group-onsemi 0:098463de4c5d 3744 float32_t * pSrc,
group-onsemi 0:098463de4c5d 3745 float32_t * pDst,
group-onsemi 0:098463de4c5d 3746 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3747
group-onsemi 0:098463de4c5d 3748 /**
group-onsemi 0:098463de4c5d 3749 * @brief Initialization function for the floating-point FIR interpolator.
group-onsemi 0:098463de4c5d 3750 * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure.
group-onsemi 0:098463de4c5d 3751 * @param[in] L upsample factor.
group-onsemi 0:098463de4c5d 3752 * @param[in] numTaps number of filter coefficients in the filter.
group-onsemi 0:098463de4c5d 3753 * @param[in] *pCoeffs points to the filter coefficient buffer.
group-onsemi 0:098463de4c5d 3754 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3755 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 3756 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if
group-onsemi 0:098463de4c5d 3757 * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>.
group-onsemi 0:098463de4c5d 3758 */
group-onsemi 0:098463de4c5d 3759
group-onsemi 0:098463de4c5d 3760 arm_status arm_fir_interpolate_init_f32(
group-onsemi 0:098463de4c5d 3761 arm_fir_interpolate_instance_f32 * S,
group-onsemi 0:098463de4c5d 3762 uint8_t L,
group-onsemi 0:098463de4c5d 3763 uint16_t numTaps,
group-onsemi 0:098463de4c5d 3764 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 3765 float32_t * pState,
group-onsemi 0:098463de4c5d 3766 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3767
group-onsemi 0:098463de4c5d 3768 /**
group-onsemi 0:098463de4c5d 3769 * @brief Instance structure for the high precision Q31 Biquad cascade filter.
group-onsemi 0:098463de4c5d 3770 */
group-onsemi 0:098463de4c5d 3771
group-onsemi 0:098463de4c5d 3772 typedef struct
group-onsemi 0:098463de4c5d 3773 {
group-onsemi 0:098463de4c5d 3774 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 3775 q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
group-onsemi 0:098463de4c5d 3776 q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 3777 uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */
group-onsemi 0:098463de4c5d 3778
group-onsemi 0:098463de4c5d 3779 } arm_biquad_cas_df1_32x64_ins_q31;
group-onsemi 0:098463de4c5d 3780
group-onsemi 0:098463de4c5d 3781
group-onsemi 0:098463de4c5d 3782 /**
group-onsemi 0:098463de4c5d 3783 * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
group-onsemi 0:098463de4c5d 3784 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3785 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3786 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 3787 * @return none.
group-onsemi 0:098463de4c5d 3788 */
group-onsemi 0:098463de4c5d 3789
group-onsemi 0:098463de4c5d 3790 void arm_biquad_cas_df1_32x64_q31(
group-onsemi 0:098463de4c5d 3791 const arm_biquad_cas_df1_32x64_ins_q31 * S,
group-onsemi 0:098463de4c5d 3792 q31_t * pSrc,
group-onsemi 0:098463de4c5d 3793 q31_t * pDst,
group-onsemi 0:098463de4c5d 3794 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3795
group-onsemi 0:098463de4c5d 3796
group-onsemi 0:098463de4c5d 3797 /**
group-onsemi 0:098463de4c5d 3798 * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure.
group-onsemi 0:098463de4c5d 3799 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 3800 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3801 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3802 * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format
group-onsemi 0:098463de4c5d 3803 * @return none
group-onsemi 0:098463de4c5d 3804 */
group-onsemi 0:098463de4c5d 3805
group-onsemi 0:098463de4c5d 3806 void arm_biquad_cas_df1_32x64_init_q31(
group-onsemi 0:098463de4c5d 3807 arm_biquad_cas_df1_32x64_ins_q31 * S,
group-onsemi 0:098463de4c5d 3808 uint8_t numStages,
group-onsemi 0:098463de4c5d 3809 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 3810 q63_t * pState,
group-onsemi 0:098463de4c5d 3811 uint8_t postShift);
group-onsemi 0:098463de4c5d 3812
group-onsemi 0:098463de4c5d 3813
group-onsemi 0:098463de4c5d 3814
group-onsemi 0:098463de4c5d 3815 /**
group-onsemi 0:098463de4c5d 3816 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3817 */
group-onsemi 0:098463de4c5d 3818
group-onsemi 0:098463de4c5d 3819 typedef struct
group-onsemi 0:098463de4c5d 3820 {
group-onsemi 0:098463de4c5d 3821 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 3822 float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
group-onsemi 0:098463de4c5d 3823 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 3824 } arm_biquad_cascade_df2T_instance_f32;
group-onsemi 0:098463de4c5d 3825
group-onsemi 0:098463de4c5d 3826
group-onsemi 0:098463de4c5d 3827
group-onsemi 0:098463de4c5d 3828 /**
group-onsemi 0:098463de4c5d 3829 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3830 */
group-onsemi 0:098463de4c5d 3831
group-onsemi 0:098463de4c5d 3832 typedef struct
group-onsemi 0:098463de4c5d 3833 {
group-onsemi 0:098463de4c5d 3834 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 3835 float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */
group-onsemi 0:098463de4c5d 3836 float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 3837 } arm_biquad_cascade_stereo_df2T_instance_f32;
group-onsemi 0:098463de4c5d 3838
group-onsemi 0:098463de4c5d 3839
group-onsemi 0:098463de4c5d 3840
group-onsemi 0:098463de4c5d 3841 /**
group-onsemi 0:098463de4c5d 3842 * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3843 */
group-onsemi 0:098463de4c5d 3844
group-onsemi 0:098463de4c5d 3845 typedef struct
group-onsemi 0:098463de4c5d 3846 {
group-onsemi 0:098463de4c5d 3847 uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
group-onsemi 0:098463de4c5d 3848 float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */
group-onsemi 0:098463de4c5d 3849 float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */
group-onsemi 0:098463de4c5d 3850 } arm_biquad_cascade_df2T_instance_f64;
group-onsemi 0:098463de4c5d 3851
group-onsemi 0:098463de4c5d 3852
group-onsemi 0:098463de4c5d 3853 /**
group-onsemi 0:098463de4c5d 3854 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3855 * @param[in] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3856 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3857 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3858 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 3859 * @return none.
group-onsemi 0:098463de4c5d 3860 */
group-onsemi 0:098463de4c5d 3861
group-onsemi 0:098463de4c5d 3862 void arm_biquad_cascade_df2T_f32(
group-onsemi 0:098463de4c5d 3863 const arm_biquad_cascade_df2T_instance_f32 * S,
group-onsemi 0:098463de4c5d 3864 float32_t * pSrc,
group-onsemi 0:098463de4c5d 3865 float32_t * pDst,
group-onsemi 0:098463de4c5d 3866 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3867
group-onsemi 0:098463de4c5d 3868
group-onsemi 0:098463de4c5d 3869 /**
group-onsemi 0:098463de4c5d 3870 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels
group-onsemi 0:098463de4c5d 3871 * @param[in] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3872 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3873 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3874 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 3875 * @return none.
group-onsemi 0:098463de4c5d 3876 */
group-onsemi 0:098463de4c5d 3877
group-onsemi 0:098463de4c5d 3878 void arm_biquad_cascade_stereo_df2T_f32(
group-onsemi 0:098463de4c5d 3879 const arm_biquad_cascade_stereo_df2T_instance_f32 * S,
group-onsemi 0:098463de4c5d 3880 float32_t * pSrc,
group-onsemi 0:098463de4c5d 3881 float32_t * pDst,
group-onsemi 0:098463de4c5d 3882 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3883
group-onsemi 0:098463de4c5d 3884 /**
group-onsemi 0:098463de4c5d 3885 * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3886 * @param[in] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3887 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 3888 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 3889 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 3890 * @return none.
group-onsemi 0:098463de4c5d 3891 */
group-onsemi 0:098463de4c5d 3892
group-onsemi 0:098463de4c5d 3893 void arm_biquad_cascade_df2T_f64(
group-onsemi 0:098463de4c5d 3894 const arm_biquad_cascade_df2T_instance_f64 * S,
group-onsemi 0:098463de4c5d 3895 float64_t * pSrc,
group-onsemi 0:098463de4c5d 3896 float64_t * pDst,
group-onsemi 0:098463de4c5d 3897 uint32_t blockSize);
group-onsemi 0:098463de4c5d 3898
group-onsemi 0:098463de4c5d 3899
group-onsemi 0:098463de4c5d 3900 /**
group-onsemi 0:098463de4c5d 3901 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3902 * @param[in,out] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3903 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 3904 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3905 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3906 * @return none
group-onsemi 0:098463de4c5d 3907 */
group-onsemi 0:098463de4c5d 3908
group-onsemi 0:098463de4c5d 3909 void arm_biquad_cascade_df2T_init_f32(
group-onsemi 0:098463de4c5d 3910 arm_biquad_cascade_df2T_instance_f32 * S,
group-onsemi 0:098463de4c5d 3911 uint8_t numStages,
group-onsemi 0:098463de4c5d 3912 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 3913 float32_t * pState);
group-onsemi 0:098463de4c5d 3914
group-onsemi 0:098463de4c5d 3915
group-onsemi 0:098463de4c5d 3916 /**
group-onsemi 0:098463de4c5d 3917 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3918 * @param[in,out] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3919 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 3920 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3921 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3922 * @return none
group-onsemi 0:098463de4c5d 3923 */
group-onsemi 0:098463de4c5d 3924
group-onsemi 0:098463de4c5d 3925 void arm_biquad_cascade_stereo_df2T_init_f32(
group-onsemi 0:098463de4c5d 3926 arm_biquad_cascade_stereo_df2T_instance_f32 * S,
group-onsemi 0:098463de4c5d 3927 uint8_t numStages,
group-onsemi 0:098463de4c5d 3928 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 3929 float32_t * pState);
group-onsemi 0:098463de4c5d 3930
group-onsemi 0:098463de4c5d 3931
group-onsemi 0:098463de4c5d 3932 /**
group-onsemi 0:098463de4c5d 3933 * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter.
group-onsemi 0:098463de4c5d 3934 * @param[in,out] *S points to an instance of the filter data structure.
group-onsemi 0:098463de4c5d 3935 * @param[in] numStages number of 2nd order stages in the filter.
group-onsemi 0:098463de4c5d 3936 * @param[in] *pCoeffs points to the filter coefficients.
group-onsemi 0:098463de4c5d 3937 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 3938 * @return none
group-onsemi 0:098463de4c5d 3939 */
group-onsemi 0:098463de4c5d 3940
group-onsemi 0:098463de4c5d 3941 void arm_biquad_cascade_df2T_init_f64(
group-onsemi 0:098463de4c5d 3942 arm_biquad_cascade_df2T_instance_f64 * S,
group-onsemi 0:098463de4c5d 3943 uint8_t numStages,
group-onsemi 0:098463de4c5d 3944 float64_t * pCoeffs,
group-onsemi 0:098463de4c5d 3945 float64_t * pState);
group-onsemi 0:098463de4c5d 3946
group-onsemi 0:098463de4c5d 3947
group-onsemi 0:098463de4c5d 3948
group-onsemi 0:098463de4c5d 3949 /**
group-onsemi 0:098463de4c5d 3950 * @brief Instance structure for the Q15 FIR lattice filter.
group-onsemi 0:098463de4c5d 3951 */
group-onsemi 0:098463de4c5d 3952
group-onsemi 0:098463de4c5d 3953 typedef struct
group-onsemi 0:098463de4c5d 3954 {
group-onsemi 0:098463de4c5d 3955 uint16_t numStages; /**< number of filter stages. */
group-onsemi 0:098463de4c5d 3956 q15_t *pState; /**< points to the state variable array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3957 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3958 } arm_fir_lattice_instance_q15;
group-onsemi 0:098463de4c5d 3959
group-onsemi 0:098463de4c5d 3960 /**
group-onsemi 0:098463de4c5d 3961 * @brief Instance structure for the Q31 FIR lattice filter.
group-onsemi 0:098463de4c5d 3962 */
group-onsemi 0:098463de4c5d 3963
group-onsemi 0:098463de4c5d 3964 typedef struct
group-onsemi 0:098463de4c5d 3965 {
group-onsemi 0:098463de4c5d 3966 uint16_t numStages; /**< number of filter stages. */
group-onsemi 0:098463de4c5d 3967 q31_t *pState; /**< points to the state variable array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3968 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3969 } arm_fir_lattice_instance_q31;
group-onsemi 0:098463de4c5d 3970
group-onsemi 0:098463de4c5d 3971 /**
group-onsemi 0:098463de4c5d 3972 * @brief Instance structure for the floating-point FIR lattice filter.
group-onsemi 0:098463de4c5d 3973 */
group-onsemi 0:098463de4c5d 3974
group-onsemi 0:098463de4c5d 3975 typedef struct
group-onsemi 0:098463de4c5d 3976 {
group-onsemi 0:098463de4c5d 3977 uint16_t numStages; /**< number of filter stages. */
group-onsemi 0:098463de4c5d 3978 float32_t *pState; /**< points to the state variable array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3979 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 3980 } arm_fir_lattice_instance_f32;
group-onsemi 0:098463de4c5d 3981
group-onsemi 0:098463de4c5d 3982 /**
group-onsemi 0:098463de4c5d 3983 * @brief Initialization function for the Q15 FIR lattice filter.
group-onsemi 0:098463de4c5d 3984 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
group-onsemi 0:098463de4c5d 3985 * @param[in] numStages number of filter stages.
group-onsemi 0:098463de4c5d 3986 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 3987 * @param[in] *pState points to the state buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 3988 * @return none.
group-onsemi 0:098463de4c5d 3989 */
group-onsemi 0:098463de4c5d 3990
group-onsemi 0:098463de4c5d 3991 void arm_fir_lattice_init_q15(
group-onsemi 0:098463de4c5d 3992 arm_fir_lattice_instance_q15 * S,
group-onsemi 0:098463de4c5d 3993 uint16_t numStages,
group-onsemi 0:098463de4c5d 3994 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 3995 q15_t * pState);
group-onsemi 0:098463de4c5d 3996
group-onsemi 0:098463de4c5d 3997
group-onsemi 0:098463de4c5d 3998 /**
group-onsemi 0:098463de4c5d 3999 * @brief Processing function for the Q15 FIR lattice filter.
group-onsemi 0:098463de4c5d 4000 * @param[in] *S points to an instance of the Q15 FIR lattice structure.
group-onsemi 0:098463de4c5d 4001 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4002 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 4003 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4004 * @return none.
group-onsemi 0:098463de4c5d 4005 */
group-onsemi 0:098463de4c5d 4006 void arm_fir_lattice_q15(
group-onsemi 0:098463de4c5d 4007 const arm_fir_lattice_instance_q15 * S,
group-onsemi 0:098463de4c5d 4008 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4009 q15_t * pDst,
group-onsemi 0:098463de4c5d 4010 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4011
group-onsemi 0:098463de4c5d 4012 /**
group-onsemi 0:098463de4c5d 4013 * @brief Initialization function for the Q31 FIR lattice filter.
group-onsemi 0:098463de4c5d 4014 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
group-onsemi 0:098463de4c5d 4015 * @param[in] numStages number of filter stages.
group-onsemi 0:098463de4c5d 4016 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4017 * @param[in] *pState points to the state buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4018 * @return none.
group-onsemi 0:098463de4c5d 4019 */
group-onsemi 0:098463de4c5d 4020
group-onsemi 0:098463de4c5d 4021 void arm_fir_lattice_init_q31(
group-onsemi 0:098463de4c5d 4022 arm_fir_lattice_instance_q31 * S,
group-onsemi 0:098463de4c5d 4023 uint16_t numStages,
group-onsemi 0:098463de4c5d 4024 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 4025 q31_t * pState);
group-onsemi 0:098463de4c5d 4026
group-onsemi 0:098463de4c5d 4027
group-onsemi 0:098463de4c5d 4028 /**
group-onsemi 0:098463de4c5d 4029 * @brief Processing function for the Q31 FIR lattice filter.
group-onsemi 0:098463de4c5d 4030 * @param[in] *S points to an instance of the Q31 FIR lattice structure.
group-onsemi 0:098463de4c5d 4031 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4032 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4033 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4034 * @return none.
group-onsemi 0:098463de4c5d 4035 */
group-onsemi 0:098463de4c5d 4036
group-onsemi 0:098463de4c5d 4037 void arm_fir_lattice_q31(
group-onsemi 0:098463de4c5d 4038 const arm_fir_lattice_instance_q31 * S,
group-onsemi 0:098463de4c5d 4039 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4040 q31_t * pDst,
group-onsemi 0:098463de4c5d 4041 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4042
group-onsemi 0:098463de4c5d 4043 /**
group-onsemi 0:098463de4c5d 4044 * @brief Initialization function for the floating-point FIR lattice filter.
group-onsemi 0:098463de4c5d 4045 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
group-onsemi 0:098463de4c5d 4046 * @param[in] numStages number of filter stages.
group-onsemi 0:098463de4c5d 4047 * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4048 * @param[in] *pState points to the state buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4049 * @return none.
group-onsemi 0:098463de4c5d 4050 */
group-onsemi 0:098463de4c5d 4051
group-onsemi 0:098463de4c5d 4052 void arm_fir_lattice_init_f32(
group-onsemi 0:098463de4c5d 4053 arm_fir_lattice_instance_f32 * S,
group-onsemi 0:098463de4c5d 4054 uint16_t numStages,
group-onsemi 0:098463de4c5d 4055 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 4056 float32_t * pState);
group-onsemi 0:098463de4c5d 4057
group-onsemi 0:098463de4c5d 4058 /**
group-onsemi 0:098463de4c5d 4059 * @brief Processing function for the floating-point FIR lattice filter.
group-onsemi 0:098463de4c5d 4060 * @param[in] *S points to an instance of the floating-point FIR lattice structure.
group-onsemi 0:098463de4c5d 4061 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4062 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4063 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4064 * @return none.
group-onsemi 0:098463de4c5d 4065 */
group-onsemi 0:098463de4c5d 4066
group-onsemi 0:098463de4c5d 4067 void arm_fir_lattice_f32(
group-onsemi 0:098463de4c5d 4068 const arm_fir_lattice_instance_f32 * S,
group-onsemi 0:098463de4c5d 4069 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4070 float32_t * pDst,
group-onsemi 0:098463de4c5d 4071 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4072
group-onsemi 0:098463de4c5d 4073 /**
group-onsemi 0:098463de4c5d 4074 * @brief Instance structure for the Q15 IIR lattice filter.
group-onsemi 0:098463de4c5d 4075 */
group-onsemi 0:098463de4c5d 4076 typedef struct
group-onsemi 0:098463de4c5d 4077 {
group-onsemi 0:098463de4c5d 4078 uint16_t numStages; /**< number of stages in the filter. */
group-onsemi 0:098463de4c5d 4079 q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
group-onsemi 0:098463de4c5d 4080 q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 4081 q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
group-onsemi 0:098463de4c5d 4082 } arm_iir_lattice_instance_q15;
group-onsemi 0:098463de4c5d 4083
group-onsemi 0:098463de4c5d 4084 /**
group-onsemi 0:098463de4c5d 4085 * @brief Instance structure for the Q31 IIR lattice filter.
group-onsemi 0:098463de4c5d 4086 */
group-onsemi 0:098463de4c5d 4087 typedef struct
group-onsemi 0:098463de4c5d 4088 {
group-onsemi 0:098463de4c5d 4089 uint16_t numStages; /**< number of stages in the filter. */
group-onsemi 0:098463de4c5d 4090 q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
group-onsemi 0:098463de4c5d 4091 q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 4092 q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
group-onsemi 0:098463de4c5d 4093 } arm_iir_lattice_instance_q31;
group-onsemi 0:098463de4c5d 4094
group-onsemi 0:098463de4c5d 4095 /**
group-onsemi 0:098463de4c5d 4096 * @brief Instance structure for the floating-point IIR lattice filter.
group-onsemi 0:098463de4c5d 4097 */
group-onsemi 0:098463de4c5d 4098 typedef struct
group-onsemi 0:098463de4c5d 4099 {
group-onsemi 0:098463de4c5d 4100 uint16_t numStages; /**< number of stages in the filter. */
group-onsemi 0:098463de4c5d 4101 float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */
group-onsemi 0:098463de4c5d 4102 float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */
group-onsemi 0:098463de4c5d 4103 float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */
group-onsemi 0:098463de4c5d 4104 } arm_iir_lattice_instance_f32;
group-onsemi 0:098463de4c5d 4105
group-onsemi 0:098463de4c5d 4106 /**
group-onsemi 0:098463de4c5d 4107 * @brief Processing function for the floating-point IIR lattice filter.
group-onsemi 0:098463de4c5d 4108 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
group-onsemi 0:098463de4c5d 4109 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4110 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 4111 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4112 * @return none.
group-onsemi 0:098463de4c5d 4113 */
group-onsemi 0:098463de4c5d 4114
group-onsemi 0:098463de4c5d 4115 void arm_iir_lattice_f32(
group-onsemi 0:098463de4c5d 4116 const arm_iir_lattice_instance_f32 * S,
group-onsemi 0:098463de4c5d 4117 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4118 float32_t * pDst,
group-onsemi 0:098463de4c5d 4119 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4120
group-onsemi 0:098463de4c5d 4121 /**
group-onsemi 0:098463de4c5d 4122 * @brief Initialization function for the floating-point IIR lattice filter.
group-onsemi 0:098463de4c5d 4123 * @param[in] *S points to an instance of the floating-point IIR lattice structure.
group-onsemi 0:098463de4c5d 4124 * @param[in] numStages number of stages in the filter.
group-onsemi 0:098463de4c5d 4125 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4126 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
group-onsemi 0:098463de4c5d 4127 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1.
group-onsemi 0:098463de4c5d 4128 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4129 * @return none.
group-onsemi 0:098463de4c5d 4130 */
group-onsemi 0:098463de4c5d 4131
group-onsemi 0:098463de4c5d 4132 void arm_iir_lattice_init_f32(
group-onsemi 0:098463de4c5d 4133 arm_iir_lattice_instance_f32 * S,
group-onsemi 0:098463de4c5d 4134 uint16_t numStages,
group-onsemi 0:098463de4c5d 4135 float32_t * pkCoeffs,
group-onsemi 0:098463de4c5d 4136 float32_t * pvCoeffs,
group-onsemi 0:098463de4c5d 4137 float32_t * pState,
group-onsemi 0:098463de4c5d 4138 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4139
group-onsemi 0:098463de4c5d 4140
group-onsemi 0:098463de4c5d 4141 /**
group-onsemi 0:098463de4c5d 4142 * @brief Processing function for the Q31 IIR lattice filter.
group-onsemi 0:098463de4c5d 4143 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
group-onsemi 0:098463de4c5d 4144 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4145 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 4146 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4147 * @return none.
group-onsemi 0:098463de4c5d 4148 */
group-onsemi 0:098463de4c5d 4149
group-onsemi 0:098463de4c5d 4150 void arm_iir_lattice_q31(
group-onsemi 0:098463de4c5d 4151 const arm_iir_lattice_instance_q31 * S,
group-onsemi 0:098463de4c5d 4152 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4153 q31_t * pDst,
group-onsemi 0:098463de4c5d 4154 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4155
group-onsemi 0:098463de4c5d 4156
group-onsemi 0:098463de4c5d 4157 /**
group-onsemi 0:098463de4c5d 4158 * @brief Initialization function for the Q31 IIR lattice filter.
group-onsemi 0:098463de4c5d 4159 * @param[in] *S points to an instance of the Q31 IIR lattice structure.
group-onsemi 0:098463de4c5d 4160 * @param[in] numStages number of stages in the filter.
group-onsemi 0:098463de4c5d 4161 * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4162 * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1.
group-onsemi 0:098463de4c5d 4163 * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize.
group-onsemi 0:098463de4c5d 4164 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4165 * @return none.
group-onsemi 0:098463de4c5d 4166 */
group-onsemi 0:098463de4c5d 4167
group-onsemi 0:098463de4c5d 4168 void arm_iir_lattice_init_q31(
group-onsemi 0:098463de4c5d 4169 arm_iir_lattice_instance_q31 * S,
group-onsemi 0:098463de4c5d 4170 uint16_t numStages,
group-onsemi 0:098463de4c5d 4171 q31_t * pkCoeffs,
group-onsemi 0:098463de4c5d 4172 q31_t * pvCoeffs,
group-onsemi 0:098463de4c5d 4173 q31_t * pState,
group-onsemi 0:098463de4c5d 4174 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4175
group-onsemi 0:098463de4c5d 4176
group-onsemi 0:098463de4c5d 4177 /**
group-onsemi 0:098463de4c5d 4178 * @brief Processing function for the Q15 IIR lattice filter.
group-onsemi 0:098463de4c5d 4179 * @param[in] *S points to an instance of the Q15 IIR lattice structure.
group-onsemi 0:098463de4c5d 4180 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4181 * @param[out] *pDst points to the block of output data.
group-onsemi 0:098463de4c5d 4182 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4183 * @return none.
group-onsemi 0:098463de4c5d 4184 */
group-onsemi 0:098463de4c5d 4185
group-onsemi 0:098463de4c5d 4186 void arm_iir_lattice_q15(
group-onsemi 0:098463de4c5d 4187 const arm_iir_lattice_instance_q15 * S,
group-onsemi 0:098463de4c5d 4188 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4189 q15_t * pDst,
group-onsemi 0:098463de4c5d 4190 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4191
group-onsemi 0:098463de4c5d 4192
group-onsemi 0:098463de4c5d 4193 /**
group-onsemi 0:098463de4c5d 4194 * @brief Initialization function for the Q15 IIR lattice filter.
group-onsemi 0:098463de4c5d 4195 * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure.
group-onsemi 0:098463de4c5d 4196 * @param[in] numStages number of stages in the filter.
group-onsemi 0:098463de4c5d 4197 * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages.
group-onsemi 0:098463de4c5d 4198 * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1.
group-onsemi 0:098463de4c5d 4199 * @param[in] *pState points to state buffer. The array is of length numStages+blockSize.
group-onsemi 0:098463de4c5d 4200 * @param[in] blockSize number of samples to process per call.
group-onsemi 0:098463de4c5d 4201 * @return none.
group-onsemi 0:098463de4c5d 4202 */
group-onsemi 0:098463de4c5d 4203
group-onsemi 0:098463de4c5d 4204 void arm_iir_lattice_init_q15(
group-onsemi 0:098463de4c5d 4205 arm_iir_lattice_instance_q15 * S,
group-onsemi 0:098463de4c5d 4206 uint16_t numStages,
group-onsemi 0:098463de4c5d 4207 q15_t * pkCoeffs,
group-onsemi 0:098463de4c5d 4208 q15_t * pvCoeffs,
group-onsemi 0:098463de4c5d 4209 q15_t * pState,
group-onsemi 0:098463de4c5d 4210 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4211
group-onsemi 0:098463de4c5d 4212 /**
group-onsemi 0:098463de4c5d 4213 * @brief Instance structure for the floating-point LMS filter.
group-onsemi 0:098463de4c5d 4214 */
group-onsemi 0:098463de4c5d 4215
group-onsemi 0:098463de4c5d 4216 typedef struct
group-onsemi 0:098463de4c5d 4217 {
group-onsemi 0:098463de4c5d 4218 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4219 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4220 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4221 float32_t mu; /**< step size that controls filter coefficient updates. */
group-onsemi 0:098463de4c5d 4222 } arm_lms_instance_f32;
group-onsemi 0:098463de4c5d 4223
group-onsemi 0:098463de4c5d 4224 /**
group-onsemi 0:098463de4c5d 4225 * @brief Processing function for floating-point LMS filter.
group-onsemi 0:098463de4c5d 4226 * @param[in] *S points to an instance of the floating-point LMS filter structure.
group-onsemi 0:098463de4c5d 4227 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4228 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4229 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4230 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4231 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4232 * @return none.
group-onsemi 0:098463de4c5d 4233 */
group-onsemi 0:098463de4c5d 4234
group-onsemi 0:098463de4c5d 4235 void arm_lms_f32(
group-onsemi 0:098463de4c5d 4236 const arm_lms_instance_f32 * S,
group-onsemi 0:098463de4c5d 4237 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4238 float32_t * pRef,
group-onsemi 0:098463de4c5d 4239 float32_t * pOut,
group-onsemi 0:098463de4c5d 4240 float32_t * pErr,
group-onsemi 0:098463de4c5d 4241 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4242
group-onsemi 0:098463de4c5d 4243 /**
group-onsemi 0:098463de4c5d 4244 * @brief Initialization function for floating-point LMS filter.
group-onsemi 0:098463de4c5d 4245 * @param[in] *S points to an instance of the floating-point LMS filter structure.
group-onsemi 0:098463de4c5d 4246 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4247 * @param[in] *pCoeffs points to the coefficient buffer.
group-onsemi 0:098463de4c5d 4248 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 4249 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4250 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4251 * @return none.
group-onsemi 0:098463de4c5d 4252 */
group-onsemi 0:098463de4c5d 4253
group-onsemi 0:098463de4c5d 4254 void arm_lms_init_f32(
group-onsemi 0:098463de4c5d 4255 arm_lms_instance_f32 * S,
group-onsemi 0:098463de4c5d 4256 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4257 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 4258 float32_t * pState,
group-onsemi 0:098463de4c5d 4259 float32_t mu,
group-onsemi 0:098463de4c5d 4260 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4261
group-onsemi 0:098463de4c5d 4262 /**
group-onsemi 0:098463de4c5d 4263 * @brief Instance structure for the Q15 LMS filter.
group-onsemi 0:098463de4c5d 4264 */
group-onsemi 0:098463de4c5d 4265
group-onsemi 0:098463de4c5d 4266 typedef struct
group-onsemi 0:098463de4c5d 4267 {
group-onsemi 0:098463de4c5d 4268 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4269 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4270 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4271 q15_t mu; /**< step size that controls filter coefficient updates. */
group-onsemi 0:098463de4c5d 4272 uint32_t postShift; /**< bit shift applied to coefficients. */
group-onsemi 0:098463de4c5d 4273 } arm_lms_instance_q15;
group-onsemi 0:098463de4c5d 4274
group-onsemi 0:098463de4c5d 4275
group-onsemi 0:098463de4c5d 4276 /**
group-onsemi 0:098463de4c5d 4277 * @brief Initialization function for the Q15 LMS filter.
group-onsemi 0:098463de4c5d 4278 * @param[in] *S points to an instance of the Q15 LMS filter structure.
group-onsemi 0:098463de4c5d 4279 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4280 * @param[in] *pCoeffs points to the coefficient buffer.
group-onsemi 0:098463de4c5d 4281 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 4282 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4283 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4284 * @param[in] postShift bit shift applied to coefficients.
group-onsemi 0:098463de4c5d 4285 * @return none.
group-onsemi 0:098463de4c5d 4286 */
group-onsemi 0:098463de4c5d 4287
group-onsemi 0:098463de4c5d 4288 void arm_lms_init_q15(
group-onsemi 0:098463de4c5d 4289 arm_lms_instance_q15 * S,
group-onsemi 0:098463de4c5d 4290 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4291 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 4292 q15_t * pState,
group-onsemi 0:098463de4c5d 4293 q15_t mu,
group-onsemi 0:098463de4c5d 4294 uint32_t blockSize,
group-onsemi 0:098463de4c5d 4295 uint32_t postShift);
group-onsemi 0:098463de4c5d 4296
group-onsemi 0:098463de4c5d 4297 /**
group-onsemi 0:098463de4c5d 4298 * @brief Processing function for Q15 LMS filter.
group-onsemi 0:098463de4c5d 4299 * @param[in] *S points to an instance of the Q15 LMS filter structure.
group-onsemi 0:098463de4c5d 4300 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4301 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4302 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4303 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4304 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4305 * @return none.
group-onsemi 0:098463de4c5d 4306 */
group-onsemi 0:098463de4c5d 4307
group-onsemi 0:098463de4c5d 4308 void arm_lms_q15(
group-onsemi 0:098463de4c5d 4309 const arm_lms_instance_q15 * S,
group-onsemi 0:098463de4c5d 4310 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4311 q15_t * pRef,
group-onsemi 0:098463de4c5d 4312 q15_t * pOut,
group-onsemi 0:098463de4c5d 4313 q15_t * pErr,
group-onsemi 0:098463de4c5d 4314 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4315
group-onsemi 0:098463de4c5d 4316
group-onsemi 0:098463de4c5d 4317 /**
group-onsemi 0:098463de4c5d 4318 * @brief Instance structure for the Q31 LMS filter.
group-onsemi 0:098463de4c5d 4319 */
group-onsemi 0:098463de4c5d 4320
group-onsemi 0:098463de4c5d 4321 typedef struct
group-onsemi 0:098463de4c5d 4322 {
group-onsemi 0:098463de4c5d 4323 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4324 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4325 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4326 q31_t mu; /**< step size that controls filter coefficient updates. */
group-onsemi 0:098463de4c5d 4327 uint32_t postShift; /**< bit shift applied to coefficients. */
group-onsemi 0:098463de4c5d 4328
group-onsemi 0:098463de4c5d 4329 } arm_lms_instance_q31;
group-onsemi 0:098463de4c5d 4330
group-onsemi 0:098463de4c5d 4331 /**
group-onsemi 0:098463de4c5d 4332 * @brief Processing function for Q31 LMS filter.
group-onsemi 0:098463de4c5d 4333 * @param[in] *S points to an instance of the Q15 LMS filter structure.
group-onsemi 0:098463de4c5d 4334 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4335 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4336 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4337 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4338 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4339 * @return none.
group-onsemi 0:098463de4c5d 4340 */
group-onsemi 0:098463de4c5d 4341
group-onsemi 0:098463de4c5d 4342 void arm_lms_q31(
group-onsemi 0:098463de4c5d 4343 const arm_lms_instance_q31 * S,
group-onsemi 0:098463de4c5d 4344 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4345 q31_t * pRef,
group-onsemi 0:098463de4c5d 4346 q31_t * pOut,
group-onsemi 0:098463de4c5d 4347 q31_t * pErr,
group-onsemi 0:098463de4c5d 4348 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4349
group-onsemi 0:098463de4c5d 4350 /**
group-onsemi 0:098463de4c5d 4351 * @brief Initialization function for Q31 LMS filter.
group-onsemi 0:098463de4c5d 4352 * @param[in] *S points to an instance of the Q31 LMS filter structure.
group-onsemi 0:098463de4c5d 4353 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4354 * @param[in] *pCoeffs points to coefficient buffer.
group-onsemi 0:098463de4c5d 4355 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 4356 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4357 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4358 * @param[in] postShift bit shift applied to coefficients.
group-onsemi 0:098463de4c5d 4359 * @return none.
group-onsemi 0:098463de4c5d 4360 */
group-onsemi 0:098463de4c5d 4361
group-onsemi 0:098463de4c5d 4362 void arm_lms_init_q31(
group-onsemi 0:098463de4c5d 4363 arm_lms_instance_q31 * S,
group-onsemi 0:098463de4c5d 4364 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4365 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 4366 q31_t * pState,
group-onsemi 0:098463de4c5d 4367 q31_t mu,
group-onsemi 0:098463de4c5d 4368 uint32_t blockSize,
group-onsemi 0:098463de4c5d 4369 uint32_t postShift);
group-onsemi 0:098463de4c5d 4370
group-onsemi 0:098463de4c5d 4371 /**
group-onsemi 0:098463de4c5d 4372 * @brief Instance structure for the floating-point normalized LMS filter.
group-onsemi 0:098463de4c5d 4373 */
group-onsemi 0:098463de4c5d 4374
group-onsemi 0:098463de4c5d 4375 typedef struct
group-onsemi 0:098463de4c5d 4376 {
group-onsemi 0:098463de4c5d 4377 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4378 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4379 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4380 float32_t mu; /**< step size that control filter coefficient updates. */
group-onsemi 0:098463de4c5d 4381 float32_t energy; /**< saves previous frame energy. */
group-onsemi 0:098463de4c5d 4382 float32_t x0; /**< saves previous input sample. */
group-onsemi 0:098463de4c5d 4383 } arm_lms_norm_instance_f32;
group-onsemi 0:098463de4c5d 4384
group-onsemi 0:098463de4c5d 4385 /**
group-onsemi 0:098463de4c5d 4386 * @brief Processing function for floating-point normalized LMS filter.
group-onsemi 0:098463de4c5d 4387 * @param[in] *S points to an instance of the floating-point normalized LMS filter structure.
group-onsemi 0:098463de4c5d 4388 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4389 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4390 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4391 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4392 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4393 * @return none.
group-onsemi 0:098463de4c5d 4394 */
group-onsemi 0:098463de4c5d 4395
group-onsemi 0:098463de4c5d 4396 void arm_lms_norm_f32(
group-onsemi 0:098463de4c5d 4397 arm_lms_norm_instance_f32 * S,
group-onsemi 0:098463de4c5d 4398 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4399 float32_t * pRef,
group-onsemi 0:098463de4c5d 4400 float32_t * pOut,
group-onsemi 0:098463de4c5d 4401 float32_t * pErr,
group-onsemi 0:098463de4c5d 4402 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4403
group-onsemi 0:098463de4c5d 4404 /**
group-onsemi 0:098463de4c5d 4405 * @brief Initialization function for floating-point normalized LMS filter.
group-onsemi 0:098463de4c5d 4406 * @param[in] *S points to an instance of the floating-point LMS filter structure.
group-onsemi 0:098463de4c5d 4407 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4408 * @param[in] *pCoeffs points to coefficient buffer.
group-onsemi 0:098463de4c5d 4409 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 4410 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4411 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4412 * @return none.
group-onsemi 0:098463de4c5d 4413 */
group-onsemi 0:098463de4c5d 4414
group-onsemi 0:098463de4c5d 4415 void arm_lms_norm_init_f32(
group-onsemi 0:098463de4c5d 4416 arm_lms_norm_instance_f32 * S,
group-onsemi 0:098463de4c5d 4417 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4418 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 4419 float32_t * pState,
group-onsemi 0:098463de4c5d 4420 float32_t mu,
group-onsemi 0:098463de4c5d 4421 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4422
group-onsemi 0:098463de4c5d 4423
group-onsemi 0:098463de4c5d 4424 /**
group-onsemi 0:098463de4c5d 4425 * @brief Instance structure for the Q31 normalized LMS filter.
group-onsemi 0:098463de4c5d 4426 */
group-onsemi 0:098463de4c5d 4427 typedef struct
group-onsemi 0:098463de4c5d 4428 {
group-onsemi 0:098463de4c5d 4429 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4430 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4431 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4432 q31_t mu; /**< step size that controls filter coefficient updates. */
group-onsemi 0:098463de4c5d 4433 uint8_t postShift; /**< bit shift applied to coefficients. */
group-onsemi 0:098463de4c5d 4434 q31_t *recipTable; /**< points to the reciprocal initial value table. */
group-onsemi 0:098463de4c5d 4435 q31_t energy; /**< saves previous frame energy. */
group-onsemi 0:098463de4c5d 4436 q31_t x0; /**< saves previous input sample. */
group-onsemi 0:098463de4c5d 4437 } arm_lms_norm_instance_q31;
group-onsemi 0:098463de4c5d 4438
group-onsemi 0:098463de4c5d 4439 /**
group-onsemi 0:098463de4c5d 4440 * @brief Processing function for Q31 normalized LMS filter.
group-onsemi 0:098463de4c5d 4441 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
group-onsemi 0:098463de4c5d 4442 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4443 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4444 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4445 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4446 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4447 * @return none.
group-onsemi 0:098463de4c5d 4448 */
group-onsemi 0:098463de4c5d 4449
group-onsemi 0:098463de4c5d 4450 void arm_lms_norm_q31(
group-onsemi 0:098463de4c5d 4451 arm_lms_norm_instance_q31 * S,
group-onsemi 0:098463de4c5d 4452 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4453 q31_t * pRef,
group-onsemi 0:098463de4c5d 4454 q31_t * pOut,
group-onsemi 0:098463de4c5d 4455 q31_t * pErr,
group-onsemi 0:098463de4c5d 4456 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4457
group-onsemi 0:098463de4c5d 4458 /**
group-onsemi 0:098463de4c5d 4459 * @brief Initialization function for Q31 normalized LMS filter.
group-onsemi 0:098463de4c5d 4460 * @param[in] *S points to an instance of the Q31 normalized LMS filter structure.
group-onsemi 0:098463de4c5d 4461 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4462 * @param[in] *pCoeffs points to coefficient buffer.
group-onsemi 0:098463de4c5d 4463 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 4464 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4465 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4466 * @param[in] postShift bit shift applied to coefficients.
group-onsemi 0:098463de4c5d 4467 * @return none.
group-onsemi 0:098463de4c5d 4468 */
group-onsemi 0:098463de4c5d 4469
group-onsemi 0:098463de4c5d 4470 void arm_lms_norm_init_q31(
group-onsemi 0:098463de4c5d 4471 arm_lms_norm_instance_q31 * S,
group-onsemi 0:098463de4c5d 4472 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4473 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 4474 q31_t * pState,
group-onsemi 0:098463de4c5d 4475 q31_t mu,
group-onsemi 0:098463de4c5d 4476 uint32_t blockSize,
group-onsemi 0:098463de4c5d 4477 uint8_t postShift);
group-onsemi 0:098463de4c5d 4478
group-onsemi 0:098463de4c5d 4479 /**
group-onsemi 0:098463de4c5d 4480 * @brief Instance structure for the Q15 normalized LMS filter.
group-onsemi 0:098463de4c5d 4481 */
group-onsemi 0:098463de4c5d 4482
group-onsemi 0:098463de4c5d 4483 typedef struct
group-onsemi 0:098463de4c5d 4484 {
group-onsemi 0:098463de4c5d 4485 uint16_t numTaps; /**< Number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4486 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
group-onsemi 0:098463de4c5d 4487 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4488 q15_t mu; /**< step size that controls filter coefficient updates. */
group-onsemi 0:098463de4c5d 4489 uint8_t postShift; /**< bit shift applied to coefficients. */
group-onsemi 0:098463de4c5d 4490 q15_t *recipTable; /**< Points to the reciprocal initial value table. */
group-onsemi 0:098463de4c5d 4491 q15_t energy; /**< saves previous frame energy. */
group-onsemi 0:098463de4c5d 4492 q15_t x0; /**< saves previous input sample. */
group-onsemi 0:098463de4c5d 4493 } arm_lms_norm_instance_q15;
group-onsemi 0:098463de4c5d 4494
group-onsemi 0:098463de4c5d 4495 /**
group-onsemi 0:098463de4c5d 4496 * @brief Processing function for Q15 normalized LMS filter.
group-onsemi 0:098463de4c5d 4497 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
group-onsemi 0:098463de4c5d 4498 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4499 * @param[in] *pRef points to the block of reference data.
group-onsemi 0:098463de4c5d 4500 * @param[out] *pOut points to the block of output data.
group-onsemi 0:098463de4c5d 4501 * @param[out] *pErr points to the block of error data.
group-onsemi 0:098463de4c5d 4502 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4503 * @return none.
group-onsemi 0:098463de4c5d 4504 */
group-onsemi 0:098463de4c5d 4505
group-onsemi 0:098463de4c5d 4506 void arm_lms_norm_q15(
group-onsemi 0:098463de4c5d 4507 arm_lms_norm_instance_q15 * S,
group-onsemi 0:098463de4c5d 4508 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4509 q15_t * pRef,
group-onsemi 0:098463de4c5d 4510 q15_t * pOut,
group-onsemi 0:098463de4c5d 4511 q15_t * pErr,
group-onsemi 0:098463de4c5d 4512 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4513
group-onsemi 0:098463de4c5d 4514
group-onsemi 0:098463de4c5d 4515 /**
group-onsemi 0:098463de4c5d 4516 * @brief Initialization function for Q15 normalized LMS filter.
group-onsemi 0:098463de4c5d 4517 * @param[in] *S points to an instance of the Q15 normalized LMS filter structure.
group-onsemi 0:098463de4c5d 4518 * @param[in] numTaps number of filter coefficients.
group-onsemi 0:098463de4c5d 4519 * @param[in] *pCoeffs points to coefficient buffer.
group-onsemi 0:098463de4c5d 4520 * @param[in] *pState points to state buffer.
group-onsemi 0:098463de4c5d 4521 * @param[in] mu step size that controls filter coefficient updates.
group-onsemi 0:098463de4c5d 4522 * @param[in] blockSize number of samples to process.
group-onsemi 0:098463de4c5d 4523 * @param[in] postShift bit shift applied to coefficients.
group-onsemi 0:098463de4c5d 4524 * @return none.
group-onsemi 0:098463de4c5d 4525 */
group-onsemi 0:098463de4c5d 4526
group-onsemi 0:098463de4c5d 4527 void arm_lms_norm_init_q15(
group-onsemi 0:098463de4c5d 4528 arm_lms_norm_instance_q15 * S,
group-onsemi 0:098463de4c5d 4529 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4530 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 4531 q15_t * pState,
group-onsemi 0:098463de4c5d 4532 q15_t mu,
group-onsemi 0:098463de4c5d 4533 uint32_t blockSize,
group-onsemi 0:098463de4c5d 4534 uint8_t postShift);
group-onsemi 0:098463de4c5d 4535
group-onsemi 0:098463de4c5d 4536 /**
group-onsemi 0:098463de4c5d 4537 * @brief Correlation of floating-point sequences.
group-onsemi 0:098463de4c5d 4538 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4539 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4540 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4541 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4542 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4543 * @return none.
group-onsemi 0:098463de4c5d 4544 */
group-onsemi 0:098463de4c5d 4545
group-onsemi 0:098463de4c5d 4546 void arm_correlate_f32(
group-onsemi 0:098463de4c5d 4547 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 4548 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4549 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 4550 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4551 float32_t * pDst);
group-onsemi 0:098463de4c5d 4552
group-onsemi 0:098463de4c5d 4553
group-onsemi 0:098463de4c5d 4554 /**
group-onsemi 0:098463de4c5d 4555 * @brief Correlation of Q15 sequences
group-onsemi 0:098463de4c5d 4556 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4557 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4558 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4559 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4560 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4561 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 4562 * @return none.
group-onsemi 0:098463de4c5d 4563 */
group-onsemi 0:098463de4c5d 4564 void arm_correlate_opt_q15(
group-onsemi 0:098463de4c5d 4565 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 4566 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4567 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 4568 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4569 q15_t * pDst,
group-onsemi 0:098463de4c5d 4570 q15_t * pScratch);
group-onsemi 0:098463de4c5d 4571
group-onsemi 0:098463de4c5d 4572
group-onsemi 0:098463de4c5d 4573 /**
group-onsemi 0:098463de4c5d 4574 * @brief Correlation of Q15 sequences.
group-onsemi 0:098463de4c5d 4575 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4576 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4577 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4578 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4579 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4580 * @return none.
group-onsemi 0:098463de4c5d 4581 */
group-onsemi 0:098463de4c5d 4582
group-onsemi 0:098463de4c5d 4583 void arm_correlate_q15(
group-onsemi 0:098463de4c5d 4584 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 4585 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4586 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 4587 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4588 q15_t * pDst);
group-onsemi 0:098463de4c5d 4589
group-onsemi 0:098463de4c5d 4590 /**
group-onsemi 0:098463de4c5d 4591 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 4592 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4593 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4594 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4595 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4596 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4597 * @return none.
group-onsemi 0:098463de4c5d 4598 */
group-onsemi 0:098463de4c5d 4599
group-onsemi 0:098463de4c5d 4600 void arm_correlate_fast_q15(
group-onsemi 0:098463de4c5d 4601 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 4602 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4603 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 4604 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4605 q15_t * pDst);
group-onsemi 0:098463de4c5d 4606
group-onsemi 0:098463de4c5d 4607
group-onsemi 0:098463de4c5d 4608
group-onsemi 0:098463de4c5d 4609 /**
group-onsemi 0:098463de4c5d 4610 * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4.
group-onsemi 0:098463de4c5d 4611 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4612 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4613 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4614 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4615 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4616 * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 4617 * @return none.
group-onsemi 0:098463de4c5d 4618 */
group-onsemi 0:098463de4c5d 4619
group-onsemi 0:098463de4c5d 4620 void arm_correlate_fast_opt_q15(
group-onsemi 0:098463de4c5d 4621 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 4622 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4623 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 4624 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4625 q15_t * pDst,
group-onsemi 0:098463de4c5d 4626 q15_t * pScratch);
group-onsemi 0:098463de4c5d 4627
group-onsemi 0:098463de4c5d 4628 /**
group-onsemi 0:098463de4c5d 4629 * @brief Correlation of Q31 sequences.
group-onsemi 0:098463de4c5d 4630 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4631 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4632 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4633 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4634 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4635 * @return none.
group-onsemi 0:098463de4c5d 4636 */
group-onsemi 0:098463de4c5d 4637
group-onsemi 0:098463de4c5d 4638 void arm_correlate_q31(
group-onsemi 0:098463de4c5d 4639 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 4640 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4641 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 4642 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4643 q31_t * pDst);
group-onsemi 0:098463de4c5d 4644
group-onsemi 0:098463de4c5d 4645 /**
group-onsemi 0:098463de4c5d 4646 * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4
group-onsemi 0:098463de4c5d 4647 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4648 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4649 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4650 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4651 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4652 * @return none.
group-onsemi 0:098463de4c5d 4653 */
group-onsemi 0:098463de4c5d 4654
group-onsemi 0:098463de4c5d 4655 void arm_correlate_fast_q31(
group-onsemi 0:098463de4c5d 4656 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 4657 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4658 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 4659 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4660 q31_t * pDst);
group-onsemi 0:098463de4c5d 4661
group-onsemi 0:098463de4c5d 4662
group-onsemi 0:098463de4c5d 4663
group-onsemi 0:098463de4c5d 4664 /**
group-onsemi 0:098463de4c5d 4665 * @brief Correlation of Q7 sequences.
group-onsemi 0:098463de4c5d 4666 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4667 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4668 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4669 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4670 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4671 * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2.
group-onsemi 0:098463de4c5d 4672 * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen).
group-onsemi 0:098463de4c5d 4673 * @return none.
group-onsemi 0:098463de4c5d 4674 */
group-onsemi 0:098463de4c5d 4675
group-onsemi 0:098463de4c5d 4676 void arm_correlate_opt_q7(
group-onsemi 0:098463de4c5d 4677 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 4678 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4679 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 4680 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4681 q7_t * pDst,
group-onsemi 0:098463de4c5d 4682 q15_t * pScratch1,
group-onsemi 0:098463de4c5d 4683 q15_t * pScratch2);
group-onsemi 0:098463de4c5d 4684
group-onsemi 0:098463de4c5d 4685
group-onsemi 0:098463de4c5d 4686 /**
group-onsemi 0:098463de4c5d 4687 * @brief Correlation of Q7 sequences.
group-onsemi 0:098463de4c5d 4688 * @param[in] *pSrcA points to the first input sequence.
group-onsemi 0:098463de4c5d 4689 * @param[in] srcALen length of the first input sequence.
group-onsemi 0:098463de4c5d 4690 * @param[in] *pSrcB points to the second input sequence.
group-onsemi 0:098463de4c5d 4691 * @param[in] srcBLen length of the second input sequence.
group-onsemi 0:098463de4c5d 4692 * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1.
group-onsemi 0:098463de4c5d 4693 * @return none.
group-onsemi 0:098463de4c5d 4694 */
group-onsemi 0:098463de4c5d 4695
group-onsemi 0:098463de4c5d 4696 void arm_correlate_q7(
group-onsemi 0:098463de4c5d 4697 q7_t * pSrcA,
group-onsemi 0:098463de4c5d 4698 uint32_t srcALen,
group-onsemi 0:098463de4c5d 4699 q7_t * pSrcB,
group-onsemi 0:098463de4c5d 4700 uint32_t srcBLen,
group-onsemi 0:098463de4c5d 4701 q7_t * pDst);
group-onsemi 0:098463de4c5d 4702
group-onsemi 0:098463de4c5d 4703
group-onsemi 0:098463de4c5d 4704 /**
group-onsemi 0:098463de4c5d 4705 * @brief Instance structure for the floating-point sparse FIR filter.
group-onsemi 0:098463de4c5d 4706 */
group-onsemi 0:098463de4c5d 4707 typedef struct
group-onsemi 0:098463de4c5d 4708 {
group-onsemi 0:098463de4c5d 4709 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4710 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
group-onsemi 0:098463de4c5d 4711 float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
group-onsemi 0:098463de4c5d 4712 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 4713 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
group-onsemi 0:098463de4c5d 4714 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4715 } arm_fir_sparse_instance_f32;
group-onsemi 0:098463de4c5d 4716
group-onsemi 0:098463de4c5d 4717 /**
group-onsemi 0:098463de4c5d 4718 * @brief Instance structure for the Q31 sparse FIR filter.
group-onsemi 0:098463de4c5d 4719 */
group-onsemi 0:098463de4c5d 4720
group-onsemi 0:098463de4c5d 4721 typedef struct
group-onsemi 0:098463de4c5d 4722 {
group-onsemi 0:098463de4c5d 4723 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4724 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
group-onsemi 0:098463de4c5d 4725 q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
group-onsemi 0:098463de4c5d 4726 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 4727 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
group-onsemi 0:098463de4c5d 4728 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4729 } arm_fir_sparse_instance_q31;
group-onsemi 0:098463de4c5d 4730
group-onsemi 0:098463de4c5d 4731 /**
group-onsemi 0:098463de4c5d 4732 * @brief Instance structure for the Q15 sparse FIR filter.
group-onsemi 0:098463de4c5d 4733 */
group-onsemi 0:098463de4c5d 4734
group-onsemi 0:098463de4c5d 4735 typedef struct
group-onsemi 0:098463de4c5d 4736 {
group-onsemi 0:098463de4c5d 4737 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4738 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
group-onsemi 0:098463de4c5d 4739 q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
group-onsemi 0:098463de4c5d 4740 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 4741 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
group-onsemi 0:098463de4c5d 4742 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4743 } arm_fir_sparse_instance_q15;
group-onsemi 0:098463de4c5d 4744
group-onsemi 0:098463de4c5d 4745 /**
group-onsemi 0:098463de4c5d 4746 * @brief Instance structure for the Q7 sparse FIR filter.
group-onsemi 0:098463de4c5d 4747 */
group-onsemi 0:098463de4c5d 4748
group-onsemi 0:098463de4c5d 4749 typedef struct
group-onsemi 0:098463de4c5d 4750 {
group-onsemi 0:098463de4c5d 4751 uint16_t numTaps; /**< number of coefficients in the filter. */
group-onsemi 0:098463de4c5d 4752 uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */
group-onsemi 0:098463de4c5d 4753 q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */
group-onsemi 0:098463de4c5d 4754 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
group-onsemi 0:098463de4c5d 4755 uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */
group-onsemi 0:098463de4c5d 4756 int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */
group-onsemi 0:098463de4c5d 4757 } arm_fir_sparse_instance_q7;
group-onsemi 0:098463de4c5d 4758
group-onsemi 0:098463de4c5d 4759 /**
group-onsemi 0:098463de4c5d 4760 * @brief Processing function for the floating-point sparse FIR filter.
group-onsemi 0:098463de4c5d 4761 * @param[in] *S points to an instance of the floating-point sparse FIR structure.
group-onsemi 0:098463de4c5d 4762 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4763 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4764 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4765 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 4766 * @return none.
group-onsemi 0:098463de4c5d 4767 */
group-onsemi 0:098463de4c5d 4768
group-onsemi 0:098463de4c5d 4769 void arm_fir_sparse_f32(
group-onsemi 0:098463de4c5d 4770 arm_fir_sparse_instance_f32 * S,
group-onsemi 0:098463de4c5d 4771 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4772 float32_t * pDst,
group-onsemi 0:098463de4c5d 4773 float32_t * pScratchIn,
group-onsemi 0:098463de4c5d 4774 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4775
group-onsemi 0:098463de4c5d 4776 /**
group-onsemi 0:098463de4c5d 4777 * @brief Initialization function for the floating-point sparse FIR filter.
group-onsemi 0:098463de4c5d 4778 * @param[in,out] *S points to an instance of the floating-point sparse FIR structure.
group-onsemi 0:098463de4c5d 4779 * @param[in] numTaps number of nonzero coefficients in the filter.
group-onsemi 0:098463de4c5d 4780 * @param[in] *pCoeffs points to the array of filter coefficients.
group-onsemi 0:098463de4c5d 4781 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 4782 * @param[in] *pTapDelay points to the array of offset times.
group-onsemi 0:098463de4c5d 4783 * @param[in] maxDelay maximum offset time supported.
group-onsemi 0:098463de4c5d 4784 * @param[in] blockSize number of samples that will be processed per block.
group-onsemi 0:098463de4c5d 4785 * @return none
group-onsemi 0:098463de4c5d 4786 */
group-onsemi 0:098463de4c5d 4787
group-onsemi 0:098463de4c5d 4788 void arm_fir_sparse_init_f32(
group-onsemi 0:098463de4c5d 4789 arm_fir_sparse_instance_f32 * S,
group-onsemi 0:098463de4c5d 4790 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4791 float32_t * pCoeffs,
group-onsemi 0:098463de4c5d 4792 float32_t * pState,
group-onsemi 0:098463de4c5d 4793 int32_t * pTapDelay,
group-onsemi 0:098463de4c5d 4794 uint16_t maxDelay,
group-onsemi 0:098463de4c5d 4795 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4796
group-onsemi 0:098463de4c5d 4797 /**
group-onsemi 0:098463de4c5d 4798 * @brief Processing function for the Q31 sparse FIR filter.
group-onsemi 0:098463de4c5d 4799 * @param[in] *S points to an instance of the Q31 sparse FIR structure.
group-onsemi 0:098463de4c5d 4800 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4801 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4802 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4803 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 4804 * @return none.
group-onsemi 0:098463de4c5d 4805 */
group-onsemi 0:098463de4c5d 4806
group-onsemi 0:098463de4c5d 4807 void arm_fir_sparse_q31(
group-onsemi 0:098463de4c5d 4808 arm_fir_sparse_instance_q31 * S,
group-onsemi 0:098463de4c5d 4809 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4810 q31_t * pDst,
group-onsemi 0:098463de4c5d 4811 q31_t * pScratchIn,
group-onsemi 0:098463de4c5d 4812 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4813
group-onsemi 0:098463de4c5d 4814 /**
group-onsemi 0:098463de4c5d 4815 * @brief Initialization function for the Q31 sparse FIR filter.
group-onsemi 0:098463de4c5d 4816 * @param[in,out] *S points to an instance of the Q31 sparse FIR structure.
group-onsemi 0:098463de4c5d 4817 * @param[in] numTaps number of nonzero coefficients in the filter.
group-onsemi 0:098463de4c5d 4818 * @param[in] *pCoeffs points to the array of filter coefficients.
group-onsemi 0:098463de4c5d 4819 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 4820 * @param[in] *pTapDelay points to the array of offset times.
group-onsemi 0:098463de4c5d 4821 * @param[in] maxDelay maximum offset time supported.
group-onsemi 0:098463de4c5d 4822 * @param[in] blockSize number of samples that will be processed per block.
group-onsemi 0:098463de4c5d 4823 * @return none
group-onsemi 0:098463de4c5d 4824 */
group-onsemi 0:098463de4c5d 4825
group-onsemi 0:098463de4c5d 4826 void arm_fir_sparse_init_q31(
group-onsemi 0:098463de4c5d 4827 arm_fir_sparse_instance_q31 * S,
group-onsemi 0:098463de4c5d 4828 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4829 q31_t * pCoeffs,
group-onsemi 0:098463de4c5d 4830 q31_t * pState,
group-onsemi 0:098463de4c5d 4831 int32_t * pTapDelay,
group-onsemi 0:098463de4c5d 4832 uint16_t maxDelay,
group-onsemi 0:098463de4c5d 4833 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4834
group-onsemi 0:098463de4c5d 4835 /**
group-onsemi 0:098463de4c5d 4836 * @brief Processing function for the Q15 sparse FIR filter.
group-onsemi 0:098463de4c5d 4837 * @param[in] *S points to an instance of the Q15 sparse FIR structure.
group-onsemi 0:098463de4c5d 4838 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4839 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4840 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4841 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4842 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 4843 * @return none.
group-onsemi 0:098463de4c5d 4844 */
group-onsemi 0:098463de4c5d 4845
group-onsemi 0:098463de4c5d 4846 void arm_fir_sparse_q15(
group-onsemi 0:098463de4c5d 4847 arm_fir_sparse_instance_q15 * S,
group-onsemi 0:098463de4c5d 4848 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4849 q15_t * pDst,
group-onsemi 0:098463de4c5d 4850 q15_t * pScratchIn,
group-onsemi 0:098463de4c5d 4851 q31_t * pScratchOut,
group-onsemi 0:098463de4c5d 4852 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4853
group-onsemi 0:098463de4c5d 4854
group-onsemi 0:098463de4c5d 4855 /**
group-onsemi 0:098463de4c5d 4856 * @brief Initialization function for the Q15 sparse FIR filter.
group-onsemi 0:098463de4c5d 4857 * @param[in,out] *S points to an instance of the Q15 sparse FIR structure.
group-onsemi 0:098463de4c5d 4858 * @param[in] numTaps number of nonzero coefficients in the filter.
group-onsemi 0:098463de4c5d 4859 * @param[in] *pCoeffs points to the array of filter coefficients.
group-onsemi 0:098463de4c5d 4860 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 4861 * @param[in] *pTapDelay points to the array of offset times.
group-onsemi 0:098463de4c5d 4862 * @param[in] maxDelay maximum offset time supported.
group-onsemi 0:098463de4c5d 4863 * @param[in] blockSize number of samples that will be processed per block.
group-onsemi 0:098463de4c5d 4864 * @return none
group-onsemi 0:098463de4c5d 4865 */
group-onsemi 0:098463de4c5d 4866
group-onsemi 0:098463de4c5d 4867 void arm_fir_sparse_init_q15(
group-onsemi 0:098463de4c5d 4868 arm_fir_sparse_instance_q15 * S,
group-onsemi 0:098463de4c5d 4869 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4870 q15_t * pCoeffs,
group-onsemi 0:098463de4c5d 4871 q15_t * pState,
group-onsemi 0:098463de4c5d 4872 int32_t * pTapDelay,
group-onsemi 0:098463de4c5d 4873 uint16_t maxDelay,
group-onsemi 0:098463de4c5d 4874 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4875
group-onsemi 0:098463de4c5d 4876 /**
group-onsemi 0:098463de4c5d 4877 * @brief Processing function for the Q7 sparse FIR filter.
group-onsemi 0:098463de4c5d 4878 * @param[in] *S points to an instance of the Q7 sparse FIR structure.
group-onsemi 0:098463de4c5d 4879 * @param[in] *pSrc points to the block of input data.
group-onsemi 0:098463de4c5d 4880 * @param[out] *pDst points to the block of output data
group-onsemi 0:098463de4c5d 4881 * @param[in] *pScratchIn points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4882 * @param[in] *pScratchOut points to a temporary buffer of size blockSize.
group-onsemi 0:098463de4c5d 4883 * @param[in] blockSize number of input samples to process per call.
group-onsemi 0:098463de4c5d 4884 * @return none.
group-onsemi 0:098463de4c5d 4885 */
group-onsemi 0:098463de4c5d 4886
group-onsemi 0:098463de4c5d 4887 void arm_fir_sparse_q7(
group-onsemi 0:098463de4c5d 4888 arm_fir_sparse_instance_q7 * S,
group-onsemi 0:098463de4c5d 4889 q7_t * pSrc,
group-onsemi 0:098463de4c5d 4890 q7_t * pDst,
group-onsemi 0:098463de4c5d 4891 q7_t * pScratchIn,
group-onsemi 0:098463de4c5d 4892 q31_t * pScratchOut,
group-onsemi 0:098463de4c5d 4893 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4894
group-onsemi 0:098463de4c5d 4895 /**
group-onsemi 0:098463de4c5d 4896 * @brief Initialization function for the Q7 sparse FIR filter.
group-onsemi 0:098463de4c5d 4897 * @param[in,out] *S points to an instance of the Q7 sparse FIR structure.
group-onsemi 0:098463de4c5d 4898 * @param[in] numTaps number of nonzero coefficients in the filter.
group-onsemi 0:098463de4c5d 4899 * @param[in] *pCoeffs points to the array of filter coefficients.
group-onsemi 0:098463de4c5d 4900 * @param[in] *pState points to the state buffer.
group-onsemi 0:098463de4c5d 4901 * @param[in] *pTapDelay points to the array of offset times.
group-onsemi 0:098463de4c5d 4902 * @param[in] maxDelay maximum offset time supported.
group-onsemi 0:098463de4c5d 4903 * @param[in] blockSize number of samples that will be processed per block.
group-onsemi 0:098463de4c5d 4904 * @return none
group-onsemi 0:098463de4c5d 4905 */
group-onsemi 0:098463de4c5d 4906
group-onsemi 0:098463de4c5d 4907 void arm_fir_sparse_init_q7(
group-onsemi 0:098463de4c5d 4908 arm_fir_sparse_instance_q7 * S,
group-onsemi 0:098463de4c5d 4909 uint16_t numTaps,
group-onsemi 0:098463de4c5d 4910 q7_t * pCoeffs,
group-onsemi 0:098463de4c5d 4911 q7_t * pState,
group-onsemi 0:098463de4c5d 4912 int32_t * pTapDelay,
group-onsemi 0:098463de4c5d 4913 uint16_t maxDelay,
group-onsemi 0:098463de4c5d 4914 uint32_t blockSize);
group-onsemi 0:098463de4c5d 4915
group-onsemi 0:098463de4c5d 4916
group-onsemi 0:098463de4c5d 4917 /*
group-onsemi 0:098463de4c5d 4918 * @brief Floating-point sin_cos function.
group-onsemi 0:098463de4c5d 4919 * @param[in] theta input value in degrees
group-onsemi 0:098463de4c5d 4920 * @param[out] *pSinVal points to the processed sine output.
group-onsemi 0:098463de4c5d 4921 * @param[out] *pCosVal points to the processed cos output.
group-onsemi 0:098463de4c5d 4922 * @return none.
group-onsemi 0:098463de4c5d 4923 */
group-onsemi 0:098463de4c5d 4924
group-onsemi 0:098463de4c5d 4925 void arm_sin_cos_f32(
group-onsemi 0:098463de4c5d 4926 float32_t theta,
group-onsemi 0:098463de4c5d 4927 float32_t * pSinVal,
group-onsemi 0:098463de4c5d 4928 float32_t * pCcosVal);
group-onsemi 0:098463de4c5d 4929
group-onsemi 0:098463de4c5d 4930 /*
group-onsemi 0:098463de4c5d 4931 * @brief Q31 sin_cos function.
group-onsemi 0:098463de4c5d 4932 * @param[in] theta scaled input value in degrees
group-onsemi 0:098463de4c5d 4933 * @param[out] *pSinVal points to the processed sine output.
group-onsemi 0:098463de4c5d 4934 * @param[out] *pCosVal points to the processed cosine output.
group-onsemi 0:098463de4c5d 4935 * @return none.
group-onsemi 0:098463de4c5d 4936 */
group-onsemi 0:098463de4c5d 4937
group-onsemi 0:098463de4c5d 4938 void arm_sin_cos_q31(
group-onsemi 0:098463de4c5d 4939 q31_t theta,
group-onsemi 0:098463de4c5d 4940 q31_t * pSinVal,
group-onsemi 0:098463de4c5d 4941 q31_t * pCosVal);
group-onsemi 0:098463de4c5d 4942
group-onsemi 0:098463de4c5d 4943
group-onsemi 0:098463de4c5d 4944 /**
group-onsemi 0:098463de4c5d 4945 * @brief Floating-point complex conjugate.
group-onsemi 0:098463de4c5d 4946 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 4947 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 4948 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 4949 * @return none.
group-onsemi 0:098463de4c5d 4950 */
group-onsemi 0:098463de4c5d 4951
group-onsemi 0:098463de4c5d 4952 void arm_cmplx_conj_f32(
group-onsemi 0:098463de4c5d 4953 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4954 float32_t * pDst,
group-onsemi 0:098463de4c5d 4955 uint32_t numSamples);
group-onsemi 0:098463de4c5d 4956
group-onsemi 0:098463de4c5d 4957 /**
group-onsemi 0:098463de4c5d 4958 * @brief Q31 complex conjugate.
group-onsemi 0:098463de4c5d 4959 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 4960 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 4961 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 4962 * @return none.
group-onsemi 0:098463de4c5d 4963 */
group-onsemi 0:098463de4c5d 4964
group-onsemi 0:098463de4c5d 4965 void arm_cmplx_conj_q31(
group-onsemi 0:098463de4c5d 4966 q31_t * pSrc,
group-onsemi 0:098463de4c5d 4967 q31_t * pDst,
group-onsemi 0:098463de4c5d 4968 uint32_t numSamples);
group-onsemi 0:098463de4c5d 4969
group-onsemi 0:098463de4c5d 4970 /**
group-onsemi 0:098463de4c5d 4971 * @brief Q15 complex conjugate.
group-onsemi 0:098463de4c5d 4972 * @param[in] *pSrc points to the input vector
group-onsemi 0:098463de4c5d 4973 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 4974 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 4975 * @return none.
group-onsemi 0:098463de4c5d 4976 */
group-onsemi 0:098463de4c5d 4977
group-onsemi 0:098463de4c5d 4978 void arm_cmplx_conj_q15(
group-onsemi 0:098463de4c5d 4979 q15_t * pSrc,
group-onsemi 0:098463de4c5d 4980 q15_t * pDst,
group-onsemi 0:098463de4c5d 4981 uint32_t numSamples);
group-onsemi 0:098463de4c5d 4982
group-onsemi 0:098463de4c5d 4983
group-onsemi 0:098463de4c5d 4984
group-onsemi 0:098463de4c5d 4985 /**
group-onsemi 0:098463de4c5d 4986 * @brief Floating-point complex magnitude squared
group-onsemi 0:098463de4c5d 4987 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 4988 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 4989 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 4990 * @return none.
group-onsemi 0:098463de4c5d 4991 */
group-onsemi 0:098463de4c5d 4992
group-onsemi 0:098463de4c5d 4993 void arm_cmplx_mag_squared_f32(
group-onsemi 0:098463de4c5d 4994 float32_t * pSrc,
group-onsemi 0:098463de4c5d 4995 float32_t * pDst,
group-onsemi 0:098463de4c5d 4996 uint32_t numSamples);
group-onsemi 0:098463de4c5d 4997
group-onsemi 0:098463de4c5d 4998 /**
group-onsemi 0:098463de4c5d 4999 * @brief Q31 complex magnitude squared
group-onsemi 0:098463de4c5d 5000 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 5001 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 5002 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 5003 * @return none.
group-onsemi 0:098463de4c5d 5004 */
group-onsemi 0:098463de4c5d 5005
group-onsemi 0:098463de4c5d 5006 void arm_cmplx_mag_squared_q31(
group-onsemi 0:098463de4c5d 5007 q31_t * pSrc,
group-onsemi 0:098463de4c5d 5008 q31_t * pDst,
group-onsemi 0:098463de4c5d 5009 uint32_t numSamples);
group-onsemi 0:098463de4c5d 5010
group-onsemi 0:098463de4c5d 5011 /**
group-onsemi 0:098463de4c5d 5012 * @brief Q15 complex magnitude squared
group-onsemi 0:098463de4c5d 5013 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 5014 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 5015 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 5016 * @return none.
group-onsemi 0:098463de4c5d 5017 */
group-onsemi 0:098463de4c5d 5018
group-onsemi 0:098463de4c5d 5019 void arm_cmplx_mag_squared_q15(
group-onsemi 0:098463de4c5d 5020 q15_t * pSrc,
group-onsemi 0:098463de4c5d 5021 q15_t * pDst,
group-onsemi 0:098463de4c5d 5022 uint32_t numSamples);
group-onsemi 0:098463de4c5d 5023
group-onsemi 0:098463de4c5d 5024
group-onsemi 0:098463de4c5d 5025 /**
group-onsemi 0:098463de4c5d 5026 * @ingroup groupController
group-onsemi 0:098463de4c5d 5027 */
group-onsemi 0:098463de4c5d 5028
group-onsemi 0:098463de4c5d 5029 /**
group-onsemi 0:098463de4c5d 5030 * @defgroup PID PID Motor Control
group-onsemi 0:098463de4c5d 5031 *
group-onsemi 0:098463de4c5d 5032 * A Proportional Integral Derivative (PID) controller is a generic feedback control
group-onsemi 0:098463de4c5d 5033 * loop mechanism widely used in industrial control systems.
group-onsemi 0:098463de4c5d 5034 * A PID controller is the most commonly used type of feedback controller.
group-onsemi 0:098463de4c5d 5035 *
group-onsemi 0:098463de4c5d 5036 * This set of functions implements (PID) controllers
group-onsemi 0:098463de4c5d 5037 * for Q15, Q31, and floating-point data types. The functions operate on a single sample
group-onsemi 0:098463de4c5d 5038 * of data and each call to the function returns a single processed value.
group-onsemi 0:098463de4c5d 5039 * <code>S</code> points to an instance of the PID control data structure. <code>in</code>
group-onsemi 0:098463de4c5d 5040 * is the input sample value. The functions return the output value.
group-onsemi 0:098463de4c5d 5041 *
group-onsemi 0:098463de4c5d 5042 * \par Algorithm:
group-onsemi 0:098463de4c5d 5043 * <pre>
group-onsemi 0:098463de4c5d 5044 * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2]
group-onsemi 0:098463de4c5d 5045 * A0 = Kp + Ki + Kd
group-onsemi 0:098463de4c5d 5046 * A1 = (-Kp ) - (2 * Kd )
group-onsemi 0:098463de4c5d 5047 * A2 = Kd </pre>
group-onsemi 0:098463de4c5d 5048 *
group-onsemi 0:098463de4c5d 5049 * \par
group-onsemi 0:098463de4c5d 5050 * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant
group-onsemi 0:098463de4c5d 5051 *
group-onsemi 0:098463de4c5d 5052 * \par
group-onsemi 0:098463de4c5d 5053 * \image html PID.gif "Proportional Integral Derivative Controller"
group-onsemi 0:098463de4c5d 5054 *
group-onsemi 0:098463de4c5d 5055 * \par
group-onsemi 0:098463de4c5d 5056 * The PID controller calculates an "error" value as the difference between
group-onsemi 0:098463de4c5d 5057 * the measured output and the reference input.
group-onsemi 0:098463de4c5d 5058 * The controller attempts to minimize the error by adjusting the process control inputs.
group-onsemi 0:098463de4c5d 5059 * The proportional value determines the reaction to the current error,
group-onsemi 0:098463de4c5d 5060 * the integral value determines the reaction based on the sum of recent errors,
group-onsemi 0:098463de4c5d 5061 * and the derivative value determines the reaction based on the rate at which the error has been changing.
group-onsemi 0:098463de4c5d 5062 *
group-onsemi 0:098463de4c5d 5063 * \par Instance Structure
group-onsemi 0:098463de4c5d 5064 * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure.
group-onsemi 0:098463de4c5d 5065 * A separate instance structure must be defined for each PID Controller.
group-onsemi 0:098463de4c5d 5066 * There are separate instance structure declarations for each of the 3 supported data types.
group-onsemi 0:098463de4c5d 5067 *
group-onsemi 0:098463de4c5d 5068 * \par Reset Functions
group-onsemi 0:098463de4c5d 5069 * There is also an associated reset function for each data type which clears the state array.
group-onsemi 0:098463de4c5d 5070 *
group-onsemi 0:098463de4c5d 5071 * \par Initialization Functions
group-onsemi 0:098463de4c5d 5072 * There is also an associated initialization function for each data type.
group-onsemi 0:098463de4c5d 5073 * The initialization function performs the following operations:
group-onsemi 0:098463de4c5d 5074 * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains.
group-onsemi 0:098463de4c5d 5075 * - Zeros out the values in the state buffer.
group-onsemi 0:098463de4c5d 5076 *
group-onsemi 0:098463de4c5d 5077 * \par
group-onsemi 0:098463de4c5d 5078 * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function.
group-onsemi 0:098463de4c5d 5079 *
group-onsemi 0:098463de4c5d 5080 * \par Fixed-Point Behavior
group-onsemi 0:098463de4c5d 5081 * Care must be taken when using the fixed-point versions of the PID Controller functions.
group-onsemi 0:098463de4c5d 5082 * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered.
group-onsemi 0:098463de4c5d 5083 * Refer to the function specific documentation below for usage guidelines.
group-onsemi 0:098463de4c5d 5084 */
group-onsemi 0:098463de4c5d 5085
group-onsemi 0:098463de4c5d 5086 /**
group-onsemi 0:098463de4c5d 5087 * @addtogroup PID
group-onsemi 0:098463de4c5d 5088 * @{
group-onsemi 0:098463de4c5d 5089 */
group-onsemi 0:098463de4c5d 5090
group-onsemi 0:098463de4c5d 5091 /**
group-onsemi 0:098463de4c5d 5092 * @brief Process function for the floating-point PID Control.
group-onsemi 0:098463de4c5d 5093 * @param[in,out] *S is an instance of the floating-point PID Control structure
group-onsemi 0:098463de4c5d 5094 * @param[in] in input sample to process
group-onsemi 0:098463de4c5d 5095 * @return out processed output sample.
group-onsemi 0:098463de4c5d 5096 */
group-onsemi 0:098463de4c5d 5097
group-onsemi 0:098463de4c5d 5098
group-onsemi 0:098463de4c5d 5099 static __INLINE float32_t arm_pid_f32(
group-onsemi 0:098463de4c5d 5100 arm_pid_instance_f32 * S,
group-onsemi 0:098463de4c5d 5101 float32_t in)
group-onsemi 0:098463de4c5d 5102 {
group-onsemi 0:098463de4c5d 5103 float32_t out;
group-onsemi 0:098463de4c5d 5104
group-onsemi 0:098463de4c5d 5105 /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */
group-onsemi 0:098463de4c5d 5106 out = (S->A0 * in) +
group-onsemi 0:098463de4c5d 5107 (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]);
group-onsemi 0:098463de4c5d 5108
group-onsemi 0:098463de4c5d 5109 /* Update state */
group-onsemi 0:098463de4c5d 5110 S->state[1] = S->state[0];
group-onsemi 0:098463de4c5d 5111 S->state[0] = in;
group-onsemi 0:098463de4c5d 5112 S->state[2] = out;
group-onsemi 0:098463de4c5d 5113
group-onsemi 0:098463de4c5d 5114 /* return to application */
group-onsemi 0:098463de4c5d 5115 return (out);
group-onsemi 0:098463de4c5d 5116
group-onsemi 0:098463de4c5d 5117 }
group-onsemi 0:098463de4c5d 5118
group-onsemi 0:098463de4c5d 5119 /**
group-onsemi 0:098463de4c5d 5120 * @brief Process function for the Q31 PID Control.
group-onsemi 0:098463de4c5d 5121 * @param[in,out] *S points to an instance of the Q31 PID Control structure
group-onsemi 0:098463de4c5d 5122 * @param[in] in input sample to process
group-onsemi 0:098463de4c5d 5123 * @return out processed output sample.
group-onsemi 0:098463de4c5d 5124 *
group-onsemi 0:098463de4c5d 5125 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5126 * \par
group-onsemi 0:098463de4c5d 5127 * The function is implemented using an internal 64-bit accumulator.
group-onsemi 0:098463de4c5d 5128 * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit.
group-onsemi 0:098463de4c5d 5129 * Thus, if the accumulator result overflows it wraps around rather than clip.
group-onsemi 0:098463de4c5d 5130 * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions.
group-onsemi 0:098463de4c5d 5131 * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format.
group-onsemi 0:098463de4c5d 5132 */
group-onsemi 0:098463de4c5d 5133
group-onsemi 0:098463de4c5d 5134 static __INLINE q31_t arm_pid_q31(
group-onsemi 0:098463de4c5d 5135 arm_pid_instance_q31 * S,
group-onsemi 0:098463de4c5d 5136 q31_t in)
group-onsemi 0:098463de4c5d 5137 {
group-onsemi 0:098463de4c5d 5138 q63_t acc;
group-onsemi 0:098463de4c5d 5139 q31_t out;
group-onsemi 0:098463de4c5d 5140
group-onsemi 0:098463de4c5d 5141 /* acc = A0 * x[n] */
group-onsemi 0:098463de4c5d 5142 acc = (q63_t) S->A0 * in;
group-onsemi 0:098463de4c5d 5143
group-onsemi 0:098463de4c5d 5144 /* acc += A1 * x[n-1] */
group-onsemi 0:098463de4c5d 5145 acc += (q63_t) S->A1 * S->state[0];
group-onsemi 0:098463de4c5d 5146
group-onsemi 0:098463de4c5d 5147 /* acc += A2 * x[n-2] */
group-onsemi 0:098463de4c5d 5148 acc += (q63_t) S->A2 * S->state[1];
group-onsemi 0:098463de4c5d 5149
group-onsemi 0:098463de4c5d 5150 /* convert output to 1.31 format to add y[n-1] */
group-onsemi 0:098463de4c5d 5151 out = (q31_t) (acc >> 31u);
group-onsemi 0:098463de4c5d 5152
group-onsemi 0:098463de4c5d 5153 /* out += y[n-1] */
group-onsemi 0:098463de4c5d 5154 out += S->state[2];
group-onsemi 0:098463de4c5d 5155
group-onsemi 0:098463de4c5d 5156 /* Update state */
group-onsemi 0:098463de4c5d 5157 S->state[1] = S->state[0];
group-onsemi 0:098463de4c5d 5158 S->state[0] = in;
group-onsemi 0:098463de4c5d 5159 S->state[2] = out;
group-onsemi 0:098463de4c5d 5160
group-onsemi 0:098463de4c5d 5161 /* return to application */
group-onsemi 0:098463de4c5d 5162 return (out);
group-onsemi 0:098463de4c5d 5163
group-onsemi 0:098463de4c5d 5164 }
group-onsemi 0:098463de4c5d 5165
group-onsemi 0:098463de4c5d 5166 /**
group-onsemi 0:098463de4c5d 5167 * @brief Process function for the Q15 PID Control.
group-onsemi 0:098463de4c5d 5168 * @param[in,out] *S points to an instance of the Q15 PID Control structure
group-onsemi 0:098463de4c5d 5169 * @param[in] in input sample to process
group-onsemi 0:098463de4c5d 5170 * @return out processed output sample.
group-onsemi 0:098463de4c5d 5171 *
group-onsemi 0:098463de4c5d 5172 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5173 * \par
group-onsemi 0:098463de4c5d 5174 * The function is implemented using a 64-bit internal accumulator.
group-onsemi 0:098463de4c5d 5175 * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result.
group-onsemi 0:098463de4c5d 5176 * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format.
group-onsemi 0:098463de4c5d 5177 * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved.
group-onsemi 0:098463de4c5d 5178 * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits.
group-onsemi 0:098463de4c5d 5179 * Lastly, the accumulator is saturated to yield a result in 1.15 format.
group-onsemi 0:098463de4c5d 5180 */
group-onsemi 0:098463de4c5d 5181
group-onsemi 0:098463de4c5d 5182 static __INLINE q15_t arm_pid_q15(
group-onsemi 0:098463de4c5d 5183 arm_pid_instance_q15 * S,
group-onsemi 0:098463de4c5d 5184 q15_t in)
group-onsemi 0:098463de4c5d 5185 {
group-onsemi 0:098463de4c5d 5186 q63_t acc;
group-onsemi 0:098463de4c5d 5187 q15_t out;
group-onsemi 0:098463de4c5d 5188
group-onsemi 0:098463de4c5d 5189 #ifndef ARM_MATH_CM0_FAMILY
group-onsemi 0:098463de4c5d 5190 __SIMD32_TYPE *vstate;
group-onsemi 0:098463de4c5d 5191
group-onsemi 0:098463de4c5d 5192 /* Implementation of PID controller */
group-onsemi 0:098463de4c5d 5193
group-onsemi 0:098463de4c5d 5194 /* acc = A0 * x[n] */
group-onsemi 0:098463de4c5d 5195 acc = (q31_t) __SMUAD(S->A0, in);
group-onsemi 0:098463de4c5d 5196
group-onsemi 0:098463de4c5d 5197 /* acc += A1 * x[n-1] + A2 * x[n-2] */
group-onsemi 0:098463de4c5d 5198 vstate = __SIMD32_CONST(S->state);
group-onsemi 0:098463de4c5d 5199 acc = __SMLALD(S->A1, (q31_t) *vstate, acc);
group-onsemi 0:098463de4c5d 5200
group-onsemi 0:098463de4c5d 5201 #else
group-onsemi 0:098463de4c5d 5202 /* acc = A0 * x[n] */
group-onsemi 0:098463de4c5d 5203 acc = ((q31_t) S->A0) * in;
group-onsemi 0:098463de4c5d 5204
group-onsemi 0:098463de4c5d 5205 /* acc += A1 * x[n-1] + A2 * x[n-2] */
group-onsemi 0:098463de4c5d 5206 acc += (q31_t) S->A1 * S->state[0];
group-onsemi 0:098463de4c5d 5207 acc += (q31_t) S->A2 * S->state[1];
group-onsemi 0:098463de4c5d 5208
group-onsemi 0:098463de4c5d 5209 #endif
group-onsemi 0:098463de4c5d 5210
group-onsemi 0:098463de4c5d 5211 /* acc += y[n-1] */
group-onsemi 0:098463de4c5d 5212 acc += (q31_t) S->state[2] << 15;
group-onsemi 0:098463de4c5d 5213
group-onsemi 0:098463de4c5d 5214 /* saturate the output */
group-onsemi 0:098463de4c5d 5215 out = (q15_t) (__SSAT((acc >> 15), 16));
group-onsemi 0:098463de4c5d 5216
group-onsemi 0:098463de4c5d 5217 /* Update state */
group-onsemi 0:098463de4c5d 5218 S->state[1] = S->state[0];
group-onsemi 0:098463de4c5d 5219 S->state[0] = in;
group-onsemi 0:098463de4c5d 5220 S->state[2] = out;
group-onsemi 0:098463de4c5d 5221
group-onsemi 0:098463de4c5d 5222 /* return to application */
group-onsemi 0:098463de4c5d 5223 return (out);
group-onsemi 0:098463de4c5d 5224
group-onsemi 0:098463de4c5d 5225 }
group-onsemi 0:098463de4c5d 5226
group-onsemi 0:098463de4c5d 5227 /**
group-onsemi 0:098463de4c5d 5228 * @} end of PID group
group-onsemi 0:098463de4c5d 5229 */
group-onsemi 0:098463de4c5d 5230
group-onsemi 0:098463de4c5d 5231
group-onsemi 0:098463de4c5d 5232 /**
group-onsemi 0:098463de4c5d 5233 * @brief Floating-point matrix inverse.
group-onsemi 0:098463de4c5d 5234 * @param[in] *src points to the instance of the input floating-point matrix structure.
group-onsemi 0:098463de4c5d 5235 * @param[out] *dst points to the instance of the output floating-point matrix structure.
group-onsemi 0:098463de4c5d 5236 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
group-onsemi 0:098463de4c5d 5237 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
group-onsemi 0:098463de4c5d 5238 */
group-onsemi 0:098463de4c5d 5239
group-onsemi 0:098463de4c5d 5240 arm_status arm_mat_inverse_f32(
group-onsemi 0:098463de4c5d 5241 const arm_matrix_instance_f32 * src,
group-onsemi 0:098463de4c5d 5242 arm_matrix_instance_f32 * dst);
group-onsemi 0:098463de4c5d 5243
group-onsemi 0:098463de4c5d 5244
group-onsemi 0:098463de4c5d 5245 /**
group-onsemi 0:098463de4c5d 5246 * @brief Floating-point matrix inverse.
group-onsemi 0:098463de4c5d 5247 * @param[in] *src points to the instance of the input floating-point matrix structure.
group-onsemi 0:098463de4c5d 5248 * @param[out] *dst points to the instance of the output floating-point matrix structure.
group-onsemi 0:098463de4c5d 5249 * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match.
group-onsemi 0:098463de4c5d 5250 * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR.
group-onsemi 0:098463de4c5d 5251 */
group-onsemi 0:098463de4c5d 5252
group-onsemi 0:098463de4c5d 5253 arm_status arm_mat_inverse_f64(
group-onsemi 0:098463de4c5d 5254 const arm_matrix_instance_f64 * src,
group-onsemi 0:098463de4c5d 5255 arm_matrix_instance_f64 * dst);
group-onsemi 0:098463de4c5d 5256
group-onsemi 0:098463de4c5d 5257
group-onsemi 0:098463de4c5d 5258
group-onsemi 0:098463de4c5d 5259 /**
group-onsemi 0:098463de4c5d 5260 * @ingroup groupController
group-onsemi 0:098463de4c5d 5261 */
group-onsemi 0:098463de4c5d 5262
group-onsemi 0:098463de4c5d 5263
group-onsemi 0:098463de4c5d 5264 /**
group-onsemi 0:098463de4c5d 5265 * @defgroup clarke Vector Clarke Transform
group-onsemi 0:098463de4c5d 5266 * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector.
group-onsemi 0:098463de4c5d 5267 * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents
group-onsemi 0:098463de4c5d 5268 * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>.
group-onsemi 0:098463de4c5d 5269 * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below
group-onsemi 0:098463de4c5d 5270 * \image html clarke.gif Stator current space vector and its components in (a,b).
group-onsemi 0:098463de4c5d 5271 * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code>
group-onsemi 0:098463de4c5d 5272 * can be calculated using only <code>Ia</code> and <code>Ib</code>.
group-onsemi 0:098463de4c5d 5273 *
group-onsemi 0:098463de4c5d 5274 * The function operates on a single sample of data and each call to the function returns the processed output.
group-onsemi 0:098463de4c5d 5275 * The library provides separate functions for Q31 and floating-point data types.
group-onsemi 0:098463de4c5d 5276 * \par Algorithm
group-onsemi 0:098463de4c5d 5277 * \image html clarkeFormula.gif
group-onsemi 0:098463de4c5d 5278 * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and
group-onsemi 0:098463de4c5d 5279 * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector.
group-onsemi 0:098463de4c5d 5280 * \par Fixed-Point Behavior
group-onsemi 0:098463de4c5d 5281 * Care must be taken when using the Q31 version of the Clarke transform.
group-onsemi 0:098463de4c5d 5282 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
group-onsemi 0:098463de4c5d 5283 * Refer to the function specific documentation below for usage guidelines.
group-onsemi 0:098463de4c5d 5284 */
group-onsemi 0:098463de4c5d 5285
group-onsemi 0:098463de4c5d 5286 /**
group-onsemi 0:098463de4c5d 5287 * @addtogroup clarke
group-onsemi 0:098463de4c5d 5288 * @{
group-onsemi 0:098463de4c5d 5289 */
group-onsemi 0:098463de4c5d 5290
group-onsemi 0:098463de4c5d 5291 /**
group-onsemi 0:098463de4c5d 5292 *
group-onsemi 0:098463de4c5d 5293 * @brief Floating-point Clarke transform
group-onsemi 0:098463de4c5d 5294 * @param[in] Ia input three-phase coordinate <code>a</code>
group-onsemi 0:098463de4c5d 5295 * @param[in] Ib input three-phase coordinate <code>b</code>
group-onsemi 0:098463de4c5d 5296 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5297 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5298 * @return none.
group-onsemi 0:098463de4c5d 5299 */
group-onsemi 0:098463de4c5d 5300
group-onsemi 0:098463de4c5d 5301 static __INLINE void arm_clarke_f32(
group-onsemi 0:098463de4c5d 5302 float32_t Ia,
group-onsemi 0:098463de4c5d 5303 float32_t Ib,
group-onsemi 0:098463de4c5d 5304 float32_t * pIalpha,
group-onsemi 0:098463de4c5d 5305 float32_t * pIbeta)
group-onsemi 0:098463de4c5d 5306 {
group-onsemi 0:098463de4c5d 5307 /* Calculate pIalpha using the equation, pIalpha = Ia */
group-onsemi 0:098463de4c5d 5308 *pIalpha = Ia;
group-onsemi 0:098463de4c5d 5309
group-onsemi 0:098463de4c5d 5310 /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */
group-onsemi 0:098463de4c5d 5311 *pIbeta =
group-onsemi 0:098463de4c5d 5312 ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib);
group-onsemi 0:098463de4c5d 5313
group-onsemi 0:098463de4c5d 5314 }
group-onsemi 0:098463de4c5d 5315
group-onsemi 0:098463de4c5d 5316 /**
group-onsemi 0:098463de4c5d 5317 * @brief Clarke transform for Q31 version
group-onsemi 0:098463de4c5d 5318 * @param[in] Ia input three-phase coordinate <code>a</code>
group-onsemi 0:098463de4c5d 5319 * @param[in] Ib input three-phase coordinate <code>b</code>
group-onsemi 0:098463de4c5d 5320 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5321 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5322 * @return none.
group-onsemi 0:098463de4c5d 5323 *
group-onsemi 0:098463de4c5d 5324 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5325 * \par
group-onsemi 0:098463de4c5d 5326 * The function is implemented using an internal 32-bit accumulator.
group-onsemi 0:098463de4c5d 5327 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
group-onsemi 0:098463de4c5d 5328 * There is saturation on the addition, hence there is no risk of overflow.
group-onsemi 0:098463de4c5d 5329 */
group-onsemi 0:098463de4c5d 5330
group-onsemi 0:098463de4c5d 5331 static __INLINE void arm_clarke_q31(
group-onsemi 0:098463de4c5d 5332 q31_t Ia,
group-onsemi 0:098463de4c5d 5333 q31_t Ib,
group-onsemi 0:098463de4c5d 5334 q31_t * pIalpha,
group-onsemi 0:098463de4c5d 5335 q31_t * pIbeta)
group-onsemi 0:098463de4c5d 5336 {
group-onsemi 0:098463de4c5d 5337 q31_t product1, product2; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5338
group-onsemi 0:098463de4c5d 5339 /* Calculating pIalpha from Ia by equation pIalpha = Ia */
group-onsemi 0:098463de4c5d 5340 *pIalpha = Ia;
group-onsemi 0:098463de4c5d 5341
group-onsemi 0:098463de4c5d 5342 /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */
group-onsemi 0:098463de4c5d 5343 product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30);
group-onsemi 0:098463de4c5d 5344
group-onsemi 0:098463de4c5d 5345 /* Intermediate product is calculated by (2/sqrt(3) * Ib) */
group-onsemi 0:098463de4c5d 5346 product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30);
group-onsemi 0:098463de4c5d 5347
group-onsemi 0:098463de4c5d 5348 /* pIbeta is calculated by adding the intermediate products */
group-onsemi 0:098463de4c5d 5349 *pIbeta = __QADD(product1, product2);
group-onsemi 0:098463de4c5d 5350 }
group-onsemi 0:098463de4c5d 5351
group-onsemi 0:098463de4c5d 5352 /**
group-onsemi 0:098463de4c5d 5353 * @} end of clarke group
group-onsemi 0:098463de4c5d 5354 */
group-onsemi 0:098463de4c5d 5355
group-onsemi 0:098463de4c5d 5356 /**
group-onsemi 0:098463de4c5d 5357 * @brief Converts the elements of the Q7 vector to Q31 vector.
group-onsemi 0:098463de4c5d 5358 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 5359 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 5360 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 5361 * @return none.
group-onsemi 0:098463de4c5d 5362 */
group-onsemi 0:098463de4c5d 5363 void arm_q7_to_q31(
group-onsemi 0:098463de4c5d 5364 q7_t * pSrc,
group-onsemi 0:098463de4c5d 5365 q31_t * pDst,
group-onsemi 0:098463de4c5d 5366 uint32_t blockSize);
group-onsemi 0:098463de4c5d 5367
group-onsemi 0:098463de4c5d 5368
group-onsemi 0:098463de4c5d 5369
group-onsemi 0:098463de4c5d 5370
group-onsemi 0:098463de4c5d 5371 /**
group-onsemi 0:098463de4c5d 5372 * @ingroup groupController
group-onsemi 0:098463de4c5d 5373 */
group-onsemi 0:098463de4c5d 5374
group-onsemi 0:098463de4c5d 5375 /**
group-onsemi 0:098463de4c5d 5376 * @defgroup inv_clarke Vector Inverse Clarke Transform
group-onsemi 0:098463de4c5d 5377 * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases.
group-onsemi 0:098463de4c5d 5378 *
group-onsemi 0:098463de4c5d 5379 * The function operates on a single sample of data and each call to the function returns the processed output.
group-onsemi 0:098463de4c5d 5380 * The library provides separate functions for Q31 and floating-point data types.
group-onsemi 0:098463de4c5d 5381 * \par Algorithm
group-onsemi 0:098463de4c5d 5382 * \image html clarkeInvFormula.gif
group-onsemi 0:098463de4c5d 5383 * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and
group-onsemi 0:098463de4c5d 5384 * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector.
group-onsemi 0:098463de4c5d 5385 * \par Fixed-Point Behavior
group-onsemi 0:098463de4c5d 5386 * Care must be taken when using the Q31 version of the Clarke transform.
group-onsemi 0:098463de4c5d 5387 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
group-onsemi 0:098463de4c5d 5388 * Refer to the function specific documentation below for usage guidelines.
group-onsemi 0:098463de4c5d 5389 */
group-onsemi 0:098463de4c5d 5390
group-onsemi 0:098463de4c5d 5391 /**
group-onsemi 0:098463de4c5d 5392 * @addtogroup inv_clarke
group-onsemi 0:098463de4c5d 5393 * @{
group-onsemi 0:098463de4c5d 5394 */
group-onsemi 0:098463de4c5d 5395
group-onsemi 0:098463de4c5d 5396 /**
group-onsemi 0:098463de4c5d 5397 * @brief Floating-point Inverse Clarke transform
group-onsemi 0:098463de4c5d 5398 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5399 * @param[in] Ibeta input two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5400 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
group-onsemi 0:098463de4c5d 5401 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
group-onsemi 0:098463de4c5d 5402 * @return none.
group-onsemi 0:098463de4c5d 5403 */
group-onsemi 0:098463de4c5d 5404
group-onsemi 0:098463de4c5d 5405
group-onsemi 0:098463de4c5d 5406 static __INLINE void arm_inv_clarke_f32(
group-onsemi 0:098463de4c5d 5407 float32_t Ialpha,
group-onsemi 0:098463de4c5d 5408 float32_t Ibeta,
group-onsemi 0:098463de4c5d 5409 float32_t * pIa,
group-onsemi 0:098463de4c5d 5410 float32_t * pIb)
group-onsemi 0:098463de4c5d 5411 {
group-onsemi 0:098463de4c5d 5412 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
group-onsemi 0:098463de4c5d 5413 *pIa = Ialpha;
group-onsemi 0:098463de4c5d 5414
group-onsemi 0:098463de4c5d 5415 /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */
group-onsemi 0:098463de4c5d 5416 *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta;
group-onsemi 0:098463de4c5d 5417
group-onsemi 0:098463de4c5d 5418 }
group-onsemi 0:098463de4c5d 5419
group-onsemi 0:098463de4c5d 5420 /**
group-onsemi 0:098463de4c5d 5421 * @brief Inverse Clarke transform for Q31 version
group-onsemi 0:098463de4c5d 5422 * @param[in] Ialpha input two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5423 * @param[in] Ibeta input two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5424 * @param[out] *pIa points to output three-phase coordinate <code>a</code>
group-onsemi 0:098463de4c5d 5425 * @param[out] *pIb points to output three-phase coordinate <code>b</code>
group-onsemi 0:098463de4c5d 5426 * @return none.
group-onsemi 0:098463de4c5d 5427 *
group-onsemi 0:098463de4c5d 5428 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5429 * \par
group-onsemi 0:098463de4c5d 5430 * The function is implemented using an internal 32-bit accumulator.
group-onsemi 0:098463de4c5d 5431 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
group-onsemi 0:098463de4c5d 5432 * There is saturation on the subtraction, hence there is no risk of overflow.
group-onsemi 0:098463de4c5d 5433 */
group-onsemi 0:098463de4c5d 5434
group-onsemi 0:098463de4c5d 5435 static __INLINE void arm_inv_clarke_q31(
group-onsemi 0:098463de4c5d 5436 q31_t Ialpha,
group-onsemi 0:098463de4c5d 5437 q31_t Ibeta,
group-onsemi 0:098463de4c5d 5438 q31_t * pIa,
group-onsemi 0:098463de4c5d 5439 q31_t * pIb)
group-onsemi 0:098463de4c5d 5440 {
group-onsemi 0:098463de4c5d 5441 q31_t product1, product2; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5442
group-onsemi 0:098463de4c5d 5443 /* Calculating pIa from Ialpha by equation pIa = Ialpha */
group-onsemi 0:098463de4c5d 5444 *pIa = Ialpha;
group-onsemi 0:098463de4c5d 5445
group-onsemi 0:098463de4c5d 5446 /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */
group-onsemi 0:098463de4c5d 5447 product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31);
group-onsemi 0:098463de4c5d 5448
group-onsemi 0:098463de4c5d 5449 /* Intermediate product is calculated by (1/sqrt(3) * pIb) */
group-onsemi 0:098463de4c5d 5450 product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31);
group-onsemi 0:098463de4c5d 5451
group-onsemi 0:098463de4c5d 5452 /* pIb is calculated by subtracting the products */
group-onsemi 0:098463de4c5d 5453 *pIb = __QSUB(product2, product1);
group-onsemi 0:098463de4c5d 5454
group-onsemi 0:098463de4c5d 5455 }
group-onsemi 0:098463de4c5d 5456
group-onsemi 0:098463de4c5d 5457 /**
group-onsemi 0:098463de4c5d 5458 * @} end of inv_clarke group
group-onsemi 0:098463de4c5d 5459 */
group-onsemi 0:098463de4c5d 5460
group-onsemi 0:098463de4c5d 5461 /**
group-onsemi 0:098463de4c5d 5462 * @brief Converts the elements of the Q7 vector to Q15 vector.
group-onsemi 0:098463de4c5d 5463 * @param[in] *pSrc input pointer
group-onsemi 0:098463de4c5d 5464 * @param[out] *pDst output pointer
group-onsemi 0:098463de4c5d 5465 * @param[in] blockSize number of samples to process
group-onsemi 0:098463de4c5d 5466 * @return none.
group-onsemi 0:098463de4c5d 5467 */
group-onsemi 0:098463de4c5d 5468 void arm_q7_to_q15(
group-onsemi 0:098463de4c5d 5469 q7_t * pSrc,
group-onsemi 0:098463de4c5d 5470 q15_t * pDst,
group-onsemi 0:098463de4c5d 5471 uint32_t blockSize);
group-onsemi 0:098463de4c5d 5472
group-onsemi 0:098463de4c5d 5473
group-onsemi 0:098463de4c5d 5474
group-onsemi 0:098463de4c5d 5475 /**
group-onsemi 0:098463de4c5d 5476 * @ingroup groupController
group-onsemi 0:098463de4c5d 5477 */
group-onsemi 0:098463de4c5d 5478
group-onsemi 0:098463de4c5d 5479 /**
group-onsemi 0:098463de4c5d 5480 * @defgroup park Vector Park Transform
group-onsemi 0:098463de4c5d 5481 *
group-onsemi 0:098463de4c5d 5482 * Forward Park transform converts the input two-coordinate vector to flux and torque components.
group-onsemi 0:098463de4c5d 5483 * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents
group-onsemi 0:098463de4c5d 5484 * from the stationary to the moving reference frame and control the spatial relationship between
group-onsemi 0:098463de4c5d 5485 * the stator vector current and rotor flux vector.
group-onsemi 0:098463de4c5d 5486 * If we consider the d axis aligned with the rotor flux, the diagram below shows the
group-onsemi 0:098463de4c5d 5487 * current vector and the relationship from the two reference frames:
group-onsemi 0:098463de4c5d 5488 * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame"
group-onsemi 0:098463de4c5d 5489 *
group-onsemi 0:098463de4c5d 5490 * The function operates on a single sample of data and each call to the function returns the processed output.
group-onsemi 0:098463de4c5d 5491 * The library provides separate functions for Q31 and floating-point data types.
group-onsemi 0:098463de4c5d 5492 * \par Algorithm
group-onsemi 0:098463de4c5d 5493 * \image html parkFormula.gif
group-onsemi 0:098463de4c5d 5494 * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components,
group-onsemi 0:098463de4c5d 5495 * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
group-onsemi 0:098463de4c5d 5496 * cosine and sine values of theta (rotor flux position).
group-onsemi 0:098463de4c5d 5497 * \par Fixed-Point Behavior
group-onsemi 0:098463de4c5d 5498 * Care must be taken when using the Q31 version of the Park transform.
group-onsemi 0:098463de4c5d 5499 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
group-onsemi 0:098463de4c5d 5500 * Refer to the function specific documentation below for usage guidelines.
group-onsemi 0:098463de4c5d 5501 */
group-onsemi 0:098463de4c5d 5502
group-onsemi 0:098463de4c5d 5503 /**
group-onsemi 0:098463de4c5d 5504 * @addtogroup park
group-onsemi 0:098463de4c5d 5505 * @{
group-onsemi 0:098463de4c5d 5506 */
group-onsemi 0:098463de4c5d 5507
group-onsemi 0:098463de4c5d 5508 /**
group-onsemi 0:098463de4c5d 5509 * @brief Floating-point Park transform
group-onsemi 0:098463de4c5d 5510 * @param[in] Ialpha input two-phase vector coordinate alpha
group-onsemi 0:098463de4c5d 5511 * @param[in] Ibeta input two-phase vector coordinate beta
group-onsemi 0:098463de4c5d 5512 * @param[out] *pId points to output rotor reference frame d
group-onsemi 0:098463de4c5d 5513 * @param[out] *pIq points to output rotor reference frame q
group-onsemi 0:098463de4c5d 5514 * @param[in] sinVal sine value of rotation angle theta
group-onsemi 0:098463de4c5d 5515 * @param[in] cosVal cosine value of rotation angle theta
group-onsemi 0:098463de4c5d 5516 * @return none.
group-onsemi 0:098463de4c5d 5517 *
group-onsemi 0:098463de4c5d 5518 * The function implements the forward Park transform.
group-onsemi 0:098463de4c5d 5519 *
group-onsemi 0:098463de4c5d 5520 */
group-onsemi 0:098463de4c5d 5521
group-onsemi 0:098463de4c5d 5522 static __INLINE void arm_park_f32(
group-onsemi 0:098463de4c5d 5523 float32_t Ialpha,
group-onsemi 0:098463de4c5d 5524 float32_t Ibeta,
group-onsemi 0:098463de4c5d 5525 float32_t * pId,
group-onsemi 0:098463de4c5d 5526 float32_t * pIq,
group-onsemi 0:098463de4c5d 5527 float32_t sinVal,
group-onsemi 0:098463de4c5d 5528 float32_t cosVal)
group-onsemi 0:098463de4c5d 5529 {
group-onsemi 0:098463de4c5d 5530 /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */
group-onsemi 0:098463de4c5d 5531 *pId = Ialpha * cosVal + Ibeta * sinVal;
group-onsemi 0:098463de4c5d 5532
group-onsemi 0:098463de4c5d 5533 /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */
group-onsemi 0:098463de4c5d 5534 *pIq = -Ialpha * sinVal + Ibeta * cosVal;
group-onsemi 0:098463de4c5d 5535
group-onsemi 0:098463de4c5d 5536 }
group-onsemi 0:098463de4c5d 5537
group-onsemi 0:098463de4c5d 5538 /**
group-onsemi 0:098463de4c5d 5539 * @brief Park transform for Q31 version
group-onsemi 0:098463de4c5d 5540 * @param[in] Ialpha input two-phase vector coordinate alpha
group-onsemi 0:098463de4c5d 5541 * @param[in] Ibeta input two-phase vector coordinate beta
group-onsemi 0:098463de4c5d 5542 * @param[out] *pId points to output rotor reference frame d
group-onsemi 0:098463de4c5d 5543 * @param[out] *pIq points to output rotor reference frame q
group-onsemi 0:098463de4c5d 5544 * @param[in] sinVal sine value of rotation angle theta
group-onsemi 0:098463de4c5d 5545 * @param[in] cosVal cosine value of rotation angle theta
group-onsemi 0:098463de4c5d 5546 * @return none.
group-onsemi 0:098463de4c5d 5547 *
group-onsemi 0:098463de4c5d 5548 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5549 * \par
group-onsemi 0:098463de4c5d 5550 * The function is implemented using an internal 32-bit accumulator.
group-onsemi 0:098463de4c5d 5551 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
group-onsemi 0:098463de4c5d 5552 * There is saturation on the addition and subtraction, hence there is no risk of overflow.
group-onsemi 0:098463de4c5d 5553 */
group-onsemi 0:098463de4c5d 5554
group-onsemi 0:098463de4c5d 5555
group-onsemi 0:098463de4c5d 5556 static __INLINE void arm_park_q31(
group-onsemi 0:098463de4c5d 5557 q31_t Ialpha,
group-onsemi 0:098463de4c5d 5558 q31_t Ibeta,
group-onsemi 0:098463de4c5d 5559 q31_t * pId,
group-onsemi 0:098463de4c5d 5560 q31_t * pIq,
group-onsemi 0:098463de4c5d 5561 q31_t sinVal,
group-onsemi 0:098463de4c5d 5562 q31_t cosVal)
group-onsemi 0:098463de4c5d 5563 {
group-onsemi 0:098463de4c5d 5564 q31_t product1, product2; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5565 q31_t product3, product4; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5566
group-onsemi 0:098463de4c5d 5567 /* Intermediate product is calculated by (Ialpha * cosVal) */
group-onsemi 0:098463de4c5d 5568 product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31);
group-onsemi 0:098463de4c5d 5569
group-onsemi 0:098463de4c5d 5570 /* Intermediate product is calculated by (Ibeta * sinVal) */
group-onsemi 0:098463de4c5d 5571 product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31);
group-onsemi 0:098463de4c5d 5572
group-onsemi 0:098463de4c5d 5573
group-onsemi 0:098463de4c5d 5574 /* Intermediate product is calculated by (Ialpha * sinVal) */
group-onsemi 0:098463de4c5d 5575 product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31);
group-onsemi 0:098463de4c5d 5576
group-onsemi 0:098463de4c5d 5577 /* Intermediate product is calculated by (Ibeta * cosVal) */
group-onsemi 0:098463de4c5d 5578 product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31);
group-onsemi 0:098463de4c5d 5579
group-onsemi 0:098463de4c5d 5580 /* Calculate pId by adding the two intermediate products 1 and 2 */
group-onsemi 0:098463de4c5d 5581 *pId = __QADD(product1, product2);
group-onsemi 0:098463de4c5d 5582
group-onsemi 0:098463de4c5d 5583 /* Calculate pIq by subtracting the two intermediate products 3 from 4 */
group-onsemi 0:098463de4c5d 5584 *pIq = __QSUB(product4, product3);
group-onsemi 0:098463de4c5d 5585 }
group-onsemi 0:098463de4c5d 5586
group-onsemi 0:098463de4c5d 5587 /**
group-onsemi 0:098463de4c5d 5588 * @} end of park group
group-onsemi 0:098463de4c5d 5589 */
group-onsemi 0:098463de4c5d 5590
group-onsemi 0:098463de4c5d 5591 /**
group-onsemi 0:098463de4c5d 5592 * @brief Converts the elements of the Q7 vector to floating-point vector.
group-onsemi 0:098463de4c5d 5593 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 5594 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 5595 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 5596 * @return none.
group-onsemi 0:098463de4c5d 5597 */
group-onsemi 0:098463de4c5d 5598 void arm_q7_to_float(
group-onsemi 0:098463de4c5d 5599 q7_t * pSrc,
group-onsemi 0:098463de4c5d 5600 float32_t * pDst,
group-onsemi 0:098463de4c5d 5601 uint32_t blockSize);
group-onsemi 0:098463de4c5d 5602
group-onsemi 0:098463de4c5d 5603
group-onsemi 0:098463de4c5d 5604 /**
group-onsemi 0:098463de4c5d 5605 * @ingroup groupController
group-onsemi 0:098463de4c5d 5606 */
group-onsemi 0:098463de4c5d 5607
group-onsemi 0:098463de4c5d 5608 /**
group-onsemi 0:098463de4c5d 5609 * @defgroup inv_park Vector Inverse Park transform
group-onsemi 0:098463de4c5d 5610 * Inverse Park transform converts the input flux and torque components to two-coordinate vector.
group-onsemi 0:098463de4c5d 5611 *
group-onsemi 0:098463de4c5d 5612 * The function operates on a single sample of data and each call to the function returns the processed output.
group-onsemi 0:098463de4c5d 5613 * The library provides separate functions for Q31 and floating-point data types.
group-onsemi 0:098463de4c5d 5614 * \par Algorithm
group-onsemi 0:098463de4c5d 5615 * \image html parkInvFormula.gif
group-onsemi 0:098463de4c5d 5616 * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components,
group-onsemi 0:098463de4c5d 5617 * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the
group-onsemi 0:098463de4c5d 5618 * cosine and sine values of theta (rotor flux position).
group-onsemi 0:098463de4c5d 5619 * \par Fixed-Point Behavior
group-onsemi 0:098463de4c5d 5620 * Care must be taken when using the Q31 version of the Park transform.
group-onsemi 0:098463de4c5d 5621 * In particular, the overflow and saturation behavior of the accumulator used must be considered.
group-onsemi 0:098463de4c5d 5622 * Refer to the function specific documentation below for usage guidelines.
group-onsemi 0:098463de4c5d 5623 */
group-onsemi 0:098463de4c5d 5624
group-onsemi 0:098463de4c5d 5625 /**
group-onsemi 0:098463de4c5d 5626 * @addtogroup inv_park
group-onsemi 0:098463de4c5d 5627 * @{
group-onsemi 0:098463de4c5d 5628 */
group-onsemi 0:098463de4c5d 5629
group-onsemi 0:098463de4c5d 5630 /**
group-onsemi 0:098463de4c5d 5631 * @brief Floating-point Inverse Park transform
group-onsemi 0:098463de4c5d 5632 * @param[in] Id input coordinate of rotor reference frame d
group-onsemi 0:098463de4c5d 5633 * @param[in] Iq input coordinate of rotor reference frame q
group-onsemi 0:098463de4c5d 5634 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5635 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5636 * @param[in] sinVal sine value of rotation angle theta
group-onsemi 0:098463de4c5d 5637 * @param[in] cosVal cosine value of rotation angle theta
group-onsemi 0:098463de4c5d 5638 * @return none.
group-onsemi 0:098463de4c5d 5639 */
group-onsemi 0:098463de4c5d 5640
group-onsemi 0:098463de4c5d 5641 static __INLINE void arm_inv_park_f32(
group-onsemi 0:098463de4c5d 5642 float32_t Id,
group-onsemi 0:098463de4c5d 5643 float32_t Iq,
group-onsemi 0:098463de4c5d 5644 float32_t * pIalpha,
group-onsemi 0:098463de4c5d 5645 float32_t * pIbeta,
group-onsemi 0:098463de4c5d 5646 float32_t sinVal,
group-onsemi 0:098463de4c5d 5647 float32_t cosVal)
group-onsemi 0:098463de4c5d 5648 {
group-onsemi 0:098463de4c5d 5649 /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */
group-onsemi 0:098463de4c5d 5650 *pIalpha = Id * cosVal - Iq * sinVal;
group-onsemi 0:098463de4c5d 5651
group-onsemi 0:098463de4c5d 5652 /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */
group-onsemi 0:098463de4c5d 5653 *pIbeta = Id * sinVal + Iq * cosVal;
group-onsemi 0:098463de4c5d 5654
group-onsemi 0:098463de4c5d 5655 }
group-onsemi 0:098463de4c5d 5656
group-onsemi 0:098463de4c5d 5657
group-onsemi 0:098463de4c5d 5658 /**
group-onsemi 0:098463de4c5d 5659 * @brief Inverse Park transform for Q31 version
group-onsemi 0:098463de4c5d 5660 * @param[in] Id input coordinate of rotor reference frame d
group-onsemi 0:098463de4c5d 5661 * @param[in] Iq input coordinate of rotor reference frame q
group-onsemi 0:098463de4c5d 5662 * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha
group-onsemi 0:098463de4c5d 5663 * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta
group-onsemi 0:098463de4c5d 5664 * @param[in] sinVal sine value of rotation angle theta
group-onsemi 0:098463de4c5d 5665 * @param[in] cosVal cosine value of rotation angle theta
group-onsemi 0:098463de4c5d 5666 * @return none.
group-onsemi 0:098463de4c5d 5667 *
group-onsemi 0:098463de4c5d 5668 * <b>Scaling and Overflow Behavior:</b>
group-onsemi 0:098463de4c5d 5669 * \par
group-onsemi 0:098463de4c5d 5670 * The function is implemented using an internal 32-bit accumulator.
group-onsemi 0:098463de4c5d 5671 * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format.
group-onsemi 0:098463de4c5d 5672 * There is saturation on the addition, hence there is no risk of overflow.
group-onsemi 0:098463de4c5d 5673 */
group-onsemi 0:098463de4c5d 5674
group-onsemi 0:098463de4c5d 5675
group-onsemi 0:098463de4c5d 5676 static __INLINE void arm_inv_park_q31(
group-onsemi 0:098463de4c5d 5677 q31_t Id,
group-onsemi 0:098463de4c5d 5678 q31_t Iq,
group-onsemi 0:098463de4c5d 5679 q31_t * pIalpha,
group-onsemi 0:098463de4c5d 5680 q31_t * pIbeta,
group-onsemi 0:098463de4c5d 5681 q31_t sinVal,
group-onsemi 0:098463de4c5d 5682 q31_t cosVal)
group-onsemi 0:098463de4c5d 5683 {
group-onsemi 0:098463de4c5d 5684 q31_t product1, product2; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5685 q31_t product3, product4; /* Temporary variables used to store intermediate results */
group-onsemi 0:098463de4c5d 5686
group-onsemi 0:098463de4c5d 5687 /* Intermediate product is calculated by (Id * cosVal) */
group-onsemi 0:098463de4c5d 5688 product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31);
group-onsemi 0:098463de4c5d 5689
group-onsemi 0:098463de4c5d 5690 /* Intermediate product is calculated by (Iq * sinVal) */
group-onsemi 0:098463de4c5d 5691 product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31);
group-onsemi 0:098463de4c5d 5692
group-onsemi 0:098463de4c5d 5693
group-onsemi 0:098463de4c5d 5694 /* Intermediate product is calculated by (Id * sinVal) */
group-onsemi 0:098463de4c5d 5695 product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31);
group-onsemi 0:098463de4c5d 5696
group-onsemi 0:098463de4c5d 5697 /* Intermediate product is calculated by (Iq * cosVal) */
group-onsemi 0:098463de4c5d 5698 product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31);
group-onsemi 0:098463de4c5d 5699
group-onsemi 0:098463de4c5d 5700 /* Calculate pIalpha by using the two intermediate products 1 and 2 */
group-onsemi 0:098463de4c5d 5701 *pIalpha = __QSUB(product1, product2);
group-onsemi 0:098463de4c5d 5702
group-onsemi 0:098463de4c5d 5703 /* Calculate pIbeta by using the two intermediate products 3 and 4 */
group-onsemi 0:098463de4c5d 5704 *pIbeta = __QADD(product4, product3);
group-onsemi 0:098463de4c5d 5705
group-onsemi 0:098463de4c5d 5706 }
group-onsemi 0:098463de4c5d 5707
group-onsemi 0:098463de4c5d 5708 /**
group-onsemi 0:098463de4c5d 5709 * @} end of Inverse park group
group-onsemi 0:098463de4c5d 5710 */
group-onsemi 0:098463de4c5d 5711
group-onsemi 0:098463de4c5d 5712
group-onsemi 0:098463de4c5d 5713 /**
group-onsemi 0:098463de4c5d 5714 * @brief Converts the elements of the Q31 vector to floating-point vector.
group-onsemi 0:098463de4c5d 5715 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 5716 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 5717 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 5718 * @return none.
group-onsemi 0:098463de4c5d 5719 */
group-onsemi 0:098463de4c5d 5720 void arm_q31_to_float(
group-onsemi 0:098463de4c5d 5721 q31_t * pSrc,
group-onsemi 0:098463de4c5d 5722 float32_t * pDst,
group-onsemi 0:098463de4c5d 5723 uint32_t blockSize);
group-onsemi 0:098463de4c5d 5724
group-onsemi 0:098463de4c5d 5725 /**
group-onsemi 0:098463de4c5d 5726 * @ingroup groupInterpolation
group-onsemi 0:098463de4c5d 5727 */
group-onsemi 0:098463de4c5d 5728
group-onsemi 0:098463de4c5d 5729 /**
group-onsemi 0:098463de4c5d 5730 * @defgroup LinearInterpolate Linear Interpolation
group-onsemi 0:098463de4c5d 5731 *
group-onsemi 0:098463de4c5d 5732 * Linear interpolation is a method of curve fitting using linear polynomials.
group-onsemi 0:098463de4c5d 5733 * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line
group-onsemi 0:098463de4c5d 5734 *
group-onsemi 0:098463de4c5d 5735 * \par
group-onsemi 0:098463de4c5d 5736 * \image html LinearInterp.gif "Linear interpolation"
group-onsemi 0:098463de4c5d 5737 *
group-onsemi 0:098463de4c5d 5738 * \par
group-onsemi 0:098463de4c5d 5739 * A Linear Interpolate function calculates an output value(y), for the input(x)
group-onsemi 0:098463de4c5d 5740 * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values)
group-onsemi 0:098463de4c5d 5741 *
group-onsemi 0:098463de4c5d 5742 * \par Algorithm:
group-onsemi 0:098463de4c5d 5743 * <pre>
group-onsemi 0:098463de4c5d 5744 * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0))
group-onsemi 0:098463de4c5d 5745 * where x0, x1 are nearest values of input x
group-onsemi 0:098463de4c5d 5746 * y0, y1 are nearest values to output y
group-onsemi 0:098463de4c5d 5747 * </pre>
group-onsemi 0:098463de4c5d 5748 *
group-onsemi 0:098463de4c5d 5749 * \par
group-onsemi 0:098463de4c5d 5750 * This set of functions implements Linear interpolation process
group-onsemi 0:098463de4c5d 5751 * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single
group-onsemi 0:098463de4c5d 5752 * sample of data and each call to the function returns a single processed value.
group-onsemi 0:098463de4c5d 5753 * <code>S</code> points to an instance of the Linear Interpolate function data structure.
group-onsemi 0:098463de4c5d 5754 * <code>x</code> is the input sample value. The functions returns the output value.
group-onsemi 0:098463de4c5d 5755 *
group-onsemi 0:098463de4c5d 5756 * \par
group-onsemi 0:098463de4c5d 5757 * if x is outside of the table boundary, Linear interpolation returns first value of the table
group-onsemi 0:098463de4c5d 5758 * if x is below input range and returns last value of table if x is above range.
group-onsemi 0:098463de4c5d 5759 */
group-onsemi 0:098463de4c5d 5760
group-onsemi 0:098463de4c5d 5761 /**
group-onsemi 0:098463de4c5d 5762 * @addtogroup LinearInterpolate
group-onsemi 0:098463de4c5d 5763 * @{
group-onsemi 0:098463de4c5d 5764 */
group-onsemi 0:098463de4c5d 5765
group-onsemi 0:098463de4c5d 5766 /**
group-onsemi 0:098463de4c5d 5767 * @brief Process function for the floating-point Linear Interpolation Function.
group-onsemi 0:098463de4c5d 5768 * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure
group-onsemi 0:098463de4c5d 5769 * @param[in] x input sample to process
group-onsemi 0:098463de4c5d 5770 * @return y processed output sample.
group-onsemi 0:098463de4c5d 5771 *
group-onsemi 0:098463de4c5d 5772 */
group-onsemi 0:098463de4c5d 5773
group-onsemi 0:098463de4c5d 5774 static __INLINE float32_t arm_linear_interp_f32(
group-onsemi 0:098463de4c5d 5775 arm_linear_interp_instance_f32 * S,
group-onsemi 0:098463de4c5d 5776 float32_t x)
group-onsemi 0:098463de4c5d 5777 {
group-onsemi 0:098463de4c5d 5778
group-onsemi 0:098463de4c5d 5779 float32_t y;
group-onsemi 0:098463de4c5d 5780 float32_t x0, x1; /* Nearest input values */
group-onsemi 0:098463de4c5d 5781 float32_t y0, y1; /* Nearest output values */
group-onsemi 0:098463de4c5d 5782 float32_t xSpacing = S->xSpacing; /* spacing between input values */
group-onsemi 0:098463de4c5d 5783 int32_t i; /* Index variable */
group-onsemi 0:098463de4c5d 5784 float32_t *pYData = S->pYData; /* pointer to output table */
group-onsemi 0:098463de4c5d 5785
group-onsemi 0:098463de4c5d 5786 /* Calculation of index */
group-onsemi 0:098463de4c5d 5787 i = (int32_t) ((x - S->x1) / xSpacing);
group-onsemi 0:098463de4c5d 5788
group-onsemi 0:098463de4c5d 5789 if(i < 0)
group-onsemi 0:098463de4c5d 5790 {
group-onsemi 0:098463de4c5d 5791 /* Iniatilize output for below specified range as least output value of table */
group-onsemi 0:098463de4c5d 5792 y = pYData[0];
group-onsemi 0:098463de4c5d 5793 }
group-onsemi 0:098463de4c5d 5794 else if((uint32_t)i >= S->nValues)
group-onsemi 0:098463de4c5d 5795 {
group-onsemi 0:098463de4c5d 5796 /* Iniatilize output for above specified range as last output value of table */
group-onsemi 0:098463de4c5d 5797 y = pYData[S->nValues - 1];
group-onsemi 0:098463de4c5d 5798 }
group-onsemi 0:098463de4c5d 5799 else
group-onsemi 0:098463de4c5d 5800 {
group-onsemi 0:098463de4c5d 5801 /* Calculation of nearest input values */
group-onsemi 0:098463de4c5d 5802 x0 = S->x1 + i * xSpacing;
group-onsemi 0:098463de4c5d 5803 x1 = S->x1 + (i + 1) * xSpacing;
group-onsemi 0:098463de4c5d 5804
group-onsemi 0:098463de4c5d 5805 /* Read of nearest output values */
group-onsemi 0:098463de4c5d 5806 y0 = pYData[i];
group-onsemi 0:098463de4c5d 5807 y1 = pYData[i + 1];
group-onsemi 0:098463de4c5d 5808
group-onsemi 0:098463de4c5d 5809 /* Calculation of output */
group-onsemi 0:098463de4c5d 5810 y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0));
group-onsemi 0:098463de4c5d 5811
group-onsemi 0:098463de4c5d 5812 }
group-onsemi 0:098463de4c5d 5813
group-onsemi 0:098463de4c5d 5814 /* returns output value */
group-onsemi 0:098463de4c5d 5815 return (y);
group-onsemi 0:098463de4c5d 5816 }
group-onsemi 0:098463de4c5d 5817
group-onsemi 0:098463de4c5d 5818 /**
group-onsemi 0:098463de4c5d 5819 *
group-onsemi 0:098463de4c5d 5820 * @brief Process function for the Q31 Linear Interpolation Function.
group-onsemi 0:098463de4c5d 5821 * @param[in] *pYData pointer to Q31 Linear Interpolation table
group-onsemi 0:098463de4c5d 5822 * @param[in] x input sample to process
group-onsemi 0:098463de4c5d 5823 * @param[in] nValues number of table values
group-onsemi 0:098463de4c5d 5824 * @return y processed output sample.
group-onsemi 0:098463de4c5d 5825 *
group-onsemi 0:098463de4c5d 5826 * \par
group-onsemi 0:098463de4c5d 5827 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
group-onsemi 0:098463de4c5d 5828 * This function can support maximum of table size 2^12.
group-onsemi 0:098463de4c5d 5829 *
group-onsemi 0:098463de4c5d 5830 */
group-onsemi 0:098463de4c5d 5831
group-onsemi 0:098463de4c5d 5832
group-onsemi 0:098463de4c5d 5833 static __INLINE q31_t arm_linear_interp_q31(
group-onsemi 0:098463de4c5d 5834 q31_t * pYData,
group-onsemi 0:098463de4c5d 5835 q31_t x,
group-onsemi 0:098463de4c5d 5836 uint32_t nValues)
group-onsemi 0:098463de4c5d 5837 {
group-onsemi 0:098463de4c5d 5838 q31_t y; /* output */
group-onsemi 0:098463de4c5d 5839 q31_t y0, y1; /* Nearest output values */
group-onsemi 0:098463de4c5d 5840 q31_t fract; /* fractional part */
group-onsemi 0:098463de4c5d 5841 int32_t index; /* Index to read nearest output values */
group-onsemi 0:098463de4c5d 5842
group-onsemi 0:098463de4c5d 5843 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 5844 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 5845 /* Index value calculation */
group-onsemi 0:098463de4c5d 5846 index = ((x & 0xFFF00000) >> 20);
group-onsemi 0:098463de4c5d 5847
group-onsemi 0:098463de4c5d 5848 if(index >= (int32_t)(nValues - 1))
group-onsemi 0:098463de4c5d 5849 {
group-onsemi 0:098463de4c5d 5850 return (pYData[nValues - 1]);
group-onsemi 0:098463de4c5d 5851 }
group-onsemi 0:098463de4c5d 5852 else if(index < 0)
group-onsemi 0:098463de4c5d 5853 {
group-onsemi 0:098463de4c5d 5854 return (pYData[0]);
group-onsemi 0:098463de4c5d 5855 }
group-onsemi 0:098463de4c5d 5856 else
group-onsemi 0:098463de4c5d 5857 {
group-onsemi 0:098463de4c5d 5858
group-onsemi 0:098463de4c5d 5859 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 5860 /* shift left by 11 to keep fract in 1.31 format */
group-onsemi 0:098463de4c5d 5861 fract = (x & 0x000FFFFF) << 11;
group-onsemi 0:098463de4c5d 5862
group-onsemi 0:098463de4c5d 5863 /* Read two nearest output values from the index in 1.31(q31) format */
group-onsemi 0:098463de4c5d 5864 y0 = pYData[index];
group-onsemi 0:098463de4c5d 5865 y1 = pYData[index + 1u];
group-onsemi 0:098463de4c5d 5866
group-onsemi 0:098463de4c5d 5867 /* Calculation of y0 * (1-fract) and y is in 2.30 format */
group-onsemi 0:098463de4c5d 5868 y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32));
group-onsemi 0:098463de4c5d 5869
group-onsemi 0:098463de4c5d 5870 /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */
group-onsemi 0:098463de4c5d 5871 y += ((q31_t) (((q63_t) y1 * fract) >> 32));
group-onsemi 0:098463de4c5d 5872
group-onsemi 0:098463de4c5d 5873 /* Convert y to 1.31 format */
group-onsemi 0:098463de4c5d 5874 return (y << 1u);
group-onsemi 0:098463de4c5d 5875
group-onsemi 0:098463de4c5d 5876 }
group-onsemi 0:098463de4c5d 5877
group-onsemi 0:098463de4c5d 5878 }
group-onsemi 0:098463de4c5d 5879
group-onsemi 0:098463de4c5d 5880 /**
group-onsemi 0:098463de4c5d 5881 *
group-onsemi 0:098463de4c5d 5882 * @brief Process function for the Q15 Linear Interpolation Function.
group-onsemi 0:098463de4c5d 5883 * @param[in] *pYData pointer to Q15 Linear Interpolation table
group-onsemi 0:098463de4c5d 5884 * @param[in] x input sample to process
group-onsemi 0:098463de4c5d 5885 * @param[in] nValues number of table values
group-onsemi 0:098463de4c5d 5886 * @return y processed output sample.
group-onsemi 0:098463de4c5d 5887 *
group-onsemi 0:098463de4c5d 5888 * \par
group-onsemi 0:098463de4c5d 5889 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
group-onsemi 0:098463de4c5d 5890 * This function can support maximum of table size 2^12.
group-onsemi 0:098463de4c5d 5891 *
group-onsemi 0:098463de4c5d 5892 */
group-onsemi 0:098463de4c5d 5893
group-onsemi 0:098463de4c5d 5894
group-onsemi 0:098463de4c5d 5895 static __INLINE q15_t arm_linear_interp_q15(
group-onsemi 0:098463de4c5d 5896 q15_t * pYData,
group-onsemi 0:098463de4c5d 5897 q31_t x,
group-onsemi 0:098463de4c5d 5898 uint32_t nValues)
group-onsemi 0:098463de4c5d 5899 {
group-onsemi 0:098463de4c5d 5900 q63_t y; /* output */
group-onsemi 0:098463de4c5d 5901 q15_t y0, y1; /* Nearest output values */
group-onsemi 0:098463de4c5d 5902 q31_t fract; /* fractional part */
group-onsemi 0:098463de4c5d 5903 int32_t index; /* Index to read nearest output values */
group-onsemi 0:098463de4c5d 5904
group-onsemi 0:098463de4c5d 5905 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 5906 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 5907 /* Index value calculation */
group-onsemi 0:098463de4c5d 5908 index = ((x & 0xFFF00000) >> 20u);
group-onsemi 0:098463de4c5d 5909
group-onsemi 0:098463de4c5d 5910 if(index >= (int32_t)(nValues - 1))
group-onsemi 0:098463de4c5d 5911 {
group-onsemi 0:098463de4c5d 5912 return (pYData[nValues - 1]);
group-onsemi 0:098463de4c5d 5913 }
group-onsemi 0:098463de4c5d 5914 else if(index < 0)
group-onsemi 0:098463de4c5d 5915 {
group-onsemi 0:098463de4c5d 5916 return (pYData[0]);
group-onsemi 0:098463de4c5d 5917 }
group-onsemi 0:098463de4c5d 5918 else
group-onsemi 0:098463de4c5d 5919 {
group-onsemi 0:098463de4c5d 5920 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 5921 /* fract is in 12.20 format */
group-onsemi 0:098463de4c5d 5922 fract = (x & 0x000FFFFF);
group-onsemi 0:098463de4c5d 5923
group-onsemi 0:098463de4c5d 5924 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 5925 y0 = pYData[index];
group-onsemi 0:098463de4c5d 5926 y1 = pYData[index + 1u];
group-onsemi 0:098463de4c5d 5927
group-onsemi 0:098463de4c5d 5928 /* Calculation of y0 * (1-fract) and y is in 13.35 format */
group-onsemi 0:098463de4c5d 5929 y = ((q63_t) y0 * (0xFFFFF - fract));
group-onsemi 0:098463de4c5d 5930
group-onsemi 0:098463de4c5d 5931 /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */
group-onsemi 0:098463de4c5d 5932 y += ((q63_t) y1 * (fract));
group-onsemi 0:098463de4c5d 5933
group-onsemi 0:098463de4c5d 5934 /* convert y to 1.15 format */
group-onsemi 0:098463de4c5d 5935 return (y >> 20);
group-onsemi 0:098463de4c5d 5936 }
group-onsemi 0:098463de4c5d 5937
group-onsemi 0:098463de4c5d 5938
group-onsemi 0:098463de4c5d 5939 }
group-onsemi 0:098463de4c5d 5940
group-onsemi 0:098463de4c5d 5941 /**
group-onsemi 0:098463de4c5d 5942 *
group-onsemi 0:098463de4c5d 5943 * @brief Process function for the Q7 Linear Interpolation Function.
group-onsemi 0:098463de4c5d 5944 * @param[in] *pYData pointer to Q7 Linear Interpolation table
group-onsemi 0:098463de4c5d 5945 * @param[in] x input sample to process
group-onsemi 0:098463de4c5d 5946 * @param[in] nValues number of table values
group-onsemi 0:098463de4c5d 5947 * @return y processed output sample.
group-onsemi 0:098463de4c5d 5948 *
group-onsemi 0:098463de4c5d 5949 * \par
group-onsemi 0:098463de4c5d 5950 * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part.
group-onsemi 0:098463de4c5d 5951 * This function can support maximum of table size 2^12.
group-onsemi 0:098463de4c5d 5952 */
group-onsemi 0:098463de4c5d 5953
group-onsemi 0:098463de4c5d 5954
group-onsemi 0:098463de4c5d 5955 static __INLINE q7_t arm_linear_interp_q7(
group-onsemi 0:098463de4c5d 5956 q7_t * pYData,
group-onsemi 0:098463de4c5d 5957 q31_t x,
group-onsemi 0:098463de4c5d 5958 uint32_t nValues)
group-onsemi 0:098463de4c5d 5959 {
group-onsemi 0:098463de4c5d 5960 q31_t y; /* output */
group-onsemi 0:098463de4c5d 5961 q7_t y0, y1; /* Nearest output values */
group-onsemi 0:098463de4c5d 5962 q31_t fract; /* fractional part */
group-onsemi 0:098463de4c5d 5963 uint32_t index; /* Index to read nearest output values */
group-onsemi 0:098463de4c5d 5964
group-onsemi 0:098463de4c5d 5965 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 5966 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 5967 /* Index value calculation */
group-onsemi 0:098463de4c5d 5968 if (x < 0)
group-onsemi 0:098463de4c5d 5969 {
group-onsemi 0:098463de4c5d 5970 return (pYData[0]);
group-onsemi 0:098463de4c5d 5971 }
group-onsemi 0:098463de4c5d 5972 index = (x >> 20) & 0xfff;
group-onsemi 0:098463de4c5d 5973
group-onsemi 0:098463de4c5d 5974
group-onsemi 0:098463de4c5d 5975 if(index >= (nValues - 1))
group-onsemi 0:098463de4c5d 5976 {
group-onsemi 0:098463de4c5d 5977 return (pYData[nValues - 1]);
group-onsemi 0:098463de4c5d 5978 }
group-onsemi 0:098463de4c5d 5979 else
group-onsemi 0:098463de4c5d 5980 {
group-onsemi 0:098463de4c5d 5981
group-onsemi 0:098463de4c5d 5982 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 5983 /* fract is in 12.20 format */
group-onsemi 0:098463de4c5d 5984 fract = (x & 0x000FFFFF);
group-onsemi 0:098463de4c5d 5985
group-onsemi 0:098463de4c5d 5986 /* Read two nearest output values from the index and are in 1.7(q7) format */
group-onsemi 0:098463de4c5d 5987 y0 = pYData[index];
group-onsemi 0:098463de4c5d 5988 y1 = pYData[index + 1u];
group-onsemi 0:098463de4c5d 5989
group-onsemi 0:098463de4c5d 5990 /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */
group-onsemi 0:098463de4c5d 5991 y = ((y0 * (0xFFFFF - fract)));
group-onsemi 0:098463de4c5d 5992
group-onsemi 0:098463de4c5d 5993 /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */
group-onsemi 0:098463de4c5d 5994 y += (y1 * fract);
group-onsemi 0:098463de4c5d 5995
group-onsemi 0:098463de4c5d 5996 /* convert y to 1.7(q7) format */
group-onsemi 0:098463de4c5d 5997 return (y >> 20u);
group-onsemi 0:098463de4c5d 5998
group-onsemi 0:098463de4c5d 5999 }
group-onsemi 0:098463de4c5d 6000
group-onsemi 0:098463de4c5d 6001 }
group-onsemi 0:098463de4c5d 6002 /**
group-onsemi 0:098463de4c5d 6003 * @} end of LinearInterpolate group
group-onsemi 0:098463de4c5d 6004 */
group-onsemi 0:098463de4c5d 6005
group-onsemi 0:098463de4c5d 6006 /**
group-onsemi 0:098463de4c5d 6007 * @brief Fast approximation to the trigonometric sine function for floating-point data.
group-onsemi 0:098463de4c5d 6008 * @param[in] x input value in radians.
group-onsemi 0:098463de4c5d 6009 * @return sin(x).
group-onsemi 0:098463de4c5d 6010 */
group-onsemi 0:098463de4c5d 6011
group-onsemi 0:098463de4c5d 6012 float32_t arm_sin_f32(
group-onsemi 0:098463de4c5d 6013 float32_t x);
group-onsemi 0:098463de4c5d 6014
group-onsemi 0:098463de4c5d 6015 /**
group-onsemi 0:098463de4c5d 6016 * @brief Fast approximation to the trigonometric sine function for Q31 data.
group-onsemi 0:098463de4c5d 6017 * @param[in] x Scaled input value in radians.
group-onsemi 0:098463de4c5d 6018 * @return sin(x).
group-onsemi 0:098463de4c5d 6019 */
group-onsemi 0:098463de4c5d 6020
group-onsemi 0:098463de4c5d 6021 q31_t arm_sin_q31(
group-onsemi 0:098463de4c5d 6022 q31_t x);
group-onsemi 0:098463de4c5d 6023
group-onsemi 0:098463de4c5d 6024 /**
group-onsemi 0:098463de4c5d 6025 * @brief Fast approximation to the trigonometric sine function for Q15 data.
group-onsemi 0:098463de4c5d 6026 * @param[in] x Scaled input value in radians.
group-onsemi 0:098463de4c5d 6027 * @return sin(x).
group-onsemi 0:098463de4c5d 6028 */
group-onsemi 0:098463de4c5d 6029
group-onsemi 0:098463de4c5d 6030 q15_t arm_sin_q15(
group-onsemi 0:098463de4c5d 6031 q15_t x);
group-onsemi 0:098463de4c5d 6032
group-onsemi 0:098463de4c5d 6033 /**
group-onsemi 0:098463de4c5d 6034 * @brief Fast approximation to the trigonometric cosine function for floating-point data.
group-onsemi 0:098463de4c5d 6035 * @param[in] x input value in radians.
group-onsemi 0:098463de4c5d 6036 * @return cos(x).
group-onsemi 0:098463de4c5d 6037 */
group-onsemi 0:098463de4c5d 6038
group-onsemi 0:098463de4c5d 6039 float32_t arm_cos_f32(
group-onsemi 0:098463de4c5d 6040 float32_t x);
group-onsemi 0:098463de4c5d 6041
group-onsemi 0:098463de4c5d 6042 /**
group-onsemi 0:098463de4c5d 6043 * @brief Fast approximation to the trigonometric cosine function for Q31 data.
group-onsemi 0:098463de4c5d 6044 * @param[in] x Scaled input value in radians.
group-onsemi 0:098463de4c5d 6045 * @return cos(x).
group-onsemi 0:098463de4c5d 6046 */
group-onsemi 0:098463de4c5d 6047
group-onsemi 0:098463de4c5d 6048 q31_t arm_cos_q31(
group-onsemi 0:098463de4c5d 6049 q31_t x);
group-onsemi 0:098463de4c5d 6050
group-onsemi 0:098463de4c5d 6051 /**
group-onsemi 0:098463de4c5d 6052 * @brief Fast approximation to the trigonometric cosine function for Q15 data.
group-onsemi 0:098463de4c5d 6053 * @param[in] x Scaled input value in radians.
group-onsemi 0:098463de4c5d 6054 * @return cos(x).
group-onsemi 0:098463de4c5d 6055 */
group-onsemi 0:098463de4c5d 6056
group-onsemi 0:098463de4c5d 6057 q15_t arm_cos_q15(
group-onsemi 0:098463de4c5d 6058 q15_t x);
group-onsemi 0:098463de4c5d 6059
group-onsemi 0:098463de4c5d 6060
group-onsemi 0:098463de4c5d 6061 /**
group-onsemi 0:098463de4c5d 6062 * @ingroup groupFastMath
group-onsemi 0:098463de4c5d 6063 */
group-onsemi 0:098463de4c5d 6064
group-onsemi 0:098463de4c5d 6065
group-onsemi 0:098463de4c5d 6066 /**
group-onsemi 0:098463de4c5d 6067 * @defgroup SQRT Square Root
group-onsemi 0:098463de4c5d 6068 *
group-onsemi 0:098463de4c5d 6069 * Computes the square root of a number.
group-onsemi 0:098463de4c5d 6070 * There are separate functions for Q15, Q31, and floating-point data types.
group-onsemi 0:098463de4c5d 6071 * The square root function is computed using the Newton-Raphson algorithm.
group-onsemi 0:098463de4c5d 6072 * This is an iterative algorithm of the form:
group-onsemi 0:098463de4c5d 6073 * <pre>
group-onsemi 0:098463de4c5d 6074 * x1 = x0 - f(x0)/f'(x0)
group-onsemi 0:098463de4c5d 6075 * </pre>
group-onsemi 0:098463de4c5d 6076 * where <code>x1</code> is the current estimate,
group-onsemi 0:098463de4c5d 6077 * <code>x0</code> is the previous estimate, and
group-onsemi 0:098463de4c5d 6078 * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>.
group-onsemi 0:098463de4c5d 6079 * For the square root function, the algorithm reduces to:
group-onsemi 0:098463de4c5d 6080 * <pre>
group-onsemi 0:098463de4c5d 6081 * x0 = in/2 [initial guess]
group-onsemi 0:098463de4c5d 6082 * x1 = 1/2 * ( x0 + in / x0) [each iteration]
group-onsemi 0:098463de4c5d 6083 * </pre>
group-onsemi 0:098463de4c5d 6084 */
group-onsemi 0:098463de4c5d 6085
group-onsemi 0:098463de4c5d 6086
group-onsemi 0:098463de4c5d 6087 /**
group-onsemi 0:098463de4c5d 6088 * @addtogroup SQRT
group-onsemi 0:098463de4c5d 6089 * @{
group-onsemi 0:098463de4c5d 6090 */
group-onsemi 0:098463de4c5d 6091
group-onsemi 0:098463de4c5d 6092 /**
group-onsemi 0:098463de4c5d 6093 * @brief Floating-point square root function.
group-onsemi 0:098463de4c5d 6094 * @param[in] in input value.
group-onsemi 0:098463de4c5d 6095 * @param[out] *pOut square root of input value.
group-onsemi 0:098463de4c5d 6096 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
group-onsemi 0:098463de4c5d 6097 * <code>in</code> is negative value and returns zero output for negative values.
group-onsemi 0:098463de4c5d 6098 */
group-onsemi 0:098463de4c5d 6099
group-onsemi 0:098463de4c5d 6100 static __INLINE arm_status arm_sqrt_f32(
group-onsemi 0:098463de4c5d 6101 float32_t in,
group-onsemi 0:098463de4c5d 6102 float32_t * pOut)
group-onsemi 0:098463de4c5d 6103 {
group-onsemi 0:098463de4c5d 6104 if(in >= 0.0f)
group-onsemi 0:098463de4c5d 6105 {
group-onsemi 0:098463de4c5d 6106
group-onsemi 0:098463de4c5d 6107 // #if __FPU_USED
group-onsemi 0:098463de4c5d 6108 #if (__FPU_USED == 1) && defined ( __CC_ARM )
group-onsemi 0:098463de4c5d 6109 *pOut = __sqrtf(in);
group-onsemi 0:098463de4c5d 6110 #else
group-onsemi 0:098463de4c5d 6111 *pOut = sqrtf(in);
group-onsemi 0:098463de4c5d 6112 #endif
group-onsemi 0:098463de4c5d 6113
group-onsemi 0:098463de4c5d 6114 return (ARM_MATH_SUCCESS);
group-onsemi 0:098463de4c5d 6115 }
group-onsemi 0:098463de4c5d 6116 else
group-onsemi 0:098463de4c5d 6117 {
group-onsemi 0:098463de4c5d 6118 *pOut = 0.0f;
group-onsemi 0:098463de4c5d 6119 return (ARM_MATH_ARGUMENT_ERROR);
group-onsemi 0:098463de4c5d 6120 }
group-onsemi 0:098463de4c5d 6121
group-onsemi 0:098463de4c5d 6122 }
group-onsemi 0:098463de4c5d 6123
group-onsemi 0:098463de4c5d 6124
group-onsemi 0:098463de4c5d 6125 /**
group-onsemi 0:098463de4c5d 6126 * @brief Q31 square root function.
group-onsemi 0:098463de4c5d 6127 * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF.
group-onsemi 0:098463de4c5d 6128 * @param[out] *pOut square root of input value.
group-onsemi 0:098463de4c5d 6129 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
group-onsemi 0:098463de4c5d 6130 * <code>in</code> is negative value and returns zero output for negative values.
group-onsemi 0:098463de4c5d 6131 */
group-onsemi 0:098463de4c5d 6132 arm_status arm_sqrt_q31(
group-onsemi 0:098463de4c5d 6133 q31_t in,
group-onsemi 0:098463de4c5d 6134 q31_t * pOut);
group-onsemi 0:098463de4c5d 6135
group-onsemi 0:098463de4c5d 6136 /**
group-onsemi 0:098463de4c5d 6137 * @brief Q15 square root function.
group-onsemi 0:098463de4c5d 6138 * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF.
group-onsemi 0:098463de4c5d 6139 * @param[out] *pOut square root of input value.
group-onsemi 0:098463de4c5d 6140 * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if
group-onsemi 0:098463de4c5d 6141 * <code>in</code> is negative value and returns zero output for negative values.
group-onsemi 0:098463de4c5d 6142 */
group-onsemi 0:098463de4c5d 6143 arm_status arm_sqrt_q15(
group-onsemi 0:098463de4c5d 6144 q15_t in,
group-onsemi 0:098463de4c5d 6145 q15_t * pOut);
group-onsemi 0:098463de4c5d 6146
group-onsemi 0:098463de4c5d 6147 /**
group-onsemi 0:098463de4c5d 6148 * @} end of SQRT group
group-onsemi 0:098463de4c5d 6149 */
group-onsemi 0:098463de4c5d 6150
group-onsemi 0:098463de4c5d 6151
group-onsemi 0:098463de4c5d 6152
group-onsemi 0:098463de4c5d 6153
group-onsemi 0:098463de4c5d 6154
group-onsemi 0:098463de4c5d 6155
group-onsemi 0:098463de4c5d 6156 /**
group-onsemi 0:098463de4c5d 6157 * @brief floating-point Circular write function.
group-onsemi 0:098463de4c5d 6158 */
group-onsemi 0:098463de4c5d 6159
group-onsemi 0:098463de4c5d 6160 static __INLINE void arm_circularWrite_f32(
group-onsemi 0:098463de4c5d 6161 int32_t * circBuffer,
group-onsemi 0:098463de4c5d 6162 int32_t L,
group-onsemi 0:098463de4c5d 6163 uint16_t * writeOffset,
group-onsemi 0:098463de4c5d 6164 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6165 const int32_t * src,
group-onsemi 0:098463de4c5d 6166 int32_t srcInc,
group-onsemi 0:098463de4c5d 6167 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6168 {
group-onsemi 0:098463de4c5d 6169 uint32_t i = 0u;
group-onsemi 0:098463de4c5d 6170 int32_t wOffset;
group-onsemi 0:098463de4c5d 6171
group-onsemi 0:098463de4c5d 6172 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6173 * to the current location where the input samples to be copied */
group-onsemi 0:098463de4c5d 6174 wOffset = *writeOffset;
group-onsemi 0:098463de4c5d 6175
group-onsemi 0:098463de4c5d 6176 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6177 i = blockSize;
group-onsemi 0:098463de4c5d 6178
group-onsemi 0:098463de4c5d 6179 while(i > 0u)
group-onsemi 0:098463de4c5d 6180 {
group-onsemi 0:098463de4c5d 6181 /* copy the input sample to the circular buffer */
group-onsemi 0:098463de4c5d 6182 circBuffer[wOffset] = *src;
group-onsemi 0:098463de4c5d 6183
group-onsemi 0:098463de4c5d 6184 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6185 src += srcInc;
group-onsemi 0:098463de4c5d 6186
group-onsemi 0:098463de4c5d 6187 /* Circularly update wOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6188 wOffset += bufferInc;
group-onsemi 0:098463de4c5d 6189 if(wOffset >= L)
group-onsemi 0:098463de4c5d 6190 wOffset -= L;
group-onsemi 0:098463de4c5d 6191
group-onsemi 0:098463de4c5d 6192 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6193 i--;
group-onsemi 0:098463de4c5d 6194 }
group-onsemi 0:098463de4c5d 6195
group-onsemi 0:098463de4c5d 6196 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6197 *writeOffset = wOffset;
group-onsemi 0:098463de4c5d 6198 }
group-onsemi 0:098463de4c5d 6199
group-onsemi 0:098463de4c5d 6200
group-onsemi 0:098463de4c5d 6201
group-onsemi 0:098463de4c5d 6202 /**
group-onsemi 0:098463de4c5d 6203 * @brief floating-point Circular Read function.
group-onsemi 0:098463de4c5d 6204 */
group-onsemi 0:098463de4c5d 6205 static __INLINE void arm_circularRead_f32(
group-onsemi 0:098463de4c5d 6206 int32_t * circBuffer,
group-onsemi 0:098463de4c5d 6207 int32_t L,
group-onsemi 0:098463de4c5d 6208 int32_t * readOffset,
group-onsemi 0:098463de4c5d 6209 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6210 int32_t * dst,
group-onsemi 0:098463de4c5d 6211 int32_t * dst_base,
group-onsemi 0:098463de4c5d 6212 int32_t dst_length,
group-onsemi 0:098463de4c5d 6213 int32_t dstInc,
group-onsemi 0:098463de4c5d 6214 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6215 {
group-onsemi 0:098463de4c5d 6216 uint32_t i = 0u;
group-onsemi 0:098463de4c5d 6217 int32_t rOffset, dst_end;
group-onsemi 0:098463de4c5d 6218
group-onsemi 0:098463de4c5d 6219 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6220 * to the current location from where the input samples to be read */
group-onsemi 0:098463de4c5d 6221 rOffset = *readOffset;
group-onsemi 0:098463de4c5d 6222 dst_end = (int32_t) (dst_base + dst_length);
group-onsemi 0:098463de4c5d 6223
group-onsemi 0:098463de4c5d 6224 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6225 i = blockSize;
group-onsemi 0:098463de4c5d 6226
group-onsemi 0:098463de4c5d 6227 while(i > 0u)
group-onsemi 0:098463de4c5d 6228 {
group-onsemi 0:098463de4c5d 6229 /* copy the sample from the circular buffer to the destination buffer */
group-onsemi 0:098463de4c5d 6230 *dst = circBuffer[rOffset];
group-onsemi 0:098463de4c5d 6231
group-onsemi 0:098463de4c5d 6232 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6233 dst += dstInc;
group-onsemi 0:098463de4c5d 6234
group-onsemi 0:098463de4c5d 6235 if(dst == (int32_t *) dst_end)
group-onsemi 0:098463de4c5d 6236 {
group-onsemi 0:098463de4c5d 6237 dst = dst_base;
group-onsemi 0:098463de4c5d 6238 }
group-onsemi 0:098463de4c5d 6239
group-onsemi 0:098463de4c5d 6240 /* Circularly update rOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6241 rOffset += bufferInc;
group-onsemi 0:098463de4c5d 6242
group-onsemi 0:098463de4c5d 6243 if(rOffset >= L)
group-onsemi 0:098463de4c5d 6244 {
group-onsemi 0:098463de4c5d 6245 rOffset -= L;
group-onsemi 0:098463de4c5d 6246 }
group-onsemi 0:098463de4c5d 6247
group-onsemi 0:098463de4c5d 6248 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6249 i--;
group-onsemi 0:098463de4c5d 6250 }
group-onsemi 0:098463de4c5d 6251
group-onsemi 0:098463de4c5d 6252 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6253 *readOffset = rOffset;
group-onsemi 0:098463de4c5d 6254 }
group-onsemi 0:098463de4c5d 6255
group-onsemi 0:098463de4c5d 6256 /**
group-onsemi 0:098463de4c5d 6257 * @brief Q15 Circular write function.
group-onsemi 0:098463de4c5d 6258 */
group-onsemi 0:098463de4c5d 6259
group-onsemi 0:098463de4c5d 6260 static __INLINE void arm_circularWrite_q15(
group-onsemi 0:098463de4c5d 6261 q15_t * circBuffer,
group-onsemi 0:098463de4c5d 6262 int32_t L,
group-onsemi 0:098463de4c5d 6263 uint16_t * writeOffset,
group-onsemi 0:098463de4c5d 6264 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6265 const q15_t * src,
group-onsemi 0:098463de4c5d 6266 int32_t srcInc,
group-onsemi 0:098463de4c5d 6267 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6268 {
group-onsemi 0:098463de4c5d 6269 uint32_t i = 0u;
group-onsemi 0:098463de4c5d 6270 int32_t wOffset;
group-onsemi 0:098463de4c5d 6271
group-onsemi 0:098463de4c5d 6272 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6273 * to the current location where the input samples to be copied */
group-onsemi 0:098463de4c5d 6274 wOffset = *writeOffset;
group-onsemi 0:098463de4c5d 6275
group-onsemi 0:098463de4c5d 6276 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6277 i = blockSize;
group-onsemi 0:098463de4c5d 6278
group-onsemi 0:098463de4c5d 6279 while(i > 0u)
group-onsemi 0:098463de4c5d 6280 {
group-onsemi 0:098463de4c5d 6281 /* copy the input sample to the circular buffer */
group-onsemi 0:098463de4c5d 6282 circBuffer[wOffset] = *src;
group-onsemi 0:098463de4c5d 6283
group-onsemi 0:098463de4c5d 6284 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6285 src += srcInc;
group-onsemi 0:098463de4c5d 6286
group-onsemi 0:098463de4c5d 6287 /* Circularly update wOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6288 wOffset += bufferInc;
group-onsemi 0:098463de4c5d 6289 if(wOffset >= L)
group-onsemi 0:098463de4c5d 6290 wOffset -= L;
group-onsemi 0:098463de4c5d 6291
group-onsemi 0:098463de4c5d 6292 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6293 i--;
group-onsemi 0:098463de4c5d 6294 }
group-onsemi 0:098463de4c5d 6295
group-onsemi 0:098463de4c5d 6296 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6297 *writeOffset = wOffset;
group-onsemi 0:098463de4c5d 6298 }
group-onsemi 0:098463de4c5d 6299
group-onsemi 0:098463de4c5d 6300
group-onsemi 0:098463de4c5d 6301
group-onsemi 0:098463de4c5d 6302 /**
group-onsemi 0:098463de4c5d 6303 * @brief Q15 Circular Read function.
group-onsemi 0:098463de4c5d 6304 */
group-onsemi 0:098463de4c5d 6305 static __INLINE void arm_circularRead_q15(
group-onsemi 0:098463de4c5d 6306 q15_t * circBuffer,
group-onsemi 0:098463de4c5d 6307 int32_t L,
group-onsemi 0:098463de4c5d 6308 int32_t * readOffset,
group-onsemi 0:098463de4c5d 6309 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6310 q15_t * dst,
group-onsemi 0:098463de4c5d 6311 q15_t * dst_base,
group-onsemi 0:098463de4c5d 6312 int32_t dst_length,
group-onsemi 0:098463de4c5d 6313 int32_t dstInc,
group-onsemi 0:098463de4c5d 6314 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6315 {
group-onsemi 0:098463de4c5d 6316 uint32_t i = 0;
group-onsemi 0:098463de4c5d 6317 int32_t rOffset, dst_end;
group-onsemi 0:098463de4c5d 6318
group-onsemi 0:098463de4c5d 6319 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6320 * to the current location from where the input samples to be read */
group-onsemi 0:098463de4c5d 6321 rOffset = *readOffset;
group-onsemi 0:098463de4c5d 6322
group-onsemi 0:098463de4c5d 6323 dst_end = (int32_t) (dst_base + dst_length);
group-onsemi 0:098463de4c5d 6324
group-onsemi 0:098463de4c5d 6325 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6326 i = blockSize;
group-onsemi 0:098463de4c5d 6327
group-onsemi 0:098463de4c5d 6328 while(i > 0u)
group-onsemi 0:098463de4c5d 6329 {
group-onsemi 0:098463de4c5d 6330 /* copy the sample from the circular buffer to the destination buffer */
group-onsemi 0:098463de4c5d 6331 *dst = circBuffer[rOffset];
group-onsemi 0:098463de4c5d 6332
group-onsemi 0:098463de4c5d 6333 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6334 dst += dstInc;
group-onsemi 0:098463de4c5d 6335
group-onsemi 0:098463de4c5d 6336 if(dst == (q15_t *) dst_end)
group-onsemi 0:098463de4c5d 6337 {
group-onsemi 0:098463de4c5d 6338 dst = dst_base;
group-onsemi 0:098463de4c5d 6339 }
group-onsemi 0:098463de4c5d 6340
group-onsemi 0:098463de4c5d 6341 /* Circularly update wOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6342 rOffset += bufferInc;
group-onsemi 0:098463de4c5d 6343
group-onsemi 0:098463de4c5d 6344 if(rOffset >= L)
group-onsemi 0:098463de4c5d 6345 {
group-onsemi 0:098463de4c5d 6346 rOffset -= L;
group-onsemi 0:098463de4c5d 6347 }
group-onsemi 0:098463de4c5d 6348
group-onsemi 0:098463de4c5d 6349 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6350 i--;
group-onsemi 0:098463de4c5d 6351 }
group-onsemi 0:098463de4c5d 6352
group-onsemi 0:098463de4c5d 6353 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6354 *readOffset = rOffset;
group-onsemi 0:098463de4c5d 6355 }
group-onsemi 0:098463de4c5d 6356
group-onsemi 0:098463de4c5d 6357
group-onsemi 0:098463de4c5d 6358 /**
group-onsemi 0:098463de4c5d 6359 * @brief Q7 Circular write function.
group-onsemi 0:098463de4c5d 6360 */
group-onsemi 0:098463de4c5d 6361
group-onsemi 0:098463de4c5d 6362 static __INLINE void arm_circularWrite_q7(
group-onsemi 0:098463de4c5d 6363 q7_t * circBuffer,
group-onsemi 0:098463de4c5d 6364 int32_t L,
group-onsemi 0:098463de4c5d 6365 uint16_t * writeOffset,
group-onsemi 0:098463de4c5d 6366 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6367 const q7_t * src,
group-onsemi 0:098463de4c5d 6368 int32_t srcInc,
group-onsemi 0:098463de4c5d 6369 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6370 {
group-onsemi 0:098463de4c5d 6371 uint32_t i = 0u;
group-onsemi 0:098463de4c5d 6372 int32_t wOffset;
group-onsemi 0:098463de4c5d 6373
group-onsemi 0:098463de4c5d 6374 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6375 * to the current location where the input samples to be copied */
group-onsemi 0:098463de4c5d 6376 wOffset = *writeOffset;
group-onsemi 0:098463de4c5d 6377
group-onsemi 0:098463de4c5d 6378 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6379 i = blockSize;
group-onsemi 0:098463de4c5d 6380
group-onsemi 0:098463de4c5d 6381 while(i > 0u)
group-onsemi 0:098463de4c5d 6382 {
group-onsemi 0:098463de4c5d 6383 /* copy the input sample to the circular buffer */
group-onsemi 0:098463de4c5d 6384 circBuffer[wOffset] = *src;
group-onsemi 0:098463de4c5d 6385
group-onsemi 0:098463de4c5d 6386 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6387 src += srcInc;
group-onsemi 0:098463de4c5d 6388
group-onsemi 0:098463de4c5d 6389 /* Circularly update wOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6390 wOffset += bufferInc;
group-onsemi 0:098463de4c5d 6391 if(wOffset >= L)
group-onsemi 0:098463de4c5d 6392 wOffset -= L;
group-onsemi 0:098463de4c5d 6393
group-onsemi 0:098463de4c5d 6394 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6395 i--;
group-onsemi 0:098463de4c5d 6396 }
group-onsemi 0:098463de4c5d 6397
group-onsemi 0:098463de4c5d 6398 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6399 *writeOffset = wOffset;
group-onsemi 0:098463de4c5d 6400 }
group-onsemi 0:098463de4c5d 6401
group-onsemi 0:098463de4c5d 6402
group-onsemi 0:098463de4c5d 6403
group-onsemi 0:098463de4c5d 6404 /**
group-onsemi 0:098463de4c5d 6405 * @brief Q7 Circular Read function.
group-onsemi 0:098463de4c5d 6406 */
group-onsemi 0:098463de4c5d 6407 static __INLINE void arm_circularRead_q7(
group-onsemi 0:098463de4c5d 6408 q7_t * circBuffer,
group-onsemi 0:098463de4c5d 6409 int32_t L,
group-onsemi 0:098463de4c5d 6410 int32_t * readOffset,
group-onsemi 0:098463de4c5d 6411 int32_t bufferInc,
group-onsemi 0:098463de4c5d 6412 q7_t * dst,
group-onsemi 0:098463de4c5d 6413 q7_t * dst_base,
group-onsemi 0:098463de4c5d 6414 int32_t dst_length,
group-onsemi 0:098463de4c5d 6415 int32_t dstInc,
group-onsemi 0:098463de4c5d 6416 uint32_t blockSize)
group-onsemi 0:098463de4c5d 6417 {
group-onsemi 0:098463de4c5d 6418 uint32_t i = 0;
group-onsemi 0:098463de4c5d 6419 int32_t rOffset, dst_end;
group-onsemi 0:098463de4c5d 6420
group-onsemi 0:098463de4c5d 6421 /* Copy the value of Index pointer that points
group-onsemi 0:098463de4c5d 6422 * to the current location from where the input samples to be read */
group-onsemi 0:098463de4c5d 6423 rOffset = *readOffset;
group-onsemi 0:098463de4c5d 6424
group-onsemi 0:098463de4c5d 6425 dst_end = (int32_t) (dst_base + dst_length);
group-onsemi 0:098463de4c5d 6426
group-onsemi 0:098463de4c5d 6427 /* Loop over the blockSize */
group-onsemi 0:098463de4c5d 6428 i = blockSize;
group-onsemi 0:098463de4c5d 6429
group-onsemi 0:098463de4c5d 6430 while(i > 0u)
group-onsemi 0:098463de4c5d 6431 {
group-onsemi 0:098463de4c5d 6432 /* copy the sample from the circular buffer to the destination buffer */
group-onsemi 0:098463de4c5d 6433 *dst = circBuffer[rOffset];
group-onsemi 0:098463de4c5d 6434
group-onsemi 0:098463de4c5d 6435 /* Update the input pointer */
group-onsemi 0:098463de4c5d 6436 dst += dstInc;
group-onsemi 0:098463de4c5d 6437
group-onsemi 0:098463de4c5d 6438 if(dst == (q7_t *) dst_end)
group-onsemi 0:098463de4c5d 6439 {
group-onsemi 0:098463de4c5d 6440 dst = dst_base;
group-onsemi 0:098463de4c5d 6441 }
group-onsemi 0:098463de4c5d 6442
group-onsemi 0:098463de4c5d 6443 /* Circularly update rOffset. Watch out for positive and negative value */
group-onsemi 0:098463de4c5d 6444 rOffset += bufferInc;
group-onsemi 0:098463de4c5d 6445
group-onsemi 0:098463de4c5d 6446 if(rOffset >= L)
group-onsemi 0:098463de4c5d 6447 {
group-onsemi 0:098463de4c5d 6448 rOffset -= L;
group-onsemi 0:098463de4c5d 6449 }
group-onsemi 0:098463de4c5d 6450
group-onsemi 0:098463de4c5d 6451 /* Decrement the loop counter */
group-onsemi 0:098463de4c5d 6452 i--;
group-onsemi 0:098463de4c5d 6453 }
group-onsemi 0:098463de4c5d 6454
group-onsemi 0:098463de4c5d 6455 /* Update the index pointer */
group-onsemi 0:098463de4c5d 6456 *readOffset = rOffset;
group-onsemi 0:098463de4c5d 6457 }
group-onsemi 0:098463de4c5d 6458
group-onsemi 0:098463de4c5d 6459
group-onsemi 0:098463de4c5d 6460 /**
group-onsemi 0:098463de4c5d 6461 * @brief Sum of the squares of the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 6462 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6463 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6464 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6465 * @return none.
group-onsemi 0:098463de4c5d 6466 */
group-onsemi 0:098463de4c5d 6467
group-onsemi 0:098463de4c5d 6468 void arm_power_q31(
group-onsemi 0:098463de4c5d 6469 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6470 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6471 q63_t * pResult);
group-onsemi 0:098463de4c5d 6472
group-onsemi 0:098463de4c5d 6473 /**
group-onsemi 0:098463de4c5d 6474 * @brief Sum of the squares of the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 6475 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6476 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6477 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6478 * @return none.
group-onsemi 0:098463de4c5d 6479 */
group-onsemi 0:098463de4c5d 6480
group-onsemi 0:098463de4c5d 6481 void arm_power_f32(
group-onsemi 0:098463de4c5d 6482 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6483 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6484 float32_t * pResult);
group-onsemi 0:098463de4c5d 6485
group-onsemi 0:098463de4c5d 6486 /**
group-onsemi 0:098463de4c5d 6487 * @brief Sum of the squares of the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 6488 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6489 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6490 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6491 * @return none.
group-onsemi 0:098463de4c5d 6492 */
group-onsemi 0:098463de4c5d 6493
group-onsemi 0:098463de4c5d 6494 void arm_power_q15(
group-onsemi 0:098463de4c5d 6495 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6496 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6497 q63_t * pResult);
group-onsemi 0:098463de4c5d 6498
group-onsemi 0:098463de4c5d 6499 /**
group-onsemi 0:098463de4c5d 6500 * @brief Sum of the squares of the elements of a Q7 vector.
group-onsemi 0:098463de4c5d 6501 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6502 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6503 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6504 * @return none.
group-onsemi 0:098463de4c5d 6505 */
group-onsemi 0:098463de4c5d 6506
group-onsemi 0:098463de4c5d 6507 void arm_power_q7(
group-onsemi 0:098463de4c5d 6508 q7_t * pSrc,
group-onsemi 0:098463de4c5d 6509 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6510 q31_t * pResult);
group-onsemi 0:098463de4c5d 6511
group-onsemi 0:098463de4c5d 6512 /**
group-onsemi 0:098463de4c5d 6513 * @brief Mean value of a Q7 vector.
group-onsemi 0:098463de4c5d 6514 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6515 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6516 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6517 * @return none.
group-onsemi 0:098463de4c5d 6518 */
group-onsemi 0:098463de4c5d 6519
group-onsemi 0:098463de4c5d 6520 void arm_mean_q7(
group-onsemi 0:098463de4c5d 6521 q7_t * pSrc,
group-onsemi 0:098463de4c5d 6522 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6523 q7_t * pResult);
group-onsemi 0:098463de4c5d 6524
group-onsemi 0:098463de4c5d 6525 /**
group-onsemi 0:098463de4c5d 6526 * @brief Mean value of a Q15 vector.
group-onsemi 0:098463de4c5d 6527 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6528 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6529 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6530 * @return none.
group-onsemi 0:098463de4c5d 6531 */
group-onsemi 0:098463de4c5d 6532 void arm_mean_q15(
group-onsemi 0:098463de4c5d 6533 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6534 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6535 q15_t * pResult);
group-onsemi 0:098463de4c5d 6536
group-onsemi 0:098463de4c5d 6537 /**
group-onsemi 0:098463de4c5d 6538 * @brief Mean value of a Q31 vector.
group-onsemi 0:098463de4c5d 6539 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6540 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6541 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6542 * @return none.
group-onsemi 0:098463de4c5d 6543 */
group-onsemi 0:098463de4c5d 6544 void arm_mean_q31(
group-onsemi 0:098463de4c5d 6545 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6546 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6547 q31_t * pResult);
group-onsemi 0:098463de4c5d 6548
group-onsemi 0:098463de4c5d 6549 /**
group-onsemi 0:098463de4c5d 6550 * @brief Mean value of a floating-point vector.
group-onsemi 0:098463de4c5d 6551 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6552 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6553 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6554 * @return none.
group-onsemi 0:098463de4c5d 6555 */
group-onsemi 0:098463de4c5d 6556 void arm_mean_f32(
group-onsemi 0:098463de4c5d 6557 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6558 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6559 float32_t * pResult);
group-onsemi 0:098463de4c5d 6560
group-onsemi 0:098463de4c5d 6561 /**
group-onsemi 0:098463de4c5d 6562 * @brief Variance of the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 6563 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6564 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6565 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6566 * @return none.
group-onsemi 0:098463de4c5d 6567 */
group-onsemi 0:098463de4c5d 6568
group-onsemi 0:098463de4c5d 6569 void arm_var_f32(
group-onsemi 0:098463de4c5d 6570 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6571 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6572 float32_t * pResult);
group-onsemi 0:098463de4c5d 6573
group-onsemi 0:098463de4c5d 6574 /**
group-onsemi 0:098463de4c5d 6575 * @brief Variance of the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 6576 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6577 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6578 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6579 * @return none.
group-onsemi 0:098463de4c5d 6580 */
group-onsemi 0:098463de4c5d 6581
group-onsemi 0:098463de4c5d 6582 void arm_var_q31(
group-onsemi 0:098463de4c5d 6583 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6584 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6585 q31_t * pResult);
group-onsemi 0:098463de4c5d 6586
group-onsemi 0:098463de4c5d 6587 /**
group-onsemi 0:098463de4c5d 6588 * @brief Variance of the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 6589 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6590 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6591 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6592 * @return none.
group-onsemi 0:098463de4c5d 6593 */
group-onsemi 0:098463de4c5d 6594
group-onsemi 0:098463de4c5d 6595 void arm_var_q15(
group-onsemi 0:098463de4c5d 6596 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6597 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6598 q15_t * pResult);
group-onsemi 0:098463de4c5d 6599
group-onsemi 0:098463de4c5d 6600 /**
group-onsemi 0:098463de4c5d 6601 * @brief Root Mean Square of the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 6602 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6603 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6604 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6605 * @return none.
group-onsemi 0:098463de4c5d 6606 */
group-onsemi 0:098463de4c5d 6607
group-onsemi 0:098463de4c5d 6608 void arm_rms_f32(
group-onsemi 0:098463de4c5d 6609 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6610 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6611 float32_t * pResult);
group-onsemi 0:098463de4c5d 6612
group-onsemi 0:098463de4c5d 6613 /**
group-onsemi 0:098463de4c5d 6614 * @brief Root Mean Square of the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 6615 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6616 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6617 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6618 * @return none.
group-onsemi 0:098463de4c5d 6619 */
group-onsemi 0:098463de4c5d 6620
group-onsemi 0:098463de4c5d 6621 void arm_rms_q31(
group-onsemi 0:098463de4c5d 6622 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6623 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6624 q31_t * pResult);
group-onsemi 0:098463de4c5d 6625
group-onsemi 0:098463de4c5d 6626 /**
group-onsemi 0:098463de4c5d 6627 * @brief Root Mean Square of the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 6628 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6629 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6630 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6631 * @return none.
group-onsemi 0:098463de4c5d 6632 */
group-onsemi 0:098463de4c5d 6633
group-onsemi 0:098463de4c5d 6634 void arm_rms_q15(
group-onsemi 0:098463de4c5d 6635 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6636 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6637 q15_t * pResult);
group-onsemi 0:098463de4c5d 6638
group-onsemi 0:098463de4c5d 6639 /**
group-onsemi 0:098463de4c5d 6640 * @brief Standard deviation of the elements of a floating-point vector.
group-onsemi 0:098463de4c5d 6641 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6642 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6643 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6644 * @return none.
group-onsemi 0:098463de4c5d 6645 */
group-onsemi 0:098463de4c5d 6646
group-onsemi 0:098463de4c5d 6647 void arm_std_f32(
group-onsemi 0:098463de4c5d 6648 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6649 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6650 float32_t * pResult);
group-onsemi 0:098463de4c5d 6651
group-onsemi 0:098463de4c5d 6652 /**
group-onsemi 0:098463de4c5d 6653 * @brief Standard deviation of the elements of a Q31 vector.
group-onsemi 0:098463de4c5d 6654 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6655 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6656 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6657 * @return none.
group-onsemi 0:098463de4c5d 6658 */
group-onsemi 0:098463de4c5d 6659
group-onsemi 0:098463de4c5d 6660 void arm_std_q31(
group-onsemi 0:098463de4c5d 6661 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6662 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6663 q31_t * pResult);
group-onsemi 0:098463de4c5d 6664
group-onsemi 0:098463de4c5d 6665 /**
group-onsemi 0:098463de4c5d 6666 * @brief Standard deviation of the elements of a Q15 vector.
group-onsemi 0:098463de4c5d 6667 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6668 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6669 * @param[out] *pResult is output value.
group-onsemi 0:098463de4c5d 6670 * @return none.
group-onsemi 0:098463de4c5d 6671 */
group-onsemi 0:098463de4c5d 6672
group-onsemi 0:098463de4c5d 6673 void arm_std_q15(
group-onsemi 0:098463de4c5d 6674 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6675 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6676 q15_t * pResult);
group-onsemi 0:098463de4c5d 6677
group-onsemi 0:098463de4c5d 6678 /**
group-onsemi 0:098463de4c5d 6679 * @brief Floating-point complex magnitude
group-onsemi 0:098463de4c5d 6680 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 6681 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 6682 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 6683 * @return none.
group-onsemi 0:098463de4c5d 6684 */
group-onsemi 0:098463de4c5d 6685
group-onsemi 0:098463de4c5d 6686 void arm_cmplx_mag_f32(
group-onsemi 0:098463de4c5d 6687 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6688 float32_t * pDst,
group-onsemi 0:098463de4c5d 6689 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6690
group-onsemi 0:098463de4c5d 6691 /**
group-onsemi 0:098463de4c5d 6692 * @brief Q31 complex magnitude
group-onsemi 0:098463de4c5d 6693 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 6694 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 6695 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 6696 * @return none.
group-onsemi 0:098463de4c5d 6697 */
group-onsemi 0:098463de4c5d 6698
group-onsemi 0:098463de4c5d 6699 void arm_cmplx_mag_q31(
group-onsemi 0:098463de4c5d 6700 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6701 q31_t * pDst,
group-onsemi 0:098463de4c5d 6702 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6703
group-onsemi 0:098463de4c5d 6704 /**
group-onsemi 0:098463de4c5d 6705 * @brief Q15 complex magnitude
group-onsemi 0:098463de4c5d 6706 * @param[in] *pSrc points to the complex input vector
group-onsemi 0:098463de4c5d 6707 * @param[out] *pDst points to the real output vector
group-onsemi 0:098463de4c5d 6708 * @param[in] numSamples number of complex samples in the input vector
group-onsemi 0:098463de4c5d 6709 * @return none.
group-onsemi 0:098463de4c5d 6710 */
group-onsemi 0:098463de4c5d 6711
group-onsemi 0:098463de4c5d 6712 void arm_cmplx_mag_q15(
group-onsemi 0:098463de4c5d 6713 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6714 q15_t * pDst,
group-onsemi 0:098463de4c5d 6715 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6716
group-onsemi 0:098463de4c5d 6717 /**
group-onsemi 0:098463de4c5d 6718 * @brief Q15 complex dot product
group-onsemi 0:098463de4c5d 6719 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6720 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6721 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6722 * @param[out] *realResult real part of the result returned here
group-onsemi 0:098463de4c5d 6723 * @param[out] *imagResult imaginary part of the result returned here
group-onsemi 0:098463de4c5d 6724 * @return none.
group-onsemi 0:098463de4c5d 6725 */
group-onsemi 0:098463de4c5d 6726
group-onsemi 0:098463de4c5d 6727 void arm_cmplx_dot_prod_q15(
group-onsemi 0:098463de4c5d 6728 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 6729 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 6730 uint32_t numSamples,
group-onsemi 0:098463de4c5d 6731 q31_t * realResult,
group-onsemi 0:098463de4c5d 6732 q31_t * imagResult);
group-onsemi 0:098463de4c5d 6733
group-onsemi 0:098463de4c5d 6734 /**
group-onsemi 0:098463de4c5d 6735 * @brief Q31 complex dot product
group-onsemi 0:098463de4c5d 6736 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6737 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6738 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6739 * @param[out] *realResult real part of the result returned here
group-onsemi 0:098463de4c5d 6740 * @param[out] *imagResult imaginary part of the result returned here
group-onsemi 0:098463de4c5d 6741 * @return none.
group-onsemi 0:098463de4c5d 6742 */
group-onsemi 0:098463de4c5d 6743
group-onsemi 0:098463de4c5d 6744 void arm_cmplx_dot_prod_q31(
group-onsemi 0:098463de4c5d 6745 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 6746 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 6747 uint32_t numSamples,
group-onsemi 0:098463de4c5d 6748 q63_t * realResult,
group-onsemi 0:098463de4c5d 6749 q63_t * imagResult);
group-onsemi 0:098463de4c5d 6750
group-onsemi 0:098463de4c5d 6751 /**
group-onsemi 0:098463de4c5d 6752 * @brief Floating-point complex dot product
group-onsemi 0:098463de4c5d 6753 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6754 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6755 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6756 * @param[out] *realResult real part of the result returned here
group-onsemi 0:098463de4c5d 6757 * @param[out] *imagResult imaginary part of the result returned here
group-onsemi 0:098463de4c5d 6758 * @return none.
group-onsemi 0:098463de4c5d 6759 */
group-onsemi 0:098463de4c5d 6760
group-onsemi 0:098463de4c5d 6761 void arm_cmplx_dot_prod_f32(
group-onsemi 0:098463de4c5d 6762 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 6763 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 6764 uint32_t numSamples,
group-onsemi 0:098463de4c5d 6765 float32_t * realResult,
group-onsemi 0:098463de4c5d 6766 float32_t * imagResult);
group-onsemi 0:098463de4c5d 6767
group-onsemi 0:098463de4c5d 6768 /**
group-onsemi 0:098463de4c5d 6769 * @brief Q15 complex-by-real multiplication
group-onsemi 0:098463de4c5d 6770 * @param[in] *pSrcCmplx points to the complex input vector
group-onsemi 0:098463de4c5d 6771 * @param[in] *pSrcReal points to the real input vector
group-onsemi 0:098463de4c5d 6772 * @param[out] *pCmplxDst points to the complex output vector
group-onsemi 0:098463de4c5d 6773 * @param[in] numSamples number of samples in each vector
group-onsemi 0:098463de4c5d 6774 * @return none.
group-onsemi 0:098463de4c5d 6775 */
group-onsemi 0:098463de4c5d 6776
group-onsemi 0:098463de4c5d 6777 void arm_cmplx_mult_real_q15(
group-onsemi 0:098463de4c5d 6778 q15_t * pSrcCmplx,
group-onsemi 0:098463de4c5d 6779 q15_t * pSrcReal,
group-onsemi 0:098463de4c5d 6780 q15_t * pCmplxDst,
group-onsemi 0:098463de4c5d 6781 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6782
group-onsemi 0:098463de4c5d 6783 /**
group-onsemi 0:098463de4c5d 6784 * @brief Q31 complex-by-real multiplication
group-onsemi 0:098463de4c5d 6785 * @param[in] *pSrcCmplx points to the complex input vector
group-onsemi 0:098463de4c5d 6786 * @param[in] *pSrcReal points to the real input vector
group-onsemi 0:098463de4c5d 6787 * @param[out] *pCmplxDst points to the complex output vector
group-onsemi 0:098463de4c5d 6788 * @param[in] numSamples number of samples in each vector
group-onsemi 0:098463de4c5d 6789 * @return none.
group-onsemi 0:098463de4c5d 6790 */
group-onsemi 0:098463de4c5d 6791
group-onsemi 0:098463de4c5d 6792 void arm_cmplx_mult_real_q31(
group-onsemi 0:098463de4c5d 6793 q31_t * pSrcCmplx,
group-onsemi 0:098463de4c5d 6794 q31_t * pSrcReal,
group-onsemi 0:098463de4c5d 6795 q31_t * pCmplxDst,
group-onsemi 0:098463de4c5d 6796 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6797
group-onsemi 0:098463de4c5d 6798 /**
group-onsemi 0:098463de4c5d 6799 * @brief Floating-point complex-by-real multiplication
group-onsemi 0:098463de4c5d 6800 * @param[in] *pSrcCmplx points to the complex input vector
group-onsemi 0:098463de4c5d 6801 * @param[in] *pSrcReal points to the real input vector
group-onsemi 0:098463de4c5d 6802 * @param[out] *pCmplxDst points to the complex output vector
group-onsemi 0:098463de4c5d 6803 * @param[in] numSamples number of samples in each vector
group-onsemi 0:098463de4c5d 6804 * @return none.
group-onsemi 0:098463de4c5d 6805 */
group-onsemi 0:098463de4c5d 6806
group-onsemi 0:098463de4c5d 6807 void arm_cmplx_mult_real_f32(
group-onsemi 0:098463de4c5d 6808 float32_t * pSrcCmplx,
group-onsemi 0:098463de4c5d 6809 float32_t * pSrcReal,
group-onsemi 0:098463de4c5d 6810 float32_t * pCmplxDst,
group-onsemi 0:098463de4c5d 6811 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6812
group-onsemi 0:098463de4c5d 6813 /**
group-onsemi 0:098463de4c5d 6814 * @brief Minimum value of a Q7 vector.
group-onsemi 0:098463de4c5d 6815 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6816 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6817 * @param[out] *result is output pointer
group-onsemi 0:098463de4c5d 6818 * @param[in] index is the array index of the minimum value in the input buffer.
group-onsemi 0:098463de4c5d 6819 * @return none.
group-onsemi 0:098463de4c5d 6820 */
group-onsemi 0:098463de4c5d 6821
group-onsemi 0:098463de4c5d 6822 void arm_min_q7(
group-onsemi 0:098463de4c5d 6823 q7_t * pSrc,
group-onsemi 0:098463de4c5d 6824 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6825 q7_t * result,
group-onsemi 0:098463de4c5d 6826 uint32_t * index);
group-onsemi 0:098463de4c5d 6827
group-onsemi 0:098463de4c5d 6828 /**
group-onsemi 0:098463de4c5d 6829 * @brief Minimum value of a Q15 vector.
group-onsemi 0:098463de4c5d 6830 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6831 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6832 * @param[out] *pResult is output pointer
group-onsemi 0:098463de4c5d 6833 * @param[in] *pIndex is the array index of the minimum value in the input buffer.
group-onsemi 0:098463de4c5d 6834 * @return none.
group-onsemi 0:098463de4c5d 6835 */
group-onsemi 0:098463de4c5d 6836
group-onsemi 0:098463de4c5d 6837 void arm_min_q15(
group-onsemi 0:098463de4c5d 6838 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6839 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6840 q15_t * pResult,
group-onsemi 0:098463de4c5d 6841 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6842
group-onsemi 0:098463de4c5d 6843 /**
group-onsemi 0:098463de4c5d 6844 * @brief Minimum value of a Q31 vector.
group-onsemi 0:098463de4c5d 6845 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6846 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6847 * @param[out] *pResult is output pointer
group-onsemi 0:098463de4c5d 6848 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
group-onsemi 0:098463de4c5d 6849 * @return none.
group-onsemi 0:098463de4c5d 6850 */
group-onsemi 0:098463de4c5d 6851 void arm_min_q31(
group-onsemi 0:098463de4c5d 6852 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6853 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6854 q31_t * pResult,
group-onsemi 0:098463de4c5d 6855 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6856
group-onsemi 0:098463de4c5d 6857 /**
group-onsemi 0:098463de4c5d 6858 * @brief Minimum value of a floating-point vector.
group-onsemi 0:098463de4c5d 6859 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 6860 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 6861 * @param[out] *pResult is output pointer
group-onsemi 0:098463de4c5d 6862 * @param[out] *pIndex is the array index of the minimum value in the input buffer.
group-onsemi 0:098463de4c5d 6863 * @return none.
group-onsemi 0:098463de4c5d 6864 */
group-onsemi 0:098463de4c5d 6865
group-onsemi 0:098463de4c5d 6866 void arm_min_f32(
group-onsemi 0:098463de4c5d 6867 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6868 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6869 float32_t * pResult,
group-onsemi 0:098463de4c5d 6870 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6871
group-onsemi 0:098463de4c5d 6872 /**
group-onsemi 0:098463de4c5d 6873 * @brief Maximum value of a Q7 vector.
group-onsemi 0:098463de4c5d 6874 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 6875 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6876 * @param[out] *pResult maximum value returned here
group-onsemi 0:098463de4c5d 6877 * @param[out] *pIndex index of maximum value returned here
group-onsemi 0:098463de4c5d 6878 * @return none.
group-onsemi 0:098463de4c5d 6879 */
group-onsemi 0:098463de4c5d 6880
group-onsemi 0:098463de4c5d 6881 void arm_max_q7(
group-onsemi 0:098463de4c5d 6882 q7_t * pSrc,
group-onsemi 0:098463de4c5d 6883 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6884 q7_t * pResult,
group-onsemi 0:098463de4c5d 6885 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6886
group-onsemi 0:098463de4c5d 6887 /**
group-onsemi 0:098463de4c5d 6888 * @brief Maximum value of a Q15 vector.
group-onsemi 0:098463de4c5d 6889 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 6890 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6891 * @param[out] *pResult maximum value returned here
group-onsemi 0:098463de4c5d 6892 * @param[out] *pIndex index of maximum value returned here
group-onsemi 0:098463de4c5d 6893 * @return none.
group-onsemi 0:098463de4c5d 6894 */
group-onsemi 0:098463de4c5d 6895
group-onsemi 0:098463de4c5d 6896 void arm_max_q15(
group-onsemi 0:098463de4c5d 6897 q15_t * pSrc,
group-onsemi 0:098463de4c5d 6898 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6899 q15_t * pResult,
group-onsemi 0:098463de4c5d 6900 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6901
group-onsemi 0:098463de4c5d 6902 /**
group-onsemi 0:098463de4c5d 6903 * @brief Maximum value of a Q31 vector.
group-onsemi 0:098463de4c5d 6904 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 6905 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6906 * @param[out] *pResult maximum value returned here
group-onsemi 0:098463de4c5d 6907 * @param[out] *pIndex index of maximum value returned here
group-onsemi 0:098463de4c5d 6908 * @return none.
group-onsemi 0:098463de4c5d 6909 */
group-onsemi 0:098463de4c5d 6910
group-onsemi 0:098463de4c5d 6911 void arm_max_q31(
group-onsemi 0:098463de4c5d 6912 q31_t * pSrc,
group-onsemi 0:098463de4c5d 6913 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6914 q31_t * pResult,
group-onsemi 0:098463de4c5d 6915 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6916
group-onsemi 0:098463de4c5d 6917 /**
group-onsemi 0:098463de4c5d 6918 * @brief Maximum value of a floating-point vector.
group-onsemi 0:098463de4c5d 6919 * @param[in] *pSrc points to the input buffer
group-onsemi 0:098463de4c5d 6920 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6921 * @param[out] *pResult maximum value returned here
group-onsemi 0:098463de4c5d 6922 * @param[out] *pIndex index of maximum value returned here
group-onsemi 0:098463de4c5d 6923 * @return none.
group-onsemi 0:098463de4c5d 6924 */
group-onsemi 0:098463de4c5d 6925
group-onsemi 0:098463de4c5d 6926 void arm_max_f32(
group-onsemi 0:098463de4c5d 6927 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6928 uint32_t blockSize,
group-onsemi 0:098463de4c5d 6929 float32_t * pResult,
group-onsemi 0:098463de4c5d 6930 uint32_t * pIndex);
group-onsemi 0:098463de4c5d 6931
group-onsemi 0:098463de4c5d 6932 /**
group-onsemi 0:098463de4c5d 6933 * @brief Q15 complex-by-complex multiplication
group-onsemi 0:098463de4c5d 6934 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6935 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6936 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 6937 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6938 * @return none.
group-onsemi 0:098463de4c5d 6939 */
group-onsemi 0:098463de4c5d 6940
group-onsemi 0:098463de4c5d 6941 void arm_cmplx_mult_cmplx_q15(
group-onsemi 0:098463de4c5d 6942 q15_t * pSrcA,
group-onsemi 0:098463de4c5d 6943 q15_t * pSrcB,
group-onsemi 0:098463de4c5d 6944 q15_t * pDst,
group-onsemi 0:098463de4c5d 6945 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6946
group-onsemi 0:098463de4c5d 6947 /**
group-onsemi 0:098463de4c5d 6948 * @brief Q31 complex-by-complex multiplication
group-onsemi 0:098463de4c5d 6949 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6950 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6951 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 6952 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6953 * @return none.
group-onsemi 0:098463de4c5d 6954 */
group-onsemi 0:098463de4c5d 6955
group-onsemi 0:098463de4c5d 6956 void arm_cmplx_mult_cmplx_q31(
group-onsemi 0:098463de4c5d 6957 q31_t * pSrcA,
group-onsemi 0:098463de4c5d 6958 q31_t * pSrcB,
group-onsemi 0:098463de4c5d 6959 q31_t * pDst,
group-onsemi 0:098463de4c5d 6960 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6961
group-onsemi 0:098463de4c5d 6962 /**
group-onsemi 0:098463de4c5d 6963 * @brief Floating-point complex-by-complex multiplication
group-onsemi 0:098463de4c5d 6964 * @param[in] *pSrcA points to the first input vector
group-onsemi 0:098463de4c5d 6965 * @param[in] *pSrcB points to the second input vector
group-onsemi 0:098463de4c5d 6966 * @param[out] *pDst points to the output vector
group-onsemi 0:098463de4c5d 6967 * @param[in] numSamples number of complex samples in each vector
group-onsemi 0:098463de4c5d 6968 * @return none.
group-onsemi 0:098463de4c5d 6969 */
group-onsemi 0:098463de4c5d 6970
group-onsemi 0:098463de4c5d 6971 void arm_cmplx_mult_cmplx_f32(
group-onsemi 0:098463de4c5d 6972 float32_t * pSrcA,
group-onsemi 0:098463de4c5d 6973 float32_t * pSrcB,
group-onsemi 0:098463de4c5d 6974 float32_t * pDst,
group-onsemi 0:098463de4c5d 6975 uint32_t numSamples);
group-onsemi 0:098463de4c5d 6976
group-onsemi 0:098463de4c5d 6977 /**
group-onsemi 0:098463de4c5d 6978 * @brief Converts the elements of the floating-point vector to Q31 vector.
group-onsemi 0:098463de4c5d 6979 * @param[in] *pSrc points to the floating-point input vector
group-onsemi 0:098463de4c5d 6980 * @param[out] *pDst points to the Q31 output vector
group-onsemi 0:098463de4c5d 6981 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6982 * @return none.
group-onsemi 0:098463de4c5d 6983 */
group-onsemi 0:098463de4c5d 6984 void arm_float_to_q31(
group-onsemi 0:098463de4c5d 6985 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6986 q31_t * pDst,
group-onsemi 0:098463de4c5d 6987 uint32_t blockSize);
group-onsemi 0:098463de4c5d 6988
group-onsemi 0:098463de4c5d 6989 /**
group-onsemi 0:098463de4c5d 6990 * @brief Converts the elements of the floating-point vector to Q15 vector.
group-onsemi 0:098463de4c5d 6991 * @param[in] *pSrc points to the floating-point input vector
group-onsemi 0:098463de4c5d 6992 * @param[out] *pDst points to the Q15 output vector
group-onsemi 0:098463de4c5d 6993 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 6994 * @return none
group-onsemi 0:098463de4c5d 6995 */
group-onsemi 0:098463de4c5d 6996 void arm_float_to_q15(
group-onsemi 0:098463de4c5d 6997 float32_t * pSrc,
group-onsemi 0:098463de4c5d 6998 q15_t * pDst,
group-onsemi 0:098463de4c5d 6999 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7000
group-onsemi 0:098463de4c5d 7001 /**
group-onsemi 0:098463de4c5d 7002 * @brief Converts the elements of the floating-point vector to Q7 vector.
group-onsemi 0:098463de4c5d 7003 * @param[in] *pSrc points to the floating-point input vector
group-onsemi 0:098463de4c5d 7004 * @param[out] *pDst points to the Q7 output vector
group-onsemi 0:098463de4c5d 7005 * @param[in] blockSize length of the input vector
group-onsemi 0:098463de4c5d 7006 * @return none
group-onsemi 0:098463de4c5d 7007 */
group-onsemi 0:098463de4c5d 7008 void arm_float_to_q7(
group-onsemi 0:098463de4c5d 7009 float32_t * pSrc,
group-onsemi 0:098463de4c5d 7010 q7_t * pDst,
group-onsemi 0:098463de4c5d 7011 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7012
group-onsemi 0:098463de4c5d 7013
group-onsemi 0:098463de4c5d 7014 /**
group-onsemi 0:098463de4c5d 7015 * @brief Converts the elements of the Q31 vector to Q15 vector.
group-onsemi 0:098463de4c5d 7016 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 7017 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 7018 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 7019 * @return none.
group-onsemi 0:098463de4c5d 7020 */
group-onsemi 0:098463de4c5d 7021 void arm_q31_to_q15(
group-onsemi 0:098463de4c5d 7022 q31_t * pSrc,
group-onsemi 0:098463de4c5d 7023 q15_t * pDst,
group-onsemi 0:098463de4c5d 7024 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7025
group-onsemi 0:098463de4c5d 7026 /**
group-onsemi 0:098463de4c5d 7027 * @brief Converts the elements of the Q31 vector to Q7 vector.
group-onsemi 0:098463de4c5d 7028 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 7029 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 7030 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 7031 * @return none.
group-onsemi 0:098463de4c5d 7032 */
group-onsemi 0:098463de4c5d 7033 void arm_q31_to_q7(
group-onsemi 0:098463de4c5d 7034 q31_t * pSrc,
group-onsemi 0:098463de4c5d 7035 q7_t * pDst,
group-onsemi 0:098463de4c5d 7036 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7037
group-onsemi 0:098463de4c5d 7038 /**
group-onsemi 0:098463de4c5d 7039 * @brief Converts the elements of the Q15 vector to floating-point vector.
group-onsemi 0:098463de4c5d 7040 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 7041 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 7042 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 7043 * @return none.
group-onsemi 0:098463de4c5d 7044 */
group-onsemi 0:098463de4c5d 7045 void arm_q15_to_float(
group-onsemi 0:098463de4c5d 7046 q15_t * pSrc,
group-onsemi 0:098463de4c5d 7047 float32_t * pDst,
group-onsemi 0:098463de4c5d 7048 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7049
group-onsemi 0:098463de4c5d 7050
group-onsemi 0:098463de4c5d 7051 /**
group-onsemi 0:098463de4c5d 7052 * @brief Converts the elements of the Q15 vector to Q31 vector.
group-onsemi 0:098463de4c5d 7053 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 7054 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 7055 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 7056 * @return none.
group-onsemi 0:098463de4c5d 7057 */
group-onsemi 0:098463de4c5d 7058 void arm_q15_to_q31(
group-onsemi 0:098463de4c5d 7059 q15_t * pSrc,
group-onsemi 0:098463de4c5d 7060 q31_t * pDst,
group-onsemi 0:098463de4c5d 7061 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7062
group-onsemi 0:098463de4c5d 7063
group-onsemi 0:098463de4c5d 7064 /**
group-onsemi 0:098463de4c5d 7065 * @brief Converts the elements of the Q15 vector to Q7 vector.
group-onsemi 0:098463de4c5d 7066 * @param[in] *pSrc is input pointer
group-onsemi 0:098463de4c5d 7067 * @param[out] *pDst is output pointer
group-onsemi 0:098463de4c5d 7068 * @param[in] blockSize is the number of samples to process
group-onsemi 0:098463de4c5d 7069 * @return none.
group-onsemi 0:098463de4c5d 7070 */
group-onsemi 0:098463de4c5d 7071 void arm_q15_to_q7(
group-onsemi 0:098463de4c5d 7072 q15_t * pSrc,
group-onsemi 0:098463de4c5d 7073 q7_t * pDst,
group-onsemi 0:098463de4c5d 7074 uint32_t blockSize);
group-onsemi 0:098463de4c5d 7075
group-onsemi 0:098463de4c5d 7076
group-onsemi 0:098463de4c5d 7077 /**
group-onsemi 0:098463de4c5d 7078 * @ingroup groupInterpolation
group-onsemi 0:098463de4c5d 7079 */
group-onsemi 0:098463de4c5d 7080
group-onsemi 0:098463de4c5d 7081 /**
group-onsemi 0:098463de4c5d 7082 * @defgroup BilinearInterpolate Bilinear Interpolation
group-onsemi 0:098463de4c5d 7083 *
group-onsemi 0:098463de4c5d 7084 * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid.
group-onsemi 0:098463de4c5d 7085 * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process
group-onsemi 0:098463de4c5d 7086 * determines values between the grid points.
group-onsemi 0:098463de4c5d 7087 * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension.
group-onsemi 0:098463de4c5d 7088 * Bilinear interpolation is often used in image processing to rescale images.
group-onsemi 0:098463de4c5d 7089 * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types.
group-onsemi 0:098463de4c5d 7090 *
group-onsemi 0:098463de4c5d 7091 * <b>Algorithm</b>
group-onsemi 0:098463de4c5d 7092 * \par
group-onsemi 0:098463de4c5d 7093 * The instance structure used by the bilinear interpolation functions describes a two dimensional data table.
group-onsemi 0:098463de4c5d 7094 * For floating-point, the instance structure is defined as:
group-onsemi 0:098463de4c5d 7095 * <pre>
group-onsemi 0:098463de4c5d 7096 * typedef struct
group-onsemi 0:098463de4c5d 7097 * {
group-onsemi 0:098463de4c5d 7098 * uint16_t numRows;
group-onsemi 0:098463de4c5d 7099 * uint16_t numCols;
group-onsemi 0:098463de4c5d 7100 * float32_t *pData;
group-onsemi 0:098463de4c5d 7101 * } arm_bilinear_interp_instance_f32;
group-onsemi 0:098463de4c5d 7102 * </pre>
group-onsemi 0:098463de4c5d 7103 *
group-onsemi 0:098463de4c5d 7104 * \par
group-onsemi 0:098463de4c5d 7105 * where <code>numRows</code> specifies the number of rows in the table;
group-onsemi 0:098463de4c5d 7106 * <code>numCols</code> specifies the number of columns in the table;
group-onsemi 0:098463de4c5d 7107 * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values.
group-onsemi 0:098463de4c5d 7108 * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes.
group-onsemi 0:098463de4c5d 7109 * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers.
group-onsemi 0:098463de4c5d 7110 *
group-onsemi 0:098463de4c5d 7111 * \par
group-onsemi 0:098463de4c5d 7112 * Let <code>(x, y)</code> specify the desired interpolation point. Then define:
group-onsemi 0:098463de4c5d 7113 * <pre>
group-onsemi 0:098463de4c5d 7114 * XF = floor(x)
group-onsemi 0:098463de4c5d 7115 * YF = floor(y)
group-onsemi 0:098463de4c5d 7116 * </pre>
group-onsemi 0:098463de4c5d 7117 * \par
group-onsemi 0:098463de4c5d 7118 * The interpolated output point is computed as:
group-onsemi 0:098463de4c5d 7119 * <pre>
group-onsemi 0:098463de4c5d 7120 * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF))
group-onsemi 0:098463de4c5d 7121 * + f(XF+1, YF) * (x-XF)*(1-(y-YF))
group-onsemi 0:098463de4c5d 7122 * + f(XF, YF+1) * (1-(x-XF))*(y-YF)
group-onsemi 0:098463de4c5d 7123 * + f(XF+1, YF+1) * (x-XF)*(y-YF)
group-onsemi 0:098463de4c5d 7124 * </pre>
group-onsemi 0:098463de4c5d 7125 * Note that the coordinates (x, y) contain integer and fractional components.
group-onsemi 0:098463de4c5d 7126 * The integer components specify which portion of the table to use while the
group-onsemi 0:098463de4c5d 7127 * fractional components control the interpolation processor.
group-onsemi 0:098463de4c5d 7128 *
group-onsemi 0:098463de4c5d 7129 * \par
group-onsemi 0:098463de4c5d 7130 * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output.
group-onsemi 0:098463de4c5d 7131 */
group-onsemi 0:098463de4c5d 7132
group-onsemi 0:098463de4c5d 7133 /**
group-onsemi 0:098463de4c5d 7134 * @addtogroup BilinearInterpolate
group-onsemi 0:098463de4c5d 7135 * @{
group-onsemi 0:098463de4c5d 7136 */
group-onsemi 0:098463de4c5d 7137
group-onsemi 0:098463de4c5d 7138 /**
group-onsemi 0:098463de4c5d 7139 *
group-onsemi 0:098463de4c5d 7140 * @brief Floating-point bilinear interpolation.
group-onsemi 0:098463de4c5d 7141 * @param[in,out] *S points to an instance of the interpolation structure.
group-onsemi 0:098463de4c5d 7142 * @param[in] X interpolation coordinate.
group-onsemi 0:098463de4c5d 7143 * @param[in] Y interpolation coordinate.
group-onsemi 0:098463de4c5d 7144 * @return out interpolated value.
group-onsemi 0:098463de4c5d 7145 */
group-onsemi 0:098463de4c5d 7146
group-onsemi 0:098463de4c5d 7147
group-onsemi 0:098463de4c5d 7148 static __INLINE float32_t arm_bilinear_interp_f32(
group-onsemi 0:098463de4c5d 7149 const arm_bilinear_interp_instance_f32 * S,
group-onsemi 0:098463de4c5d 7150 float32_t X,
group-onsemi 0:098463de4c5d 7151 float32_t Y)
group-onsemi 0:098463de4c5d 7152 {
group-onsemi 0:098463de4c5d 7153 float32_t out;
group-onsemi 0:098463de4c5d 7154 float32_t f00, f01, f10, f11;
group-onsemi 0:098463de4c5d 7155 float32_t *pData = S->pData;
group-onsemi 0:098463de4c5d 7156 int32_t xIndex, yIndex, index;
group-onsemi 0:098463de4c5d 7157 float32_t xdiff, ydiff;
group-onsemi 0:098463de4c5d 7158 float32_t b1, b2, b3, b4;
group-onsemi 0:098463de4c5d 7159
group-onsemi 0:098463de4c5d 7160 xIndex = (int32_t) X;
group-onsemi 0:098463de4c5d 7161 yIndex = (int32_t) Y;
group-onsemi 0:098463de4c5d 7162
group-onsemi 0:098463de4c5d 7163 /* Care taken for table outside boundary */
group-onsemi 0:098463de4c5d 7164 /* Returns zero output when values are outside table boundary */
group-onsemi 0:098463de4c5d 7165 if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0
group-onsemi 0:098463de4c5d 7166 || yIndex > (S->numCols - 1))
group-onsemi 0:098463de4c5d 7167 {
group-onsemi 0:098463de4c5d 7168 return (0);
group-onsemi 0:098463de4c5d 7169 }
group-onsemi 0:098463de4c5d 7170
group-onsemi 0:098463de4c5d 7171 /* Calculation of index for two nearest points in X-direction */
group-onsemi 0:098463de4c5d 7172 index = (xIndex - 1) + (yIndex - 1) * S->numCols;
group-onsemi 0:098463de4c5d 7173
group-onsemi 0:098463de4c5d 7174
group-onsemi 0:098463de4c5d 7175 /* Read two nearest points in X-direction */
group-onsemi 0:098463de4c5d 7176 f00 = pData[index];
group-onsemi 0:098463de4c5d 7177 f01 = pData[index + 1];
group-onsemi 0:098463de4c5d 7178
group-onsemi 0:098463de4c5d 7179 /* Calculation of index for two nearest points in Y-direction */
group-onsemi 0:098463de4c5d 7180 index = (xIndex - 1) + (yIndex) * S->numCols;
group-onsemi 0:098463de4c5d 7181
group-onsemi 0:098463de4c5d 7182
group-onsemi 0:098463de4c5d 7183 /* Read two nearest points in Y-direction */
group-onsemi 0:098463de4c5d 7184 f10 = pData[index];
group-onsemi 0:098463de4c5d 7185 f11 = pData[index + 1];
group-onsemi 0:098463de4c5d 7186
group-onsemi 0:098463de4c5d 7187 /* Calculation of intermediate values */
group-onsemi 0:098463de4c5d 7188 b1 = f00;
group-onsemi 0:098463de4c5d 7189 b2 = f01 - f00;
group-onsemi 0:098463de4c5d 7190 b3 = f10 - f00;
group-onsemi 0:098463de4c5d 7191 b4 = f00 - f01 - f10 + f11;
group-onsemi 0:098463de4c5d 7192
group-onsemi 0:098463de4c5d 7193 /* Calculation of fractional part in X */
group-onsemi 0:098463de4c5d 7194 xdiff = X - xIndex;
group-onsemi 0:098463de4c5d 7195
group-onsemi 0:098463de4c5d 7196 /* Calculation of fractional part in Y */
group-onsemi 0:098463de4c5d 7197 ydiff = Y - yIndex;
group-onsemi 0:098463de4c5d 7198
group-onsemi 0:098463de4c5d 7199 /* Calculation of bi-linear interpolated output */
group-onsemi 0:098463de4c5d 7200 out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff;
group-onsemi 0:098463de4c5d 7201
group-onsemi 0:098463de4c5d 7202 /* return to application */
group-onsemi 0:098463de4c5d 7203 return (out);
group-onsemi 0:098463de4c5d 7204
group-onsemi 0:098463de4c5d 7205 }
group-onsemi 0:098463de4c5d 7206
group-onsemi 0:098463de4c5d 7207 /**
group-onsemi 0:098463de4c5d 7208 *
group-onsemi 0:098463de4c5d 7209 * @brief Q31 bilinear interpolation.
group-onsemi 0:098463de4c5d 7210 * @param[in,out] *S points to an instance of the interpolation structure.
group-onsemi 0:098463de4c5d 7211 * @param[in] X interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7212 * @param[in] Y interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7213 * @return out interpolated value.
group-onsemi 0:098463de4c5d 7214 */
group-onsemi 0:098463de4c5d 7215
group-onsemi 0:098463de4c5d 7216 static __INLINE q31_t arm_bilinear_interp_q31(
group-onsemi 0:098463de4c5d 7217 arm_bilinear_interp_instance_q31 * S,
group-onsemi 0:098463de4c5d 7218 q31_t X,
group-onsemi 0:098463de4c5d 7219 q31_t Y)
group-onsemi 0:098463de4c5d 7220 {
group-onsemi 0:098463de4c5d 7221 q31_t out; /* Temporary output */
group-onsemi 0:098463de4c5d 7222 q31_t acc = 0; /* output */
group-onsemi 0:098463de4c5d 7223 q31_t xfract, yfract; /* X, Y fractional parts */
group-onsemi 0:098463de4c5d 7224 q31_t x1, x2, y1, y2; /* Nearest output values */
group-onsemi 0:098463de4c5d 7225 int32_t rI, cI; /* Row and column indices */
group-onsemi 0:098463de4c5d 7226 q31_t *pYData = S->pData; /* pointer to output table values */
group-onsemi 0:098463de4c5d 7227 uint32_t nCols = S->numCols; /* num of rows */
group-onsemi 0:098463de4c5d 7228
group-onsemi 0:098463de4c5d 7229
group-onsemi 0:098463de4c5d 7230 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7231 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7232 /* Index value calculation */
group-onsemi 0:098463de4c5d 7233 rI = ((X & 0xFFF00000) >> 20u);
group-onsemi 0:098463de4c5d 7234
group-onsemi 0:098463de4c5d 7235 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7236 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7237 /* Index value calculation */
group-onsemi 0:098463de4c5d 7238 cI = ((Y & 0xFFF00000) >> 20u);
group-onsemi 0:098463de4c5d 7239
group-onsemi 0:098463de4c5d 7240 /* Care taken for table outside boundary */
group-onsemi 0:098463de4c5d 7241 /* Returns zero output when values are outside table boundary */
group-onsemi 0:098463de4c5d 7242 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
group-onsemi 0:098463de4c5d 7243 {
group-onsemi 0:098463de4c5d 7244 return (0);
group-onsemi 0:098463de4c5d 7245 }
group-onsemi 0:098463de4c5d 7246
group-onsemi 0:098463de4c5d 7247 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7248 /* shift left xfract by 11 to keep 1.31 format */
group-onsemi 0:098463de4c5d 7249 xfract = (X & 0x000FFFFF) << 11u;
group-onsemi 0:098463de4c5d 7250
group-onsemi 0:098463de4c5d 7251 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7252 x1 = pYData[(rI) + nCols * (cI)];
group-onsemi 0:098463de4c5d 7253 x2 = pYData[(rI) + nCols * (cI) + 1u];
group-onsemi 0:098463de4c5d 7254
group-onsemi 0:098463de4c5d 7255 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7256 /* shift left yfract by 11 to keep 1.31 format */
group-onsemi 0:098463de4c5d 7257 yfract = (Y & 0x000FFFFF) << 11u;
group-onsemi 0:098463de4c5d 7258
group-onsemi 0:098463de4c5d 7259 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7260 y1 = pYData[(rI) + nCols * (cI + 1)];
group-onsemi 0:098463de4c5d 7261 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
group-onsemi 0:098463de4c5d 7262
group-onsemi 0:098463de4c5d 7263 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */
group-onsemi 0:098463de4c5d 7264 out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32));
group-onsemi 0:098463de4c5d 7265 acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32));
group-onsemi 0:098463de4c5d 7266
group-onsemi 0:098463de4c5d 7267 /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */
group-onsemi 0:098463de4c5d 7268 out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32));
group-onsemi 0:098463de4c5d 7269 acc += ((q31_t) ((q63_t) out * (xfract) >> 32));
group-onsemi 0:098463de4c5d 7270
group-onsemi 0:098463de4c5d 7271 /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */
group-onsemi 0:098463de4c5d 7272 out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32));
group-onsemi 0:098463de4c5d 7273 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
group-onsemi 0:098463de4c5d 7274
group-onsemi 0:098463de4c5d 7275 /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */
group-onsemi 0:098463de4c5d 7276 out = ((q31_t) ((q63_t) y2 * (xfract) >> 32));
group-onsemi 0:098463de4c5d 7277 acc += ((q31_t) ((q63_t) out * (yfract) >> 32));
group-onsemi 0:098463de4c5d 7278
group-onsemi 0:098463de4c5d 7279 /* Convert acc to 1.31(q31) format */
group-onsemi 0:098463de4c5d 7280 return (acc << 2u);
group-onsemi 0:098463de4c5d 7281
group-onsemi 0:098463de4c5d 7282 }
group-onsemi 0:098463de4c5d 7283
group-onsemi 0:098463de4c5d 7284 /**
group-onsemi 0:098463de4c5d 7285 * @brief Q15 bilinear interpolation.
group-onsemi 0:098463de4c5d 7286 * @param[in,out] *S points to an instance of the interpolation structure.
group-onsemi 0:098463de4c5d 7287 * @param[in] X interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7288 * @param[in] Y interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7289 * @return out interpolated value.
group-onsemi 0:098463de4c5d 7290 */
group-onsemi 0:098463de4c5d 7291
group-onsemi 0:098463de4c5d 7292 static __INLINE q15_t arm_bilinear_interp_q15(
group-onsemi 0:098463de4c5d 7293 arm_bilinear_interp_instance_q15 * S,
group-onsemi 0:098463de4c5d 7294 q31_t X,
group-onsemi 0:098463de4c5d 7295 q31_t Y)
group-onsemi 0:098463de4c5d 7296 {
group-onsemi 0:098463de4c5d 7297 q63_t acc = 0; /* output */
group-onsemi 0:098463de4c5d 7298 q31_t out; /* Temporary output */
group-onsemi 0:098463de4c5d 7299 q15_t x1, x2, y1, y2; /* Nearest output values */
group-onsemi 0:098463de4c5d 7300 q31_t xfract, yfract; /* X, Y fractional parts */
group-onsemi 0:098463de4c5d 7301 int32_t rI, cI; /* Row and column indices */
group-onsemi 0:098463de4c5d 7302 q15_t *pYData = S->pData; /* pointer to output table values */
group-onsemi 0:098463de4c5d 7303 uint32_t nCols = S->numCols; /* num of rows */
group-onsemi 0:098463de4c5d 7304
group-onsemi 0:098463de4c5d 7305 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7306 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7307 /* Index value calculation */
group-onsemi 0:098463de4c5d 7308 rI = ((X & 0xFFF00000) >> 20);
group-onsemi 0:098463de4c5d 7309
group-onsemi 0:098463de4c5d 7310 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7311 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7312 /* Index value calculation */
group-onsemi 0:098463de4c5d 7313 cI = ((Y & 0xFFF00000) >> 20);
group-onsemi 0:098463de4c5d 7314
group-onsemi 0:098463de4c5d 7315 /* Care taken for table outside boundary */
group-onsemi 0:098463de4c5d 7316 /* Returns zero output when values are outside table boundary */
group-onsemi 0:098463de4c5d 7317 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
group-onsemi 0:098463de4c5d 7318 {
group-onsemi 0:098463de4c5d 7319 return (0);
group-onsemi 0:098463de4c5d 7320 }
group-onsemi 0:098463de4c5d 7321
group-onsemi 0:098463de4c5d 7322 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7323 /* xfract should be in 12.20 format */
group-onsemi 0:098463de4c5d 7324 xfract = (X & 0x000FFFFF);
group-onsemi 0:098463de4c5d 7325
group-onsemi 0:098463de4c5d 7326 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7327 x1 = pYData[(rI) + nCols * (cI)];
group-onsemi 0:098463de4c5d 7328 x2 = pYData[(rI) + nCols * (cI) + 1u];
group-onsemi 0:098463de4c5d 7329
group-onsemi 0:098463de4c5d 7330
group-onsemi 0:098463de4c5d 7331 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7332 /* yfract should be in 12.20 format */
group-onsemi 0:098463de4c5d 7333 yfract = (Y & 0x000FFFFF);
group-onsemi 0:098463de4c5d 7334
group-onsemi 0:098463de4c5d 7335 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7336 y1 = pYData[(rI) + nCols * (cI + 1)];
group-onsemi 0:098463de4c5d 7337 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
group-onsemi 0:098463de4c5d 7338
group-onsemi 0:098463de4c5d 7339 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */
group-onsemi 0:098463de4c5d 7340
group-onsemi 0:098463de4c5d 7341 /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */
group-onsemi 0:098463de4c5d 7342 /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */
group-onsemi 0:098463de4c5d 7343 out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u);
group-onsemi 0:098463de4c5d 7344 acc = ((q63_t) out * (0xFFFFF - yfract));
group-onsemi 0:098463de4c5d 7345
group-onsemi 0:098463de4c5d 7346 /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */
group-onsemi 0:098463de4c5d 7347 out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u);
group-onsemi 0:098463de4c5d 7348 acc += ((q63_t) out * (xfract));
group-onsemi 0:098463de4c5d 7349
group-onsemi 0:098463de4c5d 7350 /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */
group-onsemi 0:098463de4c5d 7351 out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u);
group-onsemi 0:098463de4c5d 7352 acc += ((q63_t) out * (yfract));
group-onsemi 0:098463de4c5d 7353
group-onsemi 0:098463de4c5d 7354 /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */
group-onsemi 0:098463de4c5d 7355 out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u);
group-onsemi 0:098463de4c5d 7356 acc += ((q63_t) out * (yfract));
group-onsemi 0:098463de4c5d 7357
group-onsemi 0:098463de4c5d 7358 /* acc is in 13.51 format and down shift acc by 36 times */
group-onsemi 0:098463de4c5d 7359 /* Convert out to 1.15 format */
group-onsemi 0:098463de4c5d 7360 return (acc >> 36);
group-onsemi 0:098463de4c5d 7361
group-onsemi 0:098463de4c5d 7362 }
group-onsemi 0:098463de4c5d 7363
group-onsemi 0:098463de4c5d 7364 /**
group-onsemi 0:098463de4c5d 7365 * @brief Q7 bilinear interpolation.
group-onsemi 0:098463de4c5d 7366 * @param[in,out] *S points to an instance of the interpolation structure.
group-onsemi 0:098463de4c5d 7367 * @param[in] X interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7368 * @param[in] Y interpolation coordinate in 12.20 format.
group-onsemi 0:098463de4c5d 7369 * @return out interpolated value.
group-onsemi 0:098463de4c5d 7370 */
group-onsemi 0:098463de4c5d 7371
group-onsemi 0:098463de4c5d 7372 static __INLINE q7_t arm_bilinear_interp_q7(
group-onsemi 0:098463de4c5d 7373 arm_bilinear_interp_instance_q7 * S,
group-onsemi 0:098463de4c5d 7374 q31_t X,
group-onsemi 0:098463de4c5d 7375 q31_t Y)
group-onsemi 0:098463de4c5d 7376 {
group-onsemi 0:098463de4c5d 7377 q63_t acc = 0; /* output */
group-onsemi 0:098463de4c5d 7378 q31_t out; /* Temporary output */
group-onsemi 0:098463de4c5d 7379 q31_t xfract, yfract; /* X, Y fractional parts */
group-onsemi 0:098463de4c5d 7380 q7_t x1, x2, y1, y2; /* Nearest output values */
group-onsemi 0:098463de4c5d 7381 int32_t rI, cI; /* Row and column indices */
group-onsemi 0:098463de4c5d 7382 q7_t *pYData = S->pData; /* pointer to output table values */
group-onsemi 0:098463de4c5d 7383 uint32_t nCols = S->numCols; /* num of rows */
group-onsemi 0:098463de4c5d 7384
group-onsemi 0:098463de4c5d 7385 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7386 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7387 /* Index value calculation */
group-onsemi 0:098463de4c5d 7388 rI = ((X & 0xFFF00000) >> 20);
group-onsemi 0:098463de4c5d 7389
group-onsemi 0:098463de4c5d 7390 /* Input is in 12.20 format */
group-onsemi 0:098463de4c5d 7391 /* 12 bits for the table index */
group-onsemi 0:098463de4c5d 7392 /* Index value calculation */
group-onsemi 0:098463de4c5d 7393 cI = ((Y & 0xFFF00000) >> 20);
group-onsemi 0:098463de4c5d 7394
group-onsemi 0:098463de4c5d 7395 /* Care taken for table outside boundary */
group-onsemi 0:098463de4c5d 7396 /* Returns zero output when values are outside table boundary */
group-onsemi 0:098463de4c5d 7397 if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1))
group-onsemi 0:098463de4c5d 7398 {
group-onsemi 0:098463de4c5d 7399 return (0);
group-onsemi 0:098463de4c5d 7400 }
group-onsemi 0:098463de4c5d 7401
group-onsemi 0:098463de4c5d 7402 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7403 /* xfract should be in 12.20 format */
group-onsemi 0:098463de4c5d 7404 xfract = (X & 0x000FFFFF);
group-onsemi 0:098463de4c5d 7405
group-onsemi 0:098463de4c5d 7406 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7407 x1 = pYData[(rI) + nCols * (cI)];
group-onsemi 0:098463de4c5d 7408 x2 = pYData[(rI) + nCols * (cI) + 1u];
group-onsemi 0:098463de4c5d 7409
group-onsemi 0:098463de4c5d 7410
group-onsemi 0:098463de4c5d 7411 /* 20 bits for the fractional part */
group-onsemi 0:098463de4c5d 7412 /* yfract should be in 12.20 format */
group-onsemi 0:098463de4c5d 7413 yfract = (Y & 0x000FFFFF);
group-onsemi 0:098463de4c5d 7414
group-onsemi 0:098463de4c5d 7415 /* Read two nearest output values from the index */
group-onsemi 0:098463de4c5d 7416 y1 = pYData[(rI) + nCols * (cI + 1)];
group-onsemi 0:098463de4c5d 7417 y2 = pYData[(rI) + nCols * (cI + 1) + 1u];
group-onsemi 0:098463de4c5d 7418
group-onsemi 0:098463de4c5d 7419 /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */
group-onsemi 0:098463de4c5d 7420 out = ((x1 * (0xFFFFF - xfract)));
group-onsemi 0:098463de4c5d 7421 acc = (((q63_t) out * (0xFFFFF - yfract)));
group-onsemi 0:098463de4c5d 7422
group-onsemi 0:098463de4c5d 7423 /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */
group-onsemi 0:098463de4c5d 7424 out = ((x2 * (0xFFFFF - yfract)));
group-onsemi 0:098463de4c5d 7425 acc += (((q63_t) out * (xfract)));
group-onsemi 0:098463de4c5d 7426
group-onsemi 0:098463de4c5d 7427 /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */
group-onsemi 0:098463de4c5d 7428 out = ((y1 * (0xFFFFF - xfract)));
group-onsemi 0:098463de4c5d 7429 acc += (((q63_t) out * (yfract)));
group-onsemi 0:098463de4c5d 7430
group-onsemi 0:098463de4c5d 7431 /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */
group-onsemi 0:098463de4c5d 7432 out = ((y2 * (yfract)));
group-onsemi 0:098463de4c5d 7433 acc += (((q63_t) out * (xfract)));
group-onsemi 0:098463de4c5d 7434
group-onsemi 0:098463de4c5d 7435 /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */
group-onsemi 0:098463de4c5d 7436 return (acc >> 40);
group-onsemi 0:098463de4c5d 7437
group-onsemi 0:098463de4c5d 7438 }
group-onsemi 0:098463de4c5d 7439
group-onsemi 0:098463de4c5d 7440 /**
group-onsemi 0:098463de4c5d 7441 * @} end of BilinearInterpolate group
group-onsemi 0:098463de4c5d 7442 */
group-onsemi 0:098463de4c5d 7443
group-onsemi 0:098463de4c5d 7444
group-onsemi 0:098463de4c5d 7445 //SMMLAR
group-onsemi 0:098463de4c5d 7446 #define multAcc_32x32_keep32_R(a, x, y) \
group-onsemi 0:098463de4c5d 7447 a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32)
group-onsemi 0:098463de4c5d 7448
group-onsemi 0:098463de4c5d 7449 //SMMLSR
group-onsemi 0:098463de4c5d 7450 #define multSub_32x32_keep32_R(a, x, y) \
group-onsemi 0:098463de4c5d 7451 a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32)
group-onsemi 0:098463de4c5d 7452
group-onsemi 0:098463de4c5d 7453 //SMMULR
group-onsemi 0:098463de4c5d 7454 #define mult_32x32_keep32_R(a, x, y) \
group-onsemi 0:098463de4c5d 7455 a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32)
group-onsemi 0:098463de4c5d 7456
group-onsemi 0:098463de4c5d 7457 //SMMLA
group-onsemi 0:098463de4c5d 7458 #define multAcc_32x32_keep32(a, x, y) \
group-onsemi 0:098463de4c5d 7459 a += (q31_t) (((q63_t) x * y) >> 32)
group-onsemi 0:098463de4c5d 7460
group-onsemi 0:098463de4c5d 7461 //SMMLS
group-onsemi 0:098463de4c5d 7462 #define multSub_32x32_keep32(a, x, y) \
group-onsemi 0:098463de4c5d 7463 a -= (q31_t) (((q63_t) x * y) >> 32)
group-onsemi 0:098463de4c5d 7464
group-onsemi 0:098463de4c5d 7465 //SMMUL
group-onsemi 0:098463de4c5d 7466 #define mult_32x32_keep32(a, x, y) \
group-onsemi 0:098463de4c5d 7467 a = (q31_t) (((q63_t) x * y ) >> 32)
group-onsemi 0:098463de4c5d 7468
group-onsemi 0:098463de4c5d 7469
group-onsemi 0:098463de4c5d 7470 #if defined ( __CC_ARM ) //Keil
group-onsemi 0:098463de4c5d 7471
group-onsemi 0:098463de4c5d 7472 //Enter low optimization region - place directly above function definition
group-onsemi 0:098463de4c5d 7473 #ifdef ARM_MATH_CM4
group-onsemi 0:098463de4c5d 7474 #define LOW_OPTIMIZATION_ENTER \
group-onsemi 0:098463de4c5d 7475 _Pragma ("push") \
group-onsemi 0:098463de4c5d 7476 _Pragma ("O1")
group-onsemi 0:098463de4c5d 7477 #else
group-onsemi 0:098463de4c5d 7478 #define LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7479 #endif
group-onsemi 0:098463de4c5d 7480
group-onsemi 0:098463de4c5d 7481 //Exit low optimization region - place directly after end of function definition
group-onsemi 0:098463de4c5d 7482 #ifdef ARM_MATH_CM4
group-onsemi 0:098463de4c5d 7483 #define LOW_OPTIMIZATION_EXIT \
group-onsemi 0:098463de4c5d 7484 _Pragma ("pop")
group-onsemi 0:098463de4c5d 7485 #else
group-onsemi 0:098463de4c5d 7486 #define LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7487 #endif
group-onsemi 0:098463de4c5d 7488
group-onsemi 0:098463de4c5d 7489 //Enter low optimization region - place directly above function definition
group-onsemi 0:098463de4c5d 7490 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7491
group-onsemi 0:098463de4c5d 7492 //Exit low optimization region - place directly after end of function definition
group-onsemi 0:098463de4c5d 7493 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7494
group-onsemi 0:098463de4c5d 7495 #elif defined(__ICCARM__) //IAR
group-onsemi 0:098463de4c5d 7496
group-onsemi 0:098463de4c5d 7497 //Enter low optimization region - place directly above function definition
group-onsemi 0:098463de4c5d 7498 #ifdef ARM_MATH_CM4
group-onsemi 0:098463de4c5d 7499 #define LOW_OPTIMIZATION_ENTER \
group-onsemi 0:098463de4c5d 7500 _Pragma ("optimize=low")
group-onsemi 0:098463de4c5d 7501 #else
group-onsemi 0:098463de4c5d 7502 #define LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7503 #endif
group-onsemi 0:098463de4c5d 7504
group-onsemi 0:098463de4c5d 7505 //Exit low optimization region - place directly after end of function definition
group-onsemi 0:098463de4c5d 7506 #define LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7507
group-onsemi 0:098463de4c5d 7508 //Enter low optimization region - place directly above function definition
group-onsemi 0:098463de4c5d 7509 #ifdef ARM_MATH_CM4
group-onsemi 0:098463de4c5d 7510 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \
group-onsemi 0:098463de4c5d 7511 _Pragma ("optimize=low")
group-onsemi 0:098463de4c5d 7512 #else
group-onsemi 0:098463de4c5d 7513 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7514 #endif
group-onsemi 0:098463de4c5d 7515
group-onsemi 0:098463de4c5d 7516 //Exit low optimization region - place directly after end of function definition
group-onsemi 0:098463de4c5d 7517 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7518
group-onsemi 0:098463de4c5d 7519 #elif defined(__GNUC__)
group-onsemi 0:098463de4c5d 7520
group-onsemi 0:098463de4c5d 7521 #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") ))
group-onsemi 0:098463de4c5d 7522
group-onsemi 0:098463de4c5d 7523 #define LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7524
group-onsemi 0:098463de4c5d 7525 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7526
group-onsemi 0:098463de4c5d 7527 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7528
group-onsemi 0:098463de4c5d 7529 #elif defined(__CSMC__) // Cosmic
group-onsemi 0:098463de4c5d 7530
group-onsemi 0:098463de4c5d 7531 #define LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7532 #define LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7533 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7534 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7535
group-onsemi 0:098463de4c5d 7536 #elif defined(__TASKING__) // TASKING
group-onsemi 0:098463de4c5d 7537
group-onsemi 0:098463de4c5d 7538 #define LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7539 #define LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7540 #define IAR_ONLY_LOW_OPTIMIZATION_ENTER
group-onsemi 0:098463de4c5d 7541 #define IAR_ONLY_LOW_OPTIMIZATION_EXIT
group-onsemi 0:098463de4c5d 7542
group-onsemi 0:098463de4c5d 7543 #endif
group-onsemi 0:098463de4c5d 7544
group-onsemi 0:098463de4c5d 7545
group-onsemi 0:098463de4c5d 7546 #ifdef __cplusplus
group-onsemi 0:098463de4c5d 7547 }
group-onsemi 0:098463de4c5d 7548 #endif
group-onsemi 0:098463de4c5d 7549
group-onsemi 0:098463de4c5d 7550
group-onsemi 0:098463de4c5d 7551 #endif /* _ARM_MATH_H */
group-onsemi 0:098463de4c5d 7552
group-onsemi 0:098463de4c5d 7553 /**
group-onsemi 0:098463de4c5d 7554 *
group-onsemi 0:098463de4c5d 7555 * End of file.
group-onsemi 0:098463de4c5d 7556 */