245 #if TN_PROFILER || DOXYGEN_ACTIVE
272 #if TN_PROFILER_WAIT_TIME || DOXYGEN_ACTIVE
306 #if TN_PROFILER_WAIT_TIME || DOXYGEN_ACTIVE
361 #if TN_MUTEX_DEADLOCK_DETECT
433 #if TN_PROFILER || DOXYGEN_ACTIVE
870 #if TN_PROFILER || DOXYGEN_ACTIVE
906 #endif // _TN_TASKS_H
enum TN_RCode tn_task_activate(struct TN_Task *task)
Activate task that is in DORMANT state, that is, it was either just created by tn_task_create() witho...
TN_WaitReason
Task wait reason.
Task wants to lock a mutex with priority inheritance.
const char * name
Task name for debug purposes, user may want to set it by hand.
enum TN_RCode tn_task_release_wait(struct TN_Task *task)
Release task from WAIT state, independently of the reason of waiting.
enum TN_RCode tn_task_iwakeup(struct TN_Task *task)
The same as tn_task_wakeup() but for using in the ISR.
enum TN_RCode tn_task_terminate(struct TN_Task *task)
This function is similar to tn_task_exit() but it terminates any task other than currently running on...
Internal kernel structure for profiling data of task.
Circular doubly linked list, for internal kernel usage.
Task is suspended (by some other task)
enum TN_RCode tn_task_create(struct TN_Task *task, TN_TaskBody *task_func, int priority, TN_UWord *task_stack_low_addr, int task_stack_size, void *param, enum TN_TaskCreateOpt opts)
Construct task and probably start it (depends on options, see below).
enum TN_WaitReason last_wait_reason
Available if only TN_PROFILER_WAIT_TIME option is non-zero.
enum TN_RCode tn_task_profiler_timing_get(const struct TN_Task *task, struct TN_TaskTiming *tgt)
Read profiler timing data of the task.
unsigned long max_consecutive_run_time
Maximum consecutive time task was running.
TN_RCode
Result code returned by kernel services.
DQueue-specific fields related to waiting task, to be included in struct TN_Task. ...
TN_ObjId
Magic number for object validity verification.
EventGrp-specific fields related to waiting task, to be included in struct TN_Task.
unsigned long TN_TickCnt
Type for system tick count, it is used by the kernel to represent absolute tick count value as well a...
enum TN_WaitReason task_wait_reason
reason for waiting (relevant if only task_state is WAIT or WAIT+SUSPEND)
unsigned long long total_wait_time[TN_WAIT_REASONS_CNT]
Available if only TN_PROFILER_WAIT_TIME option is non-zero.
Task was previously waiting, and after this it was suspended.
Task wants to receive some data to the data queue, and there's no data in the queue.
Definitions used through the whole kernel.
TN_UWord * stack_cur_pt
pointer to task's current top of the stack; Note that this field must be a first field in the struct...
enum TN_TaskState task_state
task state
unsigned long max_consecutive_wait_time[TN_WAIT_REASONS_CNT]
Available if only TN_PROFILER_WAIT_TIME option is non-zero.
enum TN_RCode tn_task_delete(struct TN_Task *task)
This function deletes the task specified by the task.
for internal kernel usage only: this option must be provided when creating idle task ...
TN_TaskCreateOpt
Options for tn_task_create()
struct TN_EGrpTaskWait eventgrp
fields specific to tn_eventgrp.h
TN_TickCnt last_tick_cnt
Tick count of when the task got running or non-running last time.
TN_TaskBody * task_func_addr
pointer to task's body function given to tn_task_create()
int tslice_count
time slice counter
enum TN_RCode tn_task_change_priority(struct TN_Task *task, int new_priority)
Set new priority for task.
struct TN_ListItem deadlock_list
list of other tasks involved in deadlock.
Timer is a kernel object that is used to ask the kernel to call some user-provided function at a part...
enum TN_RCode tn_task_wakeup(struct TN_Task *task)
Wake up task from sleep.
enum TN_RCode tn_task_sleep(TN_TickCnt timeout)
Put current task to sleep for at most timeout ticks.
union TN_Task::@2 subsys_wait
subsystem-specific fields that are used while task waits for something.
This state should never be publicly available.
Fixed memory blocks pool.
enum TN_RCode tn_task_suspend(struct TN_Task *task)
If the task is RUNNABLE, it is moved to the SUSPEND state.
Timing structure that is managed by profiler and can be read by tn_task_profiler_timing_get() functio...
void tn_task_exit(enum TN_TaskExitOpt opts)
This function terminates the currently running task.
whether task should be deleted right after it is exited.
enum TN_RCode tn_task_irelease_wait(struct TN_Task *task)
The same as tn_task_release_wait() but for using in the ISR.
enum TN_RCode tn_task_resume(struct TN_Task *task)
Release task from SUSPEND state.
int base_priority
base priority of the task (actual current priority may be higher than base priority because of mutex)...
Task isn't yet activated or it was terminated by tn_task_terminate().
Task has called tn_task_sleep()
int is_running
For internal profiler self-check only: indicates whether task is running or not.
TN_UWord * stack_high_addr
– Highest address of stack.
enum TN_ObjId id_task
id for object validity verification.
Task is ready to run (it doesn't mean that it is running at the moment)
Task wants to get memory block from memory pool, and there's no free memory blocks.
struct TN_DQueueTaskWait dqueue
fields specific to tn_dqueue.h
unsigned waited
Flag indicates that task waited for something This flag is set automatially in _tn_task_set_waiting()...
int priority
current task priority
struct _TN_TaskProfiler profiler
Profiler data, available if only TN_PROFILER is non-zero.
enum TN_RCode tn_task_iactivate(struct TN_Task *task)
The same as tn_task_activate() but for using in the ISR.
struct TN_ListItem * pwait_queue
pointer to object's (semaphore, mutex, event, etc) wait list in which task is included for waiting ...
struct TN_ListItem task_queue
queue is used to include task in ready/wait lists
Task wants to lock a mutex with priority ceiling.
struct TN_FMemTaskWait fmem
fields specific to tn_fmem.h
struct TN_Timer timer
timer object to implement task waiting for timeout
struct TN_TaskTiming timing
Main timing structure managed by profiler.
Kernel system routines: system start, tick processing, time slice managing.
unsigned long long got_running_cnt
How many times task got running.
Task wants to put some data to the data queue, and there's no space in the queue. ...
enum TN_RCode tn_task_state_get(struct TN_Task *task, enum TN_TaskState *p_state)
Get current state of the task; note that returned state is a bitmask, that is, states could be combin...
void( TN_TaskBody)(void *param)
Prototype for task body function.
Task waits to acquire a semaphore.
Task isn't waiting for anything.
unsigned priority_already_updated
Internal flag used to optimize mutex priority algorithms.
whether task should be activated right after it is created.
void * task_func_param
pointer to task's parameter given to tn_task_create()
FMem-specific fields related to waiting task, to be included in struct TN_Task.
unsigned long long total_run_time
Total time when task was running.
Circular doubly linked list item, for internal kernel usage.
unsigned int TN_UWord
Unsigned integer type whose size is equal to the size of CPU register.
TN_UWord * stack_low_addr
– lowest address of stack.
enum TN_RCode tn_task_create_wname(struct TN_Task *task, TN_TaskBody *task_func, int priority, TN_UWord *task_stack_low_addr, int task_stack_size, void *param, enum TN_TaskCreateOpt opts, const char *name)
The same as tn_task_create() but with additional argument name, which could be very useful for debug...
Task waits for some event in the event group to be set.
A data queue is a FIFO that stores pointer (of type void *) in each cell, called (in uITRON style) a ...
struct TN_ListItem create_queue
queue is used to include task in creation list (currently, this list is used for statistics only) ...
TN_TaskExitOpt
Options for tn_task_exit()
enum TN_RCode task_wait_rc
waiting result code (reason why waiting finished)
struct TN_ListItem mutex_queue
list of all mutexes that are locked by task