From cb68b70d523d8f06cb85064432c599c69f2c40e2 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Sun, 17 Jul 2022 05:30:59 +0200 Subject: [PATCH] hmc: self-registration with the device registry. --- devices/memctrl/hmc.cpp | 7 +++++++ devices/memctrl/hmc.h | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/devices/memctrl/hmc.cpp b/devices/memctrl/hmc.cpp index 3909c0f..48736cd 100644 --- a/devices/memctrl/hmc.cpp +++ b/devices/memctrl/hmc.cpp @@ -24,6 +24,7 @@ along with this program. If not, see . Author: Max Poliakovski */ +#include #include #include @@ -63,3 +64,9 @@ void HMC::write(uint32_t reg_start, uint32_t offset, uint32_t value, int size) break; } } + +static const DeviceDescription Hmc_Descriptor = { + HMC::create, {}, {} +}; + +REGISTER_DEVICE(HMC, Hmc_Descriptor); diff --git a/devices/memctrl/hmc.h b/devices/memctrl/hmc.h index 19a632f..5c6880b 100644 --- a/devices/memctrl/hmc.h +++ b/devices/memctrl/hmc.h @@ -35,6 +35,7 @@ along with this program. If not, see . #include #include +#include /** Bit in the HMC control register telling us where the frame bufffer for the on-board video is located. */ @@ -45,6 +46,10 @@ public: HMC(); ~HMC() = default; + static std::unique_ptr create() { + return std::unique_ptr(new HMC()); + } + /* MMIODevice methods */ uint32_t read(uint32_t reg_start, uint32_t offset, int size); void write(uint32_t reg_start, uint32_t offset, uint32_t value, int size);