2 #include <irx_imports.h>
13 static struct thread *refer_thread(
int thid,
int current);
30 return KE_ILLEGAL_CONTEXT;
33 if (thparam->attr & ~(TH_ASM | TH_C | TH_UMODE | TH_NO_FILLSTACK | TH_CLEAR_STACK)) {
34 return KE_ILLEGAL_ATTR;
37 if ((u32)thparam->priority > (u32)126) {
38 return KE_ILLEGAL_PRIORITY;
41 if ((u32)thparam->thread & 3) {
42 return KE_ILLEGAL_ENTRY;
45 if ((u32)thparam->stacksize < (u32)0x130) {
46 return KE_ILLEGAL_STACK_SIZE;
57 thparam->stacksize = ALIGN_256(thparam->stacksize);
58 stack = AllocSysMemory(1, thparam->stacksize, NULL);
65 thread->tag.id = ++thctx.thread_id;
66 thread->entry = thparam->thread;
67 thread->stack_size = thparam->stacksize;
69 thread->init_priority = thparam->priority;
70 thread->attr = thparam->attr;
71 thread->option = thparam->option;
72 thread->status = THS_DORMANT;
75 list_insert(&thctx.thread_list, &
thread->thread_list);
77 if ((
thread->attr & TH_NO_FILLSTACK) == 0) {
79 memset(
thread->stack_top, 0xff,
thread->stack_size - 0x30);
84 return MAKE_HANDLE(
thread);
87 int DeleteThread(
int thid)
93 return KE_ILLEGAL_CONTEXT;
97 return KE_ILLEGAL_THID;
103 if (!HANDLE_VERIFY(thid, TAG_THREAD) ||
thread == thctx.idle_thread) {
105 return KE_UNKNOWN_THID;
108 if (
thread->status != THS_DORMANT) {
110 return KE_NOT_DORMANT;
113 if (
thread->attr & TH_CLEAR_STACK) {
117 FreeSysMemory(
thread->stack_top);
118 list_remove(&
thread->queue);
119 list_remove(&
thread->thread_list);
127 int StartThread(
int thid,
void *arg)
134 return KE_ILLEGAL_CONTEXT;
138 return KE_ILLEGAL_THID;
144 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
146 return KE_UNKNOWN_THID;
149 if (
thread->status != THS_DORMANT) {
151 return KE_NOT_DORMANT;
155 reg_offset = ALIGN(
thread->stack_size) - RESERVED_REGCTX_SIZE;
157 memset(
thread->saved_regs, 0, RESERVED_REGCTX_SIZE);
159 thread->saved_regs->a0 = (u32)arg;
161 return thread_init_and_start(
thread, state);
164 int StartThreadArgs(
int thid,
int args,
void *argp)
167 u32 arg_offset, reg_offset;
171 return KE_ILLEGAL_CONTEXT;
175 return KE_ILLEGAL_THID;
181 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
183 return KE_UNKNOWN_THID;
186 if (
thread->status != THS_DORMANT) {
188 return KE_NOT_DORMANT;
192 arg_offset = ALIGN(
thread->stack_size) - ALIGN(args);
193 if ((
int)args > (
int)0 && argp) {
194 memcpy(
thread->stack_top + arg_offset, argp, args);
201 reg_offset = arg_offset - RESERVED_REGCTX_SIZE;
204 memset(
thread->saved_regs, 0, RESERVED_REGCTX_SIZE);
206 thread->saved_regs->a0 = args;
207 thread->saved_regs->a1 = (u32)
thread->stack_top + arg_offset;
209 return thread_init_and_start(
thread, state);
217 return KE_ILLEGAL_CONTEXT;
221 thctx.current_thread->status = THS_DORMANT;
222 list_insert(&thctx.dormant_queue, &thctx.current_thread->queue);
223 thctx.run_next = NULL;
224 thread_leave(0, 0, state, 1);
226 Kprintf(
"panic ! Thread DORMANT !\n");
232 int ExitDeleteThread()
237 return KE_ILLEGAL_CONTEXT;
241 thctx.current_thread->status = THS_DORMANT;
242 list_insert(&thctx.delete_queue, &thctx.current_thread->queue);
243 thctx.run_next = NULL;
244 thread_leave(0, 0, state, 1);
246 Kprintf(
"panic ! Thread ExitDeleted !\n");
252 int TerminateThread(
int thid)
258 return KE_ILLEGAL_CONTEXT;
264 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
266 return KE_UNKNOWN_THID;
269 if (
thread->status == THS_DORMANT) {
274 if (
thread->status == THS_READY) {
277 list_remove(&
thread->queue);
278 if (
thread->wait_type == TSW_DELAY) {
279 CancelAlarm(thread_delay_cb,
thread);
280 }
else if ((
int)
thread->wait_type >= (
int)TSW_DELAY && (
int)
thread->wait_type <= (
int)TSW_FPL) {
281 thread->wait_event->waiter_count--;
285 thread->status = THS_DORMANT;
286 list_insert(&thctx.dormant_queue, &
thread->queue);
292 int iTerminateThread(
int thid)
297 return KE_ILLEGAL_CONTEXT;
301 return KE_ILLEGAL_THID;
305 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
306 return KE_UNKNOWN_THID;
309 if (
thread->status == THS_DORMANT) {
313 if (
thread == thctx.current_thread) {
314 thctx.run_next = NULL;
316 if (
thread->status == THS_READY) {
319 list_remove(&
thread->queue);
321 if (
thread->status == THS_WAIT) {
322 if (
thread->wait_type == TSW_DELAY) {
323 iCancelAlarm(thread_delay_cb,
thread);
324 }
else if ((
int)
thread->wait_type >= (
int)TSW_DELAY && (
int)
thread->wait_type <= (
int)TSW_FPL) {
325 thread->wait_event->waiter_count--;
331 thread->status = THS_DORMANT;
332 list_insert(&thctx.dormant_queue, &
thread->queue);
337 int DisableDispatchThread(
void)
342 int EnableDispatchThread(
void)
347 int ChangeThreadPriority(
int thid,
int priority)
353 return KE_ILLEGAL_CONTEXT;
359 thread = thctx.current_thread;
362 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
364 return KE_UNKNOWN_THID;
367 if (
thread->status == THS_DORMANT) {
374 if ((u32)(priority - 1) >= (u32)126) {
376 return KE_ILLEGAL_PRIORITY;
379 priority = thctx.current_thread->priority;
382 if (
thread == thctx.current_thread) {
383 if ((
int)priority >= (
int)readyq_highest()) {
384 thread->status = THS_READY;
385 thread->priority = priority;
386 readyq_insert_back(
thread);
387 thctx.run_next = NULL;
389 return thread_leave(KE_OK, 0, state, 0);
392 thread->priority = priority;
394 if (
thread->status == THS_READY) {
396 thread->priority = priority;
398 return thread_start(
thread, state);
406 if (
thread->status == THS_WAIT &&
thread->wait_type != TSW_DELAY) {
407 if (
thread->wait_event->attr & SA_THPRI) {
417 int iChangeThreadPriority(
int thid,
int priority)
422 return KE_ILLEGAL_CONTEXT;
426 return KE_ILLEGAL_THID;
430 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
431 return KE_UNKNOWN_THID;
434 if (
thread->status == THS_DORMANT) {
439 priority = thctx.current_thread->priority;
442 if ((u32)(priority - 1) >= (u32)126) {
443 return KE_ILLEGAL_PRIORITY;
446 if (
thread == thctx.current_thread) {
447 thread->status = THS_READY;
449 if (
thread->status != THS_READY) {
450 thread->priority = priority;
451 if (
thread->status != THS_WAIT ||
thread->wait_type == TSW_DELAY) {
455 if ((
thread->wait_event->attr & 1) == 0) {
463 thread->priority = priority;
464 readyq_insert_back(
thread);
465 thctx.run_next = NULL;
470 int RotateThreadReadyQueue(
int priority)
476 return KE_ILLEGAL_CONTEXT;
479 if ((u32)priority >= (u32)127) {
480 return KE_ILLEGAL_PRIORITY;
485 thread = thctx.current_thread;
488 priority =
thread->priority;
491 if (list_empty(&thctx.ready_queue[priority])) {
496 if (priority !=
thread->priority) {
497 thread = list_first_entry(&thctx.ready_queue[priority],
struct thread, queue);
498 list_remove(&
thread->queue);
499 list_insert(&thctx.ready_queue[priority], &
thread->queue);
505 thread->status = THS_READY;
506 readyq_insert_back(
thread);
507 thctx.run_next = NULL;
508 return thread_leave(KE_OK, 0, state, 0);
511 int iRotateThreadReadyQueue(
int priority)
516 return KE_ILLEGAL_CONTEXT;
519 thread = thctx.current_thread;
522 if ((u32)priority >= (u32)126) {
523 return KE_ILLEGAL_PRIORITY;
526 priority = readyq_highest();
527 if ((
int)
thread->priority < (
int)priority) {
528 priority =
thread->priority;
532 if (list_empty(&thctx.ready_queue[priority])) {
536 if (priority ==
thread->priority) {
537 thread->status = THS_READY;
538 readyq_insert_back(
thread);
539 thctx.run_next = NULL;
541 thread = list_first_entry(&thctx.ready_queue[priority],
struct thread, queue);
542 list_remove(&
thread->queue);
543 list_insert(&thctx.ready_queue[priority], &
thread->queue);
549 int ReleaseWaitThread(
int thid)
555 return KE_ILLEGAL_CONTEXT;
559 return KE_ILLEGAL_THID;
565 if (
thread == thctx.current_thread) {
567 return KE_ILLEGAL_THID;
570 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
572 return KE_UNKNOWN_THID;
575 if (
thread->status != THS_WAIT) {
580 thread->saved_regs->v0 = KE_RELEASE_WAIT;
581 list_remove(&
thread->queue);
582 thread->status = THS_READY;
584 if (
thread->wait_type == TSW_DELAY) {
585 CancelAlarm(thread_delay_cb,
thread);
586 }
else if ((
int)
thread->wait_type >= (
int)TSW_DELAY && (
int)
thread->wait_type <= (
int)TSW_FPL) {
587 thread->wait_event->waiter_count--;
590 return thread_start(
thread, state);
593 int iReleaseWaitThread(
int thid)
598 return KE_ILLEGAL_CONTEXT;
602 return KE_ILLEGAL_THID;
607 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
608 return KE_UNKNOWN_THID;
611 if (
thread->status != THS_WAIT) {
615 thread->saved_regs->v0 = KE_RELEASE_WAIT;
616 list_remove(&
thread->queue);
617 thread->status = THS_READY;
619 if (
thread->wait_type == TSW_DELAY) {
620 iCancelAlarm(thread_delay_cb,
thread);
621 }
else if ((
int)
thread->wait_type >= (
int)TSW_DELAY && (
int)
thread->wait_type <= (
int)TSW_FPL) {
622 thread->wait_event->waiter_count--;
625 readyq_insert_back(
thread);
626 thctx.run_next = NULL;
631 int GetThreadId(
void)
634 return KE_ILLEGAL_CONTEXT;
637 return MAKE_HANDLE(thctx.current_thread);
640 int CheckThreadStack(
void)
646 return check_thread_stack();
655 return KE_ILLEGAL_CONTEXT;
660 thread = refer_thread(thid, 1);
661 if ((
int)
thread < (
int)0) {
678 return KE_ILLEGAL_THID;
683 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
684 return KE_UNKNOWN_THID;
692 int SleepThread(
void)
698 return KE_ILLEGAL_CONTEXT;
701 if (
CpuSuspendIntr(&state) == KE_CPUDI && (thctx.debug_flags & 8)) {
702 Kprintf(
"WARNING: SleepThread KE_CAN_NOT_WAIT\n");
704 check_thread_stack();
706 thread = thctx.current_thread;
708 if (
thread->wakeup_count != 0) {
714 thread->status = THS_WAIT;
715 thread->wait_type = TSW_SLEEP;
716 thread->wait_event = NULL;
718 thctx.run_next = NULL;
720 list_insert(&thctx.sleep_queue, &
thread->queue);
722 return thread_leave(KE_OK, 0, state, 1);
725 int WakeupThread(
int thid)
731 return KE_ILLEGAL_CONTEXT;
735 return KE_ILLEGAL_THID;
741 if (
thread == thctx.current_thread) {
742 return KE_ILLEGAL_THID;
745 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
746 return KE_UNKNOWN_THID;
749 if (
thread->status == THS_DORMANT) {
754 if (
thread->status == THS_WAIT &&
thread->wait_type == TSW_SLEEP) {
755 list_remove(&
thread->queue);
756 thread->status = THS_READY;
758 return thread_start(
thread, state);
768 int iWakeupThread(
int thid)
773 return KE_ILLEGAL_CONTEXT;
777 return KE_ILLEGAL_THID;
781 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
782 return KE_UNKNOWN_THID;
785 if (
thread->status == THS_DORMANT) {
789 if (
thread->status == THS_WAIT &&
thread->wait_type == TSW_SLEEP) {
790 list_remove(&
thread->queue);
791 thread->status = THS_READY;
792 readyq_insert_back(
thread);
793 thctx.run_next = NULL;
801 int CancelWakeupThread(
int thid)
804 int state, wakeup_count;
807 return KE_ILLEGAL_CONTEXT;
813 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
815 return KE_UNKNOWN_THID;
818 thread = thctx.current_thread;
821 wakeup_count =
thread->wakeup_count;
828 int iCancelWakeupThread(
int thid)
834 return KE_ILLEGAL_CONTEXT;
838 return KE_ILLEGAL_THID;
842 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
843 return KE_UNKNOWN_THID;
846 wakeup_count =
thread->wakeup_count;
852 int SuspendThread(
int thid)
858 int iSuspendThread(
int thid)
864 int ResumeThread(
int thid)
870 int iResumeThread(
int thid)
876 int DelayThread(
int usec)
883 return KE_ILLEGAL_CONTEXT;
886 USec2SysClock(usec, &clock);
887 if (
CpuSuspendIntr(&state) == KE_CPUDI && (thctx.debug_flags & 8)) {
888 Kprintf(
"WARNING: DelayThread KE_CAN_NOT_WAIT\n");
890 check_thread_stack();
892 thread = thctx.current_thread;
894 ret = SetAlarm(&clock, thread_delay_cb,
thread);
900 thread->status = THS_WAIT;
901 thread->wait_type = TSW_DELAY;
902 thread->wait_usecs = usec;
905 thctx.run_next = NULL;
906 list_insert(&thctx.delay_queue, &
thread->queue);
908 return thread_leave(KE_OK, 0, state, 1);
917 int SetAlarm(
iop_sys_clock_t *sys_clock,
unsigned int (*alarm_cb)(
void *userdata),
void *arg)
925 return KE_ILLEGAL_CONTEXT;
930 if (!list_empty(&thctx.alarm)) {
931 list_for_each (
alarm, &thctx.alarm, alarm_list) {
932 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
934 return KE_FOUND_HANDLER;
939 alarm = alarm_alloc();
945 if (sys_clock->hi == 0 && (u32)sys_clock->lo < (u32)thctx.min_wait) {
946 sys_clock->lo = thctx.min_wait;
949 GetSystemTime(&systime);
952 alarm->target = add64(sys_clock->hi, sys_clock->lo, systime.hi, systime.lo);
953 alarm->cb = alarm_cb;
954 alarm->userptr = arg;
956 alarm_insert(&thctx.alarm,
alarm);
958 GetSystemTime(&systime);
959 time = as_u64(systime.hi, systime.lo);
960 update_timer_compare(thctx.timer_id, time, &thctx.alarm);
967 int iSetAlarm(
iop_sys_clock_t *sys_clock,
unsigned int (*alarm_cb)(
void *userdata),
void *arg)
974 return KE_ILLEGAL_CONTEXT;
977 list_for_each (
alarm, &thctx.alarm, alarm_list) {
978 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
979 return KE_FOUND_HANDLER;
983 alarm = alarm_alloc();
988 if (sys_clock->hi == 0 && (u32)sys_clock->lo < (u32)thctx.min_wait) {
989 sys_clock->lo = thctx.min_wait;
992 read_sys_time(&systime);
994 alarm->target = add64(sys_clock->hi, sys_clock->lo, systime.hi, systime.lo);
995 alarm->cb = alarm_cb;
996 alarm->userptr = arg;
998 alarm_insert(&thctx.alarm,
alarm);
999 read_sys_time(&systime);
1000 time = as_u64(systime.hi, systime.lo);
1001 update_timer_compare(thctx.timer_id, time, &thctx.alarm);
1006 int CancelAlarm(
unsigned int (*alarm_cb)(
void *userdata),
void *arg)
1012 return KE_ILLEGAL_CONTEXT;
1017 if (list_empty(&thctx.alarm)) {
1019 return KE_NOTFOUND_HANDLER;
1022 list_for_each (
alarm, &thctx.alarm, alarm_list) {
1023 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
1024 list_remove(&
alarm->alarm_list);
1026 thctx.alarm_count--;
1035 return KE_NOTFOUND_HANDLER;
1038 int iCancelAlarm(
unsigned int (*alarm_cb)(
void *userdata),
void *arg)
1043 return KE_ILLEGAL_CONTEXT;
1046 if (list_empty(&thctx.alarm)) {
1047 return KE_NOTFOUND_HANDLER;
1050 list_for_each (
alarm, &thctx.alarm, alarm_list) {
1051 if (
alarm->cb == alarm_cb &&
alarm->userptr == arg) {
1052 list_remove(&
alarm->alarm_list);
1054 thctx.alarm_count--;
1060 return KE_NOTFOUND_HANDLER;
1066 sys_clock->lo = usec;
1067 clock_mul(sys_clock, sys_clock, thctx.unk_clock_mult);
1068 clock_div(sys_clock, sys_clock, thctx.unk_clock_div, NULL);
1074 clock_mul(&clock, sys_clock, thctx.unk_clock_div);
1075 clock_div(&clock, &clock, thctx.unk_clock_mult, NULL);
1076 clock_div(&clock, &clock, 1000000, usec);
1080 int GetSystemStatusFlag()
1082 return thctx.sytem_status_flag;
1085 int GetThreadCurrentPriority(
void)
1088 return KE_ILLEGAL_CONTEXT;
1091 return thctx.current_thread->priority;
1094 unsigned int GetSystemTimeLow(
void)
1096 return GetTimerCounter(thctx.timer_id);
1102 if ((u32)size < (u32)
sizeof(*
info)) {
1106 memset(
info, 0, size);
1110 info->status =
QueryIntrContext() ? TSS_NOTHREAD : ((ret == KE_CPUDI) ? TSS_DISABLEINTR : TSS_THREAD);
1112 info->systemLowTimerWidth = 32;
1113 info->idleClocks.hi = thctx.idle_thread->run_clocks_hi;
1114 info->idleClocks.lo = thctx.idle_thread->run_clocks_lo;
1115 info->threadSwitchCount = thctx.thread_switch_count;
1116 info->comesOutOfIdleCount = thctx.idle_thread->irq_preemption_count;
1129 return KE_ILLEGAL_CONTEXT;
1134 thread = refer_thread(thid, 1);
1135 if ((
int)
thread <= (
int)0) {
1140 if ((u32)size < (u32)
sizeof(*stat)) {
1142 return KE_ILLEGAL_SIZE;
1145 memset(stat, 0, size);
1146 thread_get_run_stats(
thread, stat);
1156 int GetThreadStackFreeSize(
int thid)
1164 return KE_ILLEGAL_CONTEXT;
1169 thread = refer_thread(thid, 1);
1170 if ((
int)
thread < (
int)0) {
1175 stack = (u32 *)
thread->stack_top;
1176 stack_size =
thread->stack_size / 4;
1179 for (i = 0; (u32)i < (u32)stack_size; i++) {
1180 if (stack[i] != (u32)-1) {
1189 int GetThreadmanIdList(
int type,
int *readbuf,
int readbufsize,
int *objectcount)
1191 int state, write_count, obj_count;
1194 return KE_ILLEGAL_CONTEXT;
1205 list_for_each (
thread, &thctx.thread_list, thread_list) {
1206 if (
thread != thctx.idle_thread) {
1207 if ((
int)write_count < (
int)readbufsize) {
1208 *readbuf++ = MAKE_HANDLE(
thread);
1215 case TMID_Semaphore: {
1217 list_for_each (sema, &thctx.semaphore, sema_list) {
1218 if ((
int)write_count < (
int)readbufsize) {
1219 *readbuf++ = MAKE_HANDLE(sema);
1225 case TMID_EventFlag: {
1227 list_for_each (evf, &thctx.event_flag, evf_list) {
1228 if ((
int)write_count < (
int)readbufsize) {
1229 *readbuf++ = MAKE_HANDLE(evf);
1237 list_for_each (mbx, &thctx.mbox, mbox_list) {
1238 if ((
int)write_count < (
int)readbufsize) {
1239 *readbuf++ = MAKE_HANDLE(mbx);
1247 list_for_each (vpl, &thctx.vpool, vpl_list) {
1248 if ((
int)write_count < (
int)readbufsize) {
1249 *readbuf++ = MAKE_HANDLE(vpl);
1257 list_for_each (fpl, &thctx.fpool, fpl_list) {
1258 if ((
int)write_count < (
int)readbufsize) {
1259 *readbuf++ = MAKE_HANDLE(fpl);
1265 case TMID_SleepThread: {
1267 list_for_each (
thread, &thctx.sleep_queue, queue) {
1268 if ((
int)write_count < (
int)readbufsize) {
1269 *readbuf++ = MAKE_HANDLE(
thread);
1275 case TMID_DelayThread: {
1277 list_for_each (
thread, &thctx.delay_queue, queue) {
1278 if ((
int)write_count < (
int)readbufsize) {
1279 *readbuf++ = MAKE_HANDLE(
thread);
1285 case TMID_DormantThread: {
1287 list_for_each (
thread, &thctx.dormant_queue, queue) {
1288 if ((
int)write_count < (
int)readbufsize) {
1289 *readbuf++ = MAKE_HANDLE(
thread);
1300 if ((
int)type < (int)0 || (u32)tag->tag < (u32)TAG_SEMA || (u32)tag->tag > (u32)TAG_FPL || tag->id != HANDLE_ID(type)) {
1302 return KE_ILLEGAL_TYPE;
1307 event = &((
struct semaphore *)tag)->event;
1313 event = &((
struct mbox *)tag)->event;
1316 event = &((
struct vpool *)tag)->event;
1319 event = &((
struct fpool *)tag)->event;
1324 if ((
int)write_count < (
int)readbufsize) {
1325 *readbuf++ = MAKE_HANDLE(
thread);
1336 *objectcount = obj_count;
1345 res = (u64)src->hi << 32 | src->lo;
1348 dst->hi = res >> 32;
1368 for (i = 0; (int)i < (
int)
sizeof(*r); ++i) {
1369 hi = (v8 << 8) | (lo >> 24);
1371 v4 = (v4 << 8) | (v9 >> 24);
1373 v9 = (v9 << 8) + (hi / d);
1385 static struct thread *refer_thread(
int thid,
int current)
1389 if (!thid && current) {
1390 return thctx.current_thread;
1393 if ((
int)thid <= (
int)0) {
1394 return (
struct thread *)KE_UNKNOWN_THID;
1398 if (!HANDLE_VERIFY(thid, TAG_THREAD)) {
1399 return (
struct thread *)KE_UNKNOWN_THID;
1418 if (
thread->status == THS_WAIT) {
1420 if (
thread->wait_type == TSW_DELAY) {
1423 switch (
thread->wait_type) {
1452 stat->status =
thread->status;
1453 stat->currentPriority =
thread->priority;
1455 if (
thread->status == THS_WAIT) {
1456 stat->waitType =
thread->wait_type;
1457 if (
thread->wait_type == TSW_DELAY) {
1458 stat->waitId =
thread->wait_usecs;
1460 switch (
thread->wait_type) {
1468 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct mbox,
event));
1471 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct fpool,
event));
1474 stat->waitId = MAKE_HANDLE(container_of(
thread->wait_event,
struct vpool,
event));
1483 stat->wakeupCount =
thread->wakeup_count;
1485 stat->regContext = (
long *)
thread->saved_regs;
1488 stat->runClocks.hi =
thread->run_clocks_hi;
1489 stat->runClocks.lo =
thread->run_clocks_lo;
1490 stat->intrPreemptCount =
thread->irq_preemption_count;
1491 stat->threadPreemptCount =
thread->thread_preemption_count;
1492 stat->releaseCount =
thread->release_count;