From d010caa44f8849f21b21b3941f61e5c9a98b3d60 Mon Sep 17 00:00:00 2001 From: Karl Palsson Date: Thu, 10 Feb 2022 14:00:03 +0000 Subject: rcc: add "disable" methods for low power Some people might like to turn peripherals back off again. We have all the machinery in place, so make it easy for them. Signed-off-by: Karl Palsson --- rcc/rcc_enums.h.j2 | 5 +++++ rcc/rcc_reg.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/rcc/rcc_enums.h.j2 b/rcc/rcc_enums.h.j2 index a4965b0..5694525 100644 --- a/rcc/rcc_enums.h.j2 +++ b/rcc/rcc_enums.h.j2 @@ -15,5 +15,10 @@ namespace rcc { rcc->{{ bus.split('_')[0] }}ENR{{ bus.split('_')[1] if '_' in bus else '' }} |= dev; } + template + void disable(const T& rcc, {{ bus }}_dev dev) { + rcc->{{ bus.split('_')[0] }}ENR{{ bus.split('_')[1] if '_' in bus else '' }} &= ~(dev); + } + {% endfor %} } diff --git a/rcc/rcc_reg.h b/rcc/rcc_reg.h index d5f8b68..7663739 100644 --- a/rcc/rcc_reg.h +++ b/rcc/rcc_reg.h @@ -204,4 +204,9 @@ class RCC_t : public mmio_ptr { void enable(Bus dev) const { rcc::enable(*this, dev); } + + template + void disable(Bus dev) const { + rcc::disable(*this, dev); + } }; -- cgit v1.2.3