mbed library for slider v2
TARGET_KL46Z/arm_math.h@0:b7116bd48af6, 2016-09-14 (annotated)
- Committer:
- mturner5
- Date:
- Wed Sep 14 07:04:27 2016 +0000
- Revision:
- 0:b7116bd48af6
Tried to use the timer.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mturner5 | 0:b7116bd48af6 | 1 | /* ---------------------------------------------------------------------- |
mturner5 | 0:b7116bd48af6 | 2 | * Copyright (C) 2010-2015 ARM Limited. All rights reserved. |
mturner5 | 0:b7116bd48af6 | 3 | * |
mturner5 | 0:b7116bd48af6 | 4 | * $Date: 19. March 2015 |
mturner5 | 0:b7116bd48af6 | 5 | * $Revision: V.1.4.5 |
mturner5 | 0:b7116bd48af6 | 6 | * |
mturner5 | 0:b7116bd48af6 | 7 | * Project: CMSIS DSP Library |
mturner5 | 0:b7116bd48af6 | 8 | * Title: arm_math.h |
mturner5 | 0:b7116bd48af6 | 9 | * |
mturner5 | 0:b7116bd48af6 | 10 | * Description: Public header file for CMSIS DSP Library |
mturner5 | 0:b7116bd48af6 | 11 | * |
mturner5 | 0:b7116bd48af6 | 12 | * Target Processor: Cortex-M7/Cortex-M4/Cortex-M3/Cortex-M0 |
mturner5 | 0:b7116bd48af6 | 13 | * |
mturner5 | 0:b7116bd48af6 | 14 | * Redistribution and use in source and binary forms, with or without |
mturner5 | 0:b7116bd48af6 | 15 | * modification, are permitted provided that the following conditions |
mturner5 | 0:b7116bd48af6 | 16 | * are met: |
mturner5 | 0:b7116bd48af6 | 17 | * - Redistributions of source code must retain the above copyright |
mturner5 | 0:b7116bd48af6 | 18 | * notice, this list of conditions and the following disclaimer. |
mturner5 | 0:b7116bd48af6 | 19 | * - Redistributions in binary form must reproduce the above copyright |
mturner5 | 0:b7116bd48af6 | 20 | * notice, this list of conditions and the following disclaimer in |
mturner5 | 0:b7116bd48af6 | 21 | * the documentation and/or other materials provided with the |
mturner5 | 0:b7116bd48af6 | 22 | * distribution. |
mturner5 | 0:b7116bd48af6 | 23 | * - Neither the name of ARM LIMITED nor the names of its contributors |
mturner5 | 0:b7116bd48af6 | 24 | * may be used to endorse or promote products derived from this |
mturner5 | 0:b7116bd48af6 | 25 | * software without specific prior written permission. |
mturner5 | 0:b7116bd48af6 | 26 | * |
mturner5 | 0:b7116bd48af6 | 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
mturner5 | 0:b7116bd48af6 | 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
mturner5 | 0:b7116bd48af6 | 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
mturner5 | 0:b7116bd48af6 | 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
mturner5 | 0:b7116bd48af6 | 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
mturner5 | 0:b7116bd48af6 | 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
mturner5 | 0:b7116bd48af6 | 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
mturner5 | 0:b7116bd48af6 | 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mturner5 | 0:b7116bd48af6 | 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
mturner5 | 0:b7116bd48af6 | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
mturner5 | 0:b7116bd48af6 | 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mturner5 | 0:b7116bd48af6 | 38 | * POSSIBILITY OF SUCH DAMAGE. |
mturner5 | 0:b7116bd48af6 | 39 | * -------------------------------------------------------------------- */ |
mturner5 | 0:b7116bd48af6 | 40 | |
mturner5 | 0:b7116bd48af6 | 41 | /** |
mturner5 | 0:b7116bd48af6 | 42 | \mainpage CMSIS DSP Software Library |
mturner5 | 0:b7116bd48af6 | 43 | * |
mturner5 | 0:b7116bd48af6 | 44 | * Introduction |
mturner5 | 0:b7116bd48af6 | 45 | * ------------ |
mturner5 | 0:b7116bd48af6 | 46 | * |
mturner5 | 0:b7116bd48af6 | 47 | * This user manual describes the CMSIS DSP software library, |
mturner5 | 0:b7116bd48af6 | 48 | * a suite of common signal processing functions for use on Cortex-M processor based devices. |
mturner5 | 0:b7116bd48af6 | 49 | * |
mturner5 | 0:b7116bd48af6 | 50 | * The library is divided into a number of functions each covering a specific category: |
mturner5 | 0:b7116bd48af6 | 51 | * - Basic math functions |
mturner5 | 0:b7116bd48af6 | 52 | * - Fast math functions |
mturner5 | 0:b7116bd48af6 | 53 | * - Complex math functions |
mturner5 | 0:b7116bd48af6 | 54 | * - Filters |
mturner5 | 0:b7116bd48af6 | 55 | * - Matrix functions |
mturner5 | 0:b7116bd48af6 | 56 | * - Transforms |
mturner5 | 0:b7116bd48af6 | 57 | * - Motor control functions |
mturner5 | 0:b7116bd48af6 | 58 | * - Statistical functions |
mturner5 | 0:b7116bd48af6 | 59 | * - Support functions |
mturner5 | 0:b7116bd48af6 | 60 | * - Interpolation functions |
mturner5 | 0:b7116bd48af6 | 61 | * |
mturner5 | 0:b7116bd48af6 | 62 | * The library has separate functions for operating on 8-bit integers, 16-bit integers, |
mturner5 | 0:b7116bd48af6 | 63 | * 32-bit integer and 32-bit floating-point values. |
mturner5 | 0:b7116bd48af6 | 64 | * |
mturner5 | 0:b7116bd48af6 | 65 | * Using the Library |
mturner5 | 0:b7116bd48af6 | 66 | * ------------ |
mturner5 | 0:b7116bd48af6 | 67 | * |
mturner5 | 0:b7116bd48af6 | 68 | * The library installer contains prebuilt versions of the libraries in the <code>Lib</code> folder. |
mturner5 | 0:b7116bd48af6 | 69 | * - arm_cortexM7lfdp_math.lib (Little endian and Double Precision Floating Point Unit on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 70 | * - arm_cortexM7bfdp_math.lib (Big endian and Double Precision Floating Point Unit on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 71 | * - arm_cortexM7lfsp_math.lib (Little endian and Single Precision Floating Point Unit on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 72 | * - arm_cortexM7bfsp_math.lib (Big endian and Single Precision Floating Point Unit on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 73 | * - arm_cortexM7l_math.lib (Little endian on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 74 | * - arm_cortexM7b_math.lib (Big endian on Cortex-M7) |
mturner5 | 0:b7116bd48af6 | 75 | * - arm_cortexM4lf_math.lib (Little endian and Floating Point Unit on Cortex-M4) |
mturner5 | 0:b7116bd48af6 | 76 | * - arm_cortexM4bf_math.lib (Big endian and Floating Point Unit on Cortex-M4) |
mturner5 | 0:b7116bd48af6 | 77 | * - arm_cortexM4l_math.lib (Little endian on Cortex-M4) |
mturner5 | 0:b7116bd48af6 | 78 | * - arm_cortexM4b_math.lib (Big endian on Cortex-M4) |
mturner5 | 0:b7116bd48af6 | 79 | * - arm_cortexM3l_math.lib (Little endian on Cortex-M3) |
mturner5 | 0:b7116bd48af6 | 80 | * - arm_cortexM3b_math.lib (Big endian on Cortex-M3) |
mturner5 | 0:b7116bd48af6 | 81 | * - arm_cortexM0l_math.lib (Little endian on Cortex-M0 / CortexM0+) |
mturner5 | 0:b7116bd48af6 | 82 | * - arm_cortexM0b_math.lib (Big endian on Cortex-M0 / CortexM0+) |
mturner5 | 0:b7116bd48af6 | 83 | * |
mturner5 | 0:b7116bd48af6 | 84 | * The library functions are declared in the public file <code>arm_math.h</code> which is placed in the <code>Include</code> folder. |
mturner5 | 0:b7116bd48af6 | 85 | * Simply include this file and link the appropriate library in the application and begin calling the library functions. The Library supports single |
mturner5 | 0:b7116bd48af6 | 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. |
mturner5 | 0:b7116bd48af6 | 87 | * Define the appropriate pre processor MACRO ARM_MATH_CM7 or ARM_MATH_CM4 or ARM_MATH_CM3 or |
mturner5 | 0:b7116bd48af6 | 88 | * ARM_MATH_CM0 or ARM_MATH_CM0PLUS depending on the target processor in the application. |
mturner5 | 0:b7116bd48af6 | 89 | * |
mturner5 | 0:b7116bd48af6 | 90 | * Examples |
mturner5 | 0:b7116bd48af6 | 91 | * -------- |
mturner5 | 0:b7116bd48af6 | 92 | * |
mturner5 | 0:b7116bd48af6 | 93 | * The library ships with a number of examples which demonstrate how to use the library functions. |
mturner5 | 0:b7116bd48af6 | 94 | * |
mturner5 | 0:b7116bd48af6 | 95 | * Toolchain Support |
mturner5 | 0:b7116bd48af6 | 96 | * ------------ |
mturner5 | 0:b7116bd48af6 | 97 | * |
mturner5 | 0:b7116bd48af6 | 98 | * The library has been developed and tested with MDK-ARM version 5.14.0.0 |
mturner5 | 0:b7116bd48af6 | 99 | * The library is being tested in GCC and IAR toolchains and updates on this activity will be made available shortly. |
mturner5 | 0:b7116bd48af6 | 100 | * |
mturner5 | 0:b7116bd48af6 | 101 | * Building the Library |
mturner5 | 0:b7116bd48af6 | 102 | * ------------ |
mturner5 | 0:b7116bd48af6 | 103 | * |
mturner5 | 0:b7116bd48af6 | 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. |
mturner5 | 0:b7116bd48af6 | 105 | * - arm_cortexM_math.uvprojx |
mturner5 | 0:b7116bd48af6 | 106 | * |
mturner5 | 0:b7116bd48af6 | 107 | * |
mturner5 | 0:b7116bd48af6 | 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. |
mturner5 | 0:b7116bd48af6 | 109 | * |
mturner5 | 0:b7116bd48af6 | 110 | * Pre-processor Macros |
mturner5 | 0:b7116bd48af6 | 111 | * ------------ |
mturner5 | 0:b7116bd48af6 | 112 | * |
mturner5 | 0:b7116bd48af6 | 113 | * Each library project have differant pre-processor macros. |
mturner5 | 0:b7116bd48af6 | 114 | * |
mturner5 | 0:b7116bd48af6 | 115 | * - UNALIGNED_SUPPORT_DISABLE: |
mturner5 | 0:b7116bd48af6 | 116 | * |
mturner5 | 0:b7116bd48af6 | 117 | * Define macro UNALIGNED_SUPPORT_DISABLE, If the silicon does not support unaligned memory access |
mturner5 | 0:b7116bd48af6 | 118 | * |
mturner5 | 0:b7116bd48af6 | 119 | * - ARM_MATH_BIG_ENDIAN: |
mturner5 | 0:b7116bd48af6 | 120 | * |
mturner5 | 0:b7116bd48af6 | 121 | * Define macro ARM_MATH_BIG_ENDIAN to build the library for big endian targets. By default library builds for little endian targets. |
mturner5 | 0:b7116bd48af6 | 122 | * |
mturner5 | 0:b7116bd48af6 | 123 | * - ARM_MATH_MATRIX_CHECK: |
mturner5 | 0:b7116bd48af6 | 124 | * |
mturner5 | 0:b7116bd48af6 | 125 | * Define macro ARM_MATH_MATRIX_CHECK for checking on the input and output sizes of matrices |
mturner5 | 0:b7116bd48af6 | 126 | * |
mturner5 | 0:b7116bd48af6 | 127 | * - ARM_MATH_ROUNDING: |
mturner5 | 0:b7116bd48af6 | 128 | * |
mturner5 | 0:b7116bd48af6 | 129 | * Define macro ARM_MATH_ROUNDING for rounding on support functions |
mturner5 | 0:b7116bd48af6 | 130 | * |
mturner5 | 0:b7116bd48af6 | 131 | * - ARM_MATH_CMx: |
mturner5 | 0:b7116bd48af6 | 132 | * |
mturner5 | 0:b7116bd48af6 | 133 | * Define macro ARM_MATH_CM4 for building the library on Cortex-M4 target, ARM_MATH_CM3 for building library on Cortex-M3 target |
mturner5 | 0:b7116bd48af6 | 134 | * and ARM_MATH_CM0 for building library on Cortex-M0 target, ARM_MATH_CM0PLUS for building library on Cortex-M0+ target, and |
mturner5 | 0:b7116bd48af6 | 135 | * ARM_MATH_CM7 for building the library on cortex-M7. |
mturner5 | 0:b7116bd48af6 | 136 | * |
mturner5 | 0:b7116bd48af6 | 137 | * - __FPU_PRESENT: |
mturner5 | 0:b7116bd48af6 | 138 | * |
mturner5 | 0:b7116bd48af6 | 139 | * Initialize macro __FPU_PRESENT = 1 when building on FPU supported Targets. Enable this macro for M4bf and M4lf libraries |
mturner5 | 0:b7116bd48af6 | 140 | * |
mturner5 | 0:b7116bd48af6 | 141 | * <hr> |
mturner5 | 0:b7116bd48af6 | 142 | * CMSIS-DSP in ARM::CMSIS Pack |
mturner5 | 0:b7116bd48af6 | 143 | * ----------------------------- |
mturner5 | 0:b7116bd48af6 | 144 | * |
mturner5 | 0:b7116bd48af6 | 145 | * The following files relevant to CMSIS-DSP are present in the <b>ARM::CMSIS</b> Pack directories: |
mturner5 | 0:b7116bd48af6 | 146 | * |File/Folder |Content | |
mturner5 | 0:b7116bd48af6 | 147 | * |------------------------------|------------------------------------------------------------------------| |
mturner5 | 0:b7116bd48af6 | 148 | * |\b CMSIS\\Documentation\\DSP | This documentation | |
mturner5 | 0:b7116bd48af6 | 149 | * |\b CMSIS\\DSP_Lib | Software license agreement (license.txt) | |
mturner5 | 0:b7116bd48af6 | 150 | * |\b CMSIS\\DSP_Lib\\Examples | Example projects demonstrating the usage of the library functions | |
mturner5 | 0:b7116bd48af6 | 151 | * |\b CMSIS\\DSP_Lib\\Source | Source files for rebuilding the library | |
mturner5 | 0:b7116bd48af6 | 152 | * |
mturner5 | 0:b7116bd48af6 | 153 | * <hr> |
mturner5 | 0:b7116bd48af6 | 154 | * Revision History of CMSIS-DSP |
mturner5 | 0:b7116bd48af6 | 155 | * ------------ |
mturner5 | 0:b7116bd48af6 | 156 | * Please refer to \ref ChangeLog_pg. |
mturner5 | 0:b7116bd48af6 | 157 | * |
mturner5 | 0:b7116bd48af6 | 158 | * Copyright Notice |
mturner5 | 0:b7116bd48af6 | 159 | * ------------ |
mturner5 | 0:b7116bd48af6 | 160 | * |
mturner5 | 0:b7116bd48af6 | 161 | * Copyright (C) 2010-2015 ARM Limited. All rights reserved. |
mturner5 | 0:b7116bd48af6 | 162 | */ |
mturner5 | 0:b7116bd48af6 | 163 | |
mturner5 | 0:b7116bd48af6 | 164 | |
mturner5 | 0:b7116bd48af6 | 165 | /** |
mturner5 | 0:b7116bd48af6 | 166 | * @defgroup groupMath Basic Math Functions |
mturner5 | 0:b7116bd48af6 | 167 | */ |
mturner5 | 0:b7116bd48af6 | 168 | |
mturner5 | 0:b7116bd48af6 | 169 | /** |
mturner5 | 0:b7116bd48af6 | 170 | * @defgroup groupFastMath Fast Math Functions |
mturner5 | 0:b7116bd48af6 | 171 | * This set of functions provides a fast approximation to sine, cosine, and square root. |
mturner5 | 0:b7116bd48af6 | 172 | * As compared to most of the other functions in the CMSIS math library, the fast math functions |
mturner5 | 0:b7116bd48af6 | 173 | * operate on individual values and not arrays. |
mturner5 | 0:b7116bd48af6 | 174 | * There are separate functions for Q15, Q31, and floating-point data. |
mturner5 | 0:b7116bd48af6 | 175 | * |
mturner5 | 0:b7116bd48af6 | 176 | */ |
mturner5 | 0:b7116bd48af6 | 177 | |
mturner5 | 0:b7116bd48af6 | 178 | /** |
mturner5 | 0:b7116bd48af6 | 179 | * @defgroup groupCmplxMath Complex Math Functions |
mturner5 | 0:b7116bd48af6 | 180 | * This set of functions operates on complex data vectors. |
mturner5 | 0:b7116bd48af6 | 181 | * The data in the complex arrays is stored in an interleaved fashion |
mturner5 | 0:b7116bd48af6 | 182 | * (real, imag, real, imag, ...). |
mturner5 | 0:b7116bd48af6 | 183 | * In the API functions, the number of samples in a complex array refers |
mturner5 | 0:b7116bd48af6 | 184 | * to the number of complex values; the array contains twice this number of |
mturner5 | 0:b7116bd48af6 | 185 | * real values. |
mturner5 | 0:b7116bd48af6 | 186 | */ |
mturner5 | 0:b7116bd48af6 | 187 | |
mturner5 | 0:b7116bd48af6 | 188 | /** |
mturner5 | 0:b7116bd48af6 | 189 | * @defgroup groupFilters Filtering Functions |
mturner5 | 0:b7116bd48af6 | 190 | */ |
mturner5 | 0:b7116bd48af6 | 191 | |
mturner5 | 0:b7116bd48af6 | 192 | /** |
mturner5 | 0:b7116bd48af6 | 193 | * @defgroup groupMatrix Matrix Functions |
mturner5 | 0:b7116bd48af6 | 194 | * |
mturner5 | 0:b7116bd48af6 | 195 | * This set of functions provides basic matrix math operations. |
mturner5 | 0:b7116bd48af6 | 196 | * The functions operate on matrix data structures. For example, |
mturner5 | 0:b7116bd48af6 | 197 | * the type |
mturner5 | 0:b7116bd48af6 | 198 | * definition for the floating-point matrix structure is shown |
mturner5 | 0:b7116bd48af6 | 199 | * below: |
mturner5 | 0:b7116bd48af6 | 200 | * <pre> |
mturner5 | 0:b7116bd48af6 | 201 | * typedef struct |
mturner5 | 0:b7116bd48af6 | 202 | * { |
mturner5 | 0:b7116bd48af6 | 203 | * uint16_t numRows; // number of rows of the matrix. |
mturner5 | 0:b7116bd48af6 | 204 | * uint16_t numCols; // number of columns of the matrix. |
mturner5 | 0:b7116bd48af6 | 205 | * float32_t *pData; // points to the data of the matrix. |
mturner5 | 0:b7116bd48af6 | 206 | * } arm_matrix_instance_f32; |
mturner5 | 0:b7116bd48af6 | 207 | * </pre> |
mturner5 | 0:b7116bd48af6 | 208 | * There are similar definitions for Q15 and Q31 data types. |
mturner5 | 0:b7116bd48af6 | 209 | * |
mturner5 | 0:b7116bd48af6 | 210 | * The structure specifies the size of the matrix and then points to |
mturner5 | 0:b7116bd48af6 | 211 | * an array of data. The array is of size <code>numRows X numCols</code> |
mturner5 | 0:b7116bd48af6 | 212 | * and the values are arranged in row order. That is, the |
mturner5 | 0:b7116bd48af6 | 213 | * matrix element (i, j) is stored at: |
mturner5 | 0:b7116bd48af6 | 214 | * <pre> |
mturner5 | 0:b7116bd48af6 | 215 | * pData[i*numCols + j] |
mturner5 | 0:b7116bd48af6 | 216 | * </pre> |
mturner5 | 0:b7116bd48af6 | 217 | * |
mturner5 | 0:b7116bd48af6 | 218 | * \par Init Functions |
mturner5 | 0:b7116bd48af6 | 219 | * There is an associated initialization function for each type of matrix |
mturner5 | 0:b7116bd48af6 | 220 | * data structure. |
mturner5 | 0:b7116bd48af6 | 221 | * The initialization function sets the values of the internal structure fields. |
mturner5 | 0:b7116bd48af6 | 222 | * Refer to the function <code>arm_mat_init_f32()</code>, <code>arm_mat_init_q31()</code> |
mturner5 | 0:b7116bd48af6 | 223 | * and <code>arm_mat_init_q15()</code> for floating-point, Q31 and Q15 types, respectively. |
mturner5 | 0:b7116bd48af6 | 224 | * |
mturner5 | 0:b7116bd48af6 | 225 | * \par |
mturner5 | 0:b7116bd48af6 | 226 | * Use of the initialization function is optional. However, if initialization function is used |
mturner5 | 0:b7116bd48af6 | 227 | * then the instance structure cannot be placed into a const data section. |
mturner5 | 0:b7116bd48af6 | 228 | * To place the instance structure in a const data |
mturner5 | 0:b7116bd48af6 | 229 | * section, manually initialize the data structure. For example: |
mturner5 | 0:b7116bd48af6 | 230 | * <pre> |
mturner5 | 0:b7116bd48af6 | 231 | * <code>arm_matrix_instance_f32 S = {nRows, nColumns, pData};</code> |
mturner5 | 0:b7116bd48af6 | 232 | * <code>arm_matrix_instance_q31 S = {nRows, nColumns, pData};</code> |
mturner5 | 0:b7116bd48af6 | 233 | * <code>arm_matrix_instance_q15 S = {nRows, nColumns, pData};</code> |
mturner5 | 0:b7116bd48af6 | 234 | * </pre> |
mturner5 | 0:b7116bd48af6 | 235 | * where <code>nRows</code> specifies the number of rows, <code>nColumns</code> |
mturner5 | 0:b7116bd48af6 | 236 | * specifies the number of columns, and <code>pData</code> points to the |
mturner5 | 0:b7116bd48af6 | 237 | * data array. |
mturner5 | 0:b7116bd48af6 | 238 | * |
mturner5 | 0:b7116bd48af6 | 239 | * \par Size Checking |
mturner5 | 0:b7116bd48af6 | 240 | * By default all of the matrix functions perform size checking on the input and |
mturner5 | 0:b7116bd48af6 | 241 | * output matrices. For example, the matrix addition function verifies that the |
mturner5 | 0:b7116bd48af6 | 242 | * two input matrices and the output matrix all have the same number of rows and |
mturner5 | 0:b7116bd48af6 | 243 | * columns. If the size check fails the functions return: |
mturner5 | 0:b7116bd48af6 | 244 | * <pre> |
mturner5 | 0:b7116bd48af6 | 245 | * ARM_MATH_SIZE_MISMATCH |
mturner5 | 0:b7116bd48af6 | 246 | * </pre> |
mturner5 | 0:b7116bd48af6 | 247 | * Otherwise the functions return |
mturner5 | 0:b7116bd48af6 | 248 | * <pre> |
mturner5 | 0:b7116bd48af6 | 249 | * ARM_MATH_SUCCESS |
mturner5 | 0:b7116bd48af6 | 250 | * </pre> |
mturner5 | 0:b7116bd48af6 | 251 | * There is some overhead associated with this matrix size checking. |
mturner5 | 0:b7116bd48af6 | 252 | * The matrix size checking is enabled via the \#define |
mturner5 | 0:b7116bd48af6 | 253 | * <pre> |
mturner5 | 0:b7116bd48af6 | 254 | * ARM_MATH_MATRIX_CHECK |
mturner5 | 0:b7116bd48af6 | 255 | * </pre> |
mturner5 | 0:b7116bd48af6 | 256 | * within the library project settings. By default this macro is defined |
mturner5 | 0:b7116bd48af6 | 257 | * and size checking is enabled. By changing the project settings and |
mturner5 | 0:b7116bd48af6 | 258 | * undefining this macro size checking is eliminated and the functions |
mturner5 | 0:b7116bd48af6 | 259 | * run a bit faster. With size checking disabled the functions always |
mturner5 | 0:b7116bd48af6 | 260 | * return <code>ARM_MATH_SUCCESS</code>. |
mturner5 | 0:b7116bd48af6 | 261 | */ |
mturner5 | 0:b7116bd48af6 | 262 | |
mturner5 | 0:b7116bd48af6 | 263 | /** |
mturner5 | 0:b7116bd48af6 | 264 | * @defgroup groupTransforms Transform Functions |
mturner5 | 0:b7116bd48af6 | 265 | */ |
mturner5 | 0:b7116bd48af6 | 266 | |
mturner5 | 0:b7116bd48af6 | 267 | /** |
mturner5 | 0:b7116bd48af6 | 268 | * @defgroup groupController Controller Functions |
mturner5 | 0:b7116bd48af6 | 269 | */ |
mturner5 | 0:b7116bd48af6 | 270 | |
mturner5 | 0:b7116bd48af6 | 271 | /** |
mturner5 | 0:b7116bd48af6 | 272 | * @defgroup groupStats Statistics Functions |
mturner5 | 0:b7116bd48af6 | 273 | */ |
mturner5 | 0:b7116bd48af6 | 274 | /** |
mturner5 | 0:b7116bd48af6 | 275 | * @defgroup groupSupport Support Functions |
mturner5 | 0:b7116bd48af6 | 276 | */ |
mturner5 | 0:b7116bd48af6 | 277 | |
mturner5 | 0:b7116bd48af6 | 278 | /** |
mturner5 | 0:b7116bd48af6 | 279 | * @defgroup groupInterpolation Interpolation Functions |
mturner5 | 0:b7116bd48af6 | 280 | * These functions perform 1- and 2-dimensional interpolation of data. |
mturner5 | 0:b7116bd48af6 | 281 | * Linear interpolation is used for 1-dimensional data and |
mturner5 | 0:b7116bd48af6 | 282 | * bilinear interpolation is used for 2-dimensional data. |
mturner5 | 0:b7116bd48af6 | 283 | */ |
mturner5 | 0:b7116bd48af6 | 284 | |
mturner5 | 0:b7116bd48af6 | 285 | /** |
mturner5 | 0:b7116bd48af6 | 286 | * @defgroup groupExamples Examples |
mturner5 | 0:b7116bd48af6 | 287 | */ |
mturner5 | 0:b7116bd48af6 | 288 | #ifndef _ARM_MATH_H |
mturner5 | 0:b7116bd48af6 | 289 | #define _ARM_MATH_H |
mturner5 | 0:b7116bd48af6 | 290 | |
mturner5 | 0:b7116bd48af6 | 291 | #define __CMSIS_GENERIC /* disable NVIC and Systick functions */ |
mturner5 | 0:b7116bd48af6 | 292 | |
mturner5 | 0:b7116bd48af6 | 293 | #if defined(ARM_MATH_CM7) |
mturner5 | 0:b7116bd48af6 | 294 | #include "core_cm7.h" |
mturner5 | 0:b7116bd48af6 | 295 | #elif defined (ARM_MATH_CM4) |
mturner5 | 0:b7116bd48af6 | 296 | #include "core_cm4.h" |
mturner5 | 0:b7116bd48af6 | 297 | #elif defined (ARM_MATH_CM3) |
mturner5 | 0:b7116bd48af6 | 298 | #include "core_cm3.h" |
mturner5 | 0:b7116bd48af6 | 299 | #elif defined (ARM_MATH_CM0) |
mturner5 | 0:b7116bd48af6 | 300 | #include "core_cm0.h" |
mturner5 | 0:b7116bd48af6 | 301 | #define ARM_MATH_CM0_FAMILY |
mturner5 | 0:b7116bd48af6 | 302 | #elif defined (ARM_MATH_CM0PLUS) |
mturner5 | 0:b7116bd48af6 | 303 | #include "core_cm0plus.h" |
mturner5 | 0:b7116bd48af6 | 304 | #define ARM_MATH_CM0_FAMILY |
mturner5 | 0:b7116bd48af6 | 305 | #else |
mturner5 | 0:b7116bd48af6 | 306 | #error "Define according the used Cortex core ARM_MATH_CM7, ARM_MATH_CM4, ARM_MATH_CM3, ARM_MATH_CM0PLUS or ARM_MATH_CM0" |
mturner5 | 0:b7116bd48af6 | 307 | #endif |
mturner5 | 0:b7116bd48af6 | 308 | |
mturner5 | 0:b7116bd48af6 | 309 | #undef __CMSIS_GENERIC /* enable NVIC and Systick functions */ |
mturner5 | 0:b7116bd48af6 | 310 | #include "string.h" |
mturner5 | 0:b7116bd48af6 | 311 | #include "math.h" |
mturner5 | 0:b7116bd48af6 | 312 | #ifdef __cplusplus |
mturner5 | 0:b7116bd48af6 | 313 | extern "C" |
mturner5 | 0:b7116bd48af6 | 314 | { |
mturner5 | 0:b7116bd48af6 | 315 | #endif |
mturner5 | 0:b7116bd48af6 | 316 | |
mturner5 | 0:b7116bd48af6 | 317 | |
mturner5 | 0:b7116bd48af6 | 318 | /** |
mturner5 | 0:b7116bd48af6 | 319 | * @brief Macros required for reciprocal calculation in Normalized LMS |
mturner5 | 0:b7116bd48af6 | 320 | */ |
mturner5 | 0:b7116bd48af6 | 321 | |
mturner5 | 0:b7116bd48af6 | 322 | #define DELTA_Q31 (0x100) |
mturner5 | 0:b7116bd48af6 | 323 | #define DELTA_Q15 0x5 |
mturner5 | 0:b7116bd48af6 | 324 | #define INDEX_MASK 0x0000003F |
mturner5 | 0:b7116bd48af6 | 325 | #ifndef PI |
mturner5 | 0:b7116bd48af6 | 326 | #define PI 3.14159265358979f |
mturner5 | 0:b7116bd48af6 | 327 | #endif |
mturner5 | 0:b7116bd48af6 | 328 | |
mturner5 | 0:b7116bd48af6 | 329 | /** |
mturner5 | 0:b7116bd48af6 | 330 | * @brief Macros required for SINE and COSINE Fast math approximations |
mturner5 | 0:b7116bd48af6 | 331 | */ |
mturner5 | 0:b7116bd48af6 | 332 | |
mturner5 | 0:b7116bd48af6 | 333 | #define FAST_MATH_TABLE_SIZE 512 |
mturner5 | 0:b7116bd48af6 | 334 | #define FAST_MATH_Q31_SHIFT (32 - 10) |
mturner5 | 0:b7116bd48af6 | 335 | #define FAST_MATH_Q15_SHIFT (16 - 10) |
mturner5 | 0:b7116bd48af6 | 336 | #define CONTROLLER_Q31_SHIFT (32 - 9) |
mturner5 | 0:b7116bd48af6 | 337 | #define TABLE_SIZE 256 |
mturner5 | 0:b7116bd48af6 | 338 | #define TABLE_SPACING_Q31 0x400000 |
mturner5 | 0:b7116bd48af6 | 339 | #define TABLE_SPACING_Q15 0x80 |
mturner5 | 0:b7116bd48af6 | 340 | |
mturner5 | 0:b7116bd48af6 | 341 | /** |
mturner5 | 0:b7116bd48af6 | 342 | * @brief Macros required for SINE and COSINE Controller functions |
mturner5 | 0:b7116bd48af6 | 343 | */ |
mturner5 | 0:b7116bd48af6 | 344 | /* 1.31(q31) Fixed value of 2/360 */ |
mturner5 | 0:b7116bd48af6 | 345 | /* -1 to +1 is divided into 360 values so total spacing is (2/360) */ |
mturner5 | 0:b7116bd48af6 | 346 | #define INPUT_SPACING 0xB60B61 |
mturner5 | 0:b7116bd48af6 | 347 | |
mturner5 | 0:b7116bd48af6 | 348 | /** |
mturner5 | 0:b7116bd48af6 | 349 | * @brief Macro for Unaligned Support |
mturner5 | 0:b7116bd48af6 | 350 | */ |
mturner5 | 0:b7116bd48af6 | 351 | #ifndef UNALIGNED_SUPPORT_DISABLE |
mturner5 | 0:b7116bd48af6 | 352 | #define ALIGN4 |
mturner5 | 0:b7116bd48af6 | 353 | #else |
mturner5 | 0:b7116bd48af6 | 354 | #if defined (__GNUC__) |
mturner5 | 0:b7116bd48af6 | 355 | #define ALIGN4 __attribute__((aligned(4))) |
mturner5 | 0:b7116bd48af6 | 356 | #else |
mturner5 | 0:b7116bd48af6 | 357 | #define ALIGN4 __align(4) |
mturner5 | 0:b7116bd48af6 | 358 | #endif |
mturner5 | 0:b7116bd48af6 | 359 | #endif /* #ifndef UNALIGNED_SUPPORT_DISABLE */ |
mturner5 | 0:b7116bd48af6 | 360 | |
mturner5 | 0:b7116bd48af6 | 361 | /** |
mturner5 | 0:b7116bd48af6 | 362 | * @brief Error status returned by some functions in the library. |
mturner5 | 0:b7116bd48af6 | 363 | */ |
mturner5 | 0:b7116bd48af6 | 364 | |
mturner5 | 0:b7116bd48af6 | 365 | typedef enum |
mturner5 | 0:b7116bd48af6 | 366 | { |
mturner5 | 0:b7116bd48af6 | 367 | ARM_MATH_SUCCESS = 0, /**< No error */ |
mturner5 | 0:b7116bd48af6 | 368 | ARM_MATH_ARGUMENT_ERROR = -1, /**< One or more arguments are incorrect */ |
mturner5 | 0:b7116bd48af6 | 369 | ARM_MATH_LENGTH_ERROR = -2, /**< Length of data buffer is incorrect */ |
mturner5 | 0:b7116bd48af6 | 370 | ARM_MATH_SIZE_MISMATCH = -3, /**< Size of matrices is not compatible with the operation. */ |
mturner5 | 0:b7116bd48af6 | 371 | ARM_MATH_NANINF = -4, /**< Not-a-number (NaN) or infinity is generated */ |
mturner5 | 0:b7116bd48af6 | 372 | ARM_MATH_SINGULAR = -5, /**< Generated by matrix inversion if the input matrix is singular and cannot be inverted. */ |
mturner5 | 0:b7116bd48af6 | 373 | ARM_MATH_TEST_FAILURE = -6 /**< Test Failed */ |
mturner5 | 0:b7116bd48af6 | 374 | } arm_status; |
mturner5 | 0:b7116bd48af6 | 375 | |
mturner5 | 0:b7116bd48af6 | 376 | /** |
mturner5 | 0:b7116bd48af6 | 377 | * @brief 8-bit fractional data type in 1.7 format. |
mturner5 | 0:b7116bd48af6 | 378 | */ |
mturner5 | 0:b7116bd48af6 | 379 | typedef int8_t q7_t; |
mturner5 | 0:b7116bd48af6 | 380 | |
mturner5 | 0:b7116bd48af6 | 381 | /** |
mturner5 | 0:b7116bd48af6 | 382 | * @brief 16-bit fractional data type in 1.15 format. |
mturner5 | 0:b7116bd48af6 | 383 | */ |
mturner5 | 0:b7116bd48af6 | 384 | typedef int16_t q15_t; |
mturner5 | 0:b7116bd48af6 | 385 | |
mturner5 | 0:b7116bd48af6 | 386 | /** |
mturner5 | 0:b7116bd48af6 | 387 | * @brief 32-bit fractional data type in 1.31 format. |
mturner5 | 0:b7116bd48af6 | 388 | */ |
mturner5 | 0:b7116bd48af6 | 389 | typedef int32_t q31_t; |
mturner5 | 0:b7116bd48af6 | 390 | |
mturner5 | 0:b7116bd48af6 | 391 | /** |
mturner5 | 0:b7116bd48af6 | 392 | * @brief 64-bit fractional data type in 1.63 format. |
mturner5 | 0:b7116bd48af6 | 393 | */ |
mturner5 | 0:b7116bd48af6 | 394 | typedef int64_t q63_t; |
mturner5 | 0:b7116bd48af6 | 395 | |
mturner5 | 0:b7116bd48af6 | 396 | /** |
mturner5 | 0:b7116bd48af6 | 397 | * @brief 32-bit floating-point type definition. |
mturner5 | 0:b7116bd48af6 | 398 | */ |
mturner5 | 0:b7116bd48af6 | 399 | typedef float float32_t; |
mturner5 | 0:b7116bd48af6 | 400 | |
mturner5 | 0:b7116bd48af6 | 401 | /** |
mturner5 | 0:b7116bd48af6 | 402 | * @brief 64-bit floating-point type definition. |
mturner5 | 0:b7116bd48af6 | 403 | */ |
mturner5 | 0:b7116bd48af6 | 404 | typedef double float64_t; |
mturner5 | 0:b7116bd48af6 | 405 | |
mturner5 | 0:b7116bd48af6 | 406 | /** |
mturner5 | 0:b7116bd48af6 | 407 | * @brief definition to read/write two 16 bit values. |
mturner5 | 0:b7116bd48af6 | 408 | */ |
mturner5 | 0:b7116bd48af6 | 409 | #if defined __CC_ARM |
mturner5 | 0:b7116bd48af6 | 410 | #define __SIMD32_TYPE int32_t __packed |
mturner5 | 0:b7116bd48af6 | 411 | #define CMSIS_UNUSED __attribute__((unused)) |
mturner5 | 0:b7116bd48af6 | 412 | #elif defined __ICCARM__ |
mturner5 | 0:b7116bd48af6 | 413 | #define __SIMD32_TYPE int32_t __packed |
mturner5 | 0:b7116bd48af6 | 414 | #define CMSIS_UNUSED |
mturner5 | 0:b7116bd48af6 | 415 | #elif defined __GNUC__ |
mturner5 | 0:b7116bd48af6 | 416 | #define __SIMD32_TYPE int32_t |
mturner5 | 0:b7116bd48af6 | 417 | #define CMSIS_UNUSED __attribute__((unused)) |
mturner5 | 0:b7116bd48af6 | 418 | #elif defined __CSMC__ /* Cosmic */ |
mturner5 | 0:b7116bd48af6 | 419 | #define __SIMD32_TYPE int32_t |
mturner5 | 0:b7116bd48af6 | 420 | #define CMSIS_UNUSED |
mturner5 | 0:b7116bd48af6 | 421 | #elif defined __TASKING__ |
mturner5 | 0:b7116bd48af6 | 422 | #define __SIMD32_TYPE __unaligned int32_t |
mturner5 | 0:b7116bd48af6 | 423 | #define CMSIS_UNUSED |
mturner5 | 0:b7116bd48af6 | 424 | #else |
mturner5 | 0:b7116bd48af6 | 425 | #error Unknown compiler |
mturner5 | 0:b7116bd48af6 | 426 | #endif |
mturner5 | 0:b7116bd48af6 | 427 | |
mturner5 | 0:b7116bd48af6 | 428 | #define __SIMD32(addr) (*(__SIMD32_TYPE **) & (addr)) |
mturner5 | 0:b7116bd48af6 | 429 | #define __SIMD32_CONST(addr) ((__SIMD32_TYPE *)(addr)) |
mturner5 | 0:b7116bd48af6 | 430 | |
mturner5 | 0:b7116bd48af6 | 431 | #define _SIMD32_OFFSET(addr) (*(__SIMD32_TYPE *) (addr)) |
mturner5 | 0:b7116bd48af6 | 432 | |
mturner5 | 0:b7116bd48af6 | 433 | #define __SIMD64(addr) (*(int64_t **) & (addr)) |
mturner5 | 0:b7116bd48af6 | 434 | |
mturner5 | 0:b7116bd48af6 | 435 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
mturner5 | 0:b7116bd48af6 | 436 | /** |
mturner5 | 0:b7116bd48af6 | 437 | * @brief definition to pack two 16 bit values. |
mturner5 | 0:b7116bd48af6 | 438 | */ |
mturner5 | 0:b7116bd48af6 | 439 | #define __PKHBT(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0x0000FFFF) | \ |
mturner5 | 0:b7116bd48af6 | 440 | (((int32_t)(ARG2) << ARG3) & (int32_t)0xFFFF0000) ) |
mturner5 | 0:b7116bd48af6 | 441 | #define __PKHTB(ARG1, ARG2, ARG3) ( (((int32_t)(ARG1) << 0) & (int32_t)0xFFFF0000) | \ |
mturner5 | 0:b7116bd48af6 | 442 | (((int32_t)(ARG2) >> ARG3) & (int32_t)0x0000FFFF) ) |
mturner5 | 0:b7116bd48af6 | 443 | |
mturner5 | 0:b7116bd48af6 | 444 | #endif |
mturner5 | 0:b7116bd48af6 | 445 | |
mturner5 | 0:b7116bd48af6 | 446 | |
mturner5 | 0:b7116bd48af6 | 447 | /** |
mturner5 | 0:b7116bd48af6 | 448 | * @brief definition to pack four 8 bit values. |
mturner5 | 0:b7116bd48af6 | 449 | */ |
mturner5 | 0:b7116bd48af6 | 450 | #ifndef ARM_MATH_BIG_ENDIAN |
mturner5 | 0:b7116bd48af6 | 451 | |
mturner5 | 0:b7116bd48af6 | 452 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v0) << 0) & (int32_t)0x000000FF) | \ |
mturner5 | 0:b7116bd48af6 | 453 | (((int32_t)(v1) << 8) & (int32_t)0x0000FF00) | \ |
mturner5 | 0:b7116bd48af6 | 454 | (((int32_t)(v2) << 16) & (int32_t)0x00FF0000) | \ |
mturner5 | 0:b7116bd48af6 | 455 | (((int32_t)(v3) << 24) & (int32_t)0xFF000000) ) |
mturner5 | 0:b7116bd48af6 | 456 | #else |
mturner5 | 0:b7116bd48af6 | 457 | |
mturner5 | 0:b7116bd48af6 | 458 | #define __PACKq7(v0,v1,v2,v3) ( (((int32_t)(v3) << 0) & (int32_t)0x000000FF) | \ |
mturner5 | 0:b7116bd48af6 | 459 | (((int32_t)(v2) << 8) & (int32_t)0x0000FF00) | \ |
mturner5 | 0:b7116bd48af6 | 460 | (((int32_t)(v1) << 16) & (int32_t)0x00FF0000) | \ |
mturner5 | 0:b7116bd48af6 | 461 | (((int32_t)(v0) << 24) & (int32_t)0xFF000000) ) |
mturner5 | 0:b7116bd48af6 | 462 | |
mturner5 | 0:b7116bd48af6 | 463 | #endif |
mturner5 | 0:b7116bd48af6 | 464 | |
mturner5 | 0:b7116bd48af6 | 465 | |
mturner5 | 0:b7116bd48af6 | 466 | /** |
mturner5 | 0:b7116bd48af6 | 467 | * @brief Clips Q63 to Q31 values. |
mturner5 | 0:b7116bd48af6 | 468 | */ |
mturner5 | 0:b7116bd48af6 | 469 | static __INLINE q31_t clip_q63_to_q31( |
mturner5 | 0:b7116bd48af6 | 470 | q63_t x) |
mturner5 | 0:b7116bd48af6 | 471 | { |
mturner5 | 0:b7116bd48af6 | 472 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
mturner5 | 0:b7116bd48af6 | 473 | ((0x7FFFFFFF ^ ((q31_t) (x >> 63)))) : (q31_t) x; |
mturner5 | 0:b7116bd48af6 | 474 | } |
mturner5 | 0:b7116bd48af6 | 475 | |
mturner5 | 0:b7116bd48af6 | 476 | /** |
mturner5 | 0:b7116bd48af6 | 477 | * @brief Clips Q63 to Q15 values. |
mturner5 | 0:b7116bd48af6 | 478 | */ |
mturner5 | 0:b7116bd48af6 | 479 | static __INLINE q15_t clip_q63_to_q15( |
mturner5 | 0:b7116bd48af6 | 480 | q63_t x) |
mturner5 | 0:b7116bd48af6 | 481 | { |
mturner5 | 0:b7116bd48af6 | 482 | return ((q31_t) (x >> 32) != ((q31_t) x >> 31)) ? |
mturner5 | 0:b7116bd48af6 | 483 | ((0x7FFF ^ ((q15_t) (x >> 63)))) : (q15_t) (x >> 15); |
mturner5 | 0:b7116bd48af6 | 484 | } |
mturner5 | 0:b7116bd48af6 | 485 | |
mturner5 | 0:b7116bd48af6 | 486 | /** |
mturner5 | 0:b7116bd48af6 | 487 | * @brief Clips Q31 to Q7 values. |
mturner5 | 0:b7116bd48af6 | 488 | */ |
mturner5 | 0:b7116bd48af6 | 489 | static __INLINE q7_t clip_q31_to_q7( |
mturner5 | 0:b7116bd48af6 | 490 | q31_t x) |
mturner5 | 0:b7116bd48af6 | 491 | { |
mturner5 | 0:b7116bd48af6 | 492 | return ((q31_t) (x >> 24) != ((q31_t) x >> 23)) ? |
mturner5 | 0:b7116bd48af6 | 493 | ((0x7F ^ ((q7_t) (x >> 31)))) : (q7_t) x; |
mturner5 | 0:b7116bd48af6 | 494 | } |
mturner5 | 0:b7116bd48af6 | 495 | |
mturner5 | 0:b7116bd48af6 | 496 | /** |
mturner5 | 0:b7116bd48af6 | 497 | * @brief Clips Q31 to Q15 values. |
mturner5 | 0:b7116bd48af6 | 498 | */ |
mturner5 | 0:b7116bd48af6 | 499 | static __INLINE q15_t clip_q31_to_q15( |
mturner5 | 0:b7116bd48af6 | 500 | q31_t x) |
mturner5 | 0:b7116bd48af6 | 501 | { |
mturner5 | 0:b7116bd48af6 | 502 | return ((q31_t) (x >> 16) != ((q31_t) x >> 15)) ? |
mturner5 | 0:b7116bd48af6 | 503 | ((0x7FFF ^ ((q15_t) (x >> 31)))) : (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 504 | } |
mturner5 | 0:b7116bd48af6 | 505 | |
mturner5 | 0:b7116bd48af6 | 506 | /** |
mturner5 | 0:b7116bd48af6 | 507 | * @brief Multiplies 32 X 64 and returns 32 bit result in 2.30 format. |
mturner5 | 0:b7116bd48af6 | 508 | */ |
mturner5 | 0:b7116bd48af6 | 509 | |
mturner5 | 0:b7116bd48af6 | 510 | static __INLINE q63_t mult32x64( |
mturner5 | 0:b7116bd48af6 | 511 | q63_t x, |
mturner5 | 0:b7116bd48af6 | 512 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 513 | { |
mturner5 | 0:b7116bd48af6 | 514 | return ((((q63_t) (x & 0x00000000FFFFFFFF) * y) >> 32) + |
mturner5 | 0:b7116bd48af6 | 515 | (((q63_t) (x >> 32) * y))); |
mturner5 | 0:b7116bd48af6 | 516 | } |
mturner5 | 0:b7116bd48af6 | 517 | |
mturner5 | 0:b7116bd48af6 | 518 | |
mturner5 | 0:b7116bd48af6 | 519 | //#if defined (ARM_MATH_CM0_FAMILY) && defined ( __CC_ARM ) |
mturner5 | 0:b7116bd48af6 | 520 | //#define __CLZ __clz |
mturner5 | 0:b7116bd48af6 | 521 | //#endif |
mturner5 | 0:b7116bd48af6 | 522 | |
mturner5 | 0:b7116bd48af6 | 523 | //note: function can be removed when all toolchain support __CLZ for Cortex-M0 |
mturner5 | 0:b7116bd48af6 | 524 | #if defined (ARM_MATH_CM0_FAMILY) && ((defined (__ICCARM__)) ) |
mturner5 | 0:b7116bd48af6 | 525 | |
mturner5 | 0:b7116bd48af6 | 526 | static __INLINE uint32_t __CLZ( |
mturner5 | 0:b7116bd48af6 | 527 | q31_t data); |
mturner5 | 0:b7116bd48af6 | 528 | |
mturner5 | 0:b7116bd48af6 | 529 | |
mturner5 | 0:b7116bd48af6 | 530 | static __INLINE uint32_t __CLZ( |
mturner5 | 0:b7116bd48af6 | 531 | q31_t data) |
mturner5 | 0:b7116bd48af6 | 532 | { |
mturner5 | 0:b7116bd48af6 | 533 | uint32_t count = 0; |
mturner5 | 0:b7116bd48af6 | 534 | uint32_t mask = 0x80000000; |
mturner5 | 0:b7116bd48af6 | 535 | |
mturner5 | 0:b7116bd48af6 | 536 | while((data & mask) == 0) |
mturner5 | 0:b7116bd48af6 | 537 | { |
mturner5 | 0:b7116bd48af6 | 538 | count += 1u; |
mturner5 | 0:b7116bd48af6 | 539 | mask = mask >> 1u; |
mturner5 | 0:b7116bd48af6 | 540 | } |
mturner5 | 0:b7116bd48af6 | 541 | |
mturner5 | 0:b7116bd48af6 | 542 | return (count); |
mturner5 | 0:b7116bd48af6 | 543 | |
mturner5 | 0:b7116bd48af6 | 544 | } |
mturner5 | 0:b7116bd48af6 | 545 | |
mturner5 | 0:b7116bd48af6 | 546 | #endif |
mturner5 | 0:b7116bd48af6 | 547 | |
mturner5 | 0:b7116bd48af6 | 548 | /** |
mturner5 | 0:b7116bd48af6 | 549 | * @brief Function to Calculates 1/in (reciprocal) value of Q31 Data type. |
mturner5 | 0:b7116bd48af6 | 550 | */ |
mturner5 | 0:b7116bd48af6 | 551 | |
mturner5 | 0:b7116bd48af6 | 552 | static __INLINE uint32_t arm_recip_q31( |
mturner5 | 0:b7116bd48af6 | 553 | q31_t in, |
mturner5 | 0:b7116bd48af6 | 554 | q31_t * dst, |
mturner5 | 0:b7116bd48af6 | 555 | q31_t * pRecipTable) |
mturner5 | 0:b7116bd48af6 | 556 | { |
mturner5 | 0:b7116bd48af6 | 557 | |
mturner5 | 0:b7116bd48af6 | 558 | uint32_t out, tempVal; |
mturner5 | 0:b7116bd48af6 | 559 | uint32_t index, i; |
mturner5 | 0:b7116bd48af6 | 560 | uint32_t signBits; |
mturner5 | 0:b7116bd48af6 | 561 | |
mturner5 | 0:b7116bd48af6 | 562 | if(in > 0) |
mturner5 | 0:b7116bd48af6 | 563 | { |
mturner5 | 0:b7116bd48af6 | 564 | signBits = __CLZ(in) - 1; |
mturner5 | 0:b7116bd48af6 | 565 | } |
mturner5 | 0:b7116bd48af6 | 566 | else |
mturner5 | 0:b7116bd48af6 | 567 | { |
mturner5 | 0:b7116bd48af6 | 568 | signBits = __CLZ(-in) - 1; |
mturner5 | 0:b7116bd48af6 | 569 | } |
mturner5 | 0:b7116bd48af6 | 570 | |
mturner5 | 0:b7116bd48af6 | 571 | /* Convert input sample to 1.31 format */ |
mturner5 | 0:b7116bd48af6 | 572 | in = in << signBits; |
mturner5 | 0:b7116bd48af6 | 573 | |
mturner5 | 0:b7116bd48af6 | 574 | /* calculation of index for initial approximated Val */ |
mturner5 | 0:b7116bd48af6 | 575 | index = (uint32_t) (in >> 24u); |
mturner5 | 0:b7116bd48af6 | 576 | index = (index & INDEX_MASK); |
mturner5 | 0:b7116bd48af6 | 577 | |
mturner5 | 0:b7116bd48af6 | 578 | /* 1.31 with exp 1 */ |
mturner5 | 0:b7116bd48af6 | 579 | out = pRecipTable[index]; |
mturner5 | 0:b7116bd48af6 | 580 | |
mturner5 | 0:b7116bd48af6 | 581 | /* calculation of reciprocal value */ |
mturner5 | 0:b7116bd48af6 | 582 | /* running approximation for two iterations */ |
mturner5 | 0:b7116bd48af6 | 583 | for (i = 0u; i < 2u; i++) |
mturner5 | 0:b7116bd48af6 | 584 | { |
mturner5 | 0:b7116bd48af6 | 585 | tempVal = (q31_t) (((q63_t) in * out) >> 31u); |
mturner5 | 0:b7116bd48af6 | 586 | tempVal = 0x7FFFFFFF - tempVal; |
mturner5 | 0:b7116bd48af6 | 587 | /* 1.31 with exp 1 */ |
mturner5 | 0:b7116bd48af6 | 588 | //out = (q31_t) (((q63_t) out * tempVal) >> 30u); |
mturner5 | 0:b7116bd48af6 | 589 | out = (q31_t) clip_q63_to_q31(((q63_t) out * tempVal) >> 30u); |
mturner5 | 0:b7116bd48af6 | 590 | } |
mturner5 | 0:b7116bd48af6 | 591 | |
mturner5 | 0:b7116bd48af6 | 592 | /* write output */ |
mturner5 | 0:b7116bd48af6 | 593 | *dst = out; |
mturner5 | 0:b7116bd48af6 | 594 | |
mturner5 | 0:b7116bd48af6 | 595 | /* return num of signbits of out = 1/in value */ |
mturner5 | 0:b7116bd48af6 | 596 | return (signBits + 1u); |
mturner5 | 0:b7116bd48af6 | 597 | |
mturner5 | 0:b7116bd48af6 | 598 | } |
mturner5 | 0:b7116bd48af6 | 599 | |
mturner5 | 0:b7116bd48af6 | 600 | /** |
mturner5 | 0:b7116bd48af6 | 601 | * @brief Function to Calculates 1/in (reciprocal) value of Q15 Data type. |
mturner5 | 0:b7116bd48af6 | 602 | */ |
mturner5 | 0:b7116bd48af6 | 603 | static __INLINE uint32_t arm_recip_q15( |
mturner5 | 0:b7116bd48af6 | 604 | q15_t in, |
mturner5 | 0:b7116bd48af6 | 605 | q15_t * dst, |
mturner5 | 0:b7116bd48af6 | 606 | q15_t * pRecipTable) |
mturner5 | 0:b7116bd48af6 | 607 | { |
mturner5 | 0:b7116bd48af6 | 608 | |
mturner5 | 0:b7116bd48af6 | 609 | uint32_t out = 0, tempVal = 0; |
mturner5 | 0:b7116bd48af6 | 610 | uint32_t index = 0, i = 0; |
mturner5 | 0:b7116bd48af6 | 611 | uint32_t signBits = 0; |
mturner5 | 0:b7116bd48af6 | 612 | |
mturner5 | 0:b7116bd48af6 | 613 | if(in > 0) |
mturner5 | 0:b7116bd48af6 | 614 | { |
mturner5 | 0:b7116bd48af6 | 615 | signBits = __CLZ(in) - 17; |
mturner5 | 0:b7116bd48af6 | 616 | } |
mturner5 | 0:b7116bd48af6 | 617 | else |
mturner5 | 0:b7116bd48af6 | 618 | { |
mturner5 | 0:b7116bd48af6 | 619 | signBits = __CLZ(-in) - 17; |
mturner5 | 0:b7116bd48af6 | 620 | } |
mturner5 | 0:b7116bd48af6 | 621 | |
mturner5 | 0:b7116bd48af6 | 622 | /* Convert input sample to 1.15 format */ |
mturner5 | 0:b7116bd48af6 | 623 | in = in << signBits; |
mturner5 | 0:b7116bd48af6 | 624 | |
mturner5 | 0:b7116bd48af6 | 625 | /* calculation of index for initial approximated Val */ |
mturner5 | 0:b7116bd48af6 | 626 | index = in >> 8; |
mturner5 | 0:b7116bd48af6 | 627 | index = (index & INDEX_MASK); |
mturner5 | 0:b7116bd48af6 | 628 | |
mturner5 | 0:b7116bd48af6 | 629 | /* 1.15 with exp 1 */ |
mturner5 | 0:b7116bd48af6 | 630 | out = pRecipTable[index]; |
mturner5 | 0:b7116bd48af6 | 631 | |
mturner5 | 0:b7116bd48af6 | 632 | /* calculation of reciprocal value */ |
mturner5 | 0:b7116bd48af6 | 633 | /* running approximation for two iterations */ |
mturner5 | 0:b7116bd48af6 | 634 | for (i = 0; i < 2; i++) |
mturner5 | 0:b7116bd48af6 | 635 | { |
mturner5 | 0:b7116bd48af6 | 636 | tempVal = (q15_t) (((q31_t) in * out) >> 15); |
mturner5 | 0:b7116bd48af6 | 637 | tempVal = 0x7FFF - tempVal; |
mturner5 | 0:b7116bd48af6 | 638 | /* 1.15 with exp 1 */ |
mturner5 | 0:b7116bd48af6 | 639 | out = (q15_t) (((q31_t) out * tempVal) >> 14); |
mturner5 | 0:b7116bd48af6 | 640 | } |
mturner5 | 0:b7116bd48af6 | 641 | |
mturner5 | 0:b7116bd48af6 | 642 | /* write output */ |
mturner5 | 0:b7116bd48af6 | 643 | *dst = out; |
mturner5 | 0:b7116bd48af6 | 644 | |
mturner5 | 0:b7116bd48af6 | 645 | /* return num of signbits of out = 1/in value */ |
mturner5 | 0:b7116bd48af6 | 646 | return (signBits + 1); |
mturner5 | 0:b7116bd48af6 | 647 | |
mturner5 | 0:b7116bd48af6 | 648 | } |
mturner5 | 0:b7116bd48af6 | 649 | |
mturner5 | 0:b7116bd48af6 | 650 | |
mturner5 | 0:b7116bd48af6 | 651 | /* |
mturner5 | 0:b7116bd48af6 | 652 | * @brief C custom defined intrinisic function for only M0 processors |
mturner5 | 0:b7116bd48af6 | 653 | */ |
mturner5 | 0:b7116bd48af6 | 654 | #if defined(ARM_MATH_CM0_FAMILY) |
mturner5 | 0:b7116bd48af6 | 655 | |
mturner5 | 0:b7116bd48af6 | 656 | static __INLINE q31_t __SSAT( |
mturner5 | 0:b7116bd48af6 | 657 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 658 | uint32_t y) |
mturner5 | 0:b7116bd48af6 | 659 | { |
mturner5 | 0:b7116bd48af6 | 660 | int32_t posMax, negMin; |
mturner5 | 0:b7116bd48af6 | 661 | uint32_t i; |
mturner5 | 0:b7116bd48af6 | 662 | |
mturner5 | 0:b7116bd48af6 | 663 | posMax = 1; |
mturner5 | 0:b7116bd48af6 | 664 | for (i = 0; i < (y - 1); i++) |
mturner5 | 0:b7116bd48af6 | 665 | { |
mturner5 | 0:b7116bd48af6 | 666 | posMax = posMax * 2; |
mturner5 | 0:b7116bd48af6 | 667 | } |
mturner5 | 0:b7116bd48af6 | 668 | |
mturner5 | 0:b7116bd48af6 | 669 | if(x > 0) |
mturner5 | 0:b7116bd48af6 | 670 | { |
mturner5 | 0:b7116bd48af6 | 671 | posMax = (posMax - 1); |
mturner5 | 0:b7116bd48af6 | 672 | |
mturner5 | 0:b7116bd48af6 | 673 | if(x > posMax) |
mturner5 | 0:b7116bd48af6 | 674 | { |
mturner5 | 0:b7116bd48af6 | 675 | x = posMax; |
mturner5 | 0:b7116bd48af6 | 676 | } |
mturner5 | 0:b7116bd48af6 | 677 | } |
mturner5 | 0:b7116bd48af6 | 678 | else |
mturner5 | 0:b7116bd48af6 | 679 | { |
mturner5 | 0:b7116bd48af6 | 680 | negMin = -posMax; |
mturner5 | 0:b7116bd48af6 | 681 | |
mturner5 | 0:b7116bd48af6 | 682 | if(x < negMin) |
mturner5 | 0:b7116bd48af6 | 683 | { |
mturner5 | 0:b7116bd48af6 | 684 | x = negMin; |
mturner5 | 0:b7116bd48af6 | 685 | } |
mturner5 | 0:b7116bd48af6 | 686 | } |
mturner5 | 0:b7116bd48af6 | 687 | return (x); |
mturner5 | 0:b7116bd48af6 | 688 | |
mturner5 | 0:b7116bd48af6 | 689 | |
mturner5 | 0:b7116bd48af6 | 690 | } |
mturner5 | 0:b7116bd48af6 | 691 | |
mturner5 | 0:b7116bd48af6 | 692 | #endif /* end of ARM_MATH_CM0_FAMILY */ |
mturner5 | 0:b7116bd48af6 | 693 | |
mturner5 | 0:b7116bd48af6 | 694 | |
mturner5 | 0:b7116bd48af6 | 695 | |
mturner5 | 0:b7116bd48af6 | 696 | /* |
mturner5 | 0:b7116bd48af6 | 697 | * @brief C custom defined intrinsic function for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 698 | */ |
mturner5 | 0:b7116bd48af6 | 699 | #if defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) |
mturner5 | 0:b7116bd48af6 | 700 | |
mturner5 | 0:b7116bd48af6 | 701 | /* |
mturner5 | 0:b7116bd48af6 | 702 | * @brief C custom defined QADD8 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 703 | */ |
mturner5 | 0:b7116bd48af6 | 704 | static __INLINE q31_t __QADD8( |
mturner5 | 0:b7116bd48af6 | 705 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 706 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 707 | { |
mturner5 | 0:b7116bd48af6 | 708 | |
mturner5 | 0:b7116bd48af6 | 709 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 710 | q7_t r, s, t, u; |
mturner5 | 0:b7116bd48af6 | 711 | |
mturner5 | 0:b7116bd48af6 | 712 | r = (q7_t) x; |
mturner5 | 0:b7116bd48af6 | 713 | s = (q7_t) y; |
mturner5 | 0:b7116bd48af6 | 714 | |
mturner5 | 0:b7116bd48af6 | 715 | r = __SSAT((q31_t) (r + s), 8); |
mturner5 | 0:b7116bd48af6 | 716 | s = __SSAT(((q31_t) (((x << 16) >> 24) + ((y << 16) >> 24))), 8); |
mturner5 | 0:b7116bd48af6 | 717 | t = __SSAT(((q31_t) (((x << 8) >> 24) + ((y << 8) >> 24))), 8); |
mturner5 | 0:b7116bd48af6 | 718 | u = __SSAT(((q31_t) ((x >> 24) + (y >> 24))), 8); |
mturner5 | 0:b7116bd48af6 | 719 | |
mturner5 | 0:b7116bd48af6 | 720 | sum = |
mturner5 | 0:b7116bd48af6 | 721 | (((q31_t) u << 24) & 0xFF000000) | (((q31_t) t << 16) & 0x00FF0000) | |
mturner5 | 0:b7116bd48af6 | 722 | (((q31_t) s << 8) & 0x0000FF00) | (r & 0x000000FF); |
mturner5 | 0:b7116bd48af6 | 723 | |
mturner5 | 0:b7116bd48af6 | 724 | return sum; |
mturner5 | 0:b7116bd48af6 | 725 | |
mturner5 | 0:b7116bd48af6 | 726 | } |
mturner5 | 0:b7116bd48af6 | 727 | |
mturner5 | 0:b7116bd48af6 | 728 | /* |
mturner5 | 0:b7116bd48af6 | 729 | * @brief C custom defined QSUB8 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 730 | */ |
mturner5 | 0:b7116bd48af6 | 731 | static __INLINE q31_t __QSUB8( |
mturner5 | 0:b7116bd48af6 | 732 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 733 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 734 | { |
mturner5 | 0:b7116bd48af6 | 735 | |
mturner5 | 0:b7116bd48af6 | 736 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 737 | q31_t r, s, t, u; |
mturner5 | 0:b7116bd48af6 | 738 | |
mturner5 | 0:b7116bd48af6 | 739 | r = (q7_t) x; |
mturner5 | 0:b7116bd48af6 | 740 | s = (q7_t) y; |
mturner5 | 0:b7116bd48af6 | 741 | |
mturner5 | 0:b7116bd48af6 | 742 | r = __SSAT((r - s), 8); |
mturner5 | 0:b7116bd48af6 | 743 | s = __SSAT(((q31_t) (((x << 16) >> 24) - ((y << 16) >> 24))), 8) << 8; |
mturner5 | 0:b7116bd48af6 | 744 | t = __SSAT(((q31_t) (((x << 8) >> 24) - ((y << 8) >> 24))), 8) << 16; |
mturner5 | 0:b7116bd48af6 | 745 | u = __SSAT(((q31_t) ((x >> 24) - (y >> 24))), 8) << 24; |
mturner5 | 0:b7116bd48af6 | 746 | |
mturner5 | 0:b7116bd48af6 | 747 | sum = |
mturner5 | 0:b7116bd48af6 | 748 | (u & 0xFF000000) | (t & 0x00FF0000) | (s & 0x0000FF00) | (r & |
mturner5 | 0:b7116bd48af6 | 749 | 0x000000FF); |
mturner5 | 0:b7116bd48af6 | 750 | |
mturner5 | 0:b7116bd48af6 | 751 | return sum; |
mturner5 | 0:b7116bd48af6 | 752 | } |
mturner5 | 0:b7116bd48af6 | 753 | |
mturner5 | 0:b7116bd48af6 | 754 | /* |
mturner5 | 0:b7116bd48af6 | 755 | * @brief C custom defined QADD16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 756 | */ |
mturner5 | 0:b7116bd48af6 | 757 | |
mturner5 | 0:b7116bd48af6 | 758 | /* |
mturner5 | 0:b7116bd48af6 | 759 | * @brief C custom defined QADD16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 760 | */ |
mturner5 | 0:b7116bd48af6 | 761 | static __INLINE q31_t __QADD16( |
mturner5 | 0:b7116bd48af6 | 762 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 763 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 764 | { |
mturner5 | 0:b7116bd48af6 | 765 | |
mturner5 | 0:b7116bd48af6 | 766 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 767 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 768 | |
mturner5 | 0:b7116bd48af6 | 769 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 770 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 771 | |
mturner5 | 0:b7116bd48af6 | 772 | r = __SSAT(r + s, 16); |
mturner5 | 0:b7116bd48af6 | 773 | s = __SSAT(((q31_t) ((x >> 16) + (y >> 16))), 16) << 16; |
mturner5 | 0:b7116bd48af6 | 774 | |
mturner5 | 0:b7116bd48af6 | 775 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 776 | |
mturner5 | 0:b7116bd48af6 | 777 | return sum; |
mturner5 | 0:b7116bd48af6 | 778 | |
mturner5 | 0:b7116bd48af6 | 779 | } |
mturner5 | 0:b7116bd48af6 | 780 | |
mturner5 | 0:b7116bd48af6 | 781 | /* |
mturner5 | 0:b7116bd48af6 | 782 | * @brief C custom defined SHADD16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 783 | */ |
mturner5 | 0:b7116bd48af6 | 784 | static __INLINE q31_t __SHADD16( |
mturner5 | 0:b7116bd48af6 | 785 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 786 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 787 | { |
mturner5 | 0:b7116bd48af6 | 788 | |
mturner5 | 0:b7116bd48af6 | 789 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 790 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 791 | |
mturner5 | 0:b7116bd48af6 | 792 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 793 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 794 | |
mturner5 | 0:b7116bd48af6 | 795 | r = ((r >> 1) + (s >> 1)); |
mturner5 | 0:b7116bd48af6 | 796 | s = ((q31_t) ((x >> 17) + (y >> 17))) << 16; |
mturner5 | 0:b7116bd48af6 | 797 | |
mturner5 | 0:b7116bd48af6 | 798 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 799 | |
mturner5 | 0:b7116bd48af6 | 800 | return sum; |
mturner5 | 0:b7116bd48af6 | 801 | |
mturner5 | 0:b7116bd48af6 | 802 | } |
mturner5 | 0:b7116bd48af6 | 803 | |
mturner5 | 0:b7116bd48af6 | 804 | /* |
mturner5 | 0:b7116bd48af6 | 805 | * @brief C custom defined QSUB16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 806 | */ |
mturner5 | 0:b7116bd48af6 | 807 | static __INLINE q31_t __QSUB16( |
mturner5 | 0:b7116bd48af6 | 808 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 809 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 810 | { |
mturner5 | 0:b7116bd48af6 | 811 | |
mturner5 | 0:b7116bd48af6 | 812 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 813 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 814 | |
mturner5 | 0:b7116bd48af6 | 815 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 816 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 817 | |
mturner5 | 0:b7116bd48af6 | 818 | r = __SSAT(r - s, 16); |
mturner5 | 0:b7116bd48af6 | 819 | s = __SSAT(((q31_t) ((x >> 16) - (y >> 16))), 16) << 16; |
mturner5 | 0:b7116bd48af6 | 820 | |
mturner5 | 0:b7116bd48af6 | 821 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 822 | |
mturner5 | 0:b7116bd48af6 | 823 | return sum; |
mturner5 | 0:b7116bd48af6 | 824 | } |
mturner5 | 0:b7116bd48af6 | 825 | |
mturner5 | 0:b7116bd48af6 | 826 | /* |
mturner5 | 0:b7116bd48af6 | 827 | * @brief C custom defined SHSUB16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 828 | */ |
mturner5 | 0:b7116bd48af6 | 829 | static __INLINE q31_t __SHSUB16( |
mturner5 | 0:b7116bd48af6 | 830 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 831 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 832 | { |
mturner5 | 0:b7116bd48af6 | 833 | |
mturner5 | 0:b7116bd48af6 | 834 | q31_t diff; |
mturner5 | 0:b7116bd48af6 | 835 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 836 | |
mturner5 | 0:b7116bd48af6 | 837 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 838 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 839 | |
mturner5 | 0:b7116bd48af6 | 840 | r = ((r >> 1) - (s >> 1)); |
mturner5 | 0:b7116bd48af6 | 841 | s = (((x >> 17) - (y >> 17)) << 16); |
mturner5 | 0:b7116bd48af6 | 842 | |
mturner5 | 0:b7116bd48af6 | 843 | diff = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 844 | |
mturner5 | 0:b7116bd48af6 | 845 | return diff; |
mturner5 | 0:b7116bd48af6 | 846 | } |
mturner5 | 0:b7116bd48af6 | 847 | |
mturner5 | 0:b7116bd48af6 | 848 | /* |
mturner5 | 0:b7116bd48af6 | 849 | * @brief C custom defined QASX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 850 | */ |
mturner5 | 0:b7116bd48af6 | 851 | static __INLINE q31_t __QASX( |
mturner5 | 0:b7116bd48af6 | 852 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 853 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 854 | { |
mturner5 | 0:b7116bd48af6 | 855 | |
mturner5 | 0:b7116bd48af6 | 856 | q31_t sum = 0; |
mturner5 | 0:b7116bd48af6 | 857 | |
mturner5 | 0:b7116bd48af6 | 858 | sum = |
mturner5 | 0:b7116bd48af6 | 859 | ((sum + |
mturner5 | 0:b7116bd48af6 | 860 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) + (q15_t) y))) << 16) + |
mturner5 | 0:b7116bd48af6 | 861 | clip_q31_to_q15((q31_t) ((q15_t) x - (q15_t) (y >> 16))); |
mturner5 | 0:b7116bd48af6 | 862 | |
mturner5 | 0:b7116bd48af6 | 863 | return sum; |
mturner5 | 0:b7116bd48af6 | 864 | } |
mturner5 | 0:b7116bd48af6 | 865 | |
mturner5 | 0:b7116bd48af6 | 866 | /* |
mturner5 | 0:b7116bd48af6 | 867 | * @brief C custom defined SHASX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 868 | */ |
mturner5 | 0:b7116bd48af6 | 869 | static __INLINE q31_t __SHASX( |
mturner5 | 0:b7116bd48af6 | 870 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 871 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 872 | { |
mturner5 | 0:b7116bd48af6 | 873 | |
mturner5 | 0:b7116bd48af6 | 874 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 875 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 876 | |
mturner5 | 0:b7116bd48af6 | 877 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 878 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 879 | |
mturner5 | 0:b7116bd48af6 | 880 | r = ((r >> 1) - (y >> 17)); |
mturner5 | 0:b7116bd48af6 | 881 | s = (((x >> 17) + (s >> 1)) << 16); |
mturner5 | 0:b7116bd48af6 | 882 | |
mturner5 | 0:b7116bd48af6 | 883 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 884 | |
mturner5 | 0:b7116bd48af6 | 885 | return sum; |
mturner5 | 0:b7116bd48af6 | 886 | } |
mturner5 | 0:b7116bd48af6 | 887 | |
mturner5 | 0:b7116bd48af6 | 888 | |
mturner5 | 0:b7116bd48af6 | 889 | /* |
mturner5 | 0:b7116bd48af6 | 890 | * @brief C custom defined QSAX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 891 | */ |
mturner5 | 0:b7116bd48af6 | 892 | static __INLINE q31_t __QSAX( |
mturner5 | 0:b7116bd48af6 | 893 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 894 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 895 | { |
mturner5 | 0:b7116bd48af6 | 896 | |
mturner5 | 0:b7116bd48af6 | 897 | q31_t sum = 0; |
mturner5 | 0:b7116bd48af6 | 898 | |
mturner5 | 0:b7116bd48af6 | 899 | sum = |
mturner5 | 0:b7116bd48af6 | 900 | ((sum + |
mturner5 | 0:b7116bd48af6 | 901 | clip_q31_to_q15((q31_t) ((q15_t) (x >> 16) - (q15_t) y))) << 16) + |
mturner5 | 0:b7116bd48af6 | 902 | clip_q31_to_q15((q31_t) ((q15_t) x + (q15_t) (y >> 16))); |
mturner5 | 0:b7116bd48af6 | 903 | |
mturner5 | 0:b7116bd48af6 | 904 | return sum; |
mturner5 | 0:b7116bd48af6 | 905 | } |
mturner5 | 0:b7116bd48af6 | 906 | |
mturner5 | 0:b7116bd48af6 | 907 | /* |
mturner5 | 0:b7116bd48af6 | 908 | * @brief C custom defined SHSAX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 909 | */ |
mturner5 | 0:b7116bd48af6 | 910 | static __INLINE q31_t __SHSAX( |
mturner5 | 0:b7116bd48af6 | 911 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 912 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 913 | { |
mturner5 | 0:b7116bd48af6 | 914 | |
mturner5 | 0:b7116bd48af6 | 915 | q31_t sum; |
mturner5 | 0:b7116bd48af6 | 916 | q31_t r, s; |
mturner5 | 0:b7116bd48af6 | 917 | |
mturner5 | 0:b7116bd48af6 | 918 | r = (q15_t) x; |
mturner5 | 0:b7116bd48af6 | 919 | s = (q15_t) y; |
mturner5 | 0:b7116bd48af6 | 920 | |
mturner5 | 0:b7116bd48af6 | 921 | r = ((r >> 1) + (y >> 17)); |
mturner5 | 0:b7116bd48af6 | 922 | s = (((x >> 17) - (s >> 1)) << 16); |
mturner5 | 0:b7116bd48af6 | 923 | |
mturner5 | 0:b7116bd48af6 | 924 | sum = (s & 0xFFFF0000) | (r & 0x0000FFFF); |
mturner5 | 0:b7116bd48af6 | 925 | |
mturner5 | 0:b7116bd48af6 | 926 | return sum; |
mturner5 | 0:b7116bd48af6 | 927 | } |
mturner5 | 0:b7116bd48af6 | 928 | |
mturner5 | 0:b7116bd48af6 | 929 | /* |
mturner5 | 0:b7116bd48af6 | 930 | * @brief C custom defined SMUSDX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 931 | */ |
mturner5 | 0:b7116bd48af6 | 932 | static __INLINE q31_t __SMUSDX( |
mturner5 | 0:b7116bd48af6 | 933 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 934 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 935 | { |
mturner5 | 0:b7116bd48af6 | 936 | |
mturner5 | 0:b7116bd48af6 | 937 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) - |
mturner5 | 0:b7116bd48af6 | 938 | ((q15_t) (x >> 16) * (q15_t) y))); |
mturner5 | 0:b7116bd48af6 | 939 | } |
mturner5 | 0:b7116bd48af6 | 940 | |
mturner5 | 0:b7116bd48af6 | 941 | /* |
mturner5 | 0:b7116bd48af6 | 942 | * @brief C custom defined SMUADX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 943 | */ |
mturner5 | 0:b7116bd48af6 | 944 | static __INLINE q31_t __SMUADX( |
mturner5 | 0:b7116bd48af6 | 945 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 946 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 947 | { |
mturner5 | 0:b7116bd48af6 | 948 | |
mturner5 | 0:b7116bd48af6 | 949 | return ((q31_t) (((q15_t) x * (q15_t) (y >> 16)) + |
mturner5 | 0:b7116bd48af6 | 950 | ((q15_t) (x >> 16) * (q15_t) y))); |
mturner5 | 0:b7116bd48af6 | 951 | } |
mturner5 | 0:b7116bd48af6 | 952 | |
mturner5 | 0:b7116bd48af6 | 953 | /* |
mturner5 | 0:b7116bd48af6 | 954 | * @brief C custom defined QADD for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 955 | */ |
mturner5 | 0:b7116bd48af6 | 956 | static __INLINE q31_t __QADD( |
mturner5 | 0:b7116bd48af6 | 957 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 958 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 959 | { |
mturner5 | 0:b7116bd48af6 | 960 | return clip_q63_to_q31((q63_t) x + y); |
mturner5 | 0:b7116bd48af6 | 961 | } |
mturner5 | 0:b7116bd48af6 | 962 | |
mturner5 | 0:b7116bd48af6 | 963 | /* |
mturner5 | 0:b7116bd48af6 | 964 | * @brief C custom defined QSUB for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 965 | */ |
mturner5 | 0:b7116bd48af6 | 966 | static __INLINE q31_t __QSUB( |
mturner5 | 0:b7116bd48af6 | 967 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 968 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 969 | { |
mturner5 | 0:b7116bd48af6 | 970 | return clip_q63_to_q31((q63_t) x - y); |
mturner5 | 0:b7116bd48af6 | 971 | } |
mturner5 | 0:b7116bd48af6 | 972 | |
mturner5 | 0:b7116bd48af6 | 973 | /* |
mturner5 | 0:b7116bd48af6 | 974 | * @brief C custom defined SMLAD for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 975 | */ |
mturner5 | 0:b7116bd48af6 | 976 | static __INLINE q31_t __SMLAD( |
mturner5 | 0:b7116bd48af6 | 977 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 978 | q31_t y, |
mturner5 | 0:b7116bd48af6 | 979 | q31_t sum) |
mturner5 | 0:b7116bd48af6 | 980 | { |
mturner5 | 0:b7116bd48af6 | 981 | |
mturner5 | 0:b7116bd48af6 | 982 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
mturner5 | 0:b7116bd48af6 | 983 | ((q15_t) x * (q15_t) y)); |
mturner5 | 0:b7116bd48af6 | 984 | } |
mturner5 | 0:b7116bd48af6 | 985 | |
mturner5 | 0:b7116bd48af6 | 986 | /* |
mturner5 | 0:b7116bd48af6 | 987 | * @brief C custom defined SMLADX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 988 | */ |
mturner5 | 0:b7116bd48af6 | 989 | static __INLINE q31_t __SMLADX( |
mturner5 | 0:b7116bd48af6 | 990 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 991 | q31_t y, |
mturner5 | 0:b7116bd48af6 | 992 | q31_t sum) |
mturner5 | 0:b7116bd48af6 | 993 | { |
mturner5 | 0:b7116bd48af6 | 994 | |
mturner5 | 0:b7116bd48af6 | 995 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y)) + |
mturner5 | 0:b7116bd48af6 | 996 | ((q15_t) x * (q15_t) (y >> 16))); |
mturner5 | 0:b7116bd48af6 | 997 | } |
mturner5 | 0:b7116bd48af6 | 998 | |
mturner5 | 0:b7116bd48af6 | 999 | /* |
mturner5 | 0:b7116bd48af6 | 1000 | * @brief C custom defined SMLSDX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1001 | */ |
mturner5 | 0:b7116bd48af6 | 1002 | static __INLINE q31_t __SMLSDX( |
mturner5 | 0:b7116bd48af6 | 1003 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 1004 | q31_t y, |
mturner5 | 0:b7116bd48af6 | 1005 | q31_t sum) |
mturner5 | 0:b7116bd48af6 | 1006 | { |
mturner5 | 0:b7116bd48af6 | 1007 | |
mturner5 | 0:b7116bd48af6 | 1008 | return (sum - ((q15_t) (x >> 16) * (q15_t) (y)) + |
mturner5 | 0:b7116bd48af6 | 1009 | ((q15_t) x * (q15_t) (y >> 16))); |
mturner5 | 0:b7116bd48af6 | 1010 | } |
mturner5 | 0:b7116bd48af6 | 1011 | |
mturner5 | 0:b7116bd48af6 | 1012 | /* |
mturner5 | 0:b7116bd48af6 | 1013 | * @brief C custom defined SMLALD for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1014 | */ |
mturner5 | 0:b7116bd48af6 | 1015 | static __INLINE q63_t __SMLALD( |
mturner5 | 0:b7116bd48af6 | 1016 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 1017 | q31_t y, |
mturner5 | 0:b7116bd48af6 | 1018 | q63_t sum) |
mturner5 | 0:b7116bd48af6 | 1019 | { |
mturner5 | 0:b7116bd48af6 | 1020 | |
mturner5 | 0:b7116bd48af6 | 1021 | return (sum + ((q15_t) (x >> 16) * (q15_t) (y >> 16)) + |
mturner5 | 0:b7116bd48af6 | 1022 | ((q15_t) x * (q15_t) y)); |
mturner5 | 0:b7116bd48af6 | 1023 | } |
mturner5 | 0:b7116bd48af6 | 1024 | |
mturner5 | 0:b7116bd48af6 | 1025 | /* |
mturner5 | 0:b7116bd48af6 | 1026 | * @brief C custom defined SMLALDX for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1027 | */ |
mturner5 | 0:b7116bd48af6 | 1028 | static __INLINE q63_t __SMLALDX( |
mturner5 | 0:b7116bd48af6 | 1029 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 1030 | q31_t y, |
mturner5 | 0:b7116bd48af6 | 1031 | q63_t sum) |
mturner5 | 0:b7116bd48af6 | 1032 | { |
mturner5 | 0:b7116bd48af6 | 1033 | |
mturner5 | 0:b7116bd48af6 | 1034 | return (sum + ((q15_t) (x >> 16) * (q15_t) y)) + |
mturner5 | 0:b7116bd48af6 | 1035 | ((q15_t) x * (q15_t) (y >> 16)); |
mturner5 | 0:b7116bd48af6 | 1036 | } |
mturner5 | 0:b7116bd48af6 | 1037 | |
mturner5 | 0:b7116bd48af6 | 1038 | /* |
mturner5 | 0:b7116bd48af6 | 1039 | * @brief C custom defined SMUAD for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1040 | */ |
mturner5 | 0:b7116bd48af6 | 1041 | static __INLINE q31_t __SMUAD( |
mturner5 | 0:b7116bd48af6 | 1042 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 1043 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 1044 | { |
mturner5 | 0:b7116bd48af6 | 1045 | |
mturner5 | 0:b7116bd48af6 | 1046 | return (((x >> 16) * (y >> 16)) + |
mturner5 | 0:b7116bd48af6 | 1047 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
mturner5 | 0:b7116bd48af6 | 1048 | } |
mturner5 | 0:b7116bd48af6 | 1049 | |
mturner5 | 0:b7116bd48af6 | 1050 | /* |
mturner5 | 0:b7116bd48af6 | 1051 | * @brief C custom defined SMUSD for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1052 | */ |
mturner5 | 0:b7116bd48af6 | 1053 | static __INLINE q31_t __SMUSD( |
mturner5 | 0:b7116bd48af6 | 1054 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 1055 | q31_t y) |
mturner5 | 0:b7116bd48af6 | 1056 | { |
mturner5 | 0:b7116bd48af6 | 1057 | |
mturner5 | 0:b7116bd48af6 | 1058 | return (-((x >> 16) * (y >> 16)) + |
mturner5 | 0:b7116bd48af6 | 1059 | (((x << 16) >> 16) * ((y << 16) >> 16))); |
mturner5 | 0:b7116bd48af6 | 1060 | } |
mturner5 | 0:b7116bd48af6 | 1061 | |
mturner5 | 0:b7116bd48af6 | 1062 | |
mturner5 | 0:b7116bd48af6 | 1063 | /* |
mturner5 | 0:b7116bd48af6 | 1064 | * @brief C custom defined SXTB16 for M3 and M0 processors |
mturner5 | 0:b7116bd48af6 | 1065 | */ |
mturner5 | 0:b7116bd48af6 | 1066 | static __INLINE q31_t __SXTB16( |
mturner5 | 0:b7116bd48af6 | 1067 | q31_t x) |
mturner5 | 0:b7116bd48af6 | 1068 | { |
mturner5 | 0:b7116bd48af6 | 1069 | |
mturner5 | 0:b7116bd48af6 | 1070 | return ((((x << 24) >> 24) & 0x0000FFFF) | |
mturner5 | 0:b7116bd48af6 | 1071 | (((x << 8) >> 8) & 0xFFFF0000)); |
mturner5 | 0:b7116bd48af6 | 1072 | } |
mturner5 | 0:b7116bd48af6 | 1073 | |
mturner5 | 0:b7116bd48af6 | 1074 | |
mturner5 | 0:b7116bd48af6 | 1075 | #endif /* defined (ARM_MATH_CM3) || defined (ARM_MATH_CM0_FAMILY) */ |
mturner5 | 0:b7116bd48af6 | 1076 | |
mturner5 | 0:b7116bd48af6 | 1077 | |
mturner5 | 0:b7116bd48af6 | 1078 | /** |
mturner5 | 0:b7116bd48af6 | 1079 | * @brief Instance structure for the Q7 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1080 | */ |
mturner5 | 0:b7116bd48af6 | 1081 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1082 | { |
mturner5 | 0:b7116bd48af6 | 1083 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 1084 | q7_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 1085 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 1086 | } arm_fir_instance_q7; |
mturner5 | 0:b7116bd48af6 | 1087 | |
mturner5 | 0:b7116bd48af6 | 1088 | /** |
mturner5 | 0:b7116bd48af6 | 1089 | * @brief Instance structure for the Q15 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1090 | */ |
mturner5 | 0:b7116bd48af6 | 1091 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1092 | { |
mturner5 | 0:b7116bd48af6 | 1093 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 1094 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 1095 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 1096 | } arm_fir_instance_q15; |
mturner5 | 0:b7116bd48af6 | 1097 | |
mturner5 | 0:b7116bd48af6 | 1098 | /** |
mturner5 | 0:b7116bd48af6 | 1099 | * @brief Instance structure for the Q31 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1100 | */ |
mturner5 | 0:b7116bd48af6 | 1101 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1102 | { |
mturner5 | 0:b7116bd48af6 | 1103 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 1104 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 1105 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 1106 | } arm_fir_instance_q31; |
mturner5 | 0:b7116bd48af6 | 1107 | |
mturner5 | 0:b7116bd48af6 | 1108 | /** |
mturner5 | 0:b7116bd48af6 | 1109 | * @brief Instance structure for the floating-point FIR filter. |
mturner5 | 0:b7116bd48af6 | 1110 | */ |
mturner5 | 0:b7116bd48af6 | 1111 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1112 | { |
mturner5 | 0:b7116bd48af6 | 1113 | uint16_t numTaps; /**< number of filter coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 1114 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 1115 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 1116 | } arm_fir_instance_f32; |
mturner5 | 0:b7116bd48af6 | 1117 | |
mturner5 | 0:b7116bd48af6 | 1118 | |
mturner5 | 0:b7116bd48af6 | 1119 | /** |
mturner5 | 0:b7116bd48af6 | 1120 | * @brief Processing function for the Q7 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1121 | * @param[in] *S points to an instance of the Q7 FIR filter structure. |
mturner5 | 0:b7116bd48af6 | 1122 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1123 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1124 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1125 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1126 | */ |
mturner5 | 0:b7116bd48af6 | 1127 | void arm_fir_q7( |
mturner5 | 0:b7116bd48af6 | 1128 | const arm_fir_instance_q7 * S, |
mturner5 | 0:b7116bd48af6 | 1129 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1130 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1131 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1132 | |
mturner5 | 0:b7116bd48af6 | 1133 | |
mturner5 | 0:b7116bd48af6 | 1134 | /** |
mturner5 | 0:b7116bd48af6 | 1135 | * @brief Initialization function for the Q7 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1136 | * @param[in,out] *S points to an instance of the Q7 FIR structure. |
mturner5 | 0:b7116bd48af6 | 1137 | * @param[in] numTaps Number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 1138 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1139 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1140 | * @param[in] blockSize number of samples that are processed. |
mturner5 | 0:b7116bd48af6 | 1141 | * @return none |
mturner5 | 0:b7116bd48af6 | 1142 | */ |
mturner5 | 0:b7116bd48af6 | 1143 | void arm_fir_init_q7( |
mturner5 | 0:b7116bd48af6 | 1144 | arm_fir_instance_q7 * S, |
mturner5 | 0:b7116bd48af6 | 1145 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 1146 | q7_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1147 | q7_t * pState, |
mturner5 | 0:b7116bd48af6 | 1148 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1149 | |
mturner5 | 0:b7116bd48af6 | 1150 | |
mturner5 | 0:b7116bd48af6 | 1151 | /** |
mturner5 | 0:b7116bd48af6 | 1152 | * @brief Processing function for the Q15 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1153 | * @param[in] *S points to an instance of the Q15 FIR structure. |
mturner5 | 0:b7116bd48af6 | 1154 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1155 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1156 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1157 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1158 | */ |
mturner5 | 0:b7116bd48af6 | 1159 | void arm_fir_q15( |
mturner5 | 0:b7116bd48af6 | 1160 | const arm_fir_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1161 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1162 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1163 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1164 | |
mturner5 | 0:b7116bd48af6 | 1165 | /** |
mturner5 | 0:b7116bd48af6 | 1166 | * @brief Processing function for the fast Q15 FIR filter for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 1167 | * @param[in] *S points to an instance of the Q15 FIR filter structure. |
mturner5 | 0:b7116bd48af6 | 1168 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1169 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1170 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1171 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1172 | */ |
mturner5 | 0:b7116bd48af6 | 1173 | void arm_fir_fast_q15( |
mturner5 | 0:b7116bd48af6 | 1174 | const arm_fir_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1175 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1176 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1177 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1178 | |
mturner5 | 0:b7116bd48af6 | 1179 | /** |
mturner5 | 0:b7116bd48af6 | 1180 | * @brief Initialization function for the Q15 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1181 | * @param[in,out] *S points to an instance of the Q15 FIR filter structure. |
mturner5 | 0:b7116bd48af6 | 1182 | * @param[in] numTaps Number of filter coefficients in the filter. Must be even and greater than or equal to 4. |
mturner5 | 0:b7116bd48af6 | 1183 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1184 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1185 | * @param[in] blockSize number of samples that are processed at a time. |
mturner5 | 0:b7116bd48af6 | 1186 | * @return The function returns ARM_MATH_SUCCESS if initialization was successful or ARM_MATH_ARGUMENT_ERROR if |
mturner5 | 0:b7116bd48af6 | 1187 | * <code>numTaps</code> is not a supported value. |
mturner5 | 0:b7116bd48af6 | 1188 | */ |
mturner5 | 0:b7116bd48af6 | 1189 | |
mturner5 | 0:b7116bd48af6 | 1190 | arm_status arm_fir_init_q15( |
mturner5 | 0:b7116bd48af6 | 1191 | arm_fir_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1192 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 1193 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1194 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 1195 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1196 | |
mturner5 | 0:b7116bd48af6 | 1197 | /** |
mturner5 | 0:b7116bd48af6 | 1198 | * @brief Processing function for the Q31 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1199 | * @param[in] *S points to an instance of the Q31 FIR filter structure. |
mturner5 | 0:b7116bd48af6 | 1200 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1201 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1202 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1203 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1204 | */ |
mturner5 | 0:b7116bd48af6 | 1205 | void arm_fir_q31( |
mturner5 | 0:b7116bd48af6 | 1206 | const arm_fir_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1207 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1208 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1209 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1210 | |
mturner5 | 0:b7116bd48af6 | 1211 | /** |
mturner5 | 0:b7116bd48af6 | 1212 | * @brief Processing function for the fast Q31 FIR filter for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 1213 | * @param[in] *S points to an instance of the Q31 FIR structure. |
mturner5 | 0:b7116bd48af6 | 1214 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1215 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1216 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1217 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1218 | */ |
mturner5 | 0:b7116bd48af6 | 1219 | void arm_fir_fast_q31( |
mturner5 | 0:b7116bd48af6 | 1220 | const arm_fir_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1221 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1222 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1223 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1224 | |
mturner5 | 0:b7116bd48af6 | 1225 | /** |
mturner5 | 0:b7116bd48af6 | 1226 | * @brief Initialization function for the Q31 FIR filter. |
mturner5 | 0:b7116bd48af6 | 1227 | * @param[in,out] *S points to an instance of the Q31 FIR structure. |
mturner5 | 0:b7116bd48af6 | 1228 | * @param[in] numTaps Number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 1229 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1230 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1231 | * @param[in] blockSize number of samples that are processed at a time. |
mturner5 | 0:b7116bd48af6 | 1232 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1233 | */ |
mturner5 | 0:b7116bd48af6 | 1234 | void arm_fir_init_q31( |
mturner5 | 0:b7116bd48af6 | 1235 | arm_fir_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1236 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 1237 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1238 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 1239 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1240 | |
mturner5 | 0:b7116bd48af6 | 1241 | /** |
mturner5 | 0:b7116bd48af6 | 1242 | * @brief Processing function for the floating-point FIR filter. |
mturner5 | 0:b7116bd48af6 | 1243 | * @param[in] *S points to an instance of the floating-point FIR structure. |
mturner5 | 0:b7116bd48af6 | 1244 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1245 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1246 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1247 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1248 | */ |
mturner5 | 0:b7116bd48af6 | 1249 | void arm_fir_f32( |
mturner5 | 0:b7116bd48af6 | 1250 | const arm_fir_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1251 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1252 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1253 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1254 | |
mturner5 | 0:b7116bd48af6 | 1255 | /** |
mturner5 | 0:b7116bd48af6 | 1256 | * @brief Initialization function for the floating-point FIR filter. |
mturner5 | 0:b7116bd48af6 | 1257 | * @param[in,out] *S points to an instance of the floating-point FIR filter structure. |
mturner5 | 0:b7116bd48af6 | 1258 | * @param[in] numTaps Number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 1259 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1260 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1261 | * @param[in] blockSize number of samples that are processed at a time. |
mturner5 | 0:b7116bd48af6 | 1262 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1263 | */ |
mturner5 | 0:b7116bd48af6 | 1264 | void arm_fir_init_f32( |
mturner5 | 0:b7116bd48af6 | 1265 | arm_fir_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1266 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 1267 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1268 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 1269 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1270 | |
mturner5 | 0:b7116bd48af6 | 1271 | |
mturner5 | 0:b7116bd48af6 | 1272 | /** |
mturner5 | 0:b7116bd48af6 | 1273 | * @brief Instance structure for the Q15 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1274 | */ |
mturner5 | 0:b7116bd48af6 | 1275 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1276 | { |
mturner5 | 0:b7116bd48af6 | 1277 | int8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1278 | q15_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1279 | q15_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1280 | int8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
mturner5 | 0:b7116bd48af6 | 1281 | |
mturner5 | 0:b7116bd48af6 | 1282 | } arm_biquad_casd_df1_inst_q15; |
mturner5 | 0:b7116bd48af6 | 1283 | |
mturner5 | 0:b7116bd48af6 | 1284 | |
mturner5 | 0:b7116bd48af6 | 1285 | /** |
mturner5 | 0:b7116bd48af6 | 1286 | * @brief Instance structure for the Q31 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1287 | */ |
mturner5 | 0:b7116bd48af6 | 1288 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1289 | { |
mturner5 | 0:b7116bd48af6 | 1290 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1291 | q31_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1292 | q31_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1293 | uint8_t postShift; /**< Additional shift, in bits, applied to each output sample. */ |
mturner5 | 0:b7116bd48af6 | 1294 | |
mturner5 | 0:b7116bd48af6 | 1295 | } arm_biquad_casd_df1_inst_q31; |
mturner5 | 0:b7116bd48af6 | 1296 | |
mturner5 | 0:b7116bd48af6 | 1297 | /** |
mturner5 | 0:b7116bd48af6 | 1298 | * @brief Instance structure for the floating-point Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1299 | */ |
mturner5 | 0:b7116bd48af6 | 1300 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1301 | { |
mturner5 | 0:b7116bd48af6 | 1302 | uint32_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1303 | float32_t *pState; /**< Points to the array of state coefficients. The array is of length 4*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1304 | float32_t *pCoeffs; /**< Points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 1305 | |
mturner5 | 0:b7116bd48af6 | 1306 | |
mturner5 | 0:b7116bd48af6 | 1307 | } arm_biquad_casd_df1_inst_f32; |
mturner5 | 0:b7116bd48af6 | 1308 | |
mturner5 | 0:b7116bd48af6 | 1309 | |
mturner5 | 0:b7116bd48af6 | 1310 | |
mturner5 | 0:b7116bd48af6 | 1311 | /** |
mturner5 | 0:b7116bd48af6 | 1312 | * @brief Processing function for the Q15 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1313 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1314 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1315 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1316 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1317 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1318 | */ |
mturner5 | 0:b7116bd48af6 | 1319 | |
mturner5 | 0:b7116bd48af6 | 1320 | void arm_biquad_cascade_df1_q15( |
mturner5 | 0:b7116bd48af6 | 1321 | const arm_biquad_casd_df1_inst_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1322 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1323 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1324 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1325 | |
mturner5 | 0:b7116bd48af6 | 1326 | /** |
mturner5 | 0:b7116bd48af6 | 1327 | * @brief Initialization function for the Q15 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1328 | * @param[in,out] *S points to an instance of the Q15 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1329 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 1330 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1331 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1332 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
mturner5 | 0:b7116bd48af6 | 1333 | * @return none |
mturner5 | 0:b7116bd48af6 | 1334 | */ |
mturner5 | 0:b7116bd48af6 | 1335 | |
mturner5 | 0:b7116bd48af6 | 1336 | void arm_biquad_cascade_df1_init_q15( |
mturner5 | 0:b7116bd48af6 | 1337 | arm_biquad_casd_df1_inst_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1338 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 1339 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1340 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 1341 | int8_t postShift); |
mturner5 | 0:b7116bd48af6 | 1342 | |
mturner5 | 0:b7116bd48af6 | 1343 | |
mturner5 | 0:b7116bd48af6 | 1344 | /** |
mturner5 | 0:b7116bd48af6 | 1345 | * @brief Fast but less precise processing function for the Q15 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 1346 | * @param[in] *S points to an instance of the Q15 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1347 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1348 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1349 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1350 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1351 | */ |
mturner5 | 0:b7116bd48af6 | 1352 | |
mturner5 | 0:b7116bd48af6 | 1353 | void arm_biquad_cascade_df1_fast_q15( |
mturner5 | 0:b7116bd48af6 | 1354 | const arm_biquad_casd_df1_inst_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1355 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1356 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1357 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1358 | |
mturner5 | 0:b7116bd48af6 | 1359 | |
mturner5 | 0:b7116bd48af6 | 1360 | /** |
mturner5 | 0:b7116bd48af6 | 1361 | * @brief Processing function for the Q31 Biquad cascade filter |
mturner5 | 0:b7116bd48af6 | 1362 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1363 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1364 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1365 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1366 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1367 | */ |
mturner5 | 0:b7116bd48af6 | 1368 | |
mturner5 | 0:b7116bd48af6 | 1369 | void arm_biquad_cascade_df1_q31( |
mturner5 | 0:b7116bd48af6 | 1370 | const arm_biquad_casd_df1_inst_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1371 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1372 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1373 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1374 | |
mturner5 | 0:b7116bd48af6 | 1375 | /** |
mturner5 | 0:b7116bd48af6 | 1376 | * @brief Fast but less precise processing function for the Q31 Biquad cascade filter for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 1377 | * @param[in] *S points to an instance of the Q31 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1378 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1379 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1380 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1381 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1382 | */ |
mturner5 | 0:b7116bd48af6 | 1383 | |
mturner5 | 0:b7116bd48af6 | 1384 | void arm_biquad_cascade_df1_fast_q31( |
mturner5 | 0:b7116bd48af6 | 1385 | const arm_biquad_casd_df1_inst_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1386 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1387 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1388 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1389 | |
mturner5 | 0:b7116bd48af6 | 1390 | /** |
mturner5 | 0:b7116bd48af6 | 1391 | * @brief Initialization function for the Q31 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1392 | * @param[in,out] *S points to an instance of the Q31 Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1393 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 1394 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1395 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1396 | * @param[in] postShift Shift to be applied to the output. Varies according to the coefficients format |
mturner5 | 0:b7116bd48af6 | 1397 | * @return none |
mturner5 | 0:b7116bd48af6 | 1398 | */ |
mturner5 | 0:b7116bd48af6 | 1399 | |
mturner5 | 0:b7116bd48af6 | 1400 | void arm_biquad_cascade_df1_init_q31( |
mturner5 | 0:b7116bd48af6 | 1401 | arm_biquad_casd_df1_inst_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1402 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 1403 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1404 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 1405 | int8_t postShift); |
mturner5 | 0:b7116bd48af6 | 1406 | |
mturner5 | 0:b7116bd48af6 | 1407 | /** |
mturner5 | 0:b7116bd48af6 | 1408 | * @brief Processing function for the floating-point Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1409 | * @param[in] *S points to an instance of the floating-point Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1410 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 1411 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 1412 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 1413 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1414 | */ |
mturner5 | 0:b7116bd48af6 | 1415 | |
mturner5 | 0:b7116bd48af6 | 1416 | void arm_biquad_cascade_df1_f32( |
mturner5 | 0:b7116bd48af6 | 1417 | const arm_biquad_casd_df1_inst_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1418 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 1419 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1420 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1421 | |
mturner5 | 0:b7116bd48af6 | 1422 | /** |
mturner5 | 0:b7116bd48af6 | 1423 | * @brief Initialization function for the floating-point Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 1424 | * @param[in,out] *S points to an instance of the floating-point Biquad cascade structure. |
mturner5 | 0:b7116bd48af6 | 1425 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 1426 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 1427 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 1428 | * @return none |
mturner5 | 0:b7116bd48af6 | 1429 | */ |
mturner5 | 0:b7116bd48af6 | 1430 | |
mturner5 | 0:b7116bd48af6 | 1431 | void arm_biquad_cascade_df1_init_f32( |
mturner5 | 0:b7116bd48af6 | 1432 | arm_biquad_casd_df1_inst_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1433 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 1434 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 1435 | float32_t * pState); |
mturner5 | 0:b7116bd48af6 | 1436 | |
mturner5 | 0:b7116bd48af6 | 1437 | |
mturner5 | 0:b7116bd48af6 | 1438 | /** |
mturner5 | 0:b7116bd48af6 | 1439 | * @brief Instance structure for the floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 1440 | */ |
mturner5 | 0:b7116bd48af6 | 1441 | |
mturner5 | 0:b7116bd48af6 | 1442 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1443 | { |
mturner5 | 0:b7116bd48af6 | 1444 | uint16_t numRows; /**< number of rows of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1445 | uint16_t numCols; /**< number of columns of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1446 | float32_t *pData; /**< points to the data of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1447 | } arm_matrix_instance_f32; |
mturner5 | 0:b7116bd48af6 | 1448 | |
mturner5 | 0:b7116bd48af6 | 1449 | |
mturner5 | 0:b7116bd48af6 | 1450 | /** |
mturner5 | 0:b7116bd48af6 | 1451 | * @brief Instance structure for the floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 1452 | */ |
mturner5 | 0:b7116bd48af6 | 1453 | |
mturner5 | 0:b7116bd48af6 | 1454 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1455 | { |
mturner5 | 0:b7116bd48af6 | 1456 | uint16_t numRows; /**< number of rows of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1457 | uint16_t numCols; /**< number of columns of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1458 | float64_t *pData; /**< points to the data of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1459 | } arm_matrix_instance_f64; |
mturner5 | 0:b7116bd48af6 | 1460 | |
mturner5 | 0:b7116bd48af6 | 1461 | /** |
mturner5 | 0:b7116bd48af6 | 1462 | * @brief Instance structure for the Q15 matrix structure. |
mturner5 | 0:b7116bd48af6 | 1463 | */ |
mturner5 | 0:b7116bd48af6 | 1464 | |
mturner5 | 0:b7116bd48af6 | 1465 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1466 | { |
mturner5 | 0:b7116bd48af6 | 1467 | uint16_t numRows; /**< number of rows of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1468 | uint16_t numCols; /**< number of columns of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1469 | q15_t *pData; /**< points to the data of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1470 | |
mturner5 | 0:b7116bd48af6 | 1471 | } arm_matrix_instance_q15; |
mturner5 | 0:b7116bd48af6 | 1472 | |
mturner5 | 0:b7116bd48af6 | 1473 | /** |
mturner5 | 0:b7116bd48af6 | 1474 | * @brief Instance structure for the Q31 matrix structure. |
mturner5 | 0:b7116bd48af6 | 1475 | */ |
mturner5 | 0:b7116bd48af6 | 1476 | |
mturner5 | 0:b7116bd48af6 | 1477 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1478 | { |
mturner5 | 0:b7116bd48af6 | 1479 | uint16_t numRows; /**< number of rows of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1480 | uint16_t numCols; /**< number of columns of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1481 | q31_t *pData; /**< points to the data of the matrix. */ |
mturner5 | 0:b7116bd48af6 | 1482 | |
mturner5 | 0:b7116bd48af6 | 1483 | } arm_matrix_instance_q31; |
mturner5 | 0:b7116bd48af6 | 1484 | |
mturner5 | 0:b7116bd48af6 | 1485 | |
mturner5 | 0:b7116bd48af6 | 1486 | |
mturner5 | 0:b7116bd48af6 | 1487 | /** |
mturner5 | 0:b7116bd48af6 | 1488 | * @brief Floating-point matrix addition. |
mturner5 | 0:b7116bd48af6 | 1489 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1490 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1491 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1492 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1493 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1494 | */ |
mturner5 | 0:b7116bd48af6 | 1495 | |
mturner5 | 0:b7116bd48af6 | 1496 | arm_status arm_mat_add_f32( |
mturner5 | 0:b7116bd48af6 | 1497 | const arm_matrix_instance_f32 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1498 | const arm_matrix_instance_f32 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1499 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1500 | |
mturner5 | 0:b7116bd48af6 | 1501 | /** |
mturner5 | 0:b7116bd48af6 | 1502 | * @brief Q15 matrix addition. |
mturner5 | 0:b7116bd48af6 | 1503 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1504 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1505 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1506 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1507 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1508 | */ |
mturner5 | 0:b7116bd48af6 | 1509 | |
mturner5 | 0:b7116bd48af6 | 1510 | arm_status arm_mat_add_q15( |
mturner5 | 0:b7116bd48af6 | 1511 | const arm_matrix_instance_q15 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1512 | const arm_matrix_instance_q15 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1513 | arm_matrix_instance_q15 * pDst); |
mturner5 | 0:b7116bd48af6 | 1514 | |
mturner5 | 0:b7116bd48af6 | 1515 | /** |
mturner5 | 0:b7116bd48af6 | 1516 | * @brief Q31 matrix addition. |
mturner5 | 0:b7116bd48af6 | 1517 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1518 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1519 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1520 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1521 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1522 | */ |
mturner5 | 0:b7116bd48af6 | 1523 | |
mturner5 | 0:b7116bd48af6 | 1524 | arm_status arm_mat_add_q31( |
mturner5 | 0:b7116bd48af6 | 1525 | const arm_matrix_instance_q31 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1526 | const arm_matrix_instance_q31 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1527 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1528 | |
mturner5 | 0:b7116bd48af6 | 1529 | /** |
mturner5 | 0:b7116bd48af6 | 1530 | * @brief Floating-point, complex, matrix multiplication. |
mturner5 | 0:b7116bd48af6 | 1531 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1532 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1533 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1534 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1535 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1536 | */ |
mturner5 | 0:b7116bd48af6 | 1537 | |
mturner5 | 0:b7116bd48af6 | 1538 | arm_status arm_mat_cmplx_mult_f32( |
mturner5 | 0:b7116bd48af6 | 1539 | const arm_matrix_instance_f32 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1540 | const arm_matrix_instance_f32 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1541 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1542 | |
mturner5 | 0:b7116bd48af6 | 1543 | /** |
mturner5 | 0:b7116bd48af6 | 1544 | * @brief Q15, complex, matrix multiplication. |
mturner5 | 0:b7116bd48af6 | 1545 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1546 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1547 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1548 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1549 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1550 | */ |
mturner5 | 0:b7116bd48af6 | 1551 | |
mturner5 | 0:b7116bd48af6 | 1552 | arm_status arm_mat_cmplx_mult_q15( |
mturner5 | 0:b7116bd48af6 | 1553 | const arm_matrix_instance_q15 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1554 | const arm_matrix_instance_q15 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1555 | arm_matrix_instance_q15 * pDst, |
mturner5 | 0:b7116bd48af6 | 1556 | q15_t * pScratch); |
mturner5 | 0:b7116bd48af6 | 1557 | |
mturner5 | 0:b7116bd48af6 | 1558 | /** |
mturner5 | 0:b7116bd48af6 | 1559 | * @brief Q31, complex, matrix multiplication. |
mturner5 | 0:b7116bd48af6 | 1560 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1561 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1562 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1563 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1564 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1565 | */ |
mturner5 | 0:b7116bd48af6 | 1566 | |
mturner5 | 0:b7116bd48af6 | 1567 | arm_status arm_mat_cmplx_mult_q31( |
mturner5 | 0:b7116bd48af6 | 1568 | const arm_matrix_instance_q31 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1569 | const arm_matrix_instance_q31 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1570 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1571 | |
mturner5 | 0:b7116bd48af6 | 1572 | |
mturner5 | 0:b7116bd48af6 | 1573 | /** |
mturner5 | 0:b7116bd48af6 | 1574 | * @brief Floating-point matrix transpose. |
mturner5 | 0:b7116bd48af6 | 1575 | * @param[in] *pSrc points to the input matrix |
mturner5 | 0:b7116bd48af6 | 1576 | * @param[out] *pDst points to the output matrix |
mturner5 | 0:b7116bd48af6 | 1577 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
mturner5 | 0:b7116bd48af6 | 1578 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1579 | */ |
mturner5 | 0:b7116bd48af6 | 1580 | |
mturner5 | 0:b7116bd48af6 | 1581 | arm_status arm_mat_trans_f32( |
mturner5 | 0:b7116bd48af6 | 1582 | const arm_matrix_instance_f32 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1583 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1584 | |
mturner5 | 0:b7116bd48af6 | 1585 | |
mturner5 | 0:b7116bd48af6 | 1586 | /** |
mturner5 | 0:b7116bd48af6 | 1587 | * @brief Q15 matrix transpose. |
mturner5 | 0:b7116bd48af6 | 1588 | * @param[in] *pSrc points to the input matrix |
mturner5 | 0:b7116bd48af6 | 1589 | * @param[out] *pDst points to the output matrix |
mturner5 | 0:b7116bd48af6 | 1590 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
mturner5 | 0:b7116bd48af6 | 1591 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1592 | */ |
mturner5 | 0:b7116bd48af6 | 1593 | |
mturner5 | 0:b7116bd48af6 | 1594 | arm_status arm_mat_trans_q15( |
mturner5 | 0:b7116bd48af6 | 1595 | const arm_matrix_instance_q15 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1596 | arm_matrix_instance_q15 * pDst); |
mturner5 | 0:b7116bd48af6 | 1597 | |
mturner5 | 0:b7116bd48af6 | 1598 | /** |
mturner5 | 0:b7116bd48af6 | 1599 | * @brief Q31 matrix transpose. |
mturner5 | 0:b7116bd48af6 | 1600 | * @param[in] *pSrc points to the input matrix |
mturner5 | 0:b7116bd48af6 | 1601 | * @param[out] *pDst points to the output matrix |
mturner5 | 0:b7116bd48af6 | 1602 | * @return The function returns either <code>ARM_MATH_SIZE_MISMATCH</code> |
mturner5 | 0:b7116bd48af6 | 1603 | * or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1604 | */ |
mturner5 | 0:b7116bd48af6 | 1605 | |
mturner5 | 0:b7116bd48af6 | 1606 | arm_status arm_mat_trans_q31( |
mturner5 | 0:b7116bd48af6 | 1607 | const arm_matrix_instance_q31 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1608 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1609 | |
mturner5 | 0:b7116bd48af6 | 1610 | |
mturner5 | 0:b7116bd48af6 | 1611 | /** |
mturner5 | 0:b7116bd48af6 | 1612 | * @brief Floating-point matrix multiplication |
mturner5 | 0:b7116bd48af6 | 1613 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1614 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1615 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1616 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1617 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1618 | */ |
mturner5 | 0:b7116bd48af6 | 1619 | |
mturner5 | 0:b7116bd48af6 | 1620 | arm_status arm_mat_mult_f32( |
mturner5 | 0:b7116bd48af6 | 1621 | const arm_matrix_instance_f32 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1622 | const arm_matrix_instance_f32 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1623 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1624 | |
mturner5 | 0:b7116bd48af6 | 1625 | /** |
mturner5 | 0:b7116bd48af6 | 1626 | * @brief Q15 matrix multiplication |
mturner5 | 0:b7116bd48af6 | 1627 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1628 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1629 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1630 | * @param[in] *pState points to the array for storing intermediate results |
mturner5 | 0:b7116bd48af6 | 1631 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1632 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1633 | */ |
mturner5 | 0:b7116bd48af6 | 1634 | |
mturner5 | 0:b7116bd48af6 | 1635 | arm_status arm_mat_mult_q15( |
mturner5 | 0:b7116bd48af6 | 1636 | const arm_matrix_instance_q15 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1637 | const arm_matrix_instance_q15 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1638 | arm_matrix_instance_q15 * pDst, |
mturner5 | 0:b7116bd48af6 | 1639 | q15_t * pState); |
mturner5 | 0:b7116bd48af6 | 1640 | |
mturner5 | 0:b7116bd48af6 | 1641 | /** |
mturner5 | 0:b7116bd48af6 | 1642 | * @brief Q15 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 1643 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1644 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1645 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1646 | * @param[in] *pState points to the array for storing intermediate results |
mturner5 | 0:b7116bd48af6 | 1647 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1648 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1649 | */ |
mturner5 | 0:b7116bd48af6 | 1650 | |
mturner5 | 0:b7116bd48af6 | 1651 | arm_status arm_mat_mult_fast_q15( |
mturner5 | 0:b7116bd48af6 | 1652 | const arm_matrix_instance_q15 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1653 | const arm_matrix_instance_q15 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1654 | arm_matrix_instance_q15 * pDst, |
mturner5 | 0:b7116bd48af6 | 1655 | q15_t * pState); |
mturner5 | 0:b7116bd48af6 | 1656 | |
mturner5 | 0:b7116bd48af6 | 1657 | /** |
mturner5 | 0:b7116bd48af6 | 1658 | * @brief Q31 matrix multiplication |
mturner5 | 0:b7116bd48af6 | 1659 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1660 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1661 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1662 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1663 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1664 | */ |
mturner5 | 0:b7116bd48af6 | 1665 | |
mturner5 | 0:b7116bd48af6 | 1666 | arm_status arm_mat_mult_q31( |
mturner5 | 0:b7116bd48af6 | 1667 | const arm_matrix_instance_q31 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1668 | const arm_matrix_instance_q31 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1669 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1670 | |
mturner5 | 0:b7116bd48af6 | 1671 | /** |
mturner5 | 0:b7116bd48af6 | 1672 | * @brief Q31 matrix multiplication (fast variant) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 1673 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1674 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1675 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1676 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1677 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1678 | */ |
mturner5 | 0:b7116bd48af6 | 1679 | |
mturner5 | 0:b7116bd48af6 | 1680 | arm_status arm_mat_mult_fast_q31( |
mturner5 | 0:b7116bd48af6 | 1681 | const arm_matrix_instance_q31 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1682 | const arm_matrix_instance_q31 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1683 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1684 | |
mturner5 | 0:b7116bd48af6 | 1685 | |
mturner5 | 0:b7116bd48af6 | 1686 | /** |
mturner5 | 0:b7116bd48af6 | 1687 | * @brief Floating-point matrix subtraction |
mturner5 | 0:b7116bd48af6 | 1688 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1689 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1690 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1691 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1692 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1693 | */ |
mturner5 | 0:b7116bd48af6 | 1694 | |
mturner5 | 0:b7116bd48af6 | 1695 | arm_status arm_mat_sub_f32( |
mturner5 | 0:b7116bd48af6 | 1696 | const arm_matrix_instance_f32 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1697 | const arm_matrix_instance_f32 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1698 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1699 | |
mturner5 | 0:b7116bd48af6 | 1700 | /** |
mturner5 | 0:b7116bd48af6 | 1701 | * @brief Q15 matrix subtraction |
mturner5 | 0:b7116bd48af6 | 1702 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1703 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1704 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1705 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1706 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1707 | */ |
mturner5 | 0:b7116bd48af6 | 1708 | |
mturner5 | 0:b7116bd48af6 | 1709 | arm_status arm_mat_sub_q15( |
mturner5 | 0:b7116bd48af6 | 1710 | const arm_matrix_instance_q15 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1711 | const arm_matrix_instance_q15 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1712 | arm_matrix_instance_q15 * pDst); |
mturner5 | 0:b7116bd48af6 | 1713 | |
mturner5 | 0:b7116bd48af6 | 1714 | /** |
mturner5 | 0:b7116bd48af6 | 1715 | * @brief Q31 matrix subtraction |
mturner5 | 0:b7116bd48af6 | 1716 | * @param[in] *pSrcA points to the first input matrix structure |
mturner5 | 0:b7116bd48af6 | 1717 | * @param[in] *pSrcB points to the second input matrix structure |
mturner5 | 0:b7116bd48af6 | 1718 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1719 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1720 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1721 | */ |
mturner5 | 0:b7116bd48af6 | 1722 | |
mturner5 | 0:b7116bd48af6 | 1723 | arm_status arm_mat_sub_q31( |
mturner5 | 0:b7116bd48af6 | 1724 | const arm_matrix_instance_q31 * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1725 | const arm_matrix_instance_q31 * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1726 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1727 | |
mturner5 | 0:b7116bd48af6 | 1728 | /** |
mturner5 | 0:b7116bd48af6 | 1729 | * @brief Floating-point matrix scaling. |
mturner5 | 0:b7116bd48af6 | 1730 | * @param[in] *pSrc points to the input matrix |
mturner5 | 0:b7116bd48af6 | 1731 | * @param[in] scale scale factor |
mturner5 | 0:b7116bd48af6 | 1732 | * @param[out] *pDst points to the output matrix |
mturner5 | 0:b7116bd48af6 | 1733 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1734 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1735 | */ |
mturner5 | 0:b7116bd48af6 | 1736 | |
mturner5 | 0:b7116bd48af6 | 1737 | arm_status arm_mat_scale_f32( |
mturner5 | 0:b7116bd48af6 | 1738 | const arm_matrix_instance_f32 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1739 | float32_t scale, |
mturner5 | 0:b7116bd48af6 | 1740 | arm_matrix_instance_f32 * pDst); |
mturner5 | 0:b7116bd48af6 | 1741 | |
mturner5 | 0:b7116bd48af6 | 1742 | /** |
mturner5 | 0:b7116bd48af6 | 1743 | * @brief Q15 matrix scaling. |
mturner5 | 0:b7116bd48af6 | 1744 | * @param[in] *pSrc points to input matrix |
mturner5 | 0:b7116bd48af6 | 1745 | * @param[in] scaleFract fractional portion of the scale factor |
mturner5 | 0:b7116bd48af6 | 1746 | * @param[in] shift number of bits to shift the result by |
mturner5 | 0:b7116bd48af6 | 1747 | * @param[out] *pDst points to output matrix |
mturner5 | 0:b7116bd48af6 | 1748 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1749 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1750 | */ |
mturner5 | 0:b7116bd48af6 | 1751 | |
mturner5 | 0:b7116bd48af6 | 1752 | arm_status arm_mat_scale_q15( |
mturner5 | 0:b7116bd48af6 | 1753 | const arm_matrix_instance_q15 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1754 | q15_t scaleFract, |
mturner5 | 0:b7116bd48af6 | 1755 | int32_t shift, |
mturner5 | 0:b7116bd48af6 | 1756 | arm_matrix_instance_q15 * pDst); |
mturner5 | 0:b7116bd48af6 | 1757 | |
mturner5 | 0:b7116bd48af6 | 1758 | /** |
mturner5 | 0:b7116bd48af6 | 1759 | * @brief Q31 matrix scaling. |
mturner5 | 0:b7116bd48af6 | 1760 | * @param[in] *pSrc points to input matrix |
mturner5 | 0:b7116bd48af6 | 1761 | * @param[in] scaleFract fractional portion of the scale factor |
mturner5 | 0:b7116bd48af6 | 1762 | * @param[in] shift number of bits to shift the result by |
mturner5 | 0:b7116bd48af6 | 1763 | * @param[out] *pDst points to output matrix structure |
mturner5 | 0:b7116bd48af6 | 1764 | * @return The function returns either |
mturner5 | 0:b7116bd48af6 | 1765 | * <code>ARM_MATH_SIZE_MISMATCH</code> or <code>ARM_MATH_SUCCESS</code> based on the outcome of size checking. |
mturner5 | 0:b7116bd48af6 | 1766 | */ |
mturner5 | 0:b7116bd48af6 | 1767 | |
mturner5 | 0:b7116bd48af6 | 1768 | arm_status arm_mat_scale_q31( |
mturner5 | 0:b7116bd48af6 | 1769 | const arm_matrix_instance_q31 * pSrc, |
mturner5 | 0:b7116bd48af6 | 1770 | q31_t scaleFract, |
mturner5 | 0:b7116bd48af6 | 1771 | int32_t shift, |
mturner5 | 0:b7116bd48af6 | 1772 | arm_matrix_instance_q31 * pDst); |
mturner5 | 0:b7116bd48af6 | 1773 | |
mturner5 | 0:b7116bd48af6 | 1774 | |
mturner5 | 0:b7116bd48af6 | 1775 | /** |
mturner5 | 0:b7116bd48af6 | 1776 | * @brief Q31 matrix initialization. |
mturner5 | 0:b7116bd48af6 | 1777 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 1778 | * @param[in] nRows number of rows in the matrix. |
mturner5 | 0:b7116bd48af6 | 1779 | * @param[in] nColumns number of columns in the matrix. |
mturner5 | 0:b7116bd48af6 | 1780 | * @param[in] *pData points to the matrix data array. |
mturner5 | 0:b7116bd48af6 | 1781 | * @return none |
mturner5 | 0:b7116bd48af6 | 1782 | */ |
mturner5 | 0:b7116bd48af6 | 1783 | |
mturner5 | 0:b7116bd48af6 | 1784 | void arm_mat_init_q31( |
mturner5 | 0:b7116bd48af6 | 1785 | arm_matrix_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1786 | uint16_t nRows, |
mturner5 | 0:b7116bd48af6 | 1787 | uint16_t nColumns, |
mturner5 | 0:b7116bd48af6 | 1788 | q31_t * pData); |
mturner5 | 0:b7116bd48af6 | 1789 | |
mturner5 | 0:b7116bd48af6 | 1790 | /** |
mturner5 | 0:b7116bd48af6 | 1791 | * @brief Q15 matrix initialization. |
mturner5 | 0:b7116bd48af6 | 1792 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 1793 | * @param[in] nRows number of rows in the matrix. |
mturner5 | 0:b7116bd48af6 | 1794 | * @param[in] nColumns number of columns in the matrix. |
mturner5 | 0:b7116bd48af6 | 1795 | * @param[in] *pData points to the matrix data array. |
mturner5 | 0:b7116bd48af6 | 1796 | * @return none |
mturner5 | 0:b7116bd48af6 | 1797 | */ |
mturner5 | 0:b7116bd48af6 | 1798 | |
mturner5 | 0:b7116bd48af6 | 1799 | void arm_mat_init_q15( |
mturner5 | 0:b7116bd48af6 | 1800 | arm_matrix_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1801 | uint16_t nRows, |
mturner5 | 0:b7116bd48af6 | 1802 | uint16_t nColumns, |
mturner5 | 0:b7116bd48af6 | 1803 | q15_t * pData); |
mturner5 | 0:b7116bd48af6 | 1804 | |
mturner5 | 0:b7116bd48af6 | 1805 | /** |
mturner5 | 0:b7116bd48af6 | 1806 | * @brief Floating-point matrix initialization. |
mturner5 | 0:b7116bd48af6 | 1807 | * @param[in,out] *S points to an instance of the floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 1808 | * @param[in] nRows number of rows in the matrix. |
mturner5 | 0:b7116bd48af6 | 1809 | * @param[in] nColumns number of columns in the matrix. |
mturner5 | 0:b7116bd48af6 | 1810 | * @param[in] *pData points to the matrix data array. |
mturner5 | 0:b7116bd48af6 | 1811 | * @return none |
mturner5 | 0:b7116bd48af6 | 1812 | */ |
mturner5 | 0:b7116bd48af6 | 1813 | |
mturner5 | 0:b7116bd48af6 | 1814 | void arm_mat_init_f32( |
mturner5 | 0:b7116bd48af6 | 1815 | arm_matrix_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1816 | uint16_t nRows, |
mturner5 | 0:b7116bd48af6 | 1817 | uint16_t nColumns, |
mturner5 | 0:b7116bd48af6 | 1818 | float32_t * pData); |
mturner5 | 0:b7116bd48af6 | 1819 | |
mturner5 | 0:b7116bd48af6 | 1820 | |
mturner5 | 0:b7116bd48af6 | 1821 | |
mturner5 | 0:b7116bd48af6 | 1822 | /** |
mturner5 | 0:b7116bd48af6 | 1823 | * @brief Instance structure for the Q15 PID Control. |
mturner5 | 0:b7116bd48af6 | 1824 | */ |
mturner5 | 0:b7116bd48af6 | 1825 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1826 | { |
mturner5 | 0:b7116bd48af6 | 1827 | q15_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
mturner5 | 0:b7116bd48af6 | 1828 | #ifdef ARM_MATH_CM0_FAMILY |
mturner5 | 0:b7116bd48af6 | 1829 | q15_t A1; |
mturner5 | 0:b7116bd48af6 | 1830 | q15_t A2; |
mturner5 | 0:b7116bd48af6 | 1831 | #else |
mturner5 | 0:b7116bd48af6 | 1832 | q31_t A1; /**< The derived gain A1 = -Kp - 2Kd | Kd.*/ |
mturner5 | 0:b7116bd48af6 | 1833 | #endif |
mturner5 | 0:b7116bd48af6 | 1834 | q15_t state[3]; /**< The state array of length 3. */ |
mturner5 | 0:b7116bd48af6 | 1835 | q15_t Kp; /**< The proportional gain. */ |
mturner5 | 0:b7116bd48af6 | 1836 | q15_t Ki; /**< The integral gain. */ |
mturner5 | 0:b7116bd48af6 | 1837 | q15_t Kd; /**< The derivative gain. */ |
mturner5 | 0:b7116bd48af6 | 1838 | } arm_pid_instance_q15; |
mturner5 | 0:b7116bd48af6 | 1839 | |
mturner5 | 0:b7116bd48af6 | 1840 | /** |
mturner5 | 0:b7116bd48af6 | 1841 | * @brief Instance structure for the Q31 PID Control. |
mturner5 | 0:b7116bd48af6 | 1842 | */ |
mturner5 | 0:b7116bd48af6 | 1843 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1844 | { |
mturner5 | 0:b7116bd48af6 | 1845 | q31_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
mturner5 | 0:b7116bd48af6 | 1846 | q31_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
mturner5 | 0:b7116bd48af6 | 1847 | q31_t A2; /**< The derived gain, A2 = Kd . */ |
mturner5 | 0:b7116bd48af6 | 1848 | q31_t state[3]; /**< The state array of length 3. */ |
mturner5 | 0:b7116bd48af6 | 1849 | q31_t Kp; /**< The proportional gain. */ |
mturner5 | 0:b7116bd48af6 | 1850 | q31_t Ki; /**< The integral gain. */ |
mturner5 | 0:b7116bd48af6 | 1851 | q31_t Kd; /**< The derivative gain. */ |
mturner5 | 0:b7116bd48af6 | 1852 | |
mturner5 | 0:b7116bd48af6 | 1853 | } arm_pid_instance_q31; |
mturner5 | 0:b7116bd48af6 | 1854 | |
mturner5 | 0:b7116bd48af6 | 1855 | /** |
mturner5 | 0:b7116bd48af6 | 1856 | * @brief Instance structure for the floating-point PID Control. |
mturner5 | 0:b7116bd48af6 | 1857 | */ |
mturner5 | 0:b7116bd48af6 | 1858 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1859 | { |
mturner5 | 0:b7116bd48af6 | 1860 | float32_t A0; /**< The derived gain, A0 = Kp + Ki + Kd . */ |
mturner5 | 0:b7116bd48af6 | 1861 | float32_t A1; /**< The derived gain, A1 = -Kp - 2Kd. */ |
mturner5 | 0:b7116bd48af6 | 1862 | float32_t A2; /**< The derived gain, A2 = Kd . */ |
mturner5 | 0:b7116bd48af6 | 1863 | float32_t state[3]; /**< The state array of length 3. */ |
mturner5 | 0:b7116bd48af6 | 1864 | float32_t Kp; /**< The proportional gain. */ |
mturner5 | 0:b7116bd48af6 | 1865 | float32_t Ki; /**< The integral gain. */ |
mturner5 | 0:b7116bd48af6 | 1866 | float32_t Kd; /**< The derivative gain. */ |
mturner5 | 0:b7116bd48af6 | 1867 | } arm_pid_instance_f32; |
mturner5 | 0:b7116bd48af6 | 1868 | |
mturner5 | 0:b7116bd48af6 | 1869 | |
mturner5 | 0:b7116bd48af6 | 1870 | |
mturner5 | 0:b7116bd48af6 | 1871 | /** |
mturner5 | 0:b7116bd48af6 | 1872 | * @brief Initialization function for the floating-point PID Control. |
mturner5 | 0:b7116bd48af6 | 1873 | * @param[in,out] *S points to an instance of the PID structure. |
mturner5 | 0:b7116bd48af6 | 1874 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
mturner5 | 0:b7116bd48af6 | 1875 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1876 | */ |
mturner5 | 0:b7116bd48af6 | 1877 | void arm_pid_init_f32( |
mturner5 | 0:b7116bd48af6 | 1878 | arm_pid_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 1879 | int32_t resetStateFlag); |
mturner5 | 0:b7116bd48af6 | 1880 | |
mturner5 | 0:b7116bd48af6 | 1881 | /** |
mturner5 | 0:b7116bd48af6 | 1882 | * @brief Reset function for the floating-point PID Control. |
mturner5 | 0:b7116bd48af6 | 1883 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
mturner5 | 0:b7116bd48af6 | 1884 | * @return none |
mturner5 | 0:b7116bd48af6 | 1885 | */ |
mturner5 | 0:b7116bd48af6 | 1886 | void arm_pid_reset_f32( |
mturner5 | 0:b7116bd48af6 | 1887 | arm_pid_instance_f32 * S); |
mturner5 | 0:b7116bd48af6 | 1888 | |
mturner5 | 0:b7116bd48af6 | 1889 | |
mturner5 | 0:b7116bd48af6 | 1890 | /** |
mturner5 | 0:b7116bd48af6 | 1891 | * @brief Initialization function for the Q31 PID Control. |
mturner5 | 0:b7116bd48af6 | 1892 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
mturner5 | 0:b7116bd48af6 | 1893 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
mturner5 | 0:b7116bd48af6 | 1894 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1895 | */ |
mturner5 | 0:b7116bd48af6 | 1896 | void arm_pid_init_q31( |
mturner5 | 0:b7116bd48af6 | 1897 | arm_pid_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 1898 | int32_t resetStateFlag); |
mturner5 | 0:b7116bd48af6 | 1899 | |
mturner5 | 0:b7116bd48af6 | 1900 | |
mturner5 | 0:b7116bd48af6 | 1901 | /** |
mturner5 | 0:b7116bd48af6 | 1902 | * @brief Reset function for the Q31 PID Control. |
mturner5 | 0:b7116bd48af6 | 1903 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
mturner5 | 0:b7116bd48af6 | 1904 | * @return none |
mturner5 | 0:b7116bd48af6 | 1905 | */ |
mturner5 | 0:b7116bd48af6 | 1906 | |
mturner5 | 0:b7116bd48af6 | 1907 | void arm_pid_reset_q31( |
mturner5 | 0:b7116bd48af6 | 1908 | arm_pid_instance_q31 * S); |
mturner5 | 0:b7116bd48af6 | 1909 | |
mturner5 | 0:b7116bd48af6 | 1910 | /** |
mturner5 | 0:b7116bd48af6 | 1911 | * @brief Initialization function for the Q15 PID Control. |
mturner5 | 0:b7116bd48af6 | 1912 | * @param[in,out] *S points to an instance of the Q15 PID structure. |
mturner5 | 0:b7116bd48af6 | 1913 | * @param[in] resetStateFlag flag to reset the state. 0 = no change in state 1 = reset the state. |
mturner5 | 0:b7116bd48af6 | 1914 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1915 | */ |
mturner5 | 0:b7116bd48af6 | 1916 | void arm_pid_init_q15( |
mturner5 | 0:b7116bd48af6 | 1917 | arm_pid_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 1918 | int32_t resetStateFlag); |
mturner5 | 0:b7116bd48af6 | 1919 | |
mturner5 | 0:b7116bd48af6 | 1920 | /** |
mturner5 | 0:b7116bd48af6 | 1921 | * @brief Reset function for the Q15 PID Control. |
mturner5 | 0:b7116bd48af6 | 1922 | * @param[in,out] *S points to an instance of the q15 PID Control structure |
mturner5 | 0:b7116bd48af6 | 1923 | * @return none |
mturner5 | 0:b7116bd48af6 | 1924 | */ |
mturner5 | 0:b7116bd48af6 | 1925 | void arm_pid_reset_q15( |
mturner5 | 0:b7116bd48af6 | 1926 | arm_pid_instance_q15 * S); |
mturner5 | 0:b7116bd48af6 | 1927 | |
mturner5 | 0:b7116bd48af6 | 1928 | |
mturner5 | 0:b7116bd48af6 | 1929 | /** |
mturner5 | 0:b7116bd48af6 | 1930 | * @brief Instance structure for the floating-point Linear Interpolate function. |
mturner5 | 0:b7116bd48af6 | 1931 | */ |
mturner5 | 0:b7116bd48af6 | 1932 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1933 | { |
mturner5 | 0:b7116bd48af6 | 1934 | uint32_t nValues; /**< nValues */ |
mturner5 | 0:b7116bd48af6 | 1935 | float32_t x1; /**< x1 */ |
mturner5 | 0:b7116bd48af6 | 1936 | float32_t xSpacing; /**< xSpacing */ |
mturner5 | 0:b7116bd48af6 | 1937 | float32_t *pYData; /**< pointer to the table of Y values */ |
mturner5 | 0:b7116bd48af6 | 1938 | } arm_linear_interp_instance_f32; |
mturner5 | 0:b7116bd48af6 | 1939 | |
mturner5 | 0:b7116bd48af6 | 1940 | /** |
mturner5 | 0:b7116bd48af6 | 1941 | * @brief Instance structure for the floating-point bilinear interpolation function. |
mturner5 | 0:b7116bd48af6 | 1942 | */ |
mturner5 | 0:b7116bd48af6 | 1943 | |
mturner5 | 0:b7116bd48af6 | 1944 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1945 | { |
mturner5 | 0:b7116bd48af6 | 1946 | uint16_t numRows; /**< number of rows in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1947 | uint16_t numCols; /**< number of columns in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1948 | float32_t *pData; /**< points to the data table. */ |
mturner5 | 0:b7116bd48af6 | 1949 | } arm_bilinear_interp_instance_f32; |
mturner5 | 0:b7116bd48af6 | 1950 | |
mturner5 | 0:b7116bd48af6 | 1951 | /** |
mturner5 | 0:b7116bd48af6 | 1952 | * @brief Instance structure for the Q31 bilinear interpolation function. |
mturner5 | 0:b7116bd48af6 | 1953 | */ |
mturner5 | 0:b7116bd48af6 | 1954 | |
mturner5 | 0:b7116bd48af6 | 1955 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1956 | { |
mturner5 | 0:b7116bd48af6 | 1957 | uint16_t numRows; /**< number of rows in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1958 | uint16_t numCols; /**< number of columns in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1959 | q31_t *pData; /**< points to the data table. */ |
mturner5 | 0:b7116bd48af6 | 1960 | } arm_bilinear_interp_instance_q31; |
mturner5 | 0:b7116bd48af6 | 1961 | |
mturner5 | 0:b7116bd48af6 | 1962 | /** |
mturner5 | 0:b7116bd48af6 | 1963 | * @brief Instance structure for the Q15 bilinear interpolation function. |
mturner5 | 0:b7116bd48af6 | 1964 | */ |
mturner5 | 0:b7116bd48af6 | 1965 | |
mturner5 | 0:b7116bd48af6 | 1966 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1967 | { |
mturner5 | 0:b7116bd48af6 | 1968 | uint16_t numRows; /**< number of rows in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1969 | uint16_t numCols; /**< number of columns in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1970 | q15_t *pData; /**< points to the data table. */ |
mturner5 | 0:b7116bd48af6 | 1971 | } arm_bilinear_interp_instance_q15; |
mturner5 | 0:b7116bd48af6 | 1972 | |
mturner5 | 0:b7116bd48af6 | 1973 | /** |
mturner5 | 0:b7116bd48af6 | 1974 | * @brief Instance structure for the Q15 bilinear interpolation function. |
mturner5 | 0:b7116bd48af6 | 1975 | */ |
mturner5 | 0:b7116bd48af6 | 1976 | |
mturner5 | 0:b7116bd48af6 | 1977 | typedef struct |
mturner5 | 0:b7116bd48af6 | 1978 | { |
mturner5 | 0:b7116bd48af6 | 1979 | uint16_t numRows; /**< number of rows in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1980 | uint16_t numCols; /**< number of columns in the data table. */ |
mturner5 | 0:b7116bd48af6 | 1981 | q7_t *pData; /**< points to the data table. */ |
mturner5 | 0:b7116bd48af6 | 1982 | } arm_bilinear_interp_instance_q7; |
mturner5 | 0:b7116bd48af6 | 1983 | |
mturner5 | 0:b7116bd48af6 | 1984 | |
mturner5 | 0:b7116bd48af6 | 1985 | /** |
mturner5 | 0:b7116bd48af6 | 1986 | * @brief Q7 vector multiplication. |
mturner5 | 0:b7116bd48af6 | 1987 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 1988 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 1989 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 1990 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 1991 | * @return none. |
mturner5 | 0:b7116bd48af6 | 1992 | */ |
mturner5 | 0:b7116bd48af6 | 1993 | |
mturner5 | 0:b7116bd48af6 | 1994 | void arm_mult_q7( |
mturner5 | 0:b7116bd48af6 | 1995 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 1996 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 1997 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 1998 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 1999 | |
mturner5 | 0:b7116bd48af6 | 2000 | /** |
mturner5 | 0:b7116bd48af6 | 2001 | * @brief Q15 vector multiplication. |
mturner5 | 0:b7116bd48af6 | 2002 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2003 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2004 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2005 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2006 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2007 | */ |
mturner5 | 0:b7116bd48af6 | 2008 | |
mturner5 | 0:b7116bd48af6 | 2009 | void arm_mult_q15( |
mturner5 | 0:b7116bd48af6 | 2010 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2011 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2012 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2013 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2014 | |
mturner5 | 0:b7116bd48af6 | 2015 | /** |
mturner5 | 0:b7116bd48af6 | 2016 | * @brief Q31 vector multiplication. |
mturner5 | 0:b7116bd48af6 | 2017 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2018 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2019 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2020 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2021 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2022 | */ |
mturner5 | 0:b7116bd48af6 | 2023 | |
mturner5 | 0:b7116bd48af6 | 2024 | void arm_mult_q31( |
mturner5 | 0:b7116bd48af6 | 2025 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2026 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2027 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2028 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2029 | |
mturner5 | 0:b7116bd48af6 | 2030 | /** |
mturner5 | 0:b7116bd48af6 | 2031 | * @brief Floating-point vector multiplication. |
mturner5 | 0:b7116bd48af6 | 2032 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2033 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2034 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2035 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2036 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2037 | */ |
mturner5 | 0:b7116bd48af6 | 2038 | |
mturner5 | 0:b7116bd48af6 | 2039 | void arm_mult_f32( |
mturner5 | 0:b7116bd48af6 | 2040 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2041 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2042 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2043 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2044 | |
mturner5 | 0:b7116bd48af6 | 2045 | |
mturner5 | 0:b7116bd48af6 | 2046 | |
mturner5 | 0:b7116bd48af6 | 2047 | |
mturner5 | 0:b7116bd48af6 | 2048 | |
mturner5 | 0:b7116bd48af6 | 2049 | |
mturner5 | 0:b7116bd48af6 | 2050 | /** |
mturner5 | 0:b7116bd48af6 | 2051 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2052 | */ |
mturner5 | 0:b7116bd48af6 | 2053 | |
mturner5 | 0:b7116bd48af6 | 2054 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2055 | { |
mturner5 | 0:b7116bd48af6 | 2056 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2057 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2058 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2059 | q15_t *pTwiddle; /**< points to the Sin twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2060 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2061 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2062 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2063 | } arm_cfft_radix2_instance_q15; |
mturner5 | 0:b7116bd48af6 | 2064 | |
mturner5 | 0:b7116bd48af6 | 2065 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2066 | arm_status arm_cfft_radix2_init_q15( |
mturner5 | 0:b7116bd48af6 | 2067 | arm_cfft_radix2_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2068 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2069 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2070 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2071 | |
mturner5 | 0:b7116bd48af6 | 2072 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2073 | void arm_cfft_radix2_q15( |
mturner5 | 0:b7116bd48af6 | 2074 | const arm_cfft_radix2_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2075 | q15_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2076 | |
mturner5 | 0:b7116bd48af6 | 2077 | |
mturner5 | 0:b7116bd48af6 | 2078 | |
mturner5 | 0:b7116bd48af6 | 2079 | /** |
mturner5 | 0:b7116bd48af6 | 2080 | * @brief Instance structure for the Q15 CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2081 | */ |
mturner5 | 0:b7116bd48af6 | 2082 | |
mturner5 | 0:b7116bd48af6 | 2083 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2084 | { |
mturner5 | 0:b7116bd48af6 | 2085 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2086 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2087 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2088 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2089 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2090 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2091 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2092 | } arm_cfft_radix4_instance_q15; |
mturner5 | 0:b7116bd48af6 | 2093 | |
mturner5 | 0:b7116bd48af6 | 2094 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2095 | arm_status arm_cfft_radix4_init_q15( |
mturner5 | 0:b7116bd48af6 | 2096 | arm_cfft_radix4_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2097 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2098 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2099 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2100 | |
mturner5 | 0:b7116bd48af6 | 2101 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2102 | void arm_cfft_radix4_q15( |
mturner5 | 0:b7116bd48af6 | 2103 | const arm_cfft_radix4_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2104 | q15_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2105 | |
mturner5 | 0:b7116bd48af6 | 2106 | /** |
mturner5 | 0:b7116bd48af6 | 2107 | * @brief Instance structure for the Radix-2 Q31 CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2108 | */ |
mturner5 | 0:b7116bd48af6 | 2109 | |
mturner5 | 0:b7116bd48af6 | 2110 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2111 | { |
mturner5 | 0:b7116bd48af6 | 2112 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2113 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2114 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2115 | q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2116 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2117 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2118 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2119 | } arm_cfft_radix2_instance_q31; |
mturner5 | 0:b7116bd48af6 | 2120 | |
mturner5 | 0:b7116bd48af6 | 2121 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2122 | arm_status arm_cfft_radix2_init_q31( |
mturner5 | 0:b7116bd48af6 | 2123 | arm_cfft_radix2_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2124 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2125 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2126 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2127 | |
mturner5 | 0:b7116bd48af6 | 2128 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2129 | void arm_cfft_radix2_q31( |
mturner5 | 0:b7116bd48af6 | 2130 | const arm_cfft_radix2_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2131 | q31_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2132 | |
mturner5 | 0:b7116bd48af6 | 2133 | /** |
mturner5 | 0:b7116bd48af6 | 2134 | * @brief Instance structure for the Q31 CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2135 | */ |
mturner5 | 0:b7116bd48af6 | 2136 | |
mturner5 | 0:b7116bd48af6 | 2137 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2138 | { |
mturner5 | 0:b7116bd48af6 | 2139 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2140 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2141 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2142 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2143 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2144 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2145 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2146 | } arm_cfft_radix4_instance_q31; |
mturner5 | 0:b7116bd48af6 | 2147 | |
mturner5 | 0:b7116bd48af6 | 2148 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2149 | void arm_cfft_radix4_q31( |
mturner5 | 0:b7116bd48af6 | 2150 | const arm_cfft_radix4_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2151 | q31_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2152 | |
mturner5 | 0:b7116bd48af6 | 2153 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2154 | arm_status arm_cfft_radix4_init_q31( |
mturner5 | 0:b7116bd48af6 | 2155 | arm_cfft_radix4_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2156 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2157 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2158 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2159 | |
mturner5 | 0:b7116bd48af6 | 2160 | /** |
mturner5 | 0:b7116bd48af6 | 2161 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2162 | */ |
mturner5 | 0:b7116bd48af6 | 2163 | |
mturner5 | 0:b7116bd48af6 | 2164 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2165 | { |
mturner5 | 0:b7116bd48af6 | 2166 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2167 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2168 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2169 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2170 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2171 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2172 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2173 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
mturner5 | 0:b7116bd48af6 | 2174 | } arm_cfft_radix2_instance_f32; |
mturner5 | 0:b7116bd48af6 | 2175 | |
mturner5 | 0:b7116bd48af6 | 2176 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2177 | arm_status arm_cfft_radix2_init_f32( |
mturner5 | 0:b7116bd48af6 | 2178 | arm_cfft_radix2_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2179 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2180 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2181 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2182 | |
mturner5 | 0:b7116bd48af6 | 2183 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2184 | void arm_cfft_radix2_f32( |
mturner5 | 0:b7116bd48af6 | 2185 | const arm_cfft_radix2_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2186 | float32_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2187 | |
mturner5 | 0:b7116bd48af6 | 2188 | /** |
mturner5 | 0:b7116bd48af6 | 2189 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2190 | */ |
mturner5 | 0:b7116bd48af6 | 2191 | |
mturner5 | 0:b7116bd48af6 | 2192 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2193 | { |
mturner5 | 0:b7116bd48af6 | 2194 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2195 | uint8_t ifftFlag; /**< flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2196 | uint8_t bitReverseFlag; /**< flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2197 | float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2198 | uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2199 | uint16_t twidCoefModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2200 | uint16_t bitRevFactor; /**< bit reversal modifier that supports different size FFTs with the same bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2201 | float32_t onebyfftLen; /**< value of 1/fftLen. */ |
mturner5 | 0:b7116bd48af6 | 2202 | } arm_cfft_radix4_instance_f32; |
mturner5 | 0:b7116bd48af6 | 2203 | |
mturner5 | 0:b7116bd48af6 | 2204 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2205 | arm_status arm_cfft_radix4_init_f32( |
mturner5 | 0:b7116bd48af6 | 2206 | arm_cfft_radix4_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2207 | uint16_t fftLen, |
mturner5 | 0:b7116bd48af6 | 2208 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2209 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2210 | |
mturner5 | 0:b7116bd48af6 | 2211 | /* Deprecated */ |
mturner5 | 0:b7116bd48af6 | 2212 | void arm_cfft_radix4_f32( |
mturner5 | 0:b7116bd48af6 | 2213 | const arm_cfft_radix4_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2214 | float32_t * pSrc); |
mturner5 | 0:b7116bd48af6 | 2215 | |
mturner5 | 0:b7116bd48af6 | 2216 | /** |
mturner5 | 0:b7116bd48af6 | 2217 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2218 | */ |
mturner5 | 0:b7116bd48af6 | 2219 | |
mturner5 | 0:b7116bd48af6 | 2220 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2221 | { |
mturner5 | 0:b7116bd48af6 | 2222 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2223 | const q15_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2224 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2225 | uint16_t bitRevLength; /**< bit reversal table length. */ |
mturner5 | 0:b7116bd48af6 | 2226 | } arm_cfft_instance_q15; |
mturner5 | 0:b7116bd48af6 | 2227 | |
mturner5 | 0:b7116bd48af6 | 2228 | void arm_cfft_q15( |
mturner5 | 0:b7116bd48af6 | 2229 | const arm_cfft_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2230 | q15_t * p1, |
mturner5 | 0:b7116bd48af6 | 2231 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2232 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2233 | |
mturner5 | 0:b7116bd48af6 | 2234 | /** |
mturner5 | 0:b7116bd48af6 | 2235 | * @brief Instance structure for the fixed-point CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2236 | */ |
mturner5 | 0:b7116bd48af6 | 2237 | |
mturner5 | 0:b7116bd48af6 | 2238 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2239 | { |
mturner5 | 0:b7116bd48af6 | 2240 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2241 | const q31_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2242 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2243 | uint16_t bitRevLength; /**< bit reversal table length. */ |
mturner5 | 0:b7116bd48af6 | 2244 | } arm_cfft_instance_q31; |
mturner5 | 0:b7116bd48af6 | 2245 | |
mturner5 | 0:b7116bd48af6 | 2246 | void arm_cfft_q31( |
mturner5 | 0:b7116bd48af6 | 2247 | const arm_cfft_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2248 | q31_t * p1, |
mturner5 | 0:b7116bd48af6 | 2249 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2250 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2251 | |
mturner5 | 0:b7116bd48af6 | 2252 | /** |
mturner5 | 0:b7116bd48af6 | 2253 | * @brief Instance structure for the floating-point CFFT/CIFFT function. |
mturner5 | 0:b7116bd48af6 | 2254 | */ |
mturner5 | 0:b7116bd48af6 | 2255 | |
mturner5 | 0:b7116bd48af6 | 2256 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2257 | { |
mturner5 | 0:b7116bd48af6 | 2258 | uint16_t fftLen; /**< length of the FFT. */ |
mturner5 | 0:b7116bd48af6 | 2259 | const float32_t *pTwiddle; /**< points to the Twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2260 | const uint16_t *pBitRevTable; /**< points to the bit reversal table. */ |
mturner5 | 0:b7116bd48af6 | 2261 | uint16_t bitRevLength; /**< bit reversal table length. */ |
mturner5 | 0:b7116bd48af6 | 2262 | } arm_cfft_instance_f32; |
mturner5 | 0:b7116bd48af6 | 2263 | |
mturner5 | 0:b7116bd48af6 | 2264 | void arm_cfft_f32( |
mturner5 | 0:b7116bd48af6 | 2265 | const arm_cfft_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2266 | float32_t * p1, |
mturner5 | 0:b7116bd48af6 | 2267 | uint8_t ifftFlag, |
mturner5 | 0:b7116bd48af6 | 2268 | uint8_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2269 | |
mturner5 | 0:b7116bd48af6 | 2270 | /** |
mturner5 | 0:b7116bd48af6 | 2271 | * @brief Instance structure for the Q15 RFFT/RIFFT function. |
mturner5 | 0:b7116bd48af6 | 2272 | */ |
mturner5 | 0:b7116bd48af6 | 2273 | |
mturner5 | 0:b7116bd48af6 | 2274 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2275 | { |
mturner5 | 0:b7116bd48af6 | 2276 | uint32_t fftLenReal; /**< length of the real FFT. */ |
mturner5 | 0:b7116bd48af6 | 2277 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2278 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2279 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2280 | q15_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2281 | q15_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2282 | const arm_cfft_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2283 | } arm_rfft_instance_q15; |
mturner5 | 0:b7116bd48af6 | 2284 | |
mturner5 | 0:b7116bd48af6 | 2285 | arm_status arm_rfft_init_q15( |
mturner5 | 0:b7116bd48af6 | 2286 | arm_rfft_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2287 | uint32_t fftLenReal, |
mturner5 | 0:b7116bd48af6 | 2288 | uint32_t ifftFlagR, |
mturner5 | 0:b7116bd48af6 | 2289 | uint32_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2290 | |
mturner5 | 0:b7116bd48af6 | 2291 | void arm_rfft_q15( |
mturner5 | 0:b7116bd48af6 | 2292 | const arm_rfft_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2293 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2294 | q15_t * pDst); |
mturner5 | 0:b7116bd48af6 | 2295 | |
mturner5 | 0:b7116bd48af6 | 2296 | /** |
mturner5 | 0:b7116bd48af6 | 2297 | * @brief Instance structure for the Q31 RFFT/RIFFT function. |
mturner5 | 0:b7116bd48af6 | 2298 | */ |
mturner5 | 0:b7116bd48af6 | 2299 | |
mturner5 | 0:b7116bd48af6 | 2300 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2301 | { |
mturner5 | 0:b7116bd48af6 | 2302 | uint32_t fftLenReal; /**< length of the real FFT. */ |
mturner5 | 0:b7116bd48af6 | 2303 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2304 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2305 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2306 | q31_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2307 | q31_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2308 | const arm_cfft_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2309 | } arm_rfft_instance_q31; |
mturner5 | 0:b7116bd48af6 | 2310 | |
mturner5 | 0:b7116bd48af6 | 2311 | arm_status arm_rfft_init_q31( |
mturner5 | 0:b7116bd48af6 | 2312 | arm_rfft_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2313 | uint32_t fftLenReal, |
mturner5 | 0:b7116bd48af6 | 2314 | uint32_t ifftFlagR, |
mturner5 | 0:b7116bd48af6 | 2315 | uint32_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2316 | |
mturner5 | 0:b7116bd48af6 | 2317 | void arm_rfft_q31( |
mturner5 | 0:b7116bd48af6 | 2318 | const arm_rfft_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2319 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2320 | q31_t * pDst); |
mturner5 | 0:b7116bd48af6 | 2321 | |
mturner5 | 0:b7116bd48af6 | 2322 | /** |
mturner5 | 0:b7116bd48af6 | 2323 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
mturner5 | 0:b7116bd48af6 | 2324 | */ |
mturner5 | 0:b7116bd48af6 | 2325 | |
mturner5 | 0:b7116bd48af6 | 2326 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2327 | { |
mturner5 | 0:b7116bd48af6 | 2328 | uint32_t fftLenReal; /**< length of the real FFT. */ |
mturner5 | 0:b7116bd48af6 | 2329 | uint16_t fftLenBy2; /**< length of the complex FFT. */ |
mturner5 | 0:b7116bd48af6 | 2330 | uint8_t ifftFlagR; /**< flag that selects forward (ifftFlagR=0) or inverse (ifftFlagR=1) transform. */ |
mturner5 | 0:b7116bd48af6 | 2331 | uint8_t bitReverseFlagR; /**< flag that enables (bitReverseFlagR=1) or disables (bitReverseFlagR=0) bit reversal of output. */ |
mturner5 | 0:b7116bd48af6 | 2332 | uint32_t twidCoefRModifier; /**< twiddle coefficient modifier that supports different size FFTs with the same twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2333 | float32_t *pTwiddleAReal; /**< points to the real twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2334 | float32_t *pTwiddleBReal; /**< points to the imag twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2335 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2336 | } arm_rfft_instance_f32; |
mturner5 | 0:b7116bd48af6 | 2337 | |
mturner5 | 0:b7116bd48af6 | 2338 | arm_status arm_rfft_init_f32( |
mturner5 | 0:b7116bd48af6 | 2339 | arm_rfft_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2340 | arm_cfft_radix4_instance_f32 * S_CFFT, |
mturner5 | 0:b7116bd48af6 | 2341 | uint32_t fftLenReal, |
mturner5 | 0:b7116bd48af6 | 2342 | uint32_t ifftFlagR, |
mturner5 | 0:b7116bd48af6 | 2343 | uint32_t bitReverseFlag); |
mturner5 | 0:b7116bd48af6 | 2344 | |
mturner5 | 0:b7116bd48af6 | 2345 | void arm_rfft_f32( |
mturner5 | 0:b7116bd48af6 | 2346 | const arm_rfft_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2347 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2348 | float32_t * pDst); |
mturner5 | 0:b7116bd48af6 | 2349 | |
mturner5 | 0:b7116bd48af6 | 2350 | /** |
mturner5 | 0:b7116bd48af6 | 2351 | * @brief Instance structure for the floating-point RFFT/RIFFT function. |
mturner5 | 0:b7116bd48af6 | 2352 | */ |
mturner5 | 0:b7116bd48af6 | 2353 | |
mturner5 | 0:b7116bd48af6 | 2354 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2355 | { |
mturner5 | 0:b7116bd48af6 | 2356 | arm_cfft_instance_f32 Sint; /**< Internal CFFT structure. */ |
mturner5 | 0:b7116bd48af6 | 2357 | uint16_t fftLenRFFT; /**< length of the real sequence */ |
mturner5 | 0:b7116bd48af6 | 2358 | float32_t * pTwiddleRFFT; /**< Twiddle factors real stage */ |
mturner5 | 0:b7116bd48af6 | 2359 | } arm_rfft_fast_instance_f32 ; |
mturner5 | 0:b7116bd48af6 | 2360 | |
mturner5 | 0:b7116bd48af6 | 2361 | arm_status arm_rfft_fast_init_f32 ( |
mturner5 | 0:b7116bd48af6 | 2362 | arm_rfft_fast_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2363 | uint16_t fftLen); |
mturner5 | 0:b7116bd48af6 | 2364 | |
mturner5 | 0:b7116bd48af6 | 2365 | void arm_rfft_fast_f32( |
mturner5 | 0:b7116bd48af6 | 2366 | arm_rfft_fast_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2367 | float32_t * p, float32_t * pOut, |
mturner5 | 0:b7116bd48af6 | 2368 | uint8_t ifftFlag); |
mturner5 | 0:b7116bd48af6 | 2369 | |
mturner5 | 0:b7116bd48af6 | 2370 | /** |
mturner5 | 0:b7116bd48af6 | 2371 | * @brief Instance structure for the floating-point DCT4/IDCT4 function. |
mturner5 | 0:b7116bd48af6 | 2372 | */ |
mturner5 | 0:b7116bd48af6 | 2373 | |
mturner5 | 0:b7116bd48af6 | 2374 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2375 | { |
mturner5 | 0:b7116bd48af6 | 2376 | uint16_t N; /**< length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2377 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2378 | float32_t normalize; /**< normalizing factor. */ |
mturner5 | 0:b7116bd48af6 | 2379 | float32_t *pTwiddle; /**< points to the twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2380 | float32_t *pCosFactor; /**< points to the cosFactor table. */ |
mturner5 | 0:b7116bd48af6 | 2381 | arm_rfft_instance_f32 *pRfft; /**< points to the real FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2382 | arm_cfft_radix4_instance_f32 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2383 | } arm_dct4_instance_f32; |
mturner5 | 0:b7116bd48af6 | 2384 | |
mturner5 | 0:b7116bd48af6 | 2385 | /** |
mturner5 | 0:b7116bd48af6 | 2386 | * @brief Initialization function for the floating-point DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2387 | * @param[in,out] *S points to an instance of floating-point DCT4/IDCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2388 | * @param[in] *S_RFFT points to an instance of floating-point RFFT/RIFFT structure. |
mturner5 | 0:b7116bd48af6 | 2389 | * @param[in] *S_CFFT points to an instance of floating-point CFFT/CIFFT structure. |
mturner5 | 0:b7116bd48af6 | 2390 | * @param[in] N length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2391 | * @param[in] Nby2 half of the length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2392 | * @param[in] normalize normalizing factor. |
mturner5 | 0:b7116bd48af6 | 2393 | * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLenReal</code> is not a supported transform length. |
mturner5 | 0:b7116bd48af6 | 2394 | */ |
mturner5 | 0:b7116bd48af6 | 2395 | |
mturner5 | 0:b7116bd48af6 | 2396 | arm_status arm_dct4_init_f32( |
mturner5 | 0:b7116bd48af6 | 2397 | arm_dct4_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2398 | arm_rfft_instance_f32 * S_RFFT, |
mturner5 | 0:b7116bd48af6 | 2399 | arm_cfft_radix4_instance_f32 * S_CFFT, |
mturner5 | 0:b7116bd48af6 | 2400 | uint16_t N, |
mturner5 | 0:b7116bd48af6 | 2401 | uint16_t Nby2, |
mturner5 | 0:b7116bd48af6 | 2402 | float32_t normalize); |
mturner5 | 0:b7116bd48af6 | 2403 | |
mturner5 | 0:b7116bd48af6 | 2404 | /** |
mturner5 | 0:b7116bd48af6 | 2405 | * @brief Processing function for the floating-point DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2406 | * @param[in] *S points to an instance of the floating-point DCT4/IDCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2407 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 2408 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
mturner5 | 0:b7116bd48af6 | 2409 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2410 | */ |
mturner5 | 0:b7116bd48af6 | 2411 | |
mturner5 | 0:b7116bd48af6 | 2412 | void arm_dct4_f32( |
mturner5 | 0:b7116bd48af6 | 2413 | const arm_dct4_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 2414 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 2415 | float32_t * pInlineBuffer); |
mturner5 | 0:b7116bd48af6 | 2416 | |
mturner5 | 0:b7116bd48af6 | 2417 | /** |
mturner5 | 0:b7116bd48af6 | 2418 | * @brief Instance structure for the Q31 DCT4/IDCT4 function. |
mturner5 | 0:b7116bd48af6 | 2419 | */ |
mturner5 | 0:b7116bd48af6 | 2420 | |
mturner5 | 0:b7116bd48af6 | 2421 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2422 | { |
mturner5 | 0:b7116bd48af6 | 2423 | uint16_t N; /**< length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2424 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2425 | q31_t normalize; /**< normalizing factor. */ |
mturner5 | 0:b7116bd48af6 | 2426 | q31_t *pTwiddle; /**< points to the twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2427 | q31_t *pCosFactor; /**< points to the cosFactor table. */ |
mturner5 | 0:b7116bd48af6 | 2428 | arm_rfft_instance_q31 *pRfft; /**< points to the real FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2429 | arm_cfft_radix4_instance_q31 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2430 | } arm_dct4_instance_q31; |
mturner5 | 0:b7116bd48af6 | 2431 | |
mturner5 | 0:b7116bd48af6 | 2432 | /** |
mturner5 | 0:b7116bd48af6 | 2433 | * @brief Initialization function for the Q31 DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2434 | * @param[in,out] *S points to an instance of Q31 DCT4/IDCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2435 | * @param[in] *S_RFFT points to an instance of Q31 RFFT/RIFFT structure |
mturner5 | 0:b7116bd48af6 | 2436 | * @param[in] *S_CFFT points to an instance of Q31 CFFT/CIFFT structure |
mturner5 | 0:b7116bd48af6 | 2437 | * @param[in] N length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2438 | * @param[in] Nby2 half of the length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2439 | * @param[in] normalize normalizing factor. |
mturner5 | 0:b7116bd48af6 | 2440 | * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length. |
mturner5 | 0:b7116bd48af6 | 2441 | */ |
mturner5 | 0:b7116bd48af6 | 2442 | |
mturner5 | 0:b7116bd48af6 | 2443 | arm_status arm_dct4_init_q31( |
mturner5 | 0:b7116bd48af6 | 2444 | arm_dct4_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2445 | arm_rfft_instance_q31 * S_RFFT, |
mturner5 | 0:b7116bd48af6 | 2446 | arm_cfft_radix4_instance_q31 * S_CFFT, |
mturner5 | 0:b7116bd48af6 | 2447 | uint16_t N, |
mturner5 | 0:b7116bd48af6 | 2448 | uint16_t Nby2, |
mturner5 | 0:b7116bd48af6 | 2449 | q31_t normalize); |
mturner5 | 0:b7116bd48af6 | 2450 | |
mturner5 | 0:b7116bd48af6 | 2451 | /** |
mturner5 | 0:b7116bd48af6 | 2452 | * @brief Processing function for the Q31 DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2453 | * @param[in] *S points to an instance of the Q31 DCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2454 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 2455 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
mturner5 | 0:b7116bd48af6 | 2456 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2457 | */ |
mturner5 | 0:b7116bd48af6 | 2458 | |
mturner5 | 0:b7116bd48af6 | 2459 | void arm_dct4_q31( |
mturner5 | 0:b7116bd48af6 | 2460 | const arm_dct4_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 2461 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 2462 | q31_t * pInlineBuffer); |
mturner5 | 0:b7116bd48af6 | 2463 | |
mturner5 | 0:b7116bd48af6 | 2464 | /** |
mturner5 | 0:b7116bd48af6 | 2465 | * @brief Instance structure for the Q15 DCT4/IDCT4 function. |
mturner5 | 0:b7116bd48af6 | 2466 | */ |
mturner5 | 0:b7116bd48af6 | 2467 | |
mturner5 | 0:b7116bd48af6 | 2468 | typedef struct |
mturner5 | 0:b7116bd48af6 | 2469 | { |
mturner5 | 0:b7116bd48af6 | 2470 | uint16_t N; /**< length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2471 | uint16_t Nby2; /**< half of the length of the DCT4. */ |
mturner5 | 0:b7116bd48af6 | 2472 | q15_t normalize; /**< normalizing factor. */ |
mturner5 | 0:b7116bd48af6 | 2473 | q15_t *pTwiddle; /**< points to the twiddle factor table. */ |
mturner5 | 0:b7116bd48af6 | 2474 | q15_t *pCosFactor; /**< points to the cosFactor table. */ |
mturner5 | 0:b7116bd48af6 | 2475 | arm_rfft_instance_q15 *pRfft; /**< points to the real FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2476 | arm_cfft_radix4_instance_q15 *pCfft; /**< points to the complex FFT instance. */ |
mturner5 | 0:b7116bd48af6 | 2477 | } arm_dct4_instance_q15; |
mturner5 | 0:b7116bd48af6 | 2478 | |
mturner5 | 0:b7116bd48af6 | 2479 | /** |
mturner5 | 0:b7116bd48af6 | 2480 | * @brief Initialization function for the Q15 DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2481 | * @param[in,out] *S points to an instance of Q15 DCT4/IDCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2482 | * @param[in] *S_RFFT points to an instance of Q15 RFFT/RIFFT structure. |
mturner5 | 0:b7116bd48af6 | 2483 | * @param[in] *S_CFFT points to an instance of Q15 CFFT/CIFFT structure. |
mturner5 | 0:b7116bd48af6 | 2484 | * @param[in] N length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2485 | * @param[in] Nby2 half of the length of the DCT4. |
mturner5 | 0:b7116bd48af6 | 2486 | * @param[in] normalize normalizing factor. |
mturner5 | 0:b7116bd48af6 | 2487 | * @return arm_status function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>N</code> is not a supported transform length. |
mturner5 | 0:b7116bd48af6 | 2488 | */ |
mturner5 | 0:b7116bd48af6 | 2489 | |
mturner5 | 0:b7116bd48af6 | 2490 | arm_status arm_dct4_init_q15( |
mturner5 | 0:b7116bd48af6 | 2491 | arm_dct4_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2492 | arm_rfft_instance_q15 * S_RFFT, |
mturner5 | 0:b7116bd48af6 | 2493 | arm_cfft_radix4_instance_q15 * S_CFFT, |
mturner5 | 0:b7116bd48af6 | 2494 | uint16_t N, |
mturner5 | 0:b7116bd48af6 | 2495 | uint16_t Nby2, |
mturner5 | 0:b7116bd48af6 | 2496 | q15_t normalize); |
mturner5 | 0:b7116bd48af6 | 2497 | |
mturner5 | 0:b7116bd48af6 | 2498 | /** |
mturner5 | 0:b7116bd48af6 | 2499 | * @brief Processing function for the Q15 DCT4/IDCT4. |
mturner5 | 0:b7116bd48af6 | 2500 | * @param[in] *S points to an instance of the Q15 DCT4 structure. |
mturner5 | 0:b7116bd48af6 | 2501 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 2502 | * @param[in,out] *pInlineBuffer points to the in-place input and output buffer. |
mturner5 | 0:b7116bd48af6 | 2503 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2504 | */ |
mturner5 | 0:b7116bd48af6 | 2505 | |
mturner5 | 0:b7116bd48af6 | 2506 | void arm_dct4_q15( |
mturner5 | 0:b7116bd48af6 | 2507 | const arm_dct4_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 2508 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 2509 | q15_t * pInlineBuffer); |
mturner5 | 0:b7116bd48af6 | 2510 | |
mturner5 | 0:b7116bd48af6 | 2511 | /** |
mturner5 | 0:b7116bd48af6 | 2512 | * @brief Floating-point vector addition. |
mturner5 | 0:b7116bd48af6 | 2513 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2514 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2515 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2516 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2517 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2518 | */ |
mturner5 | 0:b7116bd48af6 | 2519 | |
mturner5 | 0:b7116bd48af6 | 2520 | void arm_add_f32( |
mturner5 | 0:b7116bd48af6 | 2521 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2522 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2523 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2524 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2525 | |
mturner5 | 0:b7116bd48af6 | 2526 | /** |
mturner5 | 0:b7116bd48af6 | 2527 | * @brief Q7 vector addition. |
mturner5 | 0:b7116bd48af6 | 2528 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2529 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2530 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2531 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2532 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2533 | */ |
mturner5 | 0:b7116bd48af6 | 2534 | |
mturner5 | 0:b7116bd48af6 | 2535 | void arm_add_q7( |
mturner5 | 0:b7116bd48af6 | 2536 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2537 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2538 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2539 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2540 | |
mturner5 | 0:b7116bd48af6 | 2541 | /** |
mturner5 | 0:b7116bd48af6 | 2542 | * @brief Q15 vector addition. |
mturner5 | 0:b7116bd48af6 | 2543 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2544 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2545 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2546 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2547 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2548 | */ |
mturner5 | 0:b7116bd48af6 | 2549 | |
mturner5 | 0:b7116bd48af6 | 2550 | void arm_add_q15( |
mturner5 | 0:b7116bd48af6 | 2551 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2552 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2553 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2554 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2555 | |
mturner5 | 0:b7116bd48af6 | 2556 | /** |
mturner5 | 0:b7116bd48af6 | 2557 | * @brief Q31 vector addition. |
mturner5 | 0:b7116bd48af6 | 2558 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2559 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2560 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2561 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2562 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2563 | */ |
mturner5 | 0:b7116bd48af6 | 2564 | |
mturner5 | 0:b7116bd48af6 | 2565 | void arm_add_q31( |
mturner5 | 0:b7116bd48af6 | 2566 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2567 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2568 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2569 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2570 | |
mturner5 | 0:b7116bd48af6 | 2571 | /** |
mturner5 | 0:b7116bd48af6 | 2572 | * @brief Floating-point vector subtraction. |
mturner5 | 0:b7116bd48af6 | 2573 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2574 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2575 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2576 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2577 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2578 | */ |
mturner5 | 0:b7116bd48af6 | 2579 | |
mturner5 | 0:b7116bd48af6 | 2580 | void arm_sub_f32( |
mturner5 | 0:b7116bd48af6 | 2581 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2582 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2583 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2584 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2585 | |
mturner5 | 0:b7116bd48af6 | 2586 | /** |
mturner5 | 0:b7116bd48af6 | 2587 | * @brief Q7 vector subtraction. |
mturner5 | 0:b7116bd48af6 | 2588 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2589 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2590 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2591 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2592 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2593 | */ |
mturner5 | 0:b7116bd48af6 | 2594 | |
mturner5 | 0:b7116bd48af6 | 2595 | void arm_sub_q7( |
mturner5 | 0:b7116bd48af6 | 2596 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2597 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2598 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2599 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2600 | |
mturner5 | 0:b7116bd48af6 | 2601 | /** |
mturner5 | 0:b7116bd48af6 | 2602 | * @brief Q15 vector subtraction. |
mturner5 | 0:b7116bd48af6 | 2603 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2604 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2605 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2606 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2607 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2608 | */ |
mturner5 | 0:b7116bd48af6 | 2609 | |
mturner5 | 0:b7116bd48af6 | 2610 | void arm_sub_q15( |
mturner5 | 0:b7116bd48af6 | 2611 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2612 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2613 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2614 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2615 | |
mturner5 | 0:b7116bd48af6 | 2616 | /** |
mturner5 | 0:b7116bd48af6 | 2617 | * @brief Q31 vector subtraction. |
mturner5 | 0:b7116bd48af6 | 2618 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2619 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2620 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2621 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2622 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2623 | */ |
mturner5 | 0:b7116bd48af6 | 2624 | |
mturner5 | 0:b7116bd48af6 | 2625 | void arm_sub_q31( |
mturner5 | 0:b7116bd48af6 | 2626 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2627 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2628 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2629 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2630 | |
mturner5 | 0:b7116bd48af6 | 2631 | /** |
mturner5 | 0:b7116bd48af6 | 2632 | * @brief Multiplies a floating-point vector by a scalar. |
mturner5 | 0:b7116bd48af6 | 2633 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2634 | * @param[in] scale scale factor to be applied |
mturner5 | 0:b7116bd48af6 | 2635 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2636 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2637 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2638 | */ |
mturner5 | 0:b7116bd48af6 | 2639 | |
mturner5 | 0:b7116bd48af6 | 2640 | void arm_scale_f32( |
mturner5 | 0:b7116bd48af6 | 2641 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2642 | float32_t scale, |
mturner5 | 0:b7116bd48af6 | 2643 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2644 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2645 | |
mturner5 | 0:b7116bd48af6 | 2646 | /** |
mturner5 | 0:b7116bd48af6 | 2647 | * @brief Multiplies a Q7 vector by a scalar. |
mturner5 | 0:b7116bd48af6 | 2648 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2649 | * @param[in] scaleFract fractional portion of the scale value |
mturner5 | 0:b7116bd48af6 | 2650 | * @param[in] shift number of bits to shift the result by |
mturner5 | 0:b7116bd48af6 | 2651 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2652 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2653 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2654 | */ |
mturner5 | 0:b7116bd48af6 | 2655 | |
mturner5 | 0:b7116bd48af6 | 2656 | void arm_scale_q7( |
mturner5 | 0:b7116bd48af6 | 2657 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2658 | q7_t scaleFract, |
mturner5 | 0:b7116bd48af6 | 2659 | int8_t shift, |
mturner5 | 0:b7116bd48af6 | 2660 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2661 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2662 | |
mturner5 | 0:b7116bd48af6 | 2663 | /** |
mturner5 | 0:b7116bd48af6 | 2664 | * @brief Multiplies a Q15 vector by a scalar. |
mturner5 | 0:b7116bd48af6 | 2665 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2666 | * @param[in] scaleFract fractional portion of the scale value |
mturner5 | 0:b7116bd48af6 | 2667 | * @param[in] shift number of bits to shift the result by |
mturner5 | 0:b7116bd48af6 | 2668 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2669 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2670 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2671 | */ |
mturner5 | 0:b7116bd48af6 | 2672 | |
mturner5 | 0:b7116bd48af6 | 2673 | void arm_scale_q15( |
mturner5 | 0:b7116bd48af6 | 2674 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2675 | q15_t scaleFract, |
mturner5 | 0:b7116bd48af6 | 2676 | int8_t shift, |
mturner5 | 0:b7116bd48af6 | 2677 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2678 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2679 | |
mturner5 | 0:b7116bd48af6 | 2680 | /** |
mturner5 | 0:b7116bd48af6 | 2681 | * @brief Multiplies a Q31 vector by a scalar. |
mturner5 | 0:b7116bd48af6 | 2682 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2683 | * @param[in] scaleFract fractional portion of the scale value |
mturner5 | 0:b7116bd48af6 | 2684 | * @param[in] shift number of bits to shift the result by |
mturner5 | 0:b7116bd48af6 | 2685 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2686 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2687 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2688 | */ |
mturner5 | 0:b7116bd48af6 | 2689 | |
mturner5 | 0:b7116bd48af6 | 2690 | void arm_scale_q31( |
mturner5 | 0:b7116bd48af6 | 2691 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2692 | q31_t scaleFract, |
mturner5 | 0:b7116bd48af6 | 2693 | int8_t shift, |
mturner5 | 0:b7116bd48af6 | 2694 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2695 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2696 | |
mturner5 | 0:b7116bd48af6 | 2697 | /** |
mturner5 | 0:b7116bd48af6 | 2698 | * @brief Q7 vector absolute value. |
mturner5 | 0:b7116bd48af6 | 2699 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 2700 | * @param[out] *pDst points to the output buffer |
mturner5 | 0:b7116bd48af6 | 2701 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2702 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2703 | */ |
mturner5 | 0:b7116bd48af6 | 2704 | |
mturner5 | 0:b7116bd48af6 | 2705 | void arm_abs_q7( |
mturner5 | 0:b7116bd48af6 | 2706 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2707 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2708 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2709 | |
mturner5 | 0:b7116bd48af6 | 2710 | /** |
mturner5 | 0:b7116bd48af6 | 2711 | * @brief Floating-point vector absolute value. |
mturner5 | 0:b7116bd48af6 | 2712 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 2713 | * @param[out] *pDst points to the output buffer |
mturner5 | 0:b7116bd48af6 | 2714 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2715 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2716 | */ |
mturner5 | 0:b7116bd48af6 | 2717 | |
mturner5 | 0:b7116bd48af6 | 2718 | void arm_abs_f32( |
mturner5 | 0:b7116bd48af6 | 2719 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2720 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2721 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2722 | |
mturner5 | 0:b7116bd48af6 | 2723 | /** |
mturner5 | 0:b7116bd48af6 | 2724 | * @brief Q15 vector absolute value. |
mturner5 | 0:b7116bd48af6 | 2725 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 2726 | * @param[out] *pDst points to the output buffer |
mturner5 | 0:b7116bd48af6 | 2727 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2728 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2729 | */ |
mturner5 | 0:b7116bd48af6 | 2730 | |
mturner5 | 0:b7116bd48af6 | 2731 | void arm_abs_q15( |
mturner5 | 0:b7116bd48af6 | 2732 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2733 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2734 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2735 | |
mturner5 | 0:b7116bd48af6 | 2736 | /** |
mturner5 | 0:b7116bd48af6 | 2737 | * @brief Q31 vector absolute value. |
mturner5 | 0:b7116bd48af6 | 2738 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 2739 | * @param[out] *pDst points to the output buffer |
mturner5 | 0:b7116bd48af6 | 2740 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2741 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2742 | */ |
mturner5 | 0:b7116bd48af6 | 2743 | |
mturner5 | 0:b7116bd48af6 | 2744 | void arm_abs_q31( |
mturner5 | 0:b7116bd48af6 | 2745 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2746 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2747 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2748 | |
mturner5 | 0:b7116bd48af6 | 2749 | /** |
mturner5 | 0:b7116bd48af6 | 2750 | * @brief Dot product of floating-point vectors. |
mturner5 | 0:b7116bd48af6 | 2751 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2752 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2753 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2754 | * @param[out] *result output result returned here |
mturner5 | 0:b7116bd48af6 | 2755 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2756 | */ |
mturner5 | 0:b7116bd48af6 | 2757 | |
mturner5 | 0:b7116bd48af6 | 2758 | void arm_dot_prod_f32( |
mturner5 | 0:b7116bd48af6 | 2759 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2760 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2761 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 2762 | float32_t * result); |
mturner5 | 0:b7116bd48af6 | 2763 | |
mturner5 | 0:b7116bd48af6 | 2764 | /** |
mturner5 | 0:b7116bd48af6 | 2765 | * @brief Dot product of Q7 vectors. |
mturner5 | 0:b7116bd48af6 | 2766 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2767 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2768 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2769 | * @param[out] *result output result returned here |
mturner5 | 0:b7116bd48af6 | 2770 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2771 | */ |
mturner5 | 0:b7116bd48af6 | 2772 | |
mturner5 | 0:b7116bd48af6 | 2773 | void arm_dot_prod_q7( |
mturner5 | 0:b7116bd48af6 | 2774 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2775 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2776 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 2777 | q31_t * result); |
mturner5 | 0:b7116bd48af6 | 2778 | |
mturner5 | 0:b7116bd48af6 | 2779 | /** |
mturner5 | 0:b7116bd48af6 | 2780 | * @brief Dot product of Q15 vectors. |
mturner5 | 0:b7116bd48af6 | 2781 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2782 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2783 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2784 | * @param[out] *result output result returned here |
mturner5 | 0:b7116bd48af6 | 2785 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2786 | */ |
mturner5 | 0:b7116bd48af6 | 2787 | |
mturner5 | 0:b7116bd48af6 | 2788 | void arm_dot_prod_q15( |
mturner5 | 0:b7116bd48af6 | 2789 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2790 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2791 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 2792 | q63_t * result); |
mturner5 | 0:b7116bd48af6 | 2793 | |
mturner5 | 0:b7116bd48af6 | 2794 | /** |
mturner5 | 0:b7116bd48af6 | 2795 | * @brief Dot product of Q31 vectors. |
mturner5 | 0:b7116bd48af6 | 2796 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 2797 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 2798 | * @param[in] blockSize number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 2799 | * @param[out] *result output result returned here |
mturner5 | 0:b7116bd48af6 | 2800 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2801 | */ |
mturner5 | 0:b7116bd48af6 | 2802 | |
mturner5 | 0:b7116bd48af6 | 2803 | void arm_dot_prod_q31( |
mturner5 | 0:b7116bd48af6 | 2804 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 2805 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 2806 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 2807 | q63_t * result); |
mturner5 | 0:b7116bd48af6 | 2808 | |
mturner5 | 0:b7116bd48af6 | 2809 | /** |
mturner5 | 0:b7116bd48af6 | 2810 | * @brief Shifts the elements of a Q7 vector a specified number of bits. |
mturner5 | 0:b7116bd48af6 | 2811 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2812 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
mturner5 | 0:b7116bd48af6 | 2813 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2814 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2815 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2816 | */ |
mturner5 | 0:b7116bd48af6 | 2817 | |
mturner5 | 0:b7116bd48af6 | 2818 | void arm_shift_q7( |
mturner5 | 0:b7116bd48af6 | 2819 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2820 | int8_t shiftBits, |
mturner5 | 0:b7116bd48af6 | 2821 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2822 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2823 | |
mturner5 | 0:b7116bd48af6 | 2824 | /** |
mturner5 | 0:b7116bd48af6 | 2825 | * @brief Shifts the elements of a Q15 vector a specified number of bits. |
mturner5 | 0:b7116bd48af6 | 2826 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2827 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
mturner5 | 0:b7116bd48af6 | 2828 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2829 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2830 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2831 | */ |
mturner5 | 0:b7116bd48af6 | 2832 | |
mturner5 | 0:b7116bd48af6 | 2833 | void arm_shift_q15( |
mturner5 | 0:b7116bd48af6 | 2834 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2835 | int8_t shiftBits, |
mturner5 | 0:b7116bd48af6 | 2836 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2837 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2838 | |
mturner5 | 0:b7116bd48af6 | 2839 | /** |
mturner5 | 0:b7116bd48af6 | 2840 | * @brief Shifts the elements of a Q31 vector a specified number of bits. |
mturner5 | 0:b7116bd48af6 | 2841 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2842 | * @param[in] shiftBits number of bits to shift. A positive value shifts left; a negative value shifts right. |
mturner5 | 0:b7116bd48af6 | 2843 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2844 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2845 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2846 | */ |
mturner5 | 0:b7116bd48af6 | 2847 | |
mturner5 | 0:b7116bd48af6 | 2848 | void arm_shift_q31( |
mturner5 | 0:b7116bd48af6 | 2849 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2850 | int8_t shiftBits, |
mturner5 | 0:b7116bd48af6 | 2851 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2852 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2853 | |
mturner5 | 0:b7116bd48af6 | 2854 | /** |
mturner5 | 0:b7116bd48af6 | 2855 | * @brief Adds a constant offset to a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 2856 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2857 | * @param[in] offset is the offset to be added |
mturner5 | 0:b7116bd48af6 | 2858 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2859 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2860 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2861 | */ |
mturner5 | 0:b7116bd48af6 | 2862 | |
mturner5 | 0:b7116bd48af6 | 2863 | void arm_offset_f32( |
mturner5 | 0:b7116bd48af6 | 2864 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2865 | float32_t offset, |
mturner5 | 0:b7116bd48af6 | 2866 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2867 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2868 | |
mturner5 | 0:b7116bd48af6 | 2869 | /** |
mturner5 | 0:b7116bd48af6 | 2870 | * @brief Adds a constant offset to a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 2871 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2872 | * @param[in] offset is the offset to be added |
mturner5 | 0:b7116bd48af6 | 2873 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2874 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2875 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2876 | */ |
mturner5 | 0:b7116bd48af6 | 2877 | |
mturner5 | 0:b7116bd48af6 | 2878 | void arm_offset_q7( |
mturner5 | 0:b7116bd48af6 | 2879 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2880 | q7_t offset, |
mturner5 | 0:b7116bd48af6 | 2881 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2882 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2883 | |
mturner5 | 0:b7116bd48af6 | 2884 | /** |
mturner5 | 0:b7116bd48af6 | 2885 | * @brief Adds a constant offset to a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 2886 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2887 | * @param[in] offset is the offset to be added |
mturner5 | 0:b7116bd48af6 | 2888 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2889 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2890 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2891 | */ |
mturner5 | 0:b7116bd48af6 | 2892 | |
mturner5 | 0:b7116bd48af6 | 2893 | void arm_offset_q15( |
mturner5 | 0:b7116bd48af6 | 2894 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2895 | q15_t offset, |
mturner5 | 0:b7116bd48af6 | 2896 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2897 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2898 | |
mturner5 | 0:b7116bd48af6 | 2899 | /** |
mturner5 | 0:b7116bd48af6 | 2900 | * @brief Adds a constant offset to a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 2901 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2902 | * @param[in] offset is the offset to be added |
mturner5 | 0:b7116bd48af6 | 2903 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2904 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2905 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2906 | */ |
mturner5 | 0:b7116bd48af6 | 2907 | |
mturner5 | 0:b7116bd48af6 | 2908 | void arm_offset_q31( |
mturner5 | 0:b7116bd48af6 | 2909 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2910 | q31_t offset, |
mturner5 | 0:b7116bd48af6 | 2911 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2912 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2913 | |
mturner5 | 0:b7116bd48af6 | 2914 | /** |
mturner5 | 0:b7116bd48af6 | 2915 | * @brief Negates the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 2916 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2917 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2918 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2919 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2920 | */ |
mturner5 | 0:b7116bd48af6 | 2921 | |
mturner5 | 0:b7116bd48af6 | 2922 | void arm_negate_f32( |
mturner5 | 0:b7116bd48af6 | 2923 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2924 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2925 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2926 | |
mturner5 | 0:b7116bd48af6 | 2927 | /** |
mturner5 | 0:b7116bd48af6 | 2928 | * @brief Negates the elements of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 2929 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2930 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2931 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2932 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2933 | */ |
mturner5 | 0:b7116bd48af6 | 2934 | |
mturner5 | 0:b7116bd48af6 | 2935 | void arm_negate_q7( |
mturner5 | 0:b7116bd48af6 | 2936 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2937 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2938 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2939 | |
mturner5 | 0:b7116bd48af6 | 2940 | /** |
mturner5 | 0:b7116bd48af6 | 2941 | * @brief Negates the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 2942 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2943 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2944 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2945 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2946 | */ |
mturner5 | 0:b7116bd48af6 | 2947 | |
mturner5 | 0:b7116bd48af6 | 2948 | void arm_negate_q15( |
mturner5 | 0:b7116bd48af6 | 2949 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2950 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2951 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2952 | |
mturner5 | 0:b7116bd48af6 | 2953 | /** |
mturner5 | 0:b7116bd48af6 | 2954 | * @brief Negates the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 2955 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 2956 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 2957 | * @param[in] blockSize number of samples in the vector |
mturner5 | 0:b7116bd48af6 | 2958 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2959 | */ |
mturner5 | 0:b7116bd48af6 | 2960 | |
mturner5 | 0:b7116bd48af6 | 2961 | void arm_negate_q31( |
mturner5 | 0:b7116bd48af6 | 2962 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2963 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2964 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2965 | /** |
mturner5 | 0:b7116bd48af6 | 2966 | * @brief Copies the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 2967 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 2968 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 2969 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 2970 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2971 | */ |
mturner5 | 0:b7116bd48af6 | 2972 | void arm_copy_f32( |
mturner5 | 0:b7116bd48af6 | 2973 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2974 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2975 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2976 | |
mturner5 | 0:b7116bd48af6 | 2977 | /** |
mturner5 | 0:b7116bd48af6 | 2978 | * @brief Copies the elements of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 2979 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 2980 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 2981 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 2982 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2983 | */ |
mturner5 | 0:b7116bd48af6 | 2984 | void arm_copy_q7( |
mturner5 | 0:b7116bd48af6 | 2985 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2986 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2987 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 2988 | |
mturner5 | 0:b7116bd48af6 | 2989 | /** |
mturner5 | 0:b7116bd48af6 | 2990 | * @brief Copies the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 2991 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 2992 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 2993 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 2994 | * @return none. |
mturner5 | 0:b7116bd48af6 | 2995 | */ |
mturner5 | 0:b7116bd48af6 | 2996 | void arm_copy_q15( |
mturner5 | 0:b7116bd48af6 | 2997 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 2998 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 2999 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3000 | |
mturner5 | 0:b7116bd48af6 | 3001 | /** |
mturner5 | 0:b7116bd48af6 | 3002 | * @brief Copies the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 3003 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 3004 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 3005 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 3006 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3007 | */ |
mturner5 | 0:b7116bd48af6 | 3008 | void arm_copy_q31( |
mturner5 | 0:b7116bd48af6 | 3009 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3010 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3011 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3012 | /** |
mturner5 | 0:b7116bd48af6 | 3013 | * @brief Fills a constant value into a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 3014 | * @param[in] value input value to be filled |
mturner5 | 0:b7116bd48af6 | 3015 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 3016 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 3017 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3018 | */ |
mturner5 | 0:b7116bd48af6 | 3019 | void arm_fill_f32( |
mturner5 | 0:b7116bd48af6 | 3020 | float32_t value, |
mturner5 | 0:b7116bd48af6 | 3021 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3022 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3023 | |
mturner5 | 0:b7116bd48af6 | 3024 | /** |
mturner5 | 0:b7116bd48af6 | 3025 | * @brief Fills a constant value into a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 3026 | * @param[in] value input value to be filled |
mturner5 | 0:b7116bd48af6 | 3027 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 3028 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 3029 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3030 | */ |
mturner5 | 0:b7116bd48af6 | 3031 | void arm_fill_q7( |
mturner5 | 0:b7116bd48af6 | 3032 | q7_t value, |
mturner5 | 0:b7116bd48af6 | 3033 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3034 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3035 | |
mturner5 | 0:b7116bd48af6 | 3036 | /** |
mturner5 | 0:b7116bd48af6 | 3037 | * @brief Fills a constant value into a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 3038 | * @param[in] value input value to be filled |
mturner5 | 0:b7116bd48af6 | 3039 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 3040 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 3041 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3042 | */ |
mturner5 | 0:b7116bd48af6 | 3043 | void arm_fill_q15( |
mturner5 | 0:b7116bd48af6 | 3044 | q15_t value, |
mturner5 | 0:b7116bd48af6 | 3045 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3046 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3047 | |
mturner5 | 0:b7116bd48af6 | 3048 | /** |
mturner5 | 0:b7116bd48af6 | 3049 | * @brief Fills a constant value into a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 3050 | * @param[in] value input value to be filled |
mturner5 | 0:b7116bd48af6 | 3051 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 3052 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 3053 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3054 | */ |
mturner5 | 0:b7116bd48af6 | 3055 | void arm_fill_q31( |
mturner5 | 0:b7116bd48af6 | 3056 | q31_t value, |
mturner5 | 0:b7116bd48af6 | 3057 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3058 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3059 | |
mturner5 | 0:b7116bd48af6 | 3060 | /** |
mturner5 | 0:b7116bd48af6 | 3061 | * @brief Convolution of floating-point sequences. |
mturner5 | 0:b7116bd48af6 | 3062 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3063 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3064 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3065 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3066 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3067 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3068 | */ |
mturner5 | 0:b7116bd48af6 | 3069 | |
mturner5 | 0:b7116bd48af6 | 3070 | void arm_conv_f32( |
mturner5 | 0:b7116bd48af6 | 3071 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3072 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3073 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3074 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3075 | float32_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3076 | |
mturner5 | 0:b7116bd48af6 | 3077 | |
mturner5 | 0:b7116bd48af6 | 3078 | /** |
mturner5 | 0:b7116bd48af6 | 3079 | * @brief Convolution of Q15 sequences. |
mturner5 | 0:b7116bd48af6 | 3080 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3081 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3082 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3083 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3084 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3085 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3086 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3087 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3088 | */ |
mturner5 | 0:b7116bd48af6 | 3089 | |
mturner5 | 0:b7116bd48af6 | 3090 | |
mturner5 | 0:b7116bd48af6 | 3091 | void arm_conv_opt_q15( |
mturner5 | 0:b7116bd48af6 | 3092 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3093 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3094 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3095 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3096 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3097 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3098 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3099 | |
mturner5 | 0:b7116bd48af6 | 3100 | |
mturner5 | 0:b7116bd48af6 | 3101 | /** |
mturner5 | 0:b7116bd48af6 | 3102 | * @brief Convolution of Q15 sequences. |
mturner5 | 0:b7116bd48af6 | 3103 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3104 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3105 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3106 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3107 | * @param[out] *pDst points to the location where the output result is written. Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3108 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3109 | */ |
mturner5 | 0:b7116bd48af6 | 3110 | |
mturner5 | 0:b7116bd48af6 | 3111 | void arm_conv_q15( |
mturner5 | 0:b7116bd48af6 | 3112 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3113 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3114 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3115 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3116 | q15_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3117 | |
mturner5 | 0:b7116bd48af6 | 3118 | /** |
mturner5 | 0:b7116bd48af6 | 3119 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3120 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3121 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3122 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3123 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3124 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3125 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3126 | */ |
mturner5 | 0:b7116bd48af6 | 3127 | |
mturner5 | 0:b7116bd48af6 | 3128 | void arm_conv_fast_q15( |
mturner5 | 0:b7116bd48af6 | 3129 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3130 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3131 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3132 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3133 | q15_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3134 | |
mturner5 | 0:b7116bd48af6 | 3135 | /** |
mturner5 | 0:b7116bd48af6 | 3136 | * @brief Convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3137 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3138 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3139 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3140 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3141 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3142 | * @param[in] *pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3143 | * @param[in] *pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3144 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3145 | */ |
mturner5 | 0:b7116bd48af6 | 3146 | |
mturner5 | 0:b7116bd48af6 | 3147 | void arm_conv_fast_opt_q15( |
mturner5 | 0:b7116bd48af6 | 3148 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3149 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3150 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3151 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3152 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3153 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3154 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3155 | |
mturner5 | 0:b7116bd48af6 | 3156 | |
mturner5 | 0:b7116bd48af6 | 3157 | |
mturner5 | 0:b7116bd48af6 | 3158 | /** |
mturner5 | 0:b7116bd48af6 | 3159 | * @brief Convolution of Q31 sequences. |
mturner5 | 0:b7116bd48af6 | 3160 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3161 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3162 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3163 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3164 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3165 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3166 | */ |
mturner5 | 0:b7116bd48af6 | 3167 | |
mturner5 | 0:b7116bd48af6 | 3168 | void arm_conv_q31( |
mturner5 | 0:b7116bd48af6 | 3169 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3170 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3171 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3172 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3173 | q31_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3174 | |
mturner5 | 0:b7116bd48af6 | 3175 | /** |
mturner5 | 0:b7116bd48af6 | 3176 | * @brief Convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3177 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3178 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3179 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3180 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3181 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3182 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3183 | */ |
mturner5 | 0:b7116bd48af6 | 3184 | |
mturner5 | 0:b7116bd48af6 | 3185 | void arm_conv_fast_q31( |
mturner5 | 0:b7116bd48af6 | 3186 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3187 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3188 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3189 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3190 | q31_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3191 | |
mturner5 | 0:b7116bd48af6 | 3192 | |
mturner5 | 0:b7116bd48af6 | 3193 | /** |
mturner5 | 0:b7116bd48af6 | 3194 | * @brief Convolution of Q7 sequences. |
mturner5 | 0:b7116bd48af6 | 3195 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3196 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3197 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3198 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3199 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3200 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3201 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3202 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3203 | */ |
mturner5 | 0:b7116bd48af6 | 3204 | |
mturner5 | 0:b7116bd48af6 | 3205 | void arm_conv_opt_q7( |
mturner5 | 0:b7116bd48af6 | 3206 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3207 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3208 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3209 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3210 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3211 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3212 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3213 | |
mturner5 | 0:b7116bd48af6 | 3214 | |
mturner5 | 0:b7116bd48af6 | 3215 | |
mturner5 | 0:b7116bd48af6 | 3216 | /** |
mturner5 | 0:b7116bd48af6 | 3217 | * @brief Convolution of Q7 sequences. |
mturner5 | 0:b7116bd48af6 | 3218 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3219 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3220 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3221 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3222 | * @param[out] *pDst points to the block of output data Length srcALen+srcBLen-1. |
mturner5 | 0:b7116bd48af6 | 3223 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3224 | */ |
mturner5 | 0:b7116bd48af6 | 3225 | |
mturner5 | 0:b7116bd48af6 | 3226 | void arm_conv_q7( |
mturner5 | 0:b7116bd48af6 | 3227 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3228 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3229 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3230 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3231 | q7_t * pDst); |
mturner5 | 0:b7116bd48af6 | 3232 | |
mturner5 | 0:b7116bd48af6 | 3233 | |
mturner5 | 0:b7116bd48af6 | 3234 | /** |
mturner5 | 0:b7116bd48af6 | 3235 | * @brief Partial convolution of floating-point sequences. |
mturner5 | 0:b7116bd48af6 | 3236 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3237 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3238 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3239 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3240 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3241 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3242 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3243 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3244 | */ |
mturner5 | 0:b7116bd48af6 | 3245 | |
mturner5 | 0:b7116bd48af6 | 3246 | arm_status arm_conv_partial_f32( |
mturner5 | 0:b7116bd48af6 | 3247 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3248 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3249 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3250 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3251 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3252 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3253 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3254 | |
mturner5 | 0:b7116bd48af6 | 3255 | /** |
mturner5 | 0:b7116bd48af6 | 3256 | * @brief Partial convolution of Q15 sequences. |
mturner5 | 0:b7116bd48af6 | 3257 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3258 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3259 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3260 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3261 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3262 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3263 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3264 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3265 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3266 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3267 | */ |
mturner5 | 0:b7116bd48af6 | 3268 | |
mturner5 | 0:b7116bd48af6 | 3269 | arm_status arm_conv_partial_opt_q15( |
mturner5 | 0:b7116bd48af6 | 3270 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3271 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3272 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3273 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3274 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3275 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3276 | uint32_t numPoints, |
mturner5 | 0:b7116bd48af6 | 3277 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3278 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3279 | |
mturner5 | 0:b7116bd48af6 | 3280 | |
mturner5 | 0:b7116bd48af6 | 3281 | /** |
mturner5 | 0:b7116bd48af6 | 3282 | * @brief Partial convolution of Q15 sequences. |
mturner5 | 0:b7116bd48af6 | 3283 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3284 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3285 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3286 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3287 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3288 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3289 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3290 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3291 | */ |
mturner5 | 0:b7116bd48af6 | 3292 | |
mturner5 | 0:b7116bd48af6 | 3293 | arm_status arm_conv_partial_q15( |
mturner5 | 0:b7116bd48af6 | 3294 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3295 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3296 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3297 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3298 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3299 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3300 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3301 | |
mturner5 | 0:b7116bd48af6 | 3302 | /** |
mturner5 | 0:b7116bd48af6 | 3303 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3304 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3305 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3306 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3307 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3308 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3309 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3310 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3311 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3312 | */ |
mturner5 | 0:b7116bd48af6 | 3313 | |
mturner5 | 0:b7116bd48af6 | 3314 | arm_status arm_conv_partial_fast_q15( |
mturner5 | 0:b7116bd48af6 | 3315 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3316 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3317 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3318 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3319 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3320 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3321 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3322 | |
mturner5 | 0:b7116bd48af6 | 3323 | |
mturner5 | 0:b7116bd48af6 | 3324 | /** |
mturner5 | 0:b7116bd48af6 | 3325 | * @brief Partial convolution of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3326 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3327 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3328 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3329 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3330 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3331 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3332 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3333 | * @param[in] * pScratch1 points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3334 | * @param[in] * pScratch2 points to scratch buffer of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3335 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3336 | */ |
mturner5 | 0:b7116bd48af6 | 3337 | |
mturner5 | 0:b7116bd48af6 | 3338 | arm_status arm_conv_partial_fast_opt_q15( |
mturner5 | 0:b7116bd48af6 | 3339 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3340 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3341 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3342 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3343 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3344 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3345 | uint32_t numPoints, |
mturner5 | 0:b7116bd48af6 | 3346 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3347 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3348 | |
mturner5 | 0:b7116bd48af6 | 3349 | |
mturner5 | 0:b7116bd48af6 | 3350 | /** |
mturner5 | 0:b7116bd48af6 | 3351 | * @brief Partial convolution of Q31 sequences. |
mturner5 | 0:b7116bd48af6 | 3352 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3353 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3354 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3355 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3356 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3357 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3358 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3359 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3360 | */ |
mturner5 | 0:b7116bd48af6 | 3361 | |
mturner5 | 0:b7116bd48af6 | 3362 | arm_status arm_conv_partial_q31( |
mturner5 | 0:b7116bd48af6 | 3363 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3364 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3365 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3366 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3367 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3368 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3369 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3370 | |
mturner5 | 0:b7116bd48af6 | 3371 | |
mturner5 | 0:b7116bd48af6 | 3372 | /** |
mturner5 | 0:b7116bd48af6 | 3373 | * @brief Partial convolution of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 3374 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3375 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3376 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3377 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3378 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3379 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3380 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3381 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3382 | */ |
mturner5 | 0:b7116bd48af6 | 3383 | |
mturner5 | 0:b7116bd48af6 | 3384 | arm_status arm_conv_partial_fast_q31( |
mturner5 | 0:b7116bd48af6 | 3385 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3386 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3387 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3388 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3389 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3390 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3391 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3392 | |
mturner5 | 0:b7116bd48af6 | 3393 | |
mturner5 | 0:b7116bd48af6 | 3394 | /** |
mturner5 | 0:b7116bd48af6 | 3395 | * @brief Partial convolution of Q7 sequences |
mturner5 | 0:b7116bd48af6 | 3396 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3397 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3398 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3399 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3400 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3401 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3402 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3403 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 3404 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 3405 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3406 | */ |
mturner5 | 0:b7116bd48af6 | 3407 | |
mturner5 | 0:b7116bd48af6 | 3408 | arm_status arm_conv_partial_opt_q7( |
mturner5 | 0:b7116bd48af6 | 3409 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3410 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3411 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3412 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3413 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3414 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3415 | uint32_t numPoints, |
mturner5 | 0:b7116bd48af6 | 3416 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 3417 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 3418 | |
mturner5 | 0:b7116bd48af6 | 3419 | |
mturner5 | 0:b7116bd48af6 | 3420 | /** |
mturner5 | 0:b7116bd48af6 | 3421 | * @brief Partial convolution of Q7 sequences. |
mturner5 | 0:b7116bd48af6 | 3422 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3423 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 3424 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3425 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 3426 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3427 | * @param[in] firstIndex is the first output sample to start with. |
mturner5 | 0:b7116bd48af6 | 3428 | * @param[in] numPoints is the number of output points to be computed. |
mturner5 | 0:b7116bd48af6 | 3429 | * @return Returns either ARM_MATH_SUCCESS if the function completed correctly or ARM_MATH_ARGUMENT_ERROR if the requested subset is not in the range [0 srcALen+srcBLen-2]. |
mturner5 | 0:b7116bd48af6 | 3430 | */ |
mturner5 | 0:b7116bd48af6 | 3431 | |
mturner5 | 0:b7116bd48af6 | 3432 | arm_status arm_conv_partial_q7( |
mturner5 | 0:b7116bd48af6 | 3433 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 3434 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 3435 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 3436 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 3437 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3438 | uint32_t firstIndex, |
mturner5 | 0:b7116bd48af6 | 3439 | uint32_t numPoints); |
mturner5 | 0:b7116bd48af6 | 3440 | |
mturner5 | 0:b7116bd48af6 | 3441 | |
mturner5 | 0:b7116bd48af6 | 3442 | |
mturner5 | 0:b7116bd48af6 | 3443 | /** |
mturner5 | 0:b7116bd48af6 | 3444 | * @brief Instance structure for the Q15 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3445 | */ |
mturner5 | 0:b7116bd48af6 | 3446 | |
mturner5 | 0:b7116bd48af6 | 3447 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3448 | { |
mturner5 | 0:b7116bd48af6 | 3449 | uint8_t M; /**< decimation factor. */ |
mturner5 | 0:b7116bd48af6 | 3450 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 3451 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 3452 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 3453 | } arm_fir_decimate_instance_q15; |
mturner5 | 0:b7116bd48af6 | 3454 | |
mturner5 | 0:b7116bd48af6 | 3455 | /** |
mturner5 | 0:b7116bd48af6 | 3456 | * @brief Instance structure for the Q31 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3457 | */ |
mturner5 | 0:b7116bd48af6 | 3458 | |
mturner5 | 0:b7116bd48af6 | 3459 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3460 | { |
mturner5 | 0:b7116bd48af6 | 3461 | uint8_t M; /**< decimation factor. */ |
mturner5 | 0:b7116bd48af6 | 3462 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 3463 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 3464 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 3465 | |
mturner5 | 0:b7116bd48af6 | 3466 | } arm_fir_decimate_instance_q31; |
mturner5 | 0:b7116bd48af6 | 3467 | |
mturner5 | 0:b7116bd48af6 | 3468 | /** |
mturner5 | 0:b7116bd48af6 | 3469 | * @brief Instance structure for the floating-point FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3470 | */ |
mturner5 | 0:b7116bd48af6 | 3471 | |
mturner5 | 0:b7116bd48af6 | 3472 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3473 | { |
mturner5 | 0:b7116bd48af6 | 3474 | uint8_t M; /**< decimation factor. */ |
mturner5 | 0:b7116bd48af6 | 3475 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 3476 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 3477 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 3478 | |
mturner5 | 0:b7116bd48af6 | 3479 | } arm_fir_decimate_instance_f32; |
mturner5 | 0:b7116bd48af6 | 3480 | |
mturner5 | 0:b7116bd48af6 | 3481 | |
mturner5 | 0:b7116bd48af6 | 3482 | |
mturner5 | 0:b7116bd48af6 | 3483 | /** |
mturner5 | 0:b7116bd48af6 | 3484 | * @brief Processing function for the floating-point FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3485 | * @param[in] *S points to an instance of the floating-point FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3486 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3487 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3488 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3489 | * @return none |
mturner5 | 0:b7116bd48af6 | 3490 | */ |
mturner5 | 0:b7116bd48af6 | 3491 | |
mturner5 | 0:b7116bd48af6 | 3492 | void arm_fir_decimate_f32( |
mturner5 | 0:b7116bd48af6 | 3493 | const arm_fir_decimate_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3494 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3495 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3496 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3497 | |
mturner5 | 0:b7116bd48af6 | 3498 | |
mturner5 | 0:b7116bd48af6 | 3499 | /** |
mturner5 | 0:b7116bd48af6 | 3500 | * @brief Initialization function for the floating-point FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3501 | * @param[in,out] *S points to an instance of the floating-point FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3502 | * @param[in] numTaps number of coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3503 | * @param[in] M decimation factor. |
mturner5 | 0:b7116bd48af6 | 3504 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3505 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3506 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3507 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3508 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
mturner5 | 0:b7116bd48af6 | 3509 | */ |
mturner5 | 0:b7116bd48af6 | 3510 | |
mturner5 | 0:b7116bd48af6 | 3511 | arm_status arm_fir_decimate_init_f32( |
mturner5 | 0:b7116bd48af6 | 3512 | arm_fir_decimate_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3513 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3514 | uint8_t M, |
mturner5 | 0:b7116bd48af6 | 3515 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3516 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 3517 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3518 | |
mturner5 | 0:b7116bd48af6 | 3519 | /** |
mturner5 | 0:b7116bd48af6 | 3520 | * @brief Processing function for the Q15 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3521 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3522 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3523 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3524 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3525 | * @return none |
mturner5 | 0:b7116bd48af6 | 3526 | */ |
mturner5 | 0:b7116bd48af6 | 3527 | |
mturner5 | 0:b7116bd48af6 | 3528 | void arm_fir_decimate_q15( |
mturner5 | 0:b7116bd48af6 | 3529 | const arm_fir_decimate_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3530 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3531 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3532 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3533 | |
mturner5 | 0:b7116bd48af6 | 3534 | /** |
mturner5 | 0:b7116bd48af6 | 3535 | * @brief Processing function for the Q15 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 3536 | * @param[in] *S points to an instance of the Q15 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3537 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3538 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3539 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3540 | * @return none |
mturner5 | 0:b7116bd48af6 | 3541 | */ |
mturner5 | 0:b7116bd48af6 | 3542 | |
mturner5 | 0:b7116bd48af6 | 3543 | void arm_fir_decimate_fast_q15( |
mturner5 | 0:b7116bd48af6 | 3544 | const arm_fir_decimate_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3545 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3546 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3547 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3548 | |
mturner5 | 0:b7116bd48af6 | 3549 | |
mturner5 | 0:b7116bd48af6 | 3550 | |
mturner5 | 0:b7116bd48af6 | 3551 | /** |
mturner5 | 0:b7116bd48af6 | 3552 | * @brief Initialization function for the Q15 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3553 | * @param[in,out] *S points to an instance of the Q15 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3554 | * @param[in] numTaps number of coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3555 | * @param[in] M decimation factor. |
mturner5 | 0:b7116bd48af6 | 3556 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3557 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3558 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3559 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3560 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
mturner5 | 0:b7116bd48af6 | 3561 | */ |
mturner5 | 0:b7116bd48af6 | 3562 | |
mturner5 | 0:b7116bd48af6 | 3563 | arm_status arm_fir_decimate_init_q15( |
mturner5 | 0:b7116bd48af6 | 3564 | arm_fir_decimate_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3565 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3566 | uint8_t M, |
mturner5 | 0:b7116bd48af6 | 3567 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3568 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 3569 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3570 | |
mturner5 | 0:b7116bd48af6 | 3571 | /** |
mturner5 | 0:b7116bd48af6 | 3572 | * @brief Processing function for the Q31 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3573 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3574 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3575 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3576 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3577 | * @return none |
mturner5 | 0:b7116bd48af6 | 3578 | */ |
mturner5 | 0:b7116bd48af6 | 3579 | |
mturner5 | 0:b7116bd48af6 | 3580 | void arm_fir_decimate_q31( |
mturner5 | 0:b7116bd48af6 | 3581 | const arm_fir_decimate_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3582 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3583 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3584 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3585 | |
mturner5 | 0:b7116bd48af6 | 3586 | /** |
mturner5 | 0:b7116bd48af6 | 3587 | * @brief Processing function for the Q31 FIR decimator (fast variant) for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 3588 | * @param[in] *S points to an instance of the Q31 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3589 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3590 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3591 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3592 | * @return none |
mturner5 | 0:b7116bd48af6 | 3593 | */ |
mturner5 | 0:b7116bd48af6 | 3594 | |
mturner5 | 0:b7116bd48af6 | 3595 | void arm_fir_decimate_fast_q31( |
mturner5 | 0:b7116bd48af6 | 3596 | arm_fir_decimate_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3597 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3598 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3599 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3600 | |
mturner5 | 0:b7116bd48af6 | 3601 | |
mturner5 | 0:b7116bd48af6 | 3602 | /** |
mturner5 | 0:b7116bd48af6 | 3603 | * @brief Initialization function for the Q31 FIR decimator. |
mturner5 | 0:b7116bd48af6 | 3604 | * @param[in,out] *S points to an instance of the Q31 FIR decimator structure. |
mturner5 | 0:b7116bd48af6 | 3605 | * @param[in] numTaps number of coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3606 | * @param[in] M decimation factor. |
mturner5 | 0:b7116bd48af6 | 3607 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3608 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3609 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3610 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3611 | * <code>blockSize</code> is not a multiple of <code>M</code>. |
mturner5 | 0:b7116bd48af6 | 3612 | */ |
mturner5 | 0:b7116bd48af6 | 3613 | |
mturner5 | 0:b7116bd48af6 | 3614 | arm_status arm_fir_decimate_init_q31( |
mturner5 | 0:b7116bd48af6 | 3615 | arm_fir_decimate_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3616 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3617 | uint8_t M, |
mturner5 | 0:b7116bd48af6 | 3618 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3619 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 3620 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3621 | |
mturner5 | 0:b7116bd48af6 | 3622 | |
mturner5 | 0:b7116bd48af6 | 3623 | |
mturner5 | 0:b7116bd48af6 | 3624 | /** |
mturner5 | 0:b7116bd48af6 | 3625 | * @brief Instance structure for the Q15 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3626 | */ |
mturner5 | 0:b7116bd48af6 | 3627 | |
mturner5 | 0:b7116bd48af6 | 3628 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3629 | { |
mturner5 | 0:b7116bd48af6 | 3630 | uint8_t L; /**< upsample factor. */ |
mturner5 | 0:b7116bd48af6 | 3631 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
mturner5 | 0:b7116bd48af6 | 3632 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
mturner5 | 0:b7116bd48af6 | 3633 | q15_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
mturner5 | 0:b7116bd48af6 | 3634 | } arm_fir_interpolate_instance_q15; |
mturner5 | 0:b7116bd48af6 | 3635 | |
mturner5 | 0:b7116bd48af6 | 3636 | /** |
mturner5 | 0:b7116bd48af6 | 3637 | * @brief Instance structure for the Q31 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3638 | */ |
mturner5 | 0:b7116bd48af6 | 3639 | |
mturner5 | 0:b7116bd48af6 | 3640 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3641 | { |
mturner5 | 0:b7116bd48af6 | 3642 | uint8_t L; /**< upsample factor. */ |
mturner5 | 0:b7116bd48af6 | 3643 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
mturner5 | 0:b7116bd48af6 | 3644 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
mturner5 | 0:b7116bd48af6 | 3645 | q31_t *pState; /**< points to the state variable array. The array is of length blockSize+phaseLength-1. */ |
mturner5 | 0:b7116bd48af6 | 3646 | } arm_fir_interpolate_instance_q31; |
mturner5 | 0:b7116bd48af6 | 3647 | |
mturner5 | 0:b7116bd48af6 | 3648 | /** |
mturner5 | 0:b7116bd48af6 | 3649 | * @brief Instance structure for the floating-point FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3650 | */ |
mturner5 | 0:b7116bd48af6 | 3651 | |
mturner5 | 0:b7116bd48af6 | 3652 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3653 | { |
mturner5 | 0:b7116bd48af6 | 3654 | uint8_t L; /**< upsample factor. */ |
mturner5 | 0:b7116bd48af6 | 3655 | uint16_t phaseLength; /**< length of each polyphase filter component. */ |
mturner5 | 0:b7116bd48af6 | 3656 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length L*phaseLength. */ |
mturner5 | 0:b7116bd48af6 | 3657 | float32_t *pState; /**< points to the state variable array. The array is of length phaseLength+numTaps-1. */ |
mturner5 | 0:b7116bd48af6 | 3658 | } arm_fir_interpolate_instance_f32; |
mturner5 | 0:b7116bd48af6 | 3659 | |
mturner5 | 0:b7116bd48af6 | 3660 | |
mturner5 | 0:b7116bd48af6 | 3661 | /** |
mturner5 | 0:b7116bd48af6 | 3662 | * @brief Processing function for the Q15 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3663 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3664 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3665 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 3666 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3667 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3668 | */ |
mturner5 | 0:b7116bd48af6 | 3669 | |
mturner5 | 0:b7116bd48af6 | 3670 | void arm_fir_interpolate_q15( |
mturner5 | 0:b7116bd48af6 | 3671 | const arm_fir_interpolate_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3672 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3673 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3674 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3675 | |
mturner5 | 0:b7116bd48af6 | 3676 | |
mturner5 | 0:b7116bd48af6 | 3677 | /** |
mturner5 | 0:b7116bd48af6 | 3678 | * @brief Initialization function for the Q15 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3679 | * @param[in,out] *S points to an instance of the Q15 FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3680 | * @param[in] L upsample factor. |
mturner5 | 0:b7116bd48af6 | 3681 | * @param[in] numTaps number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3682 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 3683 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3684 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3685 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3686 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
mturner5 | 0:b7116bd48af6 | 3687 | */ |
mturner5 | 0:b7116bd48af6 | 3688 | |
mturner5 | 0:b7116bd48af6 | 3689 | arm_status arm_fir_interpolate_init_q15( |
mturner5 | 0:b7116bd48af6 | 3690 | arm_fir_interpolate_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3691 | uint8_t L, |
mturner5 | 0:b7116bd48af6 | 3692 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3693 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3694 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 3695 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3696 | |
mturner5 | 0:b7116bd48af6 | 3697 | /** |
mturner5 | 0:b7116bd48af6 | 3698 | * @brief Processing function for the Q31 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3699 | * @param[in] *S points to an instance of the Q15 FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3700 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3701 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 3702 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3703 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3704 | */ |
mturner5 | 0:b7116bd48af6 | 3705 | |
mturner5 | 0:b7116bd48af6 | 3706 | void arm_fir_interpolate_q31( |
mturner5 | 0:b7116bd48af6 | 3707 | const arm_fir_interpolate_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3708 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3709 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3710 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3711 | |
mturner5 | 0:b7116bd48af6 | 3712 | /** |
mturner5 | 0:b7116bd48af6 | 3713 | * @brief Initialization function for the Q31 FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3714 | * @param[in,out] *S points to an instance of the Q31 FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3715 | * @param[in] L upsample factor. |
mturner5 | 0:b7116bd48af6 | 3716 | * @param[in] numTaps number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3717 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 3718 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3719 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3720 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3721 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
mturner5 | 0:b7116bd48af6 | 3722 | */ |
mturner5 | 0:b7116bd48af6 | 3723 | |
mturner5 | 0:b7116bd48af6 | 3724 | arm_status arm_fir_interpolate_init_q31( |
mturner5 | 0:b7116bd48af6 | 3725 | arm_fir_interpolate_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3726 | uint8_t L, |
mturner5 | 0:b7116bd48af6 | 3727 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3728 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3729 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 3730 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3731 | |
mturner5 | 0:b7116bd48af6 | 3732 | |
mturner5 | 0:b7116bd48af6 | 3733 | /** |
mturner5 | 0:b7116bd48af6 | 3734 | * @brief Processing function for the floating-point FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3735 | * @param[in] *S points to an instance of the floating-point FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3736 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3737 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 3738 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3739 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3740 | */ |
mturner5 | 0:b7116bd48af6 | 3741 | |
mturner5 | 0:b7116bd48af6 | 3742 | void arm_fir_interpolate_f32( |
mturner5 | 0:b7116bd48af6 | 3743 | const arm_fir_interpolate_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3744 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3745 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3746 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3747 | |
mturner5 | 0:b7116bd48af6 | 3748 | /** |
mturner5 | 0:b7116bd48af6 | 3749 | * @brief Initialization function for the floating-point FIR interpolator. |
mturner5 | 0:b7116bd48af6 | 3750 | * @param[in,out] *S points to an instance of the floating-point FIR interpolator structure. |
mturner5 | 0:b7116bd48af6 | 3751 | * @param[in] L upsample factor. |
mturner5 | 0:b7116bd48af6 | 3752 | * @param[in] numTaps number of filter coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 3753 | * @param[in] *pCoeffs points to the filter coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 3754 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3755 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 3756 | * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_LENGTH_ERROR if |
mturner5 | 0:b7116bd48af6 | 3757 | * the filter length <code>numTaps</code> is not a multiple of the interpolation factor <code>L</code>. |
mturner5 | 0:b7116bd48af6 | 3758 | */ |
mturner5 | 0:b7116bd48af6 | 3759 | |
mturner5 | 0:b7116bd48af6 | 3760 | arm_status arm_fir_interpolate_init_f32( |
mturner5 | 0:b7116bd48af6 | 3761 | arm_fir_interpolate_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3762 | uint8_t L, |
mturner5 | 0:b7116bd48af6 | 3763 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 3764 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3765 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 3766 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3767 | |
mturner5 | 0:b7116bd48af6 | 3768 | /** |
mturner5 | 0:b7116bd48af6 | 3769 | * @brief Instance structure for the high precision Q31 Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3770 | */ |
mturner5 | 0:b7116bd48af6 | 3771 | |
mturner5 | 0:b7116bd48af6 | 3772 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3773 | { |
mturner5 | 0:b7116bd48af6 | 3774 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3775 | q63_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3776 | q31_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3777 | uint8_t postShift; /**< additional shift, in bits, applied to each output sample. */ |
mturner5 | 0:b7116bd48af6 | 3778 | |
mturner5 | 0:b7116bd48af6 | 3779 | } arm_biquad_cas_df1_32x64_ins_q31; |
mturner5 | 0:b7116bd48af6 | 3780 | |
mturner5 | 0:b7116bd48af6 | 3781 | |
mturner5 | 0:b7116bd48af6 | 3782 | /** |
mturner5 | 0:b7116bd48af6 | 3783 | * @param[in] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
mturner5 | 0:b7116bd48af6 | 3784 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3785 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3786 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 3787 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3788 | */ |
mturner5 | 0:b7116bd48af6 | 3789 | |
mturner5 | 0:b7116bd48af6 | 3790 | void arm_biquad_cas_df1_32x64_q31( |
mturner5 | 0:b7116bd48af6 | 3791 | const arm_biquad_cas_df1_32x64_ins_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3792 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3793 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3794 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3795 | |
mturner5 | 0:b7116bd48af6 | 3796 | |
mturner5 | 0:b7116bd48af6 | 3797 | /** |
mturner5 | 0:b7116bd48af6 | 3798 | * @param[in,out] *S points to an instance of the high precision Q31 Biquad cascade filter structure. |
mturner5 | 0:b7116bd48af6 | 3799 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 3800 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3801 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3802 | * @param[in] postShift shift to be applied to the output. Varies according to the coefficients format |
mturner5 | 0:b7116bd48af6 | 3803 | * @return none |
mturner5 | 0:b7116bd48af6 | 3804 | */ |
mturner5 | 0:b7116bd48af6 | 3805 | |
mturner5 | 0:b7116bd48af6 | 3806 | void arm_biquad_cas_df1_32x64_init_q31( |
mturner5 | 0:b7116bd48af6 | 3807 | arm_biquad_cas_df1_32x64_ins_q31 * S, |
mturner5 | 0:b7116bd48af6 | 3808 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 3809 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3810 | q63_t * pState, |
mturner5 | 0:b7116bd48af6 | 3811 | uint8_t postShift); |
mturner5 | 0:b7116bd48af6 | 3812 | |
mturner5 | 0:b7116bd48af6 | 3813 | |
mturner5 | 0:b7116bd48af6 | 3814 | |
mturner5 | 0:b7116bd48af6 | 3815 | /** |
mturner5 | 0:b7116bd48af6 | 3816 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3817 | */ |
mturner5 | 0:b7116bd48af6 | 3818 | |
mturner5 | 0:b7116bd48af6 | 3819 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3820 | { |
mturner5 | 0:b7116bd48af6 | 3821 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3822 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3823 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3824 | } arm_biquad_cascade_df2T_instance_f32; |
mturner5 | 0:b7116bd48af6 | 3825 | |
mturner5 | 0:b7116bd48af6 | 3826 | |
mturner5 | 0:b7116bd48af6 | 3827 | |
mturner5 | 0:b7116bd48af6 | 3828 | /** |
mturner5 | 0:b7116bd48af6 | 3829 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3830 | */ |
mturner5 | 0:b7116bd48af6 | 3831 | |
mturner5 | 0:b7116bd48af6 | 3832 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3833 | { |
mturner5 | 0:b7116bd48af6 | 3834 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3835 | float32_t *pState; /**< points to the array of state coefficients. The array is of length 4*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3836 | float32_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3837 | } arm_biquad_cascade_stereo_df2T_instance_f32; |
mturner5 | 0:b7116bd48af6 | 3838 | |
mturner5 | 0:b7116bd48af6 | 3839 | |
mturner5 | 0:b7116bd48af6 | 3840 | |
mturner5 | 0:b7116bd48af6 | 3841 | /** |
mturner5 | 0:b7116bd48af6 | 3842 | * @brief Instance structure for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3843 | */ |
mturner5 | 0:b7116bd48af6 | 3844 | |
mturner5 | 0:b7116bd48af6 | 3845 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3846 | { |
mturner5 | 0:b7116bd48af6 | 3847 | uint8_t numStages; /**< number of 2nd order stages in the filter. Overall order is 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3848 | float64_t *pState; /**< points to the array of state coefficients. The array is of length 2*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3849 | float64_t *pCoeffs; /**< points to the array of coefficients. The array is of length 5*numStages. */ |
mturner5 | 0:b7116bd48af6 | 3850 | } arm_biquad_cascade_df2T_instance_f64; |
mturner5 | 0:b7116bd48af6 | 3851 | |
mturner5 | 0:b7116bd48af6 | 3852 | |
mturner5 | 0:b7116bd48af6 | 3853 | /** |
mturner5 | 0:b7116bd48af6 | 3854 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3855 | * @param[in] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3856 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3857 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3858 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 3859 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3860 | */ |
mturner5 | 0:b7116bd48af6 | 3861 | |
mturner5 | 0:b7116bd48af6 | 3862 | void arm_biquad_cascade_df2T_f32( |
mturner5 | 0:b7116bd48af6 | 3863 | const arm_biquad_cascade_df2T_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3864 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3865 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3866 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3867 | |
mturner5 | 0:b7116bd48af6 | 3868 | |
mturner5 | 0:b7116bd48af6 | 3869 | /** |
mturner5 | 0:b7116bd48af6 | 3870 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. 2 channels |
mturner5 | 0:b7116bd48af6 | 3871 | * @param[in] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3872 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3873 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3874 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 3875 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3876 | */ |
mturner5 | 0:b7116bd48af6 | 3877 | |
mturner5 | 0:b7116bd48af6 | 3878 | void arm_biquad_cascade_stereo_df2T_f32( |
mturner5 | 0:b7116bd48af6 | 3879 | const arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3880 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3881 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3882 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3883 | |
mturner5 | 0:b7116bd48af6 | 3884 | /** |
mturner5 | 0:b7116bd48af6 | 3885 | * @brief Processing function for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3886 | * @param[in] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3887 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 3888 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 3889 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 3890 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3891 | */ |
mturner5 | 0:b7116bd48af6 | 3892 | |
mturner5 | 0:b7116bd48af6 | 3893 | void arm_biquad_cascade_df2T_f64( |
mturner5 | 0:b7116bd48af6 | 3894 | const arm_biquad_cascade_df2T_instance_f64 * S, |
mturner5 | 0:b7116bd48af6 | 3895 | float64_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 3896 | float64_t * pDst, |
mturner5 | 0:b7116bd48af6 | 3897 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 3898 | |
mturner5 | 0:b7116bd48af6 | 3899 | |
mturner5 | 0:b7116bd48af6 | 3900 | /** |
mturner5 | 0:b7116bd48af6 | 3901 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3902 | * @param[in,out] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3903 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 3904 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3905 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3906 | * @return none |
mturner5 | 0:b7116bd48af6 | 3907 | */ |
mturner5 | 0:b7116bd48af6 | 3908 | |
mturner5 | 0:b7116bd48af6 | 3909 | void arm_biquad_cascade_df2T_init_f32( |
mturner5 | 0:b7116bd48af6 | 3910 | arm_biquad_cascade_df2T_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3911 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 3912 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3913 | float32_t * pState); |
mturner5 | 0:b7116bd48af6 | 3914 | |
mturner5 | 0:b7116bd48af6 | 3915 | |
mturner5 | 0:b7116bd48af6 | 3916 | /** |
mturner5 | 0:b7116bd48af6 | 3917 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3918 | * @param[in,out] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3919 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 3920 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3921 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3922 | * @return none |
mturner5 | 0:b7116bd48af6 | 3923 | */ |
mturner5 | 0:b7116bd48af6 | 3924 | |
mturner5 | 0:b7116bd48af6 | 3925 | void arm_biquad_cascade_stereo_df2T_init_f32( |
mturner5 | 0:b7116bd48af6 | 3926 | arm_biquad_cascade_stereo_df2T_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 3927 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 3928 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3929 | float32_t * pState); |
mturner5 | 0:b7116bd48af6 | 3930 | |
mturner5 | 0:b7116bd48af6 | 3931 | |
mturner5 | 0:b7116bd48af6 | 3932 | /** |
mturner5 | 0:b7116bd48af6 | 3933 | * @brief Initialization function for the floating-point transposed direct form II Biquad cascade filter. |
mturner5 | 0:b7116bd48af6 | 3934 | * @param[in,out] *S points to an instance of the filter data structure. |
mturner5 | 0:b7116bd48af6 | 3935 | * @param[in] numStages number of 2nd order stages in the filter. |
mturner5 | 0:b7116bd48af6 | 3936 | * @param[in] *pCoeffs points to the filter coefficients. |
mturner5 | 0:b7116bd48af6 | 3937 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 3938 | * @return none |
mturner5 | 0:b7116bd48af6 | 3939 | */ |
mturner5 | 0:b7116bd48af6 | 3940 | |
mturner5 | 0:b7116bd48af6 | 3941 | void arm_biquad_cascade_df2T_init_f64( |
mturner5 | 0:b7116bd48af6 | 3942 | arm_biquad_cascade_df2T_instance_f64 * S, |
mturner5 | 0:b7116bd48af6 | 3943 | uint8_t numStages, |
mturner5 | 0:b7116bd48af6 | 3944 | float64_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3945 | float64_t * pState); |
mturner5 | 0:b7116bd48af6 | 3946 | |
mturner5 | 0:b7116bd48af6 | 3947 | |
mturner5 | 0:b7116bd48af6 | 3948 | |
mturner5 | 0:b7116bd48af6 | 3949 | /** |
mturner5 | 0:b7116bd48af6 | 3950 | * @brief Instance structure for the Q15 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 3951 | */ |
mturner5 | 0:b7116bd48af6 | 3952 | |
mturner5 | 0:b7116bd48af6 | 3953 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3954 | { |
mturner5 | 0:b7116bd48af6 | 3955 | uint16_t numStages; /**< number of filter stages. */ |
mturner5 | 0:b7116bd48af6 | 3956 | q15_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3957 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3958 | } arm_fir_lattice_instance_q15; |
mturner5 | 0:b7116bd48af6 | 3959 | |
mturner5 | 0:b7116bd48af6 | 3960 | /** |
mturner5 | 0:b7116bd48af6 | 3961 | * @brief Instance structure for the Q31 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 3962 | */ |
mturner5 | 0:b7116bd48af6 | 3963 | |
mturner5 | 0:b7116bd48af6 | 3964 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3965 | { |
mturner5 | 0:b7116bd48af6 | 3966 | uint16_t numStages; /**< number of filter stages. */ |
mturner5 | 0:b7116bd48af6 | 3967 | q31_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3968 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3969 | } arm_fir_lattice_instance_q31; |
mturner5 | 0:b7116bd48af6 | 3970 | |
mturner5 | 0:b7116bd48af6 | 3971 | /** |
mturner5 | 0:b7116bd48af6 | 3972 | * @brief Instance structure for the floating-point FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 3973 | */ |
mturner5 | 0:b7116bd48af6 | 3974 | |
mturner5 | 0:b7116bd48af6 | 3975 | typedef struct |
mturner5 | 0:b7116bd48af6 | 3976 | { |
mturner5 | 0:b7116bd48af6 | 3977 | uint16_t numStages; /**< number of filter stages. */ |
mturner5 | 0:b7116bd48af6 | 3978 | float32_t *pState; /**< points to the state variable array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3979 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 3980 | } arm_fir_lattice_instance_f32; |
mturner5 | 0:b7116bd48af6 | 3981 | |
mturner5 | 0:b7116bd48af6 | 3982 | /** |
mturner5 | 0:b7116bd48af6 | 3983 | * @brief Initialization function for the Q15 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 3984 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 3985 | * @param[in] numStages number of filter stages. |
mturner5 | 0:b7116bd48af6 | 3986 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 3987 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 3988 | * @return none. |
mturner5 | 0:b7116bd48af6 | 3989 | */ |
mturner5 | 0:b7116bd48af6 | 3990 | |
mturner5 | 0:b7116bd48af6 | 3991 | void arm_fir_lattice_init_q15( |
mturner5 | 0:b7116bd48af6 | 3992 | arm_fir_lattice_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 3993 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 3994 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 3995 | q15_t * pState); |
mturner5 | 0:b7116bd48af6 | 3996 | |
mturner5 | 0:b7116bd48af6 | 3997 | |
mturner5 | 0:b7116bd48af6 | 3998 | /** |
mturner5 | 0:b7116bd48af6 | 3999 | * @brief Processing function for the Q15 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4000 | * @param[in] *S points to an instance of the Q15 FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4001 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4002 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4003 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4004 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4005 | */ |
mturner5 | 0:b7116bd48af6 | 4006 | void arm_fir_lattice_q15( |
mturner5 | 0:b7116bd48af6 | 4007 | const arm_fir_lattice_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4008 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4009 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4010 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4011 | |
mturner5 | 0:b7116bd48af6 | 4012 | /** |
mturner5 | 0:b7116bd48af6 | 4013 | * @brief Initialization function for the Q31 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4014 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4015 | * @param[in] numStages number of filter stages. |
mturner5 | 0:b7116bd48af6 | 4016 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4017 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4018 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4019 | */ |
mturner5 | 0:b7116bd48af6 | 4020 | |
mturner5 | 0:b7116bd48af6 | 4021 | void arm_fir_lattice_init_q31( |
mturner5 | 0:b7116bd48af6 | 4022 | arm_fir_lattice_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4023 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 4024 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4025 | q31_t * pState); |
mturner5 | 0:b7116bd48af6 | 4026 | |
mturner5 | 0:b7116bd48af6 | 4027 | |
mturner5 | 0:b7116bd48af6 | 4028 | /** |
mturner5 | 0:b7116bd48af6 | 4029 | * @brief Processing function for the Q31 FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4030 | * @param[in] *S points to an instance of the Q31 FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4031 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4032 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4033 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4034 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4035 | */ |
mturner5 | 0:b7116bd48af6 | 4036 | |
mturner5 | 0:b7116bd48af6 | 4037 | void arm_fir_lattice_q31( |
mturner5 | 0:b7116bd48af6 | 4038 | const arm_fir_lattice_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4039 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4040 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4041 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4042 | |
mturner5 | 0:b7116bd48af6 | 4043 | /** |
mturner5 | 0:b7116bd48af6 | 4044 | * @brief Initialization function for the floating-point FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4045 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4046 | * @param[in] numStages number of filter stages. |
mturner5 | 0:b7116bd48af6 | 4047 | * @param[in] *pCoeffs points to the coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4048 | * @param[in] *pState points to the state buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4049 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4050 | */ |
mturner5 | 0:b7116bd48af6 | 4051 | |
mturner5 | 0:b7116bd48af6 | 4052 | void arm_fir_lattice_init_f32( |
mturner5 | 0:b7116bd48af6 | 4053 | arm_fir_lattice_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4054 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 4055 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4056 | float32_t * pState); |
mturner5 | 0:b7116bd48af6 | 4057 | |
mturner5 | 0:b7116bd48af6 | 4058 | /** |
mturner5 | 0:b7116bd48af6 | 4059 | * @brief Processing function for the floating-point FIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4060 | * @param[in] *S points to an instance of the floating-point FIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4061 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4062 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4063 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4064 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4065 | */ |
mturner5 | 0:b7116bd48af6 | 4066 | |
mturner5 | 0:b7116bd48af6 | 4067 | void arm_fir_lattice_f32( |
mturner5 | 0:b7116bd48af6 | 4068 | const arm_fir_lattice_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4069 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4070 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4071 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4072 | |
mturner5 | 0:b7116bd48af6 | 4073 | /** |
mturner5 | 0:b7116bd48af6 | 4074 | * @brief Instance structure for the Q15 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4075 | */ |
mturner5 | 0:b7116bd48af6 | 4076 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4077 | { |
mturner5 | 0:b7116bd48af6 | 4078 | uint16_t numStages; /**< number of stages in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4079 | q15_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
mturner5 | 0:b7116bd48af6 | 4080 | q15_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 4081 | q15_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
mturner5 | 0:b7116bd48af6 | 4082 | } arm_iir_lattice_instance_q15; |
mturner5 | 0:b7116bd48af6 | 4083 | |
mturner5 | 0:b7116bd48af6 | 4084 | /** |
mturner5 | 0:b7116bd48af6 | 4085 | * @brief Instance structure for the Q31 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4086 | */ |
mturner5 | 0:b7116bd48af6 | 4087 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4088 | { |
mturner5 | 0:b7116bd48af6 | 4089 | uint16_t numStages; /**< number of stages in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4090 | q31_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
mturner5 | 0:b7116bd48af6 | 4091 | q31_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 4092 | q31_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
mturner5 | 0:b7116bd48af6 | 4093 | } arm_iir_lattice_instance_q31; |
mturner5 | 0:b7116bd48af6 | 4094 | |
mturner5 | 0:b7116bd48af6 | 4095 | /** |
mturner5 | 0:b7116bd48af6 | 4096 | * @brief Instance structure for the floating-point IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4097 | */ |
mturner5 | 0:b7116bd48af6 | 4098 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4099 | { |
mturner5 | 0:b7116bd48af6 | 4100 | uint16_t numStages; /**< number of stages in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4101 | float32_t *pState; /**< points to the state variable array. The array is of length numStages+blockSize. */ |
mturner5 | 0:b7116bd48af6 | 4102 | float32_t *pkCoeffs; /**< points to the reflection coefficient array. The array is of length numStages. */ |
mturner5 | 0:b7116bd48af6 | 4103 | float32_t *pvCoeffs; /**< points to the ladder coefficient array. The array is of length numStages+1. */ |
mturner5 | 0:b7116bd48af6 | 4104 | } arm_iir_lattice_instance_f32; |
mturner5 | 0:b7116bd48af6 | 4105 | |
mturner5 | 0:b7116bd48af6 | 4106 | /** |
mturner5 | 0:b7116bd48af6 | 4107 | * @brief Processing function for the floating-point IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4108 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4109 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4110 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4111 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4112 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4113 | */ |
mturner5 | 0:b7116bd48af6 | 4114 | |
mturner5 | 0:b7116bd48af6 | 4115 | void arm_iir_lattice_f32( |
mturner5 | 0:b7116bd48af6 | 4116 | const arm_iir_lattice_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4117 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4118 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4119 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4120 | |
mturner5 | 0:b7116bd48af6 | 4121 | /** |
mturner5 | 0:b7116bd48af6 | 4122 | * @brief Initialization function for the floating-point IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4123 | * @param[in] *S points to an instance of the floating-point IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4124 | * @param[in] numStages number of stages in the filter. |
mturner5 | 0:b7116bd48af6 | 4125 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4126 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
mturner5 | 0:b7116bd48af6 | 4127 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize-1. |
mturner5 | 0:b7116bd48af6 | 4128 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4129 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4130 | */ |
mturner5 | 0:b7116bd48af6 | 4131 | |
mturner5 | 0:b7116bd48af6 | 4132 | void arm_iir_lattice_init_f32( |
mturner5 | 0:b7116bd48af6 | 4133 | arm_iir_lattice_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4134 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 4135 | float32_t * pkCoeffs, |
mturner5 | 0:b7116bd48af6 | 4136 | float32_t * pvCoeffs, |
mturner5 | 0:b7116bd48af6 | 4137 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 4138 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4139 | |
mturner5 | 0:b7116bd48af6 | 4140 | |
mturner5 | 0:b7116bd48af6 | 4141 | /** |
mturner5 | 0:b7116bd48af6 | 4142 | * @brief Processing function for the Q31 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4143 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4144 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4145 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4146 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4147 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4148 | */ |
mturner5 | 0:b7116bd48af6 | 4149 | |
mturner5 | 0:b7116bd48af6 | 4150 | void arm_iir_lattice_q31( |
mturner5 | 0:b7116bd48af6 | 4151 | const arm_iir_lattice_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4152 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4153 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4154 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4155 | |
mturner5 | 0:b7116bd48af6 | 4156 | |
mturner5 | 0:b7116bd48af6 | 4157 | /** |
mturner5 | 0:b7116bd48af6 | 4158 | * @brief Initialization function for the Q31 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4159 | * @param[in] *S points to an instance of the Q31 IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4160 | * @param[in] numStages number of stages in the filter. |
mturner5 | 0:b7116bd48af6 | 4161 | * @param[in] *pkCoeffs points to the reflection coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4162 | * @param[in] *pvCoeffs points to the ladder coefficient buffer. The array is of length numStages+1. |
mturner5 | 0:b7116bd48af6 | 4163 | * @param[in] *pState points to the state buffer. The array is of length numStages+blockSize. |
mturner5 | 0:b7116bd48af6 | 4164 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4165 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4166 | */ |
mturner5 | 0:b7116bd48af6 | 4167 | |
mturner5 | 0:b7116bd48af6 | 4168 | void arm_iir_lattice_init_q31( |
mturner5 | 0:b7116bd48af6 | 4169 | arm_iir_lattice_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4170 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 4171 | q31_t * pkCoeffs, |
mturner5 | 0:b7116bd48af6 | 4172 | q31_t * pvCoeffs, |
mturner5 | 0:b7116bd48af6 | 4173 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 4174 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4175 | |
mturner5 | 0:b7116bd48af6 | 4176 | |
mturner5 | 0:b7116bd48af6 | 4177 | /** |
mturner5 | 0:b7116bd48af6 | 4178 | * @brief Processing function for the Q15 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4179 | * @param[in] *S points to an instance of the Q15 IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4180 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4181 | * @param[out] *pDst points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4182 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4183 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4184 | */ |
mturner5 | 0:b7116bd48af6 | 4185 | |
mturner5 | 0:b7116bd48af6 | 4186 | void arm_iir_lattice_q15( |
mturner5 | 0:b7116bd48af6 | 4187 | const arm_iir_lattice_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4188 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4189 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4190 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4191 | |
mturner5 | 0:b7116bd48af6 | 4192 | |
mturner5 | 0:b7116bd48af6 | 4193 | /** |
mturner5 | 0:b7116bd48af6 | 4194 | * @brief Initialization function for the Q15 IIR lattice filter. |
mturner5 | 0:b7116bd48af6 | 4195 | * @param[in] *S points to an instance of the fixed-point Q15 IIR lattice structure. |
mturner5 | 0:b7116bd48af6 | 4196 | * @param[in] numStages number of stages in the filter. |
mturner5 | 0:b7116bd48af6 | 4197 | * @param[in] *pkCoeffs points to reflection coefficient buffer. The array is of length numStages. |
mturner5 | 0:b7116bd48af6 | 4198 | * @param[in] *pvCoeffs points to ladder coefficient buffer. The array is of length numStages+1. |
mturner5 | 0:b7116bd48af6 | 4199 | * @param[in] *pState points to state buffer. The array is of length numStages+blockSize. |
mturner5 | 0:b7116bd48af6 | 4200 | * @param[in] blockSize number of samples to process per call. |
mturner5 | 0:b7116bd48af6 | 4201 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4202 | */ |
mturner5 | 0:b7116bd48af6 | 4203 | |
mturner5 | 0:b7116bd48af6 | 4204 | void arm_iir_lattice_init_q15( |
mturner5 | 0:b7116bd48af6 | 4205 | arm_iir_lattice_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4206 | uint16_t numStages, |
mturner5 | 0:b7116bd48af6 | 4207 | q15_t * pkCoeffs, |
mturner5 | 0:b7116bd48af6 | 4208 | q15_t * pvCoeffs, |
mturner5 | 0:b7116bd48af6 | 4209 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 4210 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4211 | |
mturner5 | 0:b7116bd48af6 | 4212 | /** |
mturner5 | 0:b7116bd48af6 | 4213 | * @brief Instance structure for the floating-point LMS filter. |
mturner5 | 0:b7116bd48af6 | 4214 | */ |
mturner5 | 0:b7116bd48af6 | 4215 | |
mturner5 | 0:b7116bd48af6 | 4216 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4217 | { |
mturner5 | 0:b7116bd48af6 | 4218 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4219 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4220 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4221 | float32_t mu; /**< step size that controls filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4222 | } arm_lms_instance_f32; |
mturner5 | 0:b7116bd48af6 | 4223 | |
mturner5 | 0:b7116bd48af6 | 4224 | /** |
mturner5 | 0:b7116bd48af6 | 4225 | * @brief Processing function for floating-point LMS filter. |
mturner5 | 0:b7116bd48af6 | 4226 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4227 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4228 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4229 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4230 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4231 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4232 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4233 | */ |
mturner5 | 0:b7116bd48af6 | 4234 | |
mturner5 | 0:b7116bd48af6 | 4235 | void arm_lms_f32( |
mturner5 | 0:b7116bd48af6 | 4236 | const arm_lms_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4237 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4238 | float32_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4239 | float32_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4240 | float32_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4241 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4242 | |
mturner5 | 0:b7116bd48af6 | 4243 | /** |
mturner5 | 0:b7116bd48af6 | 4244 | * @brief Initialization function for floating-point LMS filter. |
mturner5 | 0:b7116bd48af6 | 4245 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4246 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4247 | * @param[in] *pCoeffs points to the coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4248 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 4249 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4250 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4251 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4252 | */ |
mturner5 | 0:b7116bd48af6 | 4253 | |
mturner5 | 0:b7116bd48af6 | 4254 | void arm_lms_init_f32( |
mturner5 | 0:b7116bd48af6 | 4255 | arm_lms_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4256 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4257 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4258 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 4259 | float32_t mu, |
mturner5 | 0:b7116bd48af6 | 4260 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4261 | |
mturner5 | 0:b7116bd48af6 | 4262 | /** |
mturner5 | 0:b7116bd48af6 | 4263 | * @brief Instance structure for the Q15 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4264 | */ |
mturner5 | 0:b7116bd48af6 | 4265 | |
mturner5 | 0:b7116bd48af6 | 4266 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4267 | { |
mturner5 | 0:b7116bd48af6 | 4268 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4269 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4270 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4271 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4272 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
mturner5 | 0:b7116bd48af6 | 4273 | } arm_lms_instance_q15; |
mturner5 | 0:b7116bd48af6 | 4274 | |
mturner5 | 0:b7116bd48af6 | 4275 | |
mturner5 | 0:b7116bd48af6 | 4276 | /** |
mturner5 | 0:b7116bd48af6 | 4277 | * @brief Initialization function for the Q15 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4278 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4279 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4280 | * @param[in] *pCoeffs points to the coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4281 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 4282 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4283 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4284 | * @param[in] postShift bit shift applied to coefficients. |
mturner5 | 0:b7116bd48af6 | 4285 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4286 | */ |
mturner5 | 0:b7116bd48af6 | 4287 | |
mturner5 | 0:b7116bd48af6 | 4288 | void arm_lms_init_q15( |
mturner5 | 0:b7116bd48af6 | 4289 | arm_lms_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4290 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4291 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4292 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 4293 | q15_t mu, |
mturner5 | 0:b7116bd48af6 | 4294 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 4295 | uint32_t postShift); |
mturner5 | 0:b7116bd48af6 | 4296 | |
mturner5 | 0:b7116bd48af6 | 4297 | /** |
mturner5 | 0:b7116bd48af6 | 4298 | * @brief Processing function for Q15 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4299 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4300 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4301 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4302 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4303 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4304 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4305 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4306 | */ |
mturner5 | 0:b7116bd48af6 | 4307 | |
mturner5 | 0:b7116bd48af6 | 4308 | void arm_lms_q15( |
mturner5 | 0:b7116bd48af6 | 4309 | const arm_lms_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4310 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4311 | q15_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4312 | q15_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4313 | q15_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4314 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4315 | |
mturner5 | 0:b7116bd48af6 | 4316 | |
mturner5 | 0:b7116bd48af6 | 4317 | /** |
mturner5 | 0:b7116bd48af6 | 4318 | * @brief Instance structure for the Q31 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4319 | */ |
mturner5 | 0:b7116bd48af6 | 4320 | |
mturner5 | 0:b7116bd48af6 | 4321 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4322 | { |
mturner5 | 0:b7116bd48af6 | 4323 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4324 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4325 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4326 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4327 | uint32_t postShift; /**< bit shift applied to coefficients. */ |
mturner5 | 0:b7116bd48af6 | 4328 | |
mturner5 | 0:b7116bd48af6 | 4329 | } arm_lms_instance_q31; |
mturner5 | 0:b7116bd48af6 | 4330 | |
mturner5 | 0:b7116bd48af6 | 4331 | /** |
mturner5 | 0:b7116bd48af6 | 4332 | * @brief Processing function for Q31 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4333 | * @param[in] *S points to an instance of the Q15 LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4334 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4335 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4336 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4337 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4338 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4339 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4340 | */ |
mturner5 | 0:b7116bd48af6 | 4341 | |
mturner5 | 0:b7116bd48af6 | 4342 | void arm_lms_q31( |
mturner5 | 0:b7116bd48af6 | 4343 | const arm_lms_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4344 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4345 | q31_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4346 | q31_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4347 | q31_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4348 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4349 | |
mturner5 | 0:b7116bd48af6 | 4350 | /** |
mturner5 | 0:b7116bd48af6 | 4351 | * @brief Initialization function for Q31 LMS filter. |
mturner5 | 0:b7116bd48af6 | 4352 | * @param[in] *S points to an instance of the Q31 LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4353 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4354 | * @param[in] *pCoeffs points to coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4355 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 4356 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4357 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4358 | * @param[in] postShift bit shift applied to coefficients. |
mturner5 | 0:b7116bd48af6 | 4359 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4360 | */ |
mturner5 | 0:b7116bd48af6 | 4361 | |
mturner5 | 0:b7116bd48af6 | 4362 | void arm_lms_init_q31( |
mturner5 | 0:b7116bd48af6 | 4363 | arm_lms_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4364 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4365 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4366 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 4367 | q31_t mu, |
mturner5 | 0:b7116bd48af6 | 4368 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 4369 | uint32_t postShift); |
mturner5 | 0:b7116bd48af6 | 4370 | |
mturner5 | 0:b7116bd48af6 | 4371 | /** |
mturner5 | 0:b7116bd48af6 | 4372 | * @brief Instance structure for the floating-point normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4373 | */ |
mturner5 | 0:b7116bd48af6 | 4374 | |
mturner5 | 0:b7116bd48af6 | 4375 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4376 | { |
mturner5 | 0:b7116bd48af6 | 4377 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4378 | float32_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4379 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4380 | float32_t mu; /**< step size that control filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4381 | float32_t energy; /**< saves previous frame energy. */ |
mturner5 | 0:b7116bd48af6 | 4382 | float32_t x0; /**< saves previous input sample. */ |
mturner5 | 0:b7116bd48af6 | 4383 | } arm_lms_norm_instance_f32; |
mturner5 | 0:b7116bd48af6 | 4384 | |
mturner5 | 0:b7116bd48af6 | 4385 | /** |
mturner5 | 0:b7116bd48af6 | 4386 | * @brief Processing function for floating-point normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4387 | * @param[in] *S points to an instance of the floating-point normalized LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4388 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4389 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4390 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4391 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4392 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4393 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4394 | */ |
mturner5 | 0:b7116bd48af6 | 4395 | |
mturner5 | 0:b7116bd48af6 | 4396 | void arm_lms_norm_f32( |
mturner5 | 0:b7116bd48af6 | 4397 | arm_lms_norm_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4398 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4399 | float32_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4400 | float32_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4401 | float32_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4402 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4403 | |
mturner5 | 0:b7116bd48af6 | 4404 | /** |
mturner5 | 0:b7116bd48af6 | 4405 | * @brief Initialization function for floating-point normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4406 | * @param[in] *S points to an instance of the floating-point LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4407 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4408 | * @param[in] *pCoeffs points to coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4409 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 4410 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4411 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4412 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4413 | */ |
mturner5 | 0:b7116bd48af6 | 4414 | |
mturner5 | 0:b7116bd48af6 | 4415 | void arm_lms_norm_init_f32( |
mturner5 | 0:b7116bd48af6 | 4416 | arm_lms_norm_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4417 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4418 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4419 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 4420 | float32_t mu, |
mturner5 | 0:b7116bd48af6 | 4421 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4422 | |
mturner5 | 0:b7116bd48af6 | 4423 | |
mturner5 | 0:b7116bd48af6 | 4424 | /** |
mturner5 | 0:b7116bd48af6 | 4425 | * @brief Instance structure for the Q31 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4426 | */ |
mturner5 | 0:b7116bd48af6 | 4427 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4428 | { |
mturner5 | 0:b7116bd48af6 | 4429 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4430 | q31_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4431 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4432 | q31_t mu; /**< step size that controls filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4433 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
mturner5 | 0:b7116bd48af6 | 4434 | q31_t *recipTable; /**< points to the reciprocal initial value table. */ |
mturner5 | 0:b7116bd48af6 | 4435 | q31_t energy; /**< saves previous frame energy. */ |
mturner5 | 0:b7116bd48af6 | 4436 | q31_t x0; /**< saves previous input sample. */ |
mturner5 | 0:b7116bd48af6 | 4437 | } arm_lms_norm_instance_q31; |
mturner5 | 0:b7116bd48af6 | 4438 | |
mturner5 | 0:b7116bd48af6 | 4439 | /** |
mturner5 | 0:b7116bd48af6 | 4440 | * @brief Processing function for Q31 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4441 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4442 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4443 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4444 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4445 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4446 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4447 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4448 | */ |
mturner5 | 0:b7116bd48af6 | 4449 | |
mturner5 | 0:b7116bd48af6 | 4450 | void arm_lms_norm_q31( |
mturner5 | 0:b7116bd48af6 | 4451 | arm_lms_norm_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4452 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4453 | q31_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4454 | q31_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4455 | q31_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4456 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4457 | |
mturner5 | 0:b7116bd48af6 | 4458 | /** |
mturner5 | 0:b7116bd48af6 | 4459 | * @brief Initialization function for Q31 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4460 | * @param[in] *S points to an instance of the Q31 normalized LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4461 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4462 | * @param[in] *pCoeffs points to coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4463 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 4464 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4465 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4466 | * @param[in] postShift bit shift applied to coefficients. |
mturner5 | 0:b7116bd48af6 | 4467 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4468 | */ |
mturner5 | 0:b7116bd48af6 | 4469 | |
mturner5 | 0:b7116bd48af6 | 4470 | void arm_lms_norm_init_q31( |
mturner5 | 0:b7116bd48af6 | 4471 | arm_lms_norm_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4472 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4473 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4474 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 4475 | q31_t mu, |
mturner5 | 0:b7116bd48af6 | 4476 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 4477 | uint8_t postShift); |
mturner5 | 0:b7116bd48af6 | 4478 | |
mturner5 | 0:b7116bd48af6 | 4479 | /** |
mturner5 | 0:b7116bd48af6 | 4480 | * @brief Instance structure for the Q15 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4481 | */ |
mturner5 | 0:b7116bd48af6 | 4482 | |
mturner5 | 0:b7116bd48af6 | 4483 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4484 | { |
mturner5 | 0:b7116bd48af6 | 4485 | uint16_t numTaps; /**< Number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4486 | q15_t *pState; /**< points to the state variable array. The array is of length numTaps+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4487 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4488 | q15_t mu; /**< step size that controls filter coefficient updates. */ |
mturner5 | 0:b7116bd48af6 | 4489 | uint8_t postShift; /**< bit shift applied to coefficients. */ |
mturner5 | 0:b7116bd48af6 | 4490 | q15_t *recipTable; /**< Points to the reciprocal initial value table. */ |
mturner5 | 0:b7116bd48af6 | 4491 | q15_t energy; /**< saves previous frame energy. */ |
mturner5 | 0:b7116bd48af6 | 4492 | q15_t x0; /**< saves previous input sample. */ |
mturner5 | 0:b7116bd48af6 | 4493 | } arm_lms_norm_instance_q15; |
mturner5 | 0:b7116bd48af6 | 4494 | |
mturner5 | 0:b7116bd48af6 | 4495 | /** |
mturner5 | 0:b7116bd48af6 | 4496 | * @brief Processing function for Q15 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4497 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4498 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4499 | * @param[in] *pRef points to the block of reference data. |
mturner5 | 0:b7116bd48af6 | 4500 | * @param[out] *pOut points to the block of output data. |
mturner5 | 0:b7116bd48af6 | 4501 | * @param[out] *pErr points to the block of error data. |
mturner5 | 0:b7116bd48af6 | 4502 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4503 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4504 | */ |
mturner5 | 0:b7116bd48af6 | 4505 | |
mturner5 | 0:b7116bd48af6 | 4506 | void arm_lms_norm_q15( |
mturner5 | 0:b7116bd48af6 | 4507 | arm_lms_norm_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4508 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4509 | q15_t * pRef, |
mturner5 | 0:b7116bd48af6 | 4510 | q15_t * pOut, |
mturner5 | 0:b7116bd48af6 | 4511 | q15_t * pErr, |
mturner5 | 0:b7116bd48af6 | 4512 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4513 | |
mturner5 | 0:b7116bd48af6 | 4514 | |
mturner5 | 0:b7116bd48af6 | 4515 | /** |
mturner5 | 0:b7116bd48af6 | 4516 | * @brief Initialization function for Q15 normalized LMS filter. |
mturner5 | 0:b7116bd48af6 | 4517 | * @param[in] *S points to an instance of the Q15 normalized LMS filter structure. |
mturner5 | 0:b7116bd48af6 | 4518 | * @param[in] numTaps number of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4519 | * @param[in] *pCoeffs points to coefficient buffer. |
mturner5 | 0:b7116bd48af6 | 4520 | * @param[in] *pState points to state buffer. |
mturner5 | 0:b7116bd48af6 | 4521 | * @param[in] mu step size that controls filter coefficient updates. |
mturner5 | 0:b7116bd48af6 | 4522 | * @param[in] blockSize number of samples to process. |
mturner5 | 0:b7116bd48af6 | 4523 | * @param[in] postShift bit shift applied to coefficients. |
mturner5 | 0:b7116bd48af6 | 4524 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4525 | */ |
mturner5 | 0:b7116bd48af6 | 4526 | |
mturner5 | 0:b7116bd48af6 | 4527 | void arm_lms_norm_init_q15( |
mturner5 | 0:b7116bd48af6 | 4528 | arm_lms_norm_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4529 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4530 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4531 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 4532 | q15_t mu, |
mturner5 | 0:b7116bd48af6 | 4533 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 4534 | uint8_t postShift); |
mturner5 | 0:b7116bd48af6 | 4535 | |
mturner5 | 0:b7116bd48af6 | 4536 | /** |
mturner5 | 0:b7116bd48af6 | 4537 | * @brief Correlation of floating-point sequences. |
mturner5 | 0:b7116bd48af6 | 4538 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4539 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4540 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4541 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4542 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4543 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4544 | */ |
mturner5 | 0:b7116bd48af6 | 4545 | |
mturner5 | 0:b7116bd48af6 | 4546 | void arm_correlate_f32( |
mturner5 | 0:b7116bd48af6 | 4547 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4548 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4549 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4550 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4551 | float32_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4552 | |
mturner5 | 0:b7116bd48af6 | 4553 | |
mturner5 | 0:b7116bd48af6 | 4554 | /** |
mturner5 | 0:b7116bd48af6 | 4555 | * @brief Correlation of Q15 sequences |
mturner5 | 0:b7116bd48af6 | 4556 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4557 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4558 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4559 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4560 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4561 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 4562 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4563 | */ |
mturner5 | 0:b7116bd48af6 | 4564 | void arm_correlate_opt_q15( |
mturner5 | 0:b7116bd48af6 | 4565 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4566 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4567 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4568 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4569 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4570 | q15_t * pScratch); |
mturner5 | 0:b7116bd48af6 | 4571 | |
mturner5 | 0:b7116bd48af6 | 4572 | |
mturner5 | 0:b7116bd48af6 | 4573 | /** |
mturner5 | 0:b7116bd48af6 | 4574 | * @brief Correlation of Q15 sequences. |
mturner5 | 0:b7116bd48af6 | 4575 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4576 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4577 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4578 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4579 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4580 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4581 | */ |
mturner5 | 0:b7116bd48af6 | 4582 | |
mturner5 | 0:b7116bd48af6 | 4583 | void arm_correlate_q15( |
mturner5 | 0:b7116bd48af6 | 4584 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4585 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4586 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4587 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4588 | q15_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4589 | |
mturner5 | 0:b7116bd48af6 | 4590 | /** |
mturner5 | 0:b7116bd48af6 | 4591 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 4592 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4593 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4594 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4595 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4596 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4597 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4598 | */ |
mturner5 | 0:b7116bd48af6 | 4599 | |
mturner5 | 0:b7116bd48af6 | 4600 | void arm_correlate_fast_q15( |
mturner5 | 0:b7116bd48af6 | 4601 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4602 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4603 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4604 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4605 | q15_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4606 | |
mturner5 | 0:b7116bd48af6 | 4607 | |
mturner5 | 0:b7116bd48af6 | 4608 | |
mturner5 | 0:b7116bd48af6 | 4609 | /** |
mturner5 | 0:b7116bd48af6 | 4610 | * @brief Correlation of Q15 sequences (fast version) for Cortex-M3 and Cortex-M4. |
mturner5 | 0:b7116bd48af6 | 4611 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4612 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4613 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4614 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4615 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4616 | * @param[in] *pScratch points to scratch buffer of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 4617 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4618 | */ |
mturner5 | 0:b7116bd48af6 | 4619 | |
mturner5 | 0:b7116bd48af6 | 4620 | void arm_correlate_fast_opt_q15( |
mturner5 | 0:b7116bd48af6 | 4621 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4622 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4623 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4624 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4625 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4626 | q15_t * pScratch); |
mturner5 | 0:b7116bd48af6 | 4627 | |
mturner5 | 0:b7116bd48af6 | 4628 | /** |
mturner5 | 0:b7116bd48af6 | 4629 | * @brief Correlation of Q31 sequences. |
mturner5 | 0:b7116bd48af6 | 4630 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4631 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4632 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4633 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4634 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4635 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4636 | */ |
mturner5 | 0:b7116bd48af6 | 4637 | |
mturner5 | 0:b7116bd48af6 | 4638 | void arm_correlate_q31( |
mturner5 | 0:b7116bd48af6 | 4639 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4640 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4641 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4642 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4643 | q31_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4644 | |
mturner5 | 0:b7116bd48af6 | 4645 | /** |
mturner5 | 0:b7116bd48af6 | 4646 | * @brief Correlation of Q31 sequences (fast version) for Cortex-M3 and Cortex-M4 |
mturner5 | 0:b7116bd48af6 | 4647 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4648 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4649 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4650 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4651 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4652 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4653 | */ |
mturner5 | 0:b7116bd48af6 | 4654 | |
mturner5 | 0:b7116bd48af6 | 4655 | void arm_correlate_fast_q31( |
mturner5 | 0:b7116bd48af6 | 4656 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4657 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4658 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4659 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4660 | q31_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4661 | |
mturner5 | 0:b7116bd48af6 | 4662 | |
mturner5 | 0:b7116bd48af6 | 4663 | |
mturner5 | 0:b7116bd48af6 | 4664 | /** |
mturner5 | 0:b7116bd48af6 | 4665 | * @brief Correlation of Q7 sequences. |
mturner5 | 0:b7116bd48af6 | 4666 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4667 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4668 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4669 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4670 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4671 | * @param[in] *pScratch1 points to scratch buffer(of type q15_t) of size max(srcALen, srcBLen) + 2*min(srcALen, srcBLen) - 2. |
mturner5 | 0:b7116bd48af6 | 4672 | * @param[in] *pScratch2 points to scratch buffer (of type q15_t) of size min(srcALen, srcBLen). |
mturner5 | 0:b7116bd48af6 | 4673 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4674 | */ |
mturner5 | 0:b7116bd48af6 | 4675 | |
mturner5 | 0:b7116bd48af6 | 4676 | void arm_correlate_opt_q7( |
mturner5 | 0:b7116bd48af6 | 4677 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4678 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4679 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4680 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4681 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4682 | q15_t * pScratch1, |
mturner5 | 0:b7116bd48af6 | 4683 | q15_t * pScratch2); |
mturner5 | 0:b7116bd48af6 | 4684 | |
mturner5 | 0:b7116bd48af6 | 4685 | |
mturner5 | 0:b7116bd48af6 | 4686 | /** |
mturner5 | 0:b7116bd48af6 | 4687 | * @brief Correlation of Q7 sequences. |
mturner5 | 0:b7116bd48af6 | 4688 | * @param[in] *pSrcA points to the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4689 | * @param[in] srcALen length of the first input sequence. |
mturner5 | 0:b7116bd48af6 | 4690 | * @param[in] *pSrcB points to the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4691 | * @param[in] srcBLen length of the second input sequence. |
mturner5 | 0:b7116bd48af6 | 4692 | * @param[out] *pDst points to the block of output data Length 2 * max(srcALen, srcBLen) - 1. |
mturner5 | 0:b7116bd48af6 | 4693 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4694 | */ |
mturner5 | 0:b7116bd48af6 | 4695 | |
mturner5 | 0:b7116bd48af6 | 4696 | void arm_correlate_q7( |
mturner5 | 0:b7116bd48af6 | 4697 | q7_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 4698 | uint32_t srcALen, |
mturner5 | 0:b7116bd48af6 | 4699 | q7_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 4700 | uint32_t srcBLen, |
mturner5 | 0:b7116bd48af6 | 4701 | q7_t * pDst); |
mturner5 | 0:b7116bd48af6 | 4702 | |
mturner5 | 0:b7116bd48af6 | 4703 | |
mturner5 | 0:b7116bd48af6 | 4704 | /** |
mturner5 | 0:b7116bd48af6 | 4705 | * @brief Instance structure for the floating-point sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4706 | */ |
mturner5 | 0:b7116bd48af6 | 4707 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4708 | { |
mturner5 | 0:b7116bd48af6 | 4709 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4710 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
mturner5 | 0:b7116bd48af6 | 4711 | float32_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4712 | float32_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 4713 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
mturner5 | 0:b7116bd48af6 | 4714 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4715 | } arm_fir_sparse_instance_f32; |
mturner5 | 0:b7116bd48af6 | 4716 | |
mturner5 | 0:b7116bd48af6 | 4717 | /** |
mturner5 | 0:b7116bd48af6 | 4718 | * @brief Instance structure for the Q31 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4719 | */ |
mturner5 | 0:b7116bd48af6 | 4720 | |
mturner5 | 0:b7116bd48af6 | 4721 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4722 | { |
mturner5 | 0:b7116bd48af6 | 4723 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4724 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
mturner5 | 0:b7116bd48af6 | 4725 | q31_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4726 | q31_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 4727 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
mturner5 | 0:b7116bd48af6 | 4728 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4729 | } arm_fir_sparse_instance_q31; |
mturner5 | 0:b7116bd48af6 | 4730 | |
mturner5 | 0:b7116bd48af6 | 4731 | /** |
mturner5 | 0:b7116bd48af6 | 4732 | * @brief Instance structure for the Q15 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4733 | */ |
mturner5 | 0:b7116bd48af6 | 4734 | |
mturner5 | 0:b7116bd48af6 | 4735 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4736 | { |
mturner5 | 0:b7116bd48af6 | 4737 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4738 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
mturner5 | 0:b7116bd48af6 | 4739 | q15_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4740 | q15_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 4741 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
mturner5 | 0:b7116bd48af6 | 4742 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4743 | } arm_fir_sparse_instance_q15; |
mturner5 | 0:b7116bd48af6 | 4744 | |
mturner5 | 0:b7116bd48af6 | 4745 | /** |
mturner5 | 0:b7116bd48af6 | 4746 | * @brief Instance structure for the Q7 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4747 | */ |
mturner5 | 0:b7116bd48af6 | 4748 | |
mturner5 | 0:b7116bd48af6 | 4749 | typedef struct |
mturner5 | 0:b7116bd48af6 | 4750 | { |
mturner5 | 0:b7116bd48af6 | 4751 | uint16_t numTaps; /**< number of coefficients in the filter. */ |
mturner5 | 0:b7116bd48af6 | 4752 | uint16_t stateIndex; /**< state buffer index. Points to the oldest sample in the state buffer. */ |
mturner5 | 0:b7116bd48af6 | 4753 | q7_t *pState; /**< points to the state buffer array. The array is of length maxDelay+blockSize-1. */ |
mturner5 | 0:b7116bd48af6 | 4754 | q7_t *pCoeffs; /**< points to the coefficient array. The array is of length numTaps.*/ |
mturner5 | 0:b7116bd48af6 | 4755 | uint16_t maxDelay; /**< maximum offset specified by the pTapDelay array. */ |
mturner5 | 0:b7116bd48af6 | 4756 | int32_t *pTapDelay; /**< points to the array of delay values. The array is of length numTaps. */ |
mturner5 | 0:b7116bd48af6 | 4757 | } arm_fir_sparse_instance_q7; |
mturner5 | 0:b7116bd48af6 | 4758 | |
mturner5 | 0:b7116bd48af6 | 4759 | /** |
mturner5 | 0:b7116bd48af6 | 4760 | * @brief Processing function for the floating-point sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4761 | * @param[in] *S points to an instance of the floating-point sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4762 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4763 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4764 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4765 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 4766 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4767 | */ |
mturner5 | 0:b7116bd48af6 | 4768 | |
mturner5 | 0:b7116bd48af6 | 4769 | void arm_fir_sparse_f32( |
mturner5 | 0:b7116bd48af6 | 4770 | arm_fir_sparse_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4771 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4772 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4773 | float32_t * pScratchIn, |
mturner5 | 0:b7116bd48af6 | 4774 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4775 | |
mturner5 | 0:b7116bd48af6 | 4776 | /** |
mturner5 | 0:b7116bd48af6 | 4777 | * @brief Initialization function for the floating-point sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4778 | * @param[in,out] *S points to an instance of the floating-point sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4779 | * @param[in] numTaps number of nonzero coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 4780 | * @param[in] *pCoeffs points to the array of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4781 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 4782 | * @param[in] *pTapDelay points to the array of offset times. |
mturner5 | 0:b7116bd48af6 | 4783 | * @param[in] maxDelay maximum offset time supported. |
mturner5 | 0:b7116bd48af6 | 4784 | * @param[in] blockSize number of samples that will be processed per block. |
mturner5 | 0:b7116bd48af6 | 4785 | * @return none |
mturner5 | 0:b7116bd48af6 | 4786 | */ |
mturner5 | 0:b7116bd48af6 | 4787 | |
mturner5 | 0:b7116bd48af6 | 4788 | void arm_fir_sparse_init_f32( |
mturner5 | 0:b7116bd48af6 | 4789 | arm_fir_sparse_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 4790 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4791 | float32_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4792 | float32_t * pState, |
mturner5 | 0:b7116bd48af6 | 4793 | int32_t * pTapDelay, |
mturner5 | 0:b7116bd48af6 | 4794 | uint16_t maxDelay, |
mturner5 | 0:b7116bd48af6 | 4795 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4796 | |
mturner5 | 0:b7116bd48af6 | 4797 | /** |
mturner5 | 0:b7116bd48af6 | 4798 | * @brief Processing function for the Q31 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4799 | * @param[in] *S points to an instance of the Q31 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4800 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4801 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4802 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4803 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 4804 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4805 | */ |
mturner5 | 0:b7116bd48af6 | 4806 | |
mturner5 | 0:b7116bd48af6 | 4807 | void arm_fir_sparse_q31( |
mturner5 | 0:b7116bd48af6 | 4808 | arm_fir_sparse_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4809 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4810 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4811 | q31_t * pScratchIn, |
mturner5 | 0:b7116bd48af6 | 4812 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4813 | |
mturner5 | 0:b7116bd48af6 | 4814 | /** |
mturner5 | 0:b7116bd48af6 | 4815 | * @brief Initialization function for the Q31 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4816 | * @param[in,out] *S points to an instance of the Q31 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4817 | * @param[in] numTaps number of nonzero coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 4818 | * @param[in] *pCoeffs points to the array of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4819 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 4820 | * @param[in] *pTapDelay points to the array of offset times. |
mturner5 | 0:b7116bd48af6 | 4821 | * @param[in] maxDelay maximum offset time supported. |
mturner5 | 0:b7116bd48af6 | 4822 | * @param[in] blockSize number of samples that will be processed per block. |
mturner5 | 0:b7116bd48af6 | 4823 | * @return none |
mturner5 | 0:b7116bd48af6 | 4824 | */ |
mturner5 | 0:b7116bd48af6 | 4825 | |
mturner5 | 0:b7116bd48af6 | 4826 | void arm_fir_sparse_init_q31( |
mturner5 | 0:b7116bd48af6 | 4827 | arm_fir_sparse_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 4828 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4829 | q31_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4830 | q31_t * pState, |
mturner5 | 0:b7116bd48af6 | 4831 | int32_t * pTapDelay, |
mturner5 | 0:b7116bd48af6 | 4832 | uint16_t maxDelay, |
mturner5 | 0:b7116bd48af6 | 4833 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4834 | |
mturner5 | 0:b7116bd48af6 | 4835 | /** |
mturner5 | 0:b7116bd48af6 | 4836 | * @brief Processing function for the Q15 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4837 | * @param[in] *S points to an instance of the Q15 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4838 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4839 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4840 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4841 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4842 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 4843 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4844 | */ |
mturner5 | 0:b7116bd48af6 | 4845 | |
mturner5 | 0:b7116bd48af6 | 4846 | void arm_fir_sparse_q15( |
mturner5 | 0:b7116bd48af6 | 4847 | arm_fir_sparse_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4848 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4849 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4850 | q15_t * pScratchIn, |
mturner5 | 0:b7116bd48af6 | 4851 | q31_t * pScratchOut, |
mturner5 | 0:b7116bd48af6 | 4852 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4853 | |
mturner5 | 0:b7116bd48af6 | 4854 | |
mturner5 | 0:b7116bd48af6 | 4855 | /** |
mturner5 | 0:b7116bd48af6 | 4856 | * @brief Initialization function for the Q15 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4857 | * @param[in,out] *S points to an instance of the Q15 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4858 | * @param[in] numTaps number of nonzero coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 4859 | * @param[in] *pCoeffs points to the array of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4860 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 4861 | * @param[in] *pTapDelay points to the array of offset times. |
mturner5 | 0:b7116bd48af6 | 4862 | * @param[in] maxDelay maximum offset time supported. |
mturner5 | 0:b7116bd48af6 | 4863 | * @param[in] blockSize number of samples that will be processed per block. |
mturner5 | 0:b7116bd48af6 | 4864 | * @return none |
mturner5 | 0:b7116bd48af6 | 4865 | */ |
mturner5 | 0:b7116bd48af6 | 4866 | |
mturner5 | 0:b7116bd48af6 | 4867 | void arm_fir_sparse_init_q15( |
mturner5 | 0:b7116bd48af6 | 4868 | arm_fir_sparse_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 4869 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4870 | q15_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4871 | q15_t * pState, |
mturner5 | 0:b7116bd48af6 | 4872 | int32_t * pTapDelay, |
mturner5 | 0:b7116bd48af6 | 4873 | uint16_t maxDelay, |
mturner5 | 0:b7116bd48af6 | 4874 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4875 | |
mturner5 | 0:b7116bd48af6 | 4876 | /** |
mturner5 | 0:b7116bd48af6 | 4877 | * @brief Processing function for the Q7 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4878 | * @param[in] *S points to an instance of the Q7 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4879 | * @param[in] *pSrc points to the block of input data. |
mturner5 | 0:b7116bd48af6 | 4880 | * @param[out] *pDst points to the block of output data |
mturner5 | 0:b7116bd48af6 | 4881 | * @param[in] *pScratchIn points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4882 | * @param[in] *pScratchOut points to a temporary buffer of size blockSize. |
mturner5 | 0:b7116bd48af6 | 4883 | * @param[in] blockSize number of input samples to process per call. |
mturner5 | 0:b7116bd48af6 | 4884 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4885 | */ |
mturner5 | 0:b7116bd48af6 | 4886 | |
mturner5 | 0:b7116bd48af6 | 4887 | void arm_fir_sparse_q7( |
mturner5 | 0:b7116bd48af6 | 4888 | arm_fir_sparse_instance_q7 * S, |
mturner5 | 0:b7116bd48af6 | 4889 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4890 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4891 | q7_t * pScratchIn, |
mturner5 | 0:b7116bd48af6 | 4892 | q31_t * pScratchOut, |
mturner5 | 0:b7116bd48af6 | 4893 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4894 | |
mturner5 | 0:b7116bd48af6 | 4895 | /** |
mturner5 | 0:b7116bd48af6 | 4896 | * @brief Initialization function for the Q7 sparse FIR filter. |
mturner5 | 0:b7116bd48af6 | 4897 | * @param[in,out] *S points to an instance of the Q7 sparse FIR structure. |
mturner5 | 0:b7116bd48af6 | 4898 | * @param[in] numTaps number of nonzero coefficients in the filter. |
mturner5 | 0:b7116bd48af6 | 4899 | * @param[in] *pCoeffs points to the array of filter coefficients. |
mturner5 | 0:b7116bd48af6 | 4900 | * @param[in] *pState points to the state buffer. |
mturner5 | 0:b7116bd48af6 | 4901 | * @param[in] *pTapDelay points to the array of offset times. |
mturner5 | 0:b7116bd48af6 | 4902 | * @param[in] maxDelay maximum offset time supported. |
mturner5 | 0:b7116bd48af6 | 4903 | * @param[in] blockSize number of samples that will be processed per block. |
mturner5 | 0:b7116bd48af6 | 4904 | * @return none |
mturner5 | 0:b7116bd48af6 | 4905 | */ |
mturner5 | 0:b7116bd48af6 | 4906 | |
mturner5 | 0:b7116bd48af6 | 4907 | void arm_fir_sparse_init_q7( |
mturner5 | 0:b7116bd48af6 | 4908 | arm_fir_sparse_instance_q7 * S, |
mturner5 | 0:b7116bd48af6 | 4909 | uint16_t numTaps, |
mturner5 | 0:b7116bd48af6 | 4910 | q7_t * pCoeffs, |
mturner5 | 0:b7116bd48af6 | 4911 | q7_t * pState, |
mturner5 | 0:b7116bd48af6 | 4912 | int32_t * pTapDelay, |
mturner5 | 0:b7116bd48af6 | 4913 | uint16_t maxDelay, |
mturner5 | 0:b7116bd48af6 | 4914 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 4915 | |
mturner5 | 0:b7116bd48af6 | 4916 | |
mturner5 | 0:b7116bd48af6 | 4917 | /* |
mturner5 | 0:b7116bd48af6 | 4918 | * @brief Floating-point sin_cos function. |
mturner5 | 0:b7116bd48af6 | 4919 | * @param[in] theta input value in degrees |
mturner5 | 0:b7116bd48af6 | 4920 | * @param[out] *pSinVal points to the processed sine output. |
mturner5 | 0:b7116bd48af6 | 4921 | * @param[out] *pCosVal points to the processed cos output. |
mturner5 | 0:b7116bd48af6 | 4922 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4923 | */ |
mturner5 | 0:b7116bd48af6 | 4924 | |
mturner5 | 0:b7116bd48af6 | 4925 | void arm_sin_cos_f32( |
mturner5 | 0:b7116bd48af6 | 4926 | float32_t theta, |
mturner5 | 0:b7116bd48af6 | 4927 | float32_t * pSinVal, |
mturner5 | 0:b7116bd48af6 | 4928 | float32_t * pCcosVal); |
mturner5 | 0:b7116bd48af6 | 4929 | |
mturner5 | 0:b7116bd48af6 | 4930 | /* |
mturner5 | 0:b7116bd48af6 | 4931 | * @brief Q31 sin_cos function. |
mturner5 | 0:b7116bd48af6 | 4932 | * @param[in] theta scaled input value in degrees |
mturner5 | 0:b7116bd48af6 | 4933 | * @param[out] *pSinVal points to the processed sine output. |
mturner5 | 0:b7116bd48af6 | 4934 | * @param[out] *pCosVal points to the processed cosine output. |
mturner5 | 0:b7116bd48af6 | 4935 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4936 | */ |
mturner5 | 0:b7116bd48af6 | 4937 | |
mturner5 | 0:b7116bd48af6 | 4938 | void arm_sin_cos_q31( |
mturner5 | 0:b7116bd48af6 | 4939 | q31_t theta, |
mturner5 | 0:b7116bd48af6 | 4940 | q31_t * pSinVal, |
mturner5 | 0:b7116bd48af6 | 4941 | q31_t * pCosVal); |
mturner5 | 0:b7116bd48af6 | 4942 | |
mturner5 | 0:b7116bd48af6 | 4943 | |
mturner5 | 0:b7116bd48af6 | 4944 | /** |
mturner5 | 0:b7116bd48af6 | 4945 | * @brief Floating-point complex conjugate. |
mturner5 | 0:b7116bd48af6 | 4946 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 4947 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 4948 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 4949 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4950 | */ |
mturner5 | 0:b7116bd48af6 | 4951 | |
mturner5 | 0:b7116bd48af6 | 4952 | void arm_cmplx_conj_f32( |
mturner5 | 0:b7116bd48af6 | 4953 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4954 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4955 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 4956 | |
mturner5 | 0:b7116bd48af6 | 4957 | /** |
mturner5 | 0:b7116bd48af6 | 4958 | * @brief Q31 complex conjugate. |
mturner5 | 0:b7116bd48af6 | 4959 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 4960 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 4961 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 4962 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4963 | */ |
mturner5 | 0:b7116bd48af6 | 4964 | |
mturner5 | 0:b7116bd48af6 | 4965 | void arm_cmplx_conj_q31( |
mturner5 | 0:b7116bd48af6 | 4966 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4967 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4968 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 4969 | |
mturner5 | 0:b7116bd48af6 | 4970 | /** |
mturner5 | 0:b7116bd48af6 | 4971 | * @brief Q15 complex conjugate. |
mturner5 | 0:b7116bd48af6 | 4972 | * @param[in] *pSrc points to the input vector |
mturner5 | 0:b7116bd48af6 | 4973 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 4974 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 4975 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4976 | */ |
mturner5 | 0:b7116bd48af6 | 4977 | |
mturner5 | 0:b7116bd48af6 | 4978 | void arm_cmplx_conj_q15( |
mturner5 | 0:b7116bd48af6 | 4979 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4980 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4981 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 4982 | |
mturner5 | 0:b7116bd48af6 | 4983 | |
mturner5 | 0:b7116bd48af6 | 4984 | |
mturner5 | 0:b7116bd48af6 | 4985 | /** |
mturner5 | 0:b7116bd48af6 | 4986 | * @brief Floating-point complex magnitude squared |
mturner5 | 0:b7116bd48af6 | 4987 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 4988 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 4989 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 4990 | * @return none. |
mturner5 | 0:b7116bd48af6 | 4991 | */ |
mturner5 | 0:b7116bd48af6 | 4992 | |
mturner5 | 0:b7116bd48af6 | 4993 | void arm_cmplx_mag_squared_f32( |
mturner5 | 0:b7116bd48af6 | 4994 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 4995 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 4996 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 4997 | |
mturner5 | 0:b7116bd48af6 | 4998 | /** |
mturner5 | 0:b7116bd48af6 | 4999 | * @brief Q31 complex magnitude squared |
mturner5 | 0:b7116bd48af6 | 5000 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 5001 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 5002 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 5003 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5004 | */ |
mturner5 | 0:b7116bd48af6 | 5005 | |
mturner5 | 0:b7116bd48af6 | 5006 | void arm_cmplx_mag_squared_q31( |
mturner5 | 0:b7116bd48af6 | 5007 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5008 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5009 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 5010 | |
mturner5 | 0:b7116bd48af6 | 5011 | /** |
mturner5 | 0:b7116bd48af6 | 5012 | * @brief Q15 complex magnitude squared |
mturner5 | 0:b7116bd48af6 | 5013 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 5014 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 5015 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 5016 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5017 | */ |
mturner5 | 0:b7116bd48af6 | 5018 | |
mturner5 | 0:b7116bd48af6 | 5019 | void arm_cmplx_mag_squared_q15( |
mturner5 | 0:b7116bd48af6 | 5020 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5021 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5022 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 5023 | |
mturner5 | 0:b7116bd48af6 | 5024 | |
mturner5 | 0:b7116bd48af6 | 5025 | /** |
mturner5 | 0:b7116bd48af6 | 5026 | * @ingroup groupController |
mturner5 | 0:b7116bd48af6 | 5027 | */ |
mturner5 | 0:b7116bd48af6 | 5028 | |
mturner5 | 0:b7116bd48af6 | 5029 | /** |
mturner5 | 0:b7116bd48af6 | 5030 | * @defgroup PID PID Motor Control |
mturner5 | 0:b7116bd48af6 | 5031 | * |
mturner5 | 0:b7116bd48af6 | 5032 | * A Proportional Integral Derivative (PID) controller is a generic feedback control |
mturner5 | 0:b7116bd48af6 | 5033 | * loop mechanism widely used in industrial control systems. |
mturner5 | 0:b7116bd48af6 | 5034 | * A PID controller is the most commonly used type of feedback controller. |
mturner5 | 0:b7116bd48af6 | 5035 | * |
mturner5 | 0:b7116bd48af6 | 5036 | * This set of functions implements (PID) controllers |
mturner5 | 0:b7116bd48af6 | 5037 | * for Q15, Q31, and floating-point data types. The functions operate on a single sample |
mturner5 | 0:b7116bd48af6 | 5038 | * of data and each call to the function returns a single processed value. |
mturner5 | 0:b7116bd48af6 | 5039 | * <code>S</code> points to an instance of the PID control data structure. <code>in</code> |
mturner5 | 0:b7116bd48af6 | 5040 | * is the input sample value. The functions return the output value. |
mturner5 | 0:b7116bd48af6 | 5041 | * |
mturner5 | 0:b7116bd48af6 | 5042 | * \par Algorithm: |
mturner5 | 0:b7116bd48af6 | 5043 | * <pre> |
mturner5 | 0:b7116bd48af6 | 5044 | * y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] |
mturner5 | 0:b7116bd48af6 | 5045 | * A0 = Kp + Ki + Kd |
mturner5 | 0:b7116bd48af6 | 5046 | * A1 = (-Kp ) - (2 * Kd ) |
mturner5 | 0:b7116bd48af6 | 5047 | * A2 = Kd </pre> |
mturner5 | 0:b7116bd48af6 | 5048 | * |
mturner5 | 0:b7116bd48af6 | 5049 | * \par |
mturner5 | 0:b7116bd48af6 | 5050 | * where \c Kp is proportional constant, \c Ki is Integral constant and \c Kd is Derivative constant |
mturner5 | 0:b7116bd48af6 | 5051 | * |
mturner5 | 0:b7116bd48af6 | 5052 | * \par |
mturner5 | 0:b7116bd48af6 | 5053 | * \image html PID.gif "Proportional Integral Derivative Controller" |
mturner5 | 0:b7116bd48af6 | 5054 | * |
mturner5 | 0:b7116bd48af6 | 5055 | * \par |
mturner5 | 0:b7116bd48af6 | 5056 | * The PID controller calculates an "error" value as the difference between |
mturner5 | 0:b7116bd48af6 | 5057 | * the measured output and the reference input. |
mturner5 | 0:b7116bd48af6 | 5058 | * The controller attempts to minimize the error by adjusting the process control inputs. |
mturner5 | 0:b7116bd48af6 | 5059 | * The proportional value determines the reaction to the current error, |
mturner5 | 0:b7116bd48af6 | 5060 | * the integral value determines the reaction based on the sum of recent errors, |
mturner5 | 0:b7116bd48af6 | 5061 | * and the derivative value determines the reaction based on the rate at which the error has been changing. |
mturner5 | 0:b7116bd48af6 | 5062 | * |
mturner5 | 0:b7116bd48af6 | 5063 | * \par Instance Structure |
mturner5 | 0:b7116bd48af6 | 5064 | * The Gains A0, A1, A2 and state variables for a PID controller are stored together in an instance data structure. |
mturner5 | 0:b7116bd48af6 | 5065 | * A separate instance structure must be defined for each PID Controller. |
mturner5 | 0:b7116bd48af6 | 5066 | * There are separate instance structure declarations for each of the 3 supported data types. |
mturner5 | 0:b7116bd48af6 | 5067 | * |
mturner5 | 0:b7116bd48af6 | 5068 | * \par Reset Functions |
mturner5 | 0:b7116bd48af6 | 5069 | * There is also an associated reset function for each data type which clears the state array. |
mturner5 | 0:b7116bd48af6 | 5070 | * |
mturner5 | 0:b7116bd48af6 | 5071 | * \par Initialization Functions |
mturner5 | 0:b7116bd48af6 | 5072 | * There is also an associated initialization function for each data type. |
mturner5 | 0:b7116bd48af6 | 5073 | * The initialization function performs the following operations: |
mturner5 | 0:b7116bd48af6 | 5074 | * - Initializes the Gains A0, A1, A2 from Kp,Ki, Kd gains. |
mturner5 | 0:b7116bd48af6 | 5075 | * - Zeros out the values in the state buffer. |
mturner5 | 0:b7116bd48af6 | 5076 | * |
mturner5 | 0:b7116bd48af6 | 5077 | * \par |
mturner5 | 0:b7116bd48af6 | 5078 | * Instance structure cannot be placed into a const data section and it is recommended to use the initialization function. |
mturner5 | 0:b7116bd48af6 | 5079 | * |
mturner5 | 0:b7116bd48af6 | 5080 | * \par Fixed-Point Behavior |
mturner5 | 0:b7116bd48af6 | 5081 | * Care must be taken when using the fixed-point versions of the PID Controller functions. |
mturner5 | 0:b7116bd48af6 | 5082 | * In particular, the overflow and saturation behavior of the accumulator used in each function must be considered. |
mturner5 | 0:b7116bd48af6 | 5083 | * Refer to the function specific documentation below for usage guidelines. |
mturner5 | 0:b7116bd48af6 | 5084 | */ |
mturner5 | 0:b7116bd48af6 | 5085 | |
mturner5 | 0:b7116bd48af6 | 5086 | /** |
mturner5 | 0:b7116bd48af6 | 5087 | * @addtogroup PID |
mturner5 | 0:b7116bd48af6 | 5088 | * @{ |
mturner5 | 0:b7116bd48af6 | 5089 | */ |
mturner5 | 0:b7116bd48af6 | 5090 | |
mturner5 | 0:b7116bd48af6 | 5091 | /** |
mturner5 | 0:b7116bd48af6 | 5092 | * @brief Process function for the floating-point PID Control. |
mturner5 | 0:b7116bd48af6 | 5093 | * @param[in,out] *S is an instance of the floating-point PID Control structure |
mturner5 | 0:b7116bd48af6 | 5094 | * @param[in] in input sample to process |
mturner5 | 0:b7116bd48af6 | 5095 | * @return out processed output sample. |
mturner5 | 0:b7116bd48af6 | 5096 | */ |
mturner5 | 0:b7116bd48af6 | 5097 | |
mturner5 | 0:b7116bd48af6 | 5098 | |
mturner5 | 0:b7116bd48af6 | 5099 | static __INLINE float32_t arm_pid_f32( |
mturner5 | 0:b7116bd48af6 | 5100 | arm_pid_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 5101 | float32_t in) |
mturner5 | 0:b7116bd48af6 | 5102 | { |
mturner5 | 0:b7116bd48af6 | 5103 | float32_t out; |
mturner5 | 0:b7116bd48af6 | 5104 | |
mturner5 | 0:b7116bd48af6 | 5105 | /* y[n] = y[n-1] + A0 * x[n] + A1 * x[n-1] + A2 * x[n-2] */ |
mturner5 | 0:b7116bd48af6 | 5106 | out = (S->A0 * in) + |
mturner5 | 0:b7116bd48af6 | 5107 | (S->A1 * S->state[0]) + (S->A2 * S->state[1]) + (S->state[2]); |
mturner5 | 0:b7116bd48af6 | 5108 | |
mturner5 | 0:b7116bd48af6 | 5109 | /* Update state */ |
mturner5 | 0:b7116bd48af6 | 5110 | S->state[1] = S->state[0]; |
mturner5 | 0:b7116bd48af6 | 5111 | S->state[0] = in; |
mturner5 | 0:b7116bd48af6 | 5112 | S->state[2] = out; |
mturner5 | 0:b7116bd48af6 | 5113 | |
mturner5 | 0:b7116bd48af6 | 5114 | /* return to application */ |
mturner5 | 0:b7116bd48af6 | 5115 | return (out); |
mturner5 | 0:b7116bd48af6 | 5116 | |
mturner5 | 0:b7116bd48af6 | 5117 | } |
mturner5 | 0:b7116bd48af6 | 5118 | |
mturner5 | 0:b7116bd48af6 | 5119 | /** |
mturner5 | 0:b7116bd48af6 | 5120 | * @brief Process function for the Q31 PID Control. |
mturner5 | 0:b7116bd48af6 | 5121 | * @param[in,out] *S points to an instance of the Q31 PID Control structure |
mturner5 | 0:b7116bd48af6 | 5122 | * @param[in] in input sample to process |
mturner5 | 0:b7116bd48af6 | 5123 | * @return out processed output sample. |
mturner5 | 0:b7116bd48af6 | 5124 | * |
mturner5 | 0:b7116bd48af6 | 5125 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5126 | * \par |
mturner5 | 0:b7116bd48af6 | 5127 | * The function is implemented using an internal 64-bit accumulator. |
mturner5 | 0:b7116bd48af6 | 5128 | * The accumulator has a 2.62 format and maintains full precision of the intermediate multiplication results but provides only a single guard bit. |
mturner5 | 0:b7116bd48af6 | 5129 | * Thus, if the accumulator result overflows it wraps around rather than clip. |
mturner5 | 0:b7116bd48af6 | 5130 | * In order to avoid overflows completely the input signal must be scaled down by 2 bits as there are four additions. |
mturner5 | 0:b7116bd48af6 | 5131 | * After all multiply-accumulates are performed, the 2.62 accumulator is truncated to 1.32 format and then saturated to 1.31 format. |
mturner5 | 0:b7116bd48af6 | 5132 | */ |
mturner5 | 0:b7116bd48af6 | 5133 | |
mturner5 | 0:b7116bd48af6 | 5134 | static __INLINE q31_t arm_pid_q31( |
mturner5 | 0:b7116bd48af6 | 5135 | arm_pid_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 5136 | q31_t in) |
mturner5 | 0:b7116bd48af6 | 5137 | { |
mturner5 | 0:b7116bd48af6 | 5138 | q63_t acc; |
mturner5 | 0:b7116bd48af6 | 5139 | q31_t out; |
mturner5 | 0:b7116bd48af6 | 5140 | |
mturner5 | 0:b7116bd48af6 | 5141 | /* acc = A0 * x[n] */ |
mturner5 | 0:b7116bd48af6 | 5142 | acc = (q63_t) S->A0 * in; |
mturner5 | 0:b7116bd48af6 | 5143 | |
mturner5 | 0:b7116bd48af6 | 5144 | /* acc += A1 * x[n-1] */ |
mturner5 | 0:b7116bd48af6 | 5145 | acc += (q63_t) S->A1 * S->state[0]; |
mturner5 | 0:b7116bd48af6 | 5146 | |
mturner5 | 0:b7116bd48af6 | 5147 | /* acc += A2 * x[n-2] */ |
mturner5 | 0:b7116bd48af6 | 5148 | acc += (q63_t) S->A2 * S->state[1]; |
mturner5 | 0:b7116bd48af6 | 5149 | |
mturner5 | 0:b7116bd48af6 | 5150 | /* convert output to 1.31 format to add y[n-1] */ |
mturner5 | 0:b7116bd48af6 | 5151 | out = (q31_t) (acc >> 31u); |
mturner5 | 0:b7116bd48af6 | 5152 | |
mturner5 | 0:b7116bd48af6 | 5153 | /* out += y[n-1] */ |
mturner5 | 0:b7116bd48af6 | 5154 | out += S->state[2]; |
mturner5 | 0:b7116bd48af6 | 5155 | |
mturner5 | 0:b7116bd48af6 | 5156 | /* Update state */ |
mturner5 | 0:b7116bd48af6 | 5157 | S->state[1] = S->state[0]; |
mturner5 | 0:b7116bd48af6 | 5158 | S->state[0] = in; |
mturner5 | 0:b7116bd48af6 | 5159 | S->state[2] = out; |
mturner5 | 0:b7116bd48af6 | 5160 | |
mturner5 | 0:b7116bd48af6 | 5161 | /* return to application */ |
mturner5 | 0:b7116bd48af6 | 5162 | return (out); |
mturner5 | 0:b7116bd48af6 | 5163 | |
mturner5 | 0:b7116bd48af6 | 5164 | } |
mturner5 | 0:b7116bd48af6 | 5165 | |
mturner5 | 0:b7116bd48af6 | 5166 | /** |
mturner5 | 0:b7116bd48af6 | 5167 | * @brief Process function for the Q15 PID Control. |
mturner5 | 0:b7116bd48af6 | 5168 | * @param[in,out] *S points to an instance of the Q15 PID Control structure |
mturner5 | 0:b7116bd48af6 | 5169 | * @param[in] in input sample to process |
mturner5 | 0:b7116bd48af6 | 5170 | * @return out processed output sample. |
mturner5 | 0:b7116bd48af6 | 5171 | * |
mturner5 | 0:b7116bd48af6 | 5172 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5173 | * \par |
mturner5 | 0:b7116bd48af6 | 5174 | * The function is implemented using a 64-bit internal accumulator. |
mturner5 | 0:b7116bd48af6 | 5175 | * Both Gains and state variables are represented in 1.15 format and multiplications yield a 2.30 result. |
mturner5 | 0:b7116bd48af6 | 5176 | * The 2.30 intermediate results are accumulated in a 64-bit accumulator in 34.30 format. |
mturner5 | 0:b7116bd48af6 | 5177 | * There is no risk of internal overflow with this approach and the full precision of intermediate multiplications is preserved. |
mturner5 | 0:b7116bd48af6 | 5178 | * After all additions have been performed, the accumulator is truncated to 34.15 format by discarding low 15 bits. |
mturner5 | 0:b7116bd48af6 | 5179 | * Lastly, the accumulator is saturated to yield a result in 1.15 format. |
mturner5 | 0:b7116bd48af6 | 5180 | */ |
mturner5 | 0:b7116bd48af6 | 5181 | |
mturner5 | 0:b7116bd48af6 | 5182 | static __INLINE q15_t arm_pid_q15( |
mturner5 | 0:b7116bd48af6 | 5183 | arm_pid_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 5184 | q15_t in) |
mturner5 | 0:b7116bd48af6 | 5185 | { |
mturner5 | 0:b7116bd48af6 | 5186 | q63_t acc; |
mturner5 | 0:b7116bd48af6 | 5187 | q15_t out; |
mturner5 | 0:b7116bd48af6 | 5188 | |
mturner5 | 0:b7116bd48af6 | 5189 | #ifndef ARM_MATH_CM0_FAMILY |
mturner5 | 0:b7116bd48af6 | 5190 | __SIMD32_TYPE *vstate; |
mturner5 | 0:b7116bd48af6 | 5191 | |
mturner5 | 0:b7116bd48af6 | 5192 | /* Implementation of PID controller */ |
mturner5 | 0:b7116bd48af6 | 5193 | |
mturner5 | 0:b7116bd48af6 | 5194 | /* acc = A0 * x[n] */ |
mturner5 | 0:b7116bd48af6 | 5195 | acc = (q31_t) __SMUAD(S->A0, in); |
mturner5 | 0:b7116bd48af6 | 5196 | |
mturner5 | 0:b7116bd48af6 | 5197 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
mturner5 | 0:b7116bd48af6 | 5198 | vstate = __SIMD32_CONST(S->state); |
mturner5 | 0:b7116bd48af6 | 5199 | acc = __SMLALD(S->A1, (q31_t) *vstate, acc); |
mturner5 | 0:b7116bd48af6 | 5200 | |
mturner5 | 0:b7116bd48af6 | 5201 | #else |
mturner5 | 0:b7116bd48af6 | 5202 | /* acc = A0 * x[n] */ |
mturner5 | 0:b7116bd48af6 | 5203 | acc = ((q31_t) S->A0) * in; |
mturner5 | 0:b7116bd48af6 | 5204 | |
mturner5 | 0:b7116bd48af6 | 5205 | /* acc += A1 * x[n-1] + A2 * x[n-2] */ |
mturner5 | 0:b7116bd48af6 | 5206 | acc += (q31_t) S->A1 * S->state[0]; |
mturner5 | 0:b7116bd48af6 | 5207 | acc += (q31_t) S->A2 * S->state[1]; |
mturner5 | 0:b7116bd48af6 | 5208 | |
mturner5 | 0:b7116bd48af6 | 5209 | #endif |
mturner5 | 0:b7116bd48af6 | 5210 | |
mturner5 | 0:b7116bd48af6 | 5211 | /* acc += y[n-1] */ |
mturner5 | 0:b7116bd48af6 | 5212 | acc += (q31_t) S->state[2] << 15; |
mturner5 | 0:b7116bd48af6 | 5213 | |
mturner5 | 0:b7116bd48af6 | 5214 | /* saturate the output */ |
mturner5 | 0:b7116bd48af6 | 5215 | out = (q15_t) (__SSAT((acc >> 15), 16)); |
mturner5 | 0:b7116bd48af6 | 5216 | |
mturner5 | 0:b7116bd48af6 | 5217 | /* Update state */ |
mturner5 | 0:b7116bd48af6 | 5218 | S->state[1] = S->state[0]; |
mturner5 | 0:b7116bd48af6 | 5219 | S->state[0] = in; |
mturner5 | 0:b7116bd48af6 | 5220 | S->state[2] = out; |
mturner5 | 0:b7116bd48af6 | 5221 | |
mturner5 | 0:b7116bd48af6 | 5222 | /* return to application */ |
mturner5 | 0:b7116bd48af6 | 5223 | return (out); |
mturner5 | 0:b7116bd48af6 | 5224 | |
mturner5 | 0:b7116bd48af6 | 5225 | } |
mturner5 | 0:b7116bd48af6 | 5226 | |
mturner5 | 0:b7116bd48af6 | 5227 | /** |
mturner5 | 0:b7116bd48af6 | 5228 | * @} end of PID group |
mturner5 | 0:b7116bd48af6 | 5229 | */ |
mturner5 | 0:b7116bd48af6 | 5230 | |
mturner5 | 0:b7116bd48af6 | 5231 | |
mturner5 | 0:b7116bd48af6 | 5232 | /** |
mturner5 | 0:b7116bd48af6 | 5233 | * @brief Floating-point matrix inverse. |
mturner5 | 0:b7116bd48af6 | 5234 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 5235 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 5236 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
mturner5 | 0:b7116bd48af6 | 5237 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
mturner5 | 0:b7116bd48af6 | 5238 | */ |
mturner5 | 0:b7116bd48af6 | 5239 | |
mturner5 | 0:b7116bd48af6 | 5240 | arm_status arm_mat_inverse_f32( |
mturner5 | 0:b7116bd48af6 | 5241 | const arm_matrix_instance_f32 * src, |
mturner5 | 0:b7116bd48af6 | 5242 | arm_matrix_instance_f32 * dst); |
mturner5 | 0:b7116bd48af6 | 5243 | |
mturner5 | 0:b7116bd48af6 | 5244 | |
mturner5 | 0:b7116bd48af6 | 5245 | /** |
mturner5 | 0:b7116bd48af6 | 5246 | * @brief Floating-point matrix inverse. |
mturner5 | 0:b7116bd48af6 | 5247 | * @param[in] *src points to the instance of the input floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 5248 | * @param[out] *dst points to the instance of the output floating-point matrix structure. |
mturner5 | 0:b7116bd48af6 | 5249 | * @return The function returns ARM_MATH_SIZE_MISMATCH, if the dimensions do not match. |
mturner5 | 0:b7116bd48af6 | 5250 | * If the input matrix is singular (does not have an inverse), then the algorithm terminates and returns error status ARM_MATH_SINGULAR. |
mturner5 | 0:b7116bd48af6 | 5251 | */ |
mturner5 | 0:b7116bd48af6 | 5252 | |
mturner5 | 0:b7116bd48af6 | 5253 | arm_status arm_mat_inverse_f64( |
mturner5 | 0:b7116bd48af6 | 5254 | const arm_matrix_instance_f64 * src, |
mturner5 | 0:b7116bd48af6 | 5255 | arm_matrix_instance_f64 * dst); |
mturner5 | 0:b7116bd48af6 | 5256 | |
mturner5 | 0:b7116bd48af6 | 5257 | |
mturner5 | 0:b7116bd48af6 | 5258 | |
mturner5 | 0:b7116bd48af6 | 5259 | /** |
mturner5 | 0:b7116bd48af6 | 5260 | * @ingroup groupController |
mturner5 | 0:b7116bd48af6 | 5261 | */ |
mturner5 | 0:b7116bd48af6 | 5262 | |
mturner5 | 0:b7116bd48af6 | 5263 | |
mturner5 | 0:b7116bd48af6 | 5264 | /** |
mturner5 | 0:b7116bd48af6 | 5265 | * @defgroup clarke Vector Clarke Transform |
mturner5 | 0:b7116bd48af6 | 5266 | * Forward Clarke transform converts the instantaneous stator phases into a two-coordinate time invariant vector. |
mturner5 | 0:b7116bd48af6 | 5267 | * Generally the Clarke transform uses three-phase currents <code>Ia, Ib and Ic</code> to calculate currents |
mturner5 | 0:b7116bd48af6 | 5268 | * in the two-phase orthogonal stator axis <code>Ialpha</code> and <code>Ibeta</code>. |
mturner5 | 0:b7116bd48af6 | 5269 | * When <code>Ialpha</code> is superposed with <code>Ia</code> as shown in the figure below |
mturner5 | 0:b7116bd48af6 | 5270 | * \image html clarke.gif Stator current space vector and its components in (a,b). |
mturner5 | 0:b7116bd48af6 | 5271 | * and <code>Ia + Ib + Ic = 0</code>, in this condition <code>Ialpha</code> and <code>Ibeta</code> |
mturner5 | 0:b7116bd48af6 | 5272 | * can be calculated using only <code>Ia</code> and <code>Ib</code>. |
mturner5 | 0:b7116bd48af6 | 5273 | * |
mturner5 | 0:b7116bd48af6 | 5274 | * The function operates on a single sample of data and each call to the function returns the processed output. |
mturner5 | 0:b7116bd48af6 | 5275 | * The library provides separate functions for Q31 and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 5276 | * \par Algorithm |
mturner5 | 0:b7116bd48af6 | 5277 | * \image html clarkeFormula.gif |
mturner5 | 0:b7116bd48af6 | 5278 | * where <code>Ia</code> and <code>Ib</code> are the instantaneous stator phases and |
mturner5 | 0:b7116bd48af6 | 5279 | * <code>pIalpha</code> and <code>pIbeta</code> are the two coordinates of time invariant vector. |
mturner5 | 0:b7116bd48af6 | 5280 | * \par Fixed-Point Behavior |
mturner5 | 0:b7116bd48af6 | 5281 | * Care must be taken when using the Q31 version of the Clarke transform. |
mturner5 | 0:b7116bd48af6 | 5282 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
mturner5 | 0:b7116bd48af6 | 5283 | * Refer to the function specific documentation below for usage guidelines. |
mturner5 | 0:b7116bd48af6 | 5284 | */ |
mturner5 | 0:b7116bd48af6 | 5285 | |
mturner5 | 0:b7116bd48af6 | 5286 | /** |
mturner5 | 0:b7116bd48af6 | 5287 | * @addtogroup clarke |
mturner5 | 0:b7116bd48af6 | 5288 | * @{ |
mturner5 | 0:b7116bd48af6 | 5289 | */ |
mturner5 | 0:b7116bd48af6 | 5290 | |
mturner5 | 0:b7116bd48af6 | 5291 | /** |
mturner5 | 0:b7116bd48af6 | 5292 | * |
mturner5 | 0:b7116bd48af6 | 5293 | * @brief Floating-point Clarke transform |
mturner5 | 0:b7116bd48af6 | 5294 | * @param[in] Ia input three-phase coordinate <code>a</code> |
mturner5 | 0:b7116bd48af6 | 5295 | * @param[in] Ib input three-phase coordinate <code>b</code> |
mturner5 | 0:b7116bd48af6 | 5296 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5297 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5298 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5299 | */ |
mturner5 | 0:b7116bd48af6 | 5300 | |
mturner5 | 0:b7116bd48af6 | 5301 | static __INLINE void arm_clarke_f32( |
mturner5 | 0:b7116bd48af6 | 5302 | float32_t Ia, |
mturner5 | 0:b7116bd48af6 | 5303 | float32_t Ib, |
mturner5 | 0:b7116bd48af6 | 5304 | float32_t * pIalpha, |
mturner5 | 0:b7116bd48af6 | 5305 | float32_t * pIbeta) |
mturner5 | 0:b7116bd48af6 | 5306 | { |
mturner5 | 0:b7116bd48af6 | 5307 | /* Calculate pIalpha using the equation, pIalpha = Ia */ |
mturner5 | 0:b7116bd48af6 | 5308 | *pIalpha = Ia; |
mturner5 | 0:b7116bd48af6 | 5309 | |
mturner5 | 0:b7116bd48af6 | 5310 | /* Calculate pIbeta using the equation, pIbeta = (1/sqrt(3)) * Ia + (2/sqrt(3)) * Ib */ |
mturner5 | 0:b7116bd48af6 | 5311 | *pIbeta = |
mturner5 | 0:b7116bd48af6 | 5312 | ((float32_t) 0.57735026919 * Ia + (float32_t) 1.15470053838 * Ib); |
mturner5 | 0:b7116bd48af6 | 5313 | |
mturner5 | 0:b7116bd48af6 | 5314 | } |
mturner5 | 0:b7116bd48af6 | 5315 | |
mturner5 | 0:b7116bd48af6 | 5316 | /** |
mturner5 | 0:b7116bd48af6 | 5317 | * @brief Clarke transform for Q31 version |
mturner5 | 0:b7116bd48af6 | 5318 | * @param[in] Ia input three-phase coordinate <code>a</code> |
mturner5 | 0:b7116bd48af6 | 5319 | * @param[in] Ib input three-phase coordinate <code>b</code> |
mturner5 | 0:b7116bd48af6 | 5320 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5321 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5322 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5323 | * |
mturner5 | 0:b7116bd48af6 | 5324 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5325 | * \par |
mturner5 | 0:b7116bd48af6 | 5326 | * The function is implemented using an internal 32-bit accumulator. |
mturner5 | 0:b7116bd48af6 | 5327 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
mturner5 | 0:b7116bd48af6 | 5328 | * There is saturation on the addition, hence there is no risk of overflow. |
mturner5 | 0:b7116bd48af6 | 5329 | */ |
mturner5 | 0:b7116bd48af6 | 5330 | |
mturner5 | 0:b7116bd48af6 | 5331 | static __INLINE void arm_clarke_q31( |
mturner5 | 0:b7116bd48af6 | 5332 | q31_t Ia, |
mturner5 | 0:b7116bd48af6 | 5333 | q31_t Ib, |
mturner5 | 0:b7116bd48af6 | 5334 | q31_t * pIalpha, |
mturner5 | 0:b7116bd48af6 | 5335 | q31_t * pIbeta) |
mturner5 | 0:b7116bd48af6 | 5336 | { |
mturner5 | 0:b7116bd48af6 | 5337 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5338 | |
mturner5 | 0:b7116bd48af6 | 5339 | /* Calculating pIalpha from Ia by equation pIalpha = Ia */ |
mturner5 | 0:b7116bd48af6 | 5340 | *pIalpha = Ia; |
mturner5 | 0:b7116bd48af6 | 5341 | |
mturner5 | 0:b7116bd48af6 | 5342 | /* Intermediate product is calculated by (1/(sqrt(3)) * Ia) */ |
mturner5 | 0:b7116bd48af6 | 5343 | product1 = (q31_t) (((q63_t) Ia * 0x24F34E8B) >> 30); |
mturner5 | 0:b7116bd48af6 | 5344 | |
mturner5 | 0:b7116bd48af6 | 5345 | /* Intermediate product is calculated by (2/sqrt(3) * Ib) */ |
mturner5 | 0:b7116bd48af6 | 5346 | product2 = (q31_t) (((q63_t) Ib * 0x49E69D16) >> 30); |
mturner5 | 0:b7116bd48af6 | 5347 | |
mturner5 | 0:b7116bd48af6 | 5348 | /* pIbeta is calculated by adding the intermediate products */ |
mturner5 | 0:b7116bd48af6 | 5349 | *pIbeta = __QADD(product1, product2); |
mturner5 | 0:b7116bd48af6 | 5350 | } |
mturner5 | 0:b7116bd48af6 | 5351 | |
mturner5 | 0:b7116bd48af6 | 5352 | /** |
mturner5 | 0:b7116bd48af6 | 5353 | * @} end of clarke group |
mturner5 | 0:b7116bd48af6 | 5354 | */ |
mturner5 | 0:b7116bd48af6 | 5355 | |
mturner5 | 0:b7116bd48af6 | 5356 | /** |
mturner5 | 0:b7116bd48af6 | 5357 | * @brief Converts the elements of the Q7 vector to Q31 vector. |
mturner5 | 0:b7116bd48af6 | 5358 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 5359 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 5360 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 5361 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5362 | */ |
mturner5 | 0:b7116bd48af6 | 5363 | void arm_q7_to_q31( |
mturner5 | 0:b7116bd48af6 | 5364 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5365 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5366 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 5367 | |
mturner5 | 0:b7116bd48af6 | 5368 | |
mturner5 | 0:b7116bd48af6 | 5369 | |
mturner5 | 0:b7116bd48af6 | 5370 | |
mturner5 | 0:b7116bd48af6 | 5371 | /** |
mturner5 | 0:b7116bd48af6 | 5372 | * @ingroup groupController |
mturner5 | 0:b7116bd48af6 | 5373 | */ |
mturner5 | 0:b7116bd48af6 | 5374 | |
mturner5 | 0:b7116bd48af6 | 5375 | /** |
mturner5 | 0:b7116bd48af6 | 5376 | * @defgroup inv_clarke Vector Inverse Clarke Transform |
mturner5 | 0:b7116bd48af6 | 5377 | * Inverse Clarke transform converts the two-coordinate time invariant vector into instantaneous stator phases. |
mturner5 | 0:b7116bd48af6 | 5378 | * |
mturner5 | 0:b7116bd48af6 | 5379 | * The function operates on a single sample of data and each call to the function returns the processed output. |
mturner5 | 0:b7116bd48af6 | 5380 | * The library provides separate functions for Q31 and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 5381 | * \par Algorithm |
mturner5 | 0:b7116bd48af6 | 5382 | * \image html clarkeInvFormula.gif |
mturner5 | 0:b7116bd48af6 | 5383 | * where <code>pIa</code> and <code>pIb</code> are the instantaneous stator phases and |
mturner5 | 0:b7116bd48af6 | 5384 | * <code>Ialpha</code> and <code>Ibeta</code> are the two coordinates of time invariant vector. |
mturner5 | 0:b7116bd48af6 | 5385 | * \par Fixed-Point Behavior |
mturner5 | 0:b7116bd48af6 | 5386 | * Care must be taken when using the Q31 version of the Clarke transform. |
mturner5 | 0:b7116bd48af6 | 5387 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
mturner5 | 0:b7116bd48af6 | 5388 | * Refer to the function specific documentation below for usage guidelines. |
mturner5 | 0:b7116bd48af6 | 5389 | */ |
mturner5 | 0:b7116bd48af6 | 5390 | |
mturner5 | 0:b7116bd48af6 | 5391 | /** |
mturner5 | 0:b7116bd48af6 | 5392 | * @addtogroup inv_clarke |
mturner5 | 0:b7116bd48af6 | 5393 | * @{ |
mturner5 | 0:b7116bd48af6 | 5394 | */ |
mturner5 | 0:b7116bd48af6 | 5395 | |
mturner5 | 0:b7116bd48af6 | 5396 | /** |
mturner5 | 0:b7116bd48af6 | 5397 | * @brief Floating-point Inverse Clarke transform |
mturner5 | 0:b7116bd48af6 | 5398 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5399 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5400 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
mturner5 | 0:b7116bd48af6 | 5401 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
mturner5 | 0:b7116bd48af6 | 5402 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5403 | */ |
mturner5 | 0:b7116bd48af6 | 5404 | |
mturner5 | 0:b7116bd48af6 | 5405 | |
mturner5 | 0:b7116bd48af6 | 5406 | static __INLINE void arm_inv_clarke_f32( |
mturner5 | 0:b7116bd48af6 | 5407 | float32_t Ialpha, |
mturner5 | 0:b7116bd48af6 | 5408 | float32_t Ibeta, |
mturner5 | 0:b7116bd48af6 | 5409 | float32_t * pIa, |
mturner5 | 0:b7116bd48af6 | 5410 | float32_t * pIb) |
mturner5 | 0:b7116bd48af6 | 5411 | { |
mturner5 | 0:b7116bd48af6 | 5412 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
mturner5 | 0:b7116bd48af6 | 5413 | *pIa = Ialpha; |
mturner5 | 0:b7116bd48af6 | 5414 | |
mturner5 | 0:b7116bd48af6 | 5415 | /* Calculating pIb from Ialpha and Ibeta by equation pIb = -(1/2) * Ialpha + (sqrt(3)/2) * Ibeta */ |
mturner5 | 0:b7116bd48af6 | 5416 | *pIb = -0.5 * Ialpha + (float32_t) 0.8660254039 *Ibeta; |
mturner5 | 0:b7116bd48af6 | 5417 | |
mturner5 | 0:b7116bd48af6 | 5418 | } |
mturner5 | 0:b7116bd48af6 | 5419 | |
mturner5 | 0:b7116bd48af6 | 5420 | /** |
mturner5 | 0:b7116bd48af6 | 5421 | * @brief Inverse Clarke transform for Q31 version |
mturner5 | 0:b7116bd48af6 | 5422 | * @param[in] Ialpha input two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5423 | * @param[in] Ibeta input two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5424 | * @param[out] *pIa points to output three-phase coordinate <code>a</code> |
mturner5 | 0:b7116bd48af6 | 5425 | * @param[out] *pIb points to output three-phase coordinate <code>b</code> |
mturner5 | 0:b7116bd48af6 | 5426 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5427 | * |
mturner5 | 0:b7116bd48af6 | 5428 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5429 | * \par |
mturner5 | 0:b7116bd48af6 | 5430 | * The function is implemented using an internal 32-bit accumulator. |
mturner5 | 0:b7116bd48af6 | 5431 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
mturner5 | 0:b7116bd48af6 | 5432 | * There is saturation on the subtraction, hence there is no risk of overflow. |
mturner5 | 0:b7116bd48af6 | 5433 | */ |
mturner5 | 0:b7116bd48af6 | 5434 | |
mturner5 | 0:b7116bd48af6 | 5435 | static __INLINE void arm_inv_clarke_q31( |
mturner5 | 0:b7116bd48af6 | 5436 | q31_t Ialpha, |
mturner5 | 0:b7116bd48af6 | 5437 | q31_t Ibeta, |
mturner5 | 0:b7116bd48af6 | 5438 | q31_t * pIa, |
mturner5 | 0:b7116bd48af6 | 5439 | q31_t * pIb) |
mturner5 | 0:b7116bd48af6 | 5440 | { |
mturner5 | 0:b7116bd48af6 | 5441 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5442 | |
mturner5 | 0:b7116bd48af6 | 5443 | /* Calculating pIa from Ialpha by equation pIa = Ialpha */ |
mturner5 | 0:b7116bd48af6 | 5444 | *pIa = Ialpha; |
mturner5 | 0:b7116bd48af6 | 5445 | |
mturner5 | 0:b7116bd48af6 | 5446 | /* Intermediate product is calculated by (1/(2*sqrt(3)) * Ia) */ |
mturner5 | 0:b7116bd48af6 | 5447 | product1 = (q31_t) (((q63_t) (Ialpha) * (0x40000000)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5448 | |
mturner5 | 0:b7116bd48af6 | 5449 | /* Intermediate product is calculated by (1/sqrt(3) * pIb) */ |
mturner5 | 0:b7116bd48af6 | 5450 | product2 = (q31_t) (((q63_t) (Ibeta) * (0x6ED9EBA1)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5451 | |
mturner5 | 0:b7116bd48af6 | 5452 | /* pIb is calculated by subtracting the products */ |
mturner5 | 0:b7116bd48af6 | 5453 | *pIb = __QSUB(product2, product1); |
mturner5 | 0:b7116bd48af6 | 5454 | |
mturner5 | 0:b7116bd48af6 | 5455 | } |
mturner5 | 0:b7116bd48af6 | 5456 | |
mturner5 | 0:b7116bd48af6 | 5457 | /** |
mturner5 | 0:b7116bd48af6 | 5458 | * @} end of inv_clarke group |
mturner5 | 0:b7116bd48af6 | 5459 | */ |
mturner5 | 0:b7116bd48af6 | 5460 | |
mturner5 | 0:b7116bd48af6 | 5461 | /** |
mturner5 | 0:b7116bd48af6 | 5462 | * @brief Converts the elements of the Q7 vector to Q15 vector. |
mturner5 | 0:b7116bd48af6 | 5463 | * @param[in] *pSrc input pointer |
mturner5 | 0:b7116bd48af6 | 5464 | * @param[out] *pDst output pointer |
mturner5 | 0:b7116bd48af6 | 5465 | * @param[in] blockSize number of samples to process |
mturner5 | 0:b7116bd48af6 | 5466 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5467 | */ |
mturner5 | 0:b7116bd48af6 | 5468 | void arm_q7_to_q15( |
mturner5 | 0:b7116bd48af6 | 5469 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5470 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5471 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 5472 | |
mturner5 | 0:b7116bd48af6 | 5473 | |
mturner5 | 0:b7116bd48af6 | 5474 | |
mturner5 | 0:b7116bd48af6 | 5475 | /** |
mturner5 | 0:b7116bd48af6 | 5476 | * @ingroup groupController |
mturner5 | 0:b7116bd48af6 | 5477 | */ |
mturner5 | 0:b7116bd48af6 | 5478 | |
mturner5 | 0:b7116bd48af6 | 5479 | /** |
mturner5 | 0:b7116bd48af6 | 5480 | * @defgroup park Vector Park Transform |
mturner5 | 0:b7116bd48af6 | 5481 | * |
mturner5 | 0:b7116bd48af6 | 5482 | * Forward Park transform converts the input two-coordinate vector to flux and torque components. |
mturner5 | 0:b7116bd48af6 | 5483 | * The Park transform can be used to realize the transformation of the <code>Ialpha</code> and the <code>Ibeta</code> currents |
mturner5 | 0:b7116bd48af6 | 5484 | * from the stationary to the moving reference frame and control the spatial relationship between |
mturner5 | 0:b7116bd48af6 | 5485 | * the stator vector current and rotor flux vector. |
mturner5 | 0:b7116bd48af6 | 5486 | * If we consider the d axis aligned with the rotor flux, the diagram below shows the |
mturner5 | 0:b7116bd48af6 | 5487 | * current vector and the relationship from the two reference frames: |
mturner5 | 0:b7116bd48af6 | 5488 | * \image html park.gif "Stator current space vector and its component in (a,b) and in the d,q rotating reference frame" |
mturner5 | 0:b7116bd48af6 | 5489 | * |
mturner5 | 0:b7116bd48af6 | 5490 | * The function operates on a single sample of data and each call to the function returns the processed output. |
mturner5 | 0:b7116bd48af6 | 5491 | * The library provides separate functions for Q31 and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 5492 | * \par Algorithm |
mturner5 | 0:b7116bd48af6 | 5493 | * \image html parkFormula.gif |
mturner5 | 0:b7116bd48af6 | 5494 | * where <code>Ialpha</code> and <code>Ibeta</code> are the stator vector components, |
mturner5 | 0:b7116bd48af6 | 5495 | * <code>pId</code> and <code>pIq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
mturner5 | 0:b7116bd48af6 | 5496 | * cosine and sine values of theta (rotor flux position). |
mturner5 | 0:b7116bd48af6 | 5497 | * \par Fixed-Point Behavior |
mturner5 | 0:b7116bd48af6 | 5498 | * Care must be taken when using the Q31 version of the Park transform. |
mturner5 | 0:b7116bd48af6 | 5499 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
mturner5 | 0:b7116bd48af6 | 5500 | * Refer to the function specific documentation below for usage guidelines. |
mturner5 | 0:b7116bd48af6 | 5501 | */ |
mturner5 | 0:b7116bd48af6 | 5502 | |
mturner5 | 0:b7116bd48af6 | 5503 | /** |
mturner5 | 0:b7116bd48af6 | 5504 | * @addtogroup park |
mturner5 | 0:b7116bd48af6 | 5505 | * @{ |
mturner5 | 0:b7116bd48af6 | 5506 | */ |
mturner5 | 0:b7116bd48af6 | 5507 | |
mturner5 | 0:b7116bd48af6 | 5508 | /** |
mturner5 | 0:b7116bd48af6 | 5509 | * @brief Floating-point Park transform |
mturner5 | 0:b7116bd48af6 | 5510 | * @param[in] Ialpha input two-phase vector coordinate alpha |
mturner5 | 0:b7116bd48af6 | 5511 | * @param[in] Ibeta input two-phase vector coordinate beta |
mturner5 | 0:b7116bd48af6 | 5512 | * @param[out] *pId points to output rotor reference frame d |
mturner5 | 0:b7116bd48af6 | 5513 | * @param[out] *pIq points to output rotor reference frame q |
mturner5 | 0:b7116bd48af6 | 5514 | * @param[in] sinVal sine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5515 | * @param[in] cosVal cosine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5516 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5517 | * |
mturner5 | 0:b7116bd48af6 | 5518 | * The function implements the forward Park transform. |
mturner5 | 0:b7116bd48af6 | 5519 | * |
mturner5 | 0:b7116bd48af6 | 5520 | */ |
mturner5 | 0:b7116bd48af6 | 5521 | |
mturner5 | 0:b7116bd48af6 | 5522 | static __INLINE void arm_park_f32( |
mturner5 | 0:b7116bd48af6 | 5523 | float32_t Ialpha, |
mturner5 | 0:b7116bd48af6 | 5524 | float32_t Ibeta, |
mturner5 | 0:b7116bd48af6 | 5525 | float32_t * pId, |
mturner5 | 0:b7116bd48af6 | 5526 | float32_t * pIq, |
mturner5 | 0:b7116bd48af6 | 5527 | float32_t sinVal, |
mturner5 | 0:b7116bd48af6 | 5528 | float32_t cosVal) |
mturner5 | 0:b7116bd48af6 | 5529 | { |
mturner5 | 0:b7116bd48af6 | 5530 | /* Calculate pId using the equation, pId = Ialpha * cosVal + Ibeta * sinVal */ |
mturner5 | 0:b7116bd48af6 | 5531 | *pId = Ialpha * cosVal + Ibeta * sinVal; |
mturner5 | 0:b7116bd48af6 | 5532 | |
mturner5 | 0:b7116bd48af6 | 5533 | /* Calculate pIq using the equation, pIq = - Ialpha * sinVal + Ibeta * cosVal */ |
mturner5 | 0:b7116bd48af6 | 5534 | *pIq = -Ialpha * sinVal + Ibeta * cosVal; |
mturner5 | 0:b7116bd48af6 | 5535 | |
mturner5 | 0:b7116bd48af6 | 5536 | } |
mturner5 | 0:b7116bd48af6 | 5537 | |
mturner5 | 0:b7116bd48af6 | 5538 | /** |
mturner5 | 0:b7116bd48af6 | 5539 | * @brief Park transform for Q31 version |
mturner5 | 0:b7116bd48af6 | 5540 | * @param[in] Ialpha input two-phase vector coordinate alpha |
mturner5 | 0:b7116bd48af6 | 5541 | * @param[in] Ibeta input two-phase vector coordinate beta |
mturner5 | 0:b7116bd48af6 | 5542 | * @param[out] *pId points to output rotor reference frame d |
mturner5 | 0:b7116bd48af6 | 5543 | * @param[out] *pIq points to output rotor reference frame q |
mturner5 | 0:b7116bd48af6 | 5544 | * @param[in] sinVal sine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5545 | * @param[in] cosVal cosine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5546 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5547 | * |
mturner5 | 0:b7116bd48af6 | 5548 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5549 | * \par |
mturner5 | 0:b7116bd48af6 | 5550 | * The function is implemented using an internal 32-bit accumulator. |
mturner5 | 0:b7116bd48af6 | 5551 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
mturner5 | 0:b7116bd48af6 | 5552 | * There is saturation on the addition and subtraction, hence there is no risk of overflow. |
mturner5 | 0:b7116bd48af6 | 5553 | */ |
mturner5 | 0:b7116bd48af6 | 5554 | |
mturner5 | 0:b7116bd48af6 | 5555 | |
mturner5 | 0:b7116bd48af6 | 5556 | static __INLINE void arm_park_q31( |
mturner5 | 0:b7116bd48af6 | 5557 | q31_t Ialpha, |
mturner5 | 0:b7116bd48af6 | 5558 | q31_t Ibeta, |
mturner5 | 0:b7116bd48af6 | 5559 | q31_t * pId, |
mturner5 | 0:b7116bd48af6 | 5560 | q31_t * pIq, |
mturner5 | 0:b7116bd48af6 | 5561 | q31_t sinVal, |
mturner5 | 0:b7116bd48af6 | 5562 | q31_t cosVal) |
mturner5 | 0:b7116bd48af6 | 5563 | { |
mturner5 | 0:b7116bd48af6 | 5564 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5565 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5566 | |
mturner5 | 0:b7116bd48af6 | 5567 | /* Intermediate product is calculated by (Ialpha * cosVal) */ |
mturner5 | 0:b7116bd48af6 | 5568 | product1 = (q31_t) (((q63_t) (Ialpha) * (cosVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5569 | |
mturner5 | 0:b7116bd48af6 | 5570 | /* Intermediate product is calculated by (Ibeta * sinVal) */ |
mturner5 | 0:b7116bd48af6 | 5571 | product2 = (q31_t) (((q63_t) (Ibeta) * (sinVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5572 | |
mturner5 | 0:b7116bd48af6 | 5573 | |
mturner5 | 0:b7116bd48af6 | 5574 | /* Intermediate product is calculated by (Ialpha * sinVal) */ |
mturner5 | 0:b7116bd48af6 | 5575 | product3 = (q31_t) (((q63_t) (Ialpha) * (sinVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5576 | |
mturner5 | 0:b7116bd48af6 | 5577 | /* Intermediate product is calculated by (Ibeta * cosVal) */ |
mturner5 | 0:b7116bd48af6 | 5578 | product4 = (q31_t) (((q63_t) (Ibeta) * (cosVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5579 | |
mturner5 | 0:b7116bd48af6 | 5580 | /* Calculate pId by adding the two intermediate products 1 and 2 */ |
mturner5 | 0:b7116bd48af6 | 5581 | *pId = __QADD(product1, product2); |
mturner5 | 0:b7116bd48af6 | 5582 | |
mturner5 | 0:b7116bd48af6 | 5583 | /* Calculate pIq by subtracting the two intermediate products 3 from 4 */ |
mturner5 | 0:b7116bd48af6 | 5584 | *pIq = __QSUB(product4, product3); |
mturner5 | 0:b7116bd48af6 | 5585 | } |
mturner5 | 0:b7116bd48af6 | 5586 | |
mturner5 | 0:b7116bd48af6 | 5587 | /** |
mturner5 | 0:b7116bd48af6 | 5588 | * @} end of park group |
mturner5 | 0:b7116bd48af6 | 5589 | */ |
mturner5 | 0:b7116bd48af6 | 5590 | |
mturner5 | 0:b7116bd48af6 | 5591 | /** |
mturner5 | 0:b7116bd48af6 | 5592 | * @brief Converts the elements of the Q7 vector to floating-point vector. |
mturner5 | 0:b7116bd48af6 | 5593 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 5594 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 5595 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 5596 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5597 | */ |
mturner5 | 0:b7116bd48af6 | 5598 | void arm_q7_to_float( |
mturner5 | 0:b7116bd48af6 | 5599 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5600 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5601 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 5602 | |
mturner5 | 0:b7116bd48af6 | 5603 | |
mturner5 | 0:b7116bd48af6 | 5604 | /** |
mturner5 | 0:b7116bd48af6 | 5605 | * @ingroup groupController |
mturner5 | 0:b7116bd48af6 | 5606 | */ |
mturner5 | 0:b7116bd48af6 | 5607 | |
mturner5 | 0:b7116bd48af6 | 5608 | /** |
mturner5 | 0:b7116bd48af6 | 5609 | * @defgroup inv_park Vector Inverse Park transform |
mturner5 | 0:b7116bd48af6 | 5610 | * Inverse Park transform converts the input flux and torque components to two-coordinate vector. |
mturner5 | 0:b7116bd48af6 | 5611 | * |
mturner5 | 0:b7116bd48af6 | 5612 | * The function operates on a single sample of data and each call to the function returns the processed output. |
mturner5 | 0:b7116bd48af6 | 5613 | * The library provides separate functions for Q31 and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 5614 | * \par Algorithm |
mturner5 | 0:b7116bd48af6 | 5615 | * \image html parkInvFormula.gif |
mturner5 | 0:b7116bd48af6 | 5616 | * where <code>pIalpha</code> and <code>pIbeta</code> are the stator vector components, |
mturner5 | 0:b7116bd48af6 | 5617 | * <code>Id</code> and <code>Iq</code> are rotor vector components and <code>cosVal</code> and <code>sinVal</code> are the |
mturner5 | 0:b7116bd48af6 | 5618 | * cosine and sine values of theta (rotor flux position). |
mturner5 | 0:b7116bd48af6 | 5619 | * \par Fixed-Point Behavior |
mturner5 | 0:b7116bd48af6 | 5620 | * Care must be taken when using the Q31 version of the Park transform. |
mturner5 | 0:b7116bd48af6 | 5621 | * In particular, the overflow and saturation behavior of the accumulator used must be considered. |
mturner5 | 0:b7116bd48af6 | 5622 | * Refer to the function specific documentation below for usage guidelines. |
mturner5 | 0:b7116bd48af6 | 5623 | */ |
mturner5 | 0:b7116bd48af6 | 5624 | |
mturner5 | 0:b7116bd48af6 | 5625 | /** |
mturner5 | 0:b7116bd48af6 | 5626 | * @addtogroup inv_park |
mturner5 | 0:b7116bd48af6 | 5627 | * @{ |
mturner5 | 0:b7116bd48af6 | 5628 | */ |
mturner5 | 0:b7116bd48af6 | 5629 | |
mturner5 | 0:b7116bd48af6 | 5630 | /** |
mturner5 | 0:b7116bd48af6 | 5631 | * @brief Floating-point Inverse Park transform |
mturner5 | 0:b7116bd48af6 | 5632 | * @param[in] Id input coordinate of rotor reference frame d |
mturner5 | 0:b7116bd48af6 | 5633 | * @param[in] Iq input coordinate of rotor reference frame q |
mturner5 | 0:b7116bd48af6 | 5634 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5635 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5636 | * @param[in] sinVal sine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5637 | * @param[in] cosVal cosine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5638 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5639 | */ |
mturner5 | 0:b7116bd48af6 | 5640 | |
mturner5 | 0:b7116bd48af6 | 5641 | static __INLINE void arm_inv_park_f32( |
mturner5 | 0:b7116bd48af6 | 5642 | float32_t Id, |
mturner5 | 0:b7116bd48af6 | 5643 | float32_t Iq, |
mturner5 | 0:b7116bd48af6 | 5644 | float32_t * pIalpha, |
mturner5 | 0:b7116bd48af6 | 5645 | float32_t * pIbeta, |
mturner5 | 0:b7116bd48af6 | 5646 | float32_t sinVal, |
mturner5 | 0:b7116bd48af6 | 5647 | float32_t cosVal) |
mturner5 | 0:b7116bd48af6 | 5648 | { |
mturner5 | 0:b7116bd48af6 | 5649 | /* Calculate pIalpha using the equation, pIalpha = Id * cosVal - Iq * sinVal */ |
mturner5 | 0:b7116bd48af6 | 5650 | *pIalpha = Id * cosVal - Iq * sinVal; |
mturner5 | 0:b7116bd48af6 | 5651 | |
mturner5 | 0:b7116bd48af6 | 5652 | /* Calculate pIbeta using the equation, pIbeta = Id * sinVal + Iq * cosVal */ |
mturner5 | 0:b7116bd48af6 | 5653 | *pIbeta = Id * sinVal + Iq * cosVal; |
mturner5 | 0:b7116bd48af6 | 5654 | |
mturner5 | 0:b7116bd48af6 | 5655 | } |
mturner5 | 0:b7116bd48af6 | 5656 | |
mturner5 | 0:b7116bd48af6 | 5657 | |
mturner5 | 0:b7116bd48af6 | 5658 | /** |
mturner5 | 0:b7116bd48af6 | 5659 | * @brief Inverse Park transform for Q31 version |
mturner5 | 0:b7116bd48af6 | 5660 | * @param[in] Id input coordinate of rotor reference frame d |
mturner5 | 0:b7116bd48af6 | 5661 | * @param[in] Iq input coordinate of rotor reference frame q |
mturner5 | 0:b7116bd48af6 | 5662 | * @param[out] *pIalpha points to output two-phase orthogonal vector axis alpha |
mturner5 | 0:b7116bd48af6 | 5663 | * @param[out] *pIbeta points to output two-phase orthogonal vector axis beta |
mturner5 | 0:b7116bd48af6 | 5664 | * @param[in] sinVal sine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5665 | * @param[in] cosVal cosine value of rotation angle theta |
mturner5 | 0:b7116bd48af6 | 5666 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5667 | * |
mturner5 | 0:b7116bd48af6 | 5668 | * <b>Scaling and Overflow Behavior:</b> |
mturner5 | 0:b7116bd48af6 | 5669 | * \par |
mturner5 | 0:b7116bd48af6 | 5670 | * The function is implemented using an internal 32-bit accumulator. |
mturner5 | 0:b7116bd48af6 | 5671 | * The accumulator maintains 1.31 format by truncating lower 31 bits of the intermediate multiplication in 2.62 format. |
mturner5 | 0:b7116bd48af6 | 5672 | * There is saturation on the addition, hence there is no risk of overflow. |
mturner5 | 0:b7116bd48af6 | 5673 | */ |
mturner5 | 0:b7116bd48af6 | 5674 | |
mturner5 | 0:b7116bd48af6 | 5675 | |
mturner5 | 0:b7116bd48af6 | 5676 | static __INLINE void arm_inv_park_q31( |
mturner5 | 0:b7116bd48af6 | 5677 | q31_t Id, |
mturner5 | 0:b7116bd48af6 | 5678 | q31_t Iq, |
mturner5 | 0:b7116bd48af6 | 5679 | q31_t * pIalpha, |
mturner5 | 0:b7116bd48af6 | 5680 | q31_t * pIbeta, |
mturner5 | 0:b7116bd48af6 | 5681 | q31_t sinVal, |
mturner5 | 0:b7116bd48af6 | 5682 | q31_t cosVal) |
mturner5 | 0:b7116bd48af6 | 5683 | { |
mturner5 | 0:b7116bd48af6 | 5684 | q31_t product1, product2; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5685 | q31_t product3, product4; /* Temporary variables used to store intermediate results */ |
mturner5 | 0:b7116bd48af6 | 5686 | |
mturner5 | 0:b7116bd48af6 | 5687 | /* Intermediate product is calculated by (Id * cosVal) */ |
mturner5 | 0:b7116bd48af6 | 5688 | product1 = (q31_t) (((q63_t) (Id) * (cosVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5689 | |
mturner5 | 0:b7116bd48af6 | 5690 | /* Intermediate product is calculated by (Iq * sinVal) */ |
mturner5 | 0:b7116bd48af6 | 5691 | product2 = (q31_t) (((q63_t) (Iq) * (sinVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5692 | |
mturner5 | 0:b7116bd48af6 | 5693 | |
mturner5 | 0:b7116bd48af6 | 5694 | /* Intermediate product is calculated by (Id * sinVal) */ |
mturner5 | 0:b7116bd48af6 | 5695 | product3 = (q31_t) (((q63_t) (Id) * (sinVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5696 | |
mturner5 | 0:b7116bd48af6 | 5697 | /* Intermediate product is calculated by (Iq * cosVal) */ |
mturner5 | 0:b7116bd48af6 | 5698 | product4 = (q31_t) (((q63_t) (Iq) * (cosVal)) >> 31); |
mturner5 | 0:b7116bd48af6 | 5699 | |
mturner5 | 0:b7116bd48af6 | 5700 | /* Calculate pIalpha by using the two intermediate products 1 and 2 */ |
mturner5 | 0:b7116bd48af6 | 5701 | *pIalpha = __QSUB(product1, product2); |
mturner5 | 0:b7116bd48af6 | 5702 | |
mturner5 | 0:b7116bd48af6 | 5703 | /* Calculate pIbeta by using the two intermediate products 3 and 4 */ |
mturner5 | 0:b7116bd48af6 | 5704 | *pIbeta = __QADD(product4, product3); |
mturner5 | 0:b7116bd48af6 | 5705 | |
mturner5 | 0:b7116bd48af6 | 5706 | } |
mturner5 | 0:b7116bd48af6 | 5707 | |
mturner5 | 0:b7116bd48af6 | 5708 | /** |
mturner5 | 0:b7116bd48af6 | 5709 | * @} end of Inverse park group |
mturner5 | 0:b7116bd48af6 | 5710 | */ |
mturner5 | 0:b7116bd48af6 | 5711 | |
mturner5 | 0:b7116bd48af6 | 5712 | |
mturner5 | 0:b7116bd48af6 | 5713 | /** |
mturner5 | 0:b7116bd48af6 | 5714 | * @brief Converts the elements of the Q31 vector to floating-point vector. |
mturner5 | 0:b7116bd48af6 | 5715 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 5716 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 5717 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 5718 | * @return none. |
mturner5 | 0:b7116bd48af6 | 5719 | */ |
mturner5 | 0:b7116bd48af6 | 5720 | void arm_q31_to_float( |
mturner5 | 0:b7116bd48af6 | 5721 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 5722 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 5723 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 5724 | |
mturner5 | 0:b7116bd48af6 | 5725 | /** |
mturner5 | 0:b7116bd48af6 | 5726 | * @ingroup groupInterpolation |
mturner5 | 0:b7116bd48af6 | 5727 | */ |
mturner5 | 0:b7116bd48af6 | 5728 | |
mturner5 | 0:b7116bd48af6 | 5729 | /** |
mturner5 | 0:b7116bd48af6 | 5730 | * @defgroup LinearInterpolate Linear Interpolation |
mturner5 | 0:b7116bd48af6 | 5731 | * |
mturner5 | 0:b7116bd48af6 | 5732 | * Linear interpolation is a method of curve fitting using linear polynomials. |
mturner5 | 0:b7116bd48af6 | 5733 | * Linear interpolation works by effectively drawing a straight line between two neighboring samples and returning the appropriate point along that line |
mturner5 | 0:b7116bd48af6 | 5734 | * |
mturner5 | 0:b7116bd48af6 | 5735 | * \par |
mturner5 | 0:b7116bd48af6 | 5736 | * \image html LinearInterp.gif "Linear interpolation" |
mturner5 | 0:b7116bd48af6 | 5737 | * |
mturner5 | 0:b7116bd48af6 | 5738 | * \par |
mturner5 | 0:b7116bd48af6 | 5739 | * A Linear Interpolate function calculates an output value(y), for the input(x) |
mturner5 | 0:b7116bd48af6 | 5740 | * using linear interpolation of the input values x0, x1( nearest input values) and the output values y0 and y1(nearest output values) |
mturner5 | 0:b7116bd48af6 | 5741 | * |
mturner5 | 0:b7116bd48af6 | 5742 | * \par Algorithm: |
mturner5 | 0:b7116bd48af6 | 5743 | * <pre> |
mturner5 | 0:b7116bd48af6 | 5744 | * y = y0 + (x - x0) * ((y1 - y0)/(x1-x0)) |
mturner5 | 0:b7116bd48af6 | 5745 | * where x0, x1 are nearest values of input x |
mturner5 | 0:b7116bd48af6 | 5746 | * y0, y1 are nearest values to output y |
mturner5 | 0:b7116bd48af6 | 5747 | * </pre> |
mturner5 | 0:b7116bd48af6 | 5748 | * |
mturner5 | 0:b7116bd48af6 | 5749 | * \par |
mturner5 | 0:b7116bd48af6 | 5750 | * This set of functions implements Linear interpolation process |
mturner5 | 0:b7116bd48af6 | 5751 | * for Q7, Q15, Q31, and floating-point data types. The functions operate on a single |
mturner5 | 0:b7116bd48af6 | 5752 | * sample of data and each call to the function returns a single processed value. |
mturner5 | 0:b7116bd48af6 | 5753 | * <code>S</code> points to an instance of the Linear Interpolate function data structure. |
mturner5 | 0:b7116bd48af6 | 5754 | * <code>x</code> is the input sample value. The functions returns the output value. |
mturner5 | 0:b7116bd48af6 | 5755 | * |
mturner5 | 0:b7116bd48af6 | 5756 | * \par |
mturner5 | 0:b7116bd48af6 | 5757 | * if x is outside of the table boundary, Linear interpolation returns first value of the table |
mturner5 | 0:b7116bd48af6 | 5758 | * if x is below input range and returns last value of table if x is above range. |
mturner5 | 0:b7116bd48af6 | 5759 | */ |
mturner5 | 0:b7116bd48af6 | 5760 | |
mturner5 | 0:b7116bd48af6 | 5761 | /** |
mturner5 | 0:b7116bd48af6 | 5762 | * @addtogroup LinearInterpolate |
mturner5 | 0:b7116bd48af6 | 5763 | * @{ |
mturner5 | 0:b7116bd48af6 | 5764 | */ |
mturner5 | 0:b7116bd48af6 | 5765 | |
mturner5 | 0:b7116bd48af6 | 5766 | /** |
mturner5 | 0:b7116bd48af6 | 5767 | * @brief Process function for the floating-point Linear Interpolation Function. |
mturner5 | 0:b7116bd48af6 | 5768 | * @param[in,out] *S is an instance of the floating-point Linear Interpolation structure |
mturner5 | 0:b7116bd48af6 | 5769 | * @param[in] x input sample to process |
mturner5 | 0:b7116bd48af6 | 5770 | * @return y processed output sample. |
mturner5 | 0:b7116bd48af6 | 5771 | * |
mturner5 | 0:b7116bd48af6 | 5772 | */ |
mturner5 | 0:b7116bd48af6 | 5773 | |
mturner5 | 0:b7116bd48af6 | 5774 | static __INLINE float32_t arm_linear_interp_f32( |
mturner5 | 0:b7116bd48af6 | 5775 | arm_linear_interp_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 5776 | float32_t x) |
mturner5 | 0:b7116bd48af6 | 5777 | { |
mturner5 | 0:b7116bd48af6 | 5778 | |
mturner5 | 0:b7116bd48af6 | 5779 | float32_t y; |
mturner5 | 0:b7116bd48af6 | 5780 | float32_t x0, x1; /* Nearest input values */ |
mturner5 | 0:b7116bd48af6 | 5781 | float32_t y0, y1; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5782 | float32_t xSpacing = S->xSpacing; /* spacing between input values */ |
mturner5 | 0:b7116bd48af6 | 5783 | int32_t i; /* Index variable */ |
mturner5 | 0:b7116bd48af6 | 5784 | float32_t *pYData = S->pYData; /* pointer to output table */ |
mturner5 | 0:b7116bd48af6 | 5785 | |
mturner5 | 0:b7116bd48af6 | 5786 | /* Calculation of index */ |
mturner5 | 0:b7116bd48af6 | 5787 | i = (int32_t) ((x - S->x1) / xSpacing); |
mturner5 | 0:b7116bd48af6 | 5788 | |
mturner5 | 0:b7116bd48af6 | 5789 | if(i < 0) |
mturner5 | 0:b7116bd48af6 | 5790 | { |
mturner5 | 0:b7116bd48af6 | 5791 | /* Iniatilize output for below specified range as least output value of table */ |
mturner5 | 0:b7116bd48af6 | 5792 | y = pYData[0]; |
mturner5 | 0:b7116bd48af6 | 5793 | } |
mturner5 | 0:b7116bd48af6 | 5794 | else if((uint32_t)i >= S->nValues) |
mturner5 | 0:b7116bd48af6 | 5795 | { |
mturner5 | 0:b7116bd48af6 | 5796 | /* Iniatilize output for above specified range as last output value of table */ |
mturner5 | 0:b7116bd48af6 | 5797 | y = pYData[S->nValues - 1]; |
mturner5 | 0:b7116bd48af6 | 5798 | } |
mturner5 | 0:b7116bd48af6 | 5799 | else |
mturner5 | 0:b7116bd48af6 | 5800 | { |
mturner5 | 0:b7116bd48af6 | 5801 | /* Calculation of nearest input values */ |
mturner5 | 0:b7116bd48af6 | 5802 | x0 = S->x1 + i * xSpacing; |
mturner5 | 0:b7116bd48af6 | 5803 | x1 = S->x1 + (i + 1) * xSpacing; |
mturner5 | 0:b7116bd48af6 | 5804 | |
mturner5 | 0:b7116bd48af6 | 5805 | /* Read of nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5806 | y0 = pYData[i]; |
mturner5 | 0:b7116bd48af6 | 5807 | y1 = pYData[i + 1]; |
mturner5 | 0:b7116bd48af6 | 5808 | |
mturner5 | 0:b7116bd48af6 | 5809 | /* Calculation of output */ |
mturner5 | 0:b7116bd48af6 | 5810 | y = y0 + (x - x0) * ((y1 - y0) / (x1 - x0)); |
mturner5 | 0:b7116bd48af6 | 5811 | |
mturner5 | 0:b7116bd48af6 | 5812 | } |
mturner5 | 0:b7116bd48af6 | 5813 | |
mturner5 | 0:b7116bd48af6 | 5814 | /* returns output value */ |
mturner5 | 0:b7116bd48af6 | 5815 | return (y); |
mturner5 | 0:b7116bd48af6 | 5816 | } |
mturner5 | 0:b7116bd48af6 | 5817 | |
mturner5 | 0:b7116bd48af6 | 5818 | /** |
mturner5 | 0:b7116bd48af6 | 5819 | * |
mturner5 | 0:b7116bd48af6 | 5820 | * @brief Process function for the Q31 Linear Interpolation Function. |
mturner5 | 0:b7116bd48af6 | 5821 | * @param[in] *pYData pointer to Q31 Linear Interpolation table |
mturner5 | 0:b7116bd48af6 | 5822 | * @param[in] x input sample to process |
mturner5 | 0:b7116bd48af6 | 5823 | * @param[in] nValues number of table values |
mturner5 | 0:b7116bd48af6 | 5824 | * @return y processed output sample. |
mturner5 | 0:b7116bd48af6 | 5825 | * |
mturner5 | 0:b7116bd48af6 | 5826 | * \par |
mturner5 | 0:b7116bd48af6 | 5827 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
mturner5 | 0:b7116bd48af6 | 5828 | * This function can support maximum of table size 2^12. |
mturner5 | 0:b7116bd48af6 | 5829 | * |
mturner5 | 0:b7116bd48af6 | 5830 | */ |
mturner5 | 0:b7116bd48af6 | 5831 | |
mturner5 | 0:b7116bd48af6 | 5832 | |
mturner5 | 0:b7116bd48af6 | 5833 | static __INLINE q31_t arm_linear_interp_q31( |
mturner5 | 0:b7116bd48af6 | 5834 | q31_t * pYData, |
mturner5 | 0:b7116bd48af6 | 5835 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 5836 | uint32_t nValues) |
mturner5 | 0:b7116bd48af6 | 5837 | { |
mturner5 | 0:b7116bd48af6 | 5838 | q31_t y; /* output */ |
mturner5 | 0:b7116bd48af6 | 5839 | q31_t y0, y1; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5840 | q31_t fract; /* fractional part */ |
mturner5 | 0:b7116bd48af6 | 5841 | int32_t index; /* Index to read nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5842 | |
mturner5 | 0:b7116bd48af6 | 5843 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 5844 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 5845 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 5846 | index = ((x & 0xFFF00000) >> 20); |
mturner5 | 0:b7116bd48af6 | 5847 | |
mturner5 | 0:b7116bd48af6 | 5848 | if(index >= (int32_t)(nValues - 1)) |
mturner5 | 0:b7116bd48af6 | 5849 | { |
mturner5 | 0:b7116bd48af6 | 5850 | return (pYData[nValues - 1]); |
mturner5 | 0:b7116bd48af6 | 5851 | } |
mturner5 | 0:b7116bd48af6 | 5852 | else if(index < 0) |
mturner5 | 0:b7116bd48af6 | 5853 | { |
mturner5 | 0:b7116bd48af6 | 5854 | return (pYData[0]); |
mturner5 | 0:b7116bd48af6 | 5855 | } |
mturner5 | 0:b7116bd48af6 | 5856 | else |
mturner5 | 0:b7116bd48af6 | 5857 | { |
mturner5 | 0:b7116bd48af6 | 5858 | |
mturner5 | 0:b7116bd48af6 | 5859 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 5860 | /* shift left by 11 to keep fract in 1.31 format */ |
mturner5 | 0:b7116bd48af6 | 5861 | fract = (x & 0x000FFFFF) << 11; |
mturner5 | 0:b7116bd48af6 | 5862 | |
mturner5 | 0:b7116bd48af6 | 5863 | /* Read two nearest output values from the index in 1.31(q31) format */ |
mturner5 | 0:b7116bd48af6 | 5864 | y0 = pYData[index]; |
mturner5 | 0:b7116bd48af6 | 5865 | y1 = pYData[index + 1u]; |
mturner5 | 0:b7116bd48af6 | 5866 | |
mturner5 | 0:b7116bd48af6 | 5867 | /* Calculation of y0 * (1-fract) and y is in 2.30 format */ |
mturner5 | 0:b7116bd48af6 | 5868 | y = ((q31_t) ((q63_t) y0 * (0x7FFFFFFF - fract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 5869 | |
mturner5 | 0:b7116bd48af6 | 5870 | /* Calculation of y0 * (1-fract) + y1 *fract and y is in 2.30 format */ |
mturner5 | 0:b7116bd48af6 | 5871 | y += ((q31_t) (((q63_t) y1 * fract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 5872 | |
mturner5 | 0:b7116bd48af6 | 5873 | /* Convert y to 1.31 format */ |
mturner5 | 0:b7116bd48af6 | 5874 | return (y << 1u); |
mturner5 | 0:b7116bd48af6 | 5875 | |
mturner5 | 0:b7116bd48af6 | 5876 | } |
mturner5 | 0:b7116bd48af6 | 5877 | |
mturner5 | 0:b7116bd48af6 | 5878 | } |
mturner5 | 0:b7116bd48af6 | 5879 | |
mturner5 | 0:b7116bd48af6 | 5880 | /** |
mturner5 | 0:b7116bd48af6 | 5881 | * |
mturner5 | 0:b7116bd48af6 | 5882 | * @brief Process function for the Q15 Linear Interpolation Function. |
mturner5 | 0:b7116bd48af6 | 5883 | * @param[in] *pYData pointer to Q15 Linear Interpolation table |
mturner5 | 0:b7116bd48af6 | 5884 | * @param[in] x input sample to process |
mturner5 | 0:b7116bd48af6 | 5885 | * @param[in] nValues number of table values |
mturner5 | 0:b7116bd48af6 | 5886 | * @return y processed output sample. |
mturner5 | 0:b7116bd48af6 | 5887 | * |
mturner5 | 0:b7116bd48af6 | 5888 | * \par |
mturner5 | 0:b7116bd48af6 | 5889 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
mturner5 | 0:b7116bd48af6 | 5890 | * This function can support maximum of table size 2^12. |
mturner5 | 0:b7116bd48af6 | 5891 | * |
mturner5 | 0:b7116bd48af6 | 5892 | */ |
mturner5 | 0:b7116bd48af6 | 5893 | |
mturner5 | 0:b7116bd48af6 | 5894 | |
mturner5 | 0:b7116bd48af6 | 5895 | static __INLINE q15_t arm_linear_interp_q15( |
mturner5 | 0:b7116bd48af6 | 5896 | q15_t * pYData, |
mturner5 | 0:b7116bd48af6 | 5897 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 5898 | uint32_t nValues) |
mturner5 | 0:b7116bd48af6 | 5899 | { |
mturner5 | 0:b7116bd48af6 | 5900 | q63_t y; /* output */ |
mturner5 | 0:b7116bd48af6 | 5901 | q15_t y0, y1; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5902 | q31_t fract; /* fractional part */ |
mturner5 | 0:b7116bd48af6 | 5903 | int32_t index; /* Index to read nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5904 | |
mturner5 | 0:b7116bd48af6 | 5905 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 5906 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 5907 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 5908 | index = ((x & 0xFFF00000) >> 20u); |
mturner5 | 0:b7116bd48af6 | 5909 | |
mturner5 | 0:b7116bd48af6 | 5910 | if(index >= (int32_t)(nValues - 1)) |
mturner5 | 0:b7116bd48af6 | 5911 | { |
mturner5 | 0:b7116bd48af6 | 5912 | return (pYData[nValues - 1]); |
mturner5 | 0:b7116bd48af6 | 5913 | } |
mturner5 | 0:b7116bd48af6 | 5914 | else if(index < 0) |
mturner5 | 0:b7116bd48af6 | 5915 | { |
mturner5 | 0:b7116bd48af6 | 5916 | return (pYData[0]); |
mturner5 | 0:b7116bd48af6 | 5917 | } |
mturner5 | 0:b7116bd48af6 | 5918 | else |
mturner5 | 0:b7116bd48af6 | 5919 | { |
mturner5 | 0:b7116bd48af6 | 5920 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 5921 | /* fract is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 5922 | fract = (x & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 5923 | |
mturner5 | 0:b7116bd48af6 | 5924 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 5925 | y0 = pYData[index]; |
mturner5 | 0:b7116bd48af6 | 5926 | y1 = pYData[index + 1u]; |
mturner5 | 0:b7116bd48af6 | 5927 | |
mturner5 | 0:b7116bd48af6 | 5928 | /* Calculation of y0 * (1-fract) and y is in 13.35 format */ |
mturner5 | 0:b7116bd48af6 | 5929 | y = ((q63_t) y0 * (0xFFFFF - fract)); |
mturner5 | 0:b7116bd48af6 | 5930 | |
mturner5 | 0:b7116bd48af6 | 5931 | /* Calculation of (y0 * (1-fract) + y1 * fract) and y is in 13.35 format */ |
mturner5 | 0:b7116bd48af6 | 5932 | y += ((q63_t) y1 * (fract)); |
mturner5 | 0:b7116bd48af6 | 5933 | |
mturner5 | 0:b7116bd48af6 | 5934 | /* convert y to 1.15 format */ |
mturner5 | 0:b7116bd48af6 | 5935 | return (y >> 20); |
mturner5 | 0:b7116bd48af6 | 5936 | } |
mturner5 | 0:b7116bd48af6 | 5937 | |
mturner5 | 0:b7116bd48af6 | 5938 | |
mturner5 | 0:b7116bd48af6 | 5939 | } |
mturner5 | 0:b7116bd48af6 | 5940 | |
mturner5 | 0:b7116bd48af6 | 5941 | /** |
mturner5 | 0:b7116bd48af6 | 5942 | * |
mturner5 | 0:b7116bd48af6 | 5943 | * @brief Process function for the Q7 Linear Interpolation Function. |
mturner5 | 0:b7116bd48af6 | 5944 | * @param[in] *pYData pointer to Q7 Linear Interpolation table |
mturner5 | 0:b7116bd48af6 | 5945 | * @param[in] x input sample to process |
mturner5 | 0:b7116bd48af6 | 5946 | * @param[in] nValues number of table values |
mturner5 | 0:b7116bd48af6 | 5947 | * @return y processed output sample. |
mturner5 | 0:b7116bd48af6 | 5948 | * |
mturner5 | 0:b7116bd48af6 | 5949 | * \par |
mturner5 | 0:b7116bd48af6 | 5950 | * Input sample <code>x</code> is in 12.20 format which contains 12 bits for table index and 20 bits for fractional part. |
mturner5 | 0:b7116bd48af6 | 5951 | * This function can support maximum of table size 2^12. |
mturner5 | 0:b7116bd48af6 | 5952 | */ |
mturner5 | 0:b7116bd48af6 | 5953 | |
mturner5 | 0:b7116bd48af6 | 5954 | |
mturner5 | 0:b7116bd48af6 | 5955 | static __INLINE q7_t arm_linear_interp_q7( |
mturner5 | 0:b7116bd48af6 | 5956 | q7_t * pYData, |
mturner5 | 0:b7116bd48af6 | 5957 | q31_t x, |
mturner5 | 0:b7116bd48af6 | 5958 | uint32_t nValues) |
mturner5 | 0:b7116bd48af6 | 5959 | { |
mturner5 | 0:b7116bd48af6 | 5960 | q31_t y; /* output */ |
mturner5 | 0:b7116bd48af6 | 5961 | q7_t y0, y1; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5962 | q31_t fract; /* fractional part */ |
mturner5 | 0:b7116bd48af6 | 5963 | uint32_t index; /* Index to read nearest output values */ |
mturner5 | 0:b7116bd48af6 | 5964 | |
mturner5 | 0:b7116bd48af6 | 5965 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 5966 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 5967 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 5968 | if (x < 0) |
mturner5 | 0:b7116bd48af6 | 5969 | { |
mturner5 | 0:b7116bd48af6 | 5970 | return (pYData[0]); |
mturner5 | 0:b7116bd48af6 | 5971 | } |
mturner5 | 0:b7116bd48af6 | 5972 | index = (x >> 20) & 0xfff; |
mturner5 | 0:b7116bd48af6 | 5973 | |
mturner5 | 0:b7116bd48af6 | 5974 | |
mturner5 | 0:b7116bd48af6 | 5975 | if(index >= (nValues - 1)) |
mturner5 | 0:b7116bd48af6 | 5976 | { |
mturner5 | 0:b7116bd48af6 | 5977 | return (pYData[nValues - 1]); |
mturner5 | 0:b7116bd48af6 | 5978 | } |
mturner5 | 0:b7116bd48af6 | 5979 | else |
mturner5 | 0:b7116bd48af6 | 5980 | { |
mturner5 | 0:b7116bd48af6 | 5981 | |
mturner5 | 0:b7116bd48af6 | 5982 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 5983 | /* fract is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 5984 | fract = (x & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 5985 | |
mturner5 | 0:b7116bd48af6 | 5986 | /* Read two nearest output values from the index and are in 1.7(q7) format */ |
mturner5 | 0:b7116bd48af6 | 5987 | y0 = pYData[index]; |
mturner5 | 0:b7116bd48af6 | 5988 | y1 = pYData[index + 1u]; |
mturner5 | 0:b7116bd48af6 | 5989 | |
mturner5 | 0:b7116bd48af6 | 5990 | /* Calculation of y0 * (1-fract ) and y is in 13.27(q27) format */ |
mturner5 | 0:b7116bd48af6 | 5991 | y = ((y0 * (0xFFFFF - fract))); |
mturner5 | 0:b7116bd48af6 | 5992 | |
mturner5 | 0:b7116bd48af6 | 5993 | /* Calculation of y1 * fract + y0 * (1-fract) and y is in 13.27(q27) format */ |
mturner5 | 0:b7116bd48af6 | 5994 | y += (y1 * fract); |
mturner5 | 0:b7116bd48af6 | 5995 | |
mturner5 | 0:b7116bd48af6 | 5996 | /* convert y to 1.7(q7) format */ |
mturner5 | 0:b7116bd48af6 | 5997 | return (y >> 20u); |
mturner5 | 0:b7116bd48af6 | 5998 | |
mturner5 | 0:b7116bd48af6 | 5999 | } |
mturner5 | 0:b7116bd48af6 | 6000 | |
mturner5 | 0:b7116bd48af6 | 6001 | } |
mturner5 | 0:b7116bd48af6 | 6002 | /** |
mturner5 | 0:b7116bd48af6 | 6003 | * @} end of LinearInterpolate group |
mturner5 | 0:b7116bd48af6 | 6004 | */ |
mturner5 | 0:b7116bd48af6 | 6005 | |
mturner5 | 0:b7116bd48af6 | 6006 | /** |
mturner5 | 0:b7116bd48af6 | 6007 | * @brief Fast approximation to the trigonometric sine function for floating-point data. |
mturner5 | 0:b7116bd48af6 | 6008 | * @param[in] x input value in radians. |
mturner5 | 0:b7116bd48af6 | 6009 | * @return sin(x). |
mturner5 | 0:b7116bd48af6 | 6010 | */ |
mturner5 | 0:b7116bd48af6 | 6011 | |
mturner5 | 0:b7116bd48af6 | 6012 | float32_t arm_sin_f32( |
mturner5 | 0:b7116bd48af6 | 6013 | float32_t x); |
mturner5 | 0:b7116bd48af6 | 6014 | |
mturner5 | 0:b7116bd48af6 | 6015 | /** |
mturner5 | 0:b7116bd48af6 | 6016 | * @brief Fast approximation to the trigonometric sine function for Q31 data. |
mturner5 | 0:b7116bd48af6 | 6017 | * @param[in] x Scaled input value in radians. |
mturner5 | 0:b7116bd48af6 | 6018 | * @return sin(x). |
mturner5 | 0:b7116bd48af6 | 6019 | */ |
mturner5 | 0:b7116bd48af6 | 6020 | |
mturner5 | 0:b7116bd48af6 | 6021 | q31_t arm_sin_q31( |
mturner5 | 0:b7116bd48af6 | 6022 | q31_t x); |
mturner5 | 0:b7116bd48af6 | 6023 | |
mturner5 | 0:b7116bd48af6 | 6024 | /** |
mturner5 | 0:b7116bd48af6 | 6025 | * @brief Fast approximation to the trigonometric sine function for Q15 data. |
mturner5 | 0:b7116bd48af6 | 6026 | * @param[in] x Scaled input value in radians. |
mturner5 | 0:b7116bd48af6 | 6027 | * @return sin(x). |
mturner5 | 0:b7116bd48af6 | 6028 | */ |
mturner5 | 0:b7116bd48af6 | 6029 | |
mturner5 | 0:b7116bd48af6 | 6030 | q15_t arm_sin_q15( |
mturner5 | 0:b7116bd48af6 | 6031 | q15_t x); |
mturner5 | 0:b7116bd48af6 | 6032 | |
mturner5 | 0:b7116bd48af6 | 6033 | /** |
mturner5 | 0:b7116bd48af6 | 6034 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. |
mturner5 | 0:b7116bd48af6 | 6035 | * @param[in] x input value in radians. |
mturner5 | 0:b7116bd48af6 | 6036 | * @return cos(x). |
mturner5 | 0:b7116bd48af6 | 6037 | */ |
mturner5 | 0:b7116bd48af6 | 6038 | |
mturner5 | 0:b7116bd48af6 | 6039 | float32_t arm_cos_f32( |
mturner5 | 0:b7116bd48af6 | 6040 | float32_t x); |
mturner5 | 0:b7116bd48af6 | 6041 | |
mturner5 | 0:b7116bd48af6 | 6042 | /** |
mturner5 | 0:b7116bd48af6 | 6043 | * @brief Fast approximation to the trigonometric cosine function for Q31 data. |
mturner5 | 0:b7116bd48af6 | 6044 | * @param[in] x Scaled input value in radians. |
mturner5 | 0:b7116bd48af6 | 6045 | * @return cos(x). |
mturner5 | 0:b7116bd48af6 | 6046 | */ |
mturner5 | 0:b7116bd48af6 | 6047 | |
mturner5 | 0:b7116bd48af6 | 6048 | q31_t arm_cos_q31( |
mturner5 | 0:b7116bd48af6 | 6049 | q31_t x); |
mturner5 | 0:b7116bd48af6 | 6050 | |
mturner5 | 0:b7116bd48af6 | 6051 | /** |
mturner5 | 0:b7116bd48af6 | 6052 | * @brief Fast approximation to the trigonometric cosine function for Q15 data. |
mturner5 | 0:b7116bd48af6 | 6053 | * @param[in] x Scaled input value in radians. |
mturner5 | 0:b7116bd48af6 | 6054 | * @return cos(x). |
mturner5 | 0:b7116bd48af6 | 6055 | */ |
mturner5 | 0:b7116bd48af6 | 6056 | |
mturner5 | 0:b7116bd48af6 | 6057 | q15_t arm_cos_q15( |
mturner5 | 0:b7116bd48af6 | 6058 | q15_t x); |
mturner5 | 0:b7116bd48af6 | 6059 | |
mturner5 | 0:b7116bd48af6 | 6060 | |
mturner5 | 0:b7116bd48af6 | 6061 | /** |
mturner5 | 0:b7116bd48af6 | 6062 | * @ingroup groupFastMath |
mturner5 | 0:b7116bd48af6 | 6063 | */ |
mturner5 | 0:b7116bd48af6 | 6064 | |
mturner5 | 0:b7116bd48af6 | 6065 | |
mturner5 | 0:b7116bd48af6 | 6066 | /** |
mturner5 | 0:b7116bd48af6 | 6067 | * @defgroup SQRT Square Root |
mturner5 | 0:b7116bd48af6 | 6068 | * |
mturner5 | 0:b7116bd48af6 | 6069 | * Computes the square root of a number. |
mturner5 | 0:b7116bd48af6 | 6070 | * There are separate functions for Q15, Q31, and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 6071 | * The square root function is computed using the Newton-Raphson algorithm. |
mturner5 | 0:b7116bd48af6 | 6072 | * This is an iterative algorithm of the form: |
mturner5 | 0:b7116bd48af6 | 6073 | * <pre> |
mturner5 | 0:b7116bd48af6 | 6074 | * x1 = x0 - f(x0)/f'(x0) |
mturner5 | 0:b7116bd48af6 | 6075 | * </pre> |
mturner5 | 0:b7116bd48af6 | 6076 | * where <code>x1</code> is the current estimate, |
mturner5 | 0:b7116bd48af6 | 6077 | * <code>x0</code> is the previous estimate, and |
mturner5 | 0:b7116bd48af6 | 6078 | * <code>f'(x0)</code> is the derivative of <code>f()</code> evaluated at <code>x0</code>. |
mturner5 | 0:b7116bd48af6 | 6079 | * For the square root function, the algorithm reduces to: |
mturner5 | 0:b7116bd48af6 | 6080 | * <pre> |
mturner5 | 0:b7116bd48af6 | 6081 | * x0 = in/2 [initial guess] |
mturner5 | 0:b7116bd48af6 | 6082 | * x1 = 1/2 * ( x0 + in / x0) [each iteration] |
mturner5 | 0:b7116bd48af6 | 6083 | * </pre> |
mturner5 | 0:b7116bd48af6 | 6084 | */ |
mturner5 | 0:b7116bd48af6 | 6085 | |
mturner5 | 0:b7116bd48af6 | 6086 | |
mturner5 | 0:b7116bd48af6 | 6087 | /** |
mturner5 | 0:b7116bd48af6 | 6088 | * @addtogroup SQRT |
mturner5 | 0:b7116bd48af6 | 6089 | * @{ |
mturner5 | 0:b7116bd48af6 | 6090 | */ |
mturner5 | 0:b7116bd48af6 | 6091 | |
mturner5 | 0:b7116bd48af6 | 6092 | /** |
mturner5 | 0:b7116bd48af6 | 6093 | * @brief Floating-point square root function. |
mturner5 | 0:b7116bd48af6 | 6094 | * @param[in] in input value. |
mturner5 | 0:b7116bd48af6 | 6095 | * @param[out] *pOut square root of input value. |
mturner5 | 0:b7116bd48af6 | 6096 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
mturner5 | 0:b7116bd48af6 | 6097 | * <code>in</code> is negative value and returns zero output for negative values. |
mturner5 | 0:b7116bd48af6 | 6098 | */ |
mturner5 | 0:b7116bd48af6 | 6099 | |
mturner5 | 0:b7116bd48af6 | 6100 | static __INLINE arm_status arm_sqrt_f32( |
mturner5 | 0:b7116bd48af6 | 6101 | float32_t in, |
mturner5 | 0:b7116bd48af6 | 6102 | float32_t * pOut) |
mturner5 | 0:b7116bd48af6 | 6103 | { |
mturner5 | 0:b7116bd48af6 | 6104 | if(in >= 0.0f) |
mturner5 | 0:b7116bd48af6 | 6105 | { |
mturner5 | 0:b7116bd48af6 | 6106 | |
mturner5 | 0:b7116bd48af6 | 6107 | // #if __FPU_USED |
mturner5 | 0:b7116bd48af6 | 6108 | #if (__FPU_USED == 1) && defined ( __CC_ARM ) |
mturner5 | 0:b7116bd48af6 | 6109 | *pOut = __sqrtf(in); |
mturner5 | 0:b7116bd48af6 | 6110 | #else |
mturner5 | 0:b7116bd48af6 | 6111 | *pOut = sqrtf(in); |
mturner5 | 0:b7116bd48af6 | 6112 | #endif |
mturner5 | 0:b7116bd48af6 | 6113 | |
mturner5 | 0:b7116bd48af6 | 6114 | return (ARM_MATH_SUCCESS); |
mturner5 | 0:b7116bd48af6 | 6115 | } |
mturner5 | 0:b7116bd48af6 | 6116 | else |
mturner5 | 0:b7116bd48af6 | 6117 | { |
mturner5 | 0:b7116bd48af6 | 6118 | *pOut = 0.0f; |
mturner5 | 0:b7116bd48af6 | 6119 | return (ARM_MATH_ARGUMENT_ERROR); |
mturner5 | 0:b7116bd48af6 | 6120 | } |
mturner5 | 0:b7116bd48af6 | 6121 | |
mturner5 | 0:b7116bd48af6 | 6122 | } |
mturner5 | 0:b7116bd48af6 | 6123 | |
mturner5 | 0:b7116bd48af6 | 6124 | |
mturner5 | 0:b7116bd48af6 | 6125 | /** |
mturner5 | 0:b7116bd48af6 | 6126 | * @brief Q31 square root function. |
mturner5 | 0:b7116bd48af6 | 6127 | * @param[in] in input value. The range of the input value is [0 +1) or 0x00000000 to 0x7FFFFFFF. |
mturner5 | 0:b7116bd48af6 | 6128 | * @param[out] *pOut square root of input value. |
mturner5 | 0:b7116bd48af6 | 6129 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
mturner5 | 0:b7116bd48af6 | 6130 | * <code>in</code> is negative value and returns zero output for negative values. |
mturner5 | 0:b7116bd48af6 | 6131 | */ |
mturner5 | 0:b7116bd48af6 | 6132 | arm_status arm_sqrt_q31( |
mturner5 | 0:b7116bd48af6 | 6133 | q31_t in, |
mturner5 | 0:b7116bd48af6 | 6134 | q31_t * pOut); |
mturner5 | 0:b7116bd48af6 | 6135 | |
mturner5 | 0:b7116bd48af6 | 6136 | /** |
mturner5 | 0:b7116bd48af6 | 6137 | * @brief Q15 square root function. |
mturner5 | 0:b7116bd48af6 | 6138 | * @param[in] in input value. The range of the input value is [0 +1) or 0x0000 to 0x7FFF. |
mturner5 | 0:b7116bd48af6 | 6139 | * @param[out] *pOut square root of input value. |
mturner5 | 0:b7116bd48af6 | 6140 | * @return The function returns ARM_MATH_SUCCESS if input value is positive value or ARM_MATH_ARGUMENT_ERROR if |
mturner5 | 0:b7116bd48af6 | 6141 | * <code>in</code> is negative value and returns zero output for negative values. |
mturner5 | 0:b7116bd48af6 | 6142 | */ |
mturner5 | 0:b7116bd48af6 | 6143 | arm_status arm_sqrt_q15( |
mturner5 | 0:b7116bd48af6 | 6144 | q15_t in, |
mturner5 | 0:b7116bd48af6 | 6145 | q15_t * pOut); |
mturner5 | 0:b7116bd48af6 | 6146 | |
mturner5 | 0:b7116bd48af6 | 6147 | /** |
mturner5 | 0:b7116bd48af6 | 6148 | * @} end of SQRT group |
mturner5 | 0:b7116bd48af6 | 6149 | */ |
mturner5 | 0:b7116bd48af6 | 6150 | |
mturner5 | 0:b7116bd48af6 | 6151 | |
mturner5 | 0:b7116bd48af6 | 6152 | |
mturner5 | 0:b7116bd48af6 | 6153 | |
mturner5 | 0:b7116bd48af6 | 6154 | |
mturner5 | 0:b7116bd48af6 | 6155 | |
mturner5 | 0:b7116bd48af6 | 6156 | /** |
mturner5 | 0:b7116bd48af6 | 6157 | * @brief floating-point Circular write function. |
mturner5 | 0:b7116bd48af6 | 6158 | */ |
mturner5 | 0:b7116bd48af6 | 6159 | |
mturner5 | 0:b7116bd48af6 | 6160 | static __INLINE void arm_circularWrite_f32( |
mturner5 | 0:b7116bd48af6 | 6161 | int32_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6162 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6163 | uint16_t * writeOffset, |
mturner5 | 0:b7116bd48af6 | 6164 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6165 | const int32_t * src, |
mturner5 | 0:b7116bd48af6 | 6166 | int32_t srcInc, |
mturner5 | 0:b7116bd48af6 | 6167 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6168 | { |
mturner5 | 0:b7116bd48af6 | 6169 | uint32_t i = 0u; |
mturner5 | 0:b7116bd48af6 | 6170 | int32_t wOffset; |
mturner5 | 0:b7116bd48af6 | 6171 | |
mturner5 | 0:b7116bd48af6 | 6172 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6173 | * to the current location where the input samples to be copied */ |
mturner5 | 0:b7116bd48af6 | 6174 | wOffset = *writeOffset; |
mturner5 | 0:b7116bd48af6 | 6175 | |
mturner5 | 0:b7116bd48af6 | 6176 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6177 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6178 | |
mturner5 | 0:b7116bd48af6 | 6179 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6180 | { |
mturner5 | 0:b7116bd48af6 | 6181 | /* copy the input sample to the circular buffer */ |
mturner5 | 0:b7116bd48af6 | 6182 | circBuffer[wOffset] = *src; |
mturner5 | 0:b7116bd48af6 | 6183 | |
mturner5 | 0:b7116bd48af6 | 6184 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6185 | src += srcInc; |
mturner5 | 0:b7116bd48af6 | 6186 | |
mturner5 | 0:b7116bd48af6 | 6187 | /* Circularly update wOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6188 | wOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6189 | if(wOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6190 | wOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6191 | |
mturner5 | 0:b7116bd48af6 | 6192 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6193 | i--; |
mturner5 | 0:b7116bd48af6 | 6194 | } |
mturner5 | 0:b7116bd48af6 | 6195 | |
mturner5 | 0:b7116bd48af6 | 6196 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6197 | *writeOffset = wOffset; |
mturner5 | 0:b7116bd48af6 | 6198 | } |
mturner5 | 0:b7116bd48af6 | 6199 | |
mturner5 | 0:b7116bd48af6 | 6200 | |
mturner5 | 0:b7116bd48af6 | 6201 | |
mturner5 | 0:b7116bd48af6 | 6202 | /** |
mturner5 | 0:b7116bd48af6 | 6203 | * @brief floating-point Circular Read function. |
mturner5 | 0:b7116bd48af6 | 6204 | */ |
mturner5 | 0:b7116bd48af6 | 6205 | static __INLINE void arm_circularRead_f32( |
mturner5 | 0:b7116bd48af6 | 6206 | int32_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6207 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6208 | int32_t * readOffset, |
mturner5 | 0:b7116bd48af6 | 6209 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6210 | int32_t * dst, |
mturner5 | 0:b7116bd48af6 | 6211 | int32_t * dst_base, |
mturner5 | 0:b7116bd48af6 | 6212 | int32_t dst_length, |
mturner5 | 0:b7116bd48af6 | 6213 | int32_t dstInc, |
mturner5 | 0:b7116bd48af6 | 6214 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6215 | { |
mturner5 | 0:b7116bd48af6 | 6216 | uint32_t i = 0u; |
mturner5 | 0:b7116bd48af6 | 6217 | int32_t rOffset, dst_end; |
mturner5 | 0:b7116bd48af6 | 6218 | |
mturner5 | 0:b7116bd48af6 | 6219 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6220 | * to the current location from where the input samples to be read */ |
mturner5 | 0:b7116bd48af6 | 6221 | rOffset = *readOffset; |
mturner5 | 0:b7116bd48af6 | 6222 | dst_end = (int32_t) (dst_base + dst_length); |
mturner5 | 0:b7116bd48af6 | 6223 | |
mturner5 | 0:b7116bd48af6 | 6224 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6225 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6226 | |
mturner5 | 0:b7116bd48af6 | 6227 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6228 | { |
mturner5 | 0:b7116bd48af6 | 6229 | /* copy the sample from the circular buffer to the destination buffer */ |
mturner5 | 0:b7116bd48af6 | 6230 | *dst = circBuffer[rOffset]; |
mturner5 | 0:b7116bd48af6 | 6231 | |
mturner5 | 0:b7116bd48af6 | 6232 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6233 | dst += dstInc; |
mturner5 | 0:b7116bd48af6 | 6234 | |
mturner5 | 0:b7116bd48af6 | 6235 | if(dst == (int32_t *) dst_end) |
mturner5 | 0:b7116bd48af6 | 6236 | { |
mturner5 | 0:b7116bd48af6 | 6237 | dst = dst_base; |
mturner5 | 0:b7116bd48af6 | 6238 | } |
mturner5 | 0:b7116bd48af6 | 6239 | |
mturner5 | 0:b7116bd48af6 | 6240 | /* Circularly update rOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6241 | rOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6242 | |
mturner5 | 0:b7116bd48af6 | 6243 | if(rOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6244 | { |
mturner5 | 0:b7116bd48af6 | 6245 | rOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6246 | } |
mturner5 | 0:b7116bd48af6 | 6247 | |
mturner5 | 0:b7116bd48af6 | 6248 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6249 | i--; |
mturner5 | 0:b7116bd48af6 | 6250 | } |
mturner5 | 0:b7116bd48af6 | 6251 | |
mturner5 | 0:b7116bd48af6 | 6252 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6253 | *readOffset = rOffset; |
mturner5 | 0:b7116bd48af6 | 6254 | } |
mturner5 | 0:b7116bd48af6 | 6255 | |
mturner5 | 0:b7116bd48af6 | 6256 | /** |
mturner5 | 0:b7116bd48af6 | 6257 | * @brief Q15 Circular write function. |
mturner5 | 0:b7116bd48af6 | 6258 | */ |
mturner5 | 0:b7116bd48af6 | 6259 | |
mturner5 | 0:b7116bd48af6 | 6260 | static __INLINE void arm_circularWrite_q15( |
mturner5 | 0:b7116bd48af6 | 6261 | q15_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6262 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6263 | uint16_t * writeOffset, |
mturner5 | 0:b7116bd48af6 | 6264 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6265 | const q15_t * src, |
mturner5 | 0:b7116bd48af6 | 6266 | int32_t srcInc, |
mturner5 | 0:b7116bd48af6 | 6267 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6268 | { |
mturner5 | 0:b7116bd48af6 | 6269 | uint32_t i = 0u; |
mturner5 | 0:b7116bd48af6 | 6270 | int32_t wOffset; |
mturner5 | 0:b7116bd48af6 | 6271 | |
mturner5 | 0:b7116bd48af6 | 6272 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6273 | * to the current location where the input samples to be copied */ |
mturner5 | 0:b7116bd48af6 | 6274 | wOffset = *writeOffset; |
mturner5 | 0:b7116bd48af6 | 6275 | |
mturner5 | 0:b7116bd48af6 | 6276 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6277 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6278 | |
mturner5 | 0:b7116bd48af6 | 6279 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6280 | { |
mturner5 | 0:b7116bd48af6 | 6281 | /* copy the input sample to the circular buffer */ |
mturner5 | 0:b7116bd48af6 | 6282 | circBuffer[wOffset] = *src; |
mturner5 | 0:b7116bd48af6 | 6283 | |
mturner5 | 0:b7116bd48af6 | 6284 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6285 | src += srcInc; |
mturner5 | 0:b7116bd48af6 | 6286 | |
mturner5 | 0:b7116bd48af6 | 6287 | /* Circularly update wOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6288 | wOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6289 | if(wOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6290 | wOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6291 | |
mturner5 | 0:b7116bd48af6 | 6292 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6293 | i--; |
mturner5 | 0:b7116bd48af6 | 6294 | } |
mturner5 | 0:b7116bd48af6 | 6295 | |
mturner5 | 0:b7116bd48af6 | 6296 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6297 | *writeOffset = wOffset; |
mturner5 | 0:b7116bd48af6 | 6298 | } |
mturner5 | 0:b7116bd48af6 | 6299 | |
mturner5 | 0:b7116bd48af6 | 6300 | |
mturner5 | 0:b7116bd48af6 | 6301 | |
mturner5 | 0:b7116bd48af6 | 6302 | /** |
mturner5 | 0:b7116bd48af6 | 6303 | * @brief Q15 Circular Read function. |
mturner5 | 0:b7116bd48af6 | 6304 | */ |
mturner5 | 0:b7116bd48af6 | 6305 | static __INLINE void arm_circularRead_q15( |
mturner5 | 0:b7116bd48af6 | 6306 | q15_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6307 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6308 | int32_t * readOffset, |
mturner5 | 0:b7116bd48af6 | 6309 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6310 | q15_t * dst, |
mturner5 | 0:b7116bd48af6 | 6311 | q15_t * dst_base, |
mturner5 | 0:b7116bd48af6 | 6312 | int32_t dst_length, |
mturner5 | 0:b7116bd48af6 | 6313 | int32_t dstInc, |
mturner5 | 0:b7116bd48af6 | 6314 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6315 | { |
mturner5 | 0:b7116bd48af6 | 6316 | uint32_t i = 0; |
mturner5 | 0:b7116bd48af6 | 6317 | int32_t rOffset, dst_end; |
mturner5 | 0:b7116bd48af6 | 6318 | |
mturner5 | 0:b7116bd48af6 | 6319 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6320 | * to the current location from where the input samples to be read */ |
mturner5 | 0:b7116bd48af6 | 6321 | rOffset = *readOffset; |
mturner5 | 0:b7116bd48af6 | 6322 | |
mturner5 | 0:b7116bd48af6 | 6323 | dst_end = (int32_t) (dst_base + dst_length); |
mturner5 | 0:b7116bd48af6 | 6324 | |
mturner5 | 0:b7116bd48af6 | 6325 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6326 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6327 | |
mturner5 | 0:b7116bd48af6 | 6328 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6329 | { |
mturner5 | 0:b7116bd48af6 | 6330 | /* copy the sample from the circular buffer to the destination buffer */ |
mturner5 | 0:b7116bd48af6 | 6331 | *dst = circBuffer[rOffset]; |
mturner5 | 0:b7116bd48af6 | 6332 | |
mturner5 | 0:b7116bd48af6 | 6333 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6334 | dst += dstInc; |
mturner5 | 0:b7116bd48af6 | 6335 | |
mturner5 | 0:b7116bd48af6 | 6336 | if(dst == (q15_t *) dst_end) |
mturner5 | 0:b7116bd48af6 | 6337 | { |
mturner5 | 0:b7116bd48af6 | 6338 | dst = dst_base; |
mturner5 | 0:b7116bd48af6 | 6339 | } |
mturner5 | 0:b7116bd48af6 | 6340 | |
mturner5 | 0:b7116bd48af6 | 6341 | /* Circularly update wOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6342 | rOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6343 | |
mturner5 | 0:b7116bd48af6 | 6344 | if(rOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6345 | { |
mturner5 | 0:b7116bd48af6 | 6346 | rOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6347 | } |
mturner5 | 0:b7116bd48af6 | 6348 | |
mturner5 | 0:b7116bd48af6 | 6349 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6350 | i--; |
mturner5 | 0:b7116bd48af6 | 6351 | } |
mturner5 | 0:b7116bd48af6 | 6352 | |
mturner5 | 0:b7116bd48af6 | 6353 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6354 | *readOffset = rOffset; |
mturner5 | 0:b7116bd48af6 | 6355 | } |
mturner5 | 0:b7116bd48af6 | 6356 | |
mturner5 | 0:b7116bd48af6 | 6357 | |
mturner5 | 0:b7116bd48af6 | 6358 | /** |
mturner5 | 0:b7116bd48af6 | 6359 | * @brief Q7 Circular write function. |
mturner5 | 0:b7116bd48af6 | 6360 | */ |
mturner5 | 0:b7116bd48af6 | 6361 | |
mturner5 | 0:b7116bd48af6 | 6362 | static __INLINE void arm_circularWrite_q7( |
mturner5 | 0:b7116bd48af6 | 6363 | q7_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6364 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6365 | uint16_t * writeOffset, |
mturner5 | 0:b7116bd48af6 | 6366 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6367 | const q7_t * src, |
mturner5 | 0:b7116bd48af6 | 6368 | int32_t srcInc, |
mturner5 | 0:b7116bd48af6 | 6369 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6370 | { |
mturner5 | 0:b7116bd48af6 | 6371 | uint32_t i = 0u; |
mturner5 | 0:b7116bd48af6 | 6372 | int32_t wOffset; |
mturner5 | 0:b7116bd48af6 | 6373 | |
mturner5 | 0:b7116bd48af6 | 6374 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6375 | * to the current location where the input samples to be copied */ |
mturner5 | 0:b7116bd48af6 | 6376 | wOffset = *writeOffset; |
mturner5 | 0:b7116bd48af6 | 6377 | |
mturner5 | 0:b7116bd48af6 | 6378 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6379 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6380 | |
mturner5 | 0:b7116bd48af6 | 6381 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6382 | { |
mturner5 | 0:b7116bd48af6 | 6383 | /* copy the input sample to the circular buffer */ |
mturner5 | 0:b7116bd48af6 | 6384 | circBuffer[wOffset] = *src; |
mturner5 | 0:b7116bd48af6 | 6385 | |
mturner5 | 0:b7116bd48af6 | 6386 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6387 | src += srcInc; |
mturner5 | 0:b7116bd48af6 | 6388 | |
mturner5 | 0:b7116bd48af6 | 6389 | /* Circularly update wOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6390 | wOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6391 | if(wOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6392 | wOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6393 | |
mturner5 | 0:b7116bd48af6 | 6394 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6395 | i--; |
mturner5 | 0:b7116bd48af6 | 6396 | } |
mturner5 | 0:b7116bd48af6 | 6397 | |
mturner5 | 0:b7116bd48af6 | 6398 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6399 | *writeOffset = wOffset; |
mturner5 | 0:b7116bd48af6 | 6400 | } |
mturner5 | 0:b7116bd48af6 | 6401 | |
mturner5 | 0:b7116bd48af6 | 6402 | |
mturner5 | 0:b7116bd48af6 | 6403 | |
mturner5 | 0:b7116bd48af6 | 6404 | /** |
mturner5 | 0:b7116bd48af6 | 6405 | * @brief Q7 Circular Read function. |
mturner5 | 0:b7116bd48af6 | 6406 | */ |
mturner5 | 0:b7116bd48af6 | 6407 | static __INLINE void arm_circularRead_q7( |
mturner5 | 0:b7116bd48af6 | 6408 | q7_t * circBuffer, |
mturner5 | 0:b7116bd48af6 | 6409 | int32_t L, |
mturner5 | 0:b7116bd48af6 | 6410 | int32_t * readOffset, |
mturner5 | 0:b7116bd48af6 | 6411 | int32_t bufferInc, |
mturner5 | 0:b7116bd48af6 | 6412 | q7_t * dst, |
mturner5 | 0:b7116bd48af6 | 6413 | q7_t * dst_base, |
mturner5 | 0:b7116bd48af6 | 6414 | int32_t dst_length, |
mturner5 | 0:b7116bd48af6 | 6415 | int32_t dstInc, |
mturner5 | 0:b7116bd48af6 | 6416 | uint32_t blockSize) |
mturner5 | 0:b7116bd48af6 | 6417 | { |
mturner5 | 0:b7116bd48af6 | 6418 | uint32_t i = 0; |
mturner5 | 0:b7116bd48af6 | 6419 | int32_t rOffset, dst_end; |
mturner5 | 0:b7116bd48af6 | 6420 | |
mturner5 | 0:b7116bd48af6 | 6421 | /* Copy the value of Index pointer that points |
mturner5 | 0:b7116bd48af6 | 6422 | * to the current location from where the input samples to be read */ |
mturner5 | 0:b7116bd48af6 | 6423 | rOffset = *readOffset; |
mturner5 | 0:b7116bd48af6 | 6424 | |
mturner5 | 0:b7116bd48af6 | 6425 | dst_end = (int32_t) (dst_base + dst_length); |
mturner5 | 0:b7116bd48af6 | 6426 | |
mturner5 | 0:b7116bd48af6 | 6427 | /* Loop over the blockSize */ |
mturner5 | 0:b7116bd48af6 | 6428 | i = blockSize; |
mturner5 | 0:b7116bd48af6 | 6429 | |
mturner5 | 0:b7116bd48af6 | 6430 | while(i > 0u) |
mturner5 | 0:b7116bd48af6 | 6431 | { |
mturner5 | 0:b7116bd48af6 | 6432 | /* copy the sample from the circular buffer to the destination buffer */ |
mturner5 | 0:b7116bd48af6 | 6433 | *dst = circBuffer[rOffset]; |
mturner5 | 0:b7116bd48af6 | 6434 | |
mturner5 | 0:b7116bd48af6 | 6435 | /* Update the input pointer */ |
mturner5 | 0:b7116bd48af6 | 6436 | dst += dstInc; |
mturner5 | 0:b7116bd48af6 | 6437 | |
mturner5 | 0:b7116bd48af6 | 6438 | if(dst == (q7_t *) dst_end) |
mturner5 | 0:b7116bd48af6 | 6439 | { |
mturner5 | 0:b7116bd48af6 | 6440 | dst = dst_base; |
mturner5 | 0:b7116bd48af6 | 6441 | } |
mturner5 | 0:b7116bd48af6 | 6442 | |
mturner5 | 0:b7116bd48af6 | 6443 | /* Circularly update rOffset. Watch out for positive and negative value */ |
mturner5 | 0:b7116bd48af6 | 6444 | rOffset += bufferInc; |
mturner5 | 0:b7116bd48af6 | 6445 | |
mturner5 | 0:b7116bd48af6 | 6446 | if(rOffset >= L) |
mturner5 | 0:b7116bd48af6 | 6447 | { |
mturner5 | 0:b7116bd48af6 | 6448 | rOffset -= L; |
mturner5 | 0:b7116bd48af6 | 6449 | } |
mturner5 | 0:b7116bd48af6 | 6450 | |
mturner5 | 0:b7116bd48af6 | 6451 | /* Decrement the loop counter */ |
mturner5 | 0:b7116bd48af6 | 6452 | i--; |
mturner5 | 0:b7116bd48af6 | 6453 | } |
mturner5 | 0:b7116bd48af6 | 6454 | |
mturner5 | 0:b7116bd48af6 | 6455 | /* Update the index pointer */ |
mturner5 | 0:b7116bd48af6 | 6456 | *readOffset = rOffset; |
mturner5 | 0:b7116bd48af6 | 6457 | } |
mturner5 | 0:b7116bd48af6 | 6458 | |
mturner5 | 0:b7116bd48af6 | 6459 | |
mturner5 | 0:b7116bd48af6 | 6460 | /** |
mturner5 | 0:b7116bd48af6 | 6461 | * @brief Sum of the squares of the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6462 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6463 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6464 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6465 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6466 | */ |
mturner5 | 0:b7116bd48af6 | 6467 | |
mturner5 | 0:b7116bd48af6 | 6468 | void arm_power_q31( |
mturner5 | 0:b7116bd48af6 | 6469 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6470 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6471 | q63_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6472 | |
mturner5 | 0:b7116bd48af6 | 6473 | /** |
mturner5 | 0:b7116bd48af6 | 6474 | * @brief Sum of the squares of the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6475 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6476 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6477 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6478 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6479 | */ |
mturner5 | 0:b7116bd48af6 | 6480 | |
mturner5 | 0:b7116bd48af6 | 6481 | void arm_power_f32( |
mturner5 | 0:b7116bd48af6 | 6482 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6483 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6484 | float32_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6485 | |
mturner5 | 0:b7116bd48af6 | 6486 | /** |
mturner5 | 0:b7116bd48af6 | 6487 | * @brief Sum of the squares of the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6488 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6489 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6490 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6491 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6492 | */ |
mturner5 | 0:b7116bd48af6 | 6493 | |
mturner5 | 0:b7116bd48af6 | 6494 | void arm_power_q15( |
mturner5 | 0:b7116bd48af6 | 6495 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6496 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6497 | q63_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6498 | |
mturner5 | 0:b7116bd48af6 | 6499 | /** |
mturner5 | 0:b7116bd48af6 | 6500 | * @brief Sum of the squares of the elements of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 6501 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6502 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6503 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6504 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6505 | */ |
mturner5 | 0:b7116bd48af6 | 6506 | |
mturner5 | 0:b7116bd48af6 | 6507 | void arm_power_q7( |
mturner5 | 0:b7116bd48af6 | 6508 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6509 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6510 | q31_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6511 | |
mturner5 | 0:b7116bd48af6 | 6512 | /** |
mturner5 | 0:b7116bd48af6 | 6513 | * @brief Mean value of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 6514 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6515 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6516 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6517 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6518 | */ |
mturner5 | 0:b7116bd48af6 | 6519 | |
mturner5 | 0:b7116bd48af6 | 6520 | void arm_mean_q7( |
mturner5 | 0:b7116bd48af6 | 6521 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6522 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6523 | q7_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6524 | |
mturner5 | 0:b7116bd48af6 | 6525 | /** |
mturner5 | 0:b7116bd48af6 | 6526 | * @brief Mean value of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6527 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6528 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6529 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6530 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6531 | */ |
mturner5 | 0:b7116bd48af6 | 6532 | void arm_mean_q15( |
mturner5 | 0:b7116bd48af6 | 6533 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6534 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6535 | q15_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6536 | |
mturner5 | 0:b7116bd48af6 | 6537 | /** |
mturner5 | 0:b7116bd48af6 | 6538 | * @brief Mean value of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6539 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6540 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6541 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6542 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6543 | */ |
mturner5 | 0:b7116bd48af6 | 6544 | void arm_mean_q31( |
mturner5 | 0:b7116bd48af6 | 6545 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6546 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6547 | q31_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6548 | |
mturner5 | 0:b7116bd48af6 | 6549 | /** |
mturner5 | 0:b7116bd48af6 | 6550 | * @brief Mean value of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6551 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6552 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6553 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6554 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6555 | */ |
mturner5 | 0:b7116bd48af6 | 6556 | void arm_mean_f32( |
mturner5 | 0:b7116bd48af6 | 6557 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6558 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6559 | float32_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6560 | |
mturner5 | 0:b7116bd48af6 | 6561 | /** |
mturner5 | 0:b7116bd48af6 | 6562 | * @brief Variance of the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6563 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6564 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6565 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6566 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6567 | */ |
mturner5 | 0:b7116bd48af6 | 6568 | |
mturner5 | 0:b7116bd48af6 | 6569 | void arm_var_f32( |
mturner5 | 0:b7116bd48af6 | 6570 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6571 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6572 | float32_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6573 | |
mturner5 | 0:b7116bd48af6 | 6574 | /** |
mturner5 | 0:b7116bd48af6 | 6575 | * @brief Variance of the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6576 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6577 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6578 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6579 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6580 | */ |
mturner5 | 0:b7116bd48af6 | 6581 | |
mturner5 | 0:b7116bd48af6 | 6582 | void arm_var_q31( |
mturner5 | 0:b7116bd48af6 | 6583 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6584 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6585 | q31_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6586 | |
mturner5 | 0:b7116bd48af6 | 6587 | /** |
mturner5 | 0:b7116bd48af6 | 6588 | * @brief Variance of the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6589 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6590 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6591 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6592 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6593 | */ |
mturner5 | 0:b7116bd48af6 | 6594 | |
mturner5 | 0:b7116bd48af6 | 6595 | void arm_var_q15( |
mturner5 | 0:b7116bd48af6 | 6596 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6597 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6598 | q15_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6599 | |
mturner5 | 0:b7116bd48af6 | 6600 | /** |
mturner5 | 0:b7116bd48af6 | 6601 | * @brief Root Mean Square of the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6602 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6603 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6604 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6605 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6606 | */ |
mturner5 | 0:b7116bd48af6 | 6607 | |
mturner5 | 0:b7116bd48af6 | 6608 | void arm_rms_f32( |
mturner5 | 0:b7116bd48af6 | 6609 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6610 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6611 | float32_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6612 | |
mturner5 | 0:b7116bd48af6 | 6613 | /** |
mturner5 | 0:b7116bd48af6 | 6614 | * @brief Root Mean Square of the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6615 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6616 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6617 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6618 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6619 | */ |
mturner5 | 0:b7116bd48af6 | 6620 | |
mturner5 | 0:b7116bd48af6 | 6621 | void arm_rms_q31( |
mturner5 | 0:b7116bd48af6 | 6622 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6623 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6624 | q31_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6625 | |
mturner5 | 0:b7116bd48af6 | 6626 | /** |
mturner5 | 0:b7116bd48af6 | 6627 | * @brief Root Mean Square of the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6628 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6629 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6630 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6631 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6632 | */ |
mturner5 | 0:b7116bd48af6 | 6633 | |
mturner5 | 0:b7116bd48af6 | 6634 | void arm_rms_q15( |
mturner5 | 0:b7116bd48af6 | 6635 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6636 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6637 | q15_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6638 | |
mturner5 | 0:b7116bd48af6 | 6639 | /** |
mturner5 | 0:b7116bd48af6 | 6640 | * @brief Standard deviation of the elements of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6641 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6642 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6643 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6644 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6645 | */ |
mturner5 | 0:b7116bd48af6 | 6646 | |
mturner5 | 0:b7116bd48af6 | 6647 | void arm_std_f32( |
mturner5 | 0:b7116bd48af6 | 6648 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6649 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6650 | float32_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6651 | |
mturner5 | 0:b7116bd48af6 | 6652 | /** |
mturner5 | 0:b7116bd48af6 | 6653 | * @brief Standard deviation of the elements of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6654 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6655 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6656 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6657 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6658 | */ |
mturner5 | 0:b7116bd48af6 | 6659 | |
mturner5 | 0:b7116bd48af6 | 6660 | void arm_std_q31( |
mturner5 | 0:b7116bd48af6 | 6661 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6662 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6663 | q31_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6664 | |
mturner5 | 0:b7116bd48af6 | 6665 | /** |
mturner5 | 0:b7116bd48af6 | 6666 | * @brief Standard deviation of the elements of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6667 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6668 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6669 | * @param[out] *pResult is output value. |
mturner5 | 0:b7116bd48af6 | 6670 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6671 | */ |
mturner5 | 0:b7116bd48af6 | 6672 | |
mturner5 | 0:b7116bd48af6 | 6673 | void arm_std_q15( |
mturner5 | 0:b7116bd48af6 | 6674 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6675 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6676 | q15_t * pResult); |
mturner5 | 0:b7116bd48af6 | 6677 | |
mturner5 | 0:b7116bd48af6 | 6678 | /** |
mturner5 | 0:b7116bd48af6 | 6679 | * @brief Floating-point complex magnitude |
mturner5 | 0:b7116bd48af6 | 6680 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6681 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 6682 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 6683 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6684 | */ |
mturner5 | 0:b7116bd48af6 | 6685 | |
mturner5 | 0:b7116bd48af6 | 6686 | void arm_cmplx_mag_f32( |
mturner5 | 0:b7116bd48af6 | 6687 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6688 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6689 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6690 | |
mturner5 | 0:b7116bd48af6 | 6691 | /** |
mturner5 | 0:b7116bd48af6 | 6692 | * @brief Q31 complex magnitude |
mturner5 | 0:b7116bd48af6 | 6693 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6694 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 6695 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 6696 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6697 | */ |
mturner5 | 0:b7116bd48af6 | 6698 | |
mturner5 | 0:b7116bd48af6 | 6699 | void arm_cmplx_mag_q31( |
mturner5 | 0:b7116bd48af6 | 6700 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6701 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6702 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6703 | |
mturner5 | 0:b7116bd48af6 | 6704 | /** |
mturner5 | 0:b7116bd48af6 | 6705 | * @brief Q15 complex magnitude |
mturner5 | 0:b7116bd48af6 | 6706 | * @param[in] *pSrc points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6707 | * @param[out] *pDst points to the real output vector |
mturner5 | 0:b7116bd48af6 | 6708 | * @param[in] numSamples number of complex samples in the input vector |
mturner5 | 0:b7116bd48af6 | 6709 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6710 | */ |
mturner5 | 0:b7116bd48af6 | 6711 | |
mturner5 | 0:b7116bd48af6 | 6712 | void arm_cmplx_mag_q15( |
mturner5 | 0:b7116bd48af6 | 6713 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6714 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6715 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6716 | |
mturner5 | 0:b7116bd48af6 | 6717 | /** |
mturner5 | 0:b7116bd48af6 | 6718 | * @brief Q15 complex dot product |
mturner5 | 0:b7116bd48af6 | 6719 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6720 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6721 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6722 | * @param[out] *realResult real part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6723 | * @param[out] *imagResult imaginary part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6724 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6725 | */ |
mturner5 | 0:b7116bd48af6 | 6726 | |
mturner5 | 0:b7116bd48af6 | 6727 | void arm_cmplx_dot_prod_q15( |
mturner5 | 0:b7116bd48af6 | 6728 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6729 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6730 | uint32_t numSamples, |
mturner5 | 0:b7116bd48af6 | 6731 | q31_t * realResult, |
mturner5 | 0:b7116bd48af6 | 6732 | q31_t * imagResult); |
mturner5 | 0:b7116bd48af6 | 6733 | |
mturner5 | 0:b7116bd48af6 | 6734 | /** |
mturner5 | 0:b7116bd48af6 | 6735 | * @brief Q31 complex dot product |
mturner5 | 0:b7116bd48af6 | 6736 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6737 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6738 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6739 | * @param[out] *realResult real part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6740 | * @param[out] *imagResult imaginary part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6741 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6742 | */ |
mturner5 | 0:b7116bd48af6 | 6743 | |
mturner5 | 0:b7116bd48af6 | 6744 | void arm_cmplx_dot_prod_q31( |
mturner5 | 0:b7116bd48af6 | 6745 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6746 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6747 | uint32_t numSamples, |
mturner5 | 0:b7116bd48af6 | 6748 | q63_t * realResult, |
mturner5 | 0:b7116bd48af6 | 6749 | q63_t * imagResult); |
mturner5 | 0:b7116bd48af6 | 6750 | |
mturner5 | 0:b7116bd48af6 | 6751 | /** |
mturner5 | 0:b7116bd48af6 | 6752 | * @brief Floating-point complex dot product |
mturner5 | 0:b7116bd48af6 | 6753 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6754 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6755 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6756 | * @param[out] *realResult real part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6757 | * @param[out] *imagResult imaginary part of the result returned here |
mturner5 | 0:b7116bd48af6 | 6758 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6759 | */ |
mturner5 | 0:b7116bd48af6 | 6760 | |
mturner5 | 0:b7116bd48af6 | 6761 | void arm_cmplx_dot_prod_f32( |
mturner5 | 0:b7116bd48af6 | 6762 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6763 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6764 | uint32_t numSamples, |
mturner5 | 0:b7116bd48af6 | 6765 | float32_t * realResult, |
mturner5 | 0:b7116bd48af6 | 6766 | float32_t * imagResult); |
mturner5 | 0:b7116bd48af6 | 6767 | |
mturner5 | 0:b7116bd48af6 | 6768 | /** |
mturner5 | 0:b7116bd48af6 | 6769 | * @brief Q15 complex-by-real multiplication |
mturner5 | 0:b7116bd48af6 | 6770 | * @param[in] *pSrcCmplx points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6771 | * @param[in] *pSrcReal points to the real input vector |
mturner5 | 0:b7116bd48af6 | 6772 | * @param[out] *pCmplxDst points to the complex output vector |
mturner5 | 0:b7116bd48af6 | 6773 | * @param[in] numSamples number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 6774 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6775 | */ |
mturner5 | 0:b7116bd48af6 | 6776 | |
mturner5 | 0:b7116bd48af6 | 6777 | void arm_cmplx_mult_real_q15( |
mturner5 | 0:b7116bd48af6 | 6778 | q15_t * pSrcCmplx, |
mturner5 | 0:b7116bd48af6 | 6779 | q15_t * pSrcReal, |
mturner5 | 0:b7116bd48af6 | 6780 | q15_t * pCmplxDst, |
mturner5 | 0:b7116bd48af6 | 6781 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6782 | |
mturner5 | 0:b7116bd48af6 | 6783 | /** |
mturner5 | 0:b7116bd48af6 | 6784 | * @brief Q31 complex-by-real multiplication |
mturner5 | 0:b7116bd48af6 | 6785 | * @param[in] *pSrcCmplx points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6786 | * @param[in] *pSrcReal points to the real input vector |
mturner5 | 0:b7116bd48af6 | 6787 | * @param[out] *pCmplxDst points to the complex output vector |
mturner5 | 0:b7116bd48af6 | 6788 | * @param[in] numSamples number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 6789 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6790 | */ |
mturner5 | 0:b7116bd48af6 | 6791 | |
mturner5 | 0:b7116bd48af6 | 6792 | void arm_cmplx_mult_real_q31( |
mturner5 | 0:b7116bd48af6 | 6793 | q31_t * pSrcCmplx, |
mturner5 | 0:b7116bd48af6 | 6794 | q31_t * pSrcReal, |
mturner5 | 0:b7116bd48af6 | 6795 | q31_t * pCmplxDst, |
mturner5 | 0:b7116bd48af6 | 6796 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6797 | |
mturner5 | 0:b7116bd48af6 | 6798 | /** |
mturner5 | 0:b7116bd48af6 | 6799 | * @brief Floating-point complex-by-real multiplication |
mturner5 | 0:b7116bd48af6 | 6800 | * @param[in] *pSrcCmplx points to the complex input vector |
mturner5 | 0:b7116bd48af6 | 6801 | * @param[in] *pSrcReal points to the real input vector |
mturner5 | 0:b7116bd48af6 | 6802 | * @param[out] *pCmplxDst points to the complex output vector |
mturner5 | 0:b7116bd48af6 | 6803 | * @param[in] numSamples number of samples in each vector |
mturner5 | 0:b7116bd48af6 | 6804 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6805 | */ |
mturner5 | 0:b7116bd48af6 | 6806 | |
mturner5 | 0:b7116bd48af6 | 6807 | void arm_cmplx_mult_real_f32( |
mturner5 | 0:b7116bd48af6 | 6808 | float32_t * pSrcCmplx, |
mturner5 | 0:b7116bd48af6 | 6809 | float32_t * pSrcReal, |
mturner5 | 0:b7116bd48af6 | 6810 | float32_t * pCmplxDst, |
mturner5 | 0:b7116bd48af6 | 6811 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6812 | |
mturner5 | 0:b7116bd48af6 | 6813 | /** |
mturner5 | 0:b7116bd48af6 | 6814 | * @brief Minimum value of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 6815 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6816 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6817 | * @param[out] *result is output pointer |
mturner5 | 0:b7116bd48af6 | 6818 | * @param[in] index is the array index of the minimum value in the input buffer. |
mturner5 | 0:b7116bd48af6 | 6819 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6820 | */ |
mturner5 | 0:b7116bd48af6 | 6821 | |
mturner5 | 0:b7116bd48af6 | 6822 | void arm_min_q7( |
mturner5 | 0:b7116bd48af6 | 6823 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6824 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6825 | q7_t * result, |
mturner5 | 0:b7116bd48af6 | 6826 | uint32_t * index); |
mturner5 | 0:b7116bd48af6 | 6827 | |
mturner5 | 0:b7116bd48af6 | 6828 | /** |
mturner5 | 0:b7116bd48af6 | 6829 | * @brief Minimum value of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6830 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6831 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6832 | * @param[out] *pResult is output pointer |
mturner5 | 0:b7116bd48af6 | 6833 | * @param[in] *pIndex is the array index of the minimum value in the input buffer. |
mturner5 | 0:b7116bd48af6 | 6834 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6835 | */ |
mturner5 | 0:b7116bd48af6 | 6836 | |
mturner5 | 0:b7116bd48af6 | 6837 | void arm_min_q15( |
mturner5 | 0:b7116bd48af6 | 6838 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6839 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6840 | q15_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6841 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6842 | |
mturner5 | 0:b7116bd48af6 | 6843 | /** |
mturner5 | 0:b7116bd48af6 | 6844 | * @brief Minimum value of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6845 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6846 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6847 | * @param[out] *pResult is output pointer |
mturner5 | 0:b7116bd48af6 | 6848 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
mturner5 | 0:b7116bd48af6 | 6849 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6850 | */ |
mturner5 | 0:b7116bd48af6 | 6851 | void arm_min_q31( |
mturner5 | 0:b7116bd48af6 | 6852 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6853 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6854 | q31_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6855 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6856 | |
mturner5 | 0:b7116bd48af6 | 6857 | /** |
mturner5 | 0:b7116bd48af6 | 6858 | * @brief Minimum value of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6859 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 6860 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 6861 | * @param[out] *pResult is output pointer |
mturner5 | 0:b7116bd48af6 | 6862 | * @param[out] *pIndex is the array index of the minimum value in the input buffer. |
mturner5 | 0:b7116bd48af6 | 6863 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6864 | */ |
mturner5 | 0:b7116bd48af6 | 6865 | |
mturner5 | 0:b7116bd48af6 | 6866 | void arm_min_f32( |
mturner5 | 0:b7116bd48af6 | 6867 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6868 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6869 | float32_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6870 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6871 | |
mturner5 | 0:b7116bd48af6 | 6872 | /** |
mturner5 | 0:b7116bd48af6 | 6873 | * @brief Maximum value of a Q7 vector. |
mturner5 | 0:b7116bd48af6 | 6874 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 6875 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6876 | * @param[out] *pResult maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6877 | * @param[out] *pIndex index of maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6878 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6879 | */ |
mturner5 | 0:b7116bd48af6 | 6880 | |
mturner5 | 0:b7116bd48af6 | 6881 | void arm_max_q7( |
mturner5 | 0:b7116bd48af6 | 6882 | q7_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6883 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6884 | q7_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6885 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6886 | |
mturner5 | 0:b7116bd48af6 | 6887 | /** |
mturner5 | 0:b7116bd48af6 | 6888 | * @brief Maximum value of a Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6889 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 6890 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6891 | * @param[out] *pResult maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6892 | * @param[out] *pIndex index of maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6893 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6894 | */ |
mturner5 | 0:b7116bd48af6 | 6895 | |
mturner5 | 0:b7116bd48af6 | 6896 | void arm_max_q15( |
mturner5 | 0:b7116bd48af6 | 6897 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6898 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6899 | q15_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6900 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6901 | |
mturner5 | 0:b7116bd48af6 | 6902 | /** |
mturner5 | 0:b7116bd48af6 | 6903 | * @brief Maximum value of a Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6904 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 6905 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6906 | * @param[out] *pResult maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6907 | * @param[out] *pIndex index of maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6908 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6909 | */ |
mturner5 | 0:b7116bd48af6 | 6910 | |
mturner5 | 0:b7116bd48af6 | 6911 | void arm_max_q31( |
mturner5 | 0:b7116bd48af6 | 6912 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6913 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6914 | q31_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6915 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6916 | |
mturner5 | 0:b7116bd48af6 | 6917 | /** |
mturner5 | 0:b7116bd48af6 | 6918 | * @brief Maximum value of a floating-point vector. |
mturner5 | 0:b7116bd48af6 | 6919 | * @param[in] *pSrc points to the input buffer |
mturner5 | 0:b7116bd48af6 | 6920 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6921 | * @param[out] *pResult maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6922 | * @param[out] *pIndex index of maximum value returned here |
mturner5 | 0:b7116bd48af6 | 6923 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6924 | */ |
mturner5 | 0:b7116bd48af6 | 6925 | |
mturner5 | 0:b7116bd48af6 | 6926 | void arm_max_f32( |
mturner5 | 0:b7116bd48af6 | 6927 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6928 | uint32_t blockSize, |
mturner5 | 0:b7116bd48af6 | 6929 | float32_t * pResult, |
mturner5 | 0:b7116bd48af6 | 6930 | uint32_t * pIndex); |
mturner5 | 0:b7116bd48af6 | 6931 | |
mturner5 | 0:b7116bd48af6 | 6932 | /** |
mturner5 | 0:b7116bd48af6 | 6933 | * @brief Q15 complex-by-complex multiplication |
mturner5 | 0:b7116bd48af6 | 6934 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6935 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6936 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 6937 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6938 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6939 | */ |
mturner5 | 0:b7116bd48af6 | 6940 | |
mturner5 | 0:b7116bd48af6 | 6941 | void arm_cmplx_mult_cmplx_q15( |
mturner5 | 0:b7116bd48af6 | 6942 | q15_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6943 | q15_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6944 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6945 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6946 | |
mturner5 | 0:b7116bd48af6 | 6947 | /** |
mturner5 | 0:b7116bd48af6 | 6948 | * @brief Q31 complex-by-complex multiplication |
mturner5 | 0:b7116bd48af6 | 6949 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6950 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6951 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 6952 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6953 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6954 | */ |
mturner5 | 0:b7116bd48af6 | 6955 | |
mturner5 | 0:b7116bd48af6 | 6956 | void arm_cmplx_mult_cmplx_q31( |
mturner5 | 0:b7116bd48af6 | 6957 | q31_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6958 | q31_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6959 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6960 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6961 | |
mturner5 | 0:b7116bd48af6 | 6962 | /** |
mturner5 | 0:b7116bd48af6 | 6963 | * @brief Floating-point complex-by-complex multiplication |
mturner5 | 0:b7116bd48af6 | 6964 | * @param[in] *pSrcA points to the first input vector |
mturner5 | 0:b7116bd48af6 | 6965 | * @param[in] *pSrcB points to the second input vector |
mturner5 | 0:b7116bd48af6 | 6966 | * @param[out] *pDst points to the output vector |
mturner5 | 0:b7116bd48af6 | 6967 | * @param[in] numSamples number of complex samples in each vector |
mturner5 | 0:b7116bd48af6 | 6968 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6969 | */ |
mturner5 | 0:b7116bd48af6 | 6970 | |
mturner5 | 0:b7116bd48af6 | 6971 | void arm_cmplx_mult_cmplx_f32( |
mturner5 | 0:b7116bd48af6 | 6972 | float32_t * pSrcA, |
mturner5 | 0:b7116bd48af6 | 6973 | float32_t * pSrcB, |
mturner5 | 0:b7116bd48af6 | 6974 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6975 | uint32_t numSamples); |
mturner5 | 0:b7116bd48af6 | 6976 | |
mturner5 | 0:b7116bd48af6 | 6977 | /** |
mturner5 | 0:b7116bd48af6 | 6978 | * @brief Converts the elements of the floating-point vector to Q31 vector. |
mturner5 | 0:b7116bd48af6 | 6979 | * @param[in] *pSrc points to the floating-point input vector |
mturner5 | 0:b7116bd48af6 | 6980 | * @param[out] *pDst points to the Q31 output vector |
mturner5 | 0:b7116bd48af6 | 6981 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6982 | * @return none. |
mturner5 | 0:b7116bd48af6 | 6983 | */ |
mturner5 | 0:b7116bd48af6 | 6984 | void arm_float_to_q31( |
mturner5 | 0:b7116bd48af6 | 6985 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6986 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6987 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 6988 | |
mturner5 | 0:b7116bd48af6 | 6989 | /** |
mturner5 | 0:b7116bd48af6 | 6990 | * @brief Converts the elements of the floating-point vector to Q15 vector. |
mturner5 | 0:b7116bd48af6 | 6991 | * @param[in] *pSrc points to the floating-point input vector |
mturner5 | 0:b7116bd48af6 | 6992 | * @param[out] *pDst points to the Q15 output vector |
mturner5 | 0:b7116bd48af6 | 6993 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 6994 | * @return none |
mturner5 | 0:b7116bd48af6 | 6995 | */ |
mturner5 | 0:b7116bd48af6 | 6996 | void arm_float_to_q15( |
mturner5 | 0:b7116bd48af6 | 6997 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 6998 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 6999 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7000 | |
mturner5 | 0:b7116bd48af6 | 7001 | /** |
mturner5 | 0:b7116bd48af6 | 7002 | * @brief Converts the elements of the floating-point vector to Q7 vector. |
mturner5 | 0:b7116bd48af6 | 7003 | * @param[in] *pSrc points to the floating-point input vector |
mturner5 | 0:b7116bd48af6 | 7004 | * @param[out] *pDst points to the Q7 output vector |
mturner5 | 0:b7116bd48af6 | 7005 | * @param[in] blockSize length of the input vector |
mturner5 | 0:b7116bd48af6 | 7006 | * @return none |
mturner5 | 0:b7116bd48af6 | 7007 | */ |
mturner5 | 0:b7116bd48af6 | 7008 | void arm_float_to_q7( |
mturner5 | 0:b7116bd48af6 | 7009 | float32_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7010 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7011 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7012 | |
mturner5 | 0:b7116bd48af6 | 7013 | |
mturner5 | 0:b7116bd48af6 | 7014 | /** |
mturner5 | 0:b7116bd48af6 | 7015 | * @brief Converts the elements of the Q31 vector to Q15 vector. |
mturner5 | 0:b7116bd48af6 | 7016 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 7017 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 7018 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 7019 | * @return none. |
mturner5 | 0:b7116bd48af6 | 7020 | */ |
mturner5 | 0:b7116bd48af6 | 7021 | void arm_q31_to_q15( |
mturner5 | 0:b7116bd48af6 | 7022 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7023 | q15_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7024 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7025 | |
mturner5 | 0:b7116bd48af6 | 7026 | /** |
mturner5 | 0:b7116bd48af6 | 7027 | * @brief Converts the elements of the Q31 vector to Q7 vector. |
mturner5 | 0:b7116bd48af6 | 7028 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 7029 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 7030 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 7031 | * @return none. |
mturner5 | 0:b7116bd48af6 | 7032 | */ |
mturner5 | 0:b7116bd48af6 | 7033 | void arm_q31_to_q7( |
mturner5 | 0:b7116bd48af6 | 7034 | q31_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7035 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7036 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7037 | |
mturner5 | 0:b7116bd48af6 | 7038 | /** |
mturner5 | 0:b7116bd48af6 | 7039 | * @brief Converts the elements of the Q15 vector to floating-point vector. |
mturner5 | 0:b7116bd48af6 | 7040 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 7041 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 7042 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 7043 | * @return none. |
mturner5 | 0:b7116bd48af6 | 7044 | */ |
mturner5 | 0:b7116bd48af6 | 7045 | void arm_q15_to_float( |
mturner5 | 0:b7116bd48af6 | 7046 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7047 | float32_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7048 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7049 | |
mturner5 | 0:b7116bd48af6 | 7050 | |
mturner5 | 0:b7116bd48af6 | 7051 | /** |
mturner5 | 0:b7116bd48af6 | 7052 | * @brief Converts the elements of the Q15 vector to Q31 vector. |
mturner5 | 0:b7116bd48af6 | 7053 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 7054 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 7055 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 7056 | * @return none. |
mturner5 | 0:b7116bd48af6 | 7057 | */ |
mturner5 | 0:b7116bd48af6 | 7058 | void arm_q15_to_q31( |
mturner5 | 0:b7116bd48af6 | 7059 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7060 | q31_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7061 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7062 | |
mturner5 | 0:b7116bd48af6 | 7063 | |
mturner5 | 0:b7116bd48af6 | 7064 | /** |
mturner5 | 0:b7116bd48af6 | 7065 | * @brief Converts the elements of the Q15 vector to Q7 vector. |
mturner5 | 0:b7116bd48af6 | 7066 | * @param[in] *pSrc is input pointer |
mturner5 | 0:b7116bd48af6 | 7067 | * @param[out] *pDst is output pointer |
mturner5 | 0:b7116bd48af6 | 7068 | * @param[in] blockSize is the number of samples to process |
mturner5 | 0:b7116bd48af6 | 7069 | * @return none. |
mturner5 | 0:b7116bd48af6 | 7070 | */ |
mturner5 | 0:b7116bd48af6 | 7071 | void arm_q15_to_q7( |
mturner5 | 0:b7116bd48af6 | 7072 | q15_t * pSrc, |
mturner5 | 0:b7116bd48af6 | 7073 | q7_t * pDst, |
mturner5 | 0:b7116bd48af6 | 7074 | uint32_t blockSize); |
mturner5 | 0:b7116bd48af6 | 7075 | |
mturner5 | 0:b7116bd48af6 | 7076 | |
mturner5 | 0:b7116bd48af6 | 7077 | /** |
mturner5 | 0:b7116bd48af6 | 7078 | * @ingroup groupInterpolation |
mturner5 | 0:b7116bd48af6 | 7079 | */ |
mturner5 | 0:b7116bd48af6 | 7080 | |
mturner5 | 0:b7116bd48af6 | 7081 | /** |
mturner5 | 0:b7116bd48af6 | 7082 | * @defgroup BilinearInterpolate Bilinear Interpolation |
mturner5 | 0:b7116bd48af6 | 7083 | * |
mturner5 | 0:b7116bd48af6 | 7084 | * Bilinear interpolation is an extension of linear interpolation applied to a two dimensional grid. |
mturner5 | 0:b7116bd48af6 | 7085 | * The underlying function <code>f(x, y)</code> is sampled on a regular grid and the interpolation process |
mturner5 | 0:b7116bd48af6 | 7086 | * determines values between the grid points. |
mturner5 | 0:b7116bd48af6 | 7087 | * Bilinear interpolation is equivalent to two step linear interpolation, first in the x-dimension and then in the y-dimension. |
mturner5 | 0:b7116bd48af6 | 7088 | * Bilinear interpolation is often used in image processing to rescale images. |
mturner5 | 0:b7116bd48af6 | 7089 | * The CMSIS DSP library provides bilinear interpolation functions for Q7, Q15, Q31, and floating-point data types. |
mturner5 | 0:b7116bd48af6 | 7090 | * |
mturner5 | 0:b7116bd48af6 | 7091 | * <b>Algorithm</b> |
mturner5 | 0:b7116bd48af6 | 7092 | * \par |
mturner5 | 0:b7116bd48af6 | 7093 | * The instance structure used by the bilinear interpolation functions describes a two dimensional data table. |
mturner5 | 0:b7116bd48af6 | 7094 | * For floating-point, the instance structure is defined as: |
mturner5 | 0:b7116bd48af6 | 7095 | * <pre> |
mturner5 | 0:b7116bd48af6 | 7096 | * typedef struct |
mturner5 | 0:b7116bd48af6 | 7097 | * { |
mturner5 | 0:b7116bd48af6 | 7098 | * uint16_t numRows; |
mturner5 | 0:b7116bd48af6 | 7099 | * uint16_t numCols; |
mturner5 | 0:b7116bd48af6 | 7100 | * float32_t *pData; |
mturner5 | 0:b7116bd48af6 | 7101 | * } arm_bilinear_interp_instance_f32; |
mturner5 | 0:b7116bd48af6 | 7102 | * </pre> |
mturner5 | 0:b7116bd48af6 | 7103 | * |
mturner5 | 0:b7116bd48af6 | 7104 | * \par |
mturner5 | 0:b7116bd48af6 | 7105 | * where <code>numRows</code> specifies the number of rows in the table; |
mturner5 | 0:b7116bd48af6 | 7106 | * <code>numCols</code> specifies the number of columns in the table; |
mturner5 | 0:b7116bd48af6 | 7107 | * and <code>pData</code> points to an array of size <code>numRows*numCols</code> values. |
mturner5 | 0:b7116bd48af6 | 7108 | * The data table <code>pTable</code> is organized in row order and the supplied data values fall on integer indexes. |
mturner5 | 0:b7116bd48af6 | 7109 | * That is, table element (x,y) is located at <code>pTable[x + y*numCols]</code> where x and y are integers. |
mturner5 | 0:b7116bd48af6 | 7110 | * |
mturner5 | 0:b7116bd48af6 | 7111 | * \par |
mturner5 | 0:b7116bd48af6 | 7112 | * Let <code>(x, y)</code> specify the desired interpolation point. Then define: |
mturner5 | 0:b7116bd48af6 | 7113 | * <pre> |
mturner5 | 0:b7116bd48af6 | 7114 | * XF = floor(x) |
mturner5 | 0:b7116bd48af6 | 7115 | * YF = floor(y) |
mturner5 | 0:b7116bd48af6 | 7116 | * </pre> |
mturner5 | 0:b7116bd48af6 | 7117 | * \par |
mturner5 | 0:b7116bd48af6 | 7118 | * The interpolated output point is computed as: |
mturner5 | 0:b7116bd48af6 | 7119 | * <pre> |
mturner5 | 0:b7116bd48af6 | 7120 | * f(x, y) = f(XF, YF) * (1-(x-XF)) * (1-(y-YF)) |
mturner5 | 0:b7116bd48af6 | 7121 | * + f(XF+1, YF) * (x-XF)*(1-(y-YF)) |
mturner5 | 0:b7116bd48af6 | 7122 | * + f(XF, YF+1) * (1-(x-XF))*(y-YF) |
mturner5 | 0:b7116bd48af6 | 7123 | * + f(XF+1, YF+1) * (x-XF)*(y-YF) |
mturner5 | 0:b7116bd48af6 | 7124 | * </pre> |
mturner5 | 0:b7116bd48af6 | 7125 | * Note that the coordinates (x, y) contain integer and fractional components. |
mturner5 | 0:b7116bd48af6 | 7126 | * The integer components specify which portion of the table to use while the |
mturner5 | 0:b7116bd48af6 | 7127 | * fractional components control the interpolation processor. |
mturner5 | 0:b7116bd48af6 | 7128 | * |
mturner5 | 0:b7116bd48af6 | 7129 | * \par |
mturner5 | 0:b7116bd48af6 | 7130 | * if (x,y) are outside of the table boundary, Bilinear interpolation returns zero output. |
mturner5 | 0:b7116bd48af6 | 7131 | */ |
mturner5 | 0:b7116bd48af6 | 7132 | |
mturner5 | 0:b7116bd48af6 | 7133 | /** |
mturner5 | 0:b7116bd48af6 | 7134 | * @addtogroup BilinearInterpolate |
mturner5 | 0:b7116bd48af6 | 7135 | * @{ |
mturner5 | 0:b7116bd48af6 | 7136 | */ |
mturner5 | 0:b7116bd48af6 | 7137 | |
mturner5 | 0:b7116bd48af6 | 7138 | /** |
mturner5 | 0:b7116bd48af6 | 7139 | * |
mturner5 | 0:b7116bd48af6 | 7140 | * @brief Floating-point bilinear interpolation. |
mturner5 | 0:b7116bd48af6 | 7141 | * @param[in,out] *S points to an instance of the interpolation structure. |
mturner5 | 0:b7116bd48af6 | 7142 | * @param[in] X interpolation coordinate. |
mturner5 | 0:b7116bd48af6 | 7143 | * @param[in] Y interpolation coordinate. |
mturner5 | 0:b7116bd48af6 | 7144 | * @return out interpolated value. |
mturner5 | 0:b7116bd48af6 | 7145 | */ |
mturner5 | 0:b7116bd48af6 | 7146 | |
mturner5 | 0:b7116bd48af6 | 7147 | |
mturner5 | 0:b7116bd48af6 | 7148 | static __INLINE float32_t arm_bilinear_interp_f32( |
mturner5 | 0:b7116bd48af6 | 7149 | const arm_bilinear_interp_instance_f32 * S, |
mturner5 | 0:b7116bd48af6 | 7150 | float32_t X, |
mturner5 | 0:b7116bd48af6 | 7151 | float32_t Y) |
mturner5 | 0:b7116bd48af6 | 7152 | { |
mturner5 | 0:b7116bd48af6 | 7153 | float32_t out; |
mturner5 | 0:b7116bd48af6 | 7154 | float32_t f00, f01, f10, f11; |
mturner5 | 0:b7116bd48af6 | 7155 | float32_t *pData = S->pData; |
mturner5 | 0:b7116bd48af6 | 7156 | int32_t xIndex, yIndex, index; |
mturner5 | 0:b7116bd48af6 | 7157 | float32_t xdiff, ydiff; |
mturner5 | 0:b7116bd48af6 | 7158 | float32_t b1, b2, b3, b4; |
mturner5 | 0:b7116bd48af6 | 7159 | |
mturner5 | 0:b7116bd48af6 | 7160 | xIndex = (int32_t) X; |
mturner5 | 0:b7116bd48af6 | 7161 | yIndex = (int32_t) Y; |
mturner5 | 0:b7116bd48af6 | 7162 | |
mturner5 | 0:b7116bd48af6 | 7163 | /* Care taken for table outside boundary */ |
mturner5 | 0:b7116bd48af6 | 7164 | /* Returns zero output when values are outside table boundary */ |
mturner5 | 0:b7116bd48af6 | 7165 | if(xIndex < 0 || xIndex > (S->numRows - 1) || yIndex < 0 |
mturner5 | 0:b7116bd48af6 | 7166 | || yIndex > (S->numCols - 1)) |
mturner5 | 0:b7116bd48af6 | 7167 | { |
mturner5 | 0:b7116bd48af6 | 7168 | return (0); |
mturner5 | 0:b7116bd48af6 | 7169 | } |
mturner5 | 0:b7116bd48af6 | 7170 | |
mturner5 | 0:b7116bd48af6 | 7171 | /* Calculation of index for two nearest points in X-direction */ |
mturner5 | 0:b7116bd48af6 | 7172 | index = (xIndex - 1) + (yIndex - 1) * S->numCols; |
mturner5 | 0:b7116bd48af6 | 7173 | |
mturner5 | 0:b7116bd48af6 | 7174 | |
mturner5 | 0:b7116bd48af6 | 7175 | /* Read two nearest points in X-direction */ |
mturner5 | 0:b7116bd48af6 | 7176 | f00 = pData[index]; |
mturner5 | 0:b7116bd48af6 | 7177 | f01 = pData[index + 1]; |
mturner5 | 0:b7116bd48af6 | 7178 | |
mturner5 | 0:b7116bd48af6 | 7179 | /* Calculation of index for two nearest points in Y-direction */ |
mturner5 | 0:b7116bd48af6 | 7180 | index = (xIndex - 1) + (yIndex) * S->numCols; |
mturner5 | 0:b7116bd48af6 | 7181 | |
mturner5 | 0:b7116bd48af6 | 7182 | |
mturner5 | 0:b7116bd48af6 | 7183 | /* Read two nearest points in Y-direction */ |
mturner5 | 0:b7116bd48af6 | 7184 | f10 = pData[index]; |
mturner5 | 0:b7116bd48af6 | 7185 | f11 = pData[index + 1]; |
mturner5 | 0:b7116bd48af6 | 7186 | |
mturner5 | 0:b7116bd48af6 | 7187 | /* Calculation of intermediate values */ |
mturner5 | 0:b7116bd48af6 | 7188 | b1 = f00; |
mturner5 | 0:b7116bd48af6 | 7189 | b2 = f01 - f00; |
mturner5 | 0:b7116bd48af6 | 7190 | b3 = f10 - f00; |
mturner5 | 0:b7116bd48af6 | 7191 | b4 = f00 - f01 - f10 + f11; |
mturner5 | 0:b7116bd48af6 | 7192 | |
mturner5 | 0:b7116bd48af6 | 7193 | /* Calculation of fractional part in X */ |
mturner5 | 0:b7116bd48af6 | 7194 | xdiff = X - xIndex; |
mturner5 | 0:b7116bd48af6 | 7195 | |
mturner5 | 0:b7116bd48af6 | 7196 | /* Calculation of fractional part in Y */ |
mturner5 | 0:b7116bd48af6 | 7197 | ydiff = Y - yIndex; |
mturner5 | 0:b7116bd48af6 | 7198 | |
mturner5 | 0:b7116bd48af6 | 7199 | /* Calculation of bi-linear interpolated output */ |
mturner5 | 0:b7116bd48af6 | 7200 | out = b1 + b2 * xdiff + b3 * ydiff + b4 * xdiff * ydiff; |
mturner5 | 0:b7116bd48af6 | 7201 | |
mturner5 | 0:b7116bd48af6 | 7202 | /* return to application */ |
mturner5 | 0:b7116bd48af6 | 7203 | return (out); |
mturner5 | 0:b7116bd48af6 | 7204 | |
mturner5 | 0:b7116bd48af6 | 7205 | } |
mturner5 | 0:b7116bd48af6 | 7206 | |
mturner5 | 0:b7116bd48af6 | 7207 | /** |
mturner5 | 0:b7116bd48af6 | 7208 | * |
mturner5 | 0:b7116bd48af6 | 7209 | * @brief Q31 bilinear interpolation. |
mturner5 | 0:b7116bd48af6 | 7210 | * @param[in,out] *S points to an instance of the interpolation structure. |
mturner5 | 0:b7116bd48af6 | 7211 | * @param[in] X interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7212 | * @param[in] Y interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7213 | * @return out interpolated value. |
mturner5 | 0:b7116bd48af6 | 7214 | */ |
mturner5 | 0:b7116bd48af6 | 7215 | |
mturner5 | 0:b7116bd48af6 | 7216 | static __INLINE q31_t arm_bilinear_interp_q31( |
mturner5 | 0:b7116bd48af6 | 7217 | arm_bilinear_interp_instance_q31 * S, |
mturner5 | 0:b7116bd48af6 | 7218 | q31_t X, |
mturner5 | 0:b7116bd48af6 | 7219 | q31_t Y) |
mturner5 | 0:b7116bd48af6 | 7220 | { |
mturner5 | 0:b7116bd48af6 | 7221 | q31_t out; /* Temporary output */ |
mturner5 | 0:b7116bd48af6 | 7222 | q31_t acc = 0; /* output */ |
mturner5 | 0:b7116bd48af6 | 7223 | q31_t xfract, yfract; /* X, Y fractional parts */ |
mturner5 | 0:b7116bd48af6 | 7224 | q31_t x1, x2, y1, y2; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 7225 | int32_t rI, cI; /* Row and column indices */ |
mturner5 | 0:b7116bd48af6 | 7226 | q31_t *pYData = S->pData; /* pointer to output table values */ |
mturner5 | 0:b7116bd48af6 | 7227 | uint32_t nCols = S->numCols; /* num of rows */ |
mturner5 | 0:b7116bd48af6 | 7228 | |
mturner5 | 0:b7116bd48af6 | 7229 | |
mturner5 | 0:b7116bd48af6 | 7230 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7231 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7232 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7233 | rI = ((X & 0xFFF00000) >> 20u); |
mturner5 | 0:b7116bd48af6 | 7234 | |
mturner5 | 0:b7116bd48af6 | 7235 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7236 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7237 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7238 | cI = ((Y & 0xFFF00000) >> 20u); |
mturner5 | 0:b7116bd48af6 | 7239 | |
mturner5 | 0:b7116bd48af6 | 7240 | /* Care taken for table outside boundary */ |
mturner5 | 0:b7116bd48af6 | 7241 | /* Returns zero output when values are outside table boundary */ |
mturner5 | 0:b7116bd48af6 | 7242 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
mturner5 | 0:b7116bd48af6 | 7243 | { |
mturner5 | 0:b7116bd48af6 | 7244 | return (0); |
mturner5 | 0:b7116bd48af6 | 7245 | } |
mturner5 | 0:b7116bd48af6 | 7246 | |
mturner5 | 0:b7116bd48af6 | 7247 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7248 | /* shift left xfract by 11 to keep 1.31 format */ |
mturner5 | 0:b7116bd48af6 | 7249 | xfract = (X & 0x000FFFFF) << 11u; |
mturner5 | 0:b7116bd48af6 | 7250 | |
mturner5 | 0:b7116bd48af6 | 7251 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7252 | x1 = pYData[(rI) + nCols * (cI)]; |
mturner5 | 0:b7116bd48af6 | 7253 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7254 | |
mturner5 | 0:b7116bd48af6 | 7255 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7256 | /* shift left yfract by 11 to keep 1.31 format */ |
mturner5 | 0:b7116bd48af6 | 7257 | yfract = (Y & 0x000FFFFF) << 11u; |
mturner5 | 0:b7116bd48af6 | 7258 | |
mturner5 | 0:b7116bd48af6 | 7259 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7260 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
mturner5 | 0:b7116bd48af6 | 7261 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7262 | |
mturner5 | 0:b7116bd48af6 | 7263 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 3.29(q29) format */ |
mturner5 | 0:b7116bd48af6 | 7264 | out = ((q31_t) (((q63_t) x1 * (0x7FFFFFFF - xfract)) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7265 | acc = ((q31_t) (((q63_t) out * (0x7FFFFFFF - yfract)) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7266 | |
mturner5 | 0:b7116bd48af6 | 7267 | /* x2 * (xfract) * (1-yfract) in 3.29(q29) and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7268 | out = ((q31_t) ((q63_t) x2 * (0x7FFFFFFF - yfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7269 | acc += ((q31_t) ((q63_t) out * (xfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7270 | |
mturner5 | 0:b7116bd48af6 | 7271 | /* y1 * (1 - xfract) * (yfract) in 3.29(q29) and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7272 | out = ((q31_t) ((q63_t) y1 * (0x7FFFFFFF - xfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7273 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7274 | |
mturner5 | 0:b7116bd48af6 | 7275 | /* y2 * (xfract) * (yfract) in 3.29(q29) and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7276 | out = ((q31_t) ((q63_t) y2 * (xfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7277 | acc += ((q31_t) ((q63_t) out * (yfract) >> 32)); |
mturner5 | 0:b7116bd48af6 | 7278 | |
mturner5 | 0:b7116bd48af6 | 7279 | /* Convert acc to 1.31(q31) format */ |
mturner5 | 0:b7116bd48af6 | 7280 | return (acc << 2u); |
mturner5 | 0:b7116bd48af6 | 7281 | |
mturner5 | 0:b7116bd48af6 | 7282 | } |
mturner5 | 0:b7116bd48af6 | 7283 | |
mturner5 | 0:b7116bd48af6 | 7284 | /** |
mturner5 | 0:b7116bd48af6 | 7285 | * @brief Q15 bilinear interpolation. |
mturner5 | 0:b7116bd48af6 | 7286 | * @param[in,out] *S points to an instance of the interpolation structure. |
mturner5 | 0:b7116bd48af6 | 7287 | * @param[in] X interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7288 | * @param[in] Y interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7289 | * @return out interpolated value. |
mturner5 | 0:b7116bd48af6 | 7290 | */ |
mturner5 | 0:b7116bd48af6 | 7291 | |
mturner5 | 0:b7116bd48af6 | 7292 | static __INLINE q15_t arm_bilinear_interp_q15( |
mturner5 | 0:b7116bd48af6 | 7293 | arm_bilinear_interp_instance_q15 * S, |
mturner5 | 0:b7116bd48af6 | 7294 | q31_t X, |
mturner5 | 0:b7116bd48af6 | 7295 | q31_t Y) |
mturner5 | 0:b7116bd48af6 | 7296 | { |
mturner5 | 0:b7116bd48af6 | 7297 | q63_t acc = 0; /* output */ |
mturner5 | 0:b7116bd48af6 | 7298 | q31_t out; /* Temporary output */ |
mturner5 | 0:b7116bd48af6 | 7299 | q15_t x1, x2, y1, y2; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 7300 | q31_t xfract, yfract; /* X, Y fractional parts */ |
mturner5 | 0:b7116bd48af6 | 7301 | int32_t rI, cI; /* Row and column indices */ |
mturner5 | 0:b7116bd48af6 | 7302 | q15_t *pYData = S->pData; /* pointer to output table values */ |
mturner5 | 0:b7116bd48af6 | 7303 | uint32_t nCols = S->numCols; /* num of rows */ |
mturner5 | 0:b7116bd48af6 | 7304 | |
mturner5 | 0:b7116bd48af6 | 7305 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7306 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7307 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7308 | rI = ((X & 0xFFF00000) >> 20); |
mturner5 | 0:b7116bd48af6 | 7309 | |
mturner5 | 0:b7116bd48af6 | 7310 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7311 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7312 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7313 | cI = ((Y & 0xFFF00000) >> 20); |
mturner5 | 0:b7116bd48af6 | 7314 | |
mturner5 | 0:b7116bd48af6 | 7315 | /* Care taken for table outside boundary */ |
mturner5 | 0:b7116bd48af6 | 7316 | /* Returns zero output when values are outside table boundary */ |
mturner5 | 0:b7116bd48af6 | 7317 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
mturner5 | 0:b7116bd48af6 | 7318 | { |
mturner5 | 0:b7116bd48af6 | 7319 | return (0); |
mturner5 | 0:b7116bd48af6 | 7320 | } |
mturner5 | 0:b7116bd48af6 | 7321 | |
mturner5 | 0:b7116bd48af6 | 7322 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7323 | /* xfract should be in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7324 | xfract = (X & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 7325 | |
mturner5 | 0:b7116bd48af6 | 7326 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7327 | x1 = pYData[(rI) + nCols * (cI)]; |
mturner5 | 0:b7116bd48af6 | 7328 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7329 | |
mturner5 | 0:b7116bd48af6 | 7330 | |
mturner5 | 0:b7116bd48af6 | 7331 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7332 | /* yfract should be in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7333 | yfract = (Y & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 7334 | |
mturner5 | 0:b7116bd48af6 | 7335 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7336 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
mturner5 | 0:b7116bd48af6 | 7337 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7338 | |
mturner5 | 0:b7116bd48af6 | 7339 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 13.51 format */ |
mturner5 | 0:b7116bd48af6 | 7340 | |
mturner5 | 0:b7116bd48af6 | 7341 | /* x1 is in 1.15(q15), xfract in 12.20 format and out is in 13.35 format */ |
mturner5 | 0:b7116bd48af6 | 7342 | /* convert 13.35 to 13.31 by right shifting and out is in 1.31 */ |
mturner5 | 0:b7116bd48af6 | 7343 | out = (q31_t) (((q63_t) x1 * (0xFFFFF - xfract)) >> 4u); |
mturner5 | 0:b7116bd48af6 | 7344 | acc = ((q63_t) out * (0xFFFFF - yfract)); |
mturner5 | 0:b7116bd48af6 | 7345 | |
mturner5 | 0:b7116bd48af6 | 7346 | /* x2 * (xfract) * (1-yfract) in 1.51 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7347 | out = (q31_t) (((q63_t) x2 * (0xFFFFF - yfract)) >> 4u); |
mturner5 | 0:b7116bd48af6 | 7348 | acc += ((q63_t) out * (xfract)); |
mturner5 | 0:b7116bd48af6 | 7349 | |
mturner5 | 0:b7116bd48af6 | 7350 | /* y1 * (1 - xfract) * (yfract) in 1.51 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7351 | out = (q31_t) (((q63_t) y1 * (0xFFFFF - xfract)) >> 4u); |
mturner5 | 0:b7116bd48af6 | 7352 | acc += ((q63_t) out * (yfract)); |
mturner5 | 0:b7116bd48af6 | 7353 | |
mturner5 | 0:b7116bd48af6 | 7354 | /* y2 * (xfract) * (yfract) in 1.51 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7355 | out = (q31_t) (((q63_t) y2 * (xfract)) >> 4u); |
mturner5 | 0:b7116bd48af6 | 7356 | acc += ((q63_t) out * (yfract)); |
mturner5 | 0:b7116bd48af6 | 7357 | |
mturner5 | 0:b7116bd48af6 | 7358 | /* acc is in 13.51 format and down shift acc by 36 times */ |
mturner5 | 0:b7116bd48af6 | 7359 | /* Convert out to 1.15 format */ |
mturner5 | 0:b7116bd48af6 | 7360 | return (acc >> 36); |
mturner5 | 0:b7116bd48af6 | 7361 | |
mturner5 | 0:b7116bd48af6 | 7362 | } |
mturner5 | 0:b7116bd48af6 | 7363 | |
mturner5 | 0:b7116bd48af6 | 7364 | /** |
mturner5 | 0:b7116bd48af6 | 7365 | * @brief Q7 bilinear interpolation. |
mturner5 | 0:b7116bd48af6 | 7366 | * @param[in,out] *S points to an instance of the interpolation structure. |
mturner5 | 0:b7116bd48af6 | 7367 | * @param[in] X interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7368 | * @param[in] Y interpolation coordinate in 12.20 format. |
mturner5 | 0:b7116bd48af6 | 7369 | * @return out interpolated value. |
mturner5 | 0:b7116bd48af6 | 7370 | */ |
mturner5 | 0:b7116bd48af6 | 7371 | |
mturner5 | 0:b7116bd48af6 | 7372 | static __INLINE q7_t arm_bilinear_interp_q7( |
mturner5 | 0:b7116bd48af6 | 7373 | arm_bilinear_interp_instance_q7 * S, |
mturner5 | 0:b7116bd48af6 | 7374 | q31_t X, |
mturner5 | 0:b7116bd48af6 | 7375 | q31_t Y) |
mturner5 | 0:b7116bd48af6 | 7376 | { |
mturner5 | 0:b7116bd48af6 | 7377 | q63_t acc = 0; /* output */ |
mturner5 | 0:b7116bd48af6 | 7378 | q31_t out; /* Temporary output */ |
mturner5 | 0:b7116bd48af6 | 7379 | q31_t xfract, yfract; /* X, Y fractional parts */ |
mturner5 | 0:b7116bd48af6 | 7380 | q7_t x1, x2, y1, y2; /* Nearest output values */ |
mturner5 | 0:b7116bd48af6 | 7381 | int32_t rI, cI; /* Row and column indices */ |
mturner5 | 0:b7116bd48af6 | 7382 | q7_t *pYData = S->pData; /* pointer to output table values */ |
mturner5 | 0:b7116bd48af6 | 7383 | uint32_t nCols = S->numCols; /* num of rows */ |
mturner5 | 0:b7116bd48af6 | 7384 | |
mturner5 | 0:b7116bd48af6 | 7385 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7386 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7387 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7388 | rI = ((X & 0xFFF00000) >> 20); |
mturner5 | 0:b7116bd48af6 | 7389 | |
mturner5 | 0:b7116bd48af6 | 7390 | /* Input is in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7391 | /* 12 bits for the table index */ |
mturner5 | 0:b7116bd48af6 | 7392 | /* Index value calculation */ |
mturner5 | 0:b7116bd48af6 | 7393 | cI = ((Y & 0xFFF00000) >> 20); |
mturner5 | 0:b7116bd48af6 | 7394 | |
mturner5 | 0:b7116bd48af6 | 7395 | /* Care taken for table outside boundary */ |
mturner5 | 0:b7116bd48af6 | 7396 | /* Returns zero output when values are outside table boundary */ |
mturner5 | 0:b7116bd48af6 | 7397 | if(rI < 0 || rI > (S->numRows - 1) || cI < 0 || cI > (S->numCols - 1)) |
mturner5 | 0:b7116bd48af6 | 7398 | { |
mturner5 | 0:b7116bd48af6 | 7399 | return (0); |
mturner5 | 0:b7116bd48af6 | 7400 | } |
mturner5 | 0:b7116bd48af6 | 7401 | |
mturner5 | 0:b7116bd48af6 | 7402 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7403 | /* xfract should be in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7404 | xfract = (X & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 7405 | |
mturner5 | 0:b7116bd48af6 | 7406 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7407 | x1 = pYData[(rI) + nCols * (cI)]; |
mturner5 | 0:b7116bd48af6 | 7408 | x2 = pYData[(rI) + nCols * (cI) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7409 | |
mturner5 | 0:b7116bd48af6 | 7410 | |
mturner5 | 0:b7116bd48af6 | 7411 | /* 20 bits for the fractional part */ |
mturner5 | 0:b7116bd48af6 | 7412 | /* yfract should be in 12.20 format */ |
mturner5 | 0:b7116bd48af6 | 7413 | yfract = (Y & 0x000FFFFF); |
mturner5 | 0:b7116bd48af6 | 7414 | |
mturner5 | 0:b7116bd48af6 | 7415 | /* Read two nearest output values from the index */ |
mturner5 | 0:b7116bd48af6 | 7416 | y1 = pYData[(rI) + nCols * (cI + 1)]; |
mturner5 | 0:b7116bd48af6 | 7417 | y2 = pYData[(rI) + nCols * (cI + 1) + 1u]; |
mturner5 | 0:b7116bd48af6 | 7418 | |
mturner5 | 0:b7116bd48af6 | 7419 | /* Calculation of x1 * (1-xfract ) * (1-yfract) and acc is in 16.47 format */ |
mturner5 | 0:b7116bd48af6 | 7420 | out = ((x1 * (0xFFFFF - xfract))); |
mturner5 | 0:b7116bd48af6 | 7421 | acc = (((q63_t) out * (0xFFFFF - yfract))); |
mturner5 | 0:b7116bd48af6 | 7422 | |
mturner5 | 0:b7116bd48af6 | 7423 | /* x2 * (xfract) * (1-yfract) in 2.22 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7424 | out = ((x2 * (0xFFFFF - yfract))); |
mturner5 | 0:b7116bd48af6 | 7425 | acc += (((q63_t) out * (xfract))); |
mturner5 | 0:b7116bd48af6 | 7426 | |
mturner5 | 0:b7116bd48af6 | 7427 | /* y1 * (1 - xfract) * (yfract) in 2.22 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7428 | out = ((y1 * (0xFFFFF - xfract))); |
mturner5 | 0:b7116bd48af6 | 7429 | acc += (((q63_t) out * (yfract))); |
mturner5 | 0:b7116bd48af6 | 7430 | |
mturner5 | 0:b7116bd48af6 | 7431 | /* y2 * (xfract) * (yfract) in 2.22 and adding to acc */ |
mturner5 | 0:b7116bd48af6 | 7432 | out = ((y2 * (yfract))); |
mturner5 | 0:b7116bd48af6 | 7433 | acc += (((q63_t) out * (xfract))); |
mturner5 | 0:b7116bd48af6 | 7434 | |
mturner5 | 0:b7116bd48af6 | 7435 | /* acc in 16.47 format and down shift by 40 to convert to 1.7 format */ |
mturner5 | 0:b7116bd48af6 | 7436 | return (acc >> 40); |
mturner5 | 0:b7116bd48af6 | 7437 | |
mturner5 | 0:b7116bd48af6 | 7438 | } |
mturner5 | 0:b7116bd48af6 | 7439 | |
mturner5 | 0:b7116bd48af6 | 7440 | /** |
mturner5 | 0:b7116bd48af6 | 7441 | * @} end of BilinearInterpolate group |
mturner5 | 0:b7116bd48af6 | 7442 | */ |
mturner5 | 0:b7116bd48af6 | 7443 | |
mturner5 | 0:b7116bd48af6 | 7444 | |
mturner5 | 0:b7116bd48af6 | 7445 | //SMMLAR |
mturner5 | 0:b7116bd48af6 | 7446 | #define multAcc_32x32_keep32_R(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7447 | a = (q31_t) (((((q63_t) a) << 32) + ((q63_t) x * y) + 0x80000000LL ) >> 32) |
mturner5 | 0:b7116bd48af6 | 7448 | |
mturner5 | 0:b7116bd48af6 | 7449 | //SMMLSR |
mturner5 | 0:b7116bd48af6 | 7450 | #define multSub_32x32_keep32_R(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7451 | a = (q31_t) (((((q63_t) a) << 32) - ((q63_t) x * y) + 0x80000000LL ) >> 32) |
mturner5 | 0:b7116bd48af6 | 7452 | |
mturner5 | 0:b7116bd48af6 | 7453 | //SMMULR |
mturner5 | 0:b7116bd48af6 | 7454 | #define mult_32x32_keep32_R(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7455 | a = (q31_t) (((q63_t) x * y + 0x80000000LL ) >> 32) |
mturner5 | 0:b7116bd48af6 | 7456 | |
mturner5 | 0:b7116bd48af6 | 7457 | //SMMLA |
mturner5 | 0:b7116bd48af6 | 7458 | #define multAcc_32x32_keep32(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7459 | a += (q31_t) (((q63_t) x * y) >> 32) |
mturner5 | 0:b7116bd48af6 | 7460 | |
mturner5 | 0:b7116bd48af6 | 7461 | //SMMLS |
mturner5 | 0:b7116bd48af6 | 7462 | #define multSub_32x32_keep32(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7463 | a -= (q31_t) (((q63_t) x * y) >> 32) |
mturner5 | 0:b7116bd48af6 | 7464 | |
mturner5 | 0:b7116bd48af6 | 7465 | //SMMUL |
mturner5 | 0:b7116bd48af6 | 7466 | #define mult_32x32_keep32(a, x, y) \ |
mturner5 | 0:b7116bd48af6 | 7467 | a = (q31_t) (((q63_t) x * y ) >> 32) |
mturner5 | 0:b7116bd48af6 | 7468 | |
mturner5 | 0:b7116bd48af6 | 7469 | |
mturner5 | 0:b7116bd48af6 | 7470 | #if defined ( __CC_ARM ) //Keil |
mturner5 | 0:b7116bd48af6 | 7471 | |
mturner5 | 0:b7116bd48af6 | 7472 | //Enter low optimization region - place directly above function definition |
mturner5 | 0:b7116bd48af6 | 7473 | #ifdef ARM_MATH_CM4 |
mturner5 | 0:b7116bd48af6 | 7474 | #define LOW_OPTIMIZATION_ENTER \ |
mturner5 | 0:b7116bd48af6 | 7475 | _Pragma ("push") \ |
mturner5 | 0:b7116bd48af6 | 7476 | _Pragma ("O1") |
mturner5 | 0:b7116bd48af6 | 7477 | #else |
mturner5 | 0:b7116bd48af6 | 7478 | #define LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7479 | #endif |
mturner5 | 0:b7116bd48af6 | 7480 | |
mturner5 | 0:b7116bd48af6 | 7481 | //Exit low optimization region - place directly after end of function definition |
mturner5 | 0:b7116bd48af6 | 7482 | #ifdef ARM_MATH_CM4 |
mturner5 | 0:b7116bd48af6 | 7483 | #define LOW_OPTIMIZATION_EXIT \ |
mturner5 | 0:b7116bd48af6 | 7484 | _Pragma ("pop") |
mturner5 | 0:b7116bd48af6 | 7485 | #else |
mturner5 | 0:b7116bd48af6 | 7486 | #define LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7487 | #endif |
mturner5 | 0:b7116bd48af6 | 7488 | |
mturner5 | 0:b7116bd48af6 | 7489 | //Enter low optimization region - place directly above function definition |
mturner5 | 0:b7116bd48af6 | 7490 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7491 | |
mturner5 | 0:b7116bd48af6 | 7492 | //Exit low optimization region - place directly after end of function definition |
mturner5 | 0:b7116bd48af6 | 7493 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7494 | |
mturner5 | 0:b7116bd48af6 | 7495 | #elif defined(__ICCARM__) //IAR |
mturner5 | 0:b7116bd48af6 | 7496 | |
mturner5 | 0:b7116bd48af6 | 7497 | //Enter low optimization region - place directly above function definition |
mturner5 | 0:b7116bd48af6 | 7498 | #ifdef ARM_MATH_CM4 |
mturner5 | 0:b7116bd48af6 | 7499 | #define LOW_OPTIMIZATION_ENTER \ |
mturner5 | 0:b7116bd48af6 | 7500 | _Pragma ("optimize=low") |
mturner5 | 0:b7116bd48af6 | 7501 | #else |
mturner5 | 0:b7116bd48af6 | 7502 | #define LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7503 | #endif |
mturner5 | 0:b7116bd48af6 | 7504 | |
mturner5 | 0:b7116bd48af6 | 7505 | //Exit low optimization region - place directly after end of function definition |
mturner5 | 0:b7116bd48af6 | 7506 | #define LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7507 | |
mturner5 | 0:b7116bd48af6 | 7508 | //Enter low optimization region - place directly above function definition |
mturner5 | 0:b7116bd48af6 | 7509 | #ifdef ARM_MATH_CM4 |
mturner5 | 0:b7116bd48af6 | 7510 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER \ |
mturner5 | 0:b7116bd48af6 | 7511 | _Pragma ("optimize=low") |
mturner5 | 0:b7116bd48af6 | 7512 | #else |
mturner5 | 0:b7116bd48af6 | 7513 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7514 | #endif |
mturner5 | 0:b7116bd48af6 | 7515 | |
mturner5 | 0:b7116bd48af6 | 7516 | //Exit low optimization region - place directly after end of function definition |
mturner5 | 0:b7116bd48af6 | 7517 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7518 | |
mturner5 | 0:b7116bd48af6 | 7519 | #elif defined(__GNUC__) |
mturner5 | 0:b7116bd48af6 | 7520 | |
mturner5 | 0:b7116bd48af6 | 7521 | #define LOW_OPTIMIZATION_ENTER __attribute__(( optimize("-O1") )) |
mturner5 | 0:b7116bd48af6 | 7522 | |
mturner5 | 0:b7116bd48af6 | 7523 | #define LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7524 | |
mturner5 | 0:b7116bd48af6 | 7525 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7526 | |
mturner5 | 0:b7116bd48af6 | 7527 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7528 | |
mturner5 | 0:b7116bd48af6 | 7529 | #elif defined(__CSMC__) // Cosmic |
mturner5 | 0:b7116bd48af6 | 7530 | |
mturner5 | 0:b7116bd48af6 | 7531 | #define LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7532 | #define LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7533 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7534 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7535 | |
mturner5 | 0:b7116bd48af6 | 7536 | #elif defined(__TASKING__) // TASKING |
mturner5 | 0:b7116bd48af6 | 7537 | |
mturner5 | 0:b7116bd48af6 | 7538 | #define LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7539 | #define LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7540 | #define IAR_ONLY_LOW_OPTIMIZATION_ENTER |
mturner5 | 0:b7116bd48af6 | 7541 | #define IAR_ONLY_LOW_OPTIMIZATION_EXIT |
mturner5 | 0:b7116bd48af6 | 7542 | |
mturner5 | 0:b7116bd48af6 | 7543 | #endif |
mturner5 | 0:b7116bd48af6 | 7544 | |
mturner5 | 0:b7116bd48af6 | 7545 | |
mturner5 | 0:b7116bd48af6 | 7546 | #ifdef __cplusplus |
mturner5 | 0:b7116bd48af6 | 7547 | } |
mturner5 | 0:b7116bd48af6 | 7548 | #endif |
mturner5 | 0:b7116bd48af6 | 7549 | |
mturner5 | 0:b7116bd48af6 | 7550 | |
mturner5 | 0:b7116bd48af6 | 7551 | #endif /* _ARM_MATH_H */ |
mturner5 | 0:b7116bd48af6 | 7552 | |
mturner5 | 0:b7116bd48af6 | 7553 | /** |
mturner5 | 0:b7116bd48af6 | 7554 | * |
mturner5 | 0:b7116bd48af6 | 7555 | * End of file. |
mturner5 | 0:b7116bd48af6 | 7556 | */ |