📄 tcf.c
字号:
/* 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 */
/* count of the task */
/* priority Destination for task priority*/
/* preempt Destination for preempt flag */
/* time_slice Destination for time slice */
/* stack_base Destination for pointer to */
/* base of task's stack */
/* stack_size Destination for stack size */
/* minimum_stack Destination for the minimum */
/* running size of the stack */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS If a valid task pointer is */
/* supplied */
/* NU_INVALID_TASK If task pointer is invalid */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* changed protection logic, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 11-18-1996 Corrected SPR220. */
/* */
/*************************************************************************/
STATUS TCF_Task_Information(NU_TASK *task_ptr, CHAR *name,
DATA_ELEMENT *status, UNSIGNED *scheduled_count,
DATA_ELEMENT *priority, OPTION *preempt, UNSIGNED *time_slice,
VOID **stack_base, UNSIGNED *stack_size, UNSIGNED *minimum_stack)
{
R1 TC_TCB *task; /* Task control block ptr */
INT i; /* Working index */
STATUS completion; /* Completion status */
/* Move task control block pointer into internal pointer. */
task = (TC_TCB *) task_ptr;
#ifdef NU_ENABLE_STACK_CHECK
/* Call stack checking function to check for an overflow condition. */
TCT_Check_Stack();
#endif
/* Determine if this task is valid. */
if ((task != NU_NULL) && (task -> tc_id == TC_TASK_ID))
{
/* Protect against scheduling changes. */
TCT_System_Protect();
/* The task pointer is successful. Reflect this in the completion
status and fill in the actual information. */
completion = NU_SUCCESS;
/* Copy the task's name. */
for (i = 0; i < NU_MAX_NAME; i++)
*name++ = task -> tc_name[i];
/* Determine the preemption posture. */
if (task -> tc_preemption)
*preempt = NU_PREEMPT;
else
*preempt = NU_NO_PREEMPT;
/* Setup the remaining fields. */
*status = task -> tc_status;
*scheduled_count = task -> tc_scheduled;
*priority = task -> tc_priority;
*time_slice = task -> tc_time_slice;
*stack_base = task -> tc_stack_start;
*stack_size = task -> tc_stack_size;
*minimum_stack = task -> tc_stack_minimum;
/* Release protection. */
TCT_Unprotect();
}
else
/* Indicate that the task pointer is invalid. */
completion = NU_INVALID_TASK;
/* Return the appropriate completion status. */
return(completion);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCF_HISR_Information */
/* */
/* DESCRIPTION */
/* */
/* This function returns information about the specified HISR. */
/* However, if the supplied HISR pointer is invalid, the function */
/* simply returns an error status. */
/* */
/* AUTHOR */
/* */
/* Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_System_Protect Protect scheduling info */
/* TCT_Unprotect Release protection */
/* */
/* INPUTS */
/* */
/* hisr_ptr Pointer to the hisr */
/* name Destination for the name */
/* scheduled_count Destination for scheduled */
/* count of the HISR */
/* priority Destination for HISR priority*/
/* stack_base Destination for pointer to */
/* base of HISR's stack */
/* stack_size Destination for stack size */
/* minimum_stack Destination for the minimum */
/* running size of the stack */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS If a valid HISR pointer is */
/* supplied */
/* NU_INVALID_HISR If HISR pointer is invalid */
/* */
/* HISTORY */
/* */
/* DATE REMARKS */
/* */
/* 03-01-1993 Created initial version 1.0 */
/* 04-19-1993 Verified version 1.0 */
/* 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* changed protection logic, */
/* resulting in version 1.1 */
/* */
/* 03-18-1994 Verified version 1.1 */
/* 11-18-1996 Corrected SPR220. */
/* */
/*************************************************************************/
STATUS TCF_HISR_Information(NU_HISR *hisr_ptr, CHAR *name,
UNSIGNED *scheduled_count, DATA_ELEMENT *priority,
VOID **stack_base, UNSIGNED *stack_size, UNSIGNED *minimum_stack)
{
R1 TC_HCB *hisr; /* HISR control block ptr */
INT i; /* Working index */
STATUS completion; /* Completion status */
/* Move input HISR control block pointer into internal pointer. */
hisr = (TC_HCB *) hisr_ptr;
#ifdef NU_ENABLE_STACK_CHECK
/* Call stack checking function to check for an overflow condition. */
TCT_Check_Stack();
#endif
/* Determine if this HISR is valid. */
if ((hisr != NU_NULL) && (hisr -> tc_id == TC_HISR_ID))
{
/* Protect against scheduling changes. */
TCT_System_Protect();
/* The HISR pointer is successful. Reflect this in the completion
status and fill in the actual information. */
completion = NU_SUCCESS;
/* Copy the hisr's name. */
for (i = 0; i < NU_MAX_NAME; i++)
*name++ = hisr -> tc_name[i];
/* Setup the remaining fields. */
*scheduled_count = hisr -> tc_scheduled;
*priority = hisr -> tc_priority;
*stack_base = hisr -> tc_stack_start;
*stack_size = hisr -> tc_stack_size;
*minimum_stack = hisr -> tc_stack_minimum;
/* Release protection. */
TCT_Unprotect();
}
else
/* Indicate that the HISR pointer is invalid. */
completion = NU_INVALID_HISR;
/* Return the appropriate completion status. */
return(completion);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -