示例#1
0
        private static void fillList()
        {
            //wait list ready
            m_runningLIst = PrefetchList.getNextReadyList();
            if (m_runningLIst == ListNumber.Undefine)
            {
                m_layersFinishid = PrefetchList.m_lastListReady;
                if (m_layersFinishid)
                {
                    m_state = IntState.Wait;
                }
                return;
            }

            m_layersFinishid = false;

            m_stopWatch.Restart();

            if (m_runningLIst == ListNumber.list1)
            {
                NativeMethods.PCI_Execute_List_1();
            }
            else
            {
                NativeMethods.PCI_Execute_List_2();
            }

            m_currenlList = (Int32)PrefetchList.getLayerNumber(m_runningLIst);
            ;
            m_state = IntState.Work;
        }
示例#2
0
 private void updateSignals(object sender, EventArgs e)
 {
     tb_buff_state.Text     = SpIceController.cardStatus.toString();
     tb_l1_state.Text       = PrefetchList.getListState(ListNumber.list1) + (cb_printDebug.Checked ? PrefetchList.getListStateDebug(ListNumber.list1) : "");
     tb_l2_state.Text       = PrefetchList.getListState(ListNumber.list2) + (cb_printDebug.Checked ? PrefetchList.getListStateDebug(ListNumber.list2) : "");
     tb_cl1_state.Text      = SpIceController.getStateString() + (cb_printDebug.Checked ? ", " + SpIceController.getStateStringDebug() : "");
     tb_buffLOad_state.Text = fileLoader.getStateString() + (cb_printDebug.Checked ? fileLoader.getStateStringDebug() : "");
     tb_form_state.Text     = cb_printDebug.Checked ? fileLoader.m_cs.toString() : "";
 }
示例#3
0
 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.
 }
示例#4
0
        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();
        }
示例#5
0
        public static void deinitialize()
        {
            try
            {
                m_mainThreadPermission = false;
                m_mainThread.Join();

                fileLoader.stopfillJobList();
                PrefetchList.terminate();
            }
            catch
            {
            }
        }
示例#6
0
        public static void processSignals()
        {
            NativeMethods.readStatus(ref m_cardStatus);

            if (m_isIntiialize)
            {
                PrefetchList.stepExecution();
            }

            IntSignals s = m_inputSignals;

            switch (m_state)
            {
            case IntState.Wait:
                WaitState();
                if ((s & IntSignals.Run) != 0)
                {
                    m_inputSignals &= ~IntSignals.Run;
                    m_state         = IntState.WaitListReady;
                }
                if ((s & (IntSignals.Reset)) != 0)
                {
                    processStopRequest();
                }
                break;

            case IntState.WaitListReady:

                fillList();

                if ((s & (IntSignals.Reset)) != 0)
                {
                    processStopRequest();
                }

                break;

            case IntState.Work:

                WorkState();

                if ((s & (IntSignals.Reset)) != 0)
                {
                    processStopRequest();
                }

                break;
            }
        }
示例#7
0
        private static void WorkState()
        {
            if (m_cardStatus.scanComlete) //wait until escan comlete
            {
                bool finish = PrefetchList.isOneListOnLayer(m_runningLIst);
                PrefetchList.setFree(m_runningLIst);
                m_state = finish ? IntState.Wait : IntState.WaitListReady;
                m_stopWatch.Stop();
                m_timeExecutinLayer = m_stopWatch.Elapsed;
            }

            if (PrefetchList.getNextReadyList() == ListNumber.Undefine)
            {
                m_layersFinishid = PrefetchList.m_lastListReady;
            }
        }