1 // 2 // Copyright (c) 2010-2023 Antmicro 3 // 4 // This file is licensed under the MIT License. 5 // Full license text is available in 'licenses/MIT.txt'. 6 // 7 using System; 8 9 namespace Antmicro.Renode.Peripherals.SPI.Cadence_xSPICommands 10 { 11 internal class CommandPayload 12 { CommandPayload(uint[] payload)13 public CommandPayload(uint[] payload) 14 { 15 const int RequiredLength = 6; 16 if(payload.Length != RequiredLength) 17 { 18 throw new ArgumentOutOfRangeException($"The payload must be {RequiredLength} elements length."); 19 } 20 this.payload = payload; 21 } 22 23 // The payload is immutable. 24 public uint this[int index] => payload[index]; 25 26 private readonly uint[] payload; 27 } 28 } 29