CMSIS DSP library

Dependents:   performance_timer Surfboard_ gps2rtty Capstone ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Committer:
mbed_official
Date:
Fri Nov 20 08:45:18 2015 +0000
Revision:
5:3762170b6d4d
Parent:
3:7a284390b0ce
Synchronized with git revision 2eb940b9a73af188d3004a2575fdfbb05febe62b

Full URL: https://github.com/mbedmicro/mbed/commit/2eb940b9a73af188d3004a2575fdfbb05febe62b/

Added option to build rpc library. closes #1426

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 3:7a284390b0ce 1 /* ----------------------------------------------------------------------
mbed_official 5:3762170b6d4d 2 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
mbed_official 3:7a284390b0ce 3 *
mbed_official 5:3762170b6d4d 4 * $Date: 20. October 2015
mbed_official 5:3762170b6d4d 5 * $Revision: V1.4.5 b
mbed_official 3:7a284390b0ce 6 *
mbed_official 3:7a284390b0ce 7 * Project: CMSIS DSP Library
mbed_official 3:7a284390b0ce 8 * Title: arm_math.h
mbed_official 3:7a284390b0ce 9 *
mbed_official 3:7a284390b0ce 10 * Description: Public header file for CMSIS DSP Library
mbed_official 3:7a284390b0ce 11 *
mbed_official 5:3762170b6d4d 12 * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0
mbed_official 3:7a284390b0ce 13 *
mbed_official 3:7a284390b0ce 14 * Redistribution and use in source and binary forms, with or without
mbed_official 3:7a284390b0ce 15 * modification, are permitted provided that the following conditions
mbed_official 3:7a284390b0ce 16 * are met:
mbed_official 3:7a284390b0ce 17 * - Redistributions of source code must retain the above copyright
mbed_official 3:7a284390b0ce 18 * notice, this list of conditions and the following disclaimer.
mbed_official 3:7a284390b0ce 19 * - Redistributions in binary form must reproduce the above copyright
mbed_official 3:7a284390b0ce 20 * notice, this list of conditions and the following disclaimer in
mbed_official 3:7a284390b0ce 21 * the documentation and/or other materials provided with the
mbed_official 3:7a284390b0ce 22 * distribution.
mbed_official 3:7a284390b0ce 23 * - Neither the name of ARM LIMITED nor the names of its contributors
mbed_official 3:7a284390b0ce 24 * may be used to endorse or promote products derived from this
mbed_official 3:7a284390b0ce 25 * software without specific prior written permission.
mbed_official 3:7a284390b0ce 26 *
mbed_official 3:7a284390b0ce 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
mbed_official 3:7a284390b0ce 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
mbed_official 3:7a284390b0ce 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
mbed_official 3:7a284390b0ce 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
mbed_official 3:7a284390b0ce 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mbed_official 3:7a284390b0ce 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
mbed_official 3:7a284390b0ce 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 3:7a284390b0ce 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 3:7a284390b0ce 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
mbed_official 3:7a284390b0ce 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
mbed_official 3:7a284390b0ce 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 3:7a284390b0ce 38 * POSSIBILITY OF SUCH DAMAGE.
emilmont 1:fdd22bb7aa52 39 * -------------------------------------------------------------------- */
emilmont 1:fdd22bb7aa52 40
emilmont 1:fdd22bb7aa52 41 /**
emilmont 1:fdd22bb7aa52 42 \mainpage CMSIS DSP Software Library
emilmont 1:fdd22bb7aa52 43 *
mbed_official 5:3762170b6d4d 44 * Introduction
mbed_official 5:3762170b6d4d 45 * ------------
emilmont 1:fdd22bb7aa52 46 *
mbed_official 3:7a284390b0ce 47 * This user manual describes the CMSIS DSP software library,
emilmont 1:fdd22bb7aa52 48 * a suite of common signal processing functions for use on Cortex-M processor based devices.
emilmont 1:fdd22bb7aa52 49 *
mbed_official 3:7a284390b0ce 50 * The library is divided into a number of functions each covering a specific category:
emilmont 1:fdd22bb7aa52 51 * - Basic math functions
emilmont 1:fdd22bb7aa52 52 * - Fast math functions
emilmont 1:fdd22bb7aa52 53 * - Complex math functions
emilmont 1:fdd22bb7aa52 54 * - Filters
emilmont 1:fdd22bb7aa52 55 * - Matrix functions
emilmont 1:fdd22bb7aa52 56 * - Transforms
emilmont 1:fdd22bb7aa52 57 * - Motor control functions
emilmont 1:fdd22bb7aa52 58 * - Statistical functions
emilmont 1:fdd22bb7aa52 59 * - Support functions
emilmont 1:fdd22bb7aa52 60 * - Interpolation functions
emilmont 1:fdd22bb7aa52 61 *
emilmont 1:fdd22bb7aa52 62 * The library has separate functions for operating on 8-bit integers, 16-bit integers,
mbed_official 3:7a284390b0ce 63 * 32-bit integer and 32-bit floating-point values.
emilmont 1:fdd22bb7aa52 64 *
mbed_official 5:3762170b6d4d 65 * Using the Library
mbed_official 5:3762170b6d4d 66 * ------------
emilmont 1:fdd22bb7aa52 67 *
emilmont 1:fdd22bb7aa52 68 * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder.
mbed_official 5:3762170b6d4d 69 * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7)
mbed_official 5:3762170b6d4d 70 * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7)
mbed_official 5:3762170b6d4d 71 * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7)
mbed_official 5:3762170b6d4d 72 * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7)
mbed_official 5:3762170b6d4d 73 * - arm_cortexM7l_math.lib (Little endian on Cortex-M7)
mbed_official 5:3762170b6d4d 74 * - arm_cortexM7b_math.lib (Big endian on Cortex-M7)
emilmont 1:fdd22bb7aa52 75 * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4)
emilmont 1:fdd22bb7aa52 76 * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4)
emilmont 1:fdd22bb7aa52 77 * - arm_cortexM4l_math.lib (Little endian on Cortex-M4)
emilmont 1:fdd22bb7aa52 78 * - arm_cortexM4b_math.lib (Big endian on Cortex-M4)
emilmont 1:fdd22bb7aa52 79 * - arm_cortexM3l_math.lib (Little endian on Cortex-M3)
emilmont 1:fdd22bb7aa52 80 * - arm_cortexM3b_math.lib (Big endian on Cortex-M3)
mbed_official 5:3762170b6d4d 81 * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+)
mbed_official 5:3762170b6d4d 82 * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+)
emilmont 1:fdd22bb7aa52 83 *
emilmont 1:fdd22bb7aa52 84 * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder.
mbed_official 3:7a284390b0ce 85 * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single
mbed_official 5:3762170b6d4d 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.
mbed_official 5:3762170b6d4d 87 * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or
mbed_official 3:7a284390b0ce 88 * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application.
emilmont 1:fdd22bb7aa52 89 *
mbed_official 5:3762170b6d4d 90 * Examples
mbed_official 5:3762170b6d4d 91 * --------
emilmont 1:fdd22bb7aa52 92 *
emilmont 1:fdd22bb7aa52 93 * The library ships with a number of examples which demonstrate how to use the library functions.
emilmont 1:fdd22bb7aa52 94 *
mbed_official 5:3762170b6d4d 95 * Toolchain Support
mbed_official 5:3762170b6d4d 96 * ------------
mbed_official 3:7a284390b0ce 97 *
mbed_official 5:3762170b6d4d 98 * The library has been developed and tested with MDK-ARM version 5.14.0.0
mbed_official 3:7a284390b0ce 99 * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly.
mbed_official 3:7a284390b0ce 100 *
mbed_official 5:3762170b6d4d 101 * Building the Library
mbed_official 5:3762170b6d4d 102 * ------------
emilmont 1:fdd22bb7aa52 103 *
mbed_official 5:3762170b6d4d 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.
mbed_official 5:3762170b6d4d 105 * - arm_cortexM_math.uvprojx
emilmont 1:fdd22bb7aa52 106 *
emilmont 1:fdd22bb7aa52 107 *
mbed_official 5:3762170b6d4d 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.
mbed_official 3:7a284390b0ce 109 *
mbed_official 5:3762170b6d4d 110 * Pre-processor Macros
mbed_official 5:3762170b6d4d 111 * ------------
mbed_official 3:7a284390b0ce 112 *
mbed_official 3:7a284390b0ce 113 * Each library project have differant pre-processor macros.
mbed_official 3:7a284390b0ce 114 *
mbed_official 3:7a284390b0ce 115 * - UNALIGNED_SUPPORT_DISABLE:
mbed_official 3:7a284390b0ce 116 *
mbed_official 3:7a284390b0ce 117 * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access
mbed_official 3:7a284390b0ce 118 *
mbed_official 3:7a284390b0ce 119 * - ARM_MATH_BIG_ENDIAN:
mbed_official 3:7a284390b0ce 120 *
mbed_official 3:7a284390b0ce 121 * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets.
mbed_official 3:7a284390b0ce 122 *
mbed_official 3:7a284390b0ce 123 * - ARM_MATH_MATRIX_CHECK:
mbed_official 3:7a284390b0ce 124 *
mbed_official 3:7a284390b0ce 125 * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices
mbed_official 3:7a284390b0ce 126 *
mbed_official 3:7a284390b0ce 127 * - ARM_MATH_ROUNDING:
mbed_official 3:7a284390b0ce 128 *
mbed_official 3:7a284390b0ce 129 * Define macro ARM_MATH_ROUNDING for rounding on support functions
mbed_official 3:7a284390b0ce 130 *
mbed_official 3:7a284390b0ce 131 * - ARM_MATH_CMx:
mbed_official 3:7a284390b0ce 132 *
mbed_official 3:7a284390b0ce 133 * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target
mbed_official 5:3762170b6d4d 134 * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and
mbed_official 5:3762170b6d4d 135 * ARM_MATH_CM7 for building the library on cortex-M7.
mbed_official 3:7a284390b0ce 136 *
mbed_official 3:7a284390b0ce 137 * - __FPU_PRESENT:
mbed_official 3:7a284390b0ce 138 *
mbed_official 3:7a284390b0ce 139 * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries
emilmont 1:fdd22bb7aa52 140 *
mbed_official 5:3762170b6d4d 141 * <hr>
mbed_official 5:3762170b6d4d 142 * CMSIS-DSP in ARM::CMSIS Pack
mbed_official 5:3762170b6d4d 143 * -----------------------------
emilmont 1:fdd22bb7aa52 144 *
mbed_official 5:3762170b6d4d 145 * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories:
mbed_official 5:3762170b6d4d 146 * |File/Folder |Content |
mbed_official 5:3762170b6d4d 147 * |------------------------------|------------------------------------------------------------------------|
mbed_official 5:3762170b6d4d 148 * |\b CMSIS\\Documentation\\DSP | This documentation |
mbed_official 5:3762170b6d4d 149 * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) |
mbed_official 5:3762170b6d4d 150 * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions |
mbed_official 5:3762170b6d4d 151 * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library |
mbed_official 5:3762170b6d4d 152 *
mbed_official 5:3762170b6d4d 153 * <hr>
mbed_official 5:3762170b6d4d 154 * Revision History of CMSIS-DSP
mbed_official 5:3762170b6d4d 155 * ------------
mbed_official 5:3762170b6d4d 156 * Please refer to \ref ChangeLog_pg.
mbed_official 5:3762170b6d4d 157 *
mbed_official 5:3762170b6d4d 158 * Copyright Notice
mbed_official 5:3762170b6d4d 159 * ------------
mbed_official 5:3762170b6d4d 160 *
mbed_official 5:3762170b6d4d 161 * Copyright (C) 2010-2015 ARM Limited. All rights reserved.
emilmont 1:fdd22bb7aa52 162 */
emilmont 1:fdd22bb7aa52 163
emilmont 1:fdd22bb7aa52 164
emilmont 1:fdd22bb7aa52 165 /**
emilmont 1:fdd22bb7aa52 166 * @defgroup groupMath Basic Math Functions
emilmont 1:fdd22bb7aa52 167 */
emilmont 1:fdd22bb7aa52 168
emilmont 1:fdd22bb7aa52 169 /**
emilmont 1:fdd22bb7aa52 170 * @defgroup groupFastMath Fast Math Functions
emilmont 1:fdd22bb7aa52 171 * This set of functions provides a fast approximation to sine, cosine, and square root.
emilmont 1:fdd22bb7aa52 172 * As compared to most of the other functions in the CMSIS math library, the fast math functions
emilmont 1:fdd22bb7aa52 173 * operate on individual values and not arrays.
emilmont 1:fdd22bb7aa52 174 * There are separate functions for Q15, Q31, and floating-point data.
emilmont 1:fdd22bb7aa52 175 *
emilmont 1:fdd22bb7aa52 176 */
emilmont 1:fdd22bb7aa52 177
emilmont 1:fdd22bb7aa52 178 /**
emilmont 1:fdd22bb7aa52 179 * @defgroup groupCmplxMath Complex Math Functions
emilmont 1:fdd22bb7aa52 180 * This set of functions operates on complex data vectors.
emilmont 1:fdd22bb7aa52 181 * The data in the complex arrays is stored in an interleaved fashion
emilmont 1:fdd22bb7aa52 182 * (real, imag, real, imag, ...).
emilmont 1:fdd22bb7aa52 183 * In the API functions, the number of samples in a complex array refers
emilmont 1:fdd22bb7aa52 184 * to the number of complex values; the array contains twice this number of
emilmont 1:fdd22bb7aa52 185 * real values.
emilmont 1:fdd22bb7aa52 186 */
emilmont 1:fdd22bb7aa52 187
emilmont 1:fdd22bb7aa52 188 /**
emilmont 1:fdd22bb7aa52 189 * @defgroup groupFilters Filtering Functions
emilmont 1:fdd22bb7aa52 190 */
emilmont 1:fdd22bb7aa52 191
emilmont 1:fdd22bb7aa52 192 /**
emilmont 1:fdd22bb7aa52 193 * @defgroup groupMatrix Matrix Functions
emilmont 1:fdd22bb7aa52 194 *
emilmont 1:fdd22bb7aa52 195 * This set of functions provides basic matrix math operations.
emilmont 1:fdd22bb7aa52 196 * The functions operate on matrix data structures. For example,
emilmont 1:fdd22bb7aa52 197 * the type
emilmont 1:fdd22bb7aa52 198 * definition for the floating-point matrix structure is shown
emilmont 1:fdd22bb7aa52 199 * below:
emilmont 1:fdd22bb7aa52 200 * <pre>
emilmont 1:fdd22bb7aa52 201 * typedef struct
emilmont 1:fdd22bb7aa52 202 * {
emilmont 1:fdd22bb7aa52 203 * uint16_t numRows; // number of rows of the matrix.
emilmont 1:fdd22bb7aa52 204 * uint16_t numCols; // number of columns of the matrix.
emilmont 1:fdd22bb7aa52 205 * float32_t *pData; // points to the data of the matrix.
emilmont 1:fdd22bb7aa52 206 * } arm_matrix_instance_f32;
emilmont 1:fdd22bb7aa52 207 * </pre>
emilmont 1:fdd22bb7aa52 208 * There are similar definitions for Q15 and Q31 data types.
emilmont 1:fdd22bb7aa52 209 *
emilmont 1:fdd22bb7aa52 210 * The structure specifies the size of the matrix and then points to
emilmont 1:fdd22bb7aa52 211 * an array of data. The array is of size <code>numRows X numCols</code>
emilmont 1:fdd22bb7aa52 212 * and the values are arranged in row order. That is, the
emilmont 1:fdd22bb7aa52 213 * matrix element (i, j) is stored at:
emilmont 1:fdd22bb7aa52 214 * <pre>
emilmont 1:fdd22bb7aa52 215 * pData[i*numCols + j]
emilmont 1:fdd22bb7aa52 216 * </pre>
emilmont 1:fdd22bb7aa52 217 *
emilmont 1:fdd22bb7aa52 218 * \par Init Functions
emilmont 1:fdd22bb7aa52 219 * There is an associated initialization function for each type of matrix
emilmont 1:fdd22bb7aa52 220 * data structure.
emilmont 1:fdd22bb7aa52 221 * The initialization function sets the values of the internal structure fields.
emilmont 1:fdd22bb7aa52 222 * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code>
emilmont 1:fdd22bb7aa52 223 * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively.
emilmont 1:fdd22bb7aa52 224 *
emilmont 1:fdd22bb7aa52 225 * \par
emilmont 1:fdd22bb7aa52 226 * Use of the initialization function is optional. However, if initialization function is used
emilmont 1:fdd22bb7aa52 227 * then the instance structure cannot be placed into a const data section.
emilmont 1:fdd22bb7aa52 228 * To place the instance structure in a const data
emilmont 1:fdd22bb7aa52 229 * section, manually initialize the data structure. For example:
emilmont 1:fdd22bb7aa52 230 * <pre>
emilmont 1:fdd22bb7aa52 231 * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code>
emilmont 1:fdd22bb7aa52 232 * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code>
emilmont 1:fdd22bb7aa52 233 * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code>
emilmont 1:fdd22bb7aa52 234 * </pre>
emilmont 1:fdd22bb7aa52 235 * where <code>nRows</code> specifies the number of rows, <code>nColumns</code>
emilmont 1:fdd22bb7aa52 236 * specifies the number of columns, and <code>pData</code> points to the
emilmont 1:fdd22bb7aa52 237 * data array.
emilmont 1:fdd22bb7aa52 238 *
emilmont 1:fdd22bb7aa52 239 * \par Size Checking
emilmont 1:fdd22bb7aa52 240 * By default all of the matrix functions perform size checking on the input and
emilmont 1:fdd22bb7aa52 241 * output matrices. For example, the matrix addition function verifies that the
emilmont 1:fdd22bb7aa52 242 * two input matrices and the output matrix all have the same number of rows and
emilmont 1:fdd22bb7aa52 243 * columns. If the size check fails the functions return:
emilmont 1:fdd22bb7aa52 244 * <pre>
emilmont 1:fdd22bb7aa52 245 * ARM_MATH_SIZE_MISMATCH
emilmont 1:fdd22bb7aa52 246 * </pre>
emilmont 1:fdd22bb7aa52 247 * Otherwise the functions return
emilmont 1:fdd22bb7aa52 248 * <pre>
emilmont 1:fdd22bb7aa52 249 * ARM_MATH_SUCCESS
emilmont 1:fdd22bb7aa52 250 * </pre>
emilmont 1:fdd22bb7aa52 251 * There is some overhead associated with this matrix size checking.
emilmont 1:fdd22bb7aa52 252 * The matrix size checking is enabled via the \#define
emilmont 1:fdd22bb7aa52 253 * <pre>
emilmont 1:fdd22bb7aa52 254 * ARM_MATH_MATRIX_CHECK
emilmont 1:fdd22bb7aa52 255 * </pre>
emilmont 1:fdd22bb7aa52 256 * within the library project settings. By default this macro is defined
emilmont 1:fdd22bb7aa52 257 * and size checking is enabled. By changing the project settings and
emilmont 1:fdd22bb7aa52 258 * undefining this macro size checking is eliminated and the functions
emilmont 1:fdd22bb7aa52 259 * run a bit faster. With size checking disabled the functions always
emilmont 1:fdd22bb7aa52 260 * return <code>ARM_MATH_SUCCESS</code>.
emilmont 1:fdd22bb7aa52 261 */
emilmont 1:fdd22bb7aa52 262
emilmont 1:fdd22bb7aa52 263 /**
emilmont 1:fdd22bb7aa52 264 * @defgroup groupTransforms Transform Functions
emilmont 1:fdd22bb7aa52 265 */
emilmont 1:fdd22bb7aa52 266
emilmont 1:fdd22bb7aa52 267 /**
emilmont 1:fdd22bb7aa52 268 * @defgroup groupController Controller Functions
emilmont 1:fdd22bb7aa52 269 */
emilmont 1:fdd22bb7aa52 270
emilmont 1:fdd22bb7aa52 271 /**
emilmont 1:fdd22bb7aa52 272 * @defgroup groupStats Statistics Functions
emilmont 1:fdd22bb7aa52 273 */
emilmont 1:fdd22bb7aa52 274 /**
emilmont 1:fdd22bb7aa52 275 * @defgroup groupSupport Support Functions
emilmont 1:fdd22bb7aa52 276 */
emilmont 1:fdd22bb7aa52 277
emilmont 1:fdd22bb7aa52 278 /**
emilmont 1:fdd22bb7aa52 279 * @defgroup groupInterpolation Interpolation Functions
emilmont 1:fdd22bb7aa52 280 * These functions perform 1- and 2-dimensional interpolation of data.
emilmont 1:fdd22bb7aa52 281 * Linear interpolation is used for 1-dimensional data and
emilmont 1:fdd22bb7aa52 282 * bilinear interpolation is used for 2-dimensional data.
emilmont 1:fdd22bb7aa52 283 */
emilmont 1:fdd22bb7aa52 284
emilmont 1:fdd22bb7aa52 285 /**
emilmont 1:fdd22bb7aa52 286 * @defgroup groupExamples Examples
emilmont 1:fdd22bb7aa52 287 */
emilmont 1:fdd22bb7aa52 288 #ifndef _ARM_MATH_H
emilmont 1:fdd22bb7aa52 289 #define _ARM_MATH_H
emilmont 1:fdd22bb7aa52 290
mbed_official 5:3762170b6d4d 291 /* ignore some GCC warnings */
mbed_official 5:3762170b6d4d 292 #if defined ( __GNUC__ )
mbed_official 5:3762170b6d4d 293 #pragma GCC diagnostic push
mbed_official 5:3762170b6d4d 294 #pragma GCC diagnostic ignored "-Wsign-conversion"
mbed_official 5:3762170b6d4d 295 #pragma GCC diagnostic ignored "-Wconversion"
mbed_official 5:3762170b6d4d 296 #pragma GCC diagnostic ignored "-Wunused-parameter"
mbed_official 5:3762170b6d4d 297 #endif
mbed_official 5:3762170b6d4d 298
emilmont 1:fdd22bb7aa52 299 #define __CMSIS_GENERIC /* disable NVIC and Systick functions */
emilmont 1:fdd22bb7aa52 300
mbed_official 5:3762170b6d4d 301 #if defined(ARM_MATH_CM7)
mbed_official 5:3762170b6d4d 302 #include "core_cm7.h"
mbed_official 5:3762170b6d4d 303 #elif defined (ARM_MATH_CM4)
mbed_official 5:3762170b6d4d 304 #include "core_cm4.h"
emilmont 1:fdd22bb7aa52 305 #elif defined (ARM_MATH_CM3)
mbed_official 5:3762170b6d4d 306 #include "core_cm3.h"
emilmont 1:fdd22bb7aa52 307 #elif defined (ARM_MATH_CM0)
mbed_official 5:3762170b6d4d 308 #include "core_cm0.h"
mbed_official 5:3762170b6d4d 309 #define ARM_MATH_CM0_FAMILY
mbed_official 3:7a284390b0ce 310 #elif defined (ARM_MATH_CM0PLUS)
mbed_official 5:3762170b6d4d 311 #include "core_cm0plus.h"
mbed_official 5:3762170b6d4d 312 #define ARM_MATH_CM0_FAMILY
emilmont 1:fdd22bb7aa52 313 #else
mbed_official 5:3762170b6d4d 314 #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0"
emilmont 1:fdd22bb7aa52 315 #endif
emilmont 1:fdd22bb7aa52 316
emilmont 1:fdd22bb7aa52 317 #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */
emilmont 1:fdd22bb7aa52 318 #include "string.h"
emilmont 1:fdd22bb7aa52 319 #include "math.h"
mbed_official 5:3762170b6d4d 320
mbed_official 5:3762170b6d4d 321 #ifdef __cplusplus
emilmont 1:fdd22bb7aa52 322 extern "C"
emilmont 1:fdd22bb7aa52 323 {
emilmont 1:fdd22bb7aa52 324 #endif
emilmont 1:fdd22bb7aa52 325
emilmont 1:fdd22bb7aa52 326
emilmont 1:fdd22bb7aa52 327 /**
emilmont 1:fdd22bb7aa52 328 * @brief Macros required for reciprocal calculation in Normalized LMS
emilmont 1:fdd22bb7aa52 329 */
emilmont 1:fdd22bb7aa52 330
mbed_official 5:3762170b6d4d 331 #define DELTA_Q31 (0x100)
mbed_official 5:3762170b6d4d 332 #define DELTA_Q15 0x5
mbed_official 5:3762170b6d4d 333 #define INDEX_MASK 0x0000003F
emilmont 1:fdd22bb7aa52 334 #ifndef PI
mbed_official 5:3762170b6d4d 335 #define PI 3.14159265358979f
emilmont 1:fdd22bb7aa52 336 #endif
emilmont 1:fdd22bb7aa52 337
emilmont 1:fdd22bb7aa52 338 /**
emilmont 1:fdd22bb7aa52 339 * @brief Macros required for SINE and COSINE Fast math approximations
emilmont 1:fdd22bb7aa52 340 */
emilmont 1:fdd22bb7aa52 341
mbed_official 5:3762170b6d4d 342 #define FAST_MATH_TABLE_SIZE 512
mbed_official 5:3762170b6d4d 343 #define FAST_MATH_Q31_SHIFT (32 - 10)
mbed_official 5:3762170b6d4d 344 #define FAST_MATH_Q15_SHIFT (16 - 10)
mbed_official 5:3762170b6d4d 345 #define CONTROLLER_Q31_SHIFT (32 - 9)
mbed_official 5:3762170b6d4d 346 #define TABLE_SIZE 256
mbed_official 5:3762170b6d4d 347 #define TABLE_SPACING_Q31 0x400000
mbed_official 5:3762170b6d4d 348 #define TABLE_SPACING_Q15 0x80
emilmont 1:fdd22bb7aa52 349
emilmont 1:fdd22bb7aa52 350 /**
emilmont 1:fdd22bb7aa52 351 * @brief Macros required for SINE and COSINE Controller functions
emilmont 1:fdd22bb7aa52 352 */
emilmont 1:fdd22bb7aa52 353 /* 1.31(q31) Fixed value of 2/360 */
emilmont 1:fdd22bb7aa52 354 /* -1 to +1 is divided into 360 values so total spacing is (2/360) */
mbed_official 5:3762170b6d4d 355 #define INPUT_SPACING 0xB60B61
emilmont 1:fdd22bb7aa52 356
emilmont 1:fdd22bb7aa52 357 /**
emilmont 1:fdd22bb7aa52 358 * @brief Macro for Unaligned Support
emilmont 1:fdd22bb7aa52 359 */
emilmont 1:fdd22bb7aa52 360 #ifndef UNALIGNED_SUPPORT_DISABLE
emilmont 1:fdd22bb7aa52 361 #define ALIGN4
emilmont 1:fdd22bb7aa52 362 #else
emilmont 1:fdd22bb7aa52 363 #if defined (__GNUC__)
emilmont 1:fdd22bb7aa52 364 #define ALIGN4 __attribute__((aligned(4)))
emilmont 1:fdd22bb7aa52 365 #else
emilmont 1:fdd22bb7aa52 366 #define ALIGN4 __align(4)
emilmont 1:fdd22bb7aa52 367 #endif
mbed_official 5:3762170b6d4d 368 #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */
emilmont 1:fdd22bb7aa52 369
emilmont 1:fdd22bb7aa52 370 /**
emilmont 1:fdd22bb7aa52 371 * @brief Error status returned by some functions in the library.
emilmont 1:fdd22bb7aa52 372 */
emilmont 1:fdd22bb7aa52 373
emilmont 1:fdd22bb7aa52 374 typedef enum
emilmont 1:fdd22bb7aa52 375 {
emilmont 1:fdd22bb7aa52 376 ARM_MATH_SUCCESS = 0, /**< No error */
emilmont 1:fdd22bb7aa52 377 ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */
emilmont 1:fdd22bb7aa52 378 ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */
emilmont 1:fdd22bb7aa52 379 ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */
emilmont 1:fdd22bb7aa52 380 ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */
emilmont 1:fdd22bb7aa52 381 ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */
emilmont 1:fdd22bb7aa52 382 ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */
emilmont 1:fdd22bb7aa52 383 } arm_status;
emilmont 1:fdd22bb7aa52 384
emilmont 1:fdd22bb7aa52 385 /**
emilmont 1:fdd22bb7aa52 386 * @brief 8-bit fractional data type in 1.7 format.
emilmont 1:fdd22bb7aa52 387 */
emilmont 1:fdd22bb7aa52 388 typedef int8_t q7_t;
emilmont 1:fdd22bb7aa52 389
emilmont 1:fdd22bb7aa52 390 /**
emilmont 1:fdd22bb7aa52 391 * @brief 16-bit fractional data type in 1.15 format.
emilmont 1:fdd22bb7aa52 392 */
emilmont 1:fdd22bb7aa52 393 typedef int16_t q15_t;
emilmont 1:fdd22bb7aa52 394
emilmont 1:fdd22bb7aa52 395 /**
emilmont 1:fdd22bb7aa52 396 * @brief 32-bit fractional data type in 1.31 format.
emilmont 1:fdd22bb7aa52 397 */
emilmont 1:fdd22bb7aa52 398 typedef int32_t q31_t;
emilmont 1:fdd22bb7aa52 399
emilmont 1:fdd22bb7aa52 400 /**
emilmont 1:fdd22bb7aa52 401 * @brief 64-bit fractional data type in 1.63 format.
emilmont 1:fdd22bb7aa52 402 */
emilmont 1:fdd22bb7aa52 403 typedef int64_t q63_t;
emilmont 1:fdd22bb7aa52 404
emilmont 1:fdd22bb7aa52 405 /**
emilmont 1:fdd22bb7aa52 406 * @brief 32-bit floating-point type definition.
emilmont 1:fdd22bb7aa52 407 */
emilmont 1:fdd22bb7aa52 408 typedef float float32_t;
emilmont 1:fdd22bb7aa52 409
emilmont 1:fdd22bb7aa52 410 /**
emilmont 1:fdd22bb7aa52 411 * @brief 64-bit floating-point type definition.
emilmont 1:fdd22bb7aa52 412 */
emilmont 1:fdd22bb7aa52 413 typedef double float64_t;
emilmont 1:fdd22bb7aa52 414
emilmont 1:fdd22bb7aa52 415 /**
emilmont 1:fdd22bb7aa52 416 * @brief definition to read/write two 16 bit values.
emilmont 1:fdd22bb7aa52 417 */
mbed_official 3:7a284390b0ce 418 #if defined __CC_ARM
mbed_official 5:3762170b6d4d 419 #define __SIMD32_TYPE int32_t __packed
mbed_official 5:3762170b6d4d 420 #define CMSIS_UNUSED __attribute__((unused))
mbed_official 5:3762170b6d4d 421
mbed_official 5:3762170b6d4d 422 #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
mbed_official 5:3762170b6d4d 423 #define __SIMD32_TYPE int32_t
mbed_official 5:3762170b6d4d 424 #define CMSIS_UNUSED __attribute__((unused))
mbed_official 5:3762170b6d4d 425
mbed_official 5:3762170b6d4d 426 #elif defined __GNUC__
mbed_official 5:3762170b6d4d 427 #define __SIMD32_TYPE int32_t
mbed_official 5:3762170b6d4d 428 #define CMSIS_UNUSED __attribute__((unused))
mbed_official 5:3762170b6d4d 429
mbed_official 3:7a284390b0ce 430 #elif defined __ICCARM__
mbed_official 5:3762170b6d4d 431 #define __SIMD32_TYPE int32_t __packed
mbed_official 5:3762170b6d4d 432 #define CMSIS_UNUSED
mbed_official 5:3762170b6d4d 433
mbed_official 5:3762170b6d4d 434 #elif defined __CSMC__
mbed_official 5:3762170b6d4d 435 #define __SIMD32_TYPE int32_t
mbed_official 5:3762170b6d4d 436 #define CMSIS_UNUSED
mbed_official 5:3762170b6d4d 437
mbed_official 5:3762170b6d4d 438 #elif defined __TASKING__
mbed_official 5:3762170b6d4d 439 #define __SIMD32_TYPE __unaligned int32_t
mbed_official 5:3762170b6d4d 440 #define CMSIS_UNUSED
mbed_official 5:3762170b6d4d 441
emilmont 1:fdd22bb7aa52 442 #else
mbed_official 5:3762170b6d4d 443 #error Unknown compiler
mbed_official 3:7a284390b0ce 444 #endif
mbed_official 3:7a284390b0ce 445
mbed_official 5:3762170b6d4d 446 #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr))
mbed_official 3:7a284390b0ce 447 #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr))
mbed_official 3:7a284390b0ce 448 #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr))
mbed_official 5:3762170b6d4d 449 #define __SIMD64(addr) (*(int64_t **) & (addr))
mbed_official 3:7a284390b0ce 450
mbed_official 3:7a284390b0ce 451 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
emilmont 1:fdd22bb7aa52 452 /**
emilmont 1:fdd22bb7aa52 453 * @brief definition to pack two 16 bit values.
emilmont 1:fdd22bb7aa52 454 */
emilmont 1:fdd22bb7aa52 455 #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \
emilmont 1:fdd22bb7aa52 456 (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) )
emilmont 1:fdd22bb7aa52 457 #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \
emilmont 1:fdd22bb7aa52 458 (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) )
emilmont 1:fdd22bb7aa52 459
emilmont 1:fdd22bb7aa52 460 #endif
emilmont 1:fdd22bb7aa52 461
emilmont 1:fdd22bb7aa52 462
emilmont 1:fdd22bb7aa52 463 /**
emilmont 1:fdd22bb7aa52 464 * @brief definition to pack four 8 bit values.
emilmont 1:fdd22bb7aa52 465 */
emilmont 1:fdd22bb7aa52 466 #ifndef ARM_MATH_BIG_ENDIAN
emilmont 1:fdd22bb7aa52 467
mbed_official 5:3762170b6d4d 468 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \
mbed_official 5:3762170b6d4d 469 (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \
mbed_official 5:3762170b6d4d 470 (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \
mbed_official 5:3762170b6d4d 471 (((int32_t)(v3) << 24) & (int32_t)0xFF000000) )
emilmont 1:fdd22bb7aa52 472 #else
emilmont 1:fdd22bb7aa52 473
mbed_official 5:3762170b6d4d 474 #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \
mbed_official 5:3762170b6d4d 475 (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \
mbed_official 5:3762170b6d4d 476 (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \
mbed_official 5:3762170b6d4d 477 (((int32_t)(v0) << 24) & (int32_t)0xFF000000) )
emilmont 1:fdd22bb7aa52 478
emilmont 1:fdd22bb7aa52 479 #endif
emilmont 1:fdd22bb7aa52 480
emilmont 1:fdd22bb7aa52 481
emilmont 1:fdd22bb7aa52 482 /**
emilmont 1:fdd22bb7aa52 483 * @brief Clips Q63 to Q31 values.
emilmont 1:fdd22bb7aa52 484 */
mbed_official 3:7a284390b0ce 485 static __INLINE q31_t clip_q63_to_q31(
emilmont 1:fdd22bb7aa52 486 q63_t x)
emilmont 1:fdd22bb7aa52 487 {
emilmont 1:fdd22bb7aa52 488 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
emilmont 1:fdd22bb7aa52 489 ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x;
emilmont 1:fdd22bb7aa52 490 }
emilmont 1:fdd22bb7aa52 491
emilmont 1:fdd22bb7aa52 492 /**
emilmont 1:fdd22bb7aa52 493 * @brief Clips Q63 to Q15 values.
emilmont 1:fdd22bb7aa52 494 */
mbed_official 3:7a284390b0ce 495 static __INLINE q15_t clip_q63_to_q15(
emilmont 1:fdd22bb7aa52 496 q63_t x)
emilmont 1:fdd22bb7aa52 497 {
emilmont 1:fdd22bb7aa52 498 return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ?
emilmont 1:fdd22bb7aa52 499 ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15);
emilmont 1:fdd22bb7aa52 500 }
emilmont 1:fdd22bb7aa52 501
emilmont 1:fdd22bb7aa52 502 /**
emilmont 1:fdd22bb7aa52 503 * @brief Clips Q31 to Q7 values.
emilmont 1:fdd22bb7aa52 504 */
mbed_official 3:7a284390b0ce 505 static __INLINE q7_t clip_q31_to_q7(
emilmont 1:fdd22bb7aa52 506 q31_t x)
emilmont 1:fdd22bb7aa52 507 {
emilmont 1:fdd22bb7aa52 508 return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ?
emilmont 1:fdd22bb7aa52 509 ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x;
emilmont 1:fdd22bb7aa52 510 }
emilmont 1:fdd22bb7aa52 511
emilmont 1:fdd22bb7aa52 512 /**
emilmont 1:fdd22bb7aa52 513 * @brief Clips Q31 to Q15 values.
emilmont 1:fdd22bb7aa52 514 */
mbed_official 3:7a284390b0ce 515 static __INLINE q15_t clip_q31_to_q15(
emilmont 1:fdd22bb7aa52 516 q31_t x)
emilmont 1:fdd22bb7aa52 517 {
emilmont 1:fdd22bb7aa52 518 return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ?
emilmont 1:fdd22bb7aa52 519 ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x;
emilmont 1:fdd22bb7aa52 520 }
emilmont 1:fdd22bb7aa52 521
emilmont 1:fdd22bb7aa52 522 /**
emilmont 1:fdd22bb7aa52 523 * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format.
emilmont 1:fdd22bb7aa52 524 */
emilmont 1:fdd22bb7aa52 525
mbed_official 3:7a284390b0ce 526 static __INLINE q63_t mult32x64(
emilmont 1:fdd22bb7aa52 527 q63_t x,
emilmont 1:fdd22bb7aa52 528 q31_t y)
emilmont 1:fdd22bb7aa52 529 {
emilmont 1:fdd22bb7aa52 530 return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) +
emilmont 1:fdd22bb7aa52 531 (((q63_t) (x >> 32) * y)));
emilmont 1:fdd22bb7aa52 532 }
emilmont 1:fdd22bb7aa52 533
mbed_official 5:3762170b6d4d 534 /*
mbed_official 5:3762170b6d4d 535 #if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM )
mbed_official 5:3762170b6d4d 536 #define __CLZ __clz
mbed_official 5:3762170b6d4d 537 #endif
mbed_official 5:3762170b6d4d 538 */
mbed_official 5:3762170b6d4d 539 /* note: function can be removed when all toolchain support __CLZ for Cortex-M0 */
mbed_official 5:3762170b6d4d 540 #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) )
mbed_official 3:7a284390b0ce 541 static __INLINE uint32_t __CLZ(
mbed_official 3:7a284390b0ce 542 q31_t data);
mbed_official 3:7a284390b0ce 543
mbed_official 3:7a284390b0ce 544 static __INLINE uint32_t __CLZ(
mbed_official 3:7a284390b0ce 545 q31_t data)
emilmont 1:fdd22bb7aa52 546 {
emilmont 1:fdd22bb7aa52 547 uint32_t count = 0;
emilmont 1:fdd22bb7aa52 548 uint32_t mask = 0x80000000;
emilmont 1:fdd22bb7aa52 549
emilmont 1:fdd22bb7aa52 550 while((data & mask) == 0)
emilmont 1:fdd22bb7aa52 551 {
emilmont 1:fdd22bb7aa52 552 count += 1u;
emilmont 1:fdd22bb7aa52 553 mask = mask >> 1u;
emilmont 1:fdd22bb7aa52 554 }
emilmont 1:fdd22bb7aa52 555
emilmont 1:fdd22bb7aa52 556 return (count);
emilmont 1:fdd22bb7aa52 557 }
emilmont 1:fdd22bb7aa52 558 #endif
emilmont 1:fdd22bb7aa52 559
emilmont 1:fdd22bb7aa52 560 /**
mbed_official 3:7a284390b0ce 561 * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type.
mbed_official 3:7a284390b0ce 562 */
mbed_official 3:7a284390b0ce 563
mbed_official 3:7a284390b0ce 564 static __INLINE uint32_t arm_recip_q31(
emilmont 1:fdd22bb7aa52 565 q31_t in,
emilmont 1:fdd22bb7aa52 566 q31_t * dst,
emilmont 1:fdd22bb7aa52 567 q31_t * pRecipTable)
emilmont 1:fdd22bb7aa52 568 {
mbed_official 5:3762170b6d4d 569 q31_t out;
mbed_official 5:3762170b6d4d 570 uint32_t tempVal;
emilmont 1:fdd22bb7aa52 571 uint32_t index, i;
emilmont 1:fdd22bb7aa52 572 uint32_t signBits;
emilmont 1:fdd22bb7aa52 573
emilmont 1:fdd22bb7aa52 574 if(in > 0)
emilmont 1:fdd22bb7aa52 575 {
mbed_official 5:3762170b6d4d 576 signBits = ((uint32_t) (__CLZ( in) - 1));
emilmont 1:fdd22bb7aa52 577 }
emilmont 1:fdd22bb7aa52 578 else
emilmont 1:fdd22bb7aa52 579 {
mbed_official 5:3762170b6d4d 580 signBits = ((uint32_t) (__CLZ(-in) - 1));
emilmont 1:fdd22bb7aa52 581 }
emilmont 1:fdd22bb7aa52 582
emilmont 1:fdd22bb7aa52 583 /* Convert input sample to 1.31 format */
mbed_official 5:3762170b6d4d 584 in = (in << signBits);
emilmont 1:fdd22bb7aa52 585
emilmont 1:fdd22bb7aa52 586 /* calculation of index for initial approximated Val */
mbed_official 5:3762170b6d4d 587 index = (uint32_t)(in >> 24);
emilmont 1:fdd22bb7aa52 588 index = (index & INDEX_MASK);
emilmont 1:fdd22bb7aa52 589
emilmont 1:fdd22bb7aa52 590 /* 1.31 with exp 1 */
emilmont 1:fdd22bb7aa52 591 out = pRecipTable[index];
emilmont 1:fdd22bb7aa52 592
emilmont 1:fdd22bb7aa52 593 /* calculation of reciprocal value */
emilmont 1:fdd22bb7aa52 594 /* running approximation for two iterations */
emilmont 1:fdd22bb7aa52 595 for (i = 0u; i < 2u; i++)
emilmont 1:fdd22bb7aa52 596 {
mbed_official 5:3762170b6d4d 597 tempVal = (uint32_t) (((q63_t) in * out) >> 31);
mbed_official 5:3762170b6d4d 598 tempVal = 0x7FFFFFFFu - tempVal;
emilmont 1:fdd22bb7aa52 599 /* 1.31 with exp 1 */
mbed_official 5:3762170b6d4d 600 /* out = (q31_t) (((q63_t) out * tempVal) >> 30); */
mbed_official 5:3762170b6d4d 601 out = clip_q63_to_q31(((q63_t) out * tempVal) >> 30);
emilmont 1:fdd22bb7aa52 602 }
emilmont 1:fdd22bb7aa52 603
emilmont 1:fdd22bb7aa52 604 /* write output */
emilmont 1:fdd22bb7aa52 605 *dst = out;
emilmont 1:fdd22bb7aa52 606
emilmont 1:fdd22bb7aa52 607 /* return num of signbits of out = 1/in value */
emilmont 1:fdd22bb7aa52 608 return (signBits + 1u);
emilmont 1:fdd22bb7aa52 609 }
emilmont 1:fdd22bb7aa52 610
mbed_official 5:3762170b6d4d 611
emilmont 1:fdd22bb7aa52 612 /**
mbed_official 3:7a284390b0ce 613 * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type.
mbed_official 3:7a284390b0ce 614 */
mbed_official 3:7a284390b0ce 615 static __INLINE uint32_t arm_recip_q15(
emilmont 1:fdd22bb7aa52 616 q15_t in,
emilmont 1:fdd22bb7aa52 617 q15_t * dst,
emilmont 1:fdd22bb7aa52 618 q15_t * pRecipTable)
emilmont 1:fdd22bb7aa52 619 {
mbed_official 5:3762170b6d4d 620 q15_t out = 0;
mbed_official 5:3762170b6d4d 621 uint32_t tempVal = 0;
emilmont 1:fdd22bb7aa52 622 uint32_t index = 0, i = 0;
emilmont 1:fdd22bb7aa52 623 uint32_t signBits = 0;
emilmont 1:fdd22bb7aa52 624
emilmont 1:fdd22bb7aa52 625 if(in > 0)
emilmont 1:fdd22bb7aa52 626 {
mbed_official 5:3762170b6d4d 627 signBits = ((uint32_t)(__CLZ( in) - 17));
emilmont 1:fdd22bb7aa52 628 }
emilmont 1:fdd22bb7aa52 629 else
emilmont 1:fdd22bb7aa52 630 {
mbed_official 5:3762170b6d4d 631 signBits = ((uint32_t)(__CLZ(-in) - 17));
emilmont 1:fdd22bb7aa52 632 }
emilmont 1:fdd22bb7aa52 633
emilmont 1:fdd22bb7aa52 634 /* Convert input sample to 1.15 format */
mbed_official 5:3762170b6d4d 635 in = (in << signBits);
emilmont 1:fdd22bb7aa52 636
emilmont 1:fdd22bb7aa52 637 /* calculation of index for initial approximated Val */
mbed_official 5:3762170b6d4d 638 index = (uint32_t)(in >> 8);
emilmont 1:fdd22bb7aa52 639 index = (index & INDEX_MASK);
emilmont 1:fdd22bb7aa52 640
emilmont 1:fdd22bb7aa52 641 /* 1.15 with exp 1 */
emilmont 1:fdd22bb7aa52 642 out = pRecipTable[index];
emilmont 1:fdd22bb7aa52 643
emilmont 1:fdd22bb7aa52 644 /* calculation of reciprocal value */
emilmont 1:fdd22bb7aa52 645 /* running approximation for two iterations */
mbed_official 5:3762170b6d4d 646 for (i = 0u; i < 2u; i++)
emilmont 1:fdd22bb7aa52 647 {
mbed_official 5:3762170b6d4d 648 tempVal = (uint32_t) (((q31_t) in * out) >> 15);
mbed_official 5:3762170b6d4d 649 tempVal = 0x7FFFu - tempVal;
emilmont 1:fdd22bb7aa52 650 /* 1.15 with exp 1 */
emilmont 1:fdd22bb7aa52 651 out = (q15_t) (((q31_t) out * tempVal) >> 14);
mbed_official 5:3762170b6d4d 652 /* out = clip_q31_to_q15(((q31_t) out * tempVal) >> 14); */
emilmont 1:fdd22bb7aa52 653 }
emilmont 1:fdd22bb7aa52 654
emilmont 1:fdd22bb7aa52 655 /* write output */
emilmont 1:fdd22bb7aa52 656 *dst = out;
emilmont 1:fdd22bb7aa52 657
emilmont 1:fdd22bb7aa52 658 /* return num of signbits of out = 1/in value */
emilmont 1:fdd22bb7aa52 659 return (signBits + 1);
emilmont 1:fdd22bb7aa52 660 }
emilmont 1:fdd22bb7aa52 661
emilmont 1:fdd22bb7aa52 662
emilmont 1:fdd22bb7aa52 663 /*
emilmont 1:fdd22bb7aa52 664 * @brief C custom defined intrinisic function for only M0 processors
emilmont 1:fdd22bb7aa52 665 */
mbed_official 3:7a284390b0ce 666 #if defined(ARM_MATH_CM0_FAMILY)
mbed_official 3:7a284390b0ce 667 static __INLINE q31_t __SSAT(
emilmont 1:fdd22bb7aa52 668 q31_t x,
emilmont 1:fdd22bb7aa52 669 uint32_t y)
emilmont 1:fdd22bb7aa52 670 {
emilmont 1:fdd22bb7aa52 671 int32_t posMax, negMin;
emilmont 1:fdd22bb7aa52 672 uint32_t i;
emilmont 1:fdd22bb7aa52 673
emilmont 1:fdd22bb7aa52 674 posMax = 1;
emilmont 1:fdd22bb7aa52 675 for (i = 0; i < (y - 1); i++)
emilmont 1:fdd22bb7aa52 676 {
emilmont 1:fdd22bb7aa52 677 posMax = posMax * 2;
emilmont 1:fdd22bb7aa52 678 }
emilmont 1:fdd22bb7aa52 679
emilmont 1:fdd22bb7aa52 680 if(x > 0)
emilmont 1:fdd22bb7aa52 681 {
emilmont 1:fdd22bb7aa52 682 posMax = (posMax - 1);
emilmont 1:fdd22bb7aa52 683
emilmont 1:fdd22bb7aa52 684 if(x > posMax)
emilmont 1:fdd22bb7aa52 685 {
emilmont 1:fdd22bb7aa52 686 x = posMax;
emilmont 1:fdd22bb7aa52 687 }
emilmont 1:fdd22bb7aa52 688 }
emilmont 1:fdd22bb7aa52 689 else
emilmont 1:fdd22bb7aa52 690 {
emilmont 1:fdd22bb7aa52 691 negMin = -posMax;
emilmont 1:fdd22bb7aa52 692
emilmont 1:fdd22bb7aa52 693 if(x < negMin)
emilmont 1:fdd22bb7aa52 694 {
emilmont 1:fdd22bb7aa52 695 x = negMin;
emilmont 1:fdd22bb7aa52 696 }
emilmont 1:fdd22bb7aa52 697 }
emilmont 1:fdd22bb7aa52 698 return (x);
emilmont 1:fdd22bb7aa52 699 }
mbed_official 3:7a284390b0ce 700 #endif /* end of ARM_MATH_CM0_FAMILY */
emilmont 1:fdd22bb7aa52 701
emilmont 1:fdd22bb7aa52 702
emilmont 1:fdd22bb7aa52 703 /*
emilmont 1:fdd22bb7aa52 704 * @brief C custom defined intrinsic function for M3 and M0 processors
emilmont 1:fdd22bb7aa52 705 */
mbed_official 3:7a284390b0ce 706 #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY)
emilmont 1:fdd22bb7aa52 707
emilmont 1:fdd22bb7aa52 708 /*
emilmont 1:fdd22bb7aa52 709 * @brief C custom defined QADD8 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 710 */
mbed_official 5:3762170b6d4d 711 static __INLINE uint32_t __QADD8(
mbed_official 5:3762170b6d4d 712 uint32_t x,
mbed_official 5:3762170b6d4d 713 uint32_t y)
emilmont 1:fdd22bb7aa52 714 {
mbed_official 5:3762170b6d4d 715 q31_t r, s, t, u;
mbed_official 5:3762170b6d4d 716
mbed_official 5:3762170b6d4d 717 r = __SSAT(((((q31_t)x << 24) >> 24) + (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 718 s = __SSAT(((((q31_t)x << 16) >> 24) + (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 719 t = __SSAT(((((q31_t)x << 8) >> 24) + (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 720 u = __SSAT(((((q31_t)x ) >> 24) + (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 721
mbed_official 5:3762170b6d4d 722 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
emilmont 1:fdd22bb7aa52 723 }
emilmont 1:fdd22bb7aa52 724
mbed_official 5:3762170b6d4d 725
emilmont 1:fdd22bb7aa52 726 /*
emilmont 1:fdd22bb7aa52 727 * @brief C custom defined QSUB8 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 728 */
mbed_official 5:3762170b6d4d 729 static __INLINE uint32_t __QSUB8(
mbed_official 5:3762170b6d4d 730 uint32_t x,
mbed_official 5:3762170b6d4d 731 uint32_t y)
emilmont 1:fdd22bb7aa52 732 {
emilmont 1:fdd22bb7aa52 733 q31_t r, s, t, u;
emilmont 1:fdd22bb7aa52 734
mbed_official 5:3762170b6d4d 735 r = __SSAT(((((q31_t)x << 24) >> 24) - (((q31_t)y << 24) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 736 s = __SSAT(((((q31_t)x << 16) >> 24) - (((q31_t)y << 16) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 737 t = __SSAT(((((q31_t)x << 8) >> 24) - (((q31_t)y << 8) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 738 u = __SSAT(((((q31_t)x ) >> 24) - (((q31_t)y ) >> 24)), 8) & (int32_t)0x000000FF;
mbed_official 5:3762170b6d4d 739
mbed_official 5:3762170b6d4d 740 return ((uint32_t)((u << 24) | (t << 16) | (s << 8) | (r )));
emilmont 1:fdd22bb7aa52 741 }
emilmont 1:fdd22bb7aa52 742
mbed_official 5:3762170b6d4d 743
emilmont 1:fdd22bb7aa52 744 /*
emilmont 1:fdd22bb7aa52 745 * @brief C custom defined QADD16 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 746 */
mbed_official 5:3762170b6d4d 747 static __INLINE uint32_t __QADD16(
mbed_official 5:3762170b6d4d 748 uint32_t x,
mbed_official 5:3762170b6d4d 749 uint32_t y)
emilmont 1:fdd22bb7aa52 750 {
mbed_official 5:3762170b6d4d 751 /* q31_t r, s; without initialisation 'arm_offset_q15 test' fails but 'intrinsic' tests pass! for armCC */
mbed_official 5:3762170b6d4d 752 q31_t r = 0, s = 0;
mbed_official 5:3762170b6d4d 753
mbed_official 5:3762170b6d4d 754 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 755 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 756
mbed_official 5:3762170b6d4d 757 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 758 }
emilmont 1:fdd22bb7aa52 759
mbed_official 5:3762170b6d4d 760
emilmont 1:fdd22bb7aa52 761 /*
emilmont 1:fdd22bb7aa52 762 * @brief C custom defined SHADD16 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 763 */
mbed_official 5:3762170b6d4d 764 static __INLINE uint32_t __SHADD16(
mbed_official 5:3762170b6d4d 765 uint32_t x,
mbed_official 5:3762170b6d4d 766 uint32_t y)
emilmont 1:fdd22bb7aa52 767 {
emilmont 1:fdd22bb7aa52 768 q31_t r, s;
emilmont 1:fdd22bb7aa52 769
mbed_official 5:3762170b6d4d 770 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 771 s = (((((q31_t)x ) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 772
mbed_official 5:3762170b6d4d 773 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 774 }
emilmont 1:fdd22bb7aa52 775
mbed_official 5:3762170b6d4d 776
emilmont 1:fdd22bb7aa52 777 /*
emilmont 1:fdd22bb7aa52 778 * @brief C custom defined QSUB16 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 779 */
mbed_official 5:3762170b6d4d 780 static __INLINE uint32_t __QSUB16(
mbed_official 5:3762170b6d4d 781 uint32_t x,
mbed_official 5:3762170b6d4d 782 uint32_t y)
emilmont 1:fdd22bb7aa52 783 {
emilmont 1:fdd22bb7aa52 784 q31_t r, s;
emilmont 1:fdd22bb7aa52 785
mbed_official 5:3762170b6d4d 786 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 787 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 788
mbed_official 5:3762170b6d4d 789 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 790 }
emilmont 1:fdd22bb7aa52 791
mbed_official 5:3762170b6d4d 792
emilmont 1:fdd22bb7aa52 793 /*
emilmont 1:fdd22bb7aa52 794 * @brief C custom defined SHSUB16 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 795 */
mbed_official 5:3762170b6d4d 796 static __INLINE uint32_t __SHSUB16(
mbed_official 5:3762170b6d4d 797 uint32_t x,
mbed_official 5:3762170b6d4d 798 uint32_t y)
emilmont 1:fdd22bb7aa52 799 {
emilmont 1:fdd22bb7aa52 800 q31_t r, s;
emilmont 1:fdd22bb7aa52 801
mbed_official 5:3762170b6d4d 802 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 803 s = (((((q31_t)x ) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 804
mbed_official 5:3762170b6d4d 805 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 806 }
emilmont 1:fdd22bb7aa52 807
mbed_official 5:3762170b6d4d 808
emilmont 1:fdd22bb7aa52 809 /*
emilmont 1:fdd22bb7aa52 810 * @brief C custom defined QASX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 811 */
mbed_official 5:3762170b6d4d 812 static __INLINE uint32_t __QASX(
mbed_official 5:3762170b6d4d 813 uint32_t x,
mbed_official 5:3762170b6d4d 814 uint32_t y)
emilmont 1:fdd22bb7aa52 815 {
mbed_official 5:3762170b6d4d 816 q31_t r, s;
mbed_official 5:3762170b6d4d 817
mbed_official 5:3762170b6d4d 818 r = __SSAT(((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 819 s = __SSAT(((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 820
mbed_official 5:3762170b6d4d 821 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 822 }
emilmont 1:fdd22bb7aa52 823
mbed_official 5:3762170b6d4d 824
emilmont 1:fdd22bb7aa52 825 /*
emilmont 1:fdd22bb7aa52 826 * @brief C custom defined SHASX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 827 */
mbed_official 5:3762170b6d4d 828 static __INLINE uint32_t __SHASX(
mbed_official 5:3762170b6d4d 829 uint32_t x,
mbed_official 5:3762170b6d4d 830 uint32_t y)
emilmont 1:fdd22bb7aa52 831 {
emilmont 1:fdd22bb7aa52 832 q31_t r, s;
emilmont 1:fdd22bb7aa52 833
mbed_official 5:3762170b6d4d 834 r = (((((q31_t)x << 16) >> 16) - (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 835 s = (((((q31_t)x ) >> 16) + (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 836
mbed_official 5:3762170b6d4d 837 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 838 }
emilmont 1:fdd22bb7aa52 839
emilmont 1:fdd22bb7aa52 840
emilmont 1:fdd22bb7aa52 841 /*
emilmont 1:fdd22bb7aa52 842 * @brief C custom defined QSAX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 843 */
mbed_official 5:3762170b6d4d 844 static __INLINE uint32_t __QSAX(
mbed_official 5:3762170b6d4d 845 uint32_t x,
mbed_official 5:3762170b6d4d 846 uint32_t y)
emilmont 1:fdd22bb7aa52 847 {
mbed_official 5:3762170b6d4d 848 q31_t r, s;
mbed_official 5:3762170b6d4d 849
mbed_official 5:3762170b6d4d 850 r = __SSAT(((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 851 s = __SSAT(((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)), 16) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 852
mbed_official 5:3762170b6d4d 853 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 854 }
emilmont 1:fdd22bb7aa52 855
mbed_official 5:3762170b6d4d 856
emilmont 1:fdd22bb7aa52 857 /*
emilmont 1:fdd22bb7aa52 858 * @brief C custom defined SHSAX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 859 */
mbed_official 5:3762170b6d4d 860 static __INLINE uint32_t __SHSAX(
mbed_official 5:3762170b6d4d 861 uint32_t x,
mbed_official 5:3762170b6d4d 862 uint32_t y)
emilmont 1:fdd22bb7aa52 863 {
emilmont 1:fdd22bb7aa52 864 q31_t r, s;
emilmont 1:fdd22bb7aa52 865
mbed_official 5:3762170b6d4d 866 r = (((((q31_t)x << 16) >> 16) + (((q31_t)y ) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 867 s = (((((q31_t)x ) >> 16) - (((q31_t)y << 16) >> 16)) >> 1) & (int32_t)0x0000FFFF;
mbed_official 5:3762170b6d4d 868
mbed_official 5:3762170b6d4d 869 return ((uint32_t)((s << 16) | (r )));
emilmont 1:fdd22bb7aa52 870 }
emilmont 1:fdd22bb7aa52 871
mbed_official 5:3762170b6d4d 872
emilmont 1:fdd22bb7aa52 873 /*
emilmont 1:fdd22bb7aa52 874 * @brief C custom defined SMUSDX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 875 */
mbed_official 5:3762170b6d4d 876 static __INLINE uint32_t __SMUSDX(
mbed_official 5:3762170b6d4d 877 uint32_t x,
mbed_official 5:3762170b6d4d 878 uint32_t y)
emilmont 1:fdd22bb7aa52 879 {
mbed_official 5:3762170b6d4d 880 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
mbed_official 5:3762170b6d4d 881 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
emilmont 1:fdd22bb7aa52 882 }
emilmont 1:fdd22bb7aa52 883
emilmont 1:fdd22bb7aa52 884 /*
emilmont 1:fdd22bb7aa52 885 * @brief C custom defined SMUADX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 886 */
mbed_official 5:3762170b6d4d 887 static __INLINE uint32_t __SMUADX(
mbed_official 5:3762170b6d4d 888 uint32_t x,
mbed_official 5:3762170b6d4d 889 uint32_t y)
emilmont 1:fdd22bb7aa52 890 {
mbed_official 5:3762170b6d4d 891 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
mbed_official 5:3762170b6d4d 892 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) ));
emilmont 1:fdd22bb7aa52 893 }
emilmont 1:fdd22bb7aa52 894
mbed_official 5:3762170b6d4d 895
emilmont 1:fdd22bb7aa52 896 /*
emilmont 1:fdd22bb7aa52 897 * @brief C custom defined QADD for M3 and M0 processors
emilmont 1:fdd22bb7aa52 898 */
mbed_official 5:3762170b6d4d 899 static __INLINE int32_t __QADD(
mbed_official 5:3762170b6d4d 900 int32_t x,
mbed_official 5:3762170b6d4d 901 int32_t y)
emilmont 1:fdd22bb7aa52 902 {
mbed_official 5:3762170b6d4d 903 return ((int32_t)(clip_q63_to_q31((q63_t)x + (q31_t)y)));
emilmont 1:fdd22bb7aa52 904 }
emilmont 1:fdd22bb7aa52 905
mbed_official 5:3762170b6d4d 906
emilmont 1:fdd22bb7aa52 907 /*
emilmont 1:fdd22bb7aa52 908 * @brief C custom defined QSUB for M3 and M0 processors
emilmont 1:fdd22bb7aa52 909 */
mbed_official 5:3762170b6d4d 910 static __INLINE int32_t __QSUB(
mbed_official 5:3762170b6d4d 911 int32_t x,
mbed_official 5:3762170b6d4d 912 int32_t y)
emilmont 1:fdd22bb7aa52 913 {
mbed_official 5:3762170b6d4d 914 return ((int32_t)(clip_q63_to_q31((q63_t)x - (q31_t)y)));
emilmont 1:fdd22bb7aa52 915 }
emilmont 1:fdd22bb7aa52 916
mbed_official 5:3762170b6d4d 917
emilmont 1:fdd22bb7aa52 918 /*
emilmont 1:fdd22bb7aa52 919 * @brief C custom defined SMLAD for M3 and M0 processors
emilmont 1:fdd22bb7aa52 920 */
mbed_official 5:3762170b6d4d 921 static __INLINE uint32_t __SMLAD(
mbed_official 5:3762170b6d4d 922 uint32_t x,
mbed_official 5:3762170b6d4d 923 uint32_t y,
mbed_official 5:3762170b6d4d 924 uint32_t sum)
emilmont 1:fdd22bb7aa52 925 {
mbed_official 5:3762170b6d4d 926 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 927 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
mbed_official 5:3762170b6d4d 928 ( ((q31_t)sum ) ) ));
emilmont 1:fdd22bb7aa52 929 }
emilmont 1:fdd22bb7aa52 930
mbed_official 5:3762170b6d4d 931
emilmont 1:fdd22bb7aa52 932 /*
emilmont 1:fdd22bb7aa52 933 * @brief C custom defined SMLADX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 934 */
mbed_official 5:3762170b6d4d 935 static __INLINE uint32_t __SMLADX(
mbed_official 5:3762170b6d4d 936 uint32_t x,
mbed_official 5:3762170b6d4d 937 uint32_t y,
mbed_official 5:3762170b6d4d 938 uint32_t sum)
emilmont 1:fdd22bb7aa52 939 {
mbed_official 5:3762170b6d4d 940 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
mbed_official 5:3762170b6d4d 941 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 942 ( ((q31_t)sum ) ) ));
emilmont 1:fdd22bb7aa52 943 }
emilmont 1:fdd22bb7aa52 944
mbed_official 5:3762170b6d4d 945
emilmont 1:fdd22bb7aa52 946 /*
emilmont 1:fdd22bb7aa52 947 * @brief C custom defined SMLSDX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 948 */
mbed_official 5:3762170b6d4d 949 static __INLINE uint32_t __SMLSDX(
mbed_official 5:3762170b6d4d 950 uint32_t x,
mbed_official 5:3762170b6d4d 951 uint32_t y,
mbed_official 5:3762170b6d4d 952 uint32_t sum)
emilmont 1:fdd22bb7aa52 953 {
mbed_official 5:3762170b6d4d 954 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) -
mbed_official 5:3762170b6d4d 955 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 956 ( ((q31_t)sum ) ) ));
emilmont 1:fdd22bb7aa52 957 }
emilmont 1:fdd22bb7aa52 958
mbed_official 5:3762170b6d4d 959
emilmont 1:fdd22bb7aa52 960 /*
emilmont 1:fdd22bb7aa52 961 * @brief C custom defined SMLALD for M3 and M0 processors
emilmont 1:fdd22bb7aa52 962 */
mbed_official 5:3762170b6d4d 963 static __INLINE uint64_t __SMLALD(
mbed_official 5:3762170b6d4d 964 uint32_t x,
mbed_official 5:3762170b6d4d 965 uint32_t y,
mbed_official 5:3762170b6d4d 966 uint64_t sum)
emilmont 1:fdd22bb7aa52 967 {
mbed_official 5:3762170b6d4d 968 /* return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + ((q15_t) x * (q15_t) y)); */
mbed_official 5:3762170b6d4d 969 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 970 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) +
mbed_official 5:3762170b6d4d 971 ( ((q63_t)sum ) ) ));
emilmont 1:fdd22bb7aa52 972 }
emilmont 1:fdd22bb7aa52 973
mbed_official 5:3762170b6d4d 974
emilmont 1:fdd22bb7aa52 975 /*
emilmont 1:fdd22bb7aa52 976 * @brief C custom defined SMLALDX for M3 and M0 processors
emilmont 1:fdd22bb7aa52 977 */
mbed_official 5:3762170b6d4d 978 static __INLINE uint64_t __SMLALDX(
mbed_official 5:3762170b6d4d 979 uint32_t x,
mbed_official 5:3762170b6d4d 980 uint32_t y,
mbed_official 5:3762170b6d4d 981 uint64_t sum)
emilmont 1:fdd22bb7aa52 982 {
mbed_official 5:3762170b6d4d 983 /* return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + ((q15_t) x * (q15_t) (y >> 16)); */
mbed_official 5:3762170b6d4d 984 return ((uint64_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y ) >> 16)) +
mbed_official 5:3762170b6d4d 985 ((((q31_t)x ) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 986 ( ((q63_t)sum ) ) ));
emilmont 1:fdd22bb7aa52 987 }
emilmont 1:fdd22bb7aa52 988
mbed_official 5:3762170b6d4d 989
emilmont 1:fdd22bb7aa52 990 /*
emilmont 1:fdd22bb7aa52 991 * @brief C custom defined SMUAD for M3 and M0 processors
emilmont 1:fdd22bb7aa52 992 */
mbed_official 5:3762170b6d4d 993 static __INLINE uint32_t __SMUAD(
mbed_official 5:3762170b6d4d 994 uint32_t x,
mbed_official 5:3762170b6d4d 995 uint32_t y)
emilmont 1:fdd22bb7aa52 996 {
mbed_official 5:3762170b6d4d 997 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) +
mbed_official 5:3762170b6d4d 998 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
emilmont 1:fdd22bb7aa52 999 }
emilmont 1:fdd22bb7aa52 1000
mbed_official 5:3762170b6d4d 1001
emilmont 1:fdd22bb7aa52 1002 /*
emilmont 1:fdd22bb7aa52 1003 * @brief C custom defined SMUSD for M3 and M0 processors
emilmont 1:fdd22bb7aa52 1004 */
mbed_official 5:3762170b6d4d 1005 static __INLINE uint32_t __SMUSD(
mbed_official 5:3762170b6d4d 1006 uint32_t x,
mbed_official 5:3762170b6d4d 1007 uint32_t y)
emilmont 1:fdd22bb7aa52 1008 {
mbed_official 5:3762170b6d4d 1009 return ((uint32_t)(((((q31_t)x << 16) >> 16) * (((q31_t)y << 16) >> 16)) -
mbed_official 5:3762170b6d4d 1010 ((((q31_t)x ) >> 16) * (((q31_t)y ) >> 16)) ));
emilmont 1:fdd22bb7aa52 1011 }
emilmont 1:fdd22bb7aa52 1012
emilmont 1:fdd22bb7aa52 1013
emilmont 1:fdd22bb7aa52 1014 /*
emilmont 1:fdd22bb7aa52 1015 * @brief C custom defined SXTB16 for M3 and M0 processors
emilmont 1:fdd22bb7aa52 1016 */
mbed_official 5:3762170b6d4d 1017 static __INLINE uint32_t __SXTB16(
mbed_official 5:3762170b6d4d 1018 uint32_t x)
emilmont 1:fdd22bb7aa52 1019 {
mbed_official 5:3762170b6d4d 1020 return ((uint32_t)(((((q31_t)x << 24) >> 24) & (q31_t)0x0000FFFF) |
mbed_official 5:3762170b6d4d 1021 ((((q31_t)x << 8) >> 8) & (q31_t)0xFFFF0000) ));
emilmont 1:fdd22bb7aa52 1022 }
emilmont 1:fdd22bb7aa52 1023
mbed_official 3:7a284390b0ce 1024 #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */
emilmont 1:fdd22bb7aa52 1025
emilmont 1:fdd22bb7aa52 1026
emilmont 1:fdd22bb7aa52 1027 /**
emilmont 1:fdd22bb7aa52 1028 * @brief Instance structure for the Q7 FIR filter.
emilmont 1:fdd22bb7aa52 1029 */
emilmont 1:fdd22bb7aa52 1030 typedef struct
emilmont 1:fdd22bb7aa52 1031 {
emilmont 1:fdd22bb7aa52 1032 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emilmont 1:fdd22bb7aa52 1033 q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emilmont 1:fdd22bb7aa52 1034 q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
emilmont 1:fdd22bb7aa52 1035 } arm_fir_instance_q7;
emilmont 1:fdd22bb7aa52 1036
emilmont 1:fdd22bb7aa52 1037 /**
emilmont 1:fdd22bb7aa52 1038 * @brief Instance structure for the Q15 FIR filter.
emilmont 1:fdd22bb7aa52 1039 */
emilmont 1:fdd22bb7aa52 1040 typedef struct
emilmont 1:fdd22bb7aa52 1041 {
emilmont 1:fdd22bb7aa52 1042 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emilmont 1:fdd22bb7aa52 1043 q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emilmont 1:fdd22bb7aa52 1044 q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/
emilmont 1:fdd22bb7aa52 1045 } arm_fir_instance_q15;
emilmont 1:fdd22bb7aa52 1046
emilmont 1:fdd22bb7aa52 1047 /**
emilmont 1:fdd22bb7aa52 1048 * @brief Instance structure for the Q31 FIR filter.
emilmont 1:fdd22bb7aa52 1049 */
emilmont 1:fdd22bb7aa52 1050 typedef struct
emilmont 1:fdd22bb7aa52 1051 {
emilmont 1:fdd22bb7aa52 1052 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emilmont 1:fdd22bb7aa52 1053 q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emilmont 1:fdd22bb7aa52 1054 q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
emilmont 1:fdd22bb7aa52 1055 } arm_fir_instance_q31;
emilmont 1:fdd22bb7aa52 1056
emilmont 1:fdd22bb7aa52 1057 /**
emilmont 1:fdd22bb7aa52 1058 * @brief Instance structure for the floating-point FIR filter.
emilmont 1:fdd22bb7aa52 1059 */
emilmont 1:fdd22bb7aa52 1060 typedef struct
emilmont 1:fdd22bb7aa52 1061 {
emilmont 1:fdd22bb7aa52 1062 uint16_t numTaps; /**< number of filter coefficients in the filter. */
emilmont 1:fdd22bb7aa52 1063 float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */
emilmont 1:fdd22bb7aa52 1064 float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */
emilmont 1:fdd22bb7aa52 1065 } arm_fir_instance_f32;
emilmont 1:fdd22bb7aa52 1066
emilmont 1:fdd22bb7aa52 1067
emilmont 1:fdd22bb7aa52 1068 /**
emilmont 1:fdd22bb7aa52 1069 * @brief Processing function for the Q7 FIR filter.
mbed_official 5:3762170b6d4d 1070 * @param[in] S points to an instance of the Q7 FIR filter structure.
mbed_official 5:3762170b6d4d 1071 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1072 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1073 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1074 */
emilmont 1:fdd22bb7aa52 1075 void arm_fir_q7(
emilmont 1:fdd22bb7aa52 1076 const arm_fir_instance_q7 * S,
emilmont 1:fdd22bb7aa52 1077 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 1078 q7_t * pDst,
emilmont 1:fdd22bb7aa52 1079 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1080
emilmont 1:fdd22bb7aa52 1081
emilmont 1:fdd22bb7aa52 1082 /**
emilmont 1:fdd22bb7aa52 1083 * @brief Initialization function for the Q7 FIR filter.
mbed_official 5:3762170b6d4d 1084 * @param[in,out] S points to an instance of the Q7 FIR structure.
mbed_official 5:3762170b6d4d 1085 * @param[in] numTaps Number of filter coefficients in the filter.
mbed_official 5:3762170b6d4d 1086 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1087 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1088 * @param[in] blockSize number of samples that are processed.
emilmont 1:fdd22bb7aa52 1089 */
emilmont 1:fdd22bb7aa52 1090 void arm_fir_init_q7(
emilmont 1:fdd22bb7aa52 1091 arm_fir_instance_q7 * S,
emilmont 1:fdd22bb7aa52 1092 uint16_t numTaps,
emilmont 1:fdd22bb7aa52 1093 q7_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1094 q7_t * pState,
emilmont 1:fdd22bb7aa52 1095 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1096
emilmont 1:fdd22bb7aa52 1097
emilmont 1:fdd22bb7aa52 1098 /**
emilmont 1:fdd22bb7aa52 1099 * @brief Processing function for the Q15 FIR filter.
mbed_official 5:3762170b6d4d 1100 * @param[in] S points to an instance of the Q15 FIR structure.
mbed_official 5:3762170b6d4d 1101 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1102 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1103 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1104 */
emilmont 1:fdd22bb7aa52 1105 void arm_fir_q15(
emilmont 1:fdd22bb7aa52 1106 const arm_fir_instance_q15 * S,
emilmont 1:fdd22bb7aa52 1107 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 1108 q15_t * pDst,
emilmont 1:fdd22bb7aa52 1109 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1110
mbed_official 5:3762170b6d4d 1111
emilmont 1:fdd22bb7aa52 1112 /**
emilmont 1:fdd22bb7aa52 1113 * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4.
mbed_official 5:3762170b6d4d 1114 * @param[in] S points to an instance of the Q15 FIR filter structure.
mbed_official 5:3762170b6d4d 1115 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1116 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1117 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1118 */
emilmont 1:fdd22bb7aa52 1119 void arm_fir_fast_q15(
emilmont 1:fdd22bb7aa52 1120 const arm_fir_instance_q15 * S,
emilmont 1:fdd22bb7aa52 1121 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 1122 q15_t * pDst,
emilmont 1:fdd22bb7aa52 1123 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1124
mbed_official 5:3762170b6d4d 1125
emilmont 1:fdd22bb7aa52 1126 /**
emilmont 1:fdd22bb7aa52 1127 * @brief Initialization function for the Q15 FIR filter.
mbed_official 5:3762170b6d4d 1128 * @param[in,out] S points to an instance of the Q15 FIR filter structure.
mbed_official 5:3762170b6d4d 1129 * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4.
mbed_official 5:3762170b6d4d 1130 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1131 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1132 * @param[in] blockSize number of samples that are processed at a time.
emilmont 1:fdd22bb7aa52 1133 * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if
emilmont 1:fdd22bb7aa52 1134 * <code>numTaps</code> is not a supported value.
emilmont 1:fdd22bb7aa52 1135 */
emilmont 1:fdd22bb7aa52 1136 arm_status arm_fir_init_q15(
emilmont 1:fdd22bb7aa52 1137 arm_fir_instance_q15 * S,
emilmont 1:fdd22bb7aa52 1138 uint16_t numTaps,
emilmont 1:fdd22bb7aa52 1139 q15_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1140 q15_t * pState,
emilmont 1:fdd22bb7aa52 1141 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1142
mbed_official 5:3762170b6d4d 1143
emilmont 1:fdd22bb7aa52 1144 /**
emilmont 1:fdd22bb7aa52 1145 * @brief Processing function for the Q31 FIR filter.
mbed_official 5:3762170b6d4d 1146 * @param[in] S points to an instance of the Q31 FIR filter structure.
mbed_official 5:3762170b6d4d 1147 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1148 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1149 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1150 */
emilmont 1:fdd22bb7aa52 1151 void arm_fir_q31(
emilmont 1:fdd22bb7aa52 1152 const arm_fir_instance_q31 * S,
emilmont 1:fdd22bb7aa52 1153 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 1154 q31_t * pDst,
emilmont 1:fdd22bb7aa52 1155 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1156
mbed_official 5:3762170b6d4d 1157
emilmont 1:fdd22bb7aa52 1158 /**
emilmont 1:fdd22bb7aa52 1159 * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4.
mbed_official 5:3762170b6d4d 1160 * @param[in] S points to an instance of the Q31 FIR structure.
mbed_official 5:3762170b6d4d 1161 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1162 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1163 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1164 */
emilmont 1:fdd22bb7aa52 1165 void arm_fir_fast_q31(
emilmont 1:fdd22bb7aa52 1166 const arm_fir_instance_q31 * S,
emilmont 1:fdd22bb7aa52 1167 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 1168 q31_t * pDst,
emilmont 1:fdd22bb7aa52 1169 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1170
mbed_official 5:3762170b6d4d 1171
emilmont 1:fdd22bb7aa52 1172 /**
emilmont 1:fdd22bb7aa52 1173 * @brief Initialization function for the Q31 FIR filter.
mbed_official 5:3762170b6d4d 1174 * @param[in,out] S points to an instance of the Q31 FIR structure.
mbed_official 5:3762170b6d4d 1175 * @param[in] numTaps Number of filter coefficients in the filter.
mbed_official 5:3762170b6d4d 1176 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1177 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1178 * @param[in] blockSize number of samples that are processed at a time.
emilmont 1:fdd22bb7aa52 1179 */
emilmont 1:fdd22bb7aa52 1180 void arm_fir_init_q31(
emilmont 1:fdd22bb7aa52 1181 arm_fir_instance_q31 * S,
emilmont 1:fdd22bb7aa52 1182 uint16_t numTaps,
emilmont 1:fdd22bb7aa52 1183 q31_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1184 q31_t * pState,
emilmont 1:fdd22bb7aa52 1185 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1186
mbed_official 5:3762170b6d4d 1187
emilmont 1:fdd22bb7aa52 1188 /**
emilmont 1:fdd22bb7aa52 1189 * @brief Processing function for the floating-point FIR filter.
mbed_official 5:3762170b6d4d 1190 * @param[in] S points to an instance of the floating-point FIR structure.
mbed_official 5:3762170b6d4d 1191 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1192 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1193 * @param[in] blockSize number of samples to process.
emilmont 1:fdd22bb7aa52 1194 */
emilmont 1:fdd22bb7aa52 1195 void arm_fir_f32(
emilmont 1:fdd22bb7aa52 1196 const arm_fir_instance_f32 * S,
emilmont 1:fdd22bb7aa52 1197 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 1198 float32_t * pDst,
emilmont 1:fdd22bb7aa52 1199 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1200
mbed_official 5:3762170b6d4d 1201
emilmont 1:fdd22bb7aa52 1202 /**
emilmont 1:fdd22bb7aa52 1203 * @brief Initialization function for the floating-point FIR filter.
mbed_official 5:3762170b6d4d 1204 * @param[in,out] S points to an instance of the floating-point FIR filter structure.
mbed_official 5:3762170b6d4d 1205 * @param[in] numTaps Number of filter coefficients in the filter.
mbed_official 5:3762170b6d4d 1206 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1207 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1208 * @param[in] blockSize number of samples that are processed at a time.
emilmont 1:fdd22bb7aa52 1209 */
emilmont 1:fdd22bb7aa52 1210 void arm_fir_init_f32(
emilmont 1:fdd22bb7aa52 1211 arm_fir_instance_f32 * S,
emilmont 1:fdd22bb7aa52 1212 uint16_t numTaps,
emilmont 1:fdd22bb7aa52 1213 float32_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1214 float32_t * pState,
emilmont 1:fdd22bb7aa52 1215 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1216
emilmont 1:fdd22bb7aa52 1217
emilmont 1:fdd22bb7aa52 1218 /**
emilmont 1:fdd22bb7aa52 1219 * @brief Instance structure for the Q15 Biquad cascade filter.
emilmont 1:fdd22bb7aa52 1220 */
emilmont 1:fdd22bb7aa52 1221 typedef struct
emilmont 1:fdd22bb7aa52 1222 {
mbed_official 5:3762170b6d4d 1223 int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
mbed_official 5:3762170b6d4d 1224 q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
mbed_official 5:3762170b6d4d 1225 q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
mbed_official 5:3762170b6d4d 1226 int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
emilmont 1:fdd22bb7aa52 1227 } arm_biquad_casd_df1_inst_q15;
emilmont 1:fdd22bb7aa52 1228
emilmont 1:fdd22bb7aa52 1229 /**
emilmont 1:fdd22bb7aa52 1230 * @brief Instance structure for the Q31 Biquad cascade filter.
emilmont 1:fdd22bb7aa52 1231 */
emilmont 1:fdd22bb7aa52 1232 typedef struct
emilmont 1:fdd22bb7aa52 1233 {
emilmont 1:fdd22bb7aa52 1234 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
emilmont 1:fdd22bb7aa52 1235 q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
emilmont 1:fdd22bb7aa52 1236 q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
emilmont 1:fdd22bb7aa52 1237 uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */
emilmont 1:fdd22bb7aa52 1238 } arm_biquad_casd_df1_inst_q31;
emilmont 1:fdd22bb7aa52 1239
emilmont 1:fdd22bb7aa52 1240 /**
emilmont 1:fdd22bb7aa52 1241 * @brief Instance structure for the floating-point Biquad cascade filter.
emilmont 1:fdd22bb7aa52 1242 */
emilmont 1:fdd22bb7aa52 1243 typedef struct
emilmont 1:fdd22bb7aa52 1244 {
mbed_official 5:3762170b6d4d 1245 uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */
mbed_official 5:3762170b6d4d 1246 float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */
mbed_official 5:3762170b6d4d 1247 float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */
emilmont 1:fdd22bb7aa52 1248 } arm_biquad_casd_df1_inst_f32;
emilmont 1:fdd22bb7aa52 1249
emilmont 1:fdd22bb7aa52 1250
emilmont 1:fdd22bb7aa52 1251 /**
emilmont 1:fdd22bb7aa52 1252 * @brief Processing function for the Q15 Biquad cascade filter.
mbed_official 5:3762170b6d4d 1253 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1254 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1255 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1256 * @param[in] blockSize number of samples to process.
mbed_official 5:3762170b6d4d 1257 */
emilmont 1:fdd22bb7aa52 1258 void arm_biquad_cascade_df1_q15(
emilmont 1:fdd22bb7aa52 1259 const arm_biquad_casd_df1_inst_q15 * S,
emilmont 1:fdd22bb7aa52 1260 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 1261 q15_t * pDst,
emilmont 1:fdd22bb7aa52 1262 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1263
mbed_official 5:3762170b6d4d 1264
emilmont 1:fdd22bb7aa52 1265 /**
emilmont 1:fdd22bb7aa52 1266 * @brief Initialization function for the Q15 Biquad cascade filter.
mbed_official 5:3762170b6d4d 1267 * @param[in,out] S points to an instance of the Q15 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1268 * @param[in] numStages number of 2nd order stages in the filter.
mbed_official 5:3762170b6d4d 1269 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1270 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1271 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
mbed_official 5:3762170b6d4d 1272 */
emilmont 1:fdd22bb7aa52 1273 void arm_biquad_cascade_df1_init_q15(
emilmont 1:fdd22bb7aa52 1274 arm_biquad_casd_df1_inst_q15 * S,
emilmont 1:fdd22bb7aa52 1275 uint8_t numStages,
emilmont 1:fdd22bb7aa52 1276 q15_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1277 q15_t * pState,
emilmont 1:fdd22bb7aa52 1278 int8_t postShift);
emilmont 1:fdd22bb7aa52 1279
emilmont 1:fdd22bb7aa52 1280
emilmont 1:fdd22bb7aa52 1281 /**
emilmont 1:fdd22bb7aa52 1282 * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4.
mbed_official 5:3762170b6d4d 1283 * @param[in] S points to an instance of the Q15 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1284 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1285 * @param[out] pDst points to the block of output data.
mbed_official 5:3762170b6d4d 1286 * @param[in] blockSize number of samples to process.
mbed_official 5:3762170b6d4d 1287 */
emilmont 1:fdd22bb7aa52 1288 void arm_biquad_cascade_df1_fast_q15(
emilmont 1:fdd22bb7aa52 1289 const arm_biquad_casd_df1_inst_q15 * S,
emilmont 1:fdd22bb7aa52 1290 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 1291 q15_t * pDst,
emilmont 1:fdd22bb7aa52 1292 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1293
emilmont 1:fdd22bb7aa52 1294
emilmont 1:fdd22bb7aa52 1295 /**
emilmont 1:fdd22bb7aa52 1296 * @brief Processing function for the Q31 Biquad cascade filter
mbed_official 5:3762170b6d4d 1297 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1298 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1299 * @param[out] pDst points to the block of output data.
emilmont 1:fdd22bb7aa52 1300 * @param[in] blockSize number of samples to process.
mbed_official 5:3762170b6d4d 1301 */
emilmont 1:fdd22bb7aa52 1302 void arm_biquad_cascade_df1_q31(
emilmont 1:fdd22bb7aa52 1303 const arm_biquad_casd_df1_inst_q31 * S,
emilmont 1:fdd22bb7aa52 1304 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 1305 q31_t * pDst,
emilmont 1:fdd22bb7aa52 1306 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1307
mbed_official 5:3762170b6d4d 1308
emilmont 1:fdd22bb7aa52 1309 /**
emilmont 1:fdd22bb7aa52 1310 * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4.
mbed_official 5:3762170b6d4d 1311 * @param[in] S points to an instance of the Q31 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1312 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1313 * @param[out] pDst points to the block of output data.
emilmont 1:fdd22bb7aa52 1314 * @param[in] blockSize number of samples to process.
mbed_official 5:3762170b6d4d 1315 */
emilmont 1:fdd22bb7aa52 1316 void arm_biquad_cascade_df1_fast_q31(
emilmont 1:fdd22bb7aa52 1317 const arm_biquad_casd_df1_inst_q31 * S,
emilmont 1:fdd22bb7aa52 1318 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 1319 q31_t * pDst,
emilmont 1:fdd22bb7aa52 1320 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1321
mbed_official 5:3762170b6d4d 1322
emilmont 1:fdd22bb7aa52 1323 /**
emilmont 1:fdd22bb7aa52 1324 * @brief Initialization function for the Q31 Biquad cascade filter.
mbed_official 5:3762170b6d4d 1325 * @param[in,out] S points to an instance of the Q31 Biquad cascade structure.
mbed_official 5:3762170b6d4d 1326 * @param[in] numStages number of 2nd order stages in the filter.
mbed_official 5:3762170b6d4d 1327 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1328 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1329 * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format
mbed_official 5:3762170b6d4d 1330 */
emilmont 1:fdd22bb7aa52 1331 void arm_biquad_cascade_df1_init_q31(
emilmont 1:fdd22bb7aa52 1332 arm_biquad_casd_df1_inst_q31 * S,
emilmont 1:fdd22bb7aa52 1333 uint8_t numStages,
emilmont 1:fdd22bb7aa52 1334 q31_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1335 q31_t * pState,
emilmont 1:fdd22bb7aa52 1336 int8_t postShift);
emilmont 1:fdd22bb7aa52 1337
mbed_official 5:3762170b6d4d 1338
emilmont 1:fdd22bb7aa52 1339 /**
emilmont 1:fdd22bb7aa52 1340 * @brief Processing function for the floating-point Biquad cascade filter.
mbed_official 5:3762170b6d4d 1341 * @param[in] S points to an instance of the floating-point Biquad cascade structure.
mbed_official 5:3762170b6d4d 1342 * @param[in] pSrc points to the block of input data.
mbed_official 5:3762170b6d4d 1343 * @param[out] pDst points to the block of output data.
emilmont 1:fdd22bb7aa52 1344 * @param[in] blockSize number of samples to process.
mbed_official 5:3762170b6d4d 1345 */
emilmont 1:fdd22bb7aa52 1346 void arm_biquad_cascade_df1_f32(
emilmont 1:fdd22bb7aa52 1347 const arm_biquad_casd_df1_inst_f32 * S,
emilmont 1:fdd22bb7aa52 1348 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 1349 float32_t * pDst,
emilmont 1:fdd22bb7aa52 1350 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1351
mbed_official 5:3762170b6d4d 1352
emilmont 1:fdd22bb7aa52 1353 /**
emilmont 1:fdd22bb7aa52 1354 * @brief Initialization function for the floating-point Biquad cascade filter.
mbed_official 5:3762170b6d4d 1355 * @param[in,out] S points to an instance of the floating-point Biquad cascade structure.
mbed_official 5:3762170b6d4d 1356 * @param[in] numStages number of 2nd order stages in the filter.
mbed_official 5:3762170b6d4d 1357 * @param[in] pCoeffs points to the filter coefficients.
mbed_official 5:3762170b6d4d 1358 * @param[in] pState points to the state buffer.
mbed_official 5:3762170b6d4d 1359 */
emilmont 1:fdd22bb7aa52 1360 void arm_biquad_cascade_df1_init_f32(
emilmont 1:fdd22bb7aa52 1361 arm_biquad_casd_df1_inst_f32 * S,
emilmont 1:fdd22bb7aa52 1362 uint8_t numStages,
emilmont 1:fdd22bb7aa52 1363 float32_t * pCoeffs,
emilmont 1:fdd22bb7aa52 1364 float32_t * pState);
emilmont 1:fdd22bb7aa52 1365
emilmont 1:fdd22bb7aa52 1366
emilmont 1:fdd22bb7aa52 1367 /**
emilmont 1:fdd22bb7aa52 1368 * @brief Instance structure for the floating-point matrix structure.
emilmont 1:fdd22bb7aa52 1369 */
emilmont 1:fdd22bb7aa52 1370 typedef struct
emilmont 1:fdd22bb7aa52 1371 {
emilmont 1:fdd22bb7aa52 1372 uint16_t numRows; /**< number of rows of the matrix. */
emilmont 1:fdd22bb7aa52 1373 uint16_t numCols; /**< number of columns of the matrix. */
emilmont 1:fdd22bb7aa52 1374 float32_t *pData; /**< points to the data of the matrix. */
emilmont 1:fdd22bb7aa52 1375 } arm_matrix_instance_f32;
emilmont 1:fdd22bb7aa52 1376
mbed_official 5:3762170b6d4d 1377
mbed_official 5:3762170b6d4d 1378 /**
mbed_official 5:3762170b6d4d 1379 * @brief Instance structure for the floating-point matrix structure.
mbed_official 5:3762170b6d4d 1380 */
mbed_official 5:3762170b6d4d 1381 typedef struct
mbed_official 5:3762170b6d4d 1382 {
mbed_official 5:3762170b6d4d 1383 uint16_t numRows; /**< number of rows of the matrix. */
mbed_official 5:3762170b6d4d 1384 uint16_t numCols; /**< number of columns of the matrix. */
mbed_official 5:3762170b6d4d 1385 float64_t *pData; /**< points to the data of the matrix. */
mbed_official 5:3762170b6d4d 1386 } arm_matrix_instance_f64;
mbed_official 5:3762170b6d4d 1387
emilmont 1:fdd22bb7aa52 1388 /**
emilmont 1:fdd22bb7aa52 1389 * @brief Instance structure for the Q15 matrix structure.
emilmont 1:fdd22bb7aa52 1390 */
emilmont 1:fdd22bb7aa52 1391 typedef struct
emilmont 1:fdd22bb7aa52 1392 {
emilmont 1:fdd22bb7aa52 1393 uint16_t numRows; /**< number of rows of the matrix. */
emilmont 1:fdd22bb7aa52 1394 uint16_t numCols; /**< number of columns of the matrix. */
emilmont 1:fdd22bb7aa52 1395 q15_t *pData; /**< points to the data of the matrix. */
emilmont 1:fdd22bb7aa52 1396 } arm_matrix_instance_q15;
emilmont 1:fdd22bb7aa52 1397
emilmont 1:fdd22bb7aa52 1398 /**
emilmont 1:fdd22bb7aa52 1399 * @brief Instance structure for the Q31 matrix structure.
emilmont 1:fdd22bb7aa52 1400 */
emilmont 1:fdd22bb7aa52 1401 typedef struct
emilmont 1:fdd22bb7aa52 1402 {
emilmont 1:fdd22bb7aa52 1403 uint16_t numRows; /**< number of rows of the matrix. */
emilmont 1:fdd22bb7aa52 1404 uint16_t numCols; /**< number of columns of the matrix. */
emilmont 1:fdd22bb7aa52 1405 q31_t *pData; /**< points to the data of the matrix. */
emilmont 1:fdd22bb7aa52 1406 } arm_matrix_instance_q31;
emilmont 1:fdd22bb7aa52 1407
emilmont 1:fdd22bb7aa52 1408
emilmont 1:fdd22bb7aa52 1409 /**
emilmont 1:fdd22bb7aa52 1410 * @brief Floating-point matrix addition.
mbed_official 5:3762170b6d4d 1411 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1412 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1413 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1414 * @return The function returns either
emilmont 1:fdd22bb7aa52 1415 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1416 */
emilmont 1:fdd22bb7aa52 1417 arm_status arm_mat_add_f32(
emilmont 1:fdd22bb7aa52 1418 const arm_matrix_instance_f32 * pSrcA,
emilmont 1:fdd22bb7aa52 1419 const arm_matrix_instance_f32 * pSrcB,
emilmont 1:fdd22bb7aa52 1420 arm_matrix_instance_f32 * pDst);
emilmont 1:fdd22bb7aa52 1421
mbed_official 5:3762170b6d4d 1422
emilmont 1:fdd22bb7aa52 1423 /**
emilmont 1:fdd22bb7aa52 1424 * @brief Q15 matrix addition.
mbed_official 5:3762170b6d4d 1425 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1426 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1427 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1428 * @return The function returns either
emilmont 1:fdd22bb7aa52 1429 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1430 */
emilmont 1:fdd22bb7aa52 1431 arm_status arm_mat_add_q15(
emilmont 1:fdd22bb7aa52 1432 const arm_matrix_instance_q15 * pSrcA,
emilmont 1:fdd22bb7aa52 1433 const arm_matrix_instance_q15 * pSrcB,
emilmont 1:fdd22bb7aa52 1434 arm_matrix_instance_q15 * pDst);
emilmont 1:fdd22bb7aa52 1435
mbed_official 5:3762170b6d4d 1436
emilmont 1:fdd22bb7aa52 1437 /**
emilmont 1:fdd22bb7aa52 1438 * @brief Q31 matrix addition.
mbed_official 5:3762170b6d4d 1439 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1440 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1441 * @param[out] pDst points to output matrix structure
mbed_official 5:3762170b6d4d 1442 * @return The function returns either
mbed_official 5:3762170b6d4d 1443 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
mbed_official 5:3762170b6d4d 1444 */
mbed_official 5:3762170b6d4d 1445 arm_status arm_mat_add_q31(
mbed_official 5:3762170b6d4d 1446 const arm_matrix_instance_q31 * pSrcA,
mbed_official 5:3762170b6d4d 1447 const arm_matrix_instance_q31 * pSrcB,
mbed_official 5:3762170b6d4d 1448 arm_matrix_instance_q31 * pDst);
mbed_official 5:3762170b6d4d 1449
mbed_official 5:3762170b6d4d 1450
mbed_official 5:3762170b6d4d 1451 /**
mbed_official 5:3762170b6d4d 1452 * @brief Floating-point, complex, matrix multiplication.
mbed_official 5:3762170b6d4d 1453 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1454 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1455 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1456 * @return The function returns either
emilmont 1:fdd22bb7aa52 1457 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1458 */
mbed_official 5:3762170b6d4d 1459 arm_status arm_mat_cmplx_mult_f32(
mbed_official 5:3762170b6d4d 1460 const arm_matrix_instance_f32 * pSrcA,
mbed_official 5:3762170b6d4d 1461 const arm_matrix_instance_f32 * pSrcB,
mbed_official 5:3762170b6d4d 1462 arm_matrix_instance_f32 * pDst);
mbed_official 5:3762170b6d4d 1463
mbed_official 5:3762170b6d4d 1464
mbed_official 5:3762170b6d4d 1465 /**
mbed_official 5:3762170b6d4d 1466 * @brief Q15, complex, matrix multiplication.
mbed_official 5:3762170b6d4d 1467 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1468 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1469 * @param[out] pDst points to output matrix structure
mbed_official 5:3762170b6d4d 1470 * @return The function returns either
mbed_official 5:3762170b6d4d 1471 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
mbed_official 5:3762170b6d4d 1472 */
mbed_official 5:3762170b6d4d 1473 arm_status arm_mat_cmplx_mult_q15(
mbed_official 5:3762170b6d4d 1474 const arm_matrix_instance_q15 * pSrcA,
mbed_official 5:3762170b6d4d 1475 const arm_matrix_instance_q15 * pSrcB,
mbed_official 5:3762170b6d4d 1476 arm_matrix_instance_q15 * pDst,
mbed_official 5:3762170b6d4d 1477 q15_t * pScratch);
mbed_official 5:3762170b6d4d 1478
mbed_official 5:3762170b6d4d 1479
mbed_official 5:3762170b6d4d 1480 /**
mbed_official 5:3762170b6d4d 1481 * @brief Q31, complex, matrix multiplication.
mbed_official 5:3762170b6d4d 1482 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1483 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1484 * @param[out] pDst points to output matrix structure
mbed_official 5:3762170b6d4d 1485 * @return The function returns either
mbed_official 5:3762170b6d4d 1486 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
mbed_official 5:3762170b6d4d 1487 */
mbed_official 5:3762170b6d4d 1488 arm_status arm_mat_cmplx_mult_q31(
emilmont 1:fdd22bb7aa52 1489 const arm_matrix_instance_q31 * pSrcA,
emilmont 1:fdd22bb7aa52 1490 const arm_matrix_instance_q31 * pSrcB,
emilmont 1:fdd22bb7aa52 1491 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1492
emilmont 1:fdd22bb7aa52 1493
emilmont 1:fdd22bb7aa52 1494 /**
emilmont 1:fdd22bb7aa52 1495 * @brief Floating-point matrix transpose.
mbed_official 5:3762170b6d4d 1496 * @param[in] pSrc points to the input matrix
mbed_official 5:3762170b6d4d 1497 * @param[out] pDst points to the output matrix
mbed_official 5:3762170b6d4d 1498 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emilmont 1:fdd22bb7aa52 1499 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1500 */
emilmont 1:fdd22bb7aa52 1501 arm_status arm_mat_trans_f32(
emilmont 1:fdd22bb7aa52 1502 const arm_matrix_instance_f32 * pSrc,
emilmont 1:fdd22bb7aa52 1503 arm_matrix_instance_f32 * pDst);
emilmont 1:fdd22bb7aa52 1504
emilmont 1:fdd22bb7aa52 1505
emilmont 1:fdd22bb7aa52 1506 /**
emilmont 1:fdd22bb7aa52 1507 * @brief Q15 matrix transpose.
mbed_official 5:3762170b6d4d 1508 * @param[in] pSrc points to the input matrix
mbed_official 5:3762170b6d4d 1509 * @param[out] pDst points to the output matrix
mbed_official 5:3762170b6d4d 1510 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emilmont 1:fdd22bb7aa52 1511 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1512 */
emilmont 1:fdd22bb7aa52 1513 arm_status arm_mat_trans_q15(
emilmont 1:fdd22bb7aa52 1514 const arm_matrix_instance_q15 * pSrc,
emilmont 1:fdd22bb7aa52 1515 arm_matrix_instance_q15 * pDst);
emilmont 1:fdd22bb7aa52 1516
mbed_official 5:3762170b6d4d 1517
emilmont 1:fdd22bb7aa52 1518 /**
emilmont 1:fdd22bb7aa52 1519 * @brief Q31 matrix transpose.
mbed_official 5:3762170b6d4d 1520 * @param[in] pSrc points to the input matrix
mbed_official 5:3762170b6d4d 1521 * @param[out] pDst points to the output matrix
mbed_official 5:3762170b6d4d 1522 * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code>
emilmont 1:fdd22bb7aa52 1523 * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1524 */
emilmont 1:fdd22bb7aa52 1525 arm_status arm_mat_trans_q31(
emilmont 1:fdd22bb7aa52 1526 const arm_matrix_instance_q31 * pSrc,
emilmont 1:fdd22bb7aa52 1527 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1528
emilmont 1:fdd22bb7aa52 1529
emilmont 1:fdd22bb7aa52 1530 /**
emilmont 1:fdd22bb7aa52 1531 * @brief Floating-point matrix multiplication
mbed_official 5:3762170b6d4d 1532 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1533 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1534 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1535 * @return The function returns either
emilmont 1:fdd22bb7aa52 1536 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1537 */
emilmont 1:fdd22bb7aa52 1538 arm_status arm_mat_mult_f32(
emilmont 1:fdd22bb7aa52 1539 const arm_matrix_instance_f32 * pSrcA,
emilmont 1:fdd22bb7aa52 1540 const arm_matrix_instance_f32 * pSrcB,
emilmont 1:fdd22bb7aa52 1541 arm_matrix_instance_f32 * pDst);
emilmont 1:fdd22bb7aa52 1542
mbed_official 5:3762170b6d4d 1543
emilmont 1:fdd22bb7aa52 1544 /**
emilmont 1:fdd22bb7aa52 1545 * @brief Q15 matrix multiplication
mbed_official 5:3762170b6d4d 1546 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1547 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1548 * @param[out] pDst points to output matrix structure
mbed_official 5:3762170b6d4d 1549 * @param[in] pState points to the array for storing intermediate results
emilmont 1:fdd22bb7aa52 1550 * @return The function returns either
emilmont 1:fdd22bb7aa52 1551 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1552 */
emilmont 1:fdd22bb7aa52 1553 arm_status arm_mat_mult_q15(
emilmont 1:fdd22bb7aa52 1554 const arm_matrix_instance_q15 * pSrcA,
emilmont 1:fdd22bb7aa52 1555 const arm_matrix_instance_q15 * pSrcB,
emilmont 1:fdd22bb7aa52 1556 arm_matrix_instance_q15 * pDst,
emilmont 1:fdd22bb7aa52 1557 q15_t * pState);
emilmont 1:fdd22bb7aa52 1558
mbed_official 5:3762170b6d4d 1559
emilmont 1:fdd22bb7aa52 1560 /**
emilmont 1:fdd22bb7aa52 1561 * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
mbed_official 5:3762170b6d4d 1562 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1563 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1564 * @param[out] pDst points to output matrix structure
mbed_official 5:3762170b6d4d 1565 * @param[in] pState points to the array for storing intermediate results
emilmont 1:fdd22bb7aa52 1566 * @return The function returns either
emilmont 1:fdd22bb7aa52 1567 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1568 */
emilmont 1:fdd22bb7aa52 1569 arm_status arm_mat_mult_fast_q15(
emilmont 1:fdd22bb7aa52 1570 const arm_matrix_instance_q15 * pSrcA,
emilmont 1:fdd22bb7aa52 1571 const arm_matrix_instance_q15 * pSrcB,
emilmont 1:fdd22bb7aa52 1572 arm_matrix_instance_q15 * pDst,
emilmont 1:fdd22bb7aa52 1573 q15_t * pState);
emilmont 1:fdd22bb7aa52 1574
mbed_official 5:3762170b6d4d 1575
emilmont 1:fdd22bb7aa52 1576 /**
emilmont 1:fdd22bb7aa52 1577 * @brief Q31 matrix multiplication
mbed_official 5:3762170b6d4d 1578 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1579 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1580 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1581 * @return The function returns either
emilmont 1:fdd22bb7aa52 1582 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1583 */
emilmont 1:fdd22bb7aa52 1584 arm_status arm_mat_mult_q31(
emilmont 1:fdd22bb7aa52 1585 const arm_matrix_instance_q31 * pSrcA,
emilmont 1:fdd22bb7aa52 1586 const arm_matrix_instance_q31 * pSrcB,
emilmont 1:fdd22bb7aa52 1587 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1588
mbed_official 5:3762170b6d4d 1589
emilmont 1:fdd22bb7aa52 1590 /**
emilmont 1:fdd22bb7aa52 1591 * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4
mbed_official 5:3762170b6d4d 1592 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1593 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1594 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1595 * @return The function returns either
emilmont 1:fdd22bb7aa52 1596 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1597 */
emilmont 1:fdd22bb7aa52 1598 arm_status arm_mat_mult_fast_q31(
emilmont 1:fdd22bb7aa52 1599 const arm_matrix_instance_q31 * pSrcA,
emilmont 1:fdd22bb7aa52 1600 const arm_matrix_instance_q31 * pSrcB,
emilmont 1:fdd22bb7aa52 1601 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1602
emilmont 1:fdd22bb7aa52 1603
emilmont 1:fdd22bb7aa52 1604 /**
emilmont 1:fdd22bb7aa52 1605 * @brief Floating-point matrix subtraction
mbed_official 5:3762170b6d4d 1606 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1607 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1608 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1609 * @return The function returns either
emilmont 1:fdd22bb7aa52 1610 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1611 */
emilmont 1:fdd22bb7aa52 1612 arm_status arm_mat_sub_f32(
emilmont 1:fdd22bb7aa52 1613 const arm_matrix_instance_f32 * pSrcA,
emilmont 1:fdd22bb7aa52 1614 const arm_matrix_instance_f32 * pSrcB,
emilmont 1:fdd22bb7aa52 1615 arm_matrix_instance_f32 * pDst);
emilmont 1:fdd22bb7aa52 1616
mbed_official 5:3762170b6d4d 1617
emilmont 1:fdd22bb7aa52 1618 /**
emilmont 1:fdd22bb7aa52 1619 * @brief Q15 matrix subtraction
mbed_official 5:3762170b6d4d 1620 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1621 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1622 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1623 * @return The function returns either
emilmont 1:fdd22bb7aa52 1624 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1625 */
emilmont 1:fdd22bb7aa52 1626 arm_status arm_mat_sub_q15(
emilmont 1:fdd22bb7aa52 1627 const arm_matrix_instance_q15 * pSrcA,
emilmont 1:fdd22bb7aa52 1628 const arm_matrix_instance_q15 * pSrcB,
emilmont 1:fdd22bb7aa52 1629 arm_matrix_instance_q15 * pDst);
emilmont 1:fdd22bb7aa52 1630
mbed_official 5:3762170b6d4d 1631
emilmont 1:fdd22bb7aa52 1632 /**
emilmont 1:fdd22bb7aa52 1633 * @brief Q31 matrix subtraction
mbed_official 5:3762170b6d4d 1634 * @param[in] pSrcA points to the first input matrix structure
mbed_official 5:3762170b6d4d 1635 * @param[in] pSrcB points to the second input matrix structure
mbed_official 5:3762170b6d4d 1636 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1637 * @return The function returns either
emilmont 1:fdd22bb7aa52 1638 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1639 */
emilmont 1:fdd22bb7aa52 1640 arm_status arm_mat_sub_q31(
emilmont 1:fdd22bb7aa52 1641 const arm_matrix_instance_q31 * pSrcA,
emilmont 1:fdd22bb7aa52 1642 const arm_matrix_instance_q31 * pSrcB,
emilmont 1:fdd22bb7aa52 1643 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1644
mbed_official 5:3762170b6d4d 1645
emilmont 1:fdd22bb7aa52 1646 /**
emilmont 1:fdd22bb7aa52 1647 * @brief Floating-point matrix scaling.
mbed_official 5:3762170b6d4d 1648 * @param[in] pSrc points to the input matrix
mbed_official 5:3762170b6d4d 1649 * @param[in] scale scale factor
mbed_official 5:3762170b6d4d 1650 * @param[out] pDst points to the output matrix
emilmont 1:fdd22bb7aa52 1651 * @return The function returns either
emilmont 1:fdd22bb7aa52 1652 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1653 */
emilmont 1:fdd22bb7aa52 1654 arm_status arm_mat_scale_f32(
emilmont 1:fdd22bb7aa52 1655 const arm_matrix_instance_f32 * pSrc,
emilmont 1:fdd22bb7aa52 1656 float32_t scale,
emilmont 1:fdd22bb7aa52 1657 arm_matrix_instance_f32 * pDst);
emilmont 1:fdd22bb7aa52 1658
mbed_official 5:3762170b6d4d 1659
emilmont 1:fdd22bb7aa52 1660 /**
emilmont 1:fdd22bb7aa52 1661 * @brief Q15 matrix scaling.
mbed_official 5:3762170b6d4d 1662 * @param[in] pSrc points to input matrix
mbed_official 5:3762170b6d4d 1663 * @param[in] scaleFract fractional portion of the scale factor
mbed_official 5:3762170b6d4d 1664 * @param[in] shift number of bits to shift the result by
mbed_official 5:3762170b6d4d 1665 * @param[out] pDst points to output matrix
emilmont 1:fdd22bb7aa52 1666 * @return The function returns either
emilmont 1:fdd22bb7aa52 1667 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1668 */
emilmont 1:fdd22bb7aa52 1669 arm_status arm_mat_scale_q15(
emilmont 1:fdd22bb7aa52 1670 const arm_matrix_instance_q15 * pSrc,
emilmont 1:fdd22bb7aa52 1671 q15_t scaleFract,
emilmont 1:fdd22bb7aa52 1672 int32_t shift,
emilmont 1:fdd22bb7aa52 1673 arm_matrix_instance_q15 * pDst);
emilmont 1:fdd22bb7aa52 1674
mbed_official 5:3762170b6d4d 1675
emilmont 1:fdd22bb7aa52 1676 /**
emilmont 1:fdd22bb7aa52 1677 * @brief Q31 matrix scaling.
mbed_official 5:3762170b6d4d 1678 * @param[in] pSrc points to input matrix
mbed_official 5:3762170b6d4d 1679 * @param[in] scaleFract fractional portion of the scale factor
mbed_official 5:3762170b6d4d 1680 * @param[in] shift number of bits to shift the result by
mbed_official 5:3762170b6d4d 1681 * @param[out] pDst points to output matrix structure
emilmont 1:fdd22bb7aa52 1682 * @return The function returns either
emilmont 1:fdd22bb7aa52 1683 * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking.
emilmont 1:fdd22bb7aa52 1684 */
emilmont 1:fdd22bb7aa52 1685 arm_status arm_mat_scale_q31(
emilmont 1:fdd22bb7aa52 1686 const arm_matrix_instance_q31 * pSrc,
emilmont 1:fdd22bb7aa52 1687 q31_t scaleFract,
emilmont 1:fdd22bb7aa52 1688 int32_t shift,
emilmont 1:fdd22bb7aa52 1689 arm_matrix_instance_q31 * pDst);
emilmont 1:fdd22bb7aa52 1690
emilmont 1:fdd22bb7aa52 1691
emilmont 1:fdd22bb7aa52 1692 /**
emilmont 1:fdd22bb7aa52 1693 * @brief Q31 matrix initialization.
mbed_official 5:3762170b6d4d 1694 * @param[in,out] S points to an instance of the floating-point matrix structure.
mbed_official 5:3762170b6d4d 1695 * @param[in] nRows number of rows in the matrix.
mbed_official 5:3762170b6d4d 1696 * @param[in] nColumns number of columns in the matrix.
mbed_official 5:3762170b6d4d 1697 * @param[in] pData points to the matrix data array.
mbed_official 5:3762170b6d4d 1698 */
emilmont 1:fdd22bb7aa52 1699 void arm_mat_init_q31(
emilmont 1:fdd22bb7aa52 1700 arm_matrix_instance_q31 * S,
emilmont 1:fdd22bb7aa52 1701 uint16_t nRows,
emilmont 1:fdd22bb7aa52 1702 uint16_t nColumns,
emilmont 1:fdd22bb7aa52 1703 q31_t * pData);
emilmont 1:fdd22bb7aa52 1704
mbed_official 5:3762170b6d4d 1705
emilmont 1:fdd22bb7aa52 1706 /**
emilmont 1:fdd22bb7aa52 1707 * @brief Q15 matrix initialization.
mbed_official 5:3762170b6d4d 1708 * @param[in,out] S points to an instance of the floating-point matrix structure.
mbed_official 5:3762170b6d4d 1709 * @param[in] nRows number of rows in the matrix.
mbed_official 5:3762170b6d4d 1710 * @param[in] nColumns number of columns in the matrix.
mbed_official 5:3762170b6d4d 1711 * @param[in] pData points to the matrix data array.
mbed_official 5:3762170b6d4d 1712 */
emilmont 1:fdd22bb7aa52 1713 void arm_mat_init_q15(
emilmont 1:fdd22bb7aa52 1714 arm_matrix_instance_q15 * S,
emilmont 1:fdd22bb7aa52 1715 uint16_t nRows,
emilmont 1:fdd22bb7aa52 1716 uint16_t nColumns,
emilmont 1:fdd22bb7aa52 1717 q15_t * pData);
emilmont 1:fdd22bb7aa52 1718
mbed_official 5:3762170b6d4d 1719
emilmont 1:fdd22bb7aa52 1720 /**
emilmont 1:fdd22bb7aa52 1721 * @brief Floating-point matrix initialization.
mbed_official 5:3762170b6d4d 1722 * @param[in,out] S points to an instance of the floating-point matrix structure.
mbed_official 5:3762170b6d4d 1723 * @param[in] nRows number of rows in the matrix.
mbed_official 5:3762170b6d4d 1724 * @param[in] nColumns number of columns in the matrix.
mbed_official 5:3762170b6d4d 1725 * @param[in] pData points to the matrix data array.
mbed_official 5:3762170b6d4d 1726 */
emilmont 1:fdd22bb7aa52 1727 void arm_mat_init_f32(
emilmont 1:fdd22bb7aa52 1728 arm_matrix_instance_f32 * S,
emilmont 1:fdd22bb7aa52 1729 uint16_t nRows,
emilmont 1:fdd22bb7aa52 1730 uint16_t nColumns,
emilmont 1:fdd22bb7aa52 1731 float32_t * pData);
emilmont 1:fdd22bb7aa52 1732
emilmont 1:fdd22bb7aa52 1733
emilmont 1:fdd22bb7aa52 1734
emilmont 1:fdd22bb7aa52 1735 /**
emilmont 1:fdd22bb7aa52 1736 * @brief Instance structure for the Q15 PID Control.
emilmont 1:fdd22bb7aa52 1737 */
emilmont 1:fdd22bb7aa52 1738 typedef struct
emilmont 1:fdd22bb7aa52 1739 {
mbed_official 5:3762170b6d4d 1740 q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
mbed_official 3:7a284390b0ce 1741 #ifdef ARM_MATH_CM0_FAMILY
emilmont 1:fdd22bb7aa52 1742 q15_t A1;
emilmont 1:fdd22bb7aa52 1743 q15_t A2;
emilmont 1:fdd22bb7aa52 1744 #else
emilmont 1:fdd22bb7aa52 1745 q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/
emilmont 1:fdd22bb7aa52 1746 #endif
mbed_official 5:3762170b6d4d 1747 q15_t state[3]; /**< The state array of length 3. */
emilmont 1:fdd22bb7aa52 1748 q15_t Kp; /**< The proportional gain. */
emilmont 1:fdd22bb7aa52 1749 q15_t Ki; /**< The integral gain. */
emilmont 1:fdd22bb7aa52 1750 q15_t Kd; /**< The derivative gain. */
emilmont 1:fdd22bb7aa52 1751 } arm_pid_instance_q15;
emilmont 1:fdd22bb7aa52 1752
emilmont 1:fdd22bb7aa52 1753 /**
emilmont 1:fdd22bb7aa52 1754 * @brief Instance structure for the Q31 PID Control.
emilmont 1:fdd22bb7aa52 1755 */
emilmont 1:fdd22bb7aa52 1756 typedef struct
emilmont 1:fdd22bb7aa52 1757 {
emilmont 1:fdd22bb7aa52 1758 q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
emilmont 1:fdd22bb7aa52 1759 q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
emilmont 1:fdd22bb7aa52 1760 q31_t A2; /**< The derived gain, A2 = Kd . */
emilmont 1:fdd22bb7aa52 1761 q31_t state[3]; /**< The state array of length 3. */
emilmont 1:fdd22bb7aa52 1762 q31_t Kp; /**< The proportional gain. */
emilmont 1:fdd22bb7aa52 1763 q31_t Ki; /**< The integral gain. */
emilmont 1:fdd22bb7aa52 1764 q31_t Kd; /**< The derivative gain. */
emilmont 1:fdd22bb7aa52 1765 } arm_pid_instance_q31;
emilmont 1:fdd22bb7aa52 1766
emilmont 1:fdd22bb7aa52 1767 /**
emilmont 1:fdd22bb7aa52 1768 * @brief Instance structure for the floating-point PID Control.
emilmont 1:fdd22bb7aa52 1769 */
emilmont 1:fdd22bb7aa52 1770 typedef struct
emilmont 1:fdd22bb7aa52 1771 {
emilmont 1:fdd22bb7aa52 1772 float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */
emilmont 1:fdd22bb7aa52 1773 float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */
emilmont 1:fdd22bb7aa52 1774 float32_t A2; /**< The derived gain, A2 = Kd . */
emilmont 1:fdd22bb7aa52 1775 float32_t state[3]; /**< The state array of length 3. */
mbed_official 5:3762170b6d4d 1776 float32_t Kp; /**< The proportional gain. */
mbed_official 5:3762170b6d4d 1777 float32_t Ki; /**< The integral gain. */
mbed_official 5:3762170b6d4d 1778 float32_t Kd; /**< The derivative gain. */
emilmont 1:fdd22bb7aa52 1779 } arm_pid_instance_f32;
emilmont 1:fdd22bb7aa52 1780
emilmont 1:fdd22bb7aa52 1781
emilmont 1:fdd22bb7aa52 1782
emilmont 1:fdd22bb7aa52 1783 /**
emilmont 1:fdd22bb7aa52 1784 * @brief Initialization function for the floating-point PID Control.
mbed_official 5:3762170b6d4d 1785 * @param[in,out] S points to an instance of the PID structure.
emilmont 1:fdd22bb7aa52 1786 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emilmont 1:fdd22bb7aa52 1787 */
emilmont 1:fdd22bb7aa52 1788 void arm_pid_init_f32(
emilmont 1:fdd22bb7aa52 1789 arm_pid_instance_f32 * S,
emilmont 1:fdd22bb7aa52 1790 int32_t resetStateFlag);
emilmont 1:fdd22bb7aa52 1791
mbed_official 5:3762170b6d4d 1792
emilmont 1:fdd22bb7aa52 1793 /**
emilmont 1:fdd22bb7aa52 1794 * @brief Reset function for the floating-point PID Control.
mbed_official 5:3762170b6d4d 1795 * @param[in,out] S is an instance of the floating-point PID Control structure
emilmont 1:fdd22bb7aa52 1796 */
emilmont 1:fdd22bb7aa52 1797 void arm_pid_reset_f32(
emilmont 1:fdd22bb7aa52 1798 arm_pid_instance_f32 * S);
emilmont 1:fdd22bb7aa52 1799
emilmont 1:fdd22bb7aa52 1800
emilmont 1:fdd22bb7aa52 1801 /**
emilmont 1:fdd22bb7aa52 1802 * @brief Initialization function for the Q31 PID Control.
mbed_official 5:3762170b6d4d 1803 * @param[in,out] S points to an instance of the Q15 PID structure.
emilmont 1:fdd22bb7aa52 1804 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emilmont 1:fdd22bb7aa52 1805 */
emilmont 1:fdd22bb7aa52 1806 void arm_pid_init_q31(
emilmont 1:fdd22bb7aa52 1807 arm_pid_instance_q31 * S,
emilmont 1:fdd22bb7aa52 1808 int32_t resetStateFlag);
emilmont 1:fdd22bb7aa52 1809
emilmont 1:fdd22bb7aa52 1810
emilmont 1:fdd22bb7aa52 1811 /**
emilmont 1:fdd22bb7aa52 1812 * @brief Reset function for the Q31 PID Control.
mbed_official 5:3762170b6d4d 1813 * @param[in,out] S points to an instance of the Q31 PID Control structure
emilmont 1:fdd22bb7aa52 1814 */
emilmont 1:fdd22bb7aa52 1815
emilmont 1:fdd22bb7aa52 1816 void arm_pid_reset_q31(
emilmont 1:fdd22bb7aa52 1817 arm_pid_instance_q31 * S);
emilmont 1:fdd22bb7aa52 1818
mbed_official 5:3762170b6d4d 1819
emilmont 1:fdd22bb7aa52 1820 /**
emilmont 1:fdd22bb7aa52 1821 * @brief Initialization function for the Q15 PID Control.
mbed_official 5:3762170b6d4d 1822 * @param[in,out] S points to an instance of the Q15 PID structure.
mbed_official 5:3762170b6d4d 1823 * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state.
emilmont 1:fdd22bb7aa52 1824 */
emilmont 1:fdd22bb7aa52 1825 void arm_pid_init_q15(
emilmont 1:fdd22bb7aa52 1826 arm_pid_instance_q15 * S,
emilmont 1:fdd22bb7aa52 1827 int32_t resetStateFlag);
emilmont 1:fdd22bb7aa52 1828
mbed_official 5:3762170b6d4d 1829
emilmont 1:fdd22bb7aa52 1830 /**
emilmont 1:fdd22bb7aa52 1831 * @brief Reset function for the Q15 PID Control.
mbed_official 5:3762170b6d4d 1832 * @param[in,out] S points to an instance of the q15 PID Control structure
emilmont 1:fdd22bb7aa52 1833 */
emilmont 1:fdd22bb7aa52 1834 void arm_pid_reset_q15(
emilmont 1:fdd22bb7aa52 1835 arm_pid_instance_q15 * S);
emilmont 1:fdd22bb7aa52 1836
emilmont 1:fdd22bb7aa52 1837
emilmont 1:fdd22bb7aa52 1838 /**
emilmont 1:fdd22bb7aa52 1839 * @brief Instance structure for the floating-point Linear Interpolate function.
emilmont 1:fdd22bb7aa52 1840 */
emilmont 1:fdd22bb7aa52 1841 typedef struct
emilmont 1:fdd22bb7aa52 1842 {
emilmont 1:fdd22bb7aa52 1843 uint32_t nValues; /**< nValues */
emilmont 1:fdd22bb7aa52 1844 float32_t x1; /**< x1 */
emilmont 1:fdd22bb7aa52 1845 float32_t xSpacing; /**< xSpacing */
emilmont 1:fdd22bb7aa52 1846 float32_t *pYData; /**< pointer to the table of Y values */
emilmont 1:fdd22bb7aa52 1847 } arm_linear_interp_instance_f32;
emilmont 1:fdd22bb7aa52 1848
emilmont 1:fdd22bb7aa52 1849 /**
emilmont 1:fdd22bb7aa52 1850 * @brief Instance structure for the floating-point bilinear interpolation function.
emilmont 1:fdd22bb7aa52 1851 */
emilmont 1:fdd22bb7aa52 1852 typedef struct
emilmont 1:fdd22bb7aa52 1853 {
emilmont 1:fdd22bb7aa52 1854 uint16_t numRows; /**< number of rows in the data table. */
emilmont 1:fdd22bb7aa52 1855 uint16_t numCols; /**< number of columns in the data table. */
emilmont 1:fdd22bb7aa52 1856 float32_t *pData; /**< points to the data table. */
emilmont 1:fdd22bb7aa52 1857 } arm_bilinear_interp_instance_f32;
emilmont 1:fdd22bb7aa52 1858
emilmont 1:fdd22bb7aa52 1859 /**
emilmont 1:fdd22bb7aa52 1860 * @brief Instance structure for the Q31 bilinear interpolation function.
emilmont 1:fdd22bb7aa52 1861 */
emilmont 1:fdd22bb7aa52 1862 typedef struct
emilmont 1:fdd22bb7aa52 1863 {
emilmont 1:fdd22bb7aa52 1864 uint16_t numRows; /**< number of rows in the data table. */
emilmont 1:fdd22bb7aa52 1865 uint16_t numCols; /**< number of columns in the data table. */
emilmont 1:fdd22bb7aa52 1866 q31_t *pData; /**< points to the data table. */
emilmont 1:fdd22bb7aa52 1867 } arm_bilinear_interp_instance_q31;
emilmont 1:fdd22bb7aa52 1868
emilmont 1:fdd22bb7aa52 1869 /**
emilmont 1:fdd22bb7aa52 1870 * @brief Instance structure for the Q15 bilinear interpolation function.
emilmont 1:fdd22bb7aa52 1871 */
emilmont 1:fdd22bb7aa52 1872 typedef struct
emilmont 1:fdd22bb7aa52 1873 {
emilmont 1:fdd22bb7aa52 1874 uint16_t numRows; /**< number of rows in the data table. */
emilmont 1:fdd22bb7aa52 1875 uint16_t numCols; /**< number of columns in the data table. */
emilmont 1:fdd22bb7aa52 1876 q15_t *pData; /**< points to the data table. */
emilmont 1:fdd22bb7aa52 1877 } arm_bilinear_interp_instance_q15;
emilmont 1:fdd22bb7aa52 1878
emilmont 1:fdd22bb7aa52 1879 /**
emilmont 1:fdd22bb7aa52 1880 * @brief Instance structure for the Q15 bilinear interpolation function.
emilmont 1:fdd22bb7aa52 1881 */
emilmont 1:fdd22bb7aa52 1882 typedef struct
emilmont 1:fdd22bb7aa52 1883 {
emilmont 1:fdd22bb7aa52 1884 uint16_t numRows; /**< number of rows in the data table. */
emilmont 1:fdd22bb7aa52 1885 uint16_t numCols; /**< number of columns in the data table. */
mbed_official 5:3762170b6d4d 1886 q7_t *pData; /**< points to the data table. */
emilmont 1:fdd22bb7aa52 1887 } arm_bilinear_interp_instance_q7;
emilmont 1:fdd22bb7aa52 1888
emilmont 1:fdd22bb7aa52 1889
emilmont 1:fdd22bb7aa52 1890 /**
emilmont 1:fdd22bb7aa52 1891 * @brief Q7 vector multiplication.
mbed_official 5:3762170b6d4d 1892 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 1893 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 1894 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 1895 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 1896 */
emilmont 1:fdd22bb7aa52 1897 void arm_mult_q7(
emilmont 1:fdd22bb7aa52 1898 q7_t * pSrcA,
emilmont 1:fdd22bb7aa52 1899 q7_t * pSrcB,
emilmont 1:fdd22bb7aa52 1900 q7_t * pDst,
emilmont 1:fdd22bb7aa52 1901 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1902
mbed_official 5:3762170b6d4d 1903
emilmont 1:fdd22bb7aa52 1904 /**
emilmont 1:fdd22bb7aa52 1905 * @brief Q15 vector multiplication.
mbed_official 5:3762170b6d4d 1906 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 1907 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 1908 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 1909 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 1910 */
emilmont 1:fdd22bb7aa52 1911 void arm_mult_q15(
emilmont 1:fdd22bb7aa52 1912 q15_t * pSrcA,
emilmont 1:fdd22bb7aa52 1913 q15_t * pSrcB,
emilmont 1:fdd22bb7aa52 1914 q15_t * pDst,
emilmont 1:fdd22bb7aa52 1915 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1916
mbed_official 5:3762170b6d4d 1917
emilmont 1:fdd22bb7aa52 1918 /**
emilmont 1:fdd22bb7aa52 1919 * @brief Q31 vector multiplication.
mbed_official 5:3762170b6d4d 1920 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 1921 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 1922 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 1923 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 1924 */
emilmont 1:fdd22bb7aa52 1925 void arm_mult_q31(
emilmont 1:fdd22bb7aa52 1926 q31_t * pSrcA,
emilmont 1:fdd22bb7aa52 1927 q31_t * pSrcB,
emilmont 1:fdd22bb7aa52 1928 q31_t * pDst,
emilmont 1:fdd22bb7aa52 1929 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1930
mbed_official 5:3762170b6d4d 1931
emilmont 1:fdd22bb7aa52 1932 /**
emilmont 1:fdd22bb7aa52 1933 * @brief Floating-point vector multiplication.
mbed_official 5:3762170b6d4d 1934 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 1935 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 1936 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 1937 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 1938 */
emilmont 1:fdd22bb7aa52 1939 void arm_mult_f32(
emilmont 1:fdd22bb7aa52 1940 float32_t * pSrcA,
emilmont 1:fdd22bb7aa52 1941 float32_t * pSrcB,
emilmont 1:fdd22bb7aa52 1942 float32_t * pDst,
emilmont 1:fdd22bb7aa52 1943 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 1944
emilmont 1:fdd22bb7aa52 1945
emilmont 1:fdd22bb7aa52 1946 /**
emilmont 1:fdd22bb7aa52 1947 * @brief Instance structure for the Q15 CFFT/CIFFT function.
emilmont 1:fdd22bb7aa52 1948 */
emilmont 1:fdd22bb7aa52 1949 typedef struct
emilmont 1:fdd22bb7aa52 1950 {
emilmont 1:fdd22bb7aa52 1951 uint16_t fftLen; /**< length of the FFT. */
emilmont 1:fdd22bb7aa52 1952 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
emilmont 1:fdd22bb7aa52 1953 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
mbed_official 5:3762170b6d4d 1954 q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */
emilmont 1:fdd22bb7aa52 1955 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
emilmont 1:fdd22bb7aa52 1956 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 1957 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
emilmont 1:fdd22bb7aa52 1958 } arm_cfft_radix2_instance_q15;
emilmont 1:fdd22bb7aa52 1959
mbed_official 5:3762170b6d4d 1960 /* Deprecated */
mbed_official 3:7a284390b0ce 1961 arm_status arm_cfft_radix2_init_q15(
mbed_official 3:7a284390b0ce 1962 arm_cfft_radix2_instance_q15 * S,
mbed_official 3:7a284390b0ce 1963 uint16_t fftLen,
mbed_official 3:7a284390b0ce 1964 uint8_t ifftFlag,
mbed_official 3:7a284390b0ce 1965 uint8_t bitReverseFlag);
mbed_official 3:7a284390b0ce 1966
mbed_official 5:3762170b6d4d 1967 /* Deprecated */
mbed_official 3:7a284390b0ce 1968 void arm_cfft_radix2_q15(
mbed_official 3:7a284390b0ce 1969 const arm_cfft_radix2_instance_q15 * S,
mbed_official 3:7a284390b0ce 1970 q15_t * pSrc);
mbed_official 3:7a284390b0ce 1971
mbed_official 3:7a284390b0ce 1972
mbed_official 3:7a284390b0ce 1973 /**
mbed_official 3:7a284390b0ce 1974 * @brief Instance structure for the Q15 CFFT/CIFFT function.
mbed_official 3:7a284390b0ce 1975 */
mbed_official 3:7a284390b0ce 1976 typedef struct
mbed_official 3:7a284390b0ce 1977 {
mbed_official 3:7a284390b0ce 1978 uint16_t fftLen; /**< length of the FFT. */
mbed_official 3:7a284390b0ce 1979 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
mbed_official 3:7a284390b0ce 1980 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
mbed_official 3:7a284390b0ce 1981 q15_t *pTwiddle; /**< points to the twiddle factor table. */
mbed_official 3:7a284390b0ce 1982 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 3:7a284390b0ce 1983 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
mbed_official 3:7a284390b0ce 1984 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
mbed_official 3:7a284390b0ce 1985 } arm_cfft_radix4_instance_q15;
mbed_official 3:7a284390b0ce 1986
mbed_official 5:3762170b6d4d 1987 /* Deprecated */
mbed_official 3:7a284390b0ce 1988 arm_status arm_cfft_radix4_init_q15(
mbed_official 3:7a284390b0ce 1989 arm_cfft_radix4_instance_q15 * S,
mbed_official 3:7a284390b0ce 1990 uint16_t fftLen,
mbed_official 3:7a284390b0ce 1991 uint8_t ifftFlag,
mbed_official 3:7a284390b0ce 1992 uint8_t bitReverseFlag);
mbed_official 3:7a284390b0ce 1993
mbed_official 5:3762170b6d4d 1994 /* Deprecated */
mbed_official 3:7a284390b0ce 1995 void arm_cfft_radix4_q15(
mbed_official 3:7a284390b0ce 1996 const arm_cfft_radix4_instance_q15 * S,
mbed_official 3:7a284390b0ce 1997 q15_t * pSrc);
mbed_official 3:7a284390b0ce 1998
emilmont 1:fdd22bb7aa52 1999 /**
emilmont 1:fdd22bb7aa52 2000 * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function.
emilmont 1:fdd22bb7aa52 2001 */
emilmont 1:fdd22bb7aa52 2002 typedef struct
emilmont 1:fdd22bb7aa52 2003 {
emilmont 1:fdd22bb7aa52 2004 uint16_t fftLen; /**< length of the FFT. */
emilmont 1:fdd22bb7aa52 2005 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
emilmont 1:fdd22bb7aa52 2006 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
mbed_official 5:3762170b6d4d 2007 q31_t *pTwiddle; /**< points to the Twiddle factor table. */
emilmont 1:fdd22bb7aa52 2008 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
emilmont 1:fdd22bb7aa52 2009 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 2010 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
emilmont 1:fdd22bb7aa52 2011 } arm_cfft_radix2_instance_q31;
emilmont 1:fdd22bb7aa52 2012
mbed_official 5:3762170b6d4d 2013 /* Deprecated */
mbed_official 3:7a284390b0ce 2014 arm_status arm_cfft_radix2_init_q31(
mbed_official 3:7a284390b0ce 2015 arm_cfft_radix2_instance_q31 * S,
mbed_official 3:7a284390b0ce 2016 uint16_t fftLen,
mbed_official 3:7a284390b0ce 2017 uint8_t ifftFlag,
mbed_official 3:7a284390b0ce 2018 uint8_t bitReverseFlag);
mbed_official 3:7a284390b0ce 2019
mbed_official 5:3762170b6d4d 2020 /* Deprecated */
mbed_official 3:7a284390b0ce 2021 void arm_cfft_radix2_q31(
mbed_official 3:7a284390b0ce 2022 const arm_cfft_radix2_instance_q31 * S,
mbed_official 3:7a284390b0ce 2023 q31_t * pSrc);
mbed_official 3:7a284390b0ce 2024
mbed_official 3:7a284390b0ce 2025 /**
mbed_official 3:7a284390b0ce 2026 * @brief Instance structure for the Q31 CFFT/CIFFT function.
mbed_official 3:7a284390b0ce 2027 */
mbed_official 3:7a284390b0ce 2028 typedef struct
mbed_official 3:7a284390b0ce 2029 {
mbed_official 3:7a284390b0ce 2030 uint16_t fftLen; /**< length of the FFT. */
mbed_official 3:7a284390b0ce 2031 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
mbed_official 3:7a284390b0ce 2032 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
mbed_official 3:7a284390b0ce 2033 q31_t *pTwiddle; /**< points to the twiddle factor table. */
mbed_official 3:7a284390b0ce 2034 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 3:7a284390b0ce 2035 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
mbed_official 3:7a284390b0ce 2036 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
mbed_official 3:7a284390b0ce 2037 } arm_cfft_radix4_instance_q31;
mbed_official 3:7a284390b0ce 2038
mbed_official 5:3762170b6d4d 2039 /* Deprecated */
mbed_official 3:7a284390b0ce 2040 void arm_cfft_radix4_q31(
mbed_official 3:7a284390b0ce 2041 const arm_cfft_radix4_instance_q31 * S,
mbed_official 3:7a284390b0ce 2042 q31_t * pSrc);
mbed_official 3:7a284390b0ce 2043
mbed_official 5:3762170b6d4d 2044 /* Deprecated */
mbed_official 3:7a284390b0ce 2045 arm_status arm_cfft_radix4_init_q31(
mbed_official 3:7a284390b0ce 2046 arm_cfft_radix4_instance_q31 * S,
mbed_official 3:7a284390b0ce 2047 uint16_t fftLen,
mbed_official 3:7a284390b0ce 2048 uint8_t ifftFlag,
mbed_official 3:7a284390b0ce 2049 uint8_t bitReverseFlag);
mbed_official 3:7a284390b0ce 2050
emilmont 1:fdd22bb7aa52 2051 /**
emilmont 1:fdd22bb7aa52 2052 * @brief Instance structure for the floating-point CFFT/CIFFT function.
emilmont 1:fdd22bb7aa52 2053 */
emilmont 1:fdd22bb7aa52 2054 typedef struct
emilmont 1:fdd22bb7aa52 2055 {
emilmont 1:fdd22bb7aa52 2056 uint16_t fftLen; /**< length of the FFT. */
emilmont 1:fdd22bb7aa52 2057 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
emilmont 1:fdd22bb7aa52 2058 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
emilmont 1:fdd22bb7aa52 2059 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
emilmont 1:fdd22bb7aa52 2060 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
emilmont 1:fdd22bb7aa52 2061 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 2062 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
mbed_official 5:3762170b6d4d 2063 float32_t onebyfftLen; /**< value of 1/fftLen. */
emilmont 1:fdd22bb7aa52 2064 } arm_cfft_radix2_instance_f32;
emilmont 1:fdd22bb7aa52 2065
mbed_official 3:7a284390b0ce 2066 /* Deprecated */
emilmont 1:fdd22bb7aa52 2067 arm_status arm_cfft_radix2_init_f32(
emilmont 1:fdd22bb7aa52 2068 arm_cfft_radix2_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2069 uint16_t fftLen,
emilmont 1:fdd22bb7aa52 2070 uint8_t ifftFlag,
emilmont 1:fdd22bb7aa52 2071 uint8_t bitReverseFlag);
emilmont 1:fdd22bb7aa52 2072
mbed_official 3:7a284390b0ce 2073 /* Deprecated */
mbed_official 3:7a284390b0ce 2074 void arm_cfft_radix2_f32(
mbed_official 3:7a284390b0ce 2075 const arm_cfft_radix2_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2076 float32_t * pSrc);
emilmont 1:fdd22bb7aa52 2077
emilmont 1:fdd22bb7aa52 2078 /**
mbed_official 3:7a284390b0ce 2079 * @brief Instance structure for the floating-point CFFT/CIFFT function.
mbed_official 3:7a284390b0ce 2080 */
mbed_official 3:7a284390b0ce 2081 typedef struct
mbed_official 3:7a284390b0ce 2082 {
mbed_official 3:7a284390b0ce 2083 uint16_t fftLen; /**< length of the FFT. */
mbed_official 3:7a284390b0ce 2084 uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */
mbed_official 3:7a284390b0ce 2085 uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */
mbed_official 3:7a284390b0ce 2086 float32_t *pTwiddle; /**< points to the Twiddle factor table. */
mbed_official 3:7a284390b0ce 2087 uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 3:7a284390b0ce 2088 uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
mbed_official 3:7a284390b0ce 2089 uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */
mbed_official 5:3762170b6d4d 2090 float32_t onebyfftLen; /**< value of 1/fftLen. */
mbed_official 3:7a284390b0ce 2091 } arm_cfft_radix4_instance_f32;
mbed_official 3:7a284390b0ce 2092
mbed_official 3:7a284390b0ce 2093 /* Deprecated */
emilmont 1:fdd22bb7aa52 2094 arm_status arm_cfft_radix4_init_f32(
emilmont 1:fdd22bb7aa52 2095 arm_cfft_radix4_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2096 uint16_t fftLen,
emilmont 1:fdd22bb7aa52 2097 uint8_t ifftFlag,
emilmont 1:fdd22bb7aa52 2098 uint8_t bitReverseFlag);
emilmont 1:fdd22bb7aa52 2099
mbed_official 3:7a284390b0ce 2100 /* Deprecated */
mbed_official 3:7a284390b0ce 2101 void arm_cfft_radix4_f32(
mbed_official 3:7a284390b0ce 2102 const arm_cfft_radix4_instance_f32 * S,
mbed_official 3:7a284390b0ce 2103 float32_t * pSrc);
mbed_official 3:7a284390b0ce 2104
mbed_official 3:7a284390b0ce 2105 /**
mbed_official 5:3762170b6d4d 2106 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
mbed_official 5:3762170b6d4d 2107 */
mbed_official 5:3762170b6d4d 2108 typedef struct
mbed_official 5:3762170b6d4d 2109 {
mbed_official 5:3762170b6d4d 2110 uint16_t fftLen; /**< length of the FFT. */
mbed_official 5:3762170b6d4d 2111 const q15_t *pTwiddle; /**< points to the Twiddle factor table. */
mbed_official 5:3762170b6d4d 2112 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 5:3762170b6d4d 2113 uint16_t bitRevLength; /**< bit reversal table length. */
mbed_official 5:3762170b6d4d 2114 } arm_cfft_instance_q15;
mbed_official 5:3762170b6d4d 2115
mbed_official 5:3762170b6d4d 2116 void arm_cfft_q15(
mbed_official 5:3762170b6d4d 2117 const arm_cfft_instance_q15 * S,
mbed_official 5:3762170b6d4d 2118 q15_t * p1,
mbed_official 5:3762170b6d4d 2119 uint8_t ifftFlag,
mbed_official 5:3762170b6d4d 2120 uint8_t bitReverseFlag);
mbed_official 5:3762170b6d4d 2121
mbed_official 5:3762170b6d4d 2122 /**
mbed_official 5:3762170b6d4d 2123 * @brief Instance structure for the fixed-point CFFT/CIFFT function.
mbed_official 5:3762170b6d4d 2124 */
mbed_official 5:3762170b6d4d 2125 typedef struct
mbed_official 5:3762170b6d4d 2126 {
mbed_official 5:3762170b6d4d 2127 uint16_t fftLen; /**< length of the FFT. */
mbed_official 5:3762170b6d4d 2128 const q31_t *pTwiddle; /**< points to the Twiddle factor table. */
mbed_official 5:3762170b6d4d 2129 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 5:3762170b6d4d 2130 uint16_t bitRevLength; /**< bit reversal table length. */
mbed_official 5:3762170b6d4d 2131 } arm_cfft_instance_q31;
mbed_official 5:3762170b6d4d 2132
mbed_official 5:3762170b6d4d 2133 void arm_cfft_q31(
mbed_official 5:3762170b6d4d 2134 const arm_cfft_instance_q31 * S,
mbed_official 5:3762170b6d4d 2135 q31_t * p1,
mbed_official 5:3762170b6d4d 2136 uint8_t ifftFlag,
mbed_official 5:3762170b6d4d 2137 uint8_t bitReverseFlag);
mbed_official 5:3762170b6d4d 2138
mbed_official 5:3762170b6d4d 2139 /**
mbed_official 3:7a284390b0ce 2140 * @brief Instance structure for the floating-point CFFT/CIFFT function.
mbed_official 3:7a284390b0ce 2141 */
mbed_official 3:7a284390b0ce 2142 typedef struct
mbed_official 3:7a284390b0ce 2143 {
mbed_official 3:7a284390b0ce 2144 uint16_t fftLen; /**< length of the FFT. */
mbed_official 3:7a284390b0ce 2145 const float32_t *pTwiddle; /**< points to the Twiddle factor table. */
mbed_official 3:7a284390b0ce 2146 const uint16_t *pBitRevTable; /**< points to the bit reversal table. */
mbed_official 3:7a284390b0ce 2147 uint16_t bitRevLength; /**< bit reversal table length. */
mbed_official 3:7a284390b0ce 2148 } arm_cfft_instance_f32;
mbed_official 3:7a284390b0ce 2149
mbed_official 3:7a284390b0ce 2150 void arm_cfft_f32(
mbed_official 3:7a284390b0ce 2151 const arm_cfft_instance_f32 * S,
mbed_official 3:7a284390b0ce 2152 float32_t * p1,
mbed_official 3:7a284390b0ce 2153 uint8_t ifftFlag,
mbed_official 3:7a284390b0ce 2154 uint8_t bitReverseFlag);
emilmont 1:fdd22bb7aa52 2155
emilmont 1:fdd22bb7aa52 2156 /**
emilmont 1:fdd22bb7aa52 2157 * @brief Instance structure for the Q15 RFFT/RIFFT function.
emilmont 1:fdd22bb7aa52 2158 */
emilmont 1:fdd22bb7aa52 2159 typedef struct
emilmont 1:fdd22bb7aa52 2160 {
emilmont 1:fdd22bb7aa52 2161 uint32_t fftLenReal; /**< length of the real FFT. */
emilmont 1:fdd22bb7aa52 2162 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
mbed_official 5:3762170b6d4d 2163 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
emilmont 1:fdd22bb7aa52 2164 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 2165 q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
emilmont 1:fdd22bb7aa52 2166 q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
mbed_official 5:3762170b6d4d 2167 const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2168 } arm_rfft_instance_q15;
emilmont 1:fdd22bb7aa52 2169
mbed_official 3:7a284390b0ce 2170 arm_status arm_rfft_init_q15(
mbed_official 3:7a284390b0ce 2171 arm_rfft_instance_q15 * S,
mbed_official 3:7a284390b0ce 2172 uint32_t fftLenReal,
mbed_official 3:7a284390b0ce 2173 uint32_t ifftFlagR,
mbed_official 3:7a284390b0ce 2174 uint32_t bitReverseFlag);
mbed_official 3:7a284390b0ce 2175
mbed_official 3:7a284390b0ce 2176 void arm_rfft_q15(
mbed_official 3:7a284390b0ce 2177 const arm_rfft_instance_q15 * S,
mbed_official 3:7a284390b0ce 2178 q15_t * pSrc,
mbed_official 3:7a284390b0ce 2179 q15_t * pDst);
mbed_official 3:7a284390b0ce 2180
emilmont 1:fdd22bb7aa52 2181 /**
emilmont 1:fdd22bb7aa52 2182 * @brief Instance structure for the Q31 RFFT/RIFFT function.
emilmont 1:fdd22bb7aa52 2183 */
emilmont 1:fdd22bb7aa52 2184 typedef struct
emilmont 1:fdd22bb7aa52 2185 {
emilmont 1:fdd22bb7aa52 2186 uint32_t fftLenReal; /**< length of the real FFT. */
emilmont 1:fdd22bb7aa52 2187 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
mbed_official 5:3762170b6d4d 2188 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
emilmont 1:fdd22bb7aa52 2189 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 2190 q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
emilmont 1:fdd22bb7aa52 2191 q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
mbed_official 5:3762170b6d4d 2192 const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2193 } arm_rfft_instance_q31;
emilmont 1:fdd22bb7aa52 2194
mbed_official 3:7a284390b0ce 2195 arm_status arm_rfft_init_q31(
mbed_official 3:7a284390b0ce 2196 arm_rfft_instance_q31 * S,
mbed_official 3:7a284390b0ce 2197 uint32_t fftLenReal,
mbed_official 3:7a284390b0ce 2198 uint32_t ifftFlagR,
mbed_official 3:7a284390b0ce 2199 uint32_t bitReverseFlag);
mbed_official 3:7a284390b0ce 2200
mbed_official 3:7a284390b0ce 2201 void arm_rfft_q31(
mbed_official 3:7a284390b0ce 2202 const arm_rfft_instance_q31 * S,
mbed_official 3:7a284390b0ce 2203 q31_t * pSrc,
mbed_official 3:7a284390b0ce 2204 q31_t * pDst);
mbed_official 3:7a284390b0ce 2205
emilmont 1:fdd22bb7aa52 2206 /**
emilmont 1:fdd22bb7aa52 2207 * @brief Instance structure for the floating-point RFFT/RIFFT function.
emilmont 1:fdd22bb7aa52 2208 */
emilmont 1:fdd22bb7aa52 2209 typedef struct
emilmont 1:fdd22bb7aa52 2210 {
emilmont 1:fdd22bb7aa52 2211 uint32_t fftLenReal; /**< length of the real FFT. */
emilmont 1:fdd22bb7aa52 2212 uint16_t fftLenBy2; /**< length of the complex FFT. */
emilmont 1:fdd22bb7aa52 2213 uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */
emilmont 1:fdd22bb7aa52 2214 uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */
emilmont 1:fdd22bb7aa52 2215 uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */
emilmont 1:fdd22bb7aa52 2216 float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */
emilmont 1:fdd22bb7aa52 2217 float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */
emilmont 1:fdd22bb7aa52 2218 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2219 } arm_rfft_instance_f32;
emilmont 1:fdd22bb7aa52 2220
emilmont 1:fdd22bb7aa52 2221 arm_status arm_rfft_init_f32(
emilmont 1:fdd22bb7aa52 2222 arm_rfft_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2223 arm_cfft_radix4_instance_f32 * S_CFFT,
emilmont 1:fdd22bb7aa52 2224 uint32_t fftLenReal,
emilmont 1:fdd22bb7aa52 2225 uint32_t ifftFlagR,
emilmont 1:fdd22bb7aa52 2226 uint32_t bitReverseFlag);
emilmont 1:fdd22bb7aa52 2227
emilmont 1:fdd22bb7aa52 2228 void arm_rfft_f32(
emilmont 1:fdd22bb7aa52 2229 const arm_rfft_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2230 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2231 float32_t * pDst);
emilmont 1:fdd22bb7aa52 2232
emilmont 1:fdd22bb7aa52 2233 /**
mbed_official 3:7a284390b0ce 2234 * @brief Instance structure for the floating-point RFFT/RIFFT function.
mbed_official 3:7a284390b0ce 2235 */
mbed_official 3:7a284390b0ce 2236 typedef struct
mbed_official 3:7a284390b0ce 2237 {
mbed_official 3:7a284390b0ce 2238 arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */
mbed_official 5:3762170b6d4d 2239 uint16_t fftLenRFFT; /**< length of the real sequence */
mbed_official 5:3762170b6d4d 2240 float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */
mbed_official 3:7a284390b0ce 2241 } arm_rfft_fast_instance_f32 ;
mbed_official 3:7a284390b0ce 2242
mbed_official 3:7a284390b0ce 2243 arm_status arm_rfft_fast_init_f32 (
mbed_official 5:3762170b6d4d 2244 arm_rfft_fast_instance_f32 * S,
mbed_official 5:3762170b6d4d 2245 uint16_t fftLen);
mbed_official 3:7a284390b0ce 2246
mbed_official 3:7a284390b0ce 2247 void arm_rfft_fast_f32(
mbed_official 3:7a284390b0ce 2248 arm_rfft_fast_instance_f32 * S,
mbed_official 3:7a284390b0ce 2249 float32_t * p, float32_t * pOut,
mbed_official 3:7a284390b0ce 2250 uint8_t ifftFlag);
mbed_official 3:7a284390b0ce 2251
mbed_official 3:7a284390b0ce 2252 /**
emilmont 1:fdd22bb7aa52 2253 * @brief Instance structure for the floating-point DCT4/IDCT4 function.
emilmont 1:fdd22bb7aa52 2254 */
emilmont 1:fdd22bb7aa52 2255 typedef struct
emilmont 1:fdd22bb7aa52 2256 {
mbed_official 5:3762170b6d4d 2257 uint16_t N; /**< length of the DCT4. */
mbed_official 5:3762170b6d4d 2258 uint16_t Nby2; /**< half of the length of the DCT4. */
mbed_official 5:3762170b6d4d 2259 float32_t normalize; /**< normalizing factor. */
mbed_official 5:3762170b6d4d 2260 float32_t *pTwiddle; /**< points to the twiddle factor table. */
mbed_official 5:3762170b6d4d 2261 float32_t *pCosFactor; /**< points to the cosFactor table. */
emilmont 1:fdd22bb7aa52 2262 arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */
emilmont 1:fdd22bb7aa52 2263 arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2264 } arm_dct4_instance_f32;
emilmont 1:fdd22bb7aa52 2265
mbed_official 5:3762170b6d4d 2266
emilmont 1:fdd22bb7aa52 2267 /**
emilmont 1:fdd22bb7aa52 2268 * @brief Initialization function for the floating-point DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2269 * @param[in,out] S points to an instance of floating-point DCT4/IDCT4 structure.
mbed_official 5:3762170b6d4d 2270 * @param[in] S_RFFT points to an instance of floating-point RFFT/RIFFT structure.
mbed_official 5:3762170b6d4d 2271 * @param[in] S_CFFT points to an instance of floating-point CFFT/CIFFT structure.
emilmont 1:fdd22bb7aa52 2272 * @param[in] N length of the DCT4.
emilmont 1:fdd22bb7aa52 2273 * @param[in] Nby2 half of the length of the DCT4.
emilmont 1:fdd22bb7aa52 2274 * @param[in] normalize normalizing factor.
mbed_official 5:3762170b6d4d 2275 * @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.
mbed_official 5:3762170b6d4d 2276 */
emilmont 1:fdd22bb7aa52 2277 arm_status arm_dct4_init_f32(
emilmont 1:fdd22bb7aa52 2278 arm_dct4_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2279 arm_rfft_instance_f32 * S_RFFT,
emilmont 1:fdd22bb7aa52 2280 arm_cfft_radix4_instance_f32 * S_CFFT,
emilmont 1:fdd22bb7aa52 2281 uint16_t N,
emilmont 1:fdd22bb7aa52 2282 uint16_t Nby2,
emilmont 1:fdd22bb7aa52 2283 float32_t normalize);
emilmont 1:fdd22bb7aa52 2284
mbed_official 5:3762170b6d4d 2285
emilmont 1:fdd22bb7aa52 2286 /**
emilmont 1:fdd22bb7aa52 2287 * @brief Processing function for the floating-point DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2288 * @param[in] S points to an instance of the floating-point DCT4/IDCT4 structure.
mbed_official 5:3762170b6d4d 2289 * @param[in] pState points to state buffer.
mbed_official 5:3762170b6d4d 2290 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
mbed_official 5:3762170b6d4d 2291 */
emilmont 1:fdd22bb7aa52 2292 void arm_dct4_f32(
emilmont 1:fdd22bb7aa52 2293 const arm_dct4_instance_f32 * S,
emilmont 1:fdd22bb7aa52 2294 float32_t * pState,
emilmont 1:fdd22bb7aa52 2295 float32_t * pInlineBuffer);
emilmont 1:fdd22bb7aa52 2296
mbed_official 5:3762170b6d4d 2297
emilmont 1:fdd22bb7aa52 2298 /**
emilmont 1:fdd22bb7aa52 2299 * @brief Instance structure for the Q31 DCT4/IDCT4 function.
emilmont 1:fdd22bb7aa52 2300 */
emilmont 1:fdd22bb7aa52 2301 typedef struct
emilmont 1:fdd22bb7aa52 2302 {
mbed_official 5:3762170b6d4d 2303 uint16_t N; /**< length of the DCT4. */
mbed_official 5:3762170b6d4d 2304 uint16_t Nby2; /**< half of the length of the DCT4. */
mbed_official 5:3762170b6d4d 2305 q31_t normalize; /**< normalizing factor. */
mbed_official 5:3762170b6d4d 2306 q31_t *pTwiddle; /**< points to the twiddle factor table. */
mbed_official 5:3762170b6d4d 2307 q31_t *pCosFactor; /**< points to the cosFactor table. */
emilmont 1:fdd22bb7aa52 2308 arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */
emilmont 1:fdd22bb7aa52 2309 arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2310 } arm_dct4_instance_q31;
emilmont 1:fdd22bb7aa52 2311
mbed_official 5:3762170b6d4d 2312
emilmont 1:fdd22bb7aa52 2313 /**
emilmont 1:fdd22bb7aa52 2314 * @brief Initialization function for the Q31 DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2315 * @param[in,out] S points to an instance of Q31 DCT4/IDCT4 structure.
mbed_official 5:3762170b6d4d 2316 * @param[in] S_RFFT points to an instance of Q31 RFFT/RIFFT structure
mbed_official 5:3762170b6d4d 2317 * @param[in] S_CFFT points to an instance of Q31 CFFT/CIFFT structure
emilmont 1:fdd22bb7aa52 2318 * @param[in] N length of the DCT4.
emilmont 1:fdd22bb7aa52 2319 * @param[in] Nby2 half of the length of the DCT4.
emilmont 1:fdd22bb7aa52 2320 * @param[in] normalize normalizing factor.
mbed_official 5:3762170b6d4d 2321 * @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.
mbed_official 5:3762170b6d4d 2322 */
emilmont 1:fdd22bb7aa52 2323 arm_status arm_dct4_init_q31(
emilmont 1:fdd22bb7aa52 2324 arm_dct4_instance_q31 * S,
emilmont 1:fdd22bb7aa52 2325 arm_rfft_instance_q31 * S_RFFT,
emilmont 1:fdd22bb7aa52 2326 arm_cfft_radix4_instance_q31 * S_CFFT,
emilmont 1:fdd22bb7aa52 2327 uint16_t N,
emilmont 1:fdd22bb7aa52 2328 uint16_t Nby2,
emilmont 1:fdd22bb7aa52 2329 q31_t normalize);
emilmont 1:fdd22bb7aa52 2330
mbed_official 5:3762170b6d4d 2331
emilmont 1:fdd22bb7aa52 2332 /**
emilmont 1:fdd22bb7aa52 2333 * @brief Processing function for the Q31 DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2334 * @param[in] S points to an instance of the Q31 DCT4 structure.
mbed_official 5:3762170b6d4d 2335 * @param[in] pState points to state buffer.
mbed_official 5:3762170b6d4d 2336 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
mbed_official 5:3762170b6d4d 2337 */
emilmont 1:fdd22bb7aa52 2338 void arm_dct4_q31(
emilmont 1:fdd22bb7aa52 2339 const arm_dct4_instance_q31 * S,
emilmont 1:fdd22bb7aa52 2340 q31_t * pState,
emilmont 1:fdd22bb7aa52 2341 q31_t * pInlineBuffer);
emilmont 1:fdd22bb7aa52 2342
mbed_official 5:3762170b6d4d 2343
emilmont 1:fdd22bb7aa52 2344 /**
emilmont 1:fdd22bb7aa52 2345 * @brief Instance structure for the Q15 DCT4/IDCT4 function.
emilmont 1:fdd22bb7aa52 2346 */
emilmont 1:fdd22bb7aa52 2347 typedef struct
emilmont 1:fdd22bb7aa52 2348 {
mbed_official 5:3762170b6d4d 2349 uint16_t N; /**< length of the DCT4. */
mbed_official 5:3762170b6d4d 2350 uint16_t Nby2; /**< half of the length of the DCT4. */
mbed_official 5:3762170b6d4d 2351 q15_t normalize; /**< normalizing factor. */
mbed_official 5:3762170b6d4d 2352 q15_t *pTwiddle; /**< points to the twiddle factor table. */
mbed_official 5:3762170b6d4d 2353 q15_t *pCosFactor; /**< points to the cosFactor table. */
emilmont 1:fdd22bb7aa52 2354 arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */
emilmont 1:fdd22bb7aa52 2355 arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */
emilmont 1:fdd22bb7aa52 2356 } arm_dct4_instance_q15;
emilmont 1:fdd22bb7aa52 2357
mbed_official 5:3762170b6d4d 2358
emilmont 1:fdd22bb7aa52 2359 /**
emilmont 1:fdd22bb7aa52 2360 * @brief Initialization function for the Q15 DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2361 * @param[in,out] S points to an instance of Q15 DCT4/IDCT4 structure.
mbed_official 5:3762170b6d4d 2362 * @param[in] S_RFFT points to an instance of Q15 RFFT/RIFFT structure.
mbed_official 5:3762170b6d4d 2363 * @param[in] S_CFFT points to an instance of Q15 CFFT/CIFFT structure.
emilmont 1:fdd22bb7aa52 2364 * @param[in] N length of the DCT4.
emilmont 1:fdd22bb7aa52 2365 * @param[in] Nby2 half of the length of the DCT4.
emilmont 1:fdd22bb7aa52 2366 * @param[in] normalize normalizing factor.
mbed_official 5:3762170b6d4d 2367 * @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.
mbed_official 5:3762170b6d4d 2368 */
emilmont 1:fdd22bb7aa52 2369 arm_status arm_dct4_init_q15(
emilmont 1:fdd22bb7aa52 2370 arm_dct4_instance_q15 * S,
emilmont 1:fdd22bb7aa52 2371 arm_rfft_instance_q15 * S_RFFT,
emilmont 1:fdd22bb7aa52 2372 arm_cfft_radix4_instance_q15 * S_CFFT,
emilmont 1:fdd22bb7aa52 2373 uint16_t N,
emilmont 1:fdd22bb7aa52 2374 uint16_t Nby2,
emilmont 1:fdd22bb7aa52 2375 q15_t normalize);
emilmont 1:fdd22bb7aa52 2376
mbed_official 5:3762170b6d4d 2377
emilmont 1:fdd22bb7aa52 2378 /**
emilmont 1:fdd22bb7aa52 2379 * @brief Processing function for the Q15 DCT4/IDCT4.
mbed_official 5:3762170b6d4d 2380 * @param[in] S points to an instance of the Q15 DCT4 structure.
mbed_official 5:3762170b6d4d 2381 * @param[in] pState points to state buffer.
mbed_official 5:3762170b6d4d 2382 * @param[in,out] pInlineBuffer points to the in-place input and output buffer.
mbed_official 5:3762170b6d4d 2383 */
emilmont 1:fdd22bb7aa52 2384 void arm_dct4_q15(
emilmont 1:fdd22bb7aa52 2385 const arm_dct4_instance_q15 * S,
emilmont 1:fdd22bb7aa52 2386 q15_t * pState,
emilmont 1:fdd22bb7aa52 2387 q15_t * pInlineBuffer);
emilmont 1:fdd22bb7aa52 2388
mbed_official 5:3762170b6d4d 2389
emilmont 1:fdd22bb7aa52 2390 /**
emilmont 1:fdd22bb7aa52 2391 * @brief Floating-point vector addition.
mbed_official 5:3762170b6d4d 2392 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2393 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2394 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2395 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2396 */
emilmont 1:fdd22bb7aa52 2397 void arm_add_f32(
emilmont 1:fdd22bb7aa52 2398 float32_t * pSrcA,
emilmont 1:fdd22bb7aa52 2399 float32_t * pSrcB,
emilmont 1:fdd22bb7aa52 2400 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2401 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2402
mbed_official 5:3762170b6d4d 2403
emilmont 1:fdd22bb7aa52 2404 /**
emilmont 1:fdd22bb7aa52 2405 * @brief Q7 vector addition.
mbed_official 5:3762170b6d4d 2406 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2407 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2408 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2409 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2410 */
emilmont 1:fdd22bb7aa52 2411 void arm_add_q7(
emilmont 1:fdd22bb7aa52 2412 q7_t * pSrcA,
emilmont 1:fdd22bb7aa52 2413 q7_t * pSrcB,
emilmont 1:fdd22bb7aa52 2414 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2415 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2416
mbed_official 5:3762170b6d4d 2417
emilmont 1:fdd22bb7aa52 2418 /**
emilmont 1:fdd22bb7aa52 2419 * @brief Q15 vector addition.
mbed_official 5:3762170b6d4d 2420 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2421 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2422 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2423 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2424 */
emilmont 1:fdd22bb7aa52 2425 void arm_add_q15(
emilmont 1:fdd22bb7aa52 2426 q15_t * pSrcA,
emilmont 1:fdd22bb7aa52 2427 q15_t * pSrcB,
emilmont 1:fdd22bb7aa52 2428 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2429 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2430
mbed_official 5:3762170b6d4d 2431
emilmont 1:fdd22bb7aa52 2432 /**
emilmont 1:fdd22bb7aa52 2433 * @brief Q31 vector addition.
mbed_official 5:3762170b6d4d 2434 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2435 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2436 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2437 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2438 */
emilmont 1:fdd22bb7aa52 2439 void arm_add_q31(
emilmont 1:fdd22bb7aa52 2440 q31_t * pSrcA,
emilmont 1:fdd22bb7aa52 2441 q31_t * pSrcB,
emilmont 1:fdd22bb7aa52 2442 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2443 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2444
mbed_official 5:3762170b6d4d 2445
emilmont 1:fdd22bb7aa52 2446 /**
emilmont 1:fdd22bb7aa52 2447 * @brief Floating-point vector subtraction.
mbed_official 5:3762170b6d4d 2448 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2449 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2450 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2451 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2452 */
emilmont 1:fdd22bb7aa52 2453 void arm_sub_f32(
emilmont 1:fdd22bb7aa52 2454 float32_t * pSrcA,
emilmont 1:fdd22bb7aa52 2455 float32_t * pSrcB,
emilmont 1:fdd22bb7aa52 2456 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2457 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2458
mbed_official 5:3762170b6d4d 2459
emilmont 1:fdd22bb7aa52 2460 /**
emilmont 1:fdd22bb7aa52 2461 * @brief Q7 vector subtraction.
mbed_official 5:3762170b6d4d 2462 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2463 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2464 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2465 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2466 */
emilmont 1:fdd22bb7aa52 2467 void arm_sub_q7(
emilmont 1:fdd22bb7aa52 2468 q7_t * pSrcA,
emilmont 1:fdd22bb7aa52 2469 q7_t * pSrcB,
emilmont 1:fdd22bb7aa52 2470 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2471 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2472
mbed_official 5:3762170b6d4d 2473
emilmont 1:fdd22bb7aa52 2474 /**
emilmont 1:fdd22bb7aa52 2475 * @brief Q15 vector subtraction.
mbed_official 5:3762170b6d4d 2476 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2477 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2478 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2479 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2480 */
emilmont 1:fdd22bb7aa52 2481 void arm_sub_q15(
emilmont 1:fdd22bb7aa52 2482 q15_t * pSrcA,
emilmont 1:fdd22bb7aa52 2483 q15_t * pSrcB,
emilmont 1:fdd22bb7aa52 2484 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2485 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2486
mbed_official 5:3762170b6d4d 2487
emilmont 1:fdd22bb7aa52 2488 /**
emilmont 1:fdd22bb7aa52 2489 * @brief Q31 vector subtraction.
mbed_official 5:3762170b6d4d 2490 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2491 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2492 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2493 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2494 */
emilmont 1:fdd22bb7aa52 2495 void arm_sub_q31(
emilmont 1:fdd22bb7aa52 2496 q31_t * pSrcA,
emilmont 1:fdd22bb7aa52 2497 q31_t * pSrcB,
emilmont 1:fdd22bb7aa52 2498 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2499 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2500
mbed_official 5:3762170b6d4d 2501
emilmont 1:fdd22bb7aa52 2502 /**
emilmont 1:fdd22bb7aa52 2503 * @brief Multiplies a floating-point vector by a scalar.
mbed_official 5:3762170b6d4d 2504 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2505 * @param[in] scale scale factor to be applied
mbed_official 5:3762170b6d4d 2506 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2507 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2508 */
emilmont 1:fdd22bb7aa52 2509 void arm_scale_f32(
emilmont 1:fdd22bb7aa52 2510 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2511 float32_t scale,
emilmont 1:fdd22bb7aa52 2512 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2513 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2514
mbed_official 5:3762170b6d4d 2515
emilmont 1:fdd22bb7aa52 2516 /**
emilmont 1:fdd22bb7aa52 2517 * @brief Multiplies a Q7 vector by a scalar.
mbed_official 5:3762170b6d4d 2518 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2519 * @param[in] scaleFract fractional portion of the scale value
mbed_official 5:3762170b6d4d 2520 * @param[in] shift number of bits to shift the result by
mbed_official 5:3762170b6d4d 2521 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2522 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2523 */
emilmont 1:fdd22bb7aa52 2524 void arm_scale_q7(
emilmont 1:fdd22bb7aa52 2525 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2526 q7_t scaleFract,
emilmont 1:fdd22bb7aa52 2527 int8_t shift,
emilmont 1:fdd22bb7aa52 2528 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2529 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2530
mbed_official 5:3762170b6d4d 2531
emilmont 1:fdd22bb7aa52 2532 /**
emilmont 1:fdd22bb7aa52 2533 * @brief Multiplies a Q15 vector by a scalar.
mbed_official 5:3762170b6d4d 2534 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2535 * @param[in] scaleFract fractional portion of the scale value
mbed_official 5:3762170b6d4d 2536 * @param[in] shift number of bits to shift the result by
mbed_official 5:3762170b6d4d 2537 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2538 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2539 */
emilmont 1:fdd22bb7aa52 2540 void arm_scale_q15(
emilmont 1:fdd22bb7aa52 2541 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2542 q15_t scaleFract,
emilmont 1:fdd22bb7aa52 2543 int8_t shift,
emilmont 1:fdd22bb7aa52 2544 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2545 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2546
mbed_official 5:3762170b6d4d 2547
emilmont 1:fdd22bb7aa52 2548 /**
emilmont 1:fdd22bb7aa52 2549 * @brief Multiplies a Q31 vector by a scalar.
mbed_official 5:3762170b6d4d 2550 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2551 * @param[in] scaleFract fractional portion of the scale value
mbed_official 5:3762170b6d4d 2552 * @param[in] shift number of bits to shift the result by
mbed_official 5:3762170b6d4d 2553 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2554 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2555 */
emilmont 1:fdd22bb7aa52 2556 void arm_scale_q31(
emilmont 1:fdd22bb7aa52 2557 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2558 q31_t scaleFract,
emilmont 1:fdd22bb7aa52 2559 int8_t shift,
emilmont 1:fdd22bb7aa52 2560 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2561 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2562
mbed_official 5:3762170b6d4d 2563
emilmont 1:fdd22bb7aa52 2564 /**
emilmont 1:fdd22bb7aa52 2565 * @brief Q7 vector absolute value.
mbed_official 5:3762170b6d4d 2566 * @param[in] pSrc points to the input buffer
mbed_official 5:3762170b6d4d 2567 * @param[out] pDst points to the output buffer
mbed_official 5:3762170b6d4d 2568 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2569 */
emilmont 1:fdd22bb7aa52 2570 void arm_abs_q7(
emilmont 1:fdd22bb7aa52 2571 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2572 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2573 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2574
mbed_official 5:3762170b6d4d 2575
emilmont 1:fdd22bb7aa52 2576 /**
emilmont 1:fdd22bb7aa52 2577 * @brief Floating-point vector absolute value.
mbed_official 5:3762170b6d4d 2578 * @param[in] pSrc points to the input buffer
mbed_official 5:3762170b6d4d 2579 * @param[out] pDst points to the output buffer
mbed_official 5:3762170b6d4d 2580 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2581 */
emilmont 1:fdd22bb7aa52 2582 void arm_abs_f32(
emilmont 1:fdd22bb7aa52 2583 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2584 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2585 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2586
mbed_official 5:3762170b6d4d 2587
emilmont 1:fdd22bb7aa52 2588 /**
emilmont 1:fdd22bb7aa52 2589 * @brief Q15 vector absolute value.
mbed_official 5:3762170b6d4d 2590 * @param[in] pSrc points to the input buffer
mbed_official 5:3762170b6d4d 2591 * @param[out] pDst points to the output buffer
mbed_official 5:3762170b6d4d 2592 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2593 */
emilmont 1:fdd22bb7aa52 2594 void arm_abs_q15(
emilmont 1:fdd22bb7aa52 2595 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2596 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2597 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2598
mbed_official 5:3762170b6d4d 2599
emilmont 1:fdd22bb7aa52 2600 /**
emilmont 1:fdd22bb7aa52 2601 * @brief Q31 vector absolute value.
mbed_official 5:3762170b6d4d 2602 * @param[in] pSrc points to the input buffer
mbed_official 5:3762170b6d4d 2603 * @param[out] pDst points to the output buffer
mbed_official 5:3762170b6d4d 2604 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2605 */
emilmont 1:fdd22bb7aa52 2606 void arm_abs_q31(
emilmont 1:fdd22bb7aa52 2607 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2608 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2609 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2610
mbed_official 5:3762170b6d4d 2611
emilmont 1:fdd22bb7aa52 2612 /**
emilmont 1:fdd22bb7aa52 2613 * @brief Dot product of floating-point vectors.
mbed_official 5:3762170b6d4d 2614 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2615 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2616 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2617 * @param[out] result output result returned here
mbed_official 5:3762170b6d4d 2618 */
emilmont 1:fdd22bb7aa52 2619 void arm_dot_prod_f32(
emilmont 1:fdd22bb7aa52 2620 float32_t * pSrcA,
emilmont 1:fdd22bb7aa52 2621 float32_t * pSrcB,
emilmont 1:fdd22bb7aa52 2622 uint32_t blockSize,
emilmont 1:fdd22bb7aa52 2623 float32_t * result);
emilmont 1:fdd22bb7aa52 2624
mbed_official 5:3762170b6d4d 2625
emilmont 1:fdd22bb7aa52 2626 /**
emilmont 1:fdd22bb7aa52 2627 * @brief Dot product of Q7 vectors.
mbed_official 5:3762170b6d4d 2628 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2629 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2630 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2631 * @param[out] result output result returned here
mbed_official 5:3762170b6d4d 2632 */
emilmont 1:fdd22bb7aa52 2633 void arm_dot_prod_q7(
emilmont 1:fdd22bb7aa52 2634 q7_t * pSrcA,
emilmont 1:fdd22bb7aa52 2635 q7_t * pSrcB,
emilmont 1:fdd22bb7aa52 2636 uint32_t blockSize,
emilmont 1:fdd22bb7aa52 2637 q31_t * result);
emilmont 1:fdd22bb7aa52 2638
mbed_official 5:3762170b6d4d 2639
emilmont 1:fdd22bb7aa52 2640 /**
emilmont 1:fdd22bb7aa52 2641 * @brief Dot product of Q15 vectors.
mbed_official 5:3762170b6d4d 2642 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2643 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2644 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2645 * @param[out] result output result returned here
mbed_official 5:3762170b6d4d 2646 */
emilmont 1:fdd22bb7aa52 2647 void arm_dot_prod_q15(
emilmont 1:fdd22bb7aa52 2648 q15_t * pSrcA,
emilmont 1:fdd22bb7aa52 2649 q15_t * pSrcB,
emilmont 1:fdd22bb7aa52 2650 uint32_t blockSize,
emilmont 1:fdd22bb7aa52 2651 q63_t * result);
emilmont 1:fdd22bb7aa52 2652
mbed_official 5:3762170b6d4d 2653
emilmont 1:fdd22bb7aa52 2654 /**
emilmont 1:fdd22bb7aa52 2655 * @brief Dot product of Q31 vectors.
mbed_official 5:3762170b6d4d 2656 * @param[in] pSrcA points to the first input vector
mbed_official 5:3762170b6d4d 2657 * @param[in] pSrcB points to the second input vector
mbed_official 5:3762170b6d4d 2658 * @param[in] blockSize number of samples in each vector
mbed_official 5:3762170b6d4d 2659 * @param[out] result output result returned here
mbed_official 5:3762170b6d4d 2660 */
emilmont 1:fdd22bb7aa52 2661 void arm_dot_prod_q31(
emilmont 1:fdd22bb7aa52 2662 q31_t * pSrcA,
emilmont 1:fdd22bb7aa52 2663 q31_t * pSrcB,
emilmont 1:fdd22bb7aa52 2664 uint32_t blockSize,
emilmont 1:fdd22bb7aa52 2665 q63_t * result);
emilmont 1:fdd22bb7aa52 2666
mbed_official 5:3762170b6d4d 2667
emilmont 1:fdd22bb7aa52 2668 /**
emilmont 1:fdd22bb7aa52 2669 * @brief Shifts the elements of a Q7 vector a specified number of bits.
mbed_official 5:3762170b6d4d 2670 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2671 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
mbed_official 5:3762170b6d4d 2672 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2673 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2674 */
emilmont 1:fdd22bb7aa52 2675 void arm_shift_q7(
emilmont 1:fdd22bb7aa52 2676 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2677 int8_t shiftBits,
emilmont 1:fdd22bb7aa52 2678 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2679 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2680
mbed_official 5:3762170b6d4d 2681
emilmont 1:fdd22bb7aa52 2682 /**
emilmont 1:fdd22bb7aa52 2683 * @brief Shifts the elements of a Q15 vector a specified number of bits.
mbed_official 5:3762170b6d4d 2684 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2685 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
mbed_official 5:3762170b6d4d 2686 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2687 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2688 */
emilmont 1:fdd22bb7aa52 2689 void arm_shift_q15(
emilmont 1:fdd22bb7aa52 2690 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2691 int8_t shiftBits,
emilmont 1:fdd22bb7aa52 2692 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2693 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2694
mbed_official 5:3762170b6d4d 2695
emilmont 1:fdd22bb7aa52 2696 /**
emilmont 1:fdd22bb7aa52 2697 * @brief Shifts the elements of a Q31 vector a specified number of bits.
mbed_official 5:3762170b6d4d 2698 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2699 * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right.
mbed_official 5:3762170b6d4d 2700 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2701 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2702 */
emilmont 1:fdd22bb7aa52 2703 void arm_shift_q31(
emilmont 1:fdd22bb7aa52 2704 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2705 int8_t shiftBits,
emilmont 1:fdd22bb7aa52 2706 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2707 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2708
mbed_official 5:3762170b6d4d 2709
emilmont 1:fdd22bb7aa52 2710 /**
emilmont 1:fdd22bb7aa52 2711 * @brief Adds a constant offset to a floating-point vector.
mbed_official 5:3762170b6d4d 2712 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2713 * @param[in] offset is the offset to be added
mbed_official 5:3762170b6d4d 2714 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2715 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2716 */
emilmont 1:fdd22bb7aa52 2717 void arm_offset_f32(
emilmont 1:fdd22bb7aa52 2718 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2719 float32_t offset,
emilmont 1:fdd22bb7aa52 2720 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2721 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2722
mbed_official 5:3762170b6d4d 2723
emilmont 1:fdd22bb7aa52 2724 /**
emilmont 1:fdd22bb7aa52 2725 * @brief Adds a constant offset to a Q7 vector.
mbed_official 5:3762170b6d4d 2726 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2727 * @param[in] offset is the offset to be added
mbed_official 5:3762170b6d4d 2728 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2729 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2730 */
emilmont 1:fdd22bb7aa52 2731 void arm_offset_q7(
emilmont 1:fdd22bb7aa52 2732 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2733 q7_t offset,
emilmont 1:fdd22bb7aa52 2734 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2735 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2736
mbed_official 5:3762170b6d4d 2737
emilmont 1:fdd22bb7aa52 2738 /**
emilmont 1:fdd22bb7aa52 2739 * @brief Adds a constant offset to a Q15 vector.
mbed_official 5:3762170b6d4d 2740 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2741 * @param[in] offset is the offset to be added
mbed_official 5:3762170b6d4d 2742 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2743 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2744 */
emilmont 1:fdd22bb7aa52 2745 void arm_offset_q15(
emilmont 1:fdd22bb7aa52 2746 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2747 q15_t offset,
emilmont 1:fdd22bb7aa52 2748 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2749 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2750
mbed_official 5:3762170b6d4d 2751
emilmont 1:fdd22bb7aa52 2752 /**
emilmont 1:fdd22bb7aa52 2753 * @brief Adds a constant offset to a Q31 vector.
mbed_official 5:3762170b6d4d 2754 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2755 * @param[in] offset is the offset to be added
mbed_official 5:3762170b6d4d 2756 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2757 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2758 */
emilmont 1:fdd22bb7aa52 2759 void arm_offset_q31(
emilmont 1:fdd22bb7aa52 2760 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2761 q31_t offset,
emilmont 1:fdd22bb7aa52 2762 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2763 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2764
mbed_official 5:3762170b6d4d 2765
emilmont 1:fdd22bb7aa52 2766 /**
emilmont 1:fdd22bb7aa52 2767 * @brief Negates the elements of a floating-point vector.
mbed_official 5:3762170b6d4d 2768 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2769 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2770 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2771 */
emilmont 1:fdd22bb7aa52 2772 void arm_negate_f32(
emilmont 1:fdd22bb7aa52 2773 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2774 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2775 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2776
mbed_official 5:3762170b6d4d 2777
emilmont 1:fdd22bb7aa52 2778 /**
emilmont 1:fdd22bb7aa52 2779 * @brief Negates the elements of a Q7 vector.
mbed_official 5:3762170b6d4d 2780 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2781 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2782 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2783 */
emilmont 1:fdd22bb7aa52 2784 void arm_negate_q7(
emilmont 1:fdd22bb7aa52 2785 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2786 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2787 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2788
mbed_official 5:3762170b6d4d 2789
emilmont 1:fdd22bb7aa52 2790 /**
emilmont 1:fdd22bb7aa52 2791 * @brief Negates the elements of a Q15 vector.
mbed_official 5:3762170b6d4d 2792 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2793 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2794 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2795 */
emilmont 1:fdd22bb7aa52 2796 void arm_negate_q15(
emilmont 1:fdd22bb7aa52 2797 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2798 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2799 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2800
mbed_official 5:3762170b6d4d 2801
emilmont 1:fdd22bb7aa52 2802 /**
emilmont 1:fdd22bb7aa52 2803 * @brief Negates the elements of a Q31 vector.
mbed_official 5:3762170b6d4d 2804 * @param[in] pSrc points to the input vector
mbed_official 5:3762170b6d4d 2805 * @param[out] pDst points to the output vector
mbed_official 5:3762170b6d4d 2806 * @param[in] blockSize number of samples in the vector
mbed_official 5:3762170b6d4d 2807 */
emilmont 1:fdd22bb7aa52 2808 void arm_negate_q31(
emilmont 1:fdd22bb7aa52 2809 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2810 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2811 uint32_t blockSize);
mbed_official 5:3762170b6d4d 2812
mbed_official 5:3762170b6d4d 2813
emilmont 1:fdd22bb7aa52 2814 /**
mbed_official 3:7a284390b0ce 2815 * @brief Copies the elements of a floating-point vector.
mbed_official 5:3762170b6d4d 2816 * @param[in] pSrc input pointer
mbed_official 5:3762170b6d4d 2817 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2818 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2819 */
emilmont 1:fdd22bb7aa52 2820 void arm_copy_f32(
emilmont 1:fdd22bb7aa52 2821 float32_t * pSrc,
emilmont 1:fdd22bb7aa52 2822 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2823 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2824
mbed_official 5:3762170b6d4d 2825
emilmont 1:fdd22bb7aa52 2826 /**
mbed_official 3:7a284390b0ce 2827 * @brief Copies the elements of a Q7 vector.
mbed_official 5:3762170b6d4d 2828 * @param[in] pSrc input pointer
mbed_official 5:3762170b6d4d 2829 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2830 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2831 */
emilmont 1:fdd22bb7aa52 2832 void arm_copy_q7(
emilmont 1:fdd22bb7aa52 2833 q7_t * pSrc,
emilmont 1:fdd22bb7aa52 2834 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2835 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2836
mbed_official 5:3762170b6d4d 2837
emilmont 1:fdd22bb7aa52 2838 /**
mbed_official 3:7a284390b0ce 2839 * @brief Copies the elements of a Q15 vector.
mbed_official 5:3762170b6d4d 2840 * @param[in] pSrc input pointer
mbed_official 5:3762170b6d4d 2841 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2842 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2843 */
emilmont 1:fdd22bb7aa52 2844 void arm_copy_q15(
emilmont 1:fdd22bb7aa52 2845 q15_t * pSrc,
emilmont 1:fdd22bb7aa52 2846 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2847 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2848
mbed_official 5:3762170b6d4d 2849
emilmont 1:fdd22bb7aa52 2850 /**
mbed_official 3:7a284390b0ce 2851 * @brief Copies the elements of a Q31 vector.
mbed_official 5:3762170b6d4d 2852 * @param[in] pSrc input pointer
mbed_official 5:3762170b6d4d 2853 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2854 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2855 */
emilmont 1:fdd22bb7aa52 2856 void arm_copy_q31(
emilmont 1:fdd22bb7aa52 2857 q31_t * pSrc,
emilmont 1:fdd22bb7aa52 2858 q31_t * pDst,
emilmont 1:fdd22bb7aa52 2859 uint32_t blockSize);
mbed_official 5:3762170b6d4d 2860
mbed_official 5:3762170b6d4d 2861
emilmont 1:fdd22bb7aa52 2862 /**
mbed_official 3:7a284390b0ce 2863 * @brief Fills a constant value into a floating-point vector.
mbed_official 5:3762170b6d4d 2864 * @param[in] value input value to be filled
mbed_official 5:3762170b6d4d 2865 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2866 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2867 */
emilmont 1:fdd22bb7aa52 2868 void arm_fill_f32(
emilmont 1:fdd22bb7aa52 2869 float32_t value,
emilmont 1:fdd22bb7aa52 2870 float32_t * pDst,
emilmont 1:fdd22bb7aa52 2871 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2872
mbed_official 5:3762170b6d4d 2873
emilmont 1:fdd22bb7aa52 2874 /**
mbed_official 3:7a284390b0ce 2875 * @brief Fills a constant value into a Q7 vector.
mbed_official 5:3762170b6d4d 2876 * @param[in] value input value to be filled
mbed_official 5:3762170b6d4d 2877 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2878 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2879 */
emilmont 1:fdd22bb7aa52 2880 void arm_fill_q7(
emilmont 1:fdd22bb7aa52 2881 q7_t value,
emilmont 1:fdd22bb7aa52 2882 q7_t * pDst,
emilmont 1:fdd22bb7aa52 2883 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2884
mbed_official 5:3762170b6d4d 2885
emilmont 1:fdd22bb7aa52 2886 /**
mbed_official 3:7a284390b0ce 2887 * @brief Fills a constant value into a Q15 vector.
mbed_official 5:3762170b6d4d 2888 * @param[in] value input value to be filled
mbed_official 5:3762170b6d4d 2889 * @param[out] pDst output pointer
mbed_official 5:3762170b6d4d 2890 * @param[in] blockSize number of samples to process
emilmont 1:fdd22bb7aa52 2891 */
emilmont 1:fdd22bb7aa52 2892 void arm_fill_q15(
emilmont 1:fdd22bb7aa52 2893 q15_t value,
emilmont 1:fdd22bb7aa52 2894 q15_t * pDst,
emilmont 1:fdd22bb7aa52 2895 uint32_t blockSize);
emilmont 1:fdd22bb7aa52 2896
mbed_official