|
|
1.1 root 1: //
2: // nono
3: // Copyright (C) 2022 nono project
4: // Licensed under nono-license.txt
5: //
6:
7: //
8: // ADPCM (MSM6258V)
9: //
10:
11: #pragma once
12:
13: #include "device.h"
14: #include "event.h"
15:
1.1.1.2 root 16: class DMACDevice;
17: class PPIDevice;
18:
1.1 root 19: class ADPCMDevice : public IODevice
20: {
21: using inherited = IODevice;
22:
23: static const int baseaddr = 0xe92000;
24:
25: static const uint8 STAT_PLAY = 0x80;
26:
27: static const uint8 REC_START = 0x04;
28: static const uint8 PLAY_START = 0x02;
29: static const uint8 STOP = 0x01;
30:
31: public:
32: ADPCMDevice();
1.1.1.3 ! root 33: ~ADPCMDevice() override;
1.1 root 34:
1.1.1.2 root 35: bool Init() override;
1.1 root 36: void ResetHard(bool poweron) override;
37:
38: // CT1 によるクロック切り替え。OPM から呼ばれる。
39: void SetClock(bool);
40:
41: // DMAC から呼ばれる。
42: void AssertDACK(bool tc);
43: void NegateDACK();
44:
45: protected:
46: // BusIO インタフェース
47: static const uint32 NPORT = 2;
1.1.1.3 ! root 48: busdata Read(uint32 offset);
! 49: busdata Write(uint32 offset, uint32 data);
! 50: busdata Peek(uint32 offset);
1.1 root 51:
52: private:
53: void StartPlay();
54:
55: void EventCallback(Event&);
56:
57: bool playing {};
58: bool dack {};
59: int clk {};
60: int div {};
61:
1.1.1.2 root 62: DMACDevice *dmac {};
63: PPIDevice *ppi {};
64:
1.1 root 65: Event event { this };
66: };
67:
1.1.1.2 root 68: static inline ADPCMDevice *GetADPCMDevice() {
69: return Object::GetObject<ADPCMDevice>(OBJ_ADPCM);
70: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.