summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2022-02-10 15:00:03 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2022-04-16 21:37:28 +0200
commitd010caa44f8849f21b21b3941f61e5c9a98b3d60 (patch)
tree01b9c5e328253e3236a0e51788cd752587db3472
parent2492e82430fa2016efc4067c0f74495b435eb079 (diff)
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 <karlp@etactica.com>
-rw-r--r--rcc/rcc_enums.h.j25
-rw-r--r--rcc/rcc_reg.h5
2 files changed, 10 insertions, 0 deletions
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 <typename T>
+ 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<T> {
void enable(Bus dev) const {
rcc::enable(*this, dev);
}
+
+ template <typename Bus>
+ void disable(Bus dev) const {
+ rcc::disable(*this, dev);
+ }
};