Ejemplo n.º 1
0
 public STM32F4_RCC(Machine machine, STM32F4_RTC rtcPeripheral)
 {
     // Renode, in general, does not include clock control peripherals.
     // While this is doable, it seldom benefits real software development
     // and is very cumbersome to maintain.
     //
     // To properly support the RTC peripheral, we need to add this stub class.
     // It is common in Renode that whenever a register is implemented, it
     // either contains actual logic or tags, indicating not implemented fields.
     //
     // Here, however, we want to fake most of the registers as r/w values.
     // Usually we implemented this logic with Python peripherals.
     //
     // Keep in mind that most of these registers do not affect other
     // peripherals or their clocks.
     var registersMap = new Dictionary <long, DoubleWordRegister>
     {
         { (long)Registers.ClockControl, new DoubleWordRegister(this, 0x483)
           .WithFlag(0, out var hsion, name: "HSION")
           .WithFlag(1, FieldMode.Read, valueProviderCallback: _ => hsion.Value, name: "HSIRDY")
           .WithReservedBits(2, 1)
           .WithValueField(3, 5, name: "HSITRIM")
           .WithTag("HSICAL", 8, 8)
           .WithFlag(16, out var hseon, name: "HSEON")
           .WithFlag(17, FieldMode.Read, valueProviderCallback: _ => hseon.Value, name: "HSERDY")
           .WithTag("HSEBYP", 18, 1)
           .WithTag("CSSON", 19, 1)
           .WithReservedBits(20, 4)
           .WithFlag(24, out var pllon, name: "PLLON")
           .WithFlag(25, FieldMode.Read, valueProviderCallback: _ => pllon.Value, name: "PLLRDY")
           .WithFlag(26, out var plli2son, name: "PLLI2SON")
           .WithFlag(27, FieldMode.Read, valueProviderCallback: _ => plli2son.Value, name: "PLLI2SRDY")
           .WithFlag(28, out var pllsaion, name: "PLLSAION")
           .WithFlag(29, FieldMode.Read, valueProviderCallback: _ => pllsaion.Value, name: "PLLSAIRDY")
           .WithReservedBits(30, 2) },
Ejemplo n.º 2
0
 public STM32F4_RCC(Machine machine, STM32F4_RTC rtcPeripheral)
 {
     var registersMap = new Dictionary <long, DoubleWordRegister>
     {
         { (long)Registers.ClockControl, new DoubleWordRegister(this, 0x83)
           .WithTag("HSION", 0, 1)
           .WithFlag(1, FieldMode.Read, valueProviderCallback: _ => true, name: "HSIRDY")
           .WithReservedBits(2, 1)
           .WithTag("HSITRIM", 3, 5)
           .WithTag("HSICAL", 8, 8)
           .WithTag("HSEON", 16, 1)
           .WithFlag(17, FieldMode.Read, valueProviderCallback: _ => true, name: "HSERDY")
           .WithTag("HSEBYP", 18, 1)
           .WithTag("CSSON", 19, 1)
           .WithReservedBits(20, 4)
           .WithTag("PLLON", 24, 1)
           .WithFlag(25, FieldMode.Read, valueProviderCallback: _ => true, name: "PLLRDY")
           .WithTag("PLLI2SON", 26, 1)
           .WithFlag(27, FieldMode.Read, valueProviderCallback: _ => true, name: "PLLI2SRDY")
           .WithReservedBits(28, 4) },