home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 1996 September
/
pcwk_09_96.iso
/
demo
/
wgelectr
/
pk51demo
/
files.2
/
EXAMPLES
/
TRAFFIC
/
DBG_TINY.DSW
next >
Wrap
Text File
|
1995-09-22
|
2KB
|
44 lines
func void tasks () {
uchar i;
uint adr;
printf ("+----------+-------+---------+------------------+--------+-------+-------+\n");
printf ("| Task ID | Start | State | Wait for Event | Signal | Timer | Stack |\n");
printf ("+----------+-------+---------+------------------+--------+-------+-------+\n");
for (i = 0; i <= ?RTX_TASKIDX; i++) {
printf ("| %2d | ", i);
adr = &?RTX_TASKENTRY + i*2;
printf ("%04XH | ", uint (c:adr));
adr = &?RTX_TASKSTATUS + i*2;
if (RTX_CURRENTTASK == i &&
(uchar (i:adr+1) & 0x10)) printf ("RUNNING | ");
else if (uchar (i:adr+1) & 0x40) printf ("TIMEOUT | ");
else if (uchar (i:adr+1) & 0x10) printf ("READY | ");
else if (uchar (i:adr+1) & 0x03) printf ("WAITING | ");
else if (uchar (i:adr+1) == 0) printf ("DELETED | ");
else printf ("ILLEGAL | ");
switch (uchar (i:adr+1) & 0x03) {
case 0: printf (" "); break;
case 1: printf ("SIGNAL "); break;
case 2: printf ("TIMEOUT "); break;
case 3: printf ("SIGNAL & TIMEOUT"); break;
}
if (uchar (i:adr+1) & 0x04) printf (" | 1");
else printf (" | 0");
printf (" | %3d |", uchar (i:adr));
adr = &?RTX_TASKSP + i;
printf (" %02XH |", uchar (i:adr));
printf ("\n");
}
printf ("+----------+-------+---------+------------------+--------+-------+-------+\n");
}
define button "Task State", "tasks ()"
bs ?RTX_NEXTTASK, 1, "printf (\"Switch to Task %d\\n\", R7)"