Debian Codegraph @

examples/temp_sensor/src/TimerInterruptConfigurator.c

raw symbols SCIP
1 #include "Types.h"
2 #include "TimerInterruptConfigurator.h"
3 #include "TimerInterruptHandler.h"
4
5 static inline void SetInterruptHandler(void);
6 static inline void ConfigureInterruptSourceModeRegister(void);
7 static inline void ClearInterrupt(void);
8 static inline void EnableCompareInterruptForRegisterC(void);
9
10 void Timer_DisableInterrupt(void)
11 {
12 AT91C_BASE_AIC->AIC_IDCR = TIMER0_ID_MASK;
13 }
14
15 void Timer_ResetSystemTime(void)
16 {
17 Timer_SetSystemTime(0);
18 }
19
20 void Timer_ConfigureInterrupt(void)
21 {
22 SetInterruptHandler();
23 ConfigureInterruptSourceModeRegister();
24 ClearInterrupt();
25 EnableCompareInterruptForRegisterC();
26 }
27
28 void Timer_EnableInterrupt(void)
29 {
30 AT91C_BASE_AIC->AIC_IECR = TIMER0_ID_MASK;
31 }
32
33 //
34 // Helpers
35 //
36
37 static inline void SetInterruptHandler(void)
38 {
39 AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)Timer_InterruptHandler;
40 }
41
42 static inline void ConfigureInterruptSourceModeRegister(void)
43 {
44 AT91C_BASE_AIC->AIC_SMR[AT91C_ID_TC0] = 1;
45 }
46
47 static inline void ClearInterrupt(void)
48 {
49 AT91C_BASE_AIC->AIC_ICCR = TIMER0_ID_MASK;
50 }
51
52 static inline void EnableCompareInterruptForRegisterC(void)
53 {
54 AT91C_BASE_TC0->TC_IER = AT91C_TC_CPCS;
55 }