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