1 // 2 // Copyright (c) 2010-2024 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 using System.Collections.Generic; 9 using Antmicro.Renode.Core.Structure.Registers; 10 11 namespace Antmicro.Renode.Peripherals.Miscellaneous.S32K3XX_FlexIOModel 12 { 13 public interface IResourceBlockOwner : IProvidesRegisterCollection<DoubleWordRegisterCollection>, IEmulationElement { } 14 15 public abstract class ResourceBlock 16 { ResourceBlock(IResourceBlockOwner owner, uint identifier)17 public ResourceBlock(IResourceBlockOwner owner, uint identifier) 18 { 19 this.owner = owner; 20 Identifier = identifier; 21 } 22 Reset()23 public virtual void Reset() 24 { 25 foreach(var interrupt in Interrupts) 26 { 27 interrupt.Reset(); 28 } 29 } 30 31 public uint Identifier { get; } 32 public abstract string Name { get; } 33 public abstract IEnumerable<Interrupt> Interrupts { get; } 34 35 public event Action<bool> AnyInterruptChanged; 36 OnInterruptChange(bool value)37 protected void OnInterruptChange(bool value) 38 { 39 AnyInterruptChanged?.Invoke(value); 40 } 41 42 protected readonly IResourceBlockOwner owner; 43 } 44 } 45