1 #if CONFIG_WLS_CSI_PROC
2 /** @file wls_processing.h
3  *
4  * @brief This file contains header file for CSI processing functions
5  *
6  * Copyright 2023-2024 NXP
7  *
8  * SPDX-License-Identifier: BSD-3-Clause
9  *
10  */
11 
12 /************************************************************************
13  * DFW header file for CSI processing functions
14  ************************************************************************/
15 
16 #ifdef DFW_CSI_PROC
17 #include "dsp_cmd.h"
18 #endif
19 #include "wls_structure_defs.h"
20 
21 #ifndef WLS_PROCESSING_H
22 #define WLS_PROCESSING_H
23 
24 int myAtan2(int valI, int valQ);
25 
26 int myAsin(int x);
27 
28 unsigned int mySqrt(int x);
29 
30 unsigned int mySqrtLut(int x);
31 
32 void readHexDataDemodulateProcess(hal_pktinfo_t *pktinfo,
33                                   hal_wls_processing_input_params_t *inputVals,
34                                   unsigned int *dataPtr,
35                                   int csiDataSize,
36                                   unsigned int *fftInBuffer,
37                                   unsigned int *powerPerSubband,
38                                   int *phaseRollPtr,
39                                   int chNum);
40 void readHexDataDemodulateProcessParallel(hal_pktinfo_t *pktinfo,
41                                           hal_wls_processing_input_params_t *inputVals,
42                                           unsigned int *dataPtr,
43                                           int csiDataSize,
44                                           unsigned int *fftInBfr,
45                                           unsigned int *powerPerSubband,
46                                           int *phaseRollPtr,
47                                           int chNum);
48 
49 void readHexDataDemodulateProcessVhtHeNg1(hal_pktinfo_t *pktinfo,
50                                           hal_wls_processing_input_params_t *inputVals,
51                                           unsigned int *dataPtr,
52                                           int csiDataSize,
53                                           unsigned int *fftInBuffer,
54                                           unsigned int *powerPerSubband,
55                                           int *phaseRollPtr,
56                                           int chNum);
57 void readHexDataDemodulateProcessVhtHeNg1Parallel(hal_pktinfo_t *pktinfo,
58                                                   hal_wls_processing_input_params_t *inputVals,
59                                                   unsigned int *dataPtr,
60                                                   int csiDataSize,
61                                                   unsigned int *fftInBuffer,
62                                                   unsigned int *powerPerSubband,
63                                                   int *phaseRollPtr,
64                                                   int chNum);
65 
66 void detectPhaseJump(hal_pktinfo_t *pktinfo,
67                      hal_wls_processing_input_params_t *inputVals,
68                      unsigned int *fftInBfr,
69                      int *phaseRollPtr);
70 
71 void calculateTotalPower(hal_pktinfo_t *pktinfo, unsigned int *powerPerSubband, unsigned int *totalpower);
72 
73 void processLegacyPackets(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int bufferspacing, int *phaseRollPtr);
74 
75 void interpolatePilots(
76     hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int bufferspacing, int *phaseRollPtr, unsigned int *totalpower);
77 void interpolatePilotsParallel(
78     hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int bufferspacing, int *phaseRollPtr, unsigned int *totalpower);
79 
80 void ifftProcessing(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, unsigned int *fftOutBuffer, int bufferspacing);
81 
82 void interpolateBandEdges20(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int phaseRollNg);
83 void interpolateBandEdges20Parallel(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int *phaseRollPtr);
84 
85 void interpolateBandEdges40(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int phaseRollNg);
86 void interpolateBandEdges40Parallel(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int *phaseRollPtr);
87 
88 void interpolateBandEdges(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int phaseRollNg);
89 void interpolateBandEdgesParallel(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int *phaseRollPtr);
90 
91 void interpolatePairValue(unsigned int *valLeft, unsigned int *valRight, int phaseRollNg);
92 void interpolatePairValueParallel(unsigned int *valLeft, unsigned int *valRight, int *phaseRollPtr);
93 
94 void findActiveSubbands(
95     hal_pktinfo_t *pktinfo, unsigned int *powerPerSubband, unsigned int *totalpower, int chNum, int ftmSignalBW);
96 
97 void zeroOutTones(hal_pktinfo_t *pktinfo, unsigned int *fftInBuffer, int bufferspacing);
98 
99 void removeToneRotation(hal_pktinfo_t *pktinfo, unsigned int *fftInBfr, int bufferspacing);
100 void removeToneRotationParallel(hal_pktinfo_t *pktinfo, unsigned int *fftInBfr, int bufferspacing);
101 
102 void calcPdpAndFirstPathMin(hal_pktinfo_t *pktinfo,
103                             unsigned int *fftOutBuffer,
104                             unsigned int *pdpOutBuffer,
105                             unsigned int *totalpower,
106                             int *idxRes,
107                             unsigned int *valRes,
108                             int *firstPathDelay);
109 
110 void calcPdpAndMax(hal_pktinfo_t *pktinfo,
111                    unsigned int *fftOutBuffer,
112                    unsigned int *pdpOutBuffer,
113                    unsigned int *totalpower,
114                    int *idxRes,
115                    unsigned int *valRes);
116 void calcPdpAndMaxParallel(hal_pktinfo_t *pktinfo,
117                            unsigned int *fftOutBuffer,
118                            unsigned int *pdpOutBuffer,
119                            unsigned int *totalpower,
120                            int *idxRes,
121                            unsigned int *valRes);
122 
123 int findFirstPath(hal_pktinfo_t *pktinfo, unsigned int *pdpOutBuffer, int maxIdx, unsigned int maxVal, int stride);
124 
125 void dumpRawComplex(hal_pktinfo_t *pktinfo, unsigned int *fftBuffer, int peakIdx, unsigned int *destArray);
126 
127 #endif
128 
129 #endif /* CONFIG_WLS_CSI_PROC */
130