1 |
/* |
2 |
* main.h - Emulation core |
3 |
* |
4 |
* SheepShaver (C) 1997-2004 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 void Dump68kRegs(M68kRegisters *r); // Dump 68k registers |
46 |
extern void MakeExecutable(int dummy, uint32 start, uint32 length); // Make code executable |
47 |
extern void PatchAfterStartup(void); // Patches after system startup |
48 |
extern void QuitEmulator(void); // Quit emulator (must only be called from main thread) |
49 |
extern void ErrorAlert(const char *text); // Display error alert |
50 |
extern void WarningAlert(const char *text); // Display warning alert |
51 |
extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert |
52 |
|
53 |
// Mutexes (non-recursive) |
54 |
struct B2_mutex; |
55 |
extern B2_mutex *B2_create_mutex(void); |
56 |
extern void B2_lock_mutex(B2_mutex *mutex); |
57 |
extern void B2_unlock_mutex(B2_mutex *mutex); |
58 |
extern void B2_delete_mutex(B2_mutex *mutex); |
59 |
|
60 |
// Interrupt flags |
61 |
enum { |
62 |
INTFLAG_VIA = 1, // 60.15Hz VBL |
63 |
INTFLAG_SERIAL = 2, // Serial driver |
64 |
INTFLAG_ETHER = 4, // Ethernet driver |
65 |
INTFLAG_AUDIO = 16, // Audio block read |
66 |
INTFLAG_TIMER = 32, // Time Manager |
67 |
INTFLAG_ADB = 64 // ADB |
68 |
}; |
69 |
|
70 |
extern volatile uint32 InterruptFlags; // Currently pending interrupts |
71 |
extern void SetInterruptFlag(uint32); |
72 |
extern void ClearInterruptFlag(uint32); |
73 |
extern void TriggerInterrupt(void); // Trigger SIGUSR1 interrupt in emulator thread |
74 |
extern void DisableInterrupt(void); // Disable SIGUSR1 interrupt (can be nested) |
75 |
extern void EnableInterrupt(void); // Enable SIGUSR1 interrupt (can be nested) |
76 |
|
77 |
#endif |