1 #if CONFIG_WLS_CSI_PROC
2 /** @file wls_radix4Fft.h
3  *
4  * @brief This file contains header file for fixed-point FFT functions
5  *
6  * Copyright 2023-2024 NXP
7  *
8  * SPDX-License-Identifier: BSD-3-Clause
9  *
10  */
11 
12 /************************************************************************
13  * DFW header file for fixed-point FFT functions
14  ************************************************************************/
15 
16 #ifndef WLS_RADIX4_FFT
17 #define WLS_RADIX4_FFT
18 
19 #include "wls_param_defines.h"
20 
21 #define INT8  signed char
22 #define INT16 short
23 #define INT32 int
24 #ifdef STA_20_ONLY
25 #define MAX_FFT_SIZE_256
26 #define MAX_FFT_SIZE 256
27 #else
28 #define MAX_FFT_SIZE_2048
29 #define MAX_FFT_SIZE 2048
30 #endif
31 // #define TWIDDLE_HALF_SIZE
32 #define TWIDDLE_BIPT 15
33 // #define BIASED_ROUNDING
34 
35 // call separate stages
36 void radix4FftStageOne(INT16 *pSrc, INT16 *pDst, int Nfft);
37 void radix4FftMainStages(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
38 void radix4FftLastStage(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
39 
40 void radix4IfftStageOne(INT16 *pSrc, INT16 *pDst, int Nfft);
41 void radix4IfftMainStages(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
42 void radix4IfftLastStage(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
43 
44 // auxiliary function
45 unsigned int reverse(register unsigned int x);
46 #ifndef ARM_DS5
47 int __clz(int x);
48 #endif
49 
50 void radix4Fft(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
51 void radix4Fft4in64(unsigned int *loadPtr, unsigned int *fftOutBfr, const INT16 *pCoeff, int lenCoeff);
52 
53 void radix4Ifft(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
54 void radix4IfftParallel(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
55 void radix4IfftStride(INT16 *pSrc, INT16 *pDst, int Nfft, const INT16 *pCoeff, int lenCoeff);
56 
57 void radix2Ifft(INT16 *pSrc, int Nfft, const INT16 *pCoeff, int lenCoeff);
58 void radix2IfftParallel(INT16 *pSrc, int Nfft, const INT16 *pCoeff, int lenCoeff);
59 void radix2IfftStride(INT16 *pSrc, int Nfft, const INT16 *pCoeff, int lenCoeff);
60 
61 void radix2FftFlt(float *pBfr, int Nfft, const float *pCoeff, int lenCoeff);
62 void radix2IfftFlt(float *pBfr, int Nfft, const float *pCoeff, int lenCoeff);
63 
64 #define MAX_FFT_FLT 64
65 extern const float twiddleTableFlt[2 * MAX_FFT_FLT];
66 
67 #ifdef TWIDDLE_HALF_SIZE
68 extern const INT16 radix4FftTwiddleArr[MAX_FFT_SIZE];
69 #else
70 extern const INT16 radix4FftTwiddleArr[2 * MAX_FFT_SIZE];
71 #endif
72 
73 #endif
74 
75 #endif /* CONFIG_WLS_CSI_PROC */
76