Skip to content

Commit d266bbd

Browse files
authored
Merge pull request #26 from 1a2m3/20220727
20220802 update
2 parents 592db20 + 2cadd34 commit d266bbd

File tree

6 files changed

+2608
-2242
lines changed

6 files changed

+2608
-2242
lines changed

src/SpdReaderWriterDll/Arduino.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ public Arduino(SerialPortSettings portSettings, string portName, UInt8 i2cAddres
6161
/// <param name="portSettings">Serial port settings</param>
6262
/// <param name="portName">Serial port name</param>
6363
/// <param name="i2cAddress">EEPROM address on the device's i2c bus</param>
64-
/// <param name="spdSize">Total EEPROM size</param>
65-
public Arduino(SerialPortSettings portSettings, string portName, UInt8 i2cAddress, Ram.SpdSize spdSize) {
64+
/// <param name="dataLength">Total EEPROM size</param>
65+
public Arduino(SerialPortSettings portSettings, string portName, UInt8 i2cAddress, Spd.DataLength dataLength) {
6666
PortSettings = portSettings;
6767
PortName = portName;
6868
I2CAddress = i2cAddress;
69-
SpdSize = spdSize;
69+
DataLength = dataLength;
7070
}
7171

7272
/// <summary>
@@ -525,7 +525,7 @@ public bool DetectDdr5(UInt8 address) {
525525
/// <summary>
526526
/// EEPROM size
527527
/// </summary>
528-
public Ram.SpdSize SpdSize;
528+
public Spd.DataLength DataLength;
529529

530530
/// <summary>
531531
/// Number of bytes to be read from the device

src/SpdReaderWriterDll/Eeprom.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ public static void ResetPageAddress(Smbus device) {
157157
/// <param name="eepromPageNumber">Page number</param>
158158
private static void SetPageAddress(Smbus device, UInt8 eepromPageNumber) {
159159

160-
if (device.MaxSpdSize != 0 && device.MaxSpdSize < (UInt16)Ram.SpdSize.DDR4) {
160+
if (device.MaxSpdSize != 0 && device.MaxSpdSize < (UInt16)Spd.DataLength.DDR4) {
161161
return;
162162
}
163163

164-
if (device.MaxSpdSize == (UInt16)Ram.SpdSize.DDR4 && eepromPageNumber > 1 ||
165-
device.MaxSpdSize == (UInt16)Ram.SpdSize.DDR5 && eepromPageNumber > 15) {
164+
if (device.MaxSpdSize == (UInt16)Spd.DataLength.DDR4 && eepromPageNumber > 1 ||
165+
device.MaxSpdSize == (UInt16)Spd.DataLength.DDR5 && eepromPageNumber > 15) {
166166
throw new ArgumentOutOfRangeException(nameof(eepromPageNumber));
167167
}
168168

@@ -185,19 +185,19 @@ private static UInt8 GetPageAddress() {
185185
/// <param name="offset">Byte position</param>
186186
private static void AdjustPageAddress(Smbus device, UInt16 offset) {
187187

188-
if (device.MaxSpdSize >= (UInt16)Ram.SpdSize.MINIMUM) {
188+
if (device.MaxSpdSize >= (UInt16)Spd.DataLength.MINIMUM) {
189189
if (offset > device.MaxSpdSize) {
190190
throw new IndexOutOfRangeException($"Invalid offset");
191191
}
192192

193-
if (device.MaxSpdSize < (UInt16)Spd.GetSpdSize(Ram.Type.DDR4)) {
193+
if (device.MaxSpdSize < (UInt16)Spd.GetSpdSize(Spd.RamType.DDR4)) {
194194
return;
195195
}
196196
}
197197

198198
byte targetPage = 0;
199199

200-
if (device.MaxSpdSize == (UInt16)Ram.SpdSize.DDR4) {
200+
if (device.MaxSpdSize == (UInt16)Spd.DataLength.DDR4) {
201201
targetPage = (byte)(offset >> 8);
202202
}
203203

@@ -271,11 +271,11 @@ public static bool SetRswp(Smbus device) {
271271
/// <returns><see langword="true"/> when the write protection has been enabled on block <paramref name="block"/></returns>
272272
public static bool SetRswp(Smbus device, UInt8 block) {
273273

274-
if (device.MaxSpdSize == (UInt16)Ram.SpdSize.MINIMUM && block >= 1) {
274+
if (device.MaxSpdSize == (UInt16)Spd.DataLength.MINIMUM && block >= 1) {
275275
throw new ArgumentOutOfRangeException(nameof(block));
276276
}
277277

278-
if (device.MaxSpdSize == (UInt16)Ram.SpdSize.DDR4 && block >= 4) {
278+
if (device.MaxSpdSize == (UInt16)Spd.DataLength.DDR4 && block >= 4) {
279279
throw new ArgumentOutOfRangeException(nameof(block));
280280
}
281281

@@ -318,7 +318,7 @@ public static bool GetPswp(Smbus device) {
318318
/// <param name="offset">Byte offset</param>
319319
/// <returns>Byte value at <paramref name="offset"/></returns>
320320
public static byte ReadByte(Arduino device, UInt16 offset) {
321-
if (offset > (int)Ram.SpdSize.DDR5) {
321+
if (offset > (int)Spd.DataLength.DDR5) {
322322
throw new IndexOutOfRangeException($"Invalid offset");
323323
}
324324

@@ -343,7 +343,7 @@ public static byte ReadByte(Arduino device, UInt16 offset) {
343343
/// <param name="count">Total number of bytes to read from <paramref name="offset"/> </param>
344344
/// <returns>A byte array containing byte values</returns>
345345
public static byte[] ReadByte(Arduino device, UInt16 offset, UInt8 count) {
346-
if (offset > (int)Ram.SpdSize.DDR5) {
346+
if (offset > (int)Spd.DataLength.DDR5) {
347347
throw new IndexOutOfRangeException($"Invalid offset");
348348
}
349349
if (count == 0) {
@@ -372,7 +372,7 @@ public static byte[] ReadByte(Arduino device, UInt16 offset, UInt8 count) {
372372
/// <param name="value">Byte value</param>
373373
/// <returns><see langword="true"/> if <paramref name="value"/> is written to <paramref name="offset"/> </returns>
374374
public static bool WriteByte(Arduino device, UInt16 offset, byte value) {
375-
if (offset > (int)Ram.SpdSize.DDR5) {
375+
if (offset > (int)Spd.DataLength.DDR5) {
376376
throw new IndexOutOfRangeException($"Invalid offset");
377377
}
378378
try {
@@ -397,7 +397,7 @@ public static bool WriteByte(Arduino device, UInt16 offset, byte value) {
397397
/// <param name="value">Page contents</param>
398398
/// <returns><see langword="true"/> if <paramref name="value"/> is written to <paramref name="offset"/> </returns>
399399
public static bool WriteByte(Arduino device, UInt16 offset, byte[] value) {
400-
if (offset > (int)Ram.SpdSize.DDR5) {
400+
if (offset > (int)Spd.DataLength.DDR5) {
401401
throw new IndexOutOfRangeException($"Invalid offset");
402402
}
403403
if (value.Length > 16 || value.Length == 0) {
@@ -447,7 +447,7 @@ public static bool UpdateByte(Arduino device, UInt16 offset, byte value) {
447447
/// <param name="value">Page contents</param>
448448
/// <returns><see langword="true"/> if page read at <paramref name="offset"/> matches <paramref name="value"/> values</returns>
449449
public static bool UpdateByte(Arduino device, UInt16 offset, byte[] value) {
450-
if (offset > (int)Ram.SpdSize.DDR5) {
450+
if (offset > (int)Spd.DataLength.DDR5) {
451451
throw new IndexOutOfRangeException($"Invalid offset");
452452
}
453453
if (value.Length > 16 || value.Length == 0) {

src/SpdReaderWriterDll/Ram.cs

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)