mesh: self-registration with the device registry.
This commit is contained in:
parent
7db0a31cc5
commit
9971052a78
|
@ -22,6 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
/** @file MESH (Macintosh Enhanced SCSI Hardware) controller emulation. */
|
/** @file MESH (Macintosh Enhanced SCSI Hardware) controller emulation. */
|
||||||
|
|
||||||
#include <devices/common/scsi/mesh.h>
|
#include <devices/common/scsi/mesh.h>
|
||||||
|
#include <devices/deviceregistry.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <loguru.hpp>
|
#include <loguru.hpp>
|
||||||
|
@ -69,3 +70,9 @@ void MESHController::write(uint8_t reg_offset, uint8_t value)
|
||||||
LOG_F(WARNING, "MESH: write to unimplemented register at offset %d", reg_offset);
|
LOG_F(WARNING, "MESH: write to unimplemented register at offset %d", reg_offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const DeviceDescription Mesh_Descriptor = {
|
||||||
|
MESHController::create, {}, {}
|
||||||
|
};
|
||||||
|
|
||||||
|
REGISTER_DEVICE(Mesh, Mesh_Descriptor);
|
||||||
|
|
|
@ -24,7 +24,10 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
#ifndef MESH_H
|
#ifndef MESH_H
|
||||||
#define MESH_H
|
#define MESH_H
|
||||||
|
|
||||||
|
#include <devices/common/hwcomponent.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
// Chip ID returned by the MESH cell inside the Heathrow ASIC
|
// Chip ID returned by the MESH cell inside the Heathrow ASIC
|
||||||
#define HeathrowMESHID 4
|
#define HeathrowMESHID 4
|
||||||
|
@ -53,11 +56,18 @@ enum MeshReg : uint8_t {
|
||||||
|
|
||||||
}; // namespace MeshScsi
|
}; // namespace MeshScsi
|
||||||
|
|
||||||
class MESHController {
|
class MESHController : public HWComponent {
|
||||||
public:
|
public:
|
||||||
MESHController(uint8_t mesh_id) { this->chip_id = mesh_id; };
|
MESHController(uint8_t mesh_id) {
|
||||||
|
supports_types(HWCompType::SCSI_HOST | HWCompType::SCSI_DEV);
|
||||||
|
this->chip_id = mesh_id;
|
||||||
|
};
|
||||||
~MESHController() = default;
|
~MESHController() = default;
|
||||||
|
|
||||||
|
static std::unique_ptr<HWComponent> create() {
|
||||||
|
return std::unique_ptr<MESHController>(new MESHController(HeathrowMESHID));
|
||||||
|
}
|
||||||
|
|
||||||
// MESH registers access
|
// MESH registers access
|
||||||
uint8_t read(uint8_t reg_offset);
|
uint8_t read(uint8_t reg_offset);
|
||||||
void write(uint8_t reg_offset, uint8_t value);
|
void write(uint8_t reg_offset, uint8_t value);
|
||||||
|
|
Loading…
Reference in New Issue