xref: /haiku/src/system/kernel/arch/arm/soc.h (revision 4c8e85b316c35a9161f5a1c50ad70bc91c83a76f)
1 #ifndef ARCH_ARM_SOC_H
2 #define ARCH_ARM_SOC_H
3 
4 class InterruptController;
5 
6 #include <drivers/bus/FDT.h>
7 #include <private/kernel/int.h>
8 #include <private/kernel/timer.h>
9 
10 // ------------------------------------------------------ InterruptController
11 
12 class InterruptController {
13 public:
14 	virtual void EnableInterrupt(int irq) = 0;
15 	virtual void DisableInterrupt(int irq) = 0;
16 
17 	virtual void HandleInterrupt() = 0;
18 
19 	static InterruptController* Get() {
20 		return sInstance;
21 	}
22 
23 protected:
24 	InterruptController()
25 	{
26 		if (sInstance) {
27 			panic("Multiple InterruptController objects created; that is currently unsupported!");
28 		}
29 		sInstance = this;
30 	}
31 
32 	static InterruptController *sInstance;
33 };
34 
35 
36 // ------------------------------------------------------ HardwareTimer
37 
38 class HardwareTimer {
39 public:
40 	virtual void SetTimeout(bigtime_t timeout) = 0;
41 	virtual bigtime_t Time() = 0;
42 	virtual void Clear() = 0;
43 
44 	static HardwareTimer* Get() {
45 		return sInstance;
46 	}
47 
48 protected:
49 #if 0
50 	HardwareTimer(fdt_module_info *fdtModule, fdt_device_node node)
51 		: fFDT(fdtModule), fNode(node) {
52 		if (sInstance) {
53 			panic("Multiple HardwareTimer objects created; that is currently unsupported!");
54 		}
55 		sInstance = this;
56 	}
57 
58 	// Keep our node around as we might want to grab attributes from it
59 	fdt_module_info *fFDT;
60 	fdt_device_node fNode;
61 #endif
62 
63 	static HardwareTimer *sInstance;
64 };
65 
66 #endif // ARCH_ARM_SOC_H
67