This chapter describes details of the functions provided by μT-Kernel/DS (Debugger Support).
μT-Kernel/DS provides functions enabling a debugger to reference μT-Kernel internal states and run a trace. The functions provided by μT-Kernel/DS are only for debugger use and not for use by applications or other programs.
Overall Note and Supplement | |
---|---|
|
Kernel internal state reference functions are functions for enabling a debugger to get T-Kernel internal states. They include functions for getting a list of objects, getting task precedence, getting the order in which tasks are queued, getting the status of objects, system, and task registers, and getting time.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used tasks, and puts in list
up to nent
IDs. The number of the used tasks is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used semaphores, and puts in list
up to nent
IDs. The number of the used semaphores is passed in the return code. If return code > nent
, this means not all semaphore IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used event flags, and puts in list
up to nent
IDs. The number of the used event flags is passed in the return code. If return code > nent
, this means not all event flag IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used mailboxes, and puts in list
up to nent
IDs. The number of the used mailboxes is passed in the return code. If return code > nent
, this means not all mailbox IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used mutexes, and puts in list
up to nent
IDs. The number of the used mutexes is passed in the return code. If return code > nent
, this means not all mutex IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used message buffers, and puts in list
up to nent
IDs. The number of the used message buffers is passed in the return code. If return code > nent
, this means not all message buffer IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used fixed-size memory pools, and puts in list
up to nent
IDs. The number of the used fixed-size memory pools is passed in the return code. If return code > nent
, this means not all fixed-size memory pool IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used variable-size memory pools, and puts in list
up to nent
IDs. The number of the used variable-size memory pools is passed in the return code. If return code > nent
, this means not all variable-size memory pool IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used cyclic handlers, and puts in list
up to nent
IDs. The number of the used cyclic handlers is passed in the return code. If return code > nent
, this means not all cyclic handler IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used alarm handlers, and puts in list
up to nent
IDs. The number of the used alarm handlers is passed in the return code. If return code > nent
, this means not all alarm handler IDs could be retrieved.
None.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the currently used subsystems, and puts in list
up to nent
IDs. The number of the used subsystems is passed in the return code. If return code > nent
, this means not all subsystem IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets a list of IDs of the tasks in a run state (READY state or RUNNING state) whose task priority is pri
, arranged in the order from the highest to the lowest precedence.
This function stores in list
up to nent
task IDs, arranged in the order of precedence starting from the highest-precedence task ID at the head of the list.
The number of tasks in a run state with priority pri
is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for a semaphore specified in semid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the semaphore queue. The number of the tasks in the semaphore queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for an event flag specified in flgid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the event flag queue. The number of the tasks in the event flag queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for a mailbox specified in mbxid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the mailbox queue. The number of the tasks in the mailbox queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for a mutex specified in mtxid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the mutex queue. The number of the tasks in the mutex queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for sending a message to a message buffer specified in mbfid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the message buffer send queue. The number of the tasks in the message buffer send queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for receiving a message from a message buffer specified in mbfid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the message buffer receive queue. The number of the tasks in the message buffer receive queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for allocation in a fixed-size memory pool specified in mpfid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the fixed-size memory pool queue. The number of the tasks in the fixed-size memory pool queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the list of the IDs of the queued tasks waiting for allocation in a variable-size memory pool specified in mplid
. This function stores in list
up to nent
task IDs, arranged in the order in which tasks are queued, starting from the first task in the variable-size memory pool queue. The number of the tasks in the variable-size memory pool queue is passed in the return code. If return code > nent
, this means not all task IDs could be retrieved.
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 States |
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 |
FP |
task
| Task Start Address | Task start address |
SZ |
stksz
| User Stack Size | User stack size (in bytes) |
SZ |
sstksz
| System Stack Size | System stack size (in bytes) |
void* |
istack
| Initial User Stack Pointer | User stack pointer initial value |
void* |
isstack
| Initial System Stack Pointer | System stack pointer initial value |
Only when all the service profile items below are set to be effective, this system call can be used.
Additionally, the following service profile items are related to this system call.
TK_SUPPORT_DISWAI | Information about disabled wait factors (waitmask ) is obtainable |
TK_SUPPORT_TASKEXCEPTION | Task exception information (texmask ) can be acquired. |
TK_SUPPORT_TASKEVENT | Generated task event(tskevent )can be acquired |
TK_HAS_SYSSTACK | Task can have a system stack independent of user-stack, and information can be acquired of the system stack as well as user stack(sstksz and isstack ) |
Gets the state of the task designated in tskid. This function is similar to tk_ref_tsk, with the task start address and stack information added to the state information obtained.
The stack area extends from the stack pointer initial value toward the low addresses for the number of bytes designated as the stack size.
istack
- stksz
≦ user stack area < istack
isstack
- sstksz
≦ system stack area < isstack
Note that the stack pointer initial value (istack
, isstack
) is not the same as its current position. The stack area may be used even before a task is started. Calling td_get_reg gets the stack pointer current position.
pk_rtex
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the task exception status. This is similar to tk_ref_tex.
rsem
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the semaphore status. This is similar to tk_ref_sem.
rflg
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the event flag status. This is similar to tk_ref_flg.
rmbx
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the mailbox status. This is similar to tk_ref_mbx.
rmtx
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the mutex status. This is similar to tk_ref_mtx.
rmbf
Detail:
void* |
exinf
| Extended Information | Extended information |
ID |
wtsk
| Waiting Task ID | Receive waiting task ID |
ID |
stsk
| Send Waiting Task ID | Send waiting task ID |
INT |
msgsz
| Message Size | Size of the next message to be received (in bytes) |
SZ |
frbufsz
| Free Buffer Size | Free buffer size (in bytes) |
INT |
maxmsz
| Maximum Message Size | Maximum message size (in bytes) |
Only when all the service profile items below are set to be effective, this system call can be used.
References the message buffer status. This is similar to tk_ref_mbf.
rmpf
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the fixed-size memory pool status. This is similar to tk_ref_mpf.
rmpl
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the variable-size memory pool status. This is similar to tk_ref_mpl.
rcyc
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the cyclic handler status. This is similar to tk_ref_cyc.
The time remaining lfttim
returned in the cyclic handler status information (TD_RCYC) obtained by td_ref_cyc is a value rounded to milliseconds. To know the value in microseconds, call td_ref_cyc_u.
rcyc_u
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
This system call takes 64-bit lfttim_u
in microseconds instead of the return parameter lfttim
of td_ref_cyc.
The specification of this system call is same as that of td_ref_cyc, except that the return parameter is replaced with lfttim_u
. For more details, see the description of td_ref_cyc.
ralm
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the alarm handler status. This is similar to tk_ref_alm.
The time remaining lfttim
returned in the alarm handler status information (TD_RALM) obtained by td_ref_alm is a value rounded to milliseconds. To know the value in microseconds, call td_ref_alm_u.
ralm_u
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
This system call takes 64-bit lfttim_u
in microseconds instead of the return parameter lfttim
of td_ref_alm.
The specification of this system call is same as that of td_ref_alm, except that the return parameter is replaced with lfttim_u
. For more details, see the description of td_ref_alm.
pk_rsys
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the system status. This is similar to tk_ref_sys.
rssy
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
References the subsystem status. This is similar to tk_ref_ssy.
ID |
tskid
| Task ID | Target task ID (TSK_SELF cannot be specified) |
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 register values of the task designated in tskid. This is similar to tk_get_reg.
Registers cannot be referenced for the task currently in RUNNING state. Except when a task-independent portion is executing, the current RUNNING state task is the invoking task.
If NULL is set in pk_regs
, pk_eit
, or pk_cregs
, the corresponding registers are not referenced.
The contents of T_REGS, T_EIT, and T_CREGS are implementation-dependent.
ID |
tskid
| Task ID | Target task ID (TSK_SELF cannot be specified) |
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.
Only when all the service profile items below are set to be effective, this system call can be used.
Sets registers of the task designated in tskid. This is similar to tk_set_reg.
Registers cannot be set for the task currently in RUNNING state. Except when a task-independent portion is executing, the current RUNNING state task is the invoking task.
If NULL is set in pk_regs
, pk_eit
, or pk_cregs
, the corresponding registers are not set.
The contents of T_REGS, T_EIT, and T_CREGS are implementation-dependent.
ER |
ercd
| Error Code | Error code |
SYSTIM |
tim
| Time | Current time (in milliseconds) |
UW |
ofs
| Offset | Elapsed time from tim (in nanoseconds) |
tim
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the current time as total elapsed milliseconds since 0:00:00, January 1, 1970 (UTC). The value returned in tim
is the same as that obtained by tk_get_utc. tim
is the resolution of timer interrupt intervals (cycles), but even more precise time information is obtained in ofs
as the elapsed time from tim
in nanoseconds. The resolution of ofs
is implementation-dependent, but generally is the resolution of hardware timer.
Since tim
is a cumulative time counted based on timer interrupts, in some cases time is not refreshed, when a timer interrupt cycle arrives while interrupts are disabled and the timer interrupt handler is not started (is delayed). In such cases, the time as updated by the previous timer interrupt is returned in tim
, and the elapsed time from the previous timer interrupt is returned in ofs
. Accordingly, in some cases ofs
will be longer than the timer interrupt cycle. The length of elapsed time that can be measured by ofs
depends on the hardware, but preferably it should be possible to measure at least up to twice the timer interrupt cycle (0 ≦ ofs
< twice the timer interrupt cycle).
Note that the time returned in tim
and ofs
is the time at some point between the calling of and return from td_get_utc. It is neither the time at which td_get_utc was called nor the time of return from td_get_utc. In order to obtain more accurate information, this function should be called in interrupts disabled state.
Only when all the service profile items below are set to be effective, this system call can be used.
This system call takes 64-bit tim_u
in microseconds instead of the return parameter tim
of td_get_utc.
The specification of this system call is same as that of td_get_utc, except that the return parameter is replaced with tim_u
. For more details, see the description of td_get_utc.
ER |
ercd
| Error Code | Error code |
SYSTIM |
tim
| Time | Current time (in milliseconds) |
UW |
ofs
| Offset | Elapsed time from tim (in nanoseconds) |
tim
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the current time as total elapsed milliseconds since 0:00:00 (GMT), January 1, 1985. The value returned in tim
is the same as that obtained by tk_get_tim. tim
is the resolution of timer interrupt intervals (cycles), but even more precise time information is obtained in ofs
as the elapsed time from tim
in nanoseconds. The resolution of ofs
is implementation-dependent, but generally is the resolution of hardware timer.
Since tim
is a cumulative time counted based on timer interrupts, in some cases time is not refreshed, when a timer interrupt cycle arrives while interrupts are disabled and the timer interrupt handler is not started (is delayed). In such cases, the time as updated by the previous timer interrupt is returned in tim
, and the elapsed time from the previous timer interrupt is returned in ofs
. Accordingly, in some cases ofs
will be longer than the timer interrupt cycle. The length of elapsed time that can be measured by ofs
depends on the hardware, but preferably it should be possible to measure at least up to twice the timer interrupt cycle (0 ≦ ofs
< twice the timer interrupt cycle).
Note that the time returned in tim
and ofs
is the time at some point between the calling of and return from td_get_tim. It is neither the time at which td_get_tim was called nor the time of return from td_get_tim. In order to obtain more accurate information, this function should be called in interrupts disabled state.
td_get_tim is very similar to td_get_utc. However, it uses the time system with a different epoch. td_get_tim is an API to keep compatibility with legacy μT-Kernel or T-Kernel specifications.
Only when all the service profile items below are set to be effective, this system call can be used.
This system call takes 64-bit tim_u
in microseconds instead of the return parameter tim
of td_get_tim.
The specification of this system call is same as that of td_get_tim, except that the return parameter is replaced with tim_u
. For more details, see the description of td_get_tim.
td_get_tim_u is very similar to td_get_utc_u. However, it uses the time system with a different epoch. td_get_tim_u is an API to keep compatibility with legacy μT-Kernel or T-Kernel specifications.
ER |
ercd
| Error Code | Error code |
SYSTIM |
tim
| Time | Operating time (in milliseconds) |
UW |
ofs
| Offset | Elapsed time from tim (in nanoseconds) |
tim
Detail:
Only when all the service profile items below are set to be effective, this system call can be used.
Gets the system operating time (uptime, as elapsed milliseconds since the system was booted). The value returned in tim
is the same as that obtained by tk_get_otm. tim
is the resolution of timer interrupt intervals (cycles), but even more precise time information is obtained in ofs
as the elapsed time from tim
in nanoseconds. The resolution of ofs
is implementation-dependent, but generally is the resolution of hardware timer.
Since tim
is a cumulative time counted based on timer interrupts, in some cases time is not refreshed, when a timer interrupt cycle arrives while interrupts are disabled and the timer interrupt handler is not started (is delayed). In such cases, the time as updated by the previous timer interrupt is returned in tim
, and the elapsed time from the previous timer interrupt is returned in ofs
. Accordingly, in some cases ofs
will be longer than the timer interrupt cycle. The length of elapsed time that can be measured by ofs
depends on the hardware, but preferably it should be possible to measure at least up to twice the timer interrupt cycle (0 ≦ ofs
< twice the timer interrupt cycle).
Note that the time returned in tim
and ofs
is the time at some point between the calling of and return from td_get_otm. It is neither the time at which td_get_otm was called nor the time of return from td_get_otm. In order to obtain more accurate information, this function should be called in interrupts disabled state.
Only when all the service profile items below are set to be effective, this system call can be used.
This system call takes 64-bit tim_u
in microseconds instead of the return parameter tim
of td_get_otm.
The specification of this system call is same as that of td_get_otm, except that the return parameter is replaced with tim_u
. For more details, see the description of td_get_otm.
dsname
Detail:DS object name, set at object creation or by td_set_dsname
Only when all the service profile items below are set to be effective, this system call can be used.
References the DS object name (dsname
), which is set at object creation. The object is specified by object type (type
) and object ID (id
).
Object types (type
) are as follows:
TN_TSK | 0x01 | Task |
TN_SEM | 0x02 | Semaphore |
TN_FLG | 0x03 | Event Flag |
TN_MBX | 0x04 | Mailbox |
TN_MBF | 0x05 | Message Buffer |
TN_POR | 0x06 | (reserved) |
TN_MTX | 0x07 | Mutex |
TN_MPL | 0x08 | Variable-size Memory Pool |
TN_MPF | 0x09 | Fixed-size Memory Pool |
TN_CYC | 0x0a | Cyclic Handler |
TN_ALM | 0x0b | Alarm Handler |
DS object name is valid if TA_DSNAME is set as object attribute. If DS object name is changed by td_set_dsname, then td_ref_dsname references the new name.
DS object name needs to satisfy the following conditions. However, character code range is not checked by μT-Kernel.
a to z, A to Z, 0 to 9, _
Up to 8 bytes (not including '\0')
The DS object name that is read is terminated with a '\0' character. Hence, dsname
must have a area of 9 or more bytes.
Only when all the service profile items below are set to be effective, this system call can be used.
Re-sets DS object name (dsname
), which is set at object creation. The object is specified by object type (type
) and object ID (id
).
Object types (type
) are as same as that of td_ref_dsname.
DS object name needs to satisfy the following conditions. However, character code range is not checked by μT-Kernel.
a to z, A to Z, 0 to 9, _
Up to 8 bytes (not including '\0')
DS object name is valid if TA_DSNAME is set as object attribute. td_set_dsname returns E_OBJ error if TA_DSNAME attribute is not specified.