]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/tcp3d-lld.git/blob - example/src/tcp3d_main.h
Additional changes to example and test cases.
[keystone-rtos/tcp3d-lld.git] / example / src / tcp3d_main.h
1 /*\r
2  *\r
3  * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ \r
4  * \r
5  * \r
6  *  Redistribution and use in source and binary forms, with or without \r
7  *  modification, are permitted provided that the following conditions \r
8  *  are met:\r
9  *\r
10  *    Redistributions of source code must retain the above copyright \r
11  *    notice, this list of conditions and the following disclaimer.\r
12  *\r
13  *    Redistributions in binary form must reproduce the above copyright\r
14  *    notice, this list of conditions and the following disclaimer in the \r
15  *    documentation and/or other materials provided with the   \r
16  *    distribution.\r
17  *\r
18  *    Neither the name of Texas Instruments Incorporated nor the names of\r
19  *    its contributors may be used to endorse or promote products derived\r
20  *    from this software without specific prior written permission.\r
21  *\r
22  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \r
23  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT \r
24  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\r
25  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT \r
26  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, \r
27  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT \r
28  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\r
29  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\r
30  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT \r
31  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE \r
32  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
33  *\r
34 */\r
35 #ifndef _TCP3D_MAIN_H_\r
36 #define _TCP3D_MAIN_H_\r
37 \r
38 /* XDC includes */\r
39 //#include <xdc/std.h>\r
40 #include <xdc/cfg/global.h>\r
41 #include <xdc/runtime/System.h>\r
42 #include <xdc/runtime/Memory.h>\r
43 #include <xdc/runtime/IHeap.h>\r
44 \r
45 /* Driver includes */\r
46 #include <ti/drv/tcp3d/tcp3d_drv.h>\r
47 #include <ti/drv/tcp3d/src/tcp3d_utils.h>\r
48 \r
49 /* Utility includes */\r
50 #include "tcp3d_codeBlkSeg.h"\r
51 \r
52 /**********************************************************************\r
53  ************************** Test Macros *******************************\r
54  **********************************************************************/\r
55 /**\r
56  * Address mapping is done based on the mapping shown below.\r
57  * Check on the address done to ensure it be in L2SRAM space.\r
58  * \r
59  * L2SRAM      : org = 0x00800000, len = 0x100000 (local)\r
60  * GEM0_L2_MEM : org = 0x10800000, len = 0x100000 (global)\r
61  * GEM1_L2_MEM : org = 0x11800000, len = 0x100000 (global)\r
62  * GEM2_L2_MEM : org = 0x12800000, len = 0x100000 (global)\r
63  * GEM3_L2_MEM : org = 0x13800000, len = 0x100000 (global)\r
64  *\r
65  * MSMCSRAM    : org = 0x0c000000, len = 0x200000 (global)\r
66  */\r
67 #define L2GLBMAP(coreID, addr)   \\r
68     ( ( ((UInt32)(addr) >= 0x00800000) && ((UInt32)(addr) < 0x00900000) ) ? \\r
69       ( (UInt32)(addr) | (UInt32)((0x10 | (coreID & 0x3)) << 24) ) : \\r
70       (UInt32)(addr) ) \r
71 \r
72 /**********************************************************************\r
73  ************************** Test Compile Flags ************************\r
74  **********************************************************************/\r
75 /**\r
76  * Prepare all input config registers outside the Send loop (block size based, etc)\r
77  * except for beta states since they are data dependent.\r
78  */\r
79 #define TEST_PREPARE_ONLY_BETASTATE                     1\r
80 \r
81 /**\r
82  * Set this flag to use the fixed input configuration parameters preparation\r
83  * optimization. This flag is useful only if TEST_PREPARE_ONLY_BETASTATE is\r
84  * not used.\r
85  */\r
86 #define TEST_PREPARE_ONLY_CODEBLOCK_PARAM_DEPENDENT     0\r
87 \r
88 /**\r
89  * Check the beta state values with the reference from the file generated \r
90  * with the test vectors.\r
91  */\r
92 #define TEST_BETA_VALUE_CHECK                           0\r
93 \r
94 /**********************************************************************\r
95  ************************** Test Definitions **************************\r
96  **********************************************************************/\r
97 /* TCP3D modes */\r
98 #define TEST_MODE_SINGLE        CSL_TCP3D_CFG_TCP3_MODE_MODE_SEL_3GPP   //0 (NOT SUPPORTED)\r
99 #define TEST_MODE_LTE           CSL_TCP3D_CFG_TCP3_MODE_MODE_SEL_LTE    //1\r
100 #define TEST_MODE_WIMAX         CSL_TCP3D_CFG_TCP3_MODE_MODE_SEL_WIMAX  //2\r
101 #define TEST_MODE_SPLIT         CSL_TCP3D_CFG_TCP3_MODE_MODE_SEL_HSUPA  //3\r
102 \r
103 /* Test True/False flags */\r
104 #define TEST_FALSE              0\r
105 #define TEST_TRUE               1\r
106 \r
107 /* Test Interrupt flags */\r
108 #define TEST_INTR_ENABLE        1\r
109 #define TEST_INTR_DISABLE       0\r
110 \r
111 /* Enable the correct power domain for the device. */\r
112 #ifdef DEVICE_K2L\r
113 #define TEST_CSL_PSC_PD_TCP3D_0       CSL_PSC_PD_TCP3D_0\r
114 #define TEST_CSL_PSC_LPSC_TCP3D_0     CSL_PSC_LPSC_TCP3D_0\r
115 #define TEST_CSL_PSC_PD_TCP3D_1       CSL_PSC_PD_TCP3D_1\r
116 #define TEST_CSL_PSC_LPSC_TCP3D_1     CSL_PSC_LPSC_TCP3D_1\r
117 #else /* DEVICE_K2K, DEVICE_K2H */\r
118 #define TEST_CSL_PSC_PD_TCP3D_0       CSL_PSC_PD_TCP3D_01\r
119 #define TEST_CSL_PSC_LPSC_TCP3D_0     CSL_PSC_LPSC_TCP3D_0\r
120 #define TEST_CSL_PSC_PD_TCP3D_1       CSL_PSC_PD_TCP3D_01\r
121 #define TEST_CSL_PSC_LPSC_TCP3D_1     CSL_PSC_LPSC_TCP3D_1\r
122 #endif\r
123 \r
124 /**********************************************************************\r
125  ************************** Test Structures ***************************\r
126  **********************************************************************/\r
127 /*\r
128  * Structure that holds the configuration parameters. Used for storing the\r
129  * configuration values read from the file blockXX_cfgreg.dat for a given\r
130  * code block.\r
131  */\r
132 typedef struct cbConfig\r
133 {\r
134     /* Control */\r
135     Int32 mode_sel;         //TCP3_MODE\r
136     Int32 lte_crc_init_sel;\r
137 \r
138     /* Input */\r
139     Int32 NumInfoBits;      //CFG0\r
140     Int32 SW0_length;       //CFG1\r
141     Int32 maxst_en;         //CFG2\r
142     Int32 out_flag_en;\r
143     Int32 out_order_sel;\r
144     Int32 ext_scale_en;\r
145     Int32 soft_out_flag_en;\r
146     Int32 soft_out_fmt;\r
147     Int32 min_itr;\r
148     Int32 max_itr;\r
149     Int32 snr_val;\r
150     Int32 snr_rep;\r
151     Int32 stop_sel;\r
152     Int32 crc_iter_pass;\r
153     Int32 crc_sel;\r
154     Int32 maxst_thold;        //CFG3\r
155     Int32 maxst_value;\r
156     Int32 ext_scale_0;        //CFG8\r
157     Int32 ext_scale_1;\r
158     Int32 ext_scale_2;\r
159     Int32 ext_scale_3;\r
160     Int32 ext_scale_4;        //CFG9\r
161     Int32 ext_scale_5;\r
162     Int32 ext_scale_6;\r
163     Int32 ext_scale_7;\r
164     Int32 ext_scale_8;        //CFG10\r
165     Int32 ext_scale_9;\r
166     Int32 ext_scale_10;\r
167     Int32 ext_scale_11;\r
168     Int32 ext_scale_12;       //CFG11\r
169     Int32 ext_scale_13;\r
170     Int32 ext_scale_14;\r
171     Int32 ext_scale_15;\r
172 } cbConfig;\r
173 \r
174 /*\r
175  * Structure for one code block description.\r
176  */\r
177 typedef struct cbDataDesc\r
178 {\r
179     UInt32      mode;\r
180     UInt32      crcInitVal;\r
181     Int8        tailBits[12];\r
182     Tcp3d_InCfgParams   *inCfgParams;\r
183     UInt8       sw0LengthUsed;\r
184 \r
185     UInt32  blockSize;\r
186     UInt32  interFlag;\r
187     UInt32  sdFlag;\r
188     UInt32  stsFlag;\r
189     UInt32  llrOffset;\r
190     UInt32  sdOffset;\r
191 \r
192     UInt32  sizeCFG;\r
193     UInt32  sizeINTER;\r
194     UInt32  sizeLLR;\r
195     UInt32  sizeHD;\r
196     UInt32  sizeSD;\r
197     UInt32  sizeSTS;\r
198 \r
199     UInt32  *inCfg;\r
200     UInt16  *inInter;\r
201     Int8    *inLLR; /* three arrays with offset in llrOffset */\r
202     UInt32  *outHD;\r
203     UInt32  *refHD;\r
204     Int8    *outSD; /* three arrays with offset in sdOffset */\r
205     Int8    *refSD; /* three arrays with offset in sdOffset */\r
206     UInt32  *outSts;\r
207     UInt32  *refSts;\r
208 } cbDataDesc;\r
209 \r
210 /*\r
211  * Structure for one test description. \r
212  */\r
213 typedef struct cbTestDesc\r
214 {\r
215     cbDataDesc  **cbData;\r
216     Int32       maxNumCB;\r
217     Int32       mode;\r
218     Int32       doubleBuffer;\r
219     Int32       lteCrcSel;\r
220 } cbTestDesc;\r
221 \r
222 /**********************************************************************\r
223  ************************** Test Global Tables ************************\r
224  **********************************************************************/\r
225 /* interleaver tables (used in tcp3d_inputCongigPrep.c file) */\r
226 extern Int16 TCP3_LteInterleaverTable[220][7];\r
227 extern Int16 TCP3_WimaxInterleaverTable[17][4];\r
228 \r
229 /**********************************************************************\r
230  *********************** Test Global Functions ************************\r
231  **********************************************************************/\r
232 /* interleaver table index calculation function */\r
233 Int32 LTE_interleaver_index(Int32 K);\r
234 Int32 WIMAX_interleaver_index(Int32 K);\r
235 \r
236 /* input config prepare function definitions (see tcp3d_inputCongigPrep.c) */\r
237 Void prepareBlockSizeDepICParams(cbDataDesc *cbPtr);\r
238 Void prepareBetaStateICParams(cbDataDesc *cbPtr, UInt8 mode);\r
239 Void prepareIC(cbDataDesc *cbPtr, UInt32 *tempIC, UInt8 copyFlag);\r
240 Void fillICParams(Tcp3d_InCfgParams *inCfgParams, cbConfig *cbCfg);\r
241 Void checkBetaValues (UInt32 inCfg[]);\r
242 \r
243 /* Test vector functions (see tcp3d_testvector.c) */\r
244 Int getTestSetCB(IHeap_Handle dataHeap, cbTestDesc *cbTestSet, Char *testFolder);\r
245 Void freeTestSetCB(IHeap_Handle dataHeap, cbTestDesc *cbTestSet);\r
246 \r
247 #endif  /* _TCP3D_MAIN_H_ */\r