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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
All rights reserved.
This file is part of the Palm OS Emulator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
\* ===================================================================== */
#ifndef EmRegs328_h
#define EmRegs328_h
#include "EmHAL.h" // EmHALHandler
#include "EmRegs.h" // EmRegs
#include "EmStructs.h" // RGBList
#include "EmUARTDragonball.h" // EmUARTDragonball::State
class EmScreenUpdateInfo;
class EmRegs328 : public EmRegs, public EmHALHandler
{
public:
EmRegs328 (void);
virtual ~EmRegs328 (void);
// EmRegs overrides
virtual void Initialize (void);
virtual void Reset (Bool hardwareReset);
virtual void Save (SessionFile&);
virtual void Load (SessionFile&);
virtual void Dispose (void);
virtual void SetSubBankHandlers (void);
virtual uint8* GetRealAddress (emuptr address);
virtual emuptr GetAddressStart (void);
virtual uint32 GetAddressRange (void);
// EmHALHandler overrides
virtual void Cycle (Bool sleeping);
virtual void CycleSlowly (Bool sleeping);
virtual void ButtonEvent (SkinElementType, Bool buttonIsDown);
virtual void TurnSoundOff (void);
virtual void ResetTimer (void);
virtual void ResetRTC (void);
virtual int32 GetInterruptLevel (void);
virtual int32 GetInterruptBase (void);
virtual Bool GetLCDScreenOn (void) = 0;
virtual Bool GetLCDBacklightOn (void) = 0;
virtual Bool GetLCDHasFrame (void);
virtual void GetLCDBeginEnd (emuptr&, emuptr&);
virtual void GetLCDScanlines (EmScreenUpdateInfo& info);
virtual EmUARTDeviceType GetUARTDevice (int uartNum);
virtual int32 GetDynamicHeapSize (void);
virtual int32 GetROMSize (void);
virtual emuptr GetROMBaseAddress (void);
virtual Bool ChipSelectsConfigured (void);
virtual int32 GetSystemClockFrequency (void);
virtual Bool GetCanStop (void);
virtual Bool GetAsleep (void);
virtual uint8 GetPortInputValue (int);
virtual uint8 GetPortInternalValue (int);
virtual void PortDataChanged (int, uint8, uint8);
private:
uint32 pllFreqSelRead (emuptr address, int size);
uint32 portXDataRead (emuptr address, int size);
uint32 tmr1StatusRead (emuptr address, int size);
uint32 tmr2StatusRead (emuptr address, int size);
uint32 uartRead (emuptr address, int size);
uint32 rtcHourMinSecRead (emuptr address, int size);
void csASelect1Write (emuptr address, int size, uint32 value);
void csCSelect0Write (emuptr address, int size, uint32 value);
void csCSelect1Write (emuptr address, int size, uint32 value);
void intMaskHiWrite (emuptr address, int size, uint32 value);
void intMaskLoWrite (emuptr address, int size, uint32 value);
void intStatusHiWrite (emuptr address, int size, uint32 value);
void portXDataWrite (emuptr address, int size, uint32 value);
void portDIntReqEnWrite (emuptr address, int size, uint32 value);
void tmr1StatusWrite (emuptr address, int size, uint32 value);
void tmr2StatusWrite (emuptr address, int size, uint32 value);
void wdCounterWrite (emuptr address, int size, uint32 value);
void spiMasterControlWrite (emuptr address, int size, uint32 value);
void uartWrite (emuptr address, int size, uint32 value);
void lcdRegisterWrite (emuptr address, int size, uint32 value);
void rtcControlWrite (emuptr address, int size, uint32 value);
void rtcIntStatusWrite (emuptr address, int size, uint32 value);
void rtcIntEnableWrite (emuptr address, int size, uint32 value);
protected:
void HotSyncEvent (Bool buttonIsDown);
virtual uint8 GetKeyBits (void);
virtual uint16 ButtonToBits (SkinElementType);
protected:
void UpdateInterrupts (void);
void UpdatePortDInterrupts (void);
void UpdateRTCInterrupts (void);
protected:
Bool IDDetectAsserted (void);
UInt8 GetHardwareID (void);
protected:
void UARTStateChanged (Bool sendTxData);
void UpdateUARTState (Bool refreshRxData);
void UpdateUARTInterrupts (const EmUARTDragonball::State& state);
void MarshalUARTState (EmUARTDragonball::State& state);
void UnmarshalUARTState (const EmUARTDragonball::State& state);
protected:
int GetPort (emuptr address);
void PrvGetPalette (RGBList& thePalette);
protected:
HwrM68328Type f68328Regs;
bool fHotSyncButtonDown;
uint32 fTmr2CurrentMilliseconds;
uint32 fTmr2StartMilliseconds;
uint16 fKeyBits;
uint16 fLastTmr1Status;
uint16 fLastTmr2Status;
uint8 fPortDEdge;
uint32 fPortDDataCount;
uint32 fHour;
uint32 fMin;
uint32 fSec;
uint32 fTick;
uint32 fCycle;
EmUARTDragonball* fUART;
};
#endif /* EmRegs328_h */
|