CMSIS DSP library
Dependents: KL25Z_FFT_Demo Hat_Board_v5_1 KL25Z_FFT_Demo_tony KL25Z_FFT_Demo_tony ... more
Fork of mbed-dsp by
arm_rfft_fast_init_f32.c
00001 /* ---------------------------------------------------------------------- 00002 * Copyright (C) 2010-2013 ARM Limited. All rights reserved. 00003 * 00004 * $Date: 17. January 2013 00005 * $Revision: V1.4.1 00006 * 00007 * Project: CMSIS DSP Library 00008 * Title: arm_cfft_init_f32.c 00009 * 00010 * Description: Split Radix Decimation in Frequency CFFT Floating point processing function 00011 * 00012 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 00013 * 00014 * Redistribution and use in source and binary forms, with or without 00015 * modification, are permitted provided that the following conditions 00016 * are met: 00017 * - Redistributions of source code must retain the above copyright 00018 * notice, this list of conditions and the following disclaimer. 00019 * - Redistributions in binary form must reproduce the above copyright 00020 * notice, this list of conditions and the following disclaimer in 00021 * the documentation and/or other materials provided with the 00022 * distribution. 00023 * - Neither the name of ARM LIMITED nor the names of its contributors 00024 * may be used to endorse or promote products derived from this 00025 * software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00028 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00029 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00030 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00031 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00032 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00033 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00034 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00035 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00036 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00037 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00038 * POSSIBILITY OF SUCH DAMAGE. 00039 * -------------------------------------------------------------------- */ 00040 00041 #include "arm_math.h" 00042 #include "arm_common_tables.h" 00043 00044 /** 00045 * @ingroup groupTransforms 00046 */ 00047 00048 /** 00049 * @addtogroup RealFFT 00050 * @{ 00051 */ 00052 00053 /** 00054 * @brief Initialization function for the floating-point real FFT. 00055 * @param[in,out] *S points to an arm_rfft_fast_instance_f32 structure. 00056 * @param[in] fftLen length of the Real Sequence. 00057 * @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. 00058 * 00059 * \par Description: 00060 * \par 00061 * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed. 00062 * Set(=1) ifftFlag for calculation of CIFFT otherwise RFFT is calculated 00063 * \par 00064 * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order. 00065 * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order. 00066 * \par 00067 * The parameter <code>fftLen</code> Specifies length of RFFT/CIFFT process. Supported FFT Lengths are 16, 32, 64, 128, 256, 512, 1024, 2048, 4096. 00068 * \par 00069 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer. 00070 */ 00071 arm_status arm_rfft_fast_init_f32( 00072 arm_rfft_fast_instance_f32 * S, 00073 uint16_t fftLen) 00074 { 00075 arm_cfft_instance_f32 * Sint; 00076 /* Initialise the default arm status */ 00077 arm_status status = ARM_MATH_SUCCESS; 00078 /* Initialise the FFT length */ 00079 Sint = &(S->Sint); 00080 Sint->fftLen = fftLen/2; 00081 S->fftLenRFFT = fftLen; 00082 /* Initialise the Twiddle coefficient pointer */ 00083 // S->pTwiddle = (float32_t *) twiddleCoef; 00084 00085 /* Initializations of structure parameters depending on the FFT length */ 00086 switch (Sint->fftLen) 00087 { 00088 case 4096u: 00089 /* Initializations of structure parameters for 4096 point FFT */ 00090 /* Initialise the bit reversal table length */ 00091 Sint->bitRevLength = ARMBITREVINDEXTABLE4096_TABLE_LENGTH; 00092 /* Initialise the bit reversal table pointer */ 00093 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable4096; 00094 /* Initialise the 1/fftLen Value */ 00095 break; 00096 case 2048u: 00097 Sint->bitRevLength = ARMBITREVINDEXTABLE2048_TABLE_LENGTH; 00098 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048; 00099 break; 00100 case 1024u: 00101 Sint->bitRevLength = ARMBITREVINDEXTABLE1024_TABLE_LENGTH; 00102 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024; 00103 break; 00104 case 512u: 00105 Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH; 00106 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512; 00107 break; 00108 case 256u: 00109 Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH; 00110 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256; 00111 break; 00112 case 128u: 00113 Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH; 00114 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128; 00115 break; 00116 case 64u: 00117 Sint->bitRevLength = ARMBITREVINDEXTABLE__64_TABLE_LENGTH; 00118 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64; 00119 break; 00120 case 32u: 00121 Sint->bitRevLength = ARMBITREVINDEXTABLE__32_TABLE_LENGTH; 00122 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32; 00123 break; 00124 case 16u: 00125 Sint->bitRevLength = ARMBITREVINDEXTABLE__16_TABLE_LENGTH; 00126 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16; 00127 break; 00128 default: 00129 /* Reporting argument error if fftSize is not valid value */ 00130 status = ARM_MATH_ARGUMENT_ERROR; 00131 break; 00132 } 00133 00134 return (status); 00135 } 00136 00137 /** 00138 * @} end of RealFFT group 00139 */
Generated on Tue Jul 12 2022 12:36:57 by 1.7.2