mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-22 15:29:58 +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. */
|
||||
|
||||
#include <devices/deviceregistry.h>
|
||||
#include <devices/serial/chario.h>
|
||||
#include <devices/serial/escc.h>
|
||||
#include <loguru.hpp>
|
||||
@ -29,6 +30,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#include <cinttypes>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/** Remap the compatible addressing scheme to MacRISC one. */
|
||||
const uint8_t compat_to_macrisc[6] = {
|
||||
@ -306,3 +308,15 @@ uint8_t EsccChannel::receive_byte()
|
||||
this->read_regs[0] &= ~1;
|
||||
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
|
||||
#define ESCC_H
|
||||
|
||||
#include <devices/common/hwcomponent.h>
|
||||
#include <devices/serial/chario.h>
|
||||
|
||||
#include <cinttypes>
|
||||
@ -116,11 +117,15 @@ private:
|
||||
};
|
||||
|
||||
/** ESCC Controller class. */
|
||||
class EsccController {
|
||||
class EsccController : public HWComponent {
|
||||
public:
|
||||
EsccController();
|
||||
~EsccController() = default;
|
||||
|
||||
static std::unique_ptr<HWComponent> create() {
|
||||
return std::unique_ptr<EsccController>(new EsccController());
|
||||
}
|
||||
|
||||
// ESCC registers access
|
||||
uint8_t read(uint8_t reg_offset);
|
||||
void write(uint8_t reg_offset, uint8_t value);
|
||||
|
Loading…
Reference in New Issue
Block a user