Ejemplo n.º 1
0
        private void QWorksInitialize()
        {
            uint version = 0;

            Qworks.Version(ref version);
            mErrorLog.AddInformation(string.Format("Qworks version = {0}", version));

            uint devnum = 0;
            int  status = Qworks.Initialize(ref devnum);

            mErrorLog.AddInformation(string.Format("Initialize, status = {0}", status));
            mErrorLog.AddInformation(string.Format("Initialize devsum = {0}", devnum));
            if (devnum < 1)
            {
                mErrorLog.AddError("Qworks initialize error");
            }
            else
            {
                //Convert devum to device ID, the device ID should be the bit position
                uint devcnt = 0;
                do
                {
                    if ((devnum & 0x01) == 1)//Get a board
                    {
                        int port = Qworks.GetPort(devcnt);
                        mErrorLog.AddInformation(string.Format("Device number {0}, port = {1}", devcnt, port));
                        if (mBoardNameDictionary.ContainsKey(port))
                        {
                            mBoardName = mBoardNameDictionary[port];
                        }
                        else
                        {
                            mBoardName = "Unknown";
                        }

                        if (port != 5)
                        {
                            //Now we just support QGF_V7_CPCIe
                            mErrorLog.AddInformation(string.Format("Device number {0} is a {1} board", devcnt, mBoardName));
                        }
                        else
                        {
                            mErrorLog.AddInformation(string.Format("{0} carrier board detected, device number = {1}", mBoardName, devcnt));
                            mDeviceID = devcnt;
                        }
                    }

                    devcnt++;
                    devnum = devnum >> 1;
                } while (devnum != 0);
            }
        }