📄 tcc.c
字号:
for (i = 0; i < NU_MAX_NAME; i++)
hisr -> tc_name[i] = name[i];
/* Fill in the basic HISR information. */
hisr -> tc_entry = hisr_entry;
hisr -> tc_scheduled = 0;
hisr -> tc_activation_count = 0;
hisr -> tc_cur_time_slice = 0;
/* Fill in information about the HISR's stack. */
hisr -> tc_stack_start = stack_address;
hisr -> tc_stack_end = 0;
hisr -> tc_stack_size = stack_size;
hisr -> tc_stack_minimum = stack_size;
/* Setup priority information for the HISR. Priorities range from 0 to
TC_HISR_PRIORITIES - 1. */
hisr -> tc_priority = priority & 3;
/* Initialize link pointers. */
hisr -> tc_created.cs_previous = NU_NULL;
hisr -> tc_created.cs_next = NU_NULL;
hisr -> tc_active_next = NU_NULL;
/* Clear protect pointer. */
hisr -> tc_current_protect = NU_NULL;
/* Build a stack frame for this HISR by calling TCT_Build_HISR_Stack. */
TCT_Build_HISR_Stack(hisr);
/* Protect the list of created HISRs. */
TCT_Protect(&TCD_HISR_Protect);
/* At this point the HISR is completely built. The ID can now be
set and it can be linked into the created HISR list. */
hisr -> tc_id = TC_HISR_ID;
/* Link the HISR into the list of created HISRs and increment the
total number of HISRs in the system. */
CSC_Place_On_List(&TCD_Created_HISRs_List, &(hisr -> tc_created));
TCD_Total_HISRs++;
/* Release the protection. */
TCT_Unprotect();
/* Return successful completion. */
return(NU_SUCCESS);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCC_Delete_Task */
/* */
/* DESCRIPTION */
/* */
/* This function deletes a task and removes it from the list of */
/* created tasks. It is assumed by this function that the task is */
/* in a finished or terminated state. Note that this function */
/* does not free memory associated with the task's control block or */
/* its stack. This is the responsibility of the application. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* TCCE_Delete_Task Error checking shell */
/* */
/* CALLS */
/* */
/* CSC_Remove_From_List Remove node from list */
/* [HIC_Make_History_Entry] Make entry in history log */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_Protect Protect created task list */
/* TCT_Unprotect Release protection of list */
/* */
/* INPUTS */
/* */
/* task_ptr Task control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* resulting in version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS TCC_Delete_Task(NU_TASK *task_ptr)
{
R1 TC_TCB *task; /* Task control block ptr */
/* Move input task 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
#ifdef NU_ENABLE_HISTORY
/* Make an entry that corresponds to this function in the system history
log. */
HIC_Make_History_Entry(NU_DELETE_TASK_ID, (UNSIGNED) task,
(UNSIGNED) 0, (UNSIGNED) 0);
#endif
/* Protect the list of created tasks. */
TCT_Protect(&TCD_List_Protect);
/* Remove the task from the list of created tasks. */
CSC_Remove_From_List(&TCD_Created_Tasks_List, &(task -> tc_created));
/* Decrement the total number of created tasks. */
TCD_Total_Tasks--;
/* Clear the task ID just in case. */
task -> tc_id = 0;
/* Release protection. */
TCT_Unprotect();
/* Return a successful completion. */
return(NU_SUCCESS);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCC_Delete_HISR */
/* */
/* DESCRIPTION */
/* */
/* This function deletes a HISR and removes it from the list of */
/* created HISRs. It is assumed by this function that the HISR is */
/* in a non-active state. Note that this function does not free */
/* memory associated with the HISR's control block or its stack. */
/* This is the responsibility of the application. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* TCCE_Delete_HISR Error checking shell */
/* */
/* CALLS */
/* */
/* CSC_Remove_From_List Remove node from list */
/* [HIC_Make_History_Entry] Make entry in history log */
/* [TCT_Check_Stack] Stack checking function */
/* TCT_Protect Protect created HISR list */
/* TCT_Unprotect Release protection of list */
/* */
/* INPUTS */
/* */
/* hisr_ptr HISR control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* W. Lamie 03-01-1993 Created initial version 1.0 */
/* D. Lamie 04-19-1993 Verified version 1.0 */
/* W. Lamie 03-01-1994 Modified function interface, */
/* added register optimizations, */
/* resulting in version 1.1 */
/* R. Pfaff - */
/* D. Lamie 03-18-1994 Verified version 1.1 */
/* */
/*************************************************************************/
STATUS TCC_Delete_HISR(NU_HISR *hisr_ptr)
{
R1 TC_HCB *hisr; /* HISR control block ptr */
/* Move input HISR 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
#ifdef NU_ENABLE_HISTORY
/* Make an entry that corresponds to this function in the system history
log. */
HIC_Make_History_Entry(NU_DELETE_HISR_ID, (UNSIGNED) hisr,
(UNSIGNED) 0, (UNSIGNED) 0);
#endif
/* Protect the list of created HISRs. */
TCT_Protect(&TCD_HISR_Protect);
/* Remove the HISR from the list of created HISRs. */
CSC_Remove_From_List(&TCD_Created_HISRs_List, &(hisr -> tc_created));
/* Decrement the total number of created HISRs. */
TCD_Total_HISRs--;
/* Clear the HISR ID just in case. */
hisr -> tc_id = 0;
/* Release protection. */
TCT_Unprotect();
/* Return a successful completion. */
return(NU_SUCCESS);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -