-
Notifications
You must be signed in to change notification settings - Fork 262
/
counter_call.goilTemplate
47 lines (43 loc) · 1.08 KB
/
counter_call.goilTemplate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "tpl_os_kernel.h" /* tpl_schedule */
#include "tpl_os_timeobj_kernel.h" /* tpl_counter_tick */
#include "tpl_machine_interface.h" /* tpl_switch_context_from_it */
#define OS_START_SEC_CODE
#include "tpl_memmap.h"
//gcc uses ISR as a keyword to define an interrupt handler.
//Osek uses ISR to define an ISR2 :-/
#ifdef ISR
#undef ISR
#endif
#include <avr/interrupt.h>
%foreach counter in HARDWARECOUNTERS do
# special case for SystemCounter, as it is connected
# to Arduino SysTick (TIMER0_OVF_vect) in
# (arduinoLib)/hardware/cores/arduino/wiring.c
if counter::NAME == "SystemCounter" then
%
void trampolineSystemCounter()
{
tpl_counter_tick(&% !counter::NAME %_counter_desc);
if (tpl_kern.need_schedule)
{
tpl_schedule_from_running();
LOCAL_SWITCH_CONTEXT()
}
}
%
elsif counter::SOURCE != "" then
%
ISR(%!counter::SOURCE%)
{
tpl_counter_tick(&% !counter::NAME %_counter_desc);
if (tpl_kern.need_schedule)
{
tpl_schedule_from_running();
LOCAL_SWITCH_CONTEXT()
}
}
% end if
end foreach
%
#define OS_STOP_SEC_CODE
#include "tpl_memmap.h"