|
|
1.1 root 1: //
2: // nono
1.1.1.3 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
7: #pragma once
8:
9: #include "device.h"
10: #include "upd7201.h"
11:
1.1.1.6 root 12: class SCCDevice : public uPD7201Device
1.1 root 13: {
1.1.1.3 root 14: using inherited = uPD7201Device;
1.1 root 15: private:
16: static const int baseaddr = 0xe98000;
17:
18: public:
19: SCCDevice();
1.1.1.4 root 20: virtual ~SCCDevice() override;
1.1 root 21:
22: // XXX 親の同名メソッドと名前分けたほうがいいか
1.1.1.8 ! root 23: uint8 ReadCtrl(SIO::channel *chan) override;
! 24: void WriteCtrl(SIO::channel *chan, uint32 data) override;
1.1 root 25:
1.1.1.4 root 26: // 割り込みアクノリッジ
27: int InterruptAcknowledge();
1.1.1.2 root 28:
1.1.1.3 root 29: protected:
30: // BusIO インタフェース
31: static const uint32 NPORT = 4;
1.1.1.5 root 32: uint64 Read(uint32 offset);
33: uint64 Write(uint32 offset, uint32 data);
34: uint64 Peek(uint32 offset);
1.1.1.4 root 35:
1.1.1.8 ! root 36: void Tx(int ch, uint32 data) override;
! 37:
! 38: // 指定のレジスタ名を返す
! 39: const char *CRName(const SIO::channel *chan, int n) const override;
! 40: const char *SRName(const SIO::channel *chan, int n) const override;
! 41:
! 42: // WR, RR のほうが通りがいいので結局用意する
! 43: const char *WRName(const SIO::channel *chan, int n) const {
! 44: return CRName(chan, n);
! 45: }
! 46: const char *WRName(const SIO::channel *chan) const {
! 47: return inherited::CRName(chan);
! 48: }
! 49: const char *RRName(const SIO::channel *chan, int n) const {
! 50: return SRName(chan, n);
! 51: }
! 52: const char *RRName(const SIO::channel *chan) const {
! 53: return inherited::SRName(chan);
! 54: }
! 55:
1.1.1.4 root 56: private:
57: void Interrupt() override;
1.1.1.8 ! root 58: void WriteCR0(SIO::channel *chan, uint32 data) override;
! 59: void WriteCR5(SIO::channel *chan, uint32 data) override;
! 60: void SetTXC(SIO::channel *chan);
! 61:
! 62: static const char * const wrnames[32];
! 63: static const char * const rrnames[32];
1.1 root 64: };
1.1.1.2 root 65:
66: extern std::unique_ptr<SCCDevice> gSCC;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.