mirror of
https://github.com/dingusdev/dingusppc.git
synced 2025-01-10 13:29:38 +00:00
escc: self-registration with the device registry.
This commit is contained in:
parent
439029cafe
commit
7fc28baf96
@ -21,6 +21,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
/** @file Enhanced Serial Communications Controller (ESCC) emulation. */
|
/** @file Enhanced Serial Communications Controller (ESCC) emulation. */
|
||||||
|
|
||||||
|
#include <devices/deviceregistry.h>
|
||||||
#include <devices/serial/chario.h>
|
#include <devices/serial/chario.h>
|
||||||
#include <devices/serial/escc.h>
|
#include <devices/serial/escc.h>
|
||||||
#include <loguru.hpp>
|
#include <loguru.hpp>
|
||||||
@ -29,6 +30,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
/** Remap the compatible addressing scheme to MacRISC one. */
|
/** Remap the compatible addressing scheme to MacRISC one. */
|
||||||
const uint8_t compat_to_macrisc[6] = {
|
const uint8_t compat_to_macrisc[6] = {
|
||||||
@ -306,3 +308,15 @@ uint8_t EsccChannel::receive_byte()
|
|||||||
this->read_regs[0] &= ~1;
|
this->read_regs[0] &= ~1;
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const vector<string> CharIoBackends = {"null", "stdio"};
|
||||||
|
|
||||||
|
static const PropMap Escc_Properties = {
|
||||||
|
{"serial_backend", new StrProperty("null", CharIoBackends)},
|
||||||
|
};
|
||||||
|
|
||||||
|
static const DeviceDescription Escc_Descriptor = {
|
||||||
|
EsccController::create, {}, Escc_Properties
|
||||||
|
};
|
||||||
|
|
||||||
|
REGISTER_DEVICE(Escc, Escc_Descriptor);
|
||||||
|
@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
#ifndef ESCC_H
|
#ifndef ESCC_H
|
||||||
#define ESCC_H
|
#define ESCC_H
|
||||||
|
|
||||||
|
#include <devices/common/hwcomponent.h>
|
||||||
#include <devices/serial/chario.h>
|
#include <devices/serial/chario.h>
|
||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
@ -116,11 +117,15 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** ESCC Controller class. */
|
/** ESCC Controller class. */
|
||||||
class EsccController {
|
class EsccController : public HWComponent {
|
||||||
public:
|
public:
|
||||||
EsccController();
|
EsccController();
|
||||||
~EsccController() = default;
|
~EsccController() = default;
|
||||||
|
|
||||||
|
static std::unique_ptr<HWComponent> create() {
|
||||||
|
return std::unique_ptr<EsccController>(new EsccController());
|
||||||
|
}
|
||||||
|
|
||||||
// ESCC registers access
|
// ESCC 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…
x
Reference in New Issue
Block a user