|
|
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:
1.1.1.2 root 15: class DMACDevice;
16: class PPIDevice;
17:
1.1 root 18: class ADPCMDevice : public IODevice
19: {
20: using inherited = IODevice;
21:
1.1.1.4 root 22: static const uint32 baseaddr = 0xe92000;
1.1 root 23:
24: static const uint8 STAT_PLAY = 0x80;
25:
26: static const uint8 REC_START = 0x04;
27: static const uint8 PLAY_START = 0x02;
28: static const uint8 STOP = 0x01;
29:
30: public:
31: ADPCMDevice();
1.1.1.3 root 32: ~ADPCMDevice() override;
1.1 root 33:
1.1.1.2 root 34: bool Init() override;
1.1 root 35: void ResetHard(bool poweron) override;
36:
37: // CT1 によるクロック切り替え。OPM から呼ばれる。
38: void SetClock(bool);
39:
40: // DMAC から呼ばれる。
41: void AssertDACK(bool tc);
42: void NegateDACK();
43:
44: protected:
45: // BusIO インタフェース
46: static const uint32 NPORT = 2;
1.1.1.4 root 47: busdata ReadPort(uint32 offset);
48: busdata WritePort(uint32 offset, uint32 data);
49: busdata PeekPort(uint32 offset);
50: bool PokePort(uint32 offset, uint32 data);
1.1 root 51:
52: private:
53: void StartPlay();
54:
1.1.1.5 ! root 55: void EventCallback(Event *);
1.1 root 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.1.5 ! root 65: Event *event {};
1.1 root 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.