|
|
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:
16: class ADPCMDevice : public IODevice
17: {
18: using inherited = IODevice;
19:
20: static const int baseaddr = 0xe92000;
21:
22: static const uint8 STAT_PLAY = 0x80;
23:
24: static const uint8 REC_START = 0x04;
25: static const uint8 PLAY_START = 0x02;
26: static const uint8 STOP = 0x01;
27:
28: public:
29: ADPCMDevice();
30: virtual ~ADPCMDevice() override;
31:
32: void ResetHard(bool poweron) override;
33:
34: // CT1 によるクロック切り替え。OPM から呼ばれる。
35: void SetClock(bool);
36:
37: // DMAC から呼ばれる。
38: void AssertDACK(bool tc);
39: void NegateDACK();
40:
41: protected:
42: // BusIO インタフェース
43: static const uint32 NPORT = 2;
44: uint64 Read(uint32 offset);
45: uint64 Write(uint32 offset, uint32 data);
46: uint64 Peek(uint32 offset);
47:
48: private:
49: void StartPlay();
50:
51: void EventCallback(Event&);
52:
53: bool playing {};
54: bool dack {};
55: int clk {};
56: int div {};
57:
58: Event event { this };
59: };
60:
61: extern ADPCMDevice *gADPCM;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.