#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 */ #include "AT91SAM7.h" /* AT91C_AIC_ISCR */ #define OS_START_SEC_VAR_8BIT #include "tpl_memmap.h" VAR(uint8, OS_VAR) check_buttons_period = 0; #define OS_STOP_SEC_VAR_8BIT #include "tpl_memmap.h" #define OS_START_SEC_CODE #include "tpl_memmap.h" % foreach interrupt in INTERRUPT do let counterFct := emptylist foreach counter in COUNTERS do if counter::SOURCE == interrupt::NAME then let counterFct += counter::NAME end if end foreach foreach fct in counterFct before % FUNC(void, OS_CODE) tpl_tick_% ! interrupt::NAME %() { % do % tpl_counter_tick(&% !fct %_counter_desc); % after % check_buttons_period++; if (check_buttons_period == 10) { /* Call check_buttons_status() (via interrupts) * which will check if buttons are pressed or not. */ *AT91C_AIC_ISCR = (1 << AT91C_PERIPHERAL_ID_IRQ0); check_buttons_period = 0; } if (tpl_kern.need_schedule) { tpl_schedule_from_running(); LOCAL_SWITCH_CONTEXT() } } % end foreach end foreach % #define OS_STOP_SEC_CODE #include "tpl_memmap.h"