Exemplo n.º 1
0
        public Dictionary <string, string> GetDeviceInfo()
        {
            const float MAX_VOL_CUR = 999; //Max value of Voltage and current, if read value is larger than it, then it is meaningless
            Dictionary <string, string> deviceInfo = new Dictionary <string, string>();

            deviceInfo.Add("Board Name", mBoardName);

            uint readInfo = 0;

            //F0 Info
            Qworks.F0Info(ref readInfo, (uint)EnumF0Info.F0Info_Elf, mDeviceID);
            deviceInfo.Add("F0 ELF Version", F0VersionString(readInfo));
            Qworks.F0Info(ref readInfo, (uint)EnumF0Info.F0Info_Bit, mDeviceID);
            deviceInfo.Add("F0 bit Version", F0VersionString(readInfo));

            //F1 Info
            Qworks.F1Info(ref readInfo, (uint)EnumF1Info.F1Info_Version, mDeviceID);
            deviceInfo.Add("F1 Version", F1VersionString(readInfo));
            Qworks.F1Info(ref readInfo, (uint)EnumF1Info.F1Info_StandingTime, mDeviceID);
            deviceInfo.Add("F1 Run Time", F1RunTimeString(readInfo));
            Qworks.F1Info(ref readInfo, (uint)EnumF1Info.F1Info_ClockFreq, mDeviceID);
            deviceInfo.Add("F1 Clock Rate", string.Format("{0:F1} (MHz)", (float)readInfo * 1.024 / 1000));
            Qworks.F1Info(ref readInfo, (uint)EnumF1Info.F1Info_BitState, mDeviceID);
            deviceInfo.Add("F1 Bit State", (readInfo == 1) ? "Loaded" : "Unloaded");
            Qworks.F1Info(ref readInfo, (uint)EnumF1Info.F1Info_F1F0Link, mDeviceID);
            deviceInfo.Add("F0 and F1 Link", (readInfo == 1)? "Linked":"Unlinked");

            //F1 Ram Size
            Qworks.F1RamSize(ref readInfo, mDeviceID);
            deviceInfo.Add("F1 RAM Capacity", string.Format("{0:F1} (kB)", (float)readInfo / 1024));

            //Sensor Info
            SensorInfo sensorInfo = new SensorInfo();

            Qworks.SensorInfo(ref sensorInfo, mDeviceID);
            deviceInfo.Add("F0 VCC INT", string.Format("{0:F2} V", sensorInfo.F0VCCINT > MAX_VOL_CUR? 0.0 : sensorInfo.F0VCCINT));
            deviceInfo.Add("F0 VCC AUX", string.Format("{0:F2} V", sensorInfo.F0VCCAUX > MAX_VOL_CUR ? 0.0 : sensorInfo.F0VCCAUX));
            deviceInfo.Add("F0 Temperature", string.Format("{0:F2} C", sensorInfo.F0Temperature));
            deviceInfo.Add("F1 VCC INT", string.Format("{0:F2} V(Max {1:F2} V)",
                                                       sensorInfo.F1VCCINT > MAX_VOL_CUR ? 0.0 : sensorInfo.F1VCCINT, sensorInfo.F1VCCINTMAX > MAX_VOL_CUR ? 0.0 : sensorInfo.F1VCCINTMAX));
            deviceInfo.Add("F1 VCC AUX", string.Format("{0:F2} V(Max {1:F2} V)",
                                                       sensorInfo.F1VCCAUX > MAX_VOL_CUR ? 0.0 : sensorInfo.F1VCCAUX, sensorInfo.F1VCCAUXMAX > MAX_VOL_CUR ? 0.0 : sensorInfo.F1VCCAUXMAX));
            deviceInfo.Add("F1 Temperature", string.Format("{0:F2} C", sensorInfo.F1Temperature));

            deviceInfo.Add("F1 Temperature Max", string.Format("{0:F2} C", sensorInfo.F1TemperatureMax));
            deviceInfo.Add("Voltage 12V", string.Format("{0:F2} V", sensorInfo.QGFVoltage12 > MAX_VOL_CUR ? 0.0 : sensorInfo.QGFVoltage12));
            deviceInfo.Add("Current of 12V", string.Format("{0:F2} A", sensorInfo.QGFCurrent12 > MAX_VOL_CUR ? 0.0 : sensorInfo.QGFCurrent12));
            deviceInfo.Add("Voltage 5V", string.Format("{0:F2} V", sensorInfo.QGFVoltage5 > MAX_VOL_CUR ? 0.0 : sensorInfo.QGFVoltage5));
            deviceInfo.Add("Current of 5V", string.Format("{0:F2} A", sensorInfo.QGFCurrent5 > MAX_VOL_CUR ? 0.0 : sensorInfo.QGFCurrent5));
            deviceInfo.Add("Temperature 0", string.Format("{0:F2} C", sensorInfo.QGFTemperature0));
            deviceInfo.Add("Temperature 1", string.Format("{0:F2} C", sensorInfo.QGFTemperature1));
            deviceInfo.Add("Temperature 2", string.Format("{0:F2} C", sensorInfo.QGFTemperature2));
            deviceInfo.Add("Temperature 3", string.Format("{0:F2} C", sensorInfo.QGFTemperature3));


            return(deviceInfo);
        }
Exemplo n.º 2
0
        public override string GetStatusInfo()
        {
            UInt32 version = 0;

            Qworks.Version(ref version);

            UInt32 devsum = 100;

            Qworks.Initialize(ref devsum);
            return(String.Format("Version = {0}; Device Sum = {1}", version, devsum));
            //throw new NotImplementedException();
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
0
        public static void QWorksRegWrite(uint regdata, uint regnum, uint devnum)
        {
            int status = Qworks.F1WriteReg(regdata, regnum, devnum);

            if (LogManager.RootLogger.LoggingLevel == LogLevel.Fine)
            {
                LogManager.RootLogger.LogAppend(new LoggingEvent(LogLevel.Fine, string.Format("F1WriteReg:devnum = {0},regNum = {1},regData = {2},status={3}", devnum, regnum, regdata, ErrorInfo(status))));
            }
            if (status < 0)
            {
                throw new Exception(string.Format("QWorksRegWrite Error: {0}", ErrorInfo(status)));
            }
        }
Exemplo n.º 5
0
        public static uint QWorksRegRead(uint regnum, uint devnum)
        {
            uint readvalue = 0;
            int  status    = Qworks.F1ReadReg(ref readvalue, regnum, devnum);

            if (LogManager.RootLogger.LoggingLevel == LogLevel.Fine)
            {
                LogManager.RootLogger.LogAppend(new LoggingEvent(LogLevel.Fine, string.Format("F1ReadReg:devnum = {0},regNum = {1},readvalue = {2},status={3}", devnum, regnum, readvalue, ErrorInfo(status))));
            }

            if (status < 0)
            {
                throw new Exception(string.Format("QWorksRegRead Error: {0}", ErrorInfo(status)));
            }

            return(readvalue);
        }
Exemplo n.º 6
0
 public void Close()
 {
     Qworks.Close();
 }