CMSIS DSP library

Dependents:   performance_timer Surfboard_ gps2rtty Capstone ... more

Legacy Warning

This is an mbed 2 library. To learn more about mbed OS 5, visit the docs.

Committer:
mbed_official
Date:
Fri Nov 20 08:45:18 2015 +0000
Revision:
5:3762170b6d4d
Parent:
3:7a284390b0ce
Synchronized with git revision 2eb940b9a73af188d3004a2575fdfbb05febe62b

Full URL: https://github.com/mbedmicro/mbed/commit/2eb940b9a73af188d3004a2575fdfbb05febe62b/

Added option to build rpc library. closes #1426

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 3:7a284390b0ce 1 /* ----------------------------------------------------------------------
mbed_official 5:3762170b6d4d 2 * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
mbed_official 3:7a284390b0ce 3 *
mbed_official 5:3762170b6d4d 4 * $Date: 19. March 2015
mbed_official 5:3762170b6d4d 5 * $Revision: V.1.4.5
mbed_official 3:7a284390b0ce 6 *
mbed_official 3:7a284390b0ce 7 * Project: CMSIS DSP Library
mbed_official 3:7a284390b0ce 8 * Title: arm_cfft_init_f32.c
mbed_official 3:7a284390b0ce 9 *
mbed_official 3:7a284390b0ce 10 * Description: Split Radix Decimation in Frequency CFFT Floating point processing function
mbed_official 3:7a284390b0ce 11 *
mbed_official 3:7a284390b0ce 12 * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0
mbed_official 3:7a284390b0ce 13 *
mbed_official 3:7a284390b0ce 14 * Redistribution and use in source and binary forms, with or without
mbed_official 3:7a284390b0ce 15 * modification, are permitted provided that the following conditions
mbed_official 3:7a284390b0ce 16 * are met:
mbed_official 3:7a284390b0ce 17 * - Redistributions of source code must retain the above copyright
mbed_official 3:7a284390b0ce 18 * notice, this list of conditions and the following disclaimer.
mbed_official 3:7a284390b0ce 19 * - Redistributions in binary form must reproduce the above copyright
mbed_official 3:7a284390b0ce 20 * notice, this list of conditions and the following disclaimer in
mbed_official 3:7a284390b0ce 21 * the documentation and/or other materials provided with the
mbed_official 3:7a284390b0ce 22 * distribution.
mbed_official 3:7a284390b0ce 23 * - Neither the name of ARM LIMITED nor the names of its contributors
mbed_official 3:7a284390b0ce 24 * may be used to endorse or promote products derived from this
mbed_official 3:7a284390b0ce 25 * software without specific prior written permission.
mbed_official 3:7a284390b0ce 26 *
mbed_official 3:7a284390b0ce 27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
mbed_official 3:7a284390b0ce 28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
mbed_official 3:7a284390b0ce 29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
mbed_official 3:7a284390b0ce 30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
mbed_official 3:7a284390b0ce 31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
mbed_official 3:7a284390b0ce 32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
mbed_official 3:7a284390b0ce 33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
mbed_official 3:7a284390b0ce 34 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 3:7a284390b0ce 35 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
mbed_official 3:7a284390b0ce 36 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
mbed_official 3:7a284390b0ce 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
mbed_official 3:7a284390b0ce 38 * POSSIBILITY OF SUCH DAMAGE.
mbed_official 3:7a284390b0ce 39 * -------------------------------------------------------------------- */
mbed_official 3:7a284390b0ce 40
mbed_official 3:7a284390b0ce 41 #include "arm_math.h"
mbed_official 3:7a284390b0ce 42 #include "arm_common_tables.h"
mbed_official 3:7a284390b0ce 43
mbed_official 3:7a284390b0ce 44 /**
mbed_official 3:7a284390b0ce 45 * @ingroup groupTransforms
mbed_official 3:7a284390b0ce 46 */
mbed_official 3:7a284390b0ce 47
mbed_official 3:7a284390b0ce 48 /**
mbed_official 3:7a284390b0ce 49 * @addtogroup RealFFT
mbed_official 3:7a284390b0ce 50 * @{
mbed_official 3:7a284390b0ce 51 */
mbed_official 3:7a284390b0ce 52
mbed_official 3:7a284390b0ce 53 /**
mbed_official 3:7a284390b0ce 54 * @brief Initialization function for the floating-point real FFT.
mbed_official 3:7a284390b0ce 55 * @param[in,out] *S points to an arm_rfft_fast_instance_f32 structure.
mbed_official 3:7a284390b0ce 56 * @param[in] fftLen length of the Real Sequence.
mbed_official 3:7a284390b0ce 57 * @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.
mbed_official 3:7a284390b0ce 58 *
mbed_official 3:7a284390b0ce 59 * \par Description:
mbed_official 3:7a284390b0ce 60 * \par
mbed_official 5:3762170b6d4d 61 * The parameter <code>fftLen</code> Specifies length of RFFT/CIFFT process. Supported FFT Lengths are 32, 64, 128, 256, 512, 1024, 2048, 4096.
mbed_official 3:7a284390b0ce 62 * \par
mbed_official 3:7a284390b0ce 63 * This Function also initializes Twiddle factor table pointer and Bit reversal table pointer.
mbed_official 3:7a284390b0ce 64 */
mbed_official 3:7a284390b0ce 65 arm_status arm_rfft_fast_init_f32(
mbed_official 3:7a284390b0ce 66 arm_rfft_fast_instance_f32 * S,
mbed_official 3:7a284390b0ce 67 uint16_t fftLen)
mbed_official 3:7a284390b0ce 68 {
mbed_official 3:7a284390b0ce 69 arm_cfft_instance_f32 * Sint;
mbed_official 3:7a284390b0ce 70 /* Initialise the default arm status */
mbed_official 3:7a284390b0ce 71 arm_status status = ARM_MATH_SUCCESS;
mbed_official 3:7a284390b0ce 72 /* Initialise the FFT length */
mbed_official 3:7a284390b0ce 73 Sint = &(S->Sint);
mbed_official 3:7a284390b0ce 74 Sint->fftLen = fftLen/2;
mbed_official 3:7a284390b0ce 75 S->fftLenRFFT = fftLen;
mbed_official 3:7a284390b0ce 76
mbed_official 3:7a284390b0ce 77 /* Initializations of structure parameters depending on the FFT length */
mbed_official 3:7a284390b0ce 78 switch (Sint->fftLen)
mbed_official 3:7a284390b0ce 79 {
mbed_official 5:3762170b6d4d 80 case 2048u:
mbed_official 5:3762170b6d4d 81 /* Initializations of structure parameters for 2048 point FFT */
mbed_official 3:7a284390b0ce 82 /* Initialise the bit reversal table length */
mbed_official 5:3762170b6d4d 83 Sint->bitRevLength = ARMBITREVINDEXTABLE2048_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 84 /* Initialise the bit reversal table pointer */
mbed_official 3:7a284390b0ce 85 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable2048;
mbed_official 5:3762170b6d4d 86 /* Initialise the Twiddle coefficient pointers */
mbed_official 5:3762170b6d4d 87 Sint->pTwiddle = (float32_t *) twiddleCoef_2048;
mbed_official 5:3762170b6d4d 88 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_4096;
mbed_official 3:7a284390b0ce 89 break;
mbed_official 3:7a284390b0ce 90 case 1024u:
mbed_official 3:7a284390b0ce 91 Sint->bitRevLength = ARMBITREVINDEXTABLE1024_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 92 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable1024;
mbed_official 5:3762170b6d4d 93 Sint->pTwiddle = (float32_t *) twiddleCoef_1024;
mbed_official 5:3762170b6d4d 94 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_2048;
mbed_official 3:7a284390b0ce 95 break;
mbed_official 3:7a284390b0ce 96 case 512u:
mbed_official 3:7a284390b0ce 97 Sint->bitRevLength = ARMBITREVINDEXTABLE_512_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 98 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable512;
mbed_official 5:3762170b6d4d 99 Sint->pTwiddle = (float32_t *) twiddleCoef_512;
mbed_official 5:3762170b6d4d 100 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_1024;
mbed_official 3:7a284390b0ce 101 break;
mbed_official 3:7a284390b0ce 102 case 256u:
mbed_official 3:7a284390b0ce 103 Sint->bitRevLength = ARMBITREVINDEXTABLE_256_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 104 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable256;
mbed_official 5:3762170b6d4d 105 Sint->pTwiddle = (float32_t *) twiddleCoef_256;
mbed_official 5:3762170b6d4d 106 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_512;
mbed_official 3:7a284390b0ce 107 break;
mbed_official 3:7a284390b0ce 108 case 128u:
mbed_official 3:7a284390b0ce 109 Sint->bitRevLength = ARMBITREVINDEXTABLE_128_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 110 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable128;
mbed_official 5:3762170b6d4d 111 Sint->pTwiddle = (float32_t *) twiddleCoef_128;
mbed_official 5:3762170b6d4d 112 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_256;
mbed_official 3:7a284390b0ce 113 break;
mbed_official 3:7a284390b0ce 114 case 64u:
mbed_official 3:7a284390b0ce 115 Sint->bitRevLength = ARMBITREVINDEXTABLE__64_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 116 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable64;
mbed_official 5:3762170b6d4d 117 Sint->pTwiddle = (float32_t *) twiddleCoef_64;
mbed_official 5:3762170b6d4d 118 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_128;
mbed_official 3:7a284390b0ce 119 break;
mbed_official 3:7a284390b0ce 120 case 32u:
mbed_official 3:7a284390b0ce 121 Sint->bitRevLength = ARMBITREVINDEXTABLE__32_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 122 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable32;
mbed_official 5:3762170b6d4d 123 Sint->pTwiddle = (float32_t *) twiddleCoef_32;
mbed_official 5:3762170b6d4d 124 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_64;
mbed_official 3:7a284390b0ce 125 break;
mbed_official 3:7a284390b0ce 126 case 16u:
mbed_official 3:7a284390b0ce 127 Sint->bitRevLength = ARMBITREVINDEXTABLE__16_TABLE_LENGTH;
mbed_official 3:7a284390b0ce 128 Sint->pBitRevTable = (uint16_t *)armBitRevIndexTable16;
mbed_official 5:3762170b6d4d 129 Sint->pTwiddle = (float32_t *) twiddleCoef_16;
mbed_official 5:3762170b6d4d 130 S->pTwiddleRFFT = (float32_t *) twiddleCoef_rfft_32;
mbed_official 3:7a284390b0ce 131 break;
mbed_official 3:7a284390b0ce 132 default:
mbed_official 3:7a284390b0ce 133 /* Reporting argument error if fftSize is not valid value */
mbed_official 3:7a284390b0ce 134 status = ARM_MATH_ARGUMENT_ERROR;
mbed_official 3:7a284390b0ce 135 break;
mbed_official 3:7a284390b0ce 136 }
mbed_official 3:7a284390b0ce 137
mbed_official 3:7a284390b0ce 138 return (status);
mbed_official 3:7a284390b0ce 139 }
mbed_official 3:7a284390b0ce 140
mbed_official 3:7a284390b0ce 141 /**
mbed_official 3:7a284390b0ce 142 * @} end of RealFFT group
mbed_official 3:7a284390b0ce 143 */