keilc pic的版本 才搞到的 希望对大家有帮助
源代码在线查看: dbg_tiny.inc
func void tasks (void) {
unsigned char __i;
unsigned long __adr;
printf ("+---------------------------------------------------------------------------+\n");
printf ("| TaskID | Start | State | Wait for Event | Sig | Timer | USRSP | SYSSP |\n");
printf ("+--------+-------+---------+------------------+-----+-------+-------+-------+");
for ( __i = 0 ; __i printf ("\n| %2d | ", __i);
__adr = &?RTX_TASKIP + __i*2;
printf ("%04XH | ", (unsigned int) __adr);
__adr = &?RTX_STATE + __i;
if (?RTX_CURRENT == __i &&
( ((unsigned char) __adr) & 0x10)) printf ("RUNNING | ");
else if (((unsigned char) __adr) & 0x40) printf ("TIMEOUT | ");
else if (((unsigned char) __adr) & 0x10) printf ("READY | ");
else if (((unsigned char) __adr) & 0x03) printf ("WAITING | ");
else if (((unsigned char) __adr) == 0) printf ("DELETED | ");
else printf ("ILLEGAL | ");
switch ((unsigned char) __adr & 0x03) {
case 0: printf (" "); break;
case 1: printf ("SIGNAL "); break;
case 2: printf ("TIMEOUT "); break;
case 3: printf ("SIGNAL & TIMEOUT"); break;
}
if ((unsigned char) __adr & 0x04) printf (" | 1");
else printf (" | 0");
__adr = &?RTX_TIMER + (__i*2);
printf (" | %5d |", (unsigned int) __adr);
__adr = &?RTX_USRSP + (__i*2);
printf (" %04XH |", (unsigned int) __adr);
__adr = &?RTX_SYSSP + (__i*2);
printf (" %04XH |", (unsigned int) __adr);
}
printf ("\n+--------+-------+---------+------------------+-----+-------+-------+-------+\n");
}
/* define button "Task State", "tasks()" */
/* bs ?RTX_NEXTTASK, 1, "printf (\"Switch to Task %d\\n\", R4)" */