This chapter describes details of the system calls provided by μT-Kernel/OS (Operating System).
Task management functions are functions that directly manipulate or reference task states. Functions are provided for creating and deleting a task, for task starting and exit, changing task priority, and referencing task state. A task is an object identified by an ID number called a task ID. Task states and scheduling rules are explained in the Section called Task States and Scheduling Rules in the Chapter called μT-Kernel Concepts.
For control of execution order, a task has a base priority and current priority. When simply "task priority" is mentioned, this means the current priority. The base priority of a task is initialized to the startup priority when a task is started. If the mutex function is not used, the task current priority is always identical to its base priority. For this reason, the current priority immediately after a task is started is the task startup priority. When the mutex function is used, the current priority is set as discussed in the Section called Mutex.
The kernel does not perform processing for freeing of resources acquired by a task (semaphore resources, memory blocks, etc.) upon task exit, other than mutex unlocking. Freeing of task resources is the responsibility of the application.
pk_ctsk
Detail:
void* |
exinf
| Extended Information | Extended information |
ATR |
tskatr
| Task Attribute | Task attribute |
FP |
task
| Task Start Address | Task start address |
PRI |
itskpri
| Initial Task Priority | Initial task priority |
SZ |
stksz
| Stack Size | Stack size (in bytes) |
SZ |
sstksz
| System Stack Size | System stack size (in bytes) |
void* |
stkptr
| User Stack Pointer | User stack pointer |
UB |
dsname[8]
| DS Object name | DS object name |
void* |
bufptr
| Buffer Pointer | User buffer pointer |
(Other implementation-dependent parameters may be added beyond this point.) |
E_NOMEM | Insufficient memory (memory for control block or user stack cannot be allocated) |
E_LIMIT | Number of tasks exceeds the system limit |
E_RSATR | Reserved attribute (tskatr is invalid or cannot be used), or the specified coprocessor does not exist |
E_NOSPT | Unsupported functions(when the specification of TA_ASM, TA_USERSTACK, TA_TASKSPACE, or TA_USERBUF is not supported.) |
E_PAR | Parameter error |
E_NOCOP | The specified coprocessor cannot be used (not installed, or abnormal operation detected) |
TK_SUPPORT_ASM | Support for specifying TA_ASM for task attribute |
TK_SUPPORT_USERBUF | Support for specifying TA_USERBUF for task attribute |
TK_SUPPORT_AUTOBUF | Automatic buffer allocation is supported (by not specifying TA_USERBUF to task attribute) |
TK_SUPPORT_FPU | Support for specifying TA_FPU for task attribute |
TK_SUPPORT_COPn | Support for specifying TA_COPn for task attribute |
TK_HAS_SYSSTACK | Task can have a system stack independent of user-stack, and each can be specified separately using (TA_USERSTACK, TA_SSTKSZ) |
TK_SUPPORT_DSNAME | Support for specifying TA_DSNAME for task attribute |
TK_MAX_TSKPRI | Maximum task priority that can be specified (must be 16 or higher) |
Creates a task, assigning to it a task ID number. This system call allocates a TCB (Task Control Block) to the created task and initializes it based on itskpri
, task
, stksz
and other parameters.
After the task is created, it is initially in DORMANT state.
itskpri
is used to specify the startup priority when a task is started. Task priority level can be specified by a positive integer, and the smaller the value, higher priority the task has. The largest task priority level is defined by TK_MAX_TSKPRI.
exinf
can be used freely by the user to insert miscellaneous information about the task. The information set here is passed to the task as startup parameter information and can be referred to by calling tk_ref_tsk. If a larger area is needed for indicating user information, or if the information may need to be changed after the task is created, this can be done by allocating separate memory for this purpose and putting the memory packet address in exinf
. The kernel pays no attention to the contents of exinf
.
tskatr
indicates system attributes in its lower bits and implementation-dependent attributes in its higher bits. The system attribute part of tskatr
is as follows.
tskatr := (TA_ASM || TA_HLNG) | [TA_SSTKSZ] | [TA_USERSTACK] | [TA_USERBUF] | [TA_DSNAME] | (TA_RNG0 || TA_RNG1 || TA_RNG2 || TA_RNG3) | [TA_COP0] | [TA_COP1] | [TA_COP2] | [TA_COP3] | [TA_FPU]
TA_ASM | Indicates that the task is written in assembly language |
TA_HLNG | Indicates that the task is written in high-level language |
TA_SSTKSZ | Specifies the system stack size |
TA_USERSTACK | Points to the user stack |
TA_USERBUF | Use of user-specified memory area as stack |
TA_DSNAME | Specifies DS object name |
TA_RNGn | Indicates that the task runs at protection level n |
TA_COPn | Specifies use of the nth coprocessor (including floating point coprocessor or DSP) |
TA_FPU | Specifies use of a floating point coprocessor (when a coprocessor specified in TA_COPn is a general-purpose FPU particularly for floating point processing and not dependent on the CPU) |
The function for specifying implementation-dependent attributes can be used, for example, to specify that a task is subject to debugging. One use of the remaining system attribute fields is for indicating multiprocessor attributes in the future.
#define TA_ASM 0x00000000 /* Task in Assembly Language */ #define TA_HLNG 0x00000001 /* Task in High-level language */ #define TA_SSTKSZ 0x00000002 /* System stack size */ #define TA_USERSTACK 0x00000004 /* User stack pointer */ #define TA_USERBUF 0x00000020 /* Use user-specified buffer */ #define TA_DSNAME 0x00000040 /* DS object name */ #define TA_RNG0 0x00000000 /* Run at protection level 0 */ #define TA_RNG1 0x00000100 /* Run at protection level 1 */ #define TA_RNG2 0x00000200 /* Run at protection level 2 */ #define TA_RNG3 0x00000300 /* Run at protection level 3 */ #define TA_COP0 0x00001000 /* Use ID=0 coprocessor */ #define TA_COP1 0x00002000 /* Use ID=1 coprocessor */ #define TA_COP2 0x00004000 /* Use ID=2 coprocessor */ #define TA_COP3 0x00008000 /* Use ID=3 coprocessor */
When TA_HLNG is specified, starting the task
jumps to the task
address not directly but by going through a high-level language environment configuration program (high-level language support routine). The task takes the following form in this case.
void task( INT stacd, void *exinf ) { /* (processing) */ tk_ext_tsk(); or tk_exd_tsk(); /* Exit task */ }
The startup parameters passed to the task include the task startup code stacd
specified in tk_sta_tsk, and the extended information exinf
specified in tk_cre_tsk.
The task cannot (must not) be terminated by a simple return from the function, otherwise the operation will be indeterminate (implementation-dependent).
The form of the task when the TA_ASM attribute is specified in implementation-dependent, but stacd
and exinf
must be passed as startup parameters.
The task runs at the protection level specified in the TA_RNGn attribute. When a system call or extended SVC is called, the protection level goes to 0, then goes back to its original level upon return from the system call or extended SVC.
Each task has two stack areas, a system stack and user stack. The user stack is used at the protection level specified in TA_RNGn while the system stack is used at protection level 0. When the calling of a system call or extended SVC causes the protection level to change, the stack is also switched.
Note that a task running at TA_RNG0 does not switch protection levels, so there is no stack switching either. When TA_RNG0 is specified, the combined total of the user stack size and system stack size is the size of one stack, employed as both a user stack and system stack.
When TA_SSTKSZ is specified, sstksz
is valid. If TA_SSTKSZ is not specified, sstksz
is ignored and the default size applies.
When TA_USERSTACK is specified, stkptr
is valid. In this case a user stack is not provided by the OS, but must be allocated by the caller. stksz
must be set to 0. If TA_USERSTACK is not specified, stkptr
is ignored. Note that if TA_RNG0 is set, TA_USERSTACK cannot be specified. E_PAR occurs if TA_RNG0 and TA_USERSTACK are specified at the same time.
TA_USERBUF can be specified for implementation where there is no distinction of user stack and system stack and there is only one unified stack for a task. When this attribute is specified, bufptr
becomes effective, and the memory area starting at bufptr
containing stksz
octets is used as the unified user and system stack area. In this case, the kernel does not provide the stack area.
When TA_DSNAME is specified, dsname
is valid and specifies the DS object name. DS object name is used to identify objects by debugger, and it is handled only by T-Kernel/DS API, td_ref_dsname and td_set_dsname. For more details, see the description of td_ref_dsname and td_set_dsname. If TA_DSNAME is not specified, dsname
is ignored. Then td_ref_dsname and td_set_dsname return E_OBJ error.
A task runs either at the protection level set in TA_RNGn or at protection level 0. For example, a task for which TA_RNG3 is specified in no case runs at protection level 1 or 2.
In a system with separate interrupt stack, interrupt handlers also use the system stack. An interrupt handler runs at protection level 0.
The system stack default size is decided taking into account the amount taken up by system call execution and, in a system with separate interrupt stack, the amount used by interrupt handlers.
The definition of TA_COPn is dependent on the CPU and other hardware and is not portable.
TA_FPU is provided as a portable notation method only for the definition in TA_COPn of a floating point coprocessor. If, for example, the floating point coprocessor is TA_COP0, then TA_FPU = TA_COP0. If there is no particular need to specify the use of a coprocessor for floating point operations, TA_FPU = 0 is set.
Even in a system with a single CPU's operating mode, for the sake of portability all attributes including TA_RNGn must be accepted. It is possible, for example, to handle all TA_RNGn as equivalent to TA_RNG0, but error must not be returned.
The T-Kernel 2.0 specification does not define TA_USERBUF and its associated notion of bufptr
. So if this feature is used, a modification is necessary to port the software to T-Kernel 2.0. However, if stksz
is properly set already, simply removing TA_USERBUF and bufptr
will complete the modification for porting.
The largest task priority is defined by TK_MAX_TSKPRI. Although TK_MAX_TSKPRI is variable, but is guaranteed to be equal to or larger than 16, and so by restricting the used task priorities only to the range from 1 to 16, there shall be no need for modifying the task priorities during porting.
Deletes the task specified in tskid
.
This system call changes the state of the task specified in tskid
from DORMANT state to NONEXISTENT state (no longer exists in the system), releasing the TCB and stack area that were assigned to the task. The task ID number is also released. When this system call is issued for a task not in DORMANT state, error code E_OBJ is returned.
This system call cannot specify the invoking task. If the invoking task is specified, error code E_OBJ is returned since the invoking task is not in DORMANT state. The invoking task is deleted not by this system call but by the tk_exd_tsk system call.
Starts the task specified in tskid
. This system call changes the state of the specified task from DORMANT state to READY state.
Parameters to be passed to the task when it starts can be set in stacd
. These parameters can be referred to from the started task, enabling use of this feature for simple message passing.
The task priority when it starts is the task startup priority (itskpri
) specified when the started task was created.
Start requests by this system call are not queued. If this system call is issued while the target task is in a state other than DORMANT state, the system call is ignored and error code E_OBJ is returned to the calling task.
Note that stacd
is INT type, and its value range is implementation-dependent, so care must be taken.
None.
Does not return to the context issuing the system call.
The following kind of error may be detected, but no return is made to the context issuing the system call even if the error is detected. For this reason the error code cannot be passed directly as a system call return parameter. The behavior in case an error occurs is implementation-dependent.
Exits the invoking task normally and changes its state to DORMANT state.
When a task terminates by tk_ext_tsk, the resources acquired by the task up to that time (memory blocks, semaphores, etc.) are not automatically freed. The user is responsible for releasing such resources before the task exits.
tk_ext_tsk is a system call that does not return to the context from which it was called. Even if an error code is returned when an error of some kind is detected, normally no error checking is performed in the context from which the system call was invoked, leaving the possibility that the program will behave in an unexpected manner. For this reason these system calls do not return even if error is detected.
As a rule, the task priority and other information included in the TCB is reset when the task returns to DORMANT state. If, for example, the task priority is changed by tk_chg_pri and later terminated by tk_ext_tsk, the task priority reverts to the startup priority (itskpri
) specified by tk_cre_tsk at startup. It does not keep the task priority in effect at the time tk_ext_tsk was executed.
System calls that do not return to the calling context are those named tk_ret_??? or tk_ext_??? (tk_exd_???).
None.
Does not return to the context issuing the system call.
The following kind of error may be detected, but no return is made to the context issuing the system call even if the error is detected. For this reason the error code cannot be passed directly as a system call return parameter. The behavior in case an error occurs is implementation-dependent.
Terminates the invoking task normally and also deletes it. This system call changes the state of the invoking task to NON-EXISTENT state (no longer exists in the system).
When a task terminates by tk_exd_tsk, the resources acquired by the task up to that time (memory blocks, semaphores, etc.) are not automatically freed. The user is responsible for releasing such resources before the task exits.
tk_exd_tsk is a system call that does not return to the context from which it was called. Even if an error code is returned when an error of some kind is detected, normally no error checking is performed in the context from which the system call was invoked, leaving the possibility that the program will behave in an unexpected manner. For this reason these system calls do not return even if error is detected.
Forcibly terminates the task specified in tskid
. This system call changes the state of the target task specified in tskid
to DORMANT state.
Even if the target task was in the waiting state (including SUSPENDED state), the waiting state is released and the task is terminated. If the target task was in some kind of queue (semaphore wait, etc.), executing tk_ter_tsk results in its removal from the queue.
This system call cannot specify the invoking task. If the invoking task is specified, error code E_OBJ is returned.
The relationships between target task states and the results of executing tk_ter_tsk are summarized in Table 1.
Table 1. Target Task State and Execution Result (tk_ter_tsk)
Target Task State | tk_ter_tskercd Return Value | (processing) |
---|---|---|
Run state (RUNNING or READY) (not for invoking task) | E_OK | Forced termination |
Running state (RUNNING) (invoking task) | E_OBJ | No operation |
Waiting state (WAITING) | E_OK | Forced termination |
Suspended state (SUSPENDED) | E_OK | Forced termination |
Waiting-suspended state (WAITING-SUSPENDED) | E_OK | Forced termination |
Dormant state (DORMANT) | E_OBJ | No operation |
Non-existent state (NON-EXISTENT) | E_NOEXS | No operation |
When a task is terminated by tk_ter_tsk, the resources acquired by the task up to that time (memory blocks, semaphores, etc.) are not automatically freed. The user is responsible for releasing such resources before the task is terminated.
As a rule, the task priority and other information included in the TCB is reset when the task returns to DORMANT state. If, for example, the task priority is changed by tk_chg_pri and later terminated by tk_ter_tsk, the task priority reverts to the startup priority (itskpri
) that is specified by tk_cre_tsk at startup. The task priority at task termination by tk_ter_tsk is not used after the task is restarted by tk_sta_tsk.
Forcible termination of another task is intended for use only by a debugger or a few other tasks closely related to the OS. As a rule, this system call is not to be used by ordinary applications or middleware, for the following reason.
Forced termination occurs regardless of the running state of the target task. If, for example, a task were forcibly terminated while the task was calling a middleware function, the task would terminate right while the middleware was executing. If such a situation were allowed, normal operation of the middleware could not be guaranteed.
This is an example of how task termination should not be allowed when the task status (what it is executing) is unknown. Ordinary applications therefore must not use the forcible termination function.
Changes the base priority of the task specified in tskid
to the value specified in tskpri
. The current priority of the task also changes as a result.
Task priority values are specified from 1 to TK_MAX_TSKPRI, with the smaller numbers indicating higher priority.
When TSK_SELF (= 0) is specified in tskid
, the invoking task is the target task. Note, however, that when tskid
=TSK_SELF is specified in a system call issued from a task-independent portion, error code E_ID is returned. When TPRI_INI (= 0) is specified as tskpri
, the target task base priority is changed to the initial priority when the task was started (itskpri
).
A priority changed by this system call remains valid until the task is terminated. When the task reverts to DORMANT state, the task priority before its exit is discarded, with the task again assigned to the initial priority when the task was started (itskpri
). However, the priority changed in DORMANT state is valid. The next time the task is started, it has the new initial priority.
If as a result of this system call execution the target task current priority matches the base priority (this condition is always met when the mutex function is not used), processing is as follows.
If the target task is in a run state, the task precedence changes according to its priority. The target task has the lowest precedence among tasks of the same priority after the change.
If the target task is in some kind of priority-based queue, the order in that queue changes in accordance with the new task priority. Among tasks of the same priority after the change, the target task is queued at the end.
If the target task has locked a TA_CEILING attribute mutex or is waiting for a lock, and the base priority specified in tskpri
is higher than any of the ceiling priorities, error code E_ILUSE is returned.
In some cases when this system call results in a change in the queued order of the target task in a task priority-based queue, it may be necessary to release the wait state of another task waiting in that queue (in a message buffer send queue, or in a queue waiting to acquire a variable-size memory pool).
In some cases when this system call results in a base priority change while the target task is waiting for a mutex lock with TA_INHERIT dynamic priority inheritance processing may be necessary.
When a mutex function is not used and the system call is issued specifying the invoking task as the target task, setting the new priority to the base priority of the invoking task, the order of execution of the invoking task becomes the lowest among tasks of the same priority. This system call can therefore be used to relinquish execution privilege.
The largest task priority is defined by TK_MAX_TSKPRI. Although TK_MAX_TSKPRI is variable, but is guaranteed to be equal to or larger than 16, and so by restricting the used task priorities only to the range from 1 to 16, there shall be no need for modifying the task priorities during porting.
ID |
tskid
| Task ID | Task ID |
T_REGS* |
pk_regs
| Packet of Registers | Pointer to the area to return the general register values |
T_EIT* |
pk_eit
| Packet of EIT Registers | Pointer to the area to return the values of registers saved when an exception occurs |
T_CREGS* |
pk_cregs
| Packet of Control Registers | Pointer to the area to return the control register values |
The contents of T_REGS, T_EIT, and T_CREGS are defined for each CPU and implementation.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the current register contents of the task specified in tskid
.
If NULL is set in pk_regs
, pk_eit
, or pk_cregs
, the corresponding registers are not referenced.
The referenced register values are not necessarily the values at the time the task portion was executing.
If this system call is issued for the invoking task, error code E_OBJ is returned.
In principle, all registers in the task context can be referenced. This includes not only physical CPU registers but also those treated by the kernel as virtual registers.
ID |
tskid
| Task ID | Task ID |
CONST T_REGS* |
pk_regs
| Packet of Registers | General registers |
CONST T_EIT* |
pk_eit
| Packet of EIT Registers | Registers saved when EIT occurs |
CONST T_CREGS* |
pk_cregs
| Packet of Control Registers | Control registers |
The contents of T_REGS, T_EIT, and T_CREGS are defined for each CPU and implementation.
E_OK | Normal completion |
E_ID | Invalid ID number (tskid is invalid or cannot be used) |
E_NOEXS | Object does not exist (the task specified in tskid does not exist) |
E_OBJ | Invalid object state (called for the invoking task) |
E_CTX | Context error (called from task-independent portion) |
E_PAR | Invalid register value (implementation-dependent) |
Only when all the service profile items below are set to be effective, this system call can be used.
Sets the current register contents of the task specified in tskid
.
If NULL is set in pk_regs
, pk_eit
, or pk_cregs
, the corresponding registers are not set.
The set register values are not necessarily the values while the task portion is executing. The kernel is not responsible for handling the side-effects of register value changes.
It is possible, however, that some registers or register bits cannot be changed if the kernel does not allow such changes.(Implementation-dependent)
If this system call is issued for the invoking task, error code E_OBJ is returned.
pk_copregs
Detail:
T_COP0REG |
cop0
| Coprocessor Number 0 Register | Coprocessor number 0 register |
T_COP1REG |
cop1
| Coprocessor Number 1 Register | Coprocessor number 1 register |
T_COP2REG |
cop2
| Coprocessor Number 2 Register | Coprocessor number 2 register |
T_COP3REG |
cop3
| Coprocessor Number 3 Register | Coprocessor number 3 register |
The contents of T_COPnREG are defined for each CPU and implementation.
E_OK | Normal completion |
E_ID | Invalid ID number (tskid is invalid or cannot be used) |
E_NOEXS | Object does not exist (the task specified in tskid does not exist) |
E_OBJ | Invalid object state (called for the invoking task) |
E_CTX | Context error (called from task-independent portion) |
E_PAR | Parameter error (copno is invalid or the specified coprocessor does not exist) |
If TK_SUPPORT_COPn is ineffective for all n
, this API is unsupported.
Gets the current contents of the register specified in copno
of the task specified in tskid
.
The referenced register values are not necessarily the values at the time the task portion was executing.
If this system call is issued for the invoking task, error code E_OBJ is returned.
In principle, all registers in the task context can be referenced. This includes not only physical CPU registers but also those treated by the kernel as virtual registers.
ID |
tskid
| Task ID | Task ID |
INT |
copno
| Coprocessor Number | Coprocessor number (0 to 3) |
CONST T_COPREGS* |
pk_copregs
| Packet of Coprocessor Registers | Coprocessor register |
pk_copregs
Detail:
E_OK | Normal completion |
E_ID | Invalid ID number (tskid is invalid or cannot be used) |
E_NOEXS | Object does not exist (the task specified in tskid does not exist) |
E_OBJ | Invalid object state (called for the invoking task) |
E_CTX | Context error (called from task-independent portion) |
E_PAR | Parameter error (copno is invalid or the specified coprocessor does not exist), or the set register value is invalid (implementation-dependent) |
If TK_SUPPORT_COPn is ineffective for all n
, this API is unsupported.
Sets the contents of the register specified in copno
of the task specified in tskid
.
The set register values are not necessarily the values while the task portion is executing. The kernel is not responsible for handling the side-effects of register value changes.
It is possible, however, that some registers or register bits cannot be changed if the kernel does not allow such changes.(Implementation-dependent)
If this system call is issued for the invoking task, error code E_OBJ is returned.
pk_rtsk
Detail:
void* |
exinf
| Extended Information | Extended information |
PRI |
tskpri
| Task Priority | Current priority |
PRI |
tskbpri
| Task Base Priority | Base priority |
UINT |
tskstat
| Task State | Task State |
UW |
tskwait
| Task Wait Factor | Wait factor |
ID |
wid
| Waiting Object ID | Waiting object ID |
INT |
wupcnt
| Wakeup Count | Wakeup request queuing count |
INT |
suscnt
| Suspend Count | Suspend request nesting count |
UW |
waitmask
| Wait Mask | Disabled wait factors |
UINT |
texmask
| Task Exception Mask | Allowed task exceptions |
UINT |
tskevent
| Task Event | Raised task event |
(Other implementation-dependent parameters may be added beyond this point.) |
Gets the state of the task specified in tskid
.
tskstat
takes the following values.
TTS_RUN | 0x0001 | RUNNING state |
TTS_RDY | 0x0002 | READY state |
TTS_WAI | 0x0004 | WAITING state |
TTS_SUS | 0x0008 | SUSPENDED state |
TTS_WAS | 0x000c | WAITING-SUSPENDED state |
TTS_DMT | 0x0010 | DORMANT state |
TTS_NODISWAI | 0x0080 | Disabling of wait by tk_dis_wai is prohibited |
Task states such as TTS_RUN and TTS_WAI are expressed by corresponding bits, which is useful when making a complex state decision (e.g., deciding that the state is one of either RUNNING or READY state). Note that of the above states, TTS_WAS is a combination of TTS_SUS and TTS_WAI but TTS_SUS is never combined with other states (TTS_RUN, TTS_RDY, TTS_DMT).
In the case of TTS_WAI (including TTS_WAS), disabling of wait by the tk_dis_wai is prohibited, TTS_NODISWAI is set. TTS NODISWAI is never combined with states other than TTS WAI.
When tk_ref_tsk is executed for an interrupted task from an interrupt handler, RUNNING (TTS_RUN) is returned as tskstat
.
When tskstat
is TTS_WAI (including TTS_WAS), the values of tskwait
and wid
are as shown in Table 2.
Table 2. Values of tskwait
and wid
tskwait
| Value | Description |
wid
|
---|---|---|---|
TTW_SLP | 0x00000001 | Wait caused by tk_slp_tsk | 0 |
TTW_DLY | 0x00000002 | Wait caused by tk_dly_tsk | 0 |
TTW_SEM | 0x00000004 | Wait caused by tk_wai_sem |
semid
|
TTW_FLG | 0x00000008 | Wait caused by tk_wai_flg |
flgid
|
TTW_MBX | 0x00000040 | Wait caused by tk_rcv_mbx |
mbxid
|
TTW_MTX | 0x00000080 | Wait caused by tk_loc_mtx |
mtxid
|
TTW_SMBF | 0x00000100 | Wait caused by tk_snd_mbf |
mbfid
|
TTW_RMBF | 0x00000200 | Wait caused by tk_rcv_mbf |
mbfid
|
TTW_CAL | 0x00000400 | (reserved) | (reserved) |
TTW_ACP | 0x00000800 | (reserved) | (reserved) |
TTW_RDV | 0x00001000 | (reserved) | (reserved) |
(TTW_CAL | TTW_RDV) | 0x00001400 | (reserved) | (reserved) |
TTW_MPF | 0x00002000 | Wait caused by tk_get_mpf |
mpfid
|
TTW_MPL | 0x00004000 | Wait caused by tk_get_mpl |
mplid
|
TTW_EV1 | 0x00010000 | Wait for task event #1 | 0 |
TTW_EV2 | 0x00020000 | Wait for task event #2 | 0 |
TTW_EV3 | 0x00040000 | Wait for task event #3 | 0 |
TTW_EV4 | 0x00080000 | Wait for task event #4 | 0 |
TTW_EV5 | 0x00100000 | Wait for task event #5 | 0 |
TTW_EV6 | 0x00200000 | Wait for task event #6 | 0 |
TTW_EV7 | 0x00400000 | Wait for task event #7 | 0 |
TTW_EV8 | 0x00800000 | Wait for task event #8 | 0 |
When tskstat
is not TTS_WAI (including TTS_WAS), both tskwait
and wid
are 0.
waitmask
is the same bit array as tskwait
.
texmask
is a logical OR bit array representing permitted task exception codes in the form 1<< task exception code for each code.
tskevent
shows the list of generated and pending task events by representing each event as 1<< (task event number - 1) and calculating the logical OR of the bit values.
For a task in DORMANT state, wupcnt
= 0, suscnt
= 0, and tskevent
= 0.
The invoking task can be specified by setting tskid
= TSK_SELF = 0. Note, however, that when tskid
=TSK_SELF=0 is specified in a system call issued from a task-independent portion, error code E_ID is returned.
When the task specified with tk_ref_tsk does not exist, error code E_NOEXS is returned.
Even when tskid
= TSK_SELF is specified with this system call, the ID of the invoking task is not known. Use tk_get_tid to find out the ID of the invoking task.