private static void processStopRequest() { NativeMethods.PCI_Stop_Execution(); NativeMethods.PCI_Write_Port(0xC, 0x000); NativeMethods.PCI_Write_DA_List((UInt16)0); fileLoader.m_mut.WaitOne(); //lock file loader thread fileLoader.resetFile(); PrefetchList.resetList(); m_runningLIst = ListNumber.Undefine; fileLoader.m_mut.ReleaseMutex(); m_inputSignals &= ~(IntSignals.Reset); m_state = IntState.Wait; // after reset always to wait State. }
private static void initCard(object sender, CardEventArgs e) { fileLoader.m_mut.WaitOne(); m_mut.WaitOne(); fileLoader.m_cs = e.cs; NativeMethods.debugInit(); fileLoader.debugInit(); bool rInit = NativeMethods.PCI_Init_Scan_Card_Ex((UInt16)e.cs.num); bool rLoad = NativeMethods.PCI_Load_Corr_N(e.cs.corrFilePatch, e.cs.num); bool rSetAct = NativeMethods.PCI_Set_Active_Card((UInt16)e.cs.num); bool setGain = NativeMethods.PCI_Set_Gain(e.cs.gainX, e.cs.gainY, 0, 0, (UInt16)e.cs.num); bool rSetMode = NativeMethods.PCI_Set_Mode(e.cs.mode); NativeMethods.PCI_Stop_Execution(); bool rOsc = NativeMethods.PCI_Write_Port(0xC, 0x010);// NativeMethods.PCI_Write_Port_List(0xC, 0x00); //NativeMethods.PCI_Write_DA_List((UInt16)10); dbg = e.cs.debug; bool openScript = fileLoader.openJobfile(e.cs.scriptPath); PrefetchList.resetList(); m_state = IntState.Wait; m_isIntiialize = rInit && rSetAct && rSetMode && rOsc && openScript; MessageBox.Show(string.Format(" {0, -25} -- {1, -10} \n {2,-25} -- {4, -10} ({3}) \n {5,-25} -- {6, -10} \n {7, -25} -- {8, -10} \n {9,-25} -- {10, -10} \n {11,-25} -- {12, -10} ({13}) \n {14, -25} -- {15, -10}", "Init", rInit.ToString(), "Load correction", e.cs.corrFilePatch, rLoad.ToString(), "Set mode", rSetMode.ToString(), "Set active card", rSetAct.ToString(), "Oscillator on", rOsc.ToString(), "Open script", openScript.ToString(), e.cs.scriptPath, "Set gain", setGain.ToString()), (m_isIntiialize ? "Инициализация прошла успешно!" : "Ошибка при инициализации"), MessageBoxButtons.OK, m_isIntiialize ? MessageBoxIcon.Information : MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0x40000); m_layersFinishid = false; if (!m_isIntiialize) { NativeMethods.PCI_Write_Port(0xC, 0x000); } fileLoader.m_mut.ReleaseMutex(); m_mut.ReleaseMutex(); }