aboutsummaryrefslogtreecommitdiff
path: root/src/clocks
diff options
context:
space:
mode:
Diffstat (limited to 'src/clocks')
-rw-r--r--src/clocks/mod.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/clocks/mod.rs b/src/clocks/mod.rs
index 74a1f1a1f..e02840592 100644
--- a/src/clocks/mod.rs
+++ b/src/clocks/mod.rs
@@ -821,44 +821,44 @@ impl ClockOperator<'_> {
821/// This macro is used to implement the [`Gate`] trait for a given peripheral 821/// This macro is used to implement the [`Gate`] trait for a given peripheral
822/// that is controlled by the MRCC peripheral. 822/// that is controlled by the MRCC peripheral.
823macro_rules! impl_cc_gate { 823macro_rules! impl_cc_gate {
824 ($name:ident, $reg:ident, $field:ident, $config:ty) => { 824 ($name:ident, $clk_reg:ident, $rst_reg:ident, $field:ident, $config:ty) => {
825 impl Gate for crate::peripherals::$name { 825 impl Gate for crate::peripherals::$name {
826 type MrccPeriphConfig = $config; 826 type MrccPeriphConfig = $config;
827 827
828 #[inline] 828 #[inline]
829 unsafe fn enable_clock() { 829 unsafe fn enable_clock() {
830 let mrcc = unsafe { pac::Mrcc0::steal() }; 830 let mrcc = unsafe { pac::Mrcc0::steal() };
831 mrcc.$reg().modify(|_, w| w.$field().enabled()); 831 mrcc.$clk_reg().modify(|_, w| w.$field().enabled());
832 } 832 }
833 833
834 #[inline] 834 #[inline]
835 unsafe fn disable_clock() { 835 unsafe fn disable_clock() {
836 let mrcc = unsafe { pac::Mrcc0::steal() }; 836 let mrcc = unsafe { pac::Mrcc0::steal() };
837 mrcc.$reg().modify(|_r, w| w.$field().disabled()); 837 mrcc.$clk_reg().modify(|_r, w| w.$field().disabled());
838 } 838 }
839 839
840 #[inline] 840 #[inline]
841 fn is_clock_enabled() -> bool { 841 fn is_clock_enabled() -> bool {
842 let mrcc = unsafe { pac::Mrcc0::steal() }; 842 let mrcc = unsafe { pac::Mrcc0::steal() };
843 mrcc.$reg().read().$field().is_enabled() 843 mrcc.$clk_reg().read().$field().is_enabled()
844 } 844 }
845 845
846 #[inline] 846 #[inline]
847 unsafe fn release_reset() { 847 unsafe fn release_reset() {
848 let mrcc = unsafe { pac::Mrcc0::steal() }; 848 let mrcc = unsafe { pac::Mrcc0::steal() };
849 mrcc.$reg().modify(|_, w| w.$field().enabled()); 849 mrcc.$rst_reg().modify(|_, w| w.$field().enabled());
850 } 850 }
851 851
852 #[inline] 852 #[inline]
853 unsafe fn assert_reset() { 853 unsafe fn assert_reset() {
854 let mrcc = unsafe { pac::Mrcc0::steal() }; 854 let mrcc = unsafe { pac::Mrcc0::steal() };
855 mrcc.$reg().modify(|_, w| w.$field().disabled()); 855 mrcc.$rst_reg().modify(|_, w| w.$field().disabled());
856 } 856 }
857 857
858 #[inline] 858 #[inline]
859 fn is_reset_released() -> bool { 859 fn is_reset_released() -> bool {
860 let mrcc = unsafe { pac::Mrcc0::steal() }; 860 let mrcc = unsafe { pac::Mrcc0::steal() };
861 mrcc.$reg().read().$field().is_enabled() 861 mrcc.$rst_reg().read().$field().is_enabled()
862 } 862 }
863 } 863 }
864 }; 864 };
@@ -874,14 +874,14 @@ pub(crate) mod gate {
874 // other than enabling through the MRCC gate. Currently, these peripherals will 874 // other than enabling through the MRCC gate. Currently, these peripherals will
875 // ALWAYS return `Ok(0)` when calling [`enable_and_reset()`] and/or 875 // ALWAYS return `Ok(0)` when calling [`enable_and_reset()`] and/or
876 // [`SPConfHelper::post_enable_config()`]. 876 // [`SPConfHelper::post_enable_config()`].
877 impl_cc_gate!(PORT1, mrcc_glb_cc1, port1, NoConfig); 877 impl_cc_gate!(PORT1, mrcc_glb_cc1, mrcc_glb_rst1, port1, NoConfig);
878 impl_cc_gate!(PORT2, mrcc_glb_cc1, port2, NoConfig); 878 impl_cc_gate!(PORT2, mrcc_glb_cc1, mrcc_glb_rst1, port2, NoConfig);
879 impl_cc_gate!(PORT3, mrcc_glb_cc1, port3, NoConfig); 879 impl_cc_gate!(PORT3, mrcc_glb_cc1, mrcc_glb_rst1, port3, NoConfig);
880 impl_cc_gate!(GPIO3, mrcc_glb_cc2, gpio3, NoConfig); 880 impl_cc_gate!(GPIO3, mrcc_glb_cc2, mrcc_glb_rst2, gpio3, NoConfig);
881 881
882 // These peripherals DO have meaningful configuration, and could fail if the system 882 // These peripherals DO have meaningful configuration, and could fail if the system
883 // clocks do not match their needs. 883 // clocks do not match their needs.
884 impl_cc_gate!(OSTIMER0, mrcc_glb_cc1, ostimer0, OsTimerConfig); 884 impl_cc_gate!(OSTIMER0, mrcc_glb_cc1, mrcc_glb_rst1, ostimer0, OsTimerConfig);
885 impl_cc_gate!(LPUART2, mrcc_glb_cc0, lpuart2, LpuartConfig); 885 impl_cc_gate!(LPUART2, mrcc_glb_cc0, mrcc_glb_rst0, lpuart2, LpuartConfig);
886 impl_cc_gate!(ADC1, mrcc_glb_cc1, adc1, AdcConfig); 886 impl_cc_gate!(ADC1, mrcc_glb_cc1, mrcc_glb_rst1, adc1, AdcConfig);
887} 887}