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 Antmicro.Renode.Peripherals.Miscellaneous.S32K3XX_FlexIOModel; 8 9 namespace Antmicro.Renode.Peripherals.Miscellaneous 10 { 11 public class UARTReceiver : UARTDirectionBase 12 { UARTReceiver(IEmulationElement owner, Shifter shifter)13 public UARTReceiver(IEmulationElement owner, Shifter shifter) : base(owner, shifter) { } 14 WriteChar(byte value)15 public void WriteChar(byte value) 16 { 17 LogWarnings(); 18 19 // The input data is shifted into the buffer from the left side (MSB). 20 shifter.OnDataReceive((uint)value << 24); 21 } 22 LogSpecificWarnings()23 protected override void LogSpecificWarnings() 24 { 25 LogWarningNonEqual((uint)shifter.TimerPolarity, (uint)ShifterPolarity.OnNegedge, "timer polarity", shifter.Name); 26 if(shifter.Timer != null) 27 { 28 LogWarningNonEqual((uint)shifter.Timer.Enable, (uint)TimerEnable.OnPinRisingEdge, "enable configuration", shifter.Timer.Name); 29 LogWarningNonEqual((uint)shifter.Timer.Disable, (uint)TimerDisable.OnTimerCompare, "disable configuration", shifter.Timer.Name); 30 LogWarningNonEqual((uint)shifter.Timer.Output, (uint)TimerOutput.OneOnResetToo, "output configuration", shifter.Timer.Name); 31 LogWarningNonEqual((uint)shifter.Timer.ResetMode, (uint)TimerReset.OnPinRisingEdge, "reset configuration", shifter.Timer.Name); 32 33 LogWarningNonEqual((uint)shifter.Timer.TriggerSource, (uint)TimerTriggerSource.External, "trigger source", shifter.Timer.Name); 34 LogWarningNonEqual((uint)shifter.Timer.TriggerPolarity, (uint)TimerTriggerPolarity.ActiveHigh, "trigger polarity", shifter.Timer.Name); 35 } 36 } 37 38 protected override string WarningPrefix => "Invalid configuration of receiver: "; 39 } 40 } 41