示例#1
0
        public override bool Initial(ChipControlByPN tableA, ChipDefaultValueByPN tableB, EEPROMDefaultValueByTestPlan tableC, DUTCoeffControlByPN tableD)
        {
            lock (syncRoot)
            {
                try
                {
                    this.dataTable_ChipControlByPN              = tableA;
                    this.dataTable_ChipDefaultValueByPN         = tableB;
                    this.dataTable_EEPROMDefaultValueByTestPlan = tableC;
                    this.dataTable_DUTCoeffControlByPN          = tableD;

                    //QSFP = new EEPROM(TestPlanParaByPN.DUT_USB_Port);
                    //USBIO = new IOPort("USB", TestPlanParaByPN.DUT_USB_Port.ToString());
                    //IOPort.IOConnect();
                    //USBIO = IOPort.GetIOPort();

                    string    filter    = "ItemName = " + "'" + "DEBUGINTERFACE" + "'";
                    DataRow[] foundRows = this.dataTable_DUTCoeffControlByPN.Select(filter);

                    if (foundRows.Length == 0)
                    {
                        Log.SaveLogToTxt("there is no DEBUGINTERFACE");
                    }
                    else if (foundRows.Length > 1)
                    {
                        Log.SaveLogToTxt("count of DEBUGINTERFACE is more than 1");
                    }
                    else
                    {
                        DebugInterface.EngPage      = Convert.ToByte(foundRows[0]["Page"]);
                        DebugInterface.StartAddress = Convert.ToInt32(foundRows[0]["StartAddress"]);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    Log.SaveLogToTxt(ex.ToString());
                    return(false);
                }
            }
        }
示例#2
0
        public bool ReadyForTest(out string dut_SN, out string dut_FW)
        {
            dut_SN = "";
            dut_FW = "";
            string TestStartTime = myDataIO.GetCurrTime().ToString("yyyy/MM/dd HH:mm:ss");

            try
            {
                supply      = null;
                tempControl = null;
                attennuator = null;
                foreach (string key in usedEquipments.Keys)
                {
                    if (key == "POWERSUPPLY")
                    {
                        supply = (PowerSupply)this.usedEquipments[key];
                    }

                    if (key == "THERMOCONTROLLER")
                    {
                        tempControl = (Thermocontroller)this.usedEquipments[key];
                    }

                    if (key == "ATTENNUATOR")
                    {
                        attennuator = (Attennuator)this.usedEquipments[key];
                    }
                }

                // 获得芯片control 地址信息
                Log.SaveLogToTxt("Try to get chip control address from server.");
                string          table      = "GlobalManufactureChipsetControl";
                string          expression = "select * from " + table + " where PID= " + GlobalParaByPN.ID + " order by ID";
                ChipControlByPN dataTable_ChipControlByPN = new ChipControlByPN(myDataIO.GetDataTable(expression, table));

                // 获得芯片初始化赋值信息
                Log.SaveLogToTxt("Try to get chip default value from server.");
                table      = "GlobalManufactureChipsetInitialize";
                expression = "select * from " + table + " where PID= " + GlobalParaByPN.ID + " order by ID";
                ChipDefaultValueByPN dataTable_ChipDefaultValueByPN = new ChipDefaultValueByPN(myDataIO.GetDataTable(expression, table));

                // 获得模块配置EEPROM初始化赋值信息
                Log.SaveLogToTxt("Try to get EEPROM default value from server.");
                table      = "TopoManufactureConfigInit";
                expression = "select * from " + table + " where PID= " + TestPlanParaByPN.ID + " order by ID";
                EEPROMDefaultValueByTestPlan dataTable_EEPROMDefaultValueByTestPlan = new EEPROMDefaultValueByTestPlan(myDataIO.GetDataTable(expression, table));

                // 获得模块系数表信息
                Log.SaveLogToTxt("Try to get module map from server.");
                table      = "GlobalManufactureCoefficients";
                expression = "select * from " + table + " where PID= " + GlobalParaByPN.MCoefsID + " order by ID";
                DUTCoeffControlByPN dataTable_DUTCoeffControlByPN = new DUTCoeffControlByPN(myDataIO.GetDataTable(expression, table));

                dut = myFactory.CreateDUT(GlobalParaByPN.Family);
                dut.Initial(dataTable_ChipControlByPN, dataTable_ChipDefaultValueByPN, dataTable_EEPROMDefaultValueByTestPlan, dataTable_DUTCoeffControlByPN);

                Log.SaveLogToTxt("Enable full function of module.");
                supply.OutPutSwitch(true);
                if (!dut.FullFunctionEnable())
                {
                    Log.SaveLogToTxt("Faield to enable full function of module.");
                    return(false);
                }

                //check SN
                for (int i = 0; i < 3; i++)
                {
                    dut_SN = dut.ReadSN();

                    if (Algorithm.CheckSerialNumberFormat(dut_SN))
                    {
                        Log.SaveLogToTxt("Read module' serial number is " + dut_SN);
                        break;
                    }

                    if (i == 2)
                    {
                        Log.SaveLogToTxt("Failed to read module' serial number.");
                        return(false);
                    }
                }

                //check FW
                for (int i = 0; i < 3; i++)
                {
                    dut_FW = dut.ReadFW();

                    if (dut_FW.Length != 4)
                    {
                        Log.SaveLogToTxt("Failed to read module's firmware.");
                        return(false);
                    }

                    if (dut_FW != "0000" && dut_FW != "FFFF")
                    {
                        if (TestPlanParaByPN.IsCheckFW)
                        {
                            if (dut_FW != TestPlanParaByPN.FwVersion)
                            {
                                Log.SaveLogToTxt("Module's firmware does not math.");
                                break;
                            }
                        }
                        break;
                    }
                }

                return(true);
            }
            catch
            {
                Log.SaveLogToTxt("Failed to prepare to test. Please check network.");
                return(false);
            }
        }
示例#3
0
 public virtual bool Initial(ChipControlByPN tableA, ChipDefaultValueByPN tableB, EEPROMDefaultValueByTestPlan tableC, DUTCoeffControlByPN tableD)
 {
     return(true);
 }
示例#4
0
        public override bool InitialChip(DUTCoeffControlByPN coeffControl, ChipDefaultValueByPN chipDefaultValue)
        {
            lock (syncRoot)
            {
                byte      engpage   = 0;
                int       startaddr = 0;
                string    filter    = "ItemName = " + "'" + "DEBUGINTERFACE" + "'";
                DataRow[] foundRows = coeffControl.Select(filter);

                if (foundRows == null)
                {
                    Log.SaveLogToTxt("There is no debug interface.");
                }
                else if (foundRows.Length > 1)
                {
                    Log.SaveLogToTxt("Count of debug interface is more than 1");
                }
                else
                {
                    engpage   = Convert.ToByte(foundRows[0]["Page"]);
                    startaddr = Convert.ToInt32(foundRows[0]["StartAddress"]);
                }

                if (chipDefaultValue == null)
                {
                    return(true);
                }

                for (int row = 0; row < chipDefaultValue.Rows.Count; row++)
                {
                    if (Convert.ToInt32(chipDefaultValue.Rows[row]["Length"]) == 0)
                    {
                        continue;
                    }
                    byte   length         = Convert.ToByte(chipDefaultValue.Rows[row]["Length"]);
                    bool   isLittleendian = Convert.ToBoolean(chipDefaultValue.Rows[row]["Endianness"]);
                    var    inputdata      = chipDefaultValue.Rows[row]["ItemValue"];
                    byte[] writeData      = Algorithm.ObjectToByteArray(inputdata, length, isLittleendian);
                    byte   driveTpye      = Convert.ToByte(chipDefaultValue.Rows[row]["DriverType"]);
                    byte   chipset        = 0x01;
                    switch (driveTpye)
                    {
                    case 0:
                        chipset = 0x01;
                        break;

                    case 1:
                        chipset = 0x02;
                        break;

                    case 2:
                        chipset = 0x04;
                        break;

                    case 3:
                        chipset = 0x08;
                        break;

                    default:
                        chipset = 0x01;
                        break;
                    }
                    EnterEngMode(engpage);

                    int  registerAddress = Convert.ToInt32(chipDefaultValue.Rows[row]["RegisterAddress"]);
                    byte chipLine        = Convert.ToByte(chipDefaultValue.Rows[row]["ChipLine"]);
                    int  k = 0;
                    for (k = 0; k < 3; k++)
                    {
                        WriteDriver40g(TestPlanParaByPN.DUT_USB_Port, 0xA0, startaddr, registerAddress, chipLine, chipset, writeData, GlobalParaByPN.isOldDriver);
                        // Thread.Sleep(200);
                        StoreDriver40g(TestPlanParaByPN.DUT_USB_Port, 0xA0, startaddr, registerAddress, chipLine, chipset, writeData, GlobalParaByPN.isOldDriver);
                        // Thread.Sleep(200);
                        byte[] temp = new byte[length];
                        temp = ReadDriver40g(TestPlanParaByPN.DUT_USB_Port, 0xA0, startaddr, registerAddress, chipLine, chipset, length, GlobalParaByPN.isOldDriver);

                        if (BitConverter.ToString(temp) == BitConverter.ToString(writeData))
                        {
                            break;
                        }
                    }

                    if (k >= 3)
                    {
                        return(false);
                    }
                }
                return(false);
            }
        }
示例#5
0
 public virtual bool InitialChip(DUTCoeffControlByPN coeffControl, ChipDefaultValueByPN chipDefaultValue)
 {
     return(false);
 }