1 |
/* |
2 |
* main.h - Emulation core |
3 |
* |
4 |
* SheepShaver (C) 1997-2002 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 |
|
32 |
#ifdef __BEOS__ |
33 |
extern system_info SysInfo; // System information |
34 |
#endif |
35 |
|
36 |
// 68k register structure (for Execute68k()) |
37 |
struct M68kRegisters { |
38 |
uint32 d[8]; |
39 |
uint32 a[8]; |
40 |
}; |
41 |
|
42 |
|
43 |
// Functions |
44 |
extern void Dump68kRegs(M68kRegisters *r); // Dump 68k registers |
45 |
extern void MakeExecutable(int dummy, void *start, uint32 length); // Make code executable |
46 |
extern void PatchAfterStartup(void); // Patches after system startup |
47 |
extern void QuitEmulator(void); // Quit emulator (must only be called from main thread) |
48 |
extern void ErrorAlert(const char *text); // Display error alert |
49 |
extern void WarningAlert(const char *text); // Display warning alert |
50 |
extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert |
51 |
|
52 |
// Mutexes (non-recursive) |
53 |
struct B2_mutex; |
54 |
extern B2_mutex *B2_create_mutex(void); |
55 |
extern void B2_lock_mutex(B2_mutex *mutex); |
56 |
extern void B2_unlock_mutex(B2_mutex *mutex); |
57 |
extern void B2_delete_mutex(B2_mutex *mutex); |
58 |
|
59 |
// Interrupt flags |
60 |
enum { |
61 |
INTFLAG_VIA = 1, // 60.15Hz VBL |
62 |
INTFLAG_SERIAL = 2, // Serial driver |
63 |
INTFLAG_ETHER = 4, // Ethernet driver |
64 |
INTFLAG_AUDIO = 16, // Audio block read |
65 |
INTFLAG_TIMER = 32, // Time Manager |
66 |
INTFLAG_ADB = 64 // ADB |
67 |
}; |
68 |
|
69 |
extern volatile uint32 InterruptFlags; // Currently pending interrupts |
70 |
extern void SetInterruptFlag(uint32); |
71 |
extern void ClearInterruptFlag(uint32); |
72 |
#if EMULATED_PPC |
73 |
extern void HandleInterrupt(void); // Handle SIGUSR1 interrupt in emulator thread |
74 |
#endif |
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 |