Annotation of nono/vm/device.cpp, revision 1.1.1.13

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: 
1.1.1.8   root        7: //
                      8: // デバイスの基本クラスなど
                      9: //
1.1       root       10: 
1.1.1.8   root       11: #include "device.h"
                     12: #include "mpu.h"
                     13: #include "scheduler.h"
1.1       root       14: 
                     15: //
                     16: // Device
                     17: //
                     18: 
                     19: // コンストラクタ
1.1.1.11  root       20: Device::Device(uint objid_)
1.1.1.9   root       21:        : inherited(objid_)
1.1       root       22: {
                     23: }
                     24: 
                     25: // デストラクタ
                     26: Device::~Device()
                     27: {
                     28: }
                     29: 
                     30: bool
                     31: Device::Create()
                     32: {
                     33:        return true;
                     34: }
                     35: 
                     36: bool
1.1.1.12  root       37: Device::Create2()
                     38: {
                     39:        return true;
                     40: }
                     41: 
                     42: void
                     43: Device::EarlyInit()
1.1       root       44: {
1.1.1.9   root       45:        mpu = GetMPUDevice();
                     46:        scheduler = GetScheduler();
1.1.1.12  root       47: }
1.1.1.9   root       48: 
1.1.1.12  root       49: bool
                     50: Device::Init()
                     51: {
1.1       root       52:        return true;
                     53: }
                     54: 
1.1.1.8   root       55: void
                     56: Device::ResetHard(bool poweron)
1.1       root       57: {
                     58: }
                     59: 
1.1.1.8   root       60: void
1.1       root       61: Device::PowerOff()
                     62: {
                     63: }
                     64: 
1.1.1.8   root       65: // ログ表示。
                     66: // VM デバイスでは、仮想時間、PC、オブジェクト名を表示する。
1.1       root       67: void
1.1.1.8   root       68: Device::putlogn(const char *fmt, ...) const
1.1       root       69: {
1.1.1.8   root       70:        char buf[1024];
                     71:        va_list ap;
                     72:        uint64 vt;
                     73:        int len;
                     74: 
1.1.1.9   root       75:        vt = scheduler->GetVirtTime();
1.1.1.11  root       76:        len = snprintf(buf, sizeof(buf), "%4u.%03u'%03u'%03u %08x %s ",
                     77:                (uint)(vt / 1000 / 1000 / 1000),
                     78:                (uint)((vt / 1000 / 1000) % 1000),
                     79:                (uint)((vt / 1000) % 1000),
                     80:                (uint)(vt % 1000),
1.1.1.9   root       81:                mpu->GetPPC(),
1.1.1.8   root       82:                GetName().c_str());
                     83: 
                     84:        va_start(ap, fmt);
                     85:        vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
                     86:        va_end(ap);
                     87: 
                     88:        WriteLog(buf);
1.1       root       89: }
                     90: 
                     91: 
                     92: //
                     93: // IODevice
                     94: //
                     95: 
                     96: // コンストラクタ
1.1.1.11  root       97: IODevice::IODevice(uint objid_)
1.1.1.9   root       98:        : inherited(objid_)
1.1       root       99: {
                    100: }
                    101: 
                    102: // デストラクタ
                    103: IODevice::~IODevice()
                    104: {
                    105: }
                    106: 
1.1.1.10  root      107: busdata
1.1.1.11  root      108: IODevice::Read(busaddr addr)
1.1       root      109: {
1.1.1.11  root      110:        return 0;
1.1       root      111: }
                    112: 
1.1.1.10  root      113: busdata
1.1.1.11  root      114: IODevice::Write(busaddr addr, uint32 data)
1.1       root      115: {
1.1.1.11  root      116:        return 0;
1.1       root      117: }
                    118: 
1.1.1.10  root      119: busdata
1.1.1.11  root      120: IODevice::ReadBurst16(busaddr addr, uint32 *dst)
1.1       root      121: {
1.1.1.11  root      122:        return BusData::BusErr;
1.1       root      123: }
                    124: 
1.1.1.10  root      125: busdata
1.1.1.11  root      126: IODevice::WriteBurst16(busaddr addr, const uint32 *src)
1.1       root      127: {
1.1.1.11  root      128:        return BusData::BusErr;
1.1       root      129: }
                    130: 
1.1.1.10  root      131: busdata
1.1.1.11  root      132: IODevice::Read1(uint32 addr)
1.1       root      133: {
1.1.1.11  root      134:        return 0xff;
1.1       root      135: }
                    136: 
1.1.1.10  root      137: busdata
1.1.1.11  root      138: IODevice::Write1(uint32 addr, uint32 data)
1.1       root      139: {
                    140:        return 0;
                    141: }
                    142: 
1.1.1.10  root      143: busdata
1.1.1.11  root      144: IODevice::Peek1(uint32 addr)
1.1       root      145: {
1.1.1.2   root      146:        return 0xff;
1.1       root      147: }
                    148: 
1.1.1.10  root      149: bool
1.1.1.11  root      150: IODevice::Poke1(uint32 addr, uint32 data)
1.1.1.9   root      151: {
1.1.1.10  root      152:        return false;
1.1.1.9   root      153: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.