|
|
1.1 root 1: //
2: // nono
1.1.1.2 root 3: // Copyright (C) 2020 nono project
4: // Licensed under nono-license.txt
1.1 root 5: //
6:
1.1.1.6 root 7: //
8: // プリンタポート
9: //
10:
1.1 root 11: #include "printer.h"
1.1.1.3 root 12: #include "mpu.h"
1.1 root 13:
1.1.1.9 ! root 14: // InsideOut p.135
! 15: static const busdata wait = busdata::Wait(7 * 40_nsec);
! 16:
1.1.1.6 root 17: // コンストラクタ
1.1 root 18: PrinterDevice::PrinterDevice()
1.1.1.8 root 19: : inherited(OBJ_PRINTER)
1.1 root 20: {
21: }
22:
1.1.1.6 root 23: // デストラクタ
1.1 root 24: PrinterDevice::~PrinterDevice()
25: {
26: }
27:
1.1.1.9 ! root 28: busdata
1.1 root 29: PrinterDevice::Read8(uint32 addr)
30: {
31: // 書き込み専用
1.1.1.9 ! root 32: busdata data = busdata::BusErr;
! 33: data |= wait;
! 34: return data;
1.1 root 35: }
36:
1.1.1.9 ! root 37: busdata
1.1 root 38: PrinterDevice::Read16(uint32 addr)
39: {
40: // 書き込み専用
1.1.1.9 ! root 41: busdata data = busdata::BusErr;
! 42: data |= wait;
! 43: return data;
1.1 root 44: }
45:
1.1.1.9 ! root 46: busdata
1.1 root 47: PrinterDevice::Write8(uint32 addr, uint32 data)
48: {
49: uint32 offset = addr - baseaddr;
1.1.1.9 ! root 50: busdata r;
! 51:
1.1 root 52: switch (offset) {
53: case 0:
1.1.1.7 root 54: // データ書き込み
55: putlog(0, "Write Data (NOT IMPLEMENTED)");
1.1.1.9 ! root 56: r.SetBusErr();
1.1 root 57: break;
58: case 3:
1.1.1.7 root 59: // ストローブ書き込み
60: putlog(0, "Write Strobe (NOT IMPLEMENTED)");
1.1.1.9 ! root 61: r = 0;
! 62: break;
1.1 root 63: default:
64: break;
65: }
1.1.1.9 ! root 66:
! 67: r |= wait;
! 68: return r;
1.1 root 69: }
70:
1.1.1.9 ! root 71: busdata
1.1 root 72: PrinterDevice::Write16(uint32 addr, uint32 data)
73: {
74: return Write8(addr + 1, data);
75: }
76:
1.1.1.9 ! root 77: busdata
1.1 root 78: PrinterDevice::Peek8(uint32 addr)
79: {
80: // XXX
81: return 0xff;
82: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.