[Feature]Upload Modem source code
Change-Id: Id4294f30faced84d3e6fd6d5e61e1111bf287a37
diff --git a/mcu/tools/lif_parser/lif_tbl_parser.pl b/mcu/tools/lif_parser/lif_tbl_parser.pl
new file mode 100644
index 0000000..3b6e54d
--- /dev/null
+++ b/mcu/tools/lif_parser/lif_tbl_parser.pl
@@ -0,0 +1,704 @@
+#LIF & Path calculation table parser
+use Win32::OLE;
+use warnings;
+use strict;
+
+my $input_file = $ARGV[0];
+my $output_file = $ARGV[1];
+
+open (out_file,">$output_file") or die "ERROR\n";
+
+print "Input file: $input_file\n";
+print "Output file: $output_file\n";
+
+# Open excel
+my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
+|| Win32::OLE->new('Excel.Application', 'Quit');
+our $workbook = $Excel->Workbooks->Open($input_file);
+
+# Special assignment table
+my ($special_assignment_define, $special_assignment_string, $special_assignment_search_string) = special_assignment_process();
+
+# RX path calc split table
+my ($rx_path_calc_split_define, $rx_path_calc_split_string, $rx_path_calc_split_search_string) = rx_path_calc_split_process();
+
+# RX path calc spur table
+my ($rx_path_calc_spur_define, $rx_path_calc_spur_string, $rx_path_calc_spur_search_string) = rx_path_calc_spur_process();
+
+# LIF spur table
+my ($lif_spur_define, $lif_spur_string, $lif_spur_search_string) = lif_spur_process();
+
+# Write output file
+print out_file "// TODO: UPDATE THESE DEFINES TO mml1_path_calculation_lif.h\n";
+print out_file $special_assignment_define;
+print out_file $rx_path_calc_split_define;
+print out_file $rx_path_calc_spur_define;
+print out_file $lif_spur_define;
+
+print out_file "\n\n";
+print out_file "\n\n";
+
+print out_file "// TODO: UPDATE THESE TABLES TO mml1_path_calculation_lif_tables.c\n";
+print out_file $special_assignment_string;
+# Search table not used for SpecialAssign table
+#print out_file $special_assignment_search_string;
+print out_file $rx_path_calc_split_string;
+print out_file $rx_path_calc_split_search_string;
+print out_file $rx_path_calc_spur_string;
+print out_file $rx_path_calc_spur_search_string;
+print out_file "\n\n";
+print out_file "\n\n";
+print out_file $lif_spur_string;
+print out_file $lif_spur_search_string;
+
+close(out_file);
+
+# Close excel
+$workbook->Close(0);
+$Excel->Workbooks->Close();
+
+sub special_assignment_process
+{
+ # Open worksheet
+ my $curr_ws = $workbook->Worksheets("SpecialAssign");
+ print "\nProcessing sheet: SpecialAssign\n";
+
+ # Process
+ my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
+ my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
+ my $start_row = 3;
+
+ print "--->Number of Rows=> $Tot_Rows\n";
+ print "--->Number of Cols=> $Tot_Cols\n";
+ print "--->Start parsing from Row $start_row ...\n";
+
+ my ($rxpath_str,$rxpath_search_str);
+
+ $rxpath_str .= "const MML1_PC_SPECIAL_ASSIGNMENT_T MML1_PC_SPECIAL_ASSIGNMENT_TBL[MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE] =\n";
+ $rxpath_str .= "{\n";
+ $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";
+
+ $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_SPECIAL_ASSIGNMENT_SEARCH_TBL[MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE] =\n";
+ $rxpath_search_str .= "{\n";
+
+ my $lif_count = 0;
+ my $j;
+ # Process rows
+ for $j ($start_row..$Tot_Rows)
+ {
+ if($curr_ws->Cells($j,1)->{'Value'} eq '')
+ {
+ #print "----->Empty row...\n"
+ }
+ else
+ {
+ $rxpath_str .= " {";
+
+ # RX CC num
+ my $i;
+ my $rx_cc_num = 0;
+ for $i (1...6)
+ {
+ if(!($curr_ws->Cells($j,$i)->{'Value'} eq '0'))
+ {
+ $rx_cc_num++;
+ }
+ else
+ {
+ last;
+ }
+ }
+
+ # TX & SUL CC num
+ my $tx_cc_num = 0;
+ my $sul_cc_num = 0;
+ for $i (0...1)
+ {
+ if(!($curr_ws->Cells($j,(7+$i*2))->{'Value'} eq '0'))
+ {
+ $tx_cc_num++;
+ }
+ else
+ {
+ last;
+ }
+ if(!($curr_ws->Cells($j,(7+$i*2+1))->{'Value'} eq '0'))
+ {
+ $sul_cc_num++;
+ }
+ }
+
+ $rxpath_str .= $rx_cc_num;
+ $rxpath_str .= ", ";
+ $rxpath_str .= $tx_cc_num;
+ $rxpath_str .= ", ";
+ $rxpath_str .= $sul_cc_num;
+ $rxpath_str .= ", {";
+
+ # RX CC bands
+ $rxpath_search_str .= " {";
+ my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $rxpath_search_str .= $temp_search;
+ $rxpath_search_str .= ",";
+
+ # TX CC Bands
+ $rxpath_str .= "{";
+ ($temp_str,$temp_search) = band_process($curr_ws,$j,7,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
+ $temp_search .= "},\n";
+ $rxpath_search_str .= $temp_search;
+
+ # RX CC BW
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,17,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX CC BW
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,23,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # RX CC freq
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,33,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX CC freq
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,39,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # RX CC region
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,49,6);
+ $temp_str =~ s/DL/ /g; #Remove DL prefixes used in special assignment table
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX CC region
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,55,6);
+ $temp_str =~ s/UL/ /g; #Remove UL prefixes used in special assignment table
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # SET index
+ $rxpath_str .= " ";
+ $temp_str = coef_process($curr_ws,$j,65,1);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= ",";
+
+ # RX region BW
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,66,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX region BW
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,72,4);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # RX region freq
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,76,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX region freq
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,82,4);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # MAX eLNA gain
+ $rxpath_str .= " ";
+ $temp_str = coef_process($curr_ws,$j,86,1);
+ $temp_str =~ s/G/ /g; #Remove G prefix used in special assignment table
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= ",";
+
+ # Victim RX
+ $rxpath_str .= " ";
+ $temp_str = coef_process($curr_ws,$j,87,1);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= ",";
+
+ # RX region forbidden flags
+ my $k;
+ my $table_idx;
+ $rxpath_str .= "{";
+ for $k (0...5)
+ {
+ $table_idx = 88 + $k*2;
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,$table_idx,2);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ }
+ $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_str .= "},";
+
+ # TX region forbidden flags
+ $rxpath_str .= "{";
+ for $k (0...3)
+ {
+ $table_idx = 100 + $k*2;
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,$table_idx,2);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ }
+ $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_str .= "},";
+
+ # ulca_pa_imd
+ $rxpath_str .= " ";
+ if($curr_ws->Cells($j,108)->{'Value'} eq "ON")
+ {
+ $rxpath_str .= " 1";
+ }
+ else
+ {
+ $rxpath_str .= " 0";
+ }
+ $rxpath_str .= "";
+
+ #End of line
+ $rxpath_str .= "},\n";
+
+ #Increase LIF count
+ $lif_count = $lif_count + 1;
+ }
+ }
+
+ # Avoid empty table
+ if($lif_count == 0)
+ {
+ # Empty instance
+ $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}";
+ $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
+ #Increase count
+ $lif_count = $lif_count + 1;
+ }
+
+ $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_str .= "\n};\n\n";
+ $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_search_str .= "\n};\n\n";
+
+ my $rxpath_define_str .= "#define MML1_PC_SPECIAL_ASSIGNMENT_TBL_SIZE ($lif_count)\n";
+
+ return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
+}
+
+sub rx_path_calc_split_process
+{
+ # Open worksheet
+ my $curr_ws = $workbook->Worksheets("RxPathCal_Split");
+ print "\nProcessing sheet: RxPathCal_Split\n";
+
+ # Process
+ my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
+ my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
+ my $start_row = 3;
+
+ print "--->Number of Rows=> $Tot_Rows\n";
+ print "--->Number of Cols=> $Tot_Cols\n";
+ print "--->Start parsing from Row $start_row ...\n";
+
+ my ($rxpath_str,$rxpath_search_str);
+
+ $rxpath_str .= "const MML1_PC_SPLIT_BAND_T MML1_PC_SPLIT_BAND_TBL[MML1_PC_SPLIT_BAND_TBL_SIZE] = \n";
+ $rxpath_str .= "{\n";
+
+ $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_SPLIT_BAND_SEARCH_TBL[MML1_PC_SPLIT_BAND_TBL_SIZE] =\n";
+ $rxpath_search_str .= "{\n";
+
+ $rxpath_str .= "/* {{RX_Band0, RX_Band1, RX_Band2, RX_Band3, RX_Band4, RX_Band5 },{TX_Band0, SUL_Band0, TX_Band1, SUL_Band0 },NotAllowedBand },*/\n";
+
+ my $lif_count = 0;
+ my $j;
+ # process rows
+ for $j ($start_row..$Tot_Rows)
+ {
+ if(!(defined $curr_ws->Cells($j,1)->{'Value'}))
+ {
+ #print "----->Empty row...\n"
+ }
+ else
+ {
+ my $i;
+ #print "----->Process Row $j\n";
+
+ # RX CC bands
+ $rxpath_str .= " {{";
+ $rxpath_search_str .= " {";
+ my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $rxpath_search_str .= $temp_search;
+ $rxpath_search_str .= ",";
+
+ #TX Bands
+ $rxpath_str .= "{";
+ ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
+ $temp_search .= "},\n";
+ $rxpath_search_str .= $temp_search;
+
+ $rxpath_str .= "";
+ $rxpath_str .= sprintf("%-16s", "MMRF_UNI_BAND" . $curr_ws->Cells($j,11)->{'Value'});
+
+ #End of line
+ $rxpath_str .= "},\n";
+
+ #Increase LIF count
+ $lif_count = $lif_count + 1;
+ }
+ }
+
+ # Avoid empty table
+ if($lif_count == 0)
+ {
+ # Empty instance
+ $rxpath_str .= "\n // No table instances, so use empty one\n {{0,0,0,0,0,0},{0,0,0,0},0}";
+ $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
+ #Increase count
+ $lif_count = $lif_count + 1;
+ }
+
+ $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_str .= "\n};\n\n";
+ $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_search_str .= "\n};\n\n";
+
+ my $rxpath_define_str .= "#define MML1_PC_SPLIT_BAND_TBL_SIZE ($lif_count)\n";
+
+ return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
+}
+
+sub rx_path_calc_spur_process
+{
+ # Open worksheet
+ my $curr_ws = $workbook->Worksheets("RxPathCal_Spur");
+ print "\nProcessing sheet: RxPathCal_Spur\n";
+
+ # process
+ my $Tot_Rows = $curr_ws->UsedRange->Rows->{'Count'};
+ my $Tot_Cols = $curr_ws->UsedRange->Columns->{'Count'};
+ my $start_row = 3;
+
+ print "--->Number of Rows=> $Tot_Rows\n";
+ print "--->Number of Cols=> $Tot_Cols\n";
+ print "--->Start parsing from Row $start_row ...\n";
+
+ my ($rxpath_str,$rxpath_search_str);
+
+ $rxpath_str .= "const MML1_PC_TX_IM2_PARAMS_T MML1_PC_TX_IM2_TBL[MML1_PC_TX_IM2_TBL_SIZE] =\n";
+ $rxpath_str .= "{\n";
+ $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";
+
+ $rxpath_search_str .= "const MML1_PC_LIF_PACKED_BAND_INFO_T MML1_PC_TX_IM2_SEARCH_TBL[MML1_PC_TX_IM2_TBL_SIZE] =\n";
+ $rxpath_search_str .= "{\n";
+
+ my $lif_count = 0;
+ my $j;
+ # process rows
+ for $j ($start_row..$Tot_Rows)
+ {
+ if (!(defined $curr_ws->Cells($j,1)->{'Value'}))
+ {
+ #print "----->Empty row...\n"
+ }
+ else
+ {
+ my $i;
+ #print "----->Process Row $j\n";
+
+ # RX bands
+ $rxpath_str .= " {{{";
+ $rxpath_search_str .= " {";
+ my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $rxpath_search_str .= $temp_search;
+ $rxpath_search_str .= ",";
+
+ #TX Bands
+ $rxpath_str .= "{";
+ ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+ $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
+ $temp_search .= "},\n";
+ $rxpath_search_str .= $temp_search;
+
+ # RX coef
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,11,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # TX coef
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,17,4);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "},";
+
+ # Victim RX
+ $rxpath_str .= sprintf("%12s",$curr_ws->Cells($j,21)->{'Value'} . "},");
+
+ # RX Merge
+ $rxpath_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,22,6);
+ $rxpath_str .= $temp_str;
+ $rxpath_str .= "}";
+
+ #End of line
+ $rxpath_str .= "},\n";
+
+ #Increase LIF count
+ $lif_count = $lif_count + 1;
+ }
+ }
+
+ # Avoid empty table
+ if($lif_count == 0)
+ {
+ # Empty instance
+ $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}}";
+ $rxpath_search_str .= " // No table instances, so use empty one\n {0,0}";
+ #Increase count
+ $lif_count = $lif_count + 1;
+ }
+ $rxpath_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_str .= "\n};\n\n";
+ $rxpath_search_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $rxpath_search_str .= "\n};\n\n";
+
+ my $rxpath_define_str .= "#define MML1_PC_TX_IM2_TBL_SIZE ($lif_count)\n";
+
+ return ($rxpath_define_str,$rxpath_str,$rxpath_search_str);
+}
+
+sub lif_spur_process
+{
+ # Open worksheet
+ my $curr_ws = $workbook->Worksheets("LIFtable");
+ print "\nProcessing sheet: LIFtable\n";
+
+ # process
+ my $Tot_Rows= $curr_ws->UsedRange->Rows->{'Count'};
+ my $Tot_Cols= $curr_ws->UsedRange->Columns->{'Count'};
+ my $start_row = 4;
+
+ print "--->Number of Rows=> $Tot_Rows\n";
+ print "--->Number of Cols=> $Tot_Cols\n";
+ print "--->Start parsing from Row $start_row ...\n";
+
+ # set struct definition
+ 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";
+ $txspur_tbl_str .= "{\n";
+ $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";
+
+ 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";
+ $txspur_search_tbl_str .= "{\n";
+
+ my $lif_count = 0;
+ my $j;
+
+ # process rows
+ for $j ($start_row..$Tot_Rows)
+ {
+ if(!(defined $curr_ws->Cells($j,1)->{'Value'}))
+ {
+ #print "----->Empty row...\n"
+ }
+ else
+ {
+ #print "----->Process Row $j\n";
+
+ # RX bands
+ $txspur_tbl_str .= " {{{";
+ $txspur_search_tbl_str .= " {";
+ my ($temp_str,$temp_search) = band_process($curr_ws,$j,1,6);
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= "},";
+ $txspur_search_tbl_str .= $temp_search;
+ $txspur_search_tbl_str .= ",";
+
+ # TX Bands
+ $txspur_tbl_str .= "{";
+ ($temp_str,$temp_search) = band_process($curr_ws,$j,7,4);
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= "},";
+ $temp_search =~ s/^0*//; #Remove preceding 0's from the beginning
+ $temp_search .= "},\n";
+ $txspur_search_tbl_str .= $temp_search;
+
+ # RX coef
+ $txspur_tbl_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,12,6);
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= "},";
+
+ # TX coef
+ $txspur_tbl_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,18,4);
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= "},";
+
+ # Victim RX
+ $txspur_tbl_str .= sprintf("%12s",$curr_ws->Cells($j,22)->{'Value'} . "},");
+
+ # Spur Group
+ $txspur_tbl_str .= sprintf("%12s",$curr_ws->Cells($j,11)->{'Value'} . ", ");
+
+ # RX BW
+ $txspur_tbl_str .= "{";
+ $temp_str = coef_process($curr_ws,$j,23,6);
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= "},";
+
+ # RX Movable
+ $txspur_tbl_str .= "{";
+
+ my $i;
+ for($i = 29; $i < 35; $i++)
+ {
+ if($curr_ws->Cells($j,$i)->{'Value'} eq 'not')
+ {
+ $txspur_tbl_str .= sprintf("%7s","0,");
+ }
+ else
+ {
+ $txspur_tbl_str .= sprintf("%7s",$curr_ws->Cells($j,$i)->{'Value'} . ",");
+ }
+ }
+ $txspur_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $txspur_tbl_str .= "},";
+
+ # LIF EN
+ if($curr_ws->Cells($j,35)->{'Value'} eq "ON")
+ {
+ $txspur_tbl_str .= sprintf("%8s"," 1,");
+ }
+ else
+ {
+ $txspur_tbl_str .= sprintf("%8s"," 0,");
+ }
+
+ # Max eLNA Gain
+ $txspur_tbl_str .= " ";
+ $temp_str = coef_process($curr_ws,$j,36,1);
+ $temp_str =~ s/G/ /g; #Remove G prefix used in special assignment table
+ $txspur_tbl_str .= $temp_str;
+ $txspur_tbl_str .= ",";
+
+ # APT_flag EN
+ if($curr_ws->Cells($j,37)->{'Value'} eq "ON")
+ {
+ $txspur_tbl_str .= " 1";
+ }
+ else
+ {
+ $txspur_tbl_str .= " 0";
+ }
+
+ #End of line
+ $txspur_tbl_str .= "},\n";
+
+ #Increase LIF count
+ $lif_count = $lif_count + 1;
+ }
+ }
+
+ # Avoid empty table
+ if($lif_count == 0)
+ {
+ # Empty instance
+ $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}";
+ $txspur_search_tbl_str .= " // No table instances, so use empty one\n {0,0}";
+ #Increase count
+ $lif_count = $lif_count + 1;
+ }
+ $txspur_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $txspur_tbl_str .= "\n};\n\n";
+ $txspur_search_tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ $txspur_search_tbl_str .= "\n};\n\n";
+
+ my $define_str .= "#define MML1_LIF_LO_SHIFT_TX_SPUR_TBL_SIZE ($lif_count)\n";
+
+ return ($define_str ,$txspur_tbl_str, $txspur_search_tbl_str);
+}
+
+sub band_process
+{
+ my ($curr_ws,$row,$start,$count) = @_;
+
+ my $i;
+ my $end = $start + $count;
+
+ my $tbl_str;
+ my $tbl_search;
+ for($i = $start; $i < $end; $i++)
+ {
+ if($curr_ws->Cells($row,$i)->{'Value'} eq "0")
+ {
+ $tbl_str .= sprintf("%-19s", "MMRF_UNI_BANDNONE,");
+ if($i == 1)
+ {
+ $tbl_search .= sprintf("%s",0);
+ }
+ else
+ {
+ $tbl_search .= sprintf("%03s",0);
+ }
+ }
+ else
+ {
+ $tbl_str .= sprintf("%-19s", "MMRF_UNI_BAND" . $curr_ws->Cells($row,$i)->{'Value'} . ",");
+
+ if($i == 1)
+ {
+ $tbl_search .= sprintf("%s",$curr_ws->Cells($row,$i)->{'Value'});
+ }
+ else
+ {
+ $tbl_search .= sprintf("%03s",$curr_ws->Cells($row,$i)->{'Value'});
+ }
+ }
+ }
+ $tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ #print "$tbl_str $tbl_search";
+ return ($tbl_str,$tbl_search);
+}
+
+sub coef_process
+{
+ my ($curr_ws,$row,$start,$count) = @_;
+ my $i;
+ my $end = $start + $count;
+
+ my $tbl_str;
+
+ for($i = $start; $i < $end; $i++)
+ {
+ $tbl_str .= sprintf("%10s", $curr_ws->Cells($row,$i)->{'Value'} . ",");
+ }
+
+ $tbl_str =~ s/,\s*$//; #Remove spaces and "," after the last element
+ return $tbl_str;
+}
\ No newline at end of file