forked from kstenerud/Musashi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpt.h
42 lines (30 loc) · 910 Bytes
/
gpt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma once
#include "peripheralBase.h"
#include "peripheralTypes.h"
#include "port.h"
namespace mc68k
{
class Mc68k;
class Gpt final : public PeripheralBase<g_gptBase, g_gptSize>
{
public:
typedef void (*TTimerFunc)(Gpt*);
explicit Gpt(Mc68k& _mc68k);
void write8(PeriphAddress _addr, uint8_t _val) override;
uint8_t read8(PeriphAddress _addr) override;
void write16(PeriphAddress _addr, uint16_t _val) override;
uint16_t read16(PeriphAddress _addr) override;
Port& getPortGP() { return m_portGP; }
void injectInterrupt(uint8_t _vba);
void exec(uint32_t _deltaCycles) override;
void timerOverflow();
private:
template<uint32_t TocIndex> void execToc(uint32_t _deltaCycles);
template<uint32_t TocIndex> void updateToc();
uint64_t rawTcnt() const;
Mc68k& m_mc68k;
Port m_portGP;
std::array<TTimerFunc, 2> m_timerFuncs;
std::array<int32_t, 4> m_tocLoad;
};
}