#include "tpl_os.h" #include "tpl_machine.h" #include "tpl_machine_interface.h" #include "tpl_dispatch_table.h" #include "iodefine.h" //FSY: usefull? VAR (tpl_context, OS_VAR) idle_task_context; VAR(tpl_stack_word, OS_VAR) idle_stack[IDLE_STACK_SIZE/sizeof(tpl_stack_word)]; #define SYSTICK_HZ ((u32) 80000000) /* 80MHz : is it the correct frequency? */ #define PRESCALER (0) #define TICKS_FOR_10MS SYSTICK_HZ / (1<stack->stack_size >> 2) - NB_REG_ON_SC_HANDLER_FRAME ; tpl_stack_word* sc_handler_frame = the_proc->stack->stack_zone + size_of_stack_above_sc_handler_frame; /* current stack pointer */ the_proc->context->stackPointer = (uint32)sc_handler_frame; /* setup entry point */ sc_handler_frame[reg_pc] = (uint32)(the_proc->entry); /* * set the return address of the task/isr. This is useful in case the * user forgets to call TerminateTask/TerminateISR * MISRA RULE 1,45,85 VIOLATION: the function pointer is used and stored * in a 32bits variable, but as the Os is dependant on the target, * the behaviour is controlled */ sc_handler_frame[reg_lr] = (IS_ROUTINE == the_proc->type) ? (uint32)(CallTerminateISR2) : (uint32)(CallTerminateTask); /* lr */ } extern u32 _tpl_syscall_table; FUNC(void, OS_CODE) tpl_init_machine(void) { /* Initialize Syscall registers */ __ldsr_rh(11, 1, SYSCALL_COUNT); /* SCCFG */ __ldsr_rh(12, 1, (u32) &_tpl_syscall_table); /* SCBP */ init_systick(); }