54 #include "../arch/tn_arch.h" 87 #define TN_STACK_ARR_DEF(name, size) \ 88 TN_ARCH_STK_ATTR_BEFORE \ 89 TN_UWord name[ (size) ] \ 90 TN_ARCH_STK_ATTR_AFTER 93 #if TN_CHECK_BUILD_CFG 99 #if defined (__TN_ARCH_PIC24_DSPIC__) 101 # define _TN_BUILD_CFG_ARCH_STRUCT_FILL(_p_struct) \ 103 (_p_struct)->arch.p24.p24_sys_ipl = TN_P24_SYS_IPL; \ 107 # define _TN_BUILD_CFG_ARCH_STRUCT_FILL(_p_struct) 119 #define _TN_BUILD_CFG_STRUCT_FILL(_p_struct) \ 121 memset((_p_struct), 0x00, sizeof(*(_p_struct))); \ 123 (_p_struct)->priorities_cnt = TN_PRIORITIES_CNT; \ 124 (_p_struct)->check_param = TN_CHECK_PARAM; \ 125 (_p_struct)->debug = TN_DEBUG; \ 126 (_p_struct)->use_mutexes = TN_USE_MUTEXES; \ 127 (_p_struct)->mutex_rec = TN_MUTEX_REC; \ 128 (_p_struct)->mutex_deadlock_detect = TN_MUTEX_DEADLOCK_DETECT; \ 129 (_p_struct)->tick_lists_cnt_minus_one = (TN_TICK_LISTS_CNT - 1); \ 130 (_p_struct)->api_make_alig_arg = TN_API_MAKE_ALIG_ARG; \ 131 (_p_struct)->profiler = TN_PROFILER; \ 132 (_p_struct)->profiler_wait_time = TN_PROFILER_WAIT_TIME; \ 133 (_p_struct)->stack_overflow_check = TN_STACK_OVERFLOW_CHECK; \ 134 (_p_struct)->dynamic_tick = TN_DYNAMIC_TICK; \ 135 (_p_struct)->old_events_api = TN_OLD_EVENT_API; \ 137 _TN_BUILD_CFG_ARCH_STRUCT_FILL(_p_struct); \ 143 #define _TN_BUILD_CFG_STRUCT_FILL(_p_struct) 145 #endif // TN_CHECK_BUILD_CFG 153 # define _TN_MAX_INLINED_FUNC _TN_STATIC_INLINE 155 # define _TN_MAX_INLINED_FUNC 366 #define TN_NO_TIME_SLICE 0 371 #define TN_MAX_TIME_SLICE 0xFFFE 413 unsigned int idle_task_stack_size,
415 unsigned int int_stack_size,
617 #if TN_DYNAMIC_TICK || defined(DOXYGEN_ACTIVE) unsigned mutex_rec
Value of TN_MUTEX_REC
unsigned old_events_api
Value of TN_OLD_EVENT_API
TN_UWord tn_arch_sched_dis_save(void)
Disable kernel scheduler and return previous state.
Circular doubly linked list, for internal kernel usage.
unsigned mutex_deadlock_detect
Value of TN_MUTEX_DEADLOCK_DETECT
TN_Context
System context.
unsigned profiler_wait_time
Value of TN_PROFILER_WAIT_TIME
deadlock is active Note: this feature works if only TN_MUTEX_DEADLOCK_DETECT is non-zero.
TN_RCode
Result code returned by kernel services.
_TN_STATIC_INLINE TN_BOOL tn_is_isr_context(void)
Returns whether current system context is TN_CONTEXT_ISR
None: this code is possible if only system is not running (flag (TN_STATE_FLAG__SYS_RUNNING is not se...
void() TN_CBUserTaskCreate(void)
User-provided callback function that is called directly from tn_sys_start() as a part of system start...
unsigned use_mutexes
Value of TN_USE_MUTEXES
unsigned long TN_TickCnt
Type for system tick count, it is used by the kernel to represent absolute tick count value as well a...
TN_TaskBody * tn_cur_task_body_get(void)
Returns pointer to the body function of the currently running task.
_TN_STATIC_INLINE void tn_sched_restore(TN_UWord sched_state)
Restore state of the kernel scheduler.
union _TN_BuildCfg::@0 arch
Architecture-dependent values.
TN_UWord dummy
On some architectures, we don't have any arch-dependent build-time options, but we need this "dummy" ...
void tn_arch_sched_restore(TN_UWord sched_state)
Restore state of the kernel scheduler.
void tn_callback_deadlock_set(TN_CBDeadlock *cb)
Set callback function that should be called whenever deadlock occurs or becomes inactive (say...
void() TN_CBTickSchedule(TN_TickCnt timeout)
Available if only TN_DYNAMIC_TICK is set.
Timer is a kernel object that is used to ask the kernel to call some user-provided function at a part...
void tn_sys_start(TN_UWord *idle_task_stack, unsigned int idle_task_stack_size, TN_UWord *int_stack, unsigned int int_stack_size, TN_CBUserTaskCreate *cb_user_task_create, TN_CBIdle *cb_idle)
Initial TNeo system start function, never returns.
_TN_STATIC_INLINE TN_UWord tn_sched_dis_save(void)
Disable kernel scheduler and return previous scheduler state.
_TN_STATIC_INLINE TN_BOOL tn_is_task_context(void)
Returns whether current system context is TN_CONTEXT_TASK
unsigned api_make_alig_arg
Value of TN_API_MAKE_ALIG_ARG
Dispatch configuration: set predefined options, include user-provided cfg file as well as default cfg...
TN_TickCnt() TN_CBTickCntGet(void)
Available if only TN_DYNAMIC_TICK is set.
enum TN_StateFlag tn_sys_state_flags_get(void)
Returns current system state flags.
Structure with build-time configurations values; it is needed for run-time check which ensures that b...
void tn_callback_dyn_tick_set(TN_CBTickSchedule *cb_tick_schedule, TN_CBTickCntGet *cb_tick_cnt_get)
Available if only TN_DYNAMIC_TICK is set.
enum TN_Context tn_sys_context_get(void)
Returns system context: task or ISR.
int priority
current task priority
void() TN_CBDeadlock(TN_BOOL active, struct TN_Mutex *mutex, struct TN_Task *task)
User-provided callback function that is called whenever deadlock becomes active or inactive...
TN_TickCnt tn_sys_time_get(void)
Get current system ticks count.
void() TN_CBIdle(void)
User-provided callback function which is called repeatedly from the idle task loop.
#define _TN_STATIC_INLINE
For some compilers, order of these qualifiers matters (at least when _TN_INLINE expands to some compi...
void tn_callback_stack_overflow_set(TN_CBStackOverflow *cb)
Set callback function that is called when the kernel detects stack overflow (see TN_STACK_OVERFLOW_CH...
void() TN_CBStackOverflow(struct TN_Task *task)
User-provided callback function that is called when the kernel detects stack overflow (see TN_STACK_O...
struct TN_Task * tn_cur_task_get(void)
Returns pointer to the currently running task.
unsigned priorities_cnt
Value of TN_PRIORITIES_CNT
unsigned p24_sys_ipl
Value of TN_P24_SYS_IPL
enum TN_RCode tn_sys_tslice_set(int priority, int ticks)
Set time slice ticks value for specified priority (see Round-robin scheduling).
unsigned dynamic_tick
Value of TN_DYNAMIC_TICK
unsigned tick_lists_cnt_minus_one
Value of TN_TICK_LISTS_CNT minus one.
unsigned check_param
Value of TN_CHECK_PARAM
void tn_tick_int_processing(void)
Process system tick; should be called periodically, typically from some kind of timer ISR...
unsigned debug
Value of TN_DEBUG
unsigned int TN_UWord
Unsigned integer type whose size is equal to the size of CPU register.
void() TN_TaskBody(void *param)
Prototype for task body function.
TN_StateFlag
System state flags.
unsigned stack_overflow_check
Value of TN_STACK_OVERFLOW_CHECK
#define TN_BOOL
boolean type definition
struct _TN_BuildCfg::@0::@1 p24
PIC24/dsPIC-dependent values.
unsigned profiler
Value of TN_PROFILER