1 /* 2 * Copyright (C) 2017-2024 Alibaba Group Holding Limited 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 /****************************************************************************** 20 * @file drv/fft.h 21 * @brief Header File for FFT Driver 22 * @version V1.0 23 * @date 11. Nov 2020 24 * @model fft 25 ******************************************************************************/ 26 27 #ifndef _DRV_FFT_H_ 28 #define _DRV_FFT_H_ 29 30 #include <stdint.h> 31 #include <stdbool.h> 32 #include <stddef.h> 33 34 #ifdef __cplusplus 35 extern "C" { 36 #endif 37 38 typedef enum { 39 ///< 512-point FFT 40 CSKY_MCA_FFT_LEN_512 = 0x1, 41 ///< 256-point FFT 42 CSKY_MCA_FFT_LEN_256 = 0x2, 43 ///< 128-point FFT 44 CSKY_MCA_FFT_LEN_128 = 0x4, 45 ///< 64-point FFT 46 CSKY_MCA_FFT_LEN_64 = 0x8, 47 ///< 32-point FFT 48 CSKY_MCA_FFT_LEN_32 = 0x10, 49 ///< 16-point FFT 50 CSKY_MCA_FFT_LEN_16 = 0x20, 51 } csky_mca_fft_len_t; 52 53 /* 8-bit fixed-point numeric type in user-defined format */ 54 typedef int8_t fxp8_t; 55 56 /* 16-bit fixed-point numeric type in user-defined format */ 57 typedef int16_t fxp16_t; 58 59 /* 24-bit fixed-point numeric type in user-defined format */ 60 typedef int32_t fxp24_t; 61 62 /* 32-bit fixed-point numeric type in user-defined format */ 63 typedef int32_t fxp32_t; 64 65 /* 64-bit fixed-point numeric type in user-defined format */ 66 typedef int64_t fxp64_t; 67 68 /* 8-bit fixed-point numeric type in 1.0.7 format */ 69 typedef fxp8_t q7_t; 70 71 /* 16-bit fixed-point numeric type in 1.0.15 format */ 72 typedef fxp16_t q15_t; 73 74 /* 32-bit fixed-point numeric type in 1.15.16 format */ 75 typedef fxp32_t q16_t; 76 77 void csky_mca_rfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp32_t *output); 78 void csky_mca_cfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output); 79 void csky_mca_rifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output); 80 void csky_mca_cifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output); 81 void csky_mca_power_spectrum_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp64_t *output); 82 83 #ifdef __cplusplus 84 } 85 #endif 86 87 #endif /* _DRV_FFT_H_ */ 88