1 |
/* |
2 |
* main.h - Emulation core |
3 |
* |
4 |
* SheepShaver (C) 1997-2008 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 void *R13; // r13 register |
27 |
extern uint32 KernelDataAddr; // Address of Kernel Data |
28 |
extern uint32 BootGlobsAddr; // Address of BootGlobs structure at top of Mac RAM |
29 |
extern uint32 PVR; // Theoretical PVR |
30 |
extern int64 CPUClockSpeed; // Processor clock speed (Hz) |
31 |
extern int64 BusClockSpeed; // Bus clock speed (Hz) |
32 |
extern int64 TimebaseSpeed; // Timebase clock speed (Hz) |
33 |
|
34 |
#ifdef __BEOS__ |
35 |
extern system_info SysInfo; // System information |
36 |
#endif |
37 |
|
38 |
// 68k register structure (for Execute68k()) |
39 |
struct M68kRegisters { |
40 |
uint32 d[8]; |
41 |
uint32 a[8]; |
42 |
}; |
43 |
|
44 |
|
45 |
// Functions |
46 |
extern bool InitAll(const char *vmdir); |
47 |
extern void ExitAll(void); |
48 |
extern void Dump68kRegs(M68kRegisters *r); // Dump 68k registers |
49 |
extern void MakeExecutable(int dummy, uint32 start, uint32 length); // Make code executable |
50 |
extern void PatchAfterStartup(void); // Patches after system startup |
51 |
extern void QuitEmulator(void); // Quit emulator (must only be called from main thread) |
52 |
extern void ErrorAlert(const char *text); // Display error alert |
53 |
extern void WarningAlert(const char *text); // Display warning alert |
54 |
extern bool ChoiceAlert(const char *text, const char *pos, const char *neg); // Display choice alert |
55 |
|
56 |
// Mutexes (non-recursive) |
57 |
struct B2_mutex; |
58 |
extern B2_mutex *B2_create_mutex(void); |
59 |
extern void B2_lock_mutex(B2_mutex *mutex); |
60 |
extern void B2_unlock_mutex(B2_mutex *mutex); |
61 |
extern void B2_delete_mutex(B2_mutex *mutex); |
62 |
|
63 |
// Interrupt flags |
64 |
enum { |
65 |
INTFLAG_VIA = 1, // 60.15Hz VBL |
66 |
INTFLAG_SERIAL = 2, // Serial driver |
67 |
INTFLAG_ETHER = 4, // Ethernet driver |
68 |
INTFLAG_AUDIO = 16, // Audio block read |
69 |
INTFLAG_TIMER = 32, // Time Manager |
70 |
INTFLAG_ADB = 64 // ADB |
71 |
}; |
72 |
|
73 |
extern volatile uint32 InterruptFlags; // Currently pending interrupts |
74 |
extern void SetInterruptFlag(uint32); |
75 |
extern void ClearInterruptFlag(uint32); |
76 |
extern void TriggerInterrupt(void); // Trigger SIGUSR1 interrupt in emulator thread |
77 |
extern void DisableInterrupt(void); // Disable SIGUSR1 interrupt (can be nested) |
78 |
extern void EnableInterrupt(void); // Enable SIGUSR1 interrupt (can be nested) |
79 |
|
80 |
#endif |