]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/tcp3d-lld.git/blob - example/src/tcp3d_main.h
Updates for the release
[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 /**********************************************************************\r
112  ************************** Test Structures ***************************\r
113  **********************************************************************/\r
114 /*\r
115  * Structure that holds the configuration parameters. Used for storing the\r
116  * configuration values read from the file blockXX_cfgreg.dat for a given\r
117  * code block.\r
118  */\r
119 typedef struct cbConfig\r
120 {\r
121     /* Control */\r
122     Int32 mode_sel;         //TCP3_MODE\r
123     Int32 lte_crc_init_sel;\r
124 \r
125     /* Input */\r
126     Int32 NumInfoBits;      //CFG0\r
127     Int32 SW0_length;       //CFG1\r
128     Int32 maxst_en;         //CFG2\r
129     Int32 out_flag_en;\r
130     Int32 out_order_sel;\r
131     Int32 ext_scale_en;\r
132     Int32 soft_out_flag_en;\r
133     Int32 soft_out_fmt;\r
134     Int32 min_itr;\r
135     Int32 max_itr;\r
136     Int32 snr_val;\r
137     Int32 snr_rep;\r
138     Int32 stop_sel;\r
139     Int32 crc_iter_pass;\r
140     Int32 crc_sel;\r
141     Int32 maxst_thold;        //CFG3\r
142     Int32 maxst_value;\r
143     Int32 ext_scale_0;        //CFG8\r
144     Int32 ext_scale_1;\r
145     Int32 ext_scale_2;\r
146     Int32 ext_scale_3;\r
147     Int32 ext_scale_4;        //CFG9\r
148     Int32 ext_scale_5;\r
149     Int32 ext_scale_6;\r
150     Int32 ext_scale_7;\r
151     Int32 ext_scale_8;        //CFG10\r
152     Int32 ext_scale_9;\r
153     Int32 ext_scale_10;\r
154     Int32 ext_scale_11;\r
155     Int32 ext_scale_12;       //CFG11\r
156     Int32 ext_scale_13;\r
157     Int32 ext_scale_14;\r
158     Int32 ext_scale_15;\r
159 } cbConfig;\r
160 \r
161 /*\r
162  * Structure for one code block description.\r
163  */\r
164 typedef struct cbDataDesc\r
165 {\r
166     UInt32      mode;\r
167     UInt32      crcInitVal;\r
168     Int8        tailBits[12];\r
169     Tcp3d_InCfgParams   *inCfgParams;\r
170     UInt8       sw0LengthUsed;\r
171 \r
172     UInt32  blockSize;\r
173     UInt32  interFlag;\r
174     UInt32  sdFlag;\r
175     UInt32  stsFlag;\r
176     UInt32  llrOffset;\r
177     UInt32  sdOffset;\r
178 \r
179     UInt32  sizeCFG;\r
180     UInt32  sizeINTER;\r
181     UInt32  sizeLLR;\r
182     UInt32  sizeHD;\r
183     UInt32  sizeSD;\r
184     UInt32  sizeSTS;\r
185 \r
186     UInt32  *inCfg;\r
187     UInt16  *inInter;\r
188     Int8    *inLLR; /* three arrays with offset in llrOffset */\r
189     UInt32  *outHD;\r
190     UInt32  *refHD;\r
191     Int8    *outSD; /* three arrays with offset in sdOffset */\r
192     Int8    *refSD; /* three arrays with offset in sdOffset */\r
193     UInt32  *outSts;\r
194     UInt32  *refSts;\r
195 } cbDataDesc;\r
196 \r
197 /*\r
198  * Structure for one test description. \r
199  */\r
200 typedef struct cbTestDesc\r
201 {\r
202     cbDataDesc  **cbData;\r
203     Int32       maxNumCB;\r
204     Int32       mode;\r
205     Int32       doubleBuffer;\r
206     Int32       lteCrcSel;\r
207 } cbTestDesc;\r
208 \r
209 /**********************************************************************\r
210  ************************** Test Global Tables ************************\r
211  **********************************************************************/\r
212 /* interleaver tables (used in tcp3d_inputCongigPrep.c file) */\r
213 extern Int16 TCP3_LteInterleaverTable[220][7];\r
214 extern Int16 TCP3_WimaxInterleaverTable[17][4];\r
215 \r
216 /**********************************************************************\r
217  *********************** Test Global Functions ************************\r
218  **********************************************************************/\r
219 /* interleaver table index calculation function */\r
220 Int32 LTE_interleaver_index(Int32 K);\r
221 Int32 WIMAX_interleaver_index(Int32 K);\r
222 \r
223 /* input config prepare function definitions (see tcp3d_inputCongigPrep.c) */\r
224 Void prepareBlockSizeDepICParams(cbDataDesc *cbPtr);\r
225 Void prepareBetaStateICParams(cbDataDesc *cbPtr, UInt8 mode);\r
226 Void prepareIC(cbDataDesc *cbPtr, UInt32 *tempIC, UInt8 copyFlag);\r
227 Void fillICParams(Tcp3d_InCfgParams *inCfgParams, cbConfig *cbCfg);\r
228 Void checkBetaValues (UInt32 inCfg[]);\r
229 \r
230 /* Test vector functions (see tcp3d_testvector.c) */\r
231 Int getTestSetCB(IHeap_Handle dataHeap, cbTestDesc *cbTestSet, Char *testFolder);\r
232 Void freeTestSetCB(IHeap_Handle dataHeap, cbTestDesc *cbTestSet);\r
233 \r
234 #endif  /* _TCP3D_MAIN_H_ */\r