blob: 3b6e54d89deee552c2597ce6ceae6fad592ba97c [file] [log] [blame]
rjw6c1fd8f2022-11-30 14:33:01 +08001#LIF & Path calculation table parser
2use Win32::OLE;
3use warnings;
4use strict;
5
6my $input_file = $ARGV[0];
7my $output_file = $ARGV[1];
8
9open (out_file,">$output_file") or die "ERROR\n";
10
11print "Input file: $input_file\n";
12print "Output file: $output_file\n";
13
14# Open excel
15my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
16|| Win32::OLE->new('Excel.Application', 'Quit');
17our $workbook = $Excel->Workbooks->Open($input_file);
18
19# Special assignment table
20my ($special_assignment_define, $special_assignment_string, $special_assignment_search_string) = special_assignment_process();
21
22# RX path calc split table
23my ($rx_path_calc_split_define, $rx_path_calc_split_string, $rx_path_calc_split_search_string) = rx_path_calc_split_process();
24
25# RX path calc spur table
26my ($rx_path_calc_spur_define, $rx_path_calc_spur_string, $rx_path_calc_spur_search_string) = rx_path_calc_spur_process();
27
28# LIF spur table
29my ($lif_spur_define, $lif_spur_string, $lif_spur_search_string) = lif_spur_process();
30
31# Write output file
32print out_file "// TODO: UPDATE THESE DEFINES TO mml1_path_calculation_lif.h\n";
33print out_file $special_assignment_define;
34print out_file $rx_path_calc_split_define;
35print out_file $rx_path_calc_spur_define;
36print out_file $lif_spur_define;
37
38print out_file "\n\n";
39print out_file "\n\n";
40
41print out_file "// TODO: UPDATE THESE TABLES TO mml1_path_calculation_lif_tables.c\n";
42print out_file $special_assignment_string;
43# Search table not used for SpecialAssign table
44#print out_file $special_assignment_search_string;
45print out_file $rx_path_calc_split_string;
46print out_file $rx_path_calc_split_search_string;
47print out_file $rx_path_calc_spur_string;
48print out_file $rx_path_calc_spur_search_string;
49print out_file "\n\n";
50print out_file "\n\n";
51print out_file $lif_spur_string;
52print out_file $lif_spur_search_string;
53
54close(out_file);
55
56# Close excel
57$workbook->Close(0);
58$Excel->Workbooks->Close();
59
60sub special_assignment_process
61{
62 # Open worksheet
63 my $curr_ws = $workbook->Worksheets("SpecialAssign");
64 print "\nProcessing sheet: SpecialAssign\n";
65
66 # Process
67 my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
68 my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
69 my $start_row = 3;
70
71 print "--->Number of Rows=> $Tot_Rows\n";
72 print "--->Number of Cols=> $Tot_Cols\n";
73 print "--->Start parsing from Row $start_row ...\n";
74
75 my ($rxpath_str,$rxpath_search_str);
76
77 $rxpath_str .= "const MML1_PC_SPECIAL_ASSIGNMENT_T MML1_PC_SPECIAL_ASSIGNMENT_TBL[MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE] =\n";
78 $rxpath_str .= "{\n";
79 $rxpath_str .= "\/* {CC_nums, {RX_Band0, RX_Band1, RX_Band2, RX_Band3, RX_Band4, RX_Band5 },{TX_Band0, SUL_Band0, TX_Band1, SUL_Band0, TX_Band2, SUL_Band2 },{ RX_BW0, RX_BW1, RX_BW2, RX_BW3, RX_BW4, RX_BW5},{ TX_BW0, SUL_BW0, TX_BW1, SUL_BW1, TX_BW2, SUL_BW2},{ RX_freq0, RX_freq1, RX_freq2, RX_freq3, RX_freq4, RX_freq5},{ TX_freq0,SUL_freq0, TX_freq1,SUL_freq1, TX_freq1,SUL_freq1},{ CC0_path, CC1_path, CC2_path, CC3_path, CC4_path, CC5_path},{ TX0_path,SUL0_path, TX1_path,SUL1_path,TX2_path, SUL2_path}, SET#,{ DL0_BW, DL1_BW, DL2_BW, DL3_BW, DL4_BW, DL5_BW},{ UL0_BW, UL1_BW, UL2_BW, UL3_BW},{ DL0_freq, DL1_freq, DL2_freq, DL3_freq, DL4_freq, DL5_freq},{ UL0_freq,SUL0_freq, UL1_freq,SUL1_freq}, MAX_eLNA, Victim_RX,{{ RX0_LO_F, RX0_BW_F},{ RX1_LO_F, RX1_BW_F},{ RX2_LO_F, RX2_BW_F},{ RX3_LO_F, RX3_BW_F},{ RX4_LO_F, RX4_BW_F},{ RX5_LO_F, RX5_BW_F}},{{ TX0_LO_F, TX0_BW_F},{SUL0_LO_F,SUL0_BW_F},{ TX1_LO_F, TX1_BW_F},{SUL1_LO_F,SUL1_BW_F}},UL_PA_IMD},*/\n";
80
81 $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_SPECIAL_ASSIGNMENT_SEARCH_TBL[MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE] =\n";
82 $rxpath_search_str .= "{\n";
83
84 my $lif_count = 0;
85 my $j;
86 # Process rows
87 for $j ($start_row..$Tot_Rows)
88 {
89 if($curr_ws->Cells($j,1)->{'Value'} eq '')
90 {
91 #print "----->Empty row...\n"
92 }
93 else
94 {
95 $rxpath_str .= " {";
96
97 # RX CC num
98 my $i;
99 my $rx_cc_num = 0;
100 for $i (1...6)
101 {
102 if(!($curr_ws->Cells($j,$i)->{'Value'} eq '0'))
103 {
104 $rx_cc_num++;
105 }
106 else
107 {
108 last;
109 }
110 }
111
112 # TX & SUL CC num
113 my $tx_cc_num = 0;
114 my $sul_cc_num = 0;
115 for $i (0...1)
116 {
117 if(!($curr_ws->Cells($j,(7+$i*2))->{'Value'} eq '0'))
118 {
119 $tx_cc_num++;
120 }
121 else
122 {
123 last;
124 }
125 if(!($curr_ws->Cells($j,(7+$i*2+1))->{'Value'} eq '0'))
126 {
127 $sul_cc_num++;
128 }
129 }
130
131 $rxpath_str .= $rx_cc_num;
132 $rxpath_str .= ", ";
133 $rxpath_str .= $tx_cc_num;
134 $rxpath_str .= ", ";
135 $rxpath_str .= $sul_cc_num;
136 $rxpath_str .= ", {";
137
138 # RX CC bands
139 $rxpath_search_str .= " {";
140 my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
141 $rxpath_str .= $temp_str;
142 $rxpath_str .= "},";
143 $rxpath_search_str .= $temp_search;
144 $rxpath_search_str .= ",";
145
146 # TX CC Bands
147 $rxpath_str .= "{";
148 ($temp_str,$temp_search) = band_process($curr_ws,$j,7,6);
149 $rxpath_str .= $temp_str;
150 $rxpath_str .= "},";
151 $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
152 $temp_search .= "},\n";
153 $rxpath_search_str .= $temp_search;
154
155 # RX CC BW
156 $rxpath_str .= "{";
157 $temp_str = coef_process($curr_ws,$j,17,6);
158 $rxpath_str .= $temp_str;
159 $rxpath_str .= "},";
160
161 # TX CC BW
162 $rxpath_str .= "{";
163 $temp_str = coef_process($curr_ws,$j,23,6);
164 $rxpath_str .= $temp_str;
165 $rxpath_str .= "},";
166
167 # RX CC freq
168 $rxpath_str .= "{";
169 $temp_str = coef_process($curr_ws,$j,33,6);
170 $rxpath_str .= $temp_str;
171 $rxpath_str .= "},";
172
173 # TX CC freq
174 $rxpath_str .= "{";
175 $temp_str = coef_process($curr_ws,$j,39,6);
176 $rxpath_str .= $temp_str;
177 $rxpath_str .= "},";
178
179 # RX CC region
180 $rxpath_str .= "{";
181 $temp_str = coef_process($curr_ws,$j,49,6);
182 $temp_str =~ s/DL/ /g; #Remove DL prefixes used in special assignment table
183 $rxpath_str .= $temp_str;
184 $rxpath_str .= "},";
185
186 # TX CC region
187 $rxpath_str .= "{";
188 $temp_str = coef_process($curr_ws,$j,55,6);
189 $temp_str =~ s/UL/ /g; #Remove UL prefixes used in special assignment table
190 $rxpath_str .= $temp_str;
191 $rxpath_str .= "},";
192
193 # SET index
194 $rxpath_str .= " ";
195 $temp_str = coef_process($curr_ws,$j,65,1);
196 $rxpath_str .= $temp_str;
197 $rxpath_str .= ",";
198
199 # RX region BW
200 $rxpath_str .= "{";
201 $temp_str = coef_process($curr_ws,$j,66,6);
202 $rxpath_str .= $temp_str;
203 $rxpath_str .= "},";
204
205 # TX region BW
206 $rxpath_str .= "{";
207 $temp_str = coef_process($curr_ws,$j,72,4);
208 $rxpath_str .= $temp_str;
209 $rxpath_str .= "},";
210
211 # RX region freq
212 $rxpath_str .= "{";
213 $temp_str = coef_process($curr_ws,$j,76,6);
214 $rxpath_str .= $temp_str;
215 $rxpath_str .= "},";
216
217 # TX region freq
218 $rxpath_str .= "{";
219 $temp_str = coef_process($curr_ws,$j,82,4);
220 $rxpath_str .= $temp_str;
221 $rxpath_str .= "},";
222
223 # MAX eLNA gain
224 $rxpath_str .= " ";
225 $temp_str = coef_process($curr_ws,$j,86,1);
226 $temp_str =~ s/G/ /g; #Remove G prefix used in special assignment table
227 $rxpath_str .= $temp_str;
228 $rxpath_str .= ",";
229
230 # Victim RX
231 $rxpath_str .= " ";
232 $temp_str = coef_process($curr_ws,$j,87,1);
233 $rxpath_str .= $temp_str;
234 $rxpath_str .= ",";
235
236 # RX region forbidden flags
237 my $k;
238 my $table_idx;
239 $rxpath_str .= "{";
240 for $k (0...5)
241 {
242 $table_idx = 88 + $k*2;
243 $rxpath_str .= "{";
244 $temp_str = coef_process($curr_ws,$j,$table_idx,2);
245 $rxpath_str .= $temp_str;
246 $rxpath_str .= "},";
247 }
248 $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
249 $rxpath_str .= "},";
250
251 # TX region forbidden flags
252 $rxpath_str .= "{";
253 for $k (0...3)
254 {
255 $table_idx = 100 + $k*2;
256 $rxpath_str .= "{";
257 $temp_str = coef_process($curr_ws,$j,$table_idx,2);
258 $rxpath_str .= $temp_str;
259 $rxpath_str .= "},";
260 }
261 $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
262 $rxpath_str .= "},";
263
264 # ulca_pa_imd
265 $rxpath_str .= " ";
266 if($curr_ws->Cells($j,108)->{'Value'} eq "ON")
267 {
268 $rxpath_str .= " 1";
269 }
270 else
271 {
272 $rxpath_str .= " 0";
273 }
274 $rxpath_str .= "";
275
276 #End of line
277 $rxpath_str .= "},\n";
278
279 #Increase LIF count
280 $lif_count = $lif_count + 1;
281 }
282 }
283
284 # Avoid empty table
285 if($lif_count == 0)
286 {
287 # Empty instance
288 $rxpath_str .= "\n // No table instances, so use empty one\n {0,0,0,{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},{0,0,0,0,0,0},0,{0,0,0,0,0,0},{0,0,0,0},{0,0,0,0,0,0},{0,0,0,0},0,0,{{0,0},{0,0},{0,0},{0,0},{0,0},{0,0}},{{0,0},{0,0},{0,0},{0,0}},0}";
289 $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
290 #Increase count
291 $lif_count = $lif_count + 1;
292 }
293
294 $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
295 $rxpath_str .= "\n};\n\n";
296 $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
297 $rxpath_search_str .= "\n};\n\n";
298
299 my $rxpath_define_str .= "#define MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE ($lif_count)\n";
300
301 return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
302}
303
304sub rx_path_calc_split_process
305{
306 # Open worksheet
307 my $curr_ws = $workbook->Worksheets("RxPathCal_Split");
308 print "\nProcessing sheet: RxPathCal_Split\n";
309
310 # Process
311 my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
312 my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
313 my $start_row = 3;
314
315 print "--->Number of Rows=> $Tot_Rows\n";
316 print "--->Number of Cols=> $Tot_Cols\n";
317 print "--->Start parsing from Row $start_row ...\n";
318
319 my ($rxpath_str,$rxpath_search_str);
320
321 $rxpath_str .= "const MML1_PC_SPLIT_BAND_T MML1_PC_SPLIT_BAND_TBL[MML1_PC_SPLIT_BAND_TBL_SIZE] = \n";
322 $rxpath_str .= "{\n";
323
324 $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_SPLIT_BAND_SEARCH_TBL[MML1_PC_SPLIT_BAND_TBL_SIZE] =\n";
325 $rxpath_search_str .= "{\n";
326
327 $rxpath_str .= "/* {{RX_Band0, RX_Band1, RX_Band2, RX_Band3, RX_Band4, RX_Band5 },{TX_Band0, SUL_Band0, TX_Band1, SUL_Band0 },NotAllowedBand },*/\n";
328
329 my $lif_count = 0;
330 my $j;
331 # process rows
332 for $j ($start_row..$Tot_Rows)
333 {
334 if(!(defined $curr_ws->Cells($j,1)->{'Value'}))
335 {
336 #print "----->Empty row...\n"
337 }
338 else
339 {
340 my $i;
341 #print "----->Process Row $j\n";
342
343 # RX CC bands
344 $rxpath_str .= " {{";
345 $rxpath_search_str .= " {";
346 my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
347 $rxpath_str .= $temp_str;
348 $rxpath_str .= "},";
349 $rxpath_search_str .= $temp_search;
350 $rxpath_search_str .= ",";
351
352 #TX Bands
353 $rxpath_str .= "{";
354 ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
355 $rxpath_str .= $temp_str;
356 $rxpath_str .= "},";
357 $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
358 $temp_search .= "},\n";
359 $rxpath_search_str .= $temp_search;
360
361 $rxpath_str .= "";
362 $rxpath_str .= sprintf("%-16s", "MMRF_UNI_BAND" . $curr_ws->Cells($j,11)->{'Value'});
363
364 #End of line
365 $rxpath_str .= "},\n";
366
367 #Increase LIF count
368 $lif_count = $lif_count + 1;
369 }
370 }
371
372 # Avoid empty table
373 if($lif_count == 0)
374 {
375 # Empty instance
376 $rxpath_str .= "\n // No table instances, so use empty one\n {{0,0,0,0,0,0},{0,0,0,0},0}";
377 $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
378 #Increase count
379 $lif_count = $lif_count + 1;
380 }
381
382 $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
383 $rxpath_str .= "\n};\n\n";
384 $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
385 $rxpath_search_str .= "\n};\n\n";
386
387 my $rxpath_define_str .= "#define MML1_PC_SPLIT_BAND_TBL_SIZE ($lif_count)\n";
388
389 return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
390}
391
392sub rx_path_calc_spur_process
393{
394 # Open worksheet
395 my $curr_ws = $workbook->Worksheets("RxPathCal_Spur");
396 print "\nProcessing sheet: RxPathCal_Spur\n";
397
398 # process
399 my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
400 my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
401 my $start_row = 3;
402
403 print "--->Number of Rows=> $Tot_Rows\n";
404 print "--->Number of Cols=> $Tot_Cols\n";
405 print "--->Start parsing from Row $start_row ...\n";
406
407 my ($rxpath_str,$rxpath_search_str);
408
409 $rxpath_str .= "const MML1_PC_TX_IM2_PARAMS_T MML1_PC_TX_IM2_TBL[MML1_PC_TX_IM2_TBL_SIZE] =\n";
410 $rxpath_str .= "{\n";
411 $rxpath_str .= "\/* {{{RX_Band0, RX_Band1, RX_Band2, RX_Band3, RX_Band4, RX_Band5 },{TX_Band0, SUL_Band0, TX_Band1, SUL_Band0 },{ RX_Coef0, RX_Coef1, RX_Coef2, RX_Coef3, RX_Coef4, RX_Coef5},{ TX_Coef0, TX_Coef1, TX_Coef2, TX_Coef3}, Victim_RX},{ RX_BW0, RX_BW1, RX_BW2, RX_BW3, RX_BW4, RX_BW5}} *\/\n";
412
413 $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_TX_IM2_SEARCH_TBL[MML1_PC_TX_IM2_TBL_SIZE] =\n";
414 $rxpath_search_str .= "{\n";
415
416 my $lif_count = 0;
417 my $j;
418 # process rows
419 for $j ($start_row..$Tot_Rows)
420 {
421 if (!(defined $curr_ws->Cells($j,1)->{'Value'}))
422 {
423 #print "----->Empty row...\n"
424 }
425 else
426 {
427 my $i;
428 #print "----->Process Row $j\n";
429
430 # RX bands
431 $rxpath_str .= " {{{";
432 $rxpath_search_str .= " {";
433 my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
434 $rxpath_str .= $temp_str;
435 $rxpath_str .= "},";
436 $rxpath_search_str .= $temp_search;
437 $rxpath_search_str .= ",";
438
439 #TX Bands
440 $rxpath_str .= "{";
441 ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
442 $rxpath_str .= $temp_str;
443 $rxpath_str .= "},";
444 $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
445 $temp_search .= "},\n";
446 $rxpath_search_str .= $temp_search;
447
448 # RX coef
449 $rxpath_str .= "{";
450 $temp_str = coef_process($curr_ws,$j,11,6);
451 $rxpath_str .= $temp_str;
452 $rxpath_str .= "},";
453
454 # TX coef
455 $rxpath_str .= "{";
456 $temp_str = coef_process($curr_ws,$j,17,4);
457 $rxpath_str .= $temp_str;
458 $rxpath_str .= "},";
459
460 # Victim RX
461 $rxpath_str .= sprintf("%12s",$curr_ws->Cells($j,21)->{'Value'} . "},");
462
463 # RX Merge
464 $rxpath_str .= "{";
465 $temp_str = coef_process($curr_ws,$j,22,6);
466 $rxpath_str .= $temp_str;
467 $rxpath_str .= "}";
468
469 #End of line
470 $rxpath_str .= "},\n";
471
472 #Increase LIF count
473 $lif_count = $lif_count + 1;
474 }
475 }
476
477 # Avoid empty table
478 if($lif_count == 0)
479 {
480 # Empty instance
481 $rxpath_str .= "\n // No table instances, so use empty one\n {{{0,0,0,0,0,0},{0,0,0,0},{0,0,0,0,0,0},{0,0,0,0},0},{0,0,0,0,0,0}}";
482 $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
483 #Increase count
484 $lif_count = $lif_count + 1;
485 }
486 $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
487 $rxpath_str .= "\n};\n\n";
488 $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
489 $rxpath_search_str .= "\n};\n\n";
490
491 my $rxpath_define_str .= "#define MML1_PC_TX_IM2_TBL_SIZE ($lif_count)\n";
492
493 return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
494}
495
496sub lif_spur_process
497{
498 # Open worksheet
499 my $curr_ws = $workbook->Worksheets("LIFtable");
500 print "\nProcessing sheet: LIFtable\n";
501
502 # process
503 my $Tot_Rows= $curr_ws->UsedRange->Rows->{'Count'};
504 my $Tot_Cols= $curr_ws->UsedRange->Columns->{'Count'};
505 my $start_row = 4;
506
507 print "--->Number of Rows=> $Tot_Rows\n";
508 print "--->Number of Cols=> $Tot_Cols\n";
509 print "--->Start parsing from Row $start_row ...\n";
510
511 # set struct definition
512 my $txspur_tbl_str = "const MML1_LIF_LO_SHIFT_TX_SPUR_PARAMS_T MML1_LIF_LO_SHIFT_TX_SPUR_PARAMS_TBL[MML1_LIF_LO_SHIFT_TX_SPUR_TBL_SIZE] =\n";
513 $txspur_tbl_str .= "{\n";
514 $txspur_tbl_str .= "\/* {{{RX_Band0, RX_Band1, RX_Band2, RX_Band3, RX_Band4, RX_Band5 },{TX_Band0, SUL_Band0, TX_Band1, SUL_Band1 },{ RX_Coef0, RX_Coef1, RX_Coef2, RX_Coef3, RX_Coef4, RX_Coef5},{ TX_Coef0,SUL_Coef0, TX_Coef1,SUL_Coef1}, Victim_RX}, Spur_grp#, { RX_BW0, RX_BW1, RX_BW2, RX_BW3, RX_BW4, RX_BW5},{ RX0_m, RX1_m, RX2_m, RX3_m, RX4_m, RX5_m}, LIF_EN, Max_eLNA_gain, APT_flag} */\n";
515
516 my $txspur_search_tbl_str = "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_LIF_LO_SHIFT_TX_SPUR_SEARCH_TBL[MML1_LIF_LO_SHIFT_TX_SPUR_TBL_SIZE] = \n";
517 $txspur_search_tbl_str .= "{\n";
518
519 my $lif_count = 0;
520 my $j;
521
522 # process rows
523 for $j ($start_row..$Tot_Rows)
524 {
525 if(!(defined $curr_ws->Cells($j,1)->{'Value'}))
526 {
527 #print "----->Empty row...\n"
528 }
529 else
530 {
531 #print "----->Process Row $j\n";
532
533 # RX bands
534 $txspur_tbl_str .= " {{{";
535 $txspur_search_tbl_str .= " {";
536 my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
537 $txspur_tbl_str .= $temp_str;
538 $txspur_tbl_str .= "},";
539 $txspur_search_tbl_str .= $temp_search;
540 $txspur_search_tbl_str .= ",";
541
542 # TX Bands
543 $txspur_tbl_str .= "{";
544 ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
545 $txspur_tbl_str .= $temp_str;
546 $txspur_tbl_str .= "},";
547 $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
548 $temp_search .= "},\n";
549 $txspur_search_tbl_str .= $temp_search;
550
551 # RX coef
552 $txspur_tbl_str .= "{";
553 $temp_str = coef_process($curr_ws,$j,12,6);
554 $txspur_tbl_str .= $temp_str;
555 $txspur_tbl_str .= "},";
556
557 # TX coef
558 $txspur_tbl_str .= "{";
559 $temp_str = coef_process($curr_ws,$j,18,4);
560 $txspur_tbl_str .= $temp_str;
561 $txspur_tbl_str .= "},";
562
563 # Victim RX
564 $txspur_tbl_str .= sprintf("%12s",$curr_ws->Cells($j,22)->{'Value'} . "},");
565
566 # Spur Group
567 $txspur_tbl_str .= sprintf("%12s",$curr_ws->Cells($j,11)->{'Value'} . ", ");
568
569 # RX BW
570 $txspur_tbl_str .= "{";
571 $temp_str = coef_process($curr_ws,$j,23,6);
572 $txspur_tbl_str .= $temp_str;
573 $txspur_tbl_str .= "},";
574
575 # RX Movable
576 $txspur_tbl_str .= "{";
577
578 my $i;
579 for($i = 29; $i < 35; $i++)
580 {
581 if($curr_ws->Cells($j,$i)->{'Value'} eq 'not')
582 {
583 $txspur_tbl_str .= sprintf("%7s","0,");
584 }
585 else
586 {
587 $txspur_tbl_str .= sprintf("%7s",$curr_ws->Cells($j,$i)->{'Value'} . ",");
588 }
589 }
590 $txspur_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
591 $txspur_tbl_str .= "},";
592
593 # LIF EN
594 if($curr_ws->Cells($j,35)->{'Value'} eq "ON")
595 {
596 $txspur_tbl_str .= sprintf("%8s"," 1,");
597 }
598 else
599 {
600 $txspur_tbl_str .= sprintf("%8s"," 0,");
601 }
602
603 # Max eLNA Gain
604 $txspur_tbl_str .= " ";
605 $temp_str = coef_process($curr_ws,$j,36,1);
606 $temp_str =~ s/G/ /g; #Remove G prefix used in special assignment table
607 $txspur_tbl_str .= $temp_str;
608 $txspur_tbl_str .= ",";
609
610 # APT_flag EN
611 if($curr_ws->Cells($j,37)->{'Value'} eq "ON")
612 {
613 $txspur_tbl_str .= " 1";
614 }
615 else
616 {
617 $txspur_tbl_str .= " 0";
618 }
619
620 #End of line
621 $txspur_tbl_str .= "},\n";
622
623 #Increase LIF count
624 $lif_count = $lif_count + 1;
625 }
626 }
627
628 # Avoid empty table
629 if($lif_count == 0)
630 {
631 # Empty instance
632 $txspur_tbl_str .= "\n // No table instances, so use empty one\n {{{0,0,0,0,0,0},{0,0,0,0},{0,0,0,0,0,0},{0,0,0,0},0},0,{0,0,0,0,0,0},{0,0,0,0,0,0},0,0,0}";
633 $txspur_search_tbl_str .= " // No table instances, so use empty one\n {0,0}";
634 #Increase count
635 $lif_count = $lif_count + 1;
636 }
637 $txspur_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
638 $txspur_tbl_str .= "\n};\n\n";
639 $txspur_search_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
640 $txspur_search_tbl_str .= "\n};\n\n";
641
642 my $define_str .= "#define MML1_LIF_LO_SHIFT_TX_SPUR_TBL_SIZE ($lif_count)\n";
643
644 return ($define_str ,$txspur_tbl_str, $txspur_search_tbl_str);
645}
646
647sub band_process
648{
649 my ($curr_ws,$row,$start,$count) = @_;
650
651 my $i;
652 my $end = $start + $count;
653
654 my $tbl_str;
655 my $tbl_search;
656 for($i = $start; $i < $end; $i++)
657 {
658 if($curr_ws->Cells($row,$i)->{'Value'} eq "0")
659 {
660 $tbl_str .= sprintf("%-19s", "MMRF_UNI_BANDNONE,");
661 if($i == 1)
662 {
663 $tbl_search .= sprintf("%s",0);
664 }
665 else
666 {
667 $tbl_search .= sprintf("%03s",0);
668 }
669 }
670 else
671 {
672 $tbl_str .= sprintf("%-19s", "MMRF_UNI_BAND" . $curr_ws->Cells($row,$i)->{'Value'} . ",");
673
674 if($i == 1)
675 {
676 $tbl_search .= sprintf("%s",$curr_ws->Cells($row,$i)->{'Value'});
677 }
678 else
679 {
680 $tbl_search .= sprintf("%03s",$curr_ws->Cells($row,$i)->{'Value'});
681 }
682 }
683 }
684 $tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
685 #print "$tbl_str $tbl_search";
686 return ($tbl_str,$tbl_search);
687}
688
689sub coef_process
690{
691 my ($curr_ws,$row,$start,$count) = @_;
692 my $i;
693 my $end = $start + $count;
694
695 my $tbl_str;
696
697 for($i = $start; $i < $end; $i++)
698 {
699 $tbl_str .= sprintf("%10s", $curr_ws->Cells($row,$i)->{'Value'} . ",");
700 }
701
702 $tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
703 return $tbl_str;
704}