|
|
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 容量(バイト単位)を取得
38: int GetSize() const { return ram_size; }
39: // RAM 容量(MB単位)を取得
40: int GetSizeMB() const { return (uint)ram_size / 1024 / 1024; }
41:
1.1.1.2 root 42: // アクセスウェイト [clock] を設定
1.1.1.3 ! root 43: void SetWait(uint32 wait_clock);
1.1 root 44:
1.1.1.2 root 45: // info で指定された実行ファイルをロードする
46: bool LoadExec(LoadInfo *);
47:
48: // info で指定されたデータファイルをロードする
49: bool LoadData(LoadInfo *);
1.1 root 50:
51: static std::unique_ptr<uint8[]> mainram;
52:
53: private:
54: // RAM 容量(バイト単位)。ram[] の確保したバイト数
55: int ram_size {};
56:
1.1.1.2 root 57: // アクセスウェイト
1.1.1.3 ! root 58: busdata normal_wait {};
! 59: busdata burst_wait {};
1.1 root 60: };
61:
62: static inline MainRAMDevice *GetMainRAMDevice() {
63: return Object::GetObject<MainRAMDevice>(OBJ_MAINRAM);
64: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.