xref: /haiku/headers/private/kernel/arch/m68k/arch_platform.h (revision f2b4344867e97c3f4e742a1b4a15e6879644601a)
1 /*
2  * Copyright 2006, Ingo Weinhold <bonefish@cs.tu-berlin.de>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef _KERNEL_M68K_ARCH_PLATFORM_H
6 #define _KERNEL_M68K_ARCH_PLATFORM_H
7 
8 #include <OS.h>
9 #include <arch/platform.h>
10 
11 struct real_time_data;
12 
13 typedef enum m68k_platform_types {
14 	M68K_PLATFORM_AMIGA = 0,
15 	M68K_PLATFORM_ATARI,		/* TT, Falcon, Hades, Milan... */
16 	M68K_PLATFORM_MAC,
17 	M68K_PLATFORM_NEXT
18 } m68k_platform_type;
19 
20 namespace BPrivate {
21 
22 // implemented in src/system/kernel/arch/m68k/arch_platform.cpp
23 
24 class M68KPlatform {
25 public:
26 	M68KPlatform(platform_type platformType, m68k_platform_type m68kPlatformType);
27 	virtual ~M68KPlatform();
28 
29 	static M68KPlatform *Default();
30 
31 	inline platform_type PlatformType() const	{ return fPlatformType; }
32 	inline m68k_platform_type M68KPlatformType() const	{ return fM68KPlatformType; }
33 
34 	virtual status_t Init(struct kernel_args *kernelArgs) = 0;
35 	virtual status_t InitSerialDebug(struct kernel_args *kernelArgs) = 0;
36 	virtual status_t InitPostVM(struct kernel_args *kernelArgs) = 0;
37 	virtual status_t InitPIC(struct kernel_args *kernelArgs) = 0;
38 	virtual status_t InitRTC(struct kernel_args *kernelArgs,
39 		struct real_time_data *data) = 0;
40 	virtual status_t InitTimer(struct kernel_args *kernelArgs) = 0;
41 
42 	virtual char BlueScreenGetChar() = 0;
43 
44 	virtual char SerialDebugGetChar() = 0;
45 	virtual void SerialDebugPutChar(char c) = 0;
46 
47 	virtual void EnableIOInterrupt(int irq) = 0;
48 	virtual void DisableIOInterrupt(int irq) = 0;
49 	virtual bool AcknowledgeIOInterrupt(int irq) = 0;
50 
51 	// mimic the PC CMOS
52 	virtual uint8 ReadRTCReg(uint8 reg) = 0;
53 	virtual void WriteRTCReg(uint8 reg, uint8 val) = 0;
54 	virtual	void SetHardwareRTC(uint32 seconds) = 0;
55 	virtual	uint32 GetHardwareRTC() = 0;
56 
57 	virtual void SetHardwareTimer(bigtime_t timeout) = 0;
58 	virtual void ClearHardwareTimer(void) = 0;
59 
60 	virtual	void ShutDown(bool reboot) = 0;
61 
62 private:
63 	m68k_platform_type	fM68KPlatformType;
64 	platform_type	fPlatformType;
65 };
66 
67 
68 }	// namespace BPrivate
69 
70 using BPrivate::M68KPlatform;
71 
72 //extern "C" M68KPlatform *instanciate_m68k_platform_amiga();
73 extern "C" M68KPlatform *instanciate_m68k_platform_atari();
74 //extern "C" M68KPlatform *instanciate_m68k_platform_mac();
75 //extern "C" M68KPlatform *instanciate_m68k_platform_next();
76 
77 
78 #endif	// _KERNEL_M68K_ARCH_PLATFORM_H
79