The CMSIS DSP 5 library

Dependents:   Nucleo-Heart-Rate ejercicioVrms2 PROYECTOFINAL ejercicioVrms ... more

Committer:
xorjoep
Date:
Thu Jun 21 11:56:27 2018 +0000
Revision:
3:4098b9d3d571
Parent:
1:24714b45cd1b
headers is a folder not a library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
xorjoep 1:24714b45cd1b 1 /* ----------------------------------------------------------------------
xorjoep 1:24714b45cd1b 2 * Project: CMSIS DSP Library
xorjoep 1:24714b45cd1b 3 * Title: arm_cfft_radix4_init_q15.c
xorjoep 1:24714b45cd1b 4 * Description: Radix-4 Decimation in Frequency Q15 FFT & IFFT initialization function
xorjoep 1:24714b45cd1b 5 *
xorjoep 1:24714b45cd1b 6 * $Date: 27. January 2017
xorjoep 1:24714b45cd1b 7 * $Revision: V.1.5.1
xorjoep 1:24714b45cd1b 8 *
xorjoep 1:24714b45cd1b 9 * Target Processor: Cortex-M cores
xorjoep 1:24714b45cd1b 10 * -------------------------------------------------------------------- */
xorjoep 1:24714b45cd1b 11 /*
xorjoep 1:24714b45cd1b 12 * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
xorjoep 1:24714b45cd1b 13 *
xorjoep 1:24714b45cd1b 14 * SPDX-License-Identifier: Apache-2.0
xorjoep 1:24714b45cd1b 15 *
xorjoep 1:24714b45cd1b 16 * Licensed under the Apache License, Version 2.0 (the License); you may
xorjoep 1:24714b45cd1b 17 * not use this file except in compliance with the License.
xorjoep 1:24714b45cd1b 18 * You may obtain a copy of the License at
xorjoep 1:24714b45cd1b 19 *
xorjoep 1:24714b45cd1b 20 * www.apache.org/licenses/LICENSE-2.0
xorjoep 1:24714b45cd1b 21 *
xorjoep 1:24714b45cd1b 22 * Unless required by applicable law or agreed to in writing, software
xorjoep 1:24714b45cd1b 23 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
xorjoep 1:24714b45cd1b 24 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
xorjoep 1:24714b45cd1b 25 * See the License for the specific language governing permissions and
xorjoep 1:24714b45cd1b 26 * limitations under the License.
xorjoep 1:24714b45cd1b 27 */
xorjoep 1:24714b45cd1b 28
xorjoep 1:24714b45cd1b 29 #include "arm_math.h"
xorjoep 1:24714b45cd1b 30 #include "arm_common_tables.h"
xorjoep 1:24714b45cd1b 31
xorjoep 1:24714b45cd1b 32 /**
xorjoep 1:24714b45cd1b 33 * @ingroup groupTransforms
xorjoep 1:24714b45cd1b 34 */
xorjoep 1:24714b45cd1b 35
xorjoep 1:24714b45cd1b 36
xorjoep 1:24714b45cd1b 37 /**
xorjoep 1:24714b45cd1b 38 * @addtogroup ComplexFFT
xorjoep 1:24714b45cd1b 39 * @{
xorjoep 1:24714b45cd1b 40 */
xorjoep 1:24714b45cd1b 41
xorjoep 1:24714b45cd1b 42
xorjoep 1:24714b45cd1b 43 /**
xorjoep 1:24714b45cd1b 44 * @brief Initialization function for the Q15 CFFT/CIFFT.
xorjoep 1:24714b45cd1b 45 * @deprecated Do not use this function. It has been superseded by \ref arm_cfft_q15 and will be removed
xorjoep 1:24714b45cd1b 46 * @param[in,out] *S points to an instance of the Q15 CFFT/CIFFT structure.
xorjoep 1:24714b45cd1b 47 * @param[in] fftLen length of the FFT.
xorjoep 1:24714b45cd1b 48 * @param[in] ifftFlag flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
xorjoep 1:24714b45cd1b 49 * @param[in] bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
xorjoep 1:24714b45cd1b 50 * @return The function returns ARM_MATH_SUCCESS if initialization is successful or ARM_MATH_ARGUMENT_ERROR if <code>fftLen</code> is not a supported value.
xorjoep 1:24714b45cd1b 51 *
xorjoep 1:24714b45cd1b 52 * \par Description:
xorjoep 1:24714b45cd1b 53 * \par
xorjoep 1:24714b45cd1b 54 * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
xorjoep 1:24714b45cd1b 55 * Set(=1) ifftFlag for calculation of CIFFT otherwise CFFT is calculated
xorjoep 1:24714b45cd1b 56 * \par
xorjoep 1:24714b45cd1b 57 * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
xorjoep 1:24714b45cd1b 58 * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
xorjoep 1:24714b45cd1b 59 * \par
xorjoep 1:24714b45cd1b 60 * The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
xorjoep 1:24714b45cd1b 61 * \par
xorjoep 1:24714b45cd1b 62 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
xorjoep 1:24714b45cd1b 63 */
xorjoep 1:24714b45cd1b 64
xorjoep 1:24714b45cd1b 65 arm_status arm_cfft_radix4_init_q15(
xorjoep 1:24714b45cd1b 66 arm_cfft_radix4_instance_q15 * S,
xorjoep 1:24714b45cd1b 67 uint16_t fftLen,
xorjoep 1:24714b45cd1b 68 uint8_t ifftFlag,
xorjoep 1:24714b45cd1b 69 uint8_t bitReverseFlag)
xorjoep 1:24714b45cd1b 70 {
xorjoep 1:24714b45cd1b 71 /* Initialise the default arm status */
xorjoep 1:24714b45cd1b 72 arm_status status = ARM_MATH_SUCCESS;
xorjoep 1:24714b45cd1b 73 /* Initialise the FFT length */
xorjoep 1:24714b45cd1b 74 S->fftLen = fftLen;
xorjoep 1:24714b45cd1b 75 /* Initialise the Twiddle coefficient pointer */
xorjoep 1:24714b45cd1b 76 S->pTwiddle = (q15_t *) twiddleCoef_4096_q15;
xorjoep 1:24714b45cd1b 77 /* Initialise the Flag for selection of CFFT or CIFFT */
xorjoep 1:24714b45cd1b 78 S->ifftFlag = ifftFlag;
xorjoep 1:24714b45cd1b 79 /* Initialise the Flag for calculation Bit reversal or not */
xorjoep 1:24714b45cd1b 80 S->bitReverseFlag = bitReverseFlag;
xorjoep 1:24714b45cd1b 81
xorjoep 1:24714b45cd1b 82 /* Initializations of structure parameters depending on the FFT length */
xorjoep 1:24714b45cd1b 83 switch (S->fftLen)
xorjoep 1:24714b45cd1b 84 {
xorjoep 1:24714b45cd1b 85 case 4096U:
xorjoep 1:24714b45cd1b 86 /* Initializations of structure parameters for 4096 point FFT */
xorjoep 1:24714b45cd1b 87
xorjoep 1:24714b45cd1b 88 /* Initialise the twiddle coef modifier value */
xorjoep 1:24714b45cd1b 89 S->twidCoefModifier = 1U;
xorjoep 1:24714b45cd1b 90 /* Initialise the bit reversal table modifier */
xorjoep 1:24714b45cd1b 91 S->bitRevFactor = 1U;
xorjoep 1:24714b45cd1b 92 /* Initialise the bit reversal table pointer */
xorjoep 1:24714b45cd1b 93 S->pBitRevTable = (uint16_t *) armBitRevTable;
xorjoep 1:24714b45cd1b 94
xorjoep 1:24714b45cd1b 95 break;
xorjoep 1:24714b45cd1b 96
xorjoep 1:24714b45cd1b 97 case 1024U:
xorjoep 1:24714b45cd1b 98 /* Initializations of structure parameters for 1024 point FFT */
xorjoep 1:24714b45cd1b 99 S->twidCoefModifier = 4U;
xorjoep 1:24714b45cd1b 100 S->bitRevFactor = 4U;
xorjoep 1:24714b45cd1b 101 S->pBitRevTable = (uint16_t *) & armBitRevTable[3];
xorjoep 1:24714b45cd1b 102
xorjoep 1:24714b45cd1b 103 break;
xorjoep 1:24714b45cd1b 104
xorjoep 1:24714b45cd1b 105 case 256U:
xorjoep 1:24714b45cd1b 106 /* Initializations of structure parameters for 256 point FFT */
xorjoep 1:24714b45cd1b 107 S->twidCoefModifier = 16U;
xorjoep 1:24714b45cd1b 108 S->bitRevFactor = 16U;
xorjoep 1:24714b45cd1b 109 S->pBitRevTable = (uint16_t *) & armBitRevTable[15];
xorjoep 1:24714b45cd1b 110
xorjoep 1:24714b45cd1b 111 break;
xorjoep 1:24714b45cd1b 112
xorjoep 1:24714b45cd1b 113 case 64U:
xorjoep 1:24714b45cd1b 114 /* Initializations of structure parameters for 64 point FFT */
xorjoep 1:24714b45cd1b 115 S->twidCoefModifier = 64U;
xorjoep 1:24714b45cd1b 116 S->bitRevFactor = 64U;
xorjoep 1:24714b45cd1b 117 S->pBitRevTable = (uint16_t *) & armBitRevTable[63];
xorjoep 1:24714b45cd1b 118
xorjoep 1:24714b45cd1b 119 break;
xorjoep 1:24714b45cd1b 120
xorjoep 1:24714b45cd1b 121 case 16U:
xorjoep 1:24714b45cd1b 122 /* Initializations of structure parameters for 16 point FFT */
xorjoep 1:24714b45cd1b 123 S->twidCoefModifier = 256U;
xorjoep 1:24714b45cd1b 124 S->bitRevFactor = 256U;
xorjoep 1:24714b45cd1b 125 S->pBitRevTable = (uint16_t *) & armBitRevTable[255];
xorjoep 1:24714b45cd1b 126
xorjoep 1:24714b45cd1b 127 break;
xorjoep 1:24714b45cd1b 128
xorjoep 1:24714b45cd1b 129 default:
xorjoep 1:24714b45cd1b 130 /* Reporting argument error if fftSize is not valid value */
xorjoep 1:24714b45cd1b 131 status = ARM_MATH_ARGUMENT_ERROR;
xorjoep 1:24714b45cd1b 132 break;
xorjoep 1:24714b45cd1b 133 }
xorjoep 1:24714b45cd1b 134
xorjoep 1:24714b45cd1b 135 return (status);
xorjoep 1:24714b45cd1b 136 }
xorjoep 1:24714b45cd1b 137
xorjoep 1:24714b45cd1b 138 /**
xorjoep 1:24714b45cd1b 139 * @} end of ComplexFFT group
xorjoep 1:24714b45cd1b 140 */