public void Read_and_Compare(ref bool OTP_Read_And_Compare_Stop, TextBox Changed_Script, RichTextBox Compared_Result_Script, D_IC d_ic) { Form1 f1 = (Form1)Application.OpenForms["Form1"]; TextBox textBox_Show_Compared_Mipi_Data = Changed_Script; RichTextBox richTextBox_Mipi_Finally_Compared = Compared_Result_Script; f1.Set_GB_ProgressBar_Maximum(textBox_Show_Compared_Mipi_Data.Lines.Length - 1); f1.Set_GB_ProgressBar_Step(1); f1.Set_GB_ProgressBar_Value(0); int count_mipi_parameter = 0; string Register_Address = string.Empty; string All_NG_Register = string.Empty; string annotation = string.Empty; //Comperare 2nd Textbox and Mipi Data read from OTP for (int i = 0; i < textBox_Show_Compared_Mipi_Data.Lines.Length; i++) { if (OTP_Read_And_Compare_Stop) { break; } f1.GB_ProgressBar_PerformStep(); System.Windows.Forms.Application.DoEvents(); if (Is_D_IC_Specific_Process_Performed(textBox_Show_Compared_Mipi_Data.Lines[i], richTextBox_Mipi_Finally_Compared, d_ic, ref annotation)) { //if(Is_D_IC_Specific_Process_Performed(...) do sth then return true, otherwise return false } else { if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(0, 10).ToLower() == "mipi.write") { //Get Address Register_Address = textBox_Show_Compared_Mipi_Data.Lines[i].Substring(18, 2); //Get Parameter Amount if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x15") { count_mipi_parameter = 1; } else if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x39") { count_mipi_parameter = (textBox_Show_Compared_Mipi_Data.Lines[i].Length - 20) / 5; } else if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x05") { count_mipi_parameter = 0; } else if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x0a") //PPA { count_mipi_parameter = 0; //PPA 는 원래 Read 불가한거 , 어짜피 다른값 읽힘 } else { System.Windows.Forms.MessageBox.Show("Error , it should be 0x05 , 0x15 or 0x39"); } //Read Data From OTP try { f1.OTP_Read(count_mipi_parameter, Register_Address); string temp_string = string.Empty; if (count_mipi_parameter == 0) { if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x0a") //if PPA { f1.GB_Status_AppendText_Nextline("Cannot Read PPA(mipi.write 0x0A..) Setting , Skip", Color.Red); } else { temp_string = "mipi.write 0x05 0x" + Register_Address; } } else if (count_mipi_parameter == 1) // <-- 1 일때는 0x39 일수도 있음 !! { if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x15") { temp_string = "mipi.write 0x15 0x" + Register_Address + f1.Get_Textbox_cmd2().Substring(16, 5 + 1); } else if (textBox_Show_Compared_Mipi_Data.Lines[i].Substring(11, 4).ToLower() == "0x39") { temp_string = "mipi.write 0x39 0x" + Register_Address + f1.Get_Textbox_cmd2().Substring(16, 5 + 1); } } else if (count_mipi_parameter < 10) { temp_string = "mipi.write 0x39 0x" + Register_Address + f1.Get_Textbox_cmd2().Substring(16, 5 * count_mipi_parameter + 1); } else if (count_mipi_parameter < 100) { temp_string = "mipi.write 0x39 0x" + Register_Address + f1.Get_Textbox_cmd2().Substring(17, 5 * count_mipi_parameter + 1); } else { temp_string = "mipi.write 0x39 0x" + Register_Address + f1.Get_Textbox_cmd2().Substring(18, 5 * count_mipi_parameter + 1); } richTextBox_Mipi_Finally_Compared.Select(richTextBox_Mipi_Finally_Compared.TextLength, 0); if (textBox_Show_Compared_Mipi_Data.Lines[i].Length > temp_string.Length)// 주석처리가 어디에 되어있냐에 따라 length 다르기에 { temp_string = temp_string.PadRight(textBox_Show_Compared_Mipi_Data.Lines[i].Length, ' '); } else if ((textBox_Show_Compared_Mipi_Data.Lines[i].Length < temp_string.Length)) { int temp = temp_string.Length - textBox_Show_Compared_Mipi_Data.Lines[i].Length; temp_string = temp_string.Remove(textBox_Show_Compared_Mipi_Data.Lines[i].Length, temp); } if (textBox_Show_Compared_Mipi_Data.Lines[i].ToLower() == temp_string.ToLower()) { SetrichTextBox_Mipi_Finally_Compared(temp_string.ToLower(), Color.Green, richTextBox_Mipi_Finally_Compared); f1.GB_Status_AppendText_Nextline(" " + Register_Address + annotation + " OK", Color.Green); } else { SetrichTextBox_Mipi_Finally_Compared(temp_string.ToLower(), Color.Red, richTextBox_Mipi_Finally_Compared); f1.GB_Status_AppendText_Nextline(" " + Register_Address + annotation + " NG", Color.Red); All_NG_Register += (Register_Address + annotation + "\r\n"); } } catch { System.Windows.Forms.MessageBox.Show("OTP Read fail !\nPlease check the Sample or System-connection status"); } } else { // It's not a "mipi.write" command , do nothing } } } if (All_NG_Register != string.Empty) { f1.GB_Status_AppendText_Nextline("==========OTP Read NG List==========", Color.Red); f1.GB_Status_AppendText_Nextline(All_NG_Register, Color.Red); } else { f1.GB_Status_AppendText_Nextline("OTP Read and Compare OK", Color.Green); } }
private bool Is_D_IC_Specific_Process_Performed(string textBox_Show_Compared_Mipi_Data_Line, RichTextBox Compared_Result_Script, D_IC d_ic, ref string annotation) { Form1 f1 = (Form1)Application.OpenForms["Form1"]; RichTextBox richTextBox_Mipi_Finally_Compared = Compared_Result_Script; if (d_ic == D_IC.Normal) { return(false); } else if (d_ic == D_IC.Magna) { if (textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x15 0xb0" || textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x39 0xb0") { f1.IPC_Quick_Send_And_Show(textBox_Show_Compared_Mipi_Data_Line, Color.Blue); SetrichTextBox_Mipi_Finally_Compared(textBox_Show_Compared_Mipi_Data_Line.ToLower(), Color.Blue, richTextBox_Mipi_Finally_Compared); return(true); } else { return(false); } } else if (d_ic == D_IC.Novatec) { string CMD_Page_String = string.Empty; if (textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x15 0xff" || textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x39 0xff") { if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x10") { CMD_Page_String = "(CMD1)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x20") { CMD_Page_String = "(CMD2_P0)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x21") { CMD_Page_String = "(CMD2_P1)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x22") { CMD_Page_String = "(CMD2_P2)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x23") { CMD_Page_String = "(CMD2_P3)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x24") { CMD_Page_String = "(CMD2_P4)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x25") { CMD_Page_String = "(CMD2_P5)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x26") { CMD_Page_String = "(CMD2_P6)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x27") { CMD_Page_String = "(CMD2_P7)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x28") { CMD_Page_String = "(CMD2_P8)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x29") { CMD_Page_String = "(CMD2_P9)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x2a") { CMD_Page_String = "(CMD2_P10)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x2b") { CMD_Page_String = "(CMD2_P11)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x2c") { CMD_Page_String = "(CMD2_P12)"; } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0xe0") { CMD_Page_String = "(CMD2_PE0)"; } else { } f1.IPC_Quick_Send(textBox_Show_Compared_Mipi_Data_Line.Substring(0, 25).ToLower()); SetrichTextBox_Mipi_Finally_Compared(textBox_Show_Compared_Mipi_Data_Line.Substring(0, 25).ToLower(), Color.Blue, richTextBox_Mipi_Finally_Compared); annotation = CMD_Page_String; return(true); } else { return(false); } } else if (d_ic == D_IC.SIW) { if (textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x15 0xb0" || textBox_Show_Compared_Mipi_Data_Line.Substring(0, 20).ToLower() == "mipi.write 0x39 0xb0") { if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0x55") { f1.IPC_Quick_Send_And_Show("mipi.write 0x15 0xB0 0x55", Color.Blue); SetrichTextBox_Mipi_Finally_Compared("mipi.write 0x15 0xB0 0x55".ToLower(), Color.Blue, richTextBox_Mipi_Finally_Compared); } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0xac") { f1.IPC_Quick_Send_And_Show("mipi.write 0x15 0xB0 0xAC", Color.Blue); SetrichTextBox_Mipi_Finally_Compared("mipi.write 0x15 0xB0 0xAC".ToLower(), Color.Blue, richTextBox_Mipi_Finally_Compared); } else if (textBox_Show_Compared_Mipi_Data_Line.Substring(21, 4).ToLower() == "0xca") { f1.IPC_Quick_Send_And_Show("mipi.write 0x15 0xB0 0xCA", Color.Blue); SetrichTextBox_Mipi_Finally_Compared("mipi.write 0x15 0xB0 0xCA".ToLower(), Color.Blue, richTextBox_Mipi_Finally_Compared); } return(true); } else { return(false); } } else { System.Windows.Forms.MessageBox.Show("D_IC Selection is not made"); return(false); } }