mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-11 05:29:43 +00:00
Add posti-initialization to HW components.
This commit is contained in:
parent
4867a68e11
commit
c1208b398e
@ -57,6 +57,10 @@ public:
|
|||||||
|
|
||||||
virtual bool supports_type(HWCompType type) = 0;
|
virtual bool supports_type(HWCompType type) = 0;
|
||||||
|
|
||||||
|
virtual int device_postinit() {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string name;
|
std::string name;
|
||||||
};
|
};
|
||||||
|
@ -119,3 +119,20 @@ HWComponent* MachineBase::get_comp_by_type(HWCompType type) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int MachineBase::postinit_devices()
|
||||||
|
{
|
||||||
|
for (auto it = this->comp_map.begin(); it != this->comp_map.end(); it++) {
|
||||||
|
if (it->second->device_postinit()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto it = this->subdev_map.begin(); it != this->subdev_map.end(); it++) {
|
||||||
|
if (it->second->device_postinit()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -43,6 +43,7 @@ public:
|
|||||||
void add_alias(std::string name, std::string alias);
|
void add_alias(std::string name, std::string alias);
|
||||||
HWComponent* get_comp_by_name(std::string name);
|
HWComponent* get_comp_by_name(std::string name);
|
||||||
HWComponent* get_comp_by_type(HWCompType type);
|
HWComponent* get_comp_by_type(HWCompType type);
|
||||||
|
int postinit_devices();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string name;
|
std::string name;
|
||||||
|
@ -103,6 +103,12 @@ int create_gossamer(std::string& id) {
|
|||||||
/* Init virtual CPU and request MPC750 CPU aka G3 */
|
/* Init virtual CPU and request MPC750 CPU aka G3 */
|
||||||
ppc_cpu_init(grackle_obj, PPC_VER::MPC750);
|
ppc_cpu_init(grackle_obj, PPC_VER::MPC750);
|
||||||
|
|
||||||
|
// post-initialize all devices
|
||||||
|
if (gMachineObj->postinit_devices()) {
|
||||||
|
LOG_F(ERROR, "Could not post-initialize devices!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* check for a floppy image to be inserted into the virtual superdrive */
|
/* check for a floppy image to be inserted into the virtual superdrive */
|
||||||
std::string fdd_path = GET_STR_PROP("fdd_img");
|
std::string fdd_path = GET_STR_PROP("fdd_img");
|
||||||
if (!fdd_path.empty()) {
|
if (!fdd_path.empty()) {
|
||||||
|
@ -59,7 +59,7 @@ int create_pdm(std::string& id) {
|
|||||||
/* get raw pointer to HMC object */
|
/* get raw pointer to HMC object */
|
||||||
HMC* hmc_obj = dynamic_cast<HMC*>(gMachineObj->get_comp_by_name("HMC"));
|
HMC* hmc_obj = dynamic_cast<HMC*>(gMachineObj->get_comp_by_name("HMC"));
|
||||||
|
|
||||||
/* allocate machine ID register and tell we're running PowerMac 6100 */
|
// allocate machine ID register and tell we're running PowerMac 6100
|
||||||
// TODO: add a possibility to select another machine
|
// TODO: add a possibility to select another machine
|
||||||
// to be used with the same ROM
|
// to be used with the same ROM
|
||||||
gMachineObj->add_component("MachineID", new NubusMacID(0x3010));
|
gMachineObj->add_component("MachineID", new NubusMacID(0x3010));
|
||||||
@ -87,6 +87,12 @@ int create_pdm(std::string& id) {
|
|||||||
/* Init virtual CPU and request MPC601 */
|
/* Init virtual CPU and request MPC601 */
|
||||||
ppc_cpu_init(hmc_obj, PPC_VER::MPC601);
|
ppc_cpu_init(hmc_obj, PPC_VER::MPC601);
|
||||||
|
|
||||||
|
// post-initialize all devices
|
||||||
|
if (gMachineObj->postinit_devices()) {
|
||||||
|
LOG_F(ERROR, "Could not post-initialize devices!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* check for a floppy image to be inserted into the virtual superdrive */
|
/* check for a floppy image to be inserted into the virtual superdrive */
|
||||||
std::string fdd_path = GET_STR_PROP("fdd_img");
|
std::string fdd_path = GET_STR_PROP("fdd_img");
|
||||||
if (!fdd_path.empty()) {
|
if (!fdd_path.empty()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user