platinum: self-registration with the device registry.

This commit is contained in:
Maxim Poliakovski 2022-07-17 05:35:17 +02:00
parent 97b3b9a6f8
commit 5f8a927846
2 changed files with 11 additions and 2 deletions

View File

@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/** Platinum Memory/Display Controller emulation. */
#include <devices/deviceregistry.h>
#include <devices/memctrl/platinum.h>
#include <devices/video/displayid.h>
#include <loguru.hpp>
@ -34,6 +35,8 @@ PlatinumCtrl::PlatinumCtrl() : MemCtrlBase()
{
this->name = "Platinum Memory Controller";
supports_types(HWCompType::MEM_CTRL | HWCompType::MMIO_DEV);
// add MMIO region for the configuration and status registers
add_mmio_region(0xF8000000, 0x500, this);
@ -196,3 +199,9 @@ void PlatinumCtrl::map_phys_ram()
ABORT_F("Platinum: could not allocate RAM storage");
}
}
static const DeviceDescription Platinum_Descriptor = {
PlatinumCtrl::create, {}, {}
};
REGISTER_DEVICE(Platinum, Platinum_Descriptor);

View File

@ -160,8 +160,8 @@ public:
PlatinumCtrl();
~PlatinumCtrl() = default;
bool supports_type(HWCompType type) {
return (type == HWCompType::MEM_CTRL || type == HWCompType::MMIO_DEV);
static std::unique_ptr<HWComponent> create() {
return std::unique_ptr<PlatinumCtrl>(new PlatinumCtrl());
}
/* MMIODevice methods */