xref: /haiku/src/system/kernel/arch/arm/soc.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
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 #if 0
25 	InterruptController(fdt_module_info *fdtModule, fdt_device_node node)
26 		: fFDT(fdtModule), fNode(node) {
27 		if (sInstance) {
28 			panic("Multiple InterruptController objects created; that is currently unsupported!");
29 		}
30 		sInstance = this;
31 	}
32 
33 	// Keep our node around as we might want to grab attributes from it
34 	fdt_module_info *fFDT;
35 	fdt_device_node fNode;
36 #endif
37 
38 	static InterruptController *sInstance;
39 };
40 
41 
42 // ------------------------------------------------------ HardwareTimer
43 
44 class HardwareTimer {
45 public:
46 	virtual void SetTimeout(bigtime_t timeout) = 0;
47 	virtual bigtime_t Time() = 0;
48 	virtual void Clear() = 0;
49 
50 	static HardwareTimer* Get() {
51 		return sInstance;
52 	}
53 
54 protected:
55 #if 0
56 	HardwareTimer(fdt_module_info *fdtModule, fdt_device_node node)
57 		: fFDT(fdtModule), fNode(node) {
58 		if (sInstance) {
59 			panic("Multiple HardwareTimer objects created; that is currently unsupported!");
60 		}
61 		sInstance = this;
62 	}
63 
64 	// Keep our node around as we might want to grab attributes from it
65 	fdt_module_info *fFDT;
66 	fdt_device_node fNode;
67 #endif
68 
69 	static HardwareTimer *sInstance;
70 };
71 
72 #endif // ARCH_ARM_SOC_H
73