moel@358: /*
moel@358:  
moel@358:   This Source Code Form is subject to the terms of the Mozilla Public
moel@358:   License, v. 2.0. If a copy of the MPL was not distributed with this
moel@358:   file, You can obtain one at http://mozilla.org/MPL/2.0/.
moel@358:  
moel@358:   Copyright (C) 2012 Michael Möller <mmoeller@openhardwaremonitor.org>
moel@358: 	
moel@358: */
moel@358: 
moel@358: namespace OpenHardwareMonitor.Hardware.HDD {
moel@358:   using System.Collections.Generic;
moel@358: 
moel@358:   [NamePrefix(""), RequireSmart(0xAA), RequireSmart(0xAB), RequireSmart(0xAC), 
moel@358:    RequireSmart(0xAD), RequireSmart(0xAE), RequireSmart(0xCA)]
moel@358:   internal class SSDMicron : AbstractHarddrive {
moel@358: 
moel@358:     private static readonly IEnumerable<SmartAttribute> smartAttributes =
moel@358:       new List<SmartAttribute> {
moel@358:       
moel@358:       new SmartAttribute(0x01, SmartNames.ReadErrorRate, RawToInt),
moel@358:       new SmartAttribute(0x05, SmartNames.ReallocatedSectorsCount, RawToInt),
moel@358:       new SmartAttribute(0x09, SmartNames.PowerOnHours, RawToInt),
moel@358:       new SmartAttribute(0x0C, SmartNames.PowerCycleCount, RawToInt),
moel@358:       new SmartAttribute(0xAA, SmartNames.NewFailingBlockCount, RawToInt),
moel@358:       new SmartAttribute(0xAB, SmartNames.ProgramFailCount, RawToInt),
moel@358:       new SmartAttribute(0xAC, SmartNames.EraseFailCount, RawToInt),
moel@358:       new SmartAttribute(0xAD, SmartNames.WearLevelingCount, RawToInt),
moel@358:       new SmartAttribute(0xAE, SmartNames.UnexpectedPowerLossCount, RawToInt),
moel@358:       new SmartAttribute(0xB5, SmartNames.Non4kAlignedAccess, 
moel@358:         (byte[] raw, byte value) => { return 6e4f * ((raw[5] << 8) | raw[4]); }),
moel@358:       new SmartAttribute(0xB7, SmartNames.SataDownshiftErrorCount, RawToInt),
moel@358:       new SmartAttribute(0xBB, SmartNames.ReportedUncorrectableErrors, RawToInt),
moel@358:       new SmartAttribute(0xBC, SmartNames.CommandTimeout, RawToInt),
moel@358:       new SmartAttribute(0xBD, SmartNames.FactoryBadBlockCount, RawToInt),
moel@358:       new SmartAttribute(0xC4, SmartNames.ReallocationEventCount, RawToInt),
moel@358:       new SmartAttribute(0xC5, SmartNames.CurrentPendingSectorCount),
moel@358:       new SmartAttribute(0xC6, SmartNames.OffLineUncorrectableErrorCount, RawToInt),
moel@358:       new SmartAttribute(0xC7, SmartNames.UltraDmaCrcErrorCount, RawToInt),
moel@358:       new SmartAttribute(0xCA, SmartNames.RemainingLife, 
moel@358:         (byte[] raw, byte value) => { return 100 - RawToInt(raw, value); }, 
moel@358:         SensorType.Level, 0),
moel@358:       new SmartAttribute(0xCE, SmartNames.WriteErrorRate, 
moel@358:          (byte[] raw, byte value) => { return 6e4f * ((raw[1] << 8) | raw[0]); }),
moel@358:     };
moel@358: 
moel@358:     public SSDMicron(ISmart smart, string name, string firmwareRevision, 
moel@358:       int index, ISettings settings)
moel@358:       : base(smart, name, firmwareRevision, index, smartAttributes, settings) {}
moel@358:   }
moel@358: }