Landfall

Change of pkg/devices/lib/cpm/src/x1600.cc

239:526b5482e452
pkg/devices/lib/cpm/src/x1600.cc cpm-library-improvements
     1.1 --- a/pkg/devices/lib/cpm/src/x1600.cc	Thu Nov 16 17:48:32 2023 +0100
     1.2 +++ b/pkg/devices/lib/cpm/src/x1600.cc	Thu Nov 16 22:03:51 2023 +0100
     1.3 @@ -97,6 +97,7 @@
     1.4               Clock_source_msc0         (Divider_msc0, 3, 30),        // MPCS
     1.5               Clock_source_msc1         (Divider_msc1, 3, 30),        // MPCS
     1.6               Clock_source_pwm          (Divider_pwm, 3, 30),         // PWMPCS
     1.7 +             Clock_source_rtc          (Sleep_control, 0x01, 2),     // ERCS
     1.8               Clock_source_sfc          (Divider_sfc, 3, 30),         // SFCS
     1.9               Clock_source_ssi          (Divider_ssi, 3, 30),         // SPCS
    1.10  
    1.11 @@ -254,7 +255,8 @@
    1.12             mux_core     (3, Clocks(Clock_none, Clock_main, Clock_pll_M)),
    1.13             mux_dev      (3, Clocks(Clock_main, Clock_pll_M, Clock_pll_E)),
    1.14             mux_main     (3, Clocks(Clock_none, Clock_external, Clock_pll_A)),
    1.15 -           mux_i2s      (2, Clocks(Clock_main, Clock_pll_E));
    1.16 +           mux_i2s      (2, Clocks(Clock_main, Clock_pll_E)),
    1.17 +           mux_rtc      (2, Clocks(Clock_external_div_512, Clock_rtc_external));
    1.18  
    1.19  
    1.20  
    1.21 @@ -262,7 +264,8 @@
    1.22  
    1.23  static Clock_null        clock_none;
    1.24  
    1.25 -static Clock_passive     clock_external(24000000);
    1.26 +static Clock_passive     clock_external(24000000),
    1.27 +                         clock_rtc_external(32768);
    1.28  
    1.29  // Note the use of extra parentheses due to the annoying C++ "most vexing parse"
    1.30  // problem. See: https://en.wikipedia.org/wiki/Most_vexing_parse
    1.31 @@ -285,6 +288,8 @@
    1.32  
    1.33               clock_otg0((Source(mux_hclock2)), (Control(Clock_gate_otg))),
    1.34  
    1.35 +             clock_rtc(Source(mux_rtc, Clock_source_rtc), (Control(Clock_gate_rtc))),
    1.36 +
    1.37               clock_timer((Source(mux_pclock)), (Control(Clock_gate_timer))),
    1.38  
    1.39               clock_uart0((Source(mux_external)), (Control(Clock_gate_uart0))),
    1.40 @@ -361,6 +366,9 @@
    1.41                          Control(Clock_gate_ssi0, Clock_change_enable_ssi, Clock_busy_ssi),
    1.42                          Divider(Clock_divider_ssi));
    1.43  
    1.44 +static Clock_divided_fixed
    1.45 +             clock_external_div_512((Source(mux_external)), (Divider_fixed(512)));
    1.46 +
    1.47  static Clock_divided_i2s
    1.48               clock_i2s0_rx(Source(mux_i2s0_rx),
    1.49                             Control(Clock_gate_i2s0_rx),
    1.50 @@ -415,6 +423,7 @@
    1.51    &clock_dma,
    1.52    &clock_none,            // Clock_emac
    1.53    &clock_external,
    1.54 +  &clock_external_div_512,
    1.55    &clock_hclock0,
    1.56    &clock_hclock2,
    1.57    &clock_hclock2_pclock,
    1.58 @@ -452,7 +461,8 @@
    1.59    &clock_none,            // Clock_pll_V
    1.60    &clock_pwm0,
    1.61    &clock_none,            // Clock_pwm1
    1.62 -  &clock_none,            // Clock_rtc
    1.63 +  &clock_rtc,
    1.64 +  &clock_rtc_external,
    1.65    &clock_none,            // Clock_scc
    1.66    &clock_sfc,
    1.67    &clock_none,            // Clock_ssi