|
StateOS
|
tasks (creation, control, delays) More...
Macros | |
| #define | STK_SIZE(size) |
| size of the task stack in stk_t units: the size in bytes (rounded up) with the guard area | |
| #define | OS_TSK_STACK(stk, ...) |
| define task stack | |
| #define | static_TSK_STACK(stk, ...) |
| static alias of OS_TSK_STACK() | |
| #define | OS_WRK(tsk, prio, proc, size) |
| define and initialize complete work area for task object | |
| #define | static_WRK(tsk, prio, proc, size) |
| static alias of OS_WRK() | |
| #define | OS_TSK(tsk, prio, proc, ...) |
| define and initialize complete work area for task object with default stack size | |
| #define | static_TSK(tsk, prio, proc, ...) |
| static alias of OS_TSK() | |
| #define | OS_WRK_DEF(tsk, prio, size) |
| define and initialize complete work area for task object | |
| #define | static_WRK_DEF(tsk, prio, size) |
| static alias of OS_WRK_DEF() | |
| #define | OS_TSK_DEF(tsk, prio, ...) |
| define and initialize complete work area for task object with default stack size | |
| #define | static_TSK_DEF(tsk, prio, ...) |
| static alias of OS_TSK_DEF() | |
| #define | OS_WRK_START(tsk, prio, size) |
| define, initialize and start complete work area for task object | |
| #define | static_WRK_START(tsk, prio, size) |
| static alias of OS_WRK_START() | |
| #define | OS_TSK_START(tsk, prio, ...) |
| define, initialize and start complete work area for task object with default stack size | |
| #define | static_TSK_START(tsk, prio, ...) |
| static alias of OS_TSK_START() | |
| #define | WRK_INIT(prio, proc, size) |
| create and initialize complete work area for task object | |
| #define | WRK_CREATE(prio, proc, size) |
| create and initialize complete work area for task object | |
| #define | WRK_NEW WRK_CREATE |
| alias of WRK_CREATE() | |
| #define | TSK_INIT(prio, proc, ...) |
| create and initialize complete work area for task object with default stack size | |
| #define | TSK_CREATE(prio, proc, ...) |
| create and initialize complete work area for task object with default stack size | |
| #define | TSK_NEW TSK_CREATE |
| alias of TSK_CREATE() | |
| #define | SELF ( System.cur ) |
| alias of tsk_this() | |
Functions | |
| tsk_t * | tsk_this (void) |
| return current task object | |
| tsk_t * | cur_task (void) |
| alias of tsk_this() | |
| void | wrk_init (tsk_t *tsk, unsigned prio, fun_t *proc, stk_t *stack, size_t size) |
| initialize complete work area for task object | |
| void | tsk_init (tsk_t *tsk, unsigned prio, fun_t *proc, stk_t *stack, size_t size) |
| initialize complete work area for task object and start the task, if proc != NULL | |
| tsk_t * | wrk_create (unsigned prio, fun_t *proc, size_t size, bool detached, bool autostart) |
| create and initialize complete work area for task object | |
| tsk_t * | wrk_new (unsigned prio, fun_t *proc, size_t size, bool detached, bool autostart) |
| alias of wrk_create() | |
| tsk_t * | tsk_setup (unsigned prio, fun_a *proc, void *arg, size_t size) |
| create and initialize complete work area for task object and start the task, if proc != NULL | |
| tsk_t * | tsk_create (unsigned prio, fun_t *proc) |
| create and initialize a new task object with default stack size and start the task, if proc != NULL | |
| tsk_t * | tsk_new (unsigned prio, fun_t *proc) |
| alias of tsk_create() | |
| tsk_t * | tsk_detached (unsigned prio, fun_t *proc) |
| create and initialize a new detached task object with default stack size and start the task, if proc != NULL | |
| void | tsk_start (tsk_t *tsk) |
| start previously defined/created/stopped task object | |
| void | tsk_startFrom (tsk_t *tsk, fun_t *proc) |
| start previously defined/created/stopped task object | |
| void | tsk_startWith (tsk_t *tsk, fun_a *proc, void *arg) |
| start previously defined/created/stopped task object | |
| int | tsk_detach (tsk_t *tsk) |
| detach given task | |
| int | tsk_join (tsk_t *tsk) |
| delay execution of current task until termination of given task | |
| void | tsk_stop (void) |
| stop the current task and remove it from READY queue | |
| void | tsk_exit (void) |
| alias of tsk_stop() | |
| int | tsk_reset (tsk_t *tsk) |
| reset the task object and remove it from READY/BLOCKED queue | |
| int | tsk_kill (tsk_t *tsk) |
| alias of tsk_reset() | |
| int | tsk_destroy (tsk_t *tsk) |
| reset the task object and free allocated resources | |
| int | tsk_delete (tsk_t *tsk) |
| alias of tsk_destroy() | |
| void | tsk_yield (void) |
| yield system control to the next task with the same priority in READY queue | |
| void | tsk_pass (void) |
| alias of tsk_yield() | |
| void | tsk_flip (fun_t *proc) |
| restart current task with the new proc (task function) | |
| void | tsk_setPrio (unsigned prio) |
| set current task priority | |
| void | tsk_prio (unsigned prio) |
| alias of tsk_setPrio() | |
| unsigned | tsk_getPrio (void) |
| get current task priority | |
| void | tsk_sleepFor (cnt_t delay) |
| delay execution of current task for given duration of time | |
| void | tsk_delay (cnt_t delay) |
| alias of tsk_sleepFor() | |
| void | tsk_sleepNext (cnt_t delay) |
| delay execution of current task for given duration of time | |
| void | tsk_sleepUntil (cnt_t time) |
| delay execution of current task until given timepoint | |
| void | tsk_sleep (void) |
| delay indefinitely execution of current task | |
| int | tsk_suspend (tsk_t *tsk) |
| delay indefinitely execution of given task | |
| int | tsk_resume (tsk_t *tsk) |
| resume execution of given suspended task | |
| int | tsk_resumeISR (tsk_t *tsk) |
| ISR alias of tsk_resume(). | |
| void | tsk_give (tsk_t *tsk, unsigned signo) |
| send given signal to the task | |
| void | tsk_signal (tsk_t *tsk, unsigned signo) |
| alias of tsk_give() | |
| void | tsk_action (tsk_t *tsk, act_t *action) |
| set given function as a signal handler | |
| size_t | tsk_stackSpace (void) |
| chack water mark of the stack of the current task | |
tasks (creation, control, delays)
| #define STK_SIZE | ( | size | ) |
size of the task stack in stk_t units: the size in bytes (rounded up) with the guard area
| #define OS_TSK_STACK | ( | stk, | |
| ... ) |
define task stack
| stk | name of the stack (passed to the init function) |
| ... | size: (optional) size of task stack (in bytes); default: OS_STACK_SIZE |
| #define static_TSK_STACK | ( | stk, | |
| ... ) |
static alias of OS_TSK_STACK()
| #define OS_WRK | ( | tsk, | |
| prio, | |||
| proc, | |||
| size ) |
define and initialize complete work area for task object
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| size | size of task private stack (in bytes) |
| #define static_WRK | ( | tsk, | |
| prio, | |||
| proc, | |||
| size ) |
| #define OS_TSK | ( | tsk, | |
| prio, | |||
| proc, | |||
| ... ) |
define and initialize complete work area for task object with default stack size
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| ... | size: (optional) size of task private stack (in bytes); default: OS_STACK_SIZE |
| #define static_TSK | ( | tsk, | |
| prio, | |||
| proc, | |||
| ... ) |
static alias of OS_TSK()
| #define OS_WRK_DEF | ( | tsk, | |
| prio, | |||
| size ) |
define and initialize complete work area for task object
task proc (function body) must be defined immediately below
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| size | size of task private stack (in bytes) |
| #define static_WRK_DEF | ( | tsk, | |
| prio, | |||
| size ) |
static alias of OS_WRK_DEF()
| #define OS_TSK_DEF | ( | tsk, | |
| prio, | |||
| ... ) |
define and initialize complete work area for task object with default stack size
task proc (function body) must be defined immediately below
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| ... | size: (optional) size of task private stack (in bytes); default: OS_STACK_SIZE |
| #define static_TSK_DEF | ( | tsk, | |
| prio, | |||
| ... ) |
static alias of OS_TSK_DEF()
| #define OS_WRK_START | ( | tsk, | |
| prio, | |||
| size ) |
define, initialize and start complete work area for task object
task proc (function body) must be defined immediately below
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| size | size of task private stack (in bytes) |
| #define static_WRK_START | ( | tsk, | |
| prio, | |||
| size ) |
static alias of OS_WRK_START()
| #define OS_TSK_START | ( | tsk, | |
| prio, | |||
| ... ) |
define, initialize and start complete work area for task object with default stack size
task proc (function body) must be defined immediately below
| tsk | name of a pointer to task object |
| prio | initial task priority (any unsigned int value) |
| ... | size: (optional) size of task private stack (in bytes); default: OS_STACK_SIZE |
| #define static_TSK_START | ( | tsk, | |
| prio, | |||
| ... ) |
static alias of OS_TSK_START()
| #define WRK_INIT | ( | prio, | |
| proc, | |||
| size ) |
create and initialize complete work area for task object
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| size | size of task private stack (in bytes) |
| #define WRK_CREATE | ( | prio, | |
| proc, | |||
| size ) |
create and initialize complete work area for task object
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| size | size of task private stack (in bytes) |
| #define TSK_INIT | ( | prio, | |
| proc, | |||
| ... ) |
create and initialize complete work area for task object with default stack size
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| ... | size: (optional) size of task private stack (in bytes); default: OS_STACK_SIZE |
| #define TSK_CREATE | ( | prio, | |
| proc, | |||
| ... ) |
create and initialize complete work area for task object with default stack size
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| ... | size: (optional) size of task private stack (in bytes); default: OS_STACK_SIZE |
|
inline |
return current task object
| void wrk_init | ( | tsk_t * | tsk, |
| unsigned | prio, | ||
| fun_t * | proc, | ||
| stk_t * | stack, | ||
| size_t | size ) |
initialize complete work area for task object
don't start the task
| tsk | pointer to task object |
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| stack | base of task's private stack storage |
| size | size of task private stack (in bytes) |
| void tsk_init | ( | tsk_t * | tsk, |
| unsigned | prio, | ||
| fun_t * | proc, | ||
| stk_t * | stack, | ||
| size_t | size ) |
initialize complete work area for task object and start the task, if proc != NULL
| tsk | pointer to task object |
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| stack | base of task's private stack storage |
| size | size of task private stack (in bytes) |
| tsk_t * wrk_create | ( | unsigned | prio, |
| fun_t * | proc, | ||
| size_t | size, | ||
| bool | detached, | ||
| bool | autostart ) |
create and initialize complete work area for task object
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| size | size of task private stack (in bytes) |
| detached | create as detached? |
| autostart | specifies whether the task runs immediately after initialization |
| NULL | object not created (not enough free memory) |
| tsk_t * tsk_setup | ( | unsigned | prio, |
| fun_a * | proc, | ||
| void * | arg, | ||
| size_t | size ) |
create and initialize complete work area for task object and start the task, if proc != NULL
| prio | initial task priority (any unsigned int value) |
| proc | task initial procedure (initial task function with argument) |
| arg | task initial procedure argument |
| size | size of task private stack (in bytes) |
| NULL | object not created (not enough free memory) |
|
inline |
create and initialize a new task object with default stack size and start the task, if proc != NULL
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| NULL | object not created (not enough free memory) |
|
inline |
create and initialize a new detached task object with default stack size and start the task, if proc != NULL
| prio | initial task priority (any unsigned int value) |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| NULL | object not created (not enough free memory) |
| void tsk_start | ( | tsk_t * | tsk | ) |
start previously defined/created/stopped task object
| tsk | pointer to task object |
| void tsk_startFrom | ( | tsk_t * | tsk, |
| fun_t * | proc ) |
start previously defined/created/stopped task object
| tsk | pointer to task object |
| proc | task proc (initial task function) doesn't have to be noreturn-type it will be executed into an infinite system-implemented loop |
| void tsk_startWith | ( | tsk_t * | tsk, |
| fun_a * | proc, | ||
| void * | arg ) |
start previously defined/created/stopped task object
| tsk | pointer to task object |
| proc | task initial procedure (initial task function with argument) |
| arg | task initial procedure argument |
| int tsk_detach | ( | tsk_t * | tsk | ) |
| int tsk_join | ( | tsk_t * | tsk | ) |
delay execution of current task until termination of given task
| tsk | pointer to task object |
| E_SUCCESS | given task has stopped (stop / exit) |
| E_STOPPED | given task was reseted (reset / kill) |
| E_DELETED | given task was deleted (delete / destroy) |
| E_FAILURE | given task cannot be joined |
| void tsk_stop | ( | void | ) |
stop the current task and remove it from READY queue
all mutexes held by the task are released (waiting tasks get E_STOPPED, robust mutex: next owner gets OWNERDEAD)
detached task is destroyed, otherwise
function doesn't destroy the stack storage,
and all allocated resources will remain intact until
joining, destroying or restarting the task
| int tsk_reset | ( | tsk_t * | tsk | ) |
reset the task object and remove it from READY/BLOCKED queue
all mutexes held by the task are released (waiting tasks get E_STOPPED, robust mutex: next owner gets OWNERDEAD)
other objects held by the task (e.g. semaphores, read/write locks) are not released
| tsk | pointer to task object |
| E_SUCCESS | given task was already inactive or has been reseted |
| E_FAILURE | given task cannot be reseted |
| int tsk_destroy | ( | tsk_t * | tsk | ) |
reset the task object and free allocated resources
all mutexes held by the task are released (waiting tasks get E_STOPPED, robust mutex: next owner gets OWNERDEAD)
| tsk | pointer to task object |
| void tsk_yield | ( | void | ) |
yield system control to the next task with the same priority in READY queue
the current task goes to the end of its priority group (also when a higher priority task is ready)
| void tsk_flip | ( | fun_t * | proc | ) |
restart current task with the new proc (task function)
all mutexes held by the task are released (waiting tasks get E_STOPPED, robust mutex: next owner gets OWNERDEAD)
| proc | new task proc (task function) |
| void tsk_setPrio | ( | unsigned | prio | ) |
set current task priority
| prio | new task priority value |
| unsigned tsk_getPrio | ( | void | ) |
get current task priority
| void tsk_sleepFor | ( | cnt_t | delay | ) |
delay execution of current task for given duration of time
| delay | duration of time (maximum number of ticks to delay execution of current task)
|
| void tsk_sleepNext | ( | cnt_t | delay | ) |
delay execution of current task for given duration of time
from the end of the previous countdown
| delay | duration of time (maximum number of ticks to delay execution of current task)
|
| void tsk_sleepUntil | ( | cnt_t | time | ) |
delay execution of current task until given timepoint
| time | timepoint value
|
|
inline |
delay indefinitely execution of current task
execution of the task can be resumed
| int tsk_suspend | ( | tsk_t * | tsk | ) |
| int tsk_resume | ( | tsk_t * | tsk | ) |
resume execution of given suspended task
only suspended or indefinitely blocked tasks can be resumed
| tsk | pointer to suspended task object |
| void tsk_give | ( | tsk_t * | tsk, |
| unsigned | signo ) |
send given signal to the task
| tsk | pointer to the task object |
| signo | signal number |
| void tsk_action | ( | tsk_t * | tsk, |
| act_t * | action ) |
set given function as a signal handler
| tsk | pointer to the task object |
| action | signal handler |
|
inline |
chack water mark of the stack of the current task
| 0 | DEBUG not defined |