unsigned long qKey( Q_HEAD *pQHead, Q_NODE *pQNode, int keyType ) { return Q_KEY(pQHead, pQNode, keyType); }
ULONG qKey ( Q_HEAD *pQHead, Q_NODE *pQNode, int keyType ) { return (Q_KEY (pQHead, pQNode, keyType)); }
STATUS msgQShow( MSG_Q_ID msgQId, int mode ) { STATUS status; MSG_Q_INFO info; TCB_ID tcbId; char tmpString[15]; int level; int taskIdList[20], taskDList[20]; char *msgPtrList[20]; int msgLengthList[20]; int i, j, len; char *pMsg; /* Clear info */ memset(&info, 0, sizeof(info)); /* If mode ge. 1 */ if (mode >= 1) { /* Get info for each message, task pending */ info.taskIdList = taskIdList; info.taskIdListMax = NELEMENTS(taskIdList); info.msgPtrList = msgPtrList; info.msgLengthList = msgLengthList; info.msgListMax = NELEMENTS(msgPtrList); } /* Lock interrupts */ INT_LOCK(level); /* Get message queue info structure */ status = msgQInfoGet(msgQId, &info); if (status != OK) { INT_UNLOCK(level); printf("Invalid message queue id: %#x\n", (int) msgQId); } else { /* If show tasks pending */ if ((info.numTask > 0) && (mode >= 1)) { /* For all in id list */ for (i = 0; i < min(info.numTask, NELEMENTS(taskIdList)); i++) { /* Get tcb */ tcbId = (TCB_ID) taskIdList[i]; if (tcbId->status & TASK_DELAY) { taskDList[i] = Q_KEY(&tickQHead, &tcbId->tickNode, 1); } else { taskDList[i] = 0; } } } /* Unlock interrupts */ INT_UNLOCK(level); /* Get options string */ if ((info.options & MSG_Q_TYPE_MASK) == MSG_Q_FIFO) { strcpy(tmpString, "MSG_Q_FIFO"); } else { strcpy(tmpString, "MSG_Q_PRIORITY"); } /* Print summary */ printf("\n"); printf("Message Queue Id : 0x%-10x\n", (int) msgQId); if ((info.options & MSG_Q_TYPE_MASK) == MSG_Q_FIFO) { printf("Task Queuing : %-10s\n", "FIFO"); } else { printf("Task Queuing : %-10s\n", "PRIORITY"); } printf("Message Byte Len : %-10d\n", info.maxMsgLength); printf("Messages Max : %-10d\n", info.maxMsg); printf("Messages Queued : %-10d\n", info.numMsg); if (info.numMsg == info.maxMsg) { printf("Senders Blocked : %-10d\n", info.numTask); } else { printf("Receivers Blocked : %-10d\n", info.numTask); } printf("Send timeouts : %-10d\n", info.sendTimeouts); printf("Receive timeouts : %-10d\n", info.reciveTimeouts); printf("Options : 0x%x\t%s\n", info.options, tmpString); /* If detailed info requested */ if (mode >= 1) { /* If tasks pending */ if (info.numTask > 0) { /* Get sender/receiver string */ if (info.numMsg == info.maxMsg) { strcpy(tmpString, "Senders"); } else { strcpy(tmpString, "Receivers"); } printf("\n%s Blocked:\n", tmpString); printf(" NAME TID PRI TIMEOUT\n"); printf("---------- -------- --- -------\n"); /* For all tasks */ for (i = 0; i < min(info.numTask, NELEMENTS(taskIdList)); i++) { printf( "%-11.11s%8x %3d %7u\n", taskName(taskIdList[i]), taskIdList[i], ((TCB_ID) taskIdList[i])->priority, taskDList[i] ); } } /* If messages pending */ if (info.numMsg > 0) { printf( "\nMessages queued:\n" " # address length value\n" ); /* For all messages */ for (i = 0; i < min(info.numMsg, NELEMENTS(msgPtrList)); i++) { /* Get message and length */ pMsg = msgPtrList[i]; len = msgLengthList[i]; printf("%3d %#10x %4d ", i + 1, (int) pMsg, len); /* For length */ for (j = 0; j < min(len, 20); j++) { if ((j % 4) == 0) { printf(" 0x"); } printf("%02x", pMsg[j] & 0xff); } if (len > 20) { printf(" ..."); } printf("\n"); } } } printf("\n"); } return status; }
STATUS taskInfoGet ( int tid, /* ID of task for which to get info */ TASK_DESC *pTaskDesc /* task descriptor to be filled in */ ) { int key; FAST char *pStackHigh; FAST TASK_DESC *pTd = pTaskDesc; WIND_TCB *pTcb = taskTcb (tid); if (pTcb == NULL) /* valid task ID? */ return (ERROR); /* gather the information */ #if CPU_FAMILY==I960 if (tid != taskIdSelf ()) /* showing our current sp is not possible */ taskRegsStackToTcb (pTcb); #endif /* CPU_FAMILY==I960 */ pTd->td_id = (int) pTcb; /* task ID */ pTd->td_name = pTcb->name; /* name of task */ pTd->td_priority = (int) pTcb->priority; /* priority */ pTd->td_status = pTcb->status; /* task status*/ pTd->td_options = pTcb->options; /* task option bits */ pTd->td_entry = pTcb->entry; /* entry of task */ pTd->td_sp = (char *)((int)pTcb->regs.spReg); /* saved stack ptr */ pTd->td_pStackLimit = pTcb->pStackLimit; /* limit of stack */ pTd->td_pStackBase = pTcb->pStackBase; /* bottom of stack */ pTd->td_pStackEnd = pTcb->pStackEnd; /* end of the stack */ #if (_STACK_DIR==_STACK_GROWS_DOWN) if (pTcb->options & VX_NO_STACK_FILL) pStackHigh = pTcb->pStackLimit; else for (pStackHigh = pTcb->pStackLimit; *(UINT8 *)pStackHigh == 0xee; pStackHigh ++) ; #else /* _STACK_GROWS_UP */ if (pTcb->options & VX_NO_STACK_FILL) pStackHigh = pTcb->pStackLimit - 1; else for (pStackHigh = pTcb->pStackLimit - 1; *(UINT8 *)pStackHigh == 0xee; pStackHigh --) ; #endif /* _STACK_GROWS_UP */ pTd->td_stackSize = (int)(pTcb->pStackLimit - pTcb->pStackBase) * _STACK_DIR; pTd->td_stackHigh = (int)(pStackHigh - pTcb->pStackBase) * _STACK_DIR; pTd->td_stackMargin = (int)(pTcb->pStackLimit - pStackHigh) * _STACK_DIR; pTd->td_stackCurrent= (int)(pTd->td_sp - pTcb->pStackBase) * _STACK_DIR; pTd->td_errorStatus = errnoOfTaskGet (tid); /* most recent error */ /* if task is delayed, get the time to fire out of the task's tick node */ if (pTcb->status & WIND_DELAY) pTd->td_delay = Q_KEY (&tickQHead, &pTcb->tickNode, 1); else pTd->td_delay = 0; /* not delayed */ /* copy the VxWorks events information */ key = intLock (); pTd->td_events = pTcb->events; intUnlock (key); return (OK); }