📄 tcf.c
字号:
/* specified location. The number of task pointers placed in the *//* list is equivalent to the total number of tasks or the maximum *//* number of pointers specified in the call. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* [TCT_Check_Stack] Stack checking function *//* TCT_System_Protect Protect task created list *//* TCT_Unprotect Release protection of list *//* *//* INPUTS *//* *//* pointer_list Pointer to the list area *//* maximum_pointers Maximum number of pointers *//* *//* OUTPUTS *//* *//* pointers Number of tasks placed in *//* list *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 08-09-1993 Corrected pointer retrieval *//* loop, resulting in version 1.0c *//* 08-09-1993 Verified version 1.0c *//* 03-01-1994 Modified function interface, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/UNSIGNED TCF_Task_Pointers(NU_TASK **pointer_list, UNSIGNED maximum_pointers){CS_NODE *node_ptr; /* Pointer to each TCB */UNSIGNED pointers; /* Number of pointers in list*/NU_SUPERV_USER_VARIABLES /* Switch to supervisor mode */ NU_SUPERVISOR_MODE();#ifdef NU_ENABLE_STACK_CHECK /* Call stack checking function to check for an overflow condition. */ TCT_Check_Stack();#endif /* Initialize the number of pointers returned. */ pointers = 0; /* Protect the task created list. */ TCT_Protect(&TCD_List_Protect); /* Loop until all task pointers are in the list or until the maximum list size is reached. */ node_ptr = TCD_Created_Tasks_List; while ((node_ptr) && (pointers < maximum_pointers)) { /* Place the node into the destination list. */ *pointer_list++ = (NU_TASK *) node_ptr; /* Increment the pointers variable. */ pointers++; /* Position the node pointer to the next node. */ node_ptr = node_ptr -> cs_next; /* Determine if the pointer is at the head of the list. */ if (node_ptr == TCD_Created_Tasks_List) /* The list search is complete. */ node_ptr = NU_NULL; } /* Release protection. */ TCT_Unprotect(); /* Return to user mode */ NU_USER_MODE(); /* Return the number of pointers in the list. */ return(pointers);}/*************************************************************************//* *//* FUNCTION *//* *//* TCF_HISR_Pointers *//* *//* DESCRIPTION *//* *//* This function builds a list of HISR pointers, starting at the *//* specified location. The number of HISR pointers placed in the *//* list is equivalent to the total number of HISRs or the maximum *//* number of pointers specified in the call. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* [TCT_Check_Stack] Stack checking function *//* TCT_Protect Protect HISR created list *//* TCT_Unprotect Release protection of list *//* *//* INPUTS *//* *//* pointer_list Pointer to the list area *//* maximum_pointers Maximum number of pointers *//* *//* OUTPUTS *//* *//* Number of HISRs placed in *//* list *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 08-09-1993 Corrected pointer retrieval *//* loop, resulting in version 1.0c *//* 08-09-1993 Verified version 1.0c *//* 03-01-1994 Modified function interface, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/UNSIGNED TCF_HISR_Pointers(NU_HISR **pointer_list, UNSIGNED maximum_pointers){CS_NODE *node_ptr; /* Pointer to each TCB */UNSIGNED pointers; /* Number of pointers in list*/NU_SUPERV_USER_VARIABLES /* Switch to supervisor mode */ NU_SUPERVISOR_MODE();#ifdef NU_ENABLE_STACK_CHECK /* Call stack checking function to check for an overflow condition. */ TCT_Check_Stack();#endif /* Initialize the number of pointers returned. */ pointers = 0; /* Protect the HISR created list. */ TCT_Protect(&TCD_HISR_Protect); /* Loop until all HISR pointers are in the list or until the maximum list size is reached. */ node_ptr = TCD_Created_HISRs_List; while ((node_ptr) && (pointers < maximum_pointers)) { /* Place the node into the destination list. */ *pointer_list++ = (NU_HISR *) node_ptr; /* Increment the pointers variable. */ pointers++; /* Position the node pointer to the next node. */ node_ptr = node_ptr -> cs_next; /* Determine if the pointer is at the head of the list. */ if (node_ptr == TCD_Created_HISRs_List) /* The list search is complete. */ node_ptr = NU_NULL; } /* Release protection. */ TCT_Unprotect(); /* Return to user mode */ NU_USER_MODE(); /* Return the number of pointers in the list. */ return(pointers);}/*************************************************************************//* *//* FUNCTION *//* *//* TCF_Task_Information *//* *//* DESCRIPTION *//* *//* This function returns information about the specified task. *//* However, if the supplied task pointer is invalid, the function *//* simply returns an error status. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* [TCT_Check_Stack] Stack checking function *//* TCT_System_Protect Protect scheduling info *//* TCT_Unprotect Release protection *//* *//* INPUTS *//* *//* task_ptr Pointer to the task *//* name Destination for the name *//* status Destination for task status *//* scheduled_count Destination for scheduled */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -