1 /*
2  * Copyright (C) 2017-2020 Alibaba Group Holding Limited
3  */
4 
5 /******************************************************************************
6  * @file     drv/fft.h
7  * @brief    Header File for FFT Driver
8  * @version  V1.0
9  * @date     11. Nov 2020
10  * @model    fft
11  ******************************************************************************/
12 
13 #ifndef _DRV_FFT_H_
14 #define _DRV_FFT_H_
15 
16 #include <stdint.h>
17 #include <stdbool.h>
18 #include <stddef.h>
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 typedef enum {
25     ///< 512-point FFT
26     CSKY_MCA_FFT_LEN_512 = 0x1,
27     ///< 256-point FFT
28     CSKY_MCA_FFT_LEN_256 = 0x2,
29     ///< 128-point FFT
30     CSKY_MCA_FFT_LEN_128 = 0x4,
31     ///< 64-point FFT
32     CSKY_MCA_FFT_LEN_64 = 0x8,
33     ///< 32-point FFT
34     CSKY_MCA_FFT_LEN_32 = 0x10,
35     ///< 16-point FFT
36     CSKY_MCA_FFT_LEN_16 = 0x20,
37 } csky_mca_fft_len_t;
38 
39 /* 8-bit fixed-point numeric type in user-defined format */
40 typedef int8_t fxp8_t;
41 
42 /* 16-bit fixed-point numeric type in user-defined format */
43 typedef int16_t fxp16_t;
44 
45 /* 24-bit fixed-point numeric type in user-defined format */
46 typedef int32_t fxp24_t;
47 
48 /* 32-bit fixed-point numeric type in user-defined format */
49 typedef int32_t fxp32_t;
50 
51 /* 64-bit fixed-point numeric type in user-defined format */
52 typedef int64_t fxp64_t;
53 
54 /* 8-bit fixed-point numeric type in 1.0.7 format */
55 typedef fxp8_t q7_t;
56 
57 /* 16-bit fixed-point numeric type in 1.0.15 format */
58 typedef fxp16_t q15_t;
59 
60 /* 32-bit fixed-point numeric type in 1.15.16 format */
61 typedef fxp32_t q16_t;
62 
63 void csky_mca_rfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp32_t *output);
64 void csky_mca_cfft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
65 void csky_mca_rifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
66 void csky_mca_cifft_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, fxp32_t *output);
67 void csky_mca_power_spectrum_fxp32(csky_mca_fft_len_t fft_len, const fxp32_t *input, size_t input_size, fxp64_t *output);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 
73 #endif /* _DRV_FFT_H_ */
74