51 #include "../core/tn_common.h"
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61 #define _TN_ARCH_STACK_DIR__ASC 1
62 #define _TN_ARCH_STACK_DIR__DESC 2
68 #define _TN_ARCH_STACK_PT_TYPE__FULL 3
69 #define _TN_ARCH_STACK_PT_TYPE__EMPTY 4
76 #define _TN_ARCH_STACK_IMPL__FULL_ASC 5
77 #define _TN_ARCH_STACK_IMPL__FULL_DESC 6
78 #define _TN_ARCH_STACK_IMPL__EMPTY_ASC 7
79 #define _TN_ARCH_STACK_IMPL__EMPTY_DESC 8
94 #if defined(__TN_ARCH_PIC32MX__)
96 #elif defined(__TN_ARCH_PIC24_DSPIC__)
98 #elif defined(__TN_ARCH_CORTEX_M__)
101 # error "unknown platform"
110 #ifndef DOXYGEN_SHOULD_SKIP_THIS
112 #if !defined(_TN_ARCH_STACK_DIR)
113 # error _TN_ARCH_STACK_DIR is not defined
116 #if !defined(_TN_ARCH_STACK_PT_TYPE)
117 # error _TN_ARCH_STACK_PT_TYPE is not defined
120 #if (_TN_ARCH_STACK_DIR == _TN_ARCH_STACK_DIR__ASC)
121 # if (_TN_ARCH_STACK_PT_TYPE == _TN_ARCH_STACK_PT_TYPE__FULL)
122 # define _TN_ARCH_STACK_IMPL _TN_ARCH_STACK_IMPL__FULL_ASC
123 # elif (_TN_ARCH_STACK_PT_TYPE == _TN_ARCH_STACK_PT_TYPE__EMPTY)
124 # define _TN_ARCH_STACK_IMPL _TN_ARCH_STACK_IMPL__EMPTY_ASC
126 # error wrong _TN_ARCH_STACK_PT_TYPE
128 #elif (_TN_ARCH_STACK_DIR == _TN_ARCH_STACK_DIR__DESC)
129 # if (_TN_ARCH_STACK_PT_TYPE == _TN_ARCH_STACK_PT_TYPE__FULL)
130 # define _TN_ARCH_STACK_IMPL _TN_ARCH_STACK_IMPL__FULL_DESC
131 # elif (_TN_ARCH_STACK_PT_TYPE == _TN_ARCH_STACK_PT_TYPE__EMPTY)
132 # define _TN_ARCH_STACK_IMPL _TN_ARCH_STACK_IMPL__EMPTY_DESC
134 # error wrong _TN_ARCH_STACK_PT_TYPE
137 # error wrong _TN_ARCH_STACK_DIR
Cortex-M0/M0+/M3/M4/M4F architecture-dependent routines.
void _tn_arch_sys_start(TN_UWord *int_stack, TN_UWord int_stack_size)
Performs first context switch to the first task (_tn_next_task_to_run is already set to needed task)...
PIC32 architecture-dependent routines.
TN_UWord tn_arch_sched_dis_save(void)
Disable kernel scheduler and return previous state.
int _tn_arch_is_int_disabled(void)
Should return 1 if system interrupts are currently disabled, 0 otherwise.
TN_UWord * _tn_arch_stack_init(TN_TaskBody *task_func, TN_UWord *stack_low_addr, TN_UWord *stack_high_addr, void *param)
Should put initial CPU context to the provided stack pointer for new task and return current stack po...
void _tn_arch_context_switch_pend(void)
Called whenever we need to switch context from one task to another.
void tn_arch_sched_restore(TN_UWord sched_state)
Restore state of the kernel scheduler.
void tn_arch_int_en(void)
Unconditionally enable interrupts.
void tn_arch_int_dis(void)
Unconditionally disable system interrupts.
PIC24/dsPIC architecture-dependent routines.
int _tn_arch_inside_isr(void)
Should return 1 if system ISR is currently running, 0 otherwise.
void( TN_TaskBody)(void *param)
Prototype for task body function.
TN_UWord tn_arch_sr_save_int_dis(void)
Disable system interrupts and return previous value of status register, atomically.
void _tn_arch_context_switch_now_nosave(void)
Called whenever we need to switch context to new task, but don't save current context.
void tn_arch_sr_restore(TN_UWord sr)
Restore previously saved status register.
unsigned int TN_UWord
Unsigned integer type whose size is equal to the size of CPU register.