Subversion Repositories dashGPS

Rev

Rev 2 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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