2 * Acess2 Kernel ARMv7 Port
3 * - By John Hodge (thePowersGang)
9 #include "platform_tegra2.h"
12 #define TIMER0_INT (0*32+0) // Pri #0
13 #define TIMER1_INT (0*32+1) // Pri #1
14 #define TIMER2_INT (1*32+9) // Sec #9
15 #define TIMER3_INT (1*32+10) // Sec #10
18 extern volatile Sint64 giTimestamp;
19 extern volatile Uint64 giTicks;
20 extern volatile Uint64 giPartMiliseconds;
21 extern void Timer_CallTimers(void);
23 // === PROTORTYPES ===
24 void Timer_IRQHandler_SysClock(int IRQ, void *_unused);
25 void Time_Setup(void);
28 // - Addresses for the GIC to use
29 tPAddr gGIC_InterfaceAddr = 0x50040000;
30 tPAddr gGIC_DistributorAddr = 0x50041000;
31 // - Map of timer registers
32 struct sTimersMap *gpTimersMap;
33 // - Interrupt controller code commented out, because the Tegra2 also has a GIC
35 struct sIRQMap gpIRQMap;
41 void Timer_IRQHandler_SysClock(int IRQ, void *_unused)
44 gpTimersMap->TMR0.PCR_0 = (1<<31);
49 gpTimersMap = (void*)MM_MapHWPages(0x60005000, 1);
50 // Timer 1 (used for system timekeeping)
51 IRQ_AddHandler(0*32+0, Timer_IRQHandler_SysClock, NULL);
52 gpTimersMap->TMR0.PTV_0 = (1<31)|(1<30)|(100*1000); // enable, periodic, 100 ms
56 // -- Interrupt Controller --
57 void IRQ_CtrlrHandler(struct sIRQRegs *Ctrlr, int Ofs)
63 void IRQ_RootHandler(void)
65 IRQ_CtrlrHandler(&gpIRQMap->Pri, 0*32);
66 IRQ_CtrlrHandler(&gpIRQMap->Sec, 1*32);
67 IRQ_CtrlrHandler(&gpIRQMap->Tri, 2*32);
68 IRQ_CtrlrHandler(&gpIRQMap->Quad, 3*32);
73 gpIRQMap = (void*)MM_MapHWPages(0x60004000, 1);
75 gpIRQHandler = IRQ_RootHandler;