hmc: self-registration with the device registry.

This commit is contained in:
Maxim Poliakovski 2022-07-17 05:30:59 +02:00
parent 66debbc730
commit cb68b70d52
2 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
Author: Max Poliakovski
*/
#include <devices/deviceregistry.h>
#include <devices/common/hwcomponent.h>
#include <devices/memctrl/hmc.h>
@ -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);

View File

@ -35,6 +35,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <devices/memctrl/memctrlbase.h>
#include <cinttypes>
#include <memory>
/** 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<HWComponent> create() {
return std::unique_ptr<HMC>(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);