xref: /haiku/src/system/kernel/arch/arm/soc_omap3.h (revision 7eab6b486ebadb54ca3c306601f4b04dd92359fa)
1 #ifndef ARCH_ARM_SOC_OMAP3_H
2 #define ARCH_ARM_SOC_OMAP3_H
3 
4 class OMAP3InterruptController;
5 
6 #include "soc.h"
7 
8 #include <new>
9 
10 
11 class OMAP3InterruptController : public InterruptController {
12 public:
13 	OMAP3InterruptController(uint32_t reg_base);
14 	void EnableInterrupt(int32 irq);
15 	void DisableInterrupt(int32 irq);
16 	void HandleInterrupt();
17 
18 protected:
19 	void SoftReset();
20 
21 	area_id fRegArea;
22 	uint32 *fRegBase;
23 	uint32 fNumPending;
24 };
25 
26 class OMAP3Timer : public HardwareTimer {
27 public:
28 	void SetTimeout(bigtime_t timeout);
29 	bigtime_t Time();
30 	void Clear();
31 
32 	static status_t Init(uint32_t reg_base, uint32_t interrupt) {
33 		if (sInstance == NULL) {
34 			OMAP3Timer *timer = new(std::nothrow) OMAP3Timer(reg_base, interrupt);
35 			// XXX implement InitCheck() functionality
36 			return timer != NULL ? B_OK : B_NO_MEMORY;
37 		} else {
38 			// XXX We have multiple timers; just create the first one
39 			// and ignore the rest
40 			return B_OK;
41 		}
42 	}
43 
44 private:
45 	OMAP3Timer(uint32_t reg_base, uint32_t interrupt);
46 
47 	static int32 _InterruptWrapper(void *data);
48 	int32 HandleInterrupt();
49 
50 	bigtime_t fSystemTime;
51 	area_id fRegArea;
52 	uint32 *fRegBase;
53 	int fInterrupt;
54 };
55 
56 #endif /* ARCH_ARM_SOC_OMAP3_H */
57