Annotation of nono/vm/mainram.h, revision 1.1.1.4

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2020 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // メインメモリ
                      9: //
                     10: 
                     11: #pragma once
                     12: 
                     13: #include "device.h"
                     14: #include "bootloader.h"
                     15: 
                     16: class MainRAMDevice : public IODevice
                     17: {
                     18:        using inherited = IODevice;
                     19:  public:
                     20:        MainRAMDevice();
1.1.1.2   root       21:        ~MainRAMDevice() override;
1.1       root       22: 
                     23:        bool Init() override;
                     24:        void ResetHard(bool poweron) override;
                     25: 
1.1.1.3   root       26:        busdata Read(busaddr addr) override;
                     27:        busdata Write(busaddr addr, uint32 data) override;
                     28:        busdata ReadBurst16(busaddr addr, uint32 *dst) override;
                     29:        busdata WriteBurst16(busaddr addr, const uint32 *dst) override;
                     30:        busdata Peek1(uint32 addr) override;
                     31:        bool Poke1(uint32 addr, uint32 data) override;
                     32: 
                     33:        // 領域アクセス
                     34:        bool ReadMem(uint32 addr, void *dst, uint32 len);
                     35:        bool WriteMem(uint32 addr, const void *src, uint32 len);
1.1       root       36: 
                     37:        // RAM 容量(バイト単位)を取得
1.1.1.4 ! root       38:        size_t GetSize() const  { return ram_size; }
1.1       root       39:        // RAM 容量(MB単位)を取得
1.1.1.4 ! root       40:        uint GetSizeMB() const { return (uint)(ram_size / 1024 / 1024); }
1.1       root       41: 
1.1.1.2   root       42:        // アクセスウェイト [clock] を設定
1.1.1.3   root       43:        void SetWait(uint32 wait_clock);
1.1       root       44: 
                     45:  private:
1.1.1.4 ! root       46:        std::unique_ptr<uint8[]> mainram {};
        !            47: 
1.1       root       48:        // RAM 容量(バイト単位)。ram[] の確保したバイト数
1.1.1.4 ! root       49:        size_t ram_size {};
1.1       root       50: 
1.1.1.2   root       51:        // アクセスウェイト
1.1.1.3   root       52:        busdata normal_wait {};
                     53:        busdata burst_wait {};
1.1.1.4 ! root       54: 
        !            55:        // 電源オン時にメモリをクリアする。
        !            56:        bool clear_on_boot {};
1.1       root       57: };
                     58: 
                     59: static inline MainRAMDevice *GetMainRAMDevice() {
                     60:        return Object::GetObject<MainRAMDevice>(OBJ_MAINRAM);
                     61: }

unix.superglobalmegacorp.com

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