V4.0.1 of the ARM CMSIS DSP libraries. Note that arm_bitreversal2.s, arm_cfft_f32.c and arm_rfft_fast_f32.c had to be removed. arm_bitreversal2.s will not assemble with the online tools. So, the fast f32 FFT functions are not yet available. All the other FFT functions are available.

Dependents:   MPU9150_Example fir_f32 fir_f32 MPU9150_nucleo_noni2cdev ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_rfft_fast_init_f32.c Source File

arm_rfft_fast_init_f32.c

00001 /* ----------------------------------------------------------------------    
00002 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.    
00003 *    
00004 * $Date:        12. March 2014  
00005 * $Revision:    V1.4.3  
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 
00083   /*  Initializations of structure parameters depending on the FFT length */
00084   switch (Sint->fftLen)
00085   {
00086   case 2048u:
00087     /*  Initializations of structure parameters for 2048 point FFT */
00088     /*  Initialise the bit reversal table length */
00089     Sint->bitRevLength = ARMBITREVINDEXTABLE2048_TABLE_LENGTH;
00090     /*  Initialise the bit reversal table pointer */
00091     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048;
00092     /*  Initialise the Twiddle coefficient pointers */
00093         Sint->pTwiddle     = (float32_t *) twiddleCoef_2048 ;
00094         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_4096;
00095     break;
00096   case 1024u:
00097     Sint->bitRevLength = ARMBITREVINDEXTABLE1024_TABLE_LENGTH;
00098     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024;
00099         Sint->pTwiddle     = (float32_t *) twiddleCoef_1024 ;
00100         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_2048;
00101     break;
00102   case 512u:
00103     Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH;
00104     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512;
00105         Sint->pTwiddle     = (float32_t *) twiddleCoef_512 ;
00106         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_1024;
00107     break;
00108   case 256u:
00109     Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH;
00110     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256;
00111         Sint->pTwiddle     = (float32_t *) twiddleCoef_256 ;
00112         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_512;
00113     break;
00114   case 128u:
00115     Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH;
00116     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128;
00117         Sint->pTwiddle     = (float32_t *) twiddleCoef_128 ;
00118         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_256;
00119     break;
00120   case 64u:
00121     Sint->bitRevLength = ARMBITREVINDEXTABLE__64_TABLE_LENGTH;
00122     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64;
00123         Sint->pTwiddle     = (float32_t *) twiddleCoef_64 ;
00124         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_128;
00125     break;
00126   case 32u:
00127     Sint->bitRevLength = ARMBITREVINDEXTABLE__32_TABLE_LENGTH;
00128     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32;
00129         Sint->pTwiddle     = (float32_t *) twiddleCoef_32 ;
00130         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_64;
00131     break;
00132   case 16u:
00133     Sint->bitRevLength = ARMBITREVINDEXTABLE__16_TABLE_LENGTH;
00134     Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16;
00135         Sint->pTwiddle     = (float32_t *) twiddleCoef_16 ;
00136         S->pTwiddleRFFT    = (float32_t *) twiddleCoef_rfft_32;
00137     break;
00138   default:
00139     /*  Reporting argument error if fftSize is not valid value */
00140     status = ARM_MATH_ARGUMENT_ERROR;
00141     break;
00142   }
00143 
00144   return (status);
00145 }
00146 
00147 /**   
00148  * @} end of RealFFT group   
00149  */