Aded CMSIS5 DSP and NN folder. Needs some work

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arm_cfft_radix4_init_f32.c Source File

arm_cfft_radix4_init_f32.c

00001 /* ----------------------------------------------------------------------
00002  * Project:      CMSIS DSP Library
00003  * Title:        arm_cfft_radix4_init_f32.c
00004  * Description:  Radix-4 Decimation in Frequency Floating-point CFFT & CIFFT Initialization function
00005  *
00006  * $Date:        27. January 2017
00007  * $Revision:    V.1.5.1
00008  *
00009  * Target Processor: Cortex-M cores
00010  * -------------------------------------------------------------------- */
00011 /*
00012  * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
00013  *
00014  * SPDX-License-Identifier: Apache-2.0
00015  *
00016  * Licensed under the Apache License, Version 2.0 (the License); you may
00017  * not use this file except in compliance with the License.
00018  * You may obtain a copy of the License at
00019  *
00020  * www.apache.org/licenses/LICENSE-2.0
00021  *
00022  * Unless required by applicable law or agreed to in writing, software
00023  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00024  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00025  * See the License for the specific language governing permissions and
00026  * limitations under the License.
00027  */
00028 
00029 #include "arm_math.h"
00030 #include "arm_common_tables.h"
00031 
00032 /**
00033  * @ingroup groupTransforms
00034  */
00035 
00036 /**
00037  * @addtogroup ComplexFFT
00038  * @{
00039  */
00040 
00041 /**
00042 * @brief  Initialization function for the floating-point CFFT/CIFFT.
00043 * @deprecated Do not use this function.  It has been superceded by \ref arm_cfft_f32 and will be removed
00044 * in the future.
00045 * @param[in,out] *S             points to an instance of the floating-point CFFT/CIFFT structure.
00046 * @param[in]     fftLen         length of the FFT.
00047 * @param[in]     ifftFlag       flag that selects forward (ifftFlag=0) or inverse (ifftFlag=1) transform.
00048 * @param[in]     bitReverseFlag flag that enables (bitReverseFlag=1) or disables (bitReverseFlag=0) bit reversal of output.
00049 * @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.
00050 *
00051 * \par Description:
00052 * \par
00053 * The parameter <code>ifftFlag</code> controls whether a forward or inverse transform is computed.
00054 * Set(=1) ifftFlag for calculation of CIFFT otherwise  CFFT is calculated
00055 * \par
00056 * The parameter <code>bitReverseFlag</code> controls whether output is in normal order or bit reversed order.
00057 * Set(=1) bitReverseFlag for output to be in normal order otherwise output is in bit reversed order.
00058 * \par
00059 * The parameter <code>fftLen</code> Specifies length of CFFT/CIFFT process. Supported FFT Lengths are 16, 64, 256, 1024.
00060 * \par
00061 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
00062 */
00063 
00064 arm_status arm_cfft_radix4_init_f32(
00065   arm_cfft_radix4_instance_f32 * S,
00066   uint16_t fftLen,
00067   uint8_t ifftFlag,
00068   uint8_t bitReverseFlag)
00069 {
00070   /*  Initialise the default arm status */
00071   arm_status status = ARM_MATH_SUCCESS;
00072 
00073   /*  Initialise the FFT length */
00074   S->fftLen = fftLen;
00075 
00076   /*  Initialise the Twiddle coefficient pointer */
00077   S->pTwiddle = (float32_t *) twiddleCoef;
00078 
00079   /*  Initialise the Flag for selection of CFFT or CIFFT */
00080   S->ifftFlag = ifftFlag;
00081 
00082   /*  Initialise the Flag for calculation Bit reversal or not */
00083   S->bitReverseFlag = bitReverseFlag;
00084 
00085   /*  Initializations of structure parameters depending on the FFT length */
00086   switch (S->fftLen)
00087   {
00088 
00089   case 4096U:
00090     /*  Initializations of structure parameters for 4096 point FFT */
00091 
00092     /*  Initialise the twiddle coef modifier value */
00093     S->twidCoefModifier = 1U;
00094     /*  Initialise the bit reversal table modifier */
00095     S->bitRevFactor = 1U;
00096     /*  Initialise the bit reversal table pointer */
00097     S->pBitRevTable = (uint16_t *) armBitRevTable ;
00098     /*  Initialise the 1/fftLen Value */
00099     S->onebyfftLen = 0.000244140625;
00100     break;
00101 
00102   case 1024U:
00103     /*  Initializations of structure parameters for 1024 point FFT */
00104 
00105     /*  Initialise the twiddle coef modifier value */
00106     S->twidCoefModifier = 4U;
00107     /*  Initialise the bit reversal table modifier */
00108     S->bitRevFactor = 4U;
00109     /*  Initialise the bit reversal table pointer */
00110     S->pBitRevTable = (uint16_t *) & armBitRevTable [3];
00111     /*  Initialise the 1/fftLen Value */
00112     S->onebyfftLen = 0.0009765625f;
00113     break;
00114 
00115 
00116   case 256U:
00117     /*  Initializations of structure parameters for 256 point FFT */
00118     S->twidCoefModifier = 16U;
00119     S->bitRevFactor = 16U;
00120     S->pBitRevTable = (uint16_t *) & armBitRevTable [15];
00121     S->onebyfftLen = 0.00390625f;
00122     break;
00123 
00124   case 64U:
00125     /*  Initializations of structure parameters for 64 point FFT */
00126     S->twidCoefModifier = 64U;
00127     S->bitRevFactor = 64U;
00128     S->pBitRevTable = (uint16_t *) & armBitRevTable [63];
00129     S->onebyfftLen = 0.015625f;
00130     break;
00131 
00132   case 16U:
00133     /*  Initializations of structure parameters for 16 point FFT */
00134     S->twidCoefModifier = 256U;
00135     S->bitRevFactor = 256U;
00136     S->pBitRevTable = (uint16_t *) & armBitRevTable [255];
00137     S->onebyfftLen = 0.0625f;
00138     break;
00139 
00140 
00141   default:
00142     /*  Reporting argument error if fftSize is not valid value */
00143     status = ARM_MATH_ARGUMENT_ERROR;
00144     break;
00145   }
00146 
00147   return (status);
00148 }
00149 
00150 /**
00151  * @} end of ComplexFFT group
00152  */
00153