11/*
2- * Copyright (c) 2019, 2021 Niklas Hauser
2+ * Copyright (c) 2019, 2021, 2024, Niklas Hauser
33 *
44 * This file is part of the modm project.
55 *
@@ -123,13 +123,12 @@ Rcc::enable()
123123 __DSB();
124124 %% for peripheral, (st_per, bus) in rcc_enable.items() | sort
125125 if constexpr (peripheral == Peripheral::{{ peripheral }})
126- if (not Rcc::isEnabled<peripheral>()) {
127- RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}EN;{% if st_per in rcc_reset %} __DSB();
128- RCC->{{rcc_reset[st_per] }} |= RCC_{{rcc_reset[st_per] }}_{{st_per }}RST; __DSB();
129- RCC->{{rcc_reset[st_per] }} &= ~RCC_{{rcc_reset[st_per] }}_{{st_per }}RST;{% endif %}{% if peripheral == "Eth" %} __DSB();
126+ {% if peripheral in rcc_reset %}if (not Rcc::isEnabled<peripheral>()) {% endif %} {
127+ RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}EN;{% if peripheral in rcc_reset %} __DSB();
128+ RCC->{{rcc_reset[peripheral][1] }} |= RCC_{{rcc_reset[peripheral][1] }}_{{rcc_reset[peripheral][0] }}RST; __DSB();
129+ RCC->{{rcc_reset[peripheral][1] }} &= ~RCC_{{rcc_reset[peripheral][1] }}_{{rcc_reset[peripheral][0] }}RST;{% endif %}{% if peripheral == "Eth" %} __DSB();
130130 RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}RXEN; __DSB();
131- RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}TXEN;{% elif peripheral == "Usbotghs" %} __DSB();
132- RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}ULPIEN;{% endif %}
131+ RCC->{{bus}} |= RCC_{{bus}}_{{st_per}}TXEN;{% endif %}
133132 }
134133 %% endfor
135134 __DSB();
@@ -147,8 +146,7 @@ Rcc::disable()
147146 if constexpr (peripheral == Peripheral::{{ peripheral }}) {
148147 RCC->{{bus}} &= ~RCC_{{bus}}_{{st_per}}EN;{% if peripheral == "Eth" %} __DSB();
149148 RCC->{{bus}} &= ~RCC_{{bus}}_{{st_per}}RXEN; __DSB();
150- RCC->{{bus}} &= ~RCC_{{bus}}_{{st_per}}TXEN;{% elif peripheral == "Usbotghs" %} __DSB();
151- RCC->{{bus}} &= ~RCC_{{bus}}_{{st_per}}ULPIEN;{% endif %}
149+ RCC->{{bus}} &= ~RCC_{{bus}}_{{st_per}}TXEN;{% endif %}
152150 }
153151 %% endfor
154152 __DSB();
0 commit comments