Ejemplo n.º 1
0
        /// <summary>
        /// Gets RAM type from SPD data
        /// </summary>
        /// <param name="device">Device instance</param>
        /// <returns>RAM Type</returns>
        public static RamType GetRamType(Device device)
        {
            if (device == null)
            {
                throw new NullReferenceException($"Invalid device ({device.PortName.ToString()})");
            }

            if (!device.IsConnected)
            {
                throw new IOException($"Device not connected ({device.PortName.ToString()})");
            }

            // Byte at offset 0x02 in SPD indicates RAM type
            try {
                byte _rt = Eeprom.ReadByte(device, 0x02);
                if (Enum.IsDefined(typeof(RamType), (RamType)_rt))
                {
                    return((RamType)_rt);
                }
            }
            catch {
                throw new Exception($"Unable to detect RAM type at {device.I2CAddress} on {device.PortName}");
            }
            return(RamType.UNKNOWN);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets RAM type from SPD data
        /// </summary>
        /// <param name="device">Device instance</param>
        /// <returns>RAM Type</returns>
        public static RamType GetRamType(Device device)
        {
            if (device == null)
            {
                throw new NullReferenceException("Invalid device");
            }

            if (!device.IsConnected)
            {
                throw new IOException("Invalid device");
            }

            // Byte at offset 0x02 in SPD indicates RAM type
            byte _rt = Eeprom.ReadByte(device, 0x02);

            if (Enum.IsDefined(typeof(RamType), (RamType)_rt))
            {
                return((RamType)_rt);
            }
            return(RamType.UNKNOWN);
        }