1 |
/* |
2 |
* main.h - Emulation core |
3 |
* |
4 |
* SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig |
5 |
* |
6 |
* This program is free software; you can redistribute it and/or modify |
7 |
* it under the terms of the GNU General Public License as published by |
8 |
* the Free Software Foundation; either version 2 of the License, or |
9 |
* (at your option) any later version. |
10 |
* |
11 |
* This program is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
* GNU General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU General Public License |
17 |
* along with this program; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
#ifndef MAIN_H |
22 |
#define MAIN_H |
23 |
|
24 |
// Global variables |
25 |
extern void *TOC; // TOC pointer |
26 |
extern uint32 KernelDataAddr; // Address of Kernel Data |
27 |
extern uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM |
28 |
extern uint32 PVR; // Theoretical PVR |
29 |
extern int64 CPUClockSpeed; // Processor clock speed (Hz) |
30 |
extern int64 BusClockSpeed; // Bus clock speed (Hz) |
31 |
extern int64 TimebaseSpeed; // Timebase clock speed (Hz) |
32 |
|
33 |
#ifdef __BEOS__ |
34 |
extern system_info SysInfo; // System information |
35 |
#endif |
36 |
|
37 |
// 68k register structure (for Execute68k()) |
38 |
struct M68kRegisters { |
39 |
uint32 d[8]; |
40 |
uint32 a[8]; |
41 |
}; |
42 |
|
43 |
|
44 |
// Functions |
45 |
extern bool InitAll(void); |
46 |
extern void ExitAll(void); |
47 |
extern void Dump68kRegs(M68kRegisters *r); // Dump 68k registers |
48 |
extern void MakeExecutable(int dummy, uint32 start, uint32 length); // Make code executable |
49 |
extern void PatchAfterStartup(void); // Patches after system startup |
50 |
extern void QuitEmulator(void); // Quit emulator (must only be called from main thread) |
51 |
extern void ErrorAlert(const char *text); // Display error alert |
52 |
extern void WarningAlert(const char *text); // Display warning alert |
53 |
extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert |
54 |
|
55 |
// Mutexes (non-recursive) |
56 |
struct B2_mutex; |
57 |
extern B2_mutex *B2_create_mutex(void); |
58 |
extern void B2_lock_mutex(B2_mutex *mutex); |
59 |
extern void B2_unlock_mutex(B2_mutex *mutex); |
60 |
extern void B2_delete_mutex(B2_mutex *mutex); |
61 |
|
62 |
// Interrupt flags |
63 |
enum { |
64 |
INTFLAG_VIA = 1, // 60.15Hz VBL |
65 |
INTFLAG_SERIAL = 2, // Serial driver |
66 |
INTFLAG_ETHER = 4, // Ethernet driver |
67 |
INTFLAG_AUDIO = 16, // Audio block read |
68 |
INTFLAG_TIMER = 32, // Time Manager |
69 |
INTFLAG_ADB = 64 // ADB |
70 |
}; |
71 |
|
72 |
extern volatile uint32 InterruptFlags; // Currently pending interrupts |
73 |
extern void SetInterruptFlag(uint32); |
74 |
extern void ClearInterruptFlag(uint32); |
75 |
extern void TriggerInterrupt(void); // Trigger SIGUSR1 interrupt in emulator thread |
76 |
extern void DisableInterrupt(void); // Disable SIGUSR1 interrupt (can be nested) |
77 |
extern void EnableInterrupt(void); // Enable SIGUSR1 interrupt (can be nested) |
78 |
|
79 |
#endif |