📄 tcce.c
字号:
/* TCCE_Create_HISR */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the create HISR function. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Create_HISR Actual create HISR function */
/* */
/* INPUTS */
/* */
/* hisr_ptr HISR control block pointer */
/* name HISR name */
/* hisr_entry Entry function of the HISR */
/* priority Task priority */
/* stack_address Pointer to start of stack */
/* stack_size Size of HISR stack in bytes */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_HISR Invalid HISR pointer */
/* NU_INVALID_ENTRY Invalid HISR entry point */
/* NU_INVALID_PRIORITY Invalid HISR priority */
/* NU_INVALID_MEMORY Indicates stack pointer NULL */
/* NU_INVALID_SIZE Indicates stack size is too */
/* small */
/* */
/* 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 TCCE_Create_HISR(NU_HISR *hisr_ptr, CHAR *name,
VOID (*hisr_entry)(VOID), OPTION priority,
VOID *stack_address, UNSIGNED stack_size)
{
TC_HCB *hisr; /* HISR control block ptr */
STATUS status; /* Completion status */
/* Move input HISR pointer into internal pointer. */
hisr = (TC_HCB *) hisr_ptr;
/* Check each parameter. */
if ((hisr == NU_NULL) || (hisr -> tc_id == TC_HISR_ID))
/* Invalid HISR control block pointer. */
status = NU_INVALID_HISR;
else if (hisr_entry == NU_NULL)
/* Invalid HISR entry function pointer. */
status = NU_INVALID_ENTRY;
else if (stack_address == NU_NULL)
/* Invalid stack starting address. */
status = NU_INVALID_MEMORY;
else if (stack_size < NU_MIN_STACK_SIZE)
/* Invalid stack size. */
status = NU_INVALID_SIZE;
else if (((INT) priority) >= TC_HISR_PRIORITIES)
/* Invalid HISR priority. */
status = NU_INVALID_PRIORITY;
else
/* Call the actual function to create a HISR. All the parameters
appear to be correct. */
status = TCC_Create_HISR(hisr_ptr, name, hisr_entry, priority,
stack_address, stack_size);
/* Return completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Delete_Task */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the delete task function. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Delete_Task Actual delete task function */
/* */
/* INPUTS */
/* */
/* task_ptr Task control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_SUCCESS If successful completion */
/* NU_INVALID_TASK Task pointer is invalid */
/* NU_INVALID_DELETE Task not in a finished or */
/* terminated state */
/* */
/* 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 TCCE_Delete_Task(NU_TASK *task_ptr)
{
TC_TCB *task; /* Task control block ptr */
STATUS status; /* Completion status */
/* Move input task control block pointer into internal pointer. */
task = (TC_TCB *) task_ptr;
/* Determine if the supplied task pointer is valid. */
if ((task == NU_NULL) || (task -> tc_id != TC_TASK_ID))
/* Invalid task pointer supplied. */
status = NU_INVALID_TASK;
else if ((task -> tc_status != NU_FINISHED) &&
(task -> tc_status != NU_TERMINATED))
/* A task that is not in the finished or terminated state cannot
be deleted. */
status = NU_INVALID_DELETE;
else
/* Valid task pointer, call the function to delete the task. */
status = TCC_Delete_Task(task_ptr);
/* Return the completion status. */
return(status);
}
/*************************************************************************/
/* */
/* FUNCTION */
/* */
/* TCCE_Delete_HISR */
/* */
/* DESCRIPTION */
/* */
/* This function performs error checking on the parameters supplied */
/* to the delete HISR function. */
/* */
/* AUTHOR */
/* */
/* William E. Lamie, Accelerated Technology, Inc. */
/* */
/* CALLED BY */
/* */
/* Application */
/* */
/* CALLS */
/* */
/* TCC_Delete_HISR Actual delete HISR function */
/* */
/* INPUTS */
/* */
/* hisr_ptr HISR control block pointer */
/* */
/* OUTPUTS */
/* */
/* NU_INVALID_HISR Indicates HISR pointer is */
/* invalid */
/* */
/* 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, */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -