📄 tcce.c
字号:
/*************************************************************************//* *//* Copyright Mentor Graphics Corporation 2002 *//* All Rights Reserved. *//* *//* THIS WORK CONTAINS TRADE SECRET AND PROPRIETARY INFORMATION WHICH IS *//* THE PROPERTY OF MENTOR GRAPHICS CORPORATION OR ITS LICENSORS AND IS *//* SUBJECT TO LICENSE TERMS. *//* *//*************************************************************************//*************************************************************************//* *//* FILE NAME VERSION *//* *//* tcce.c Nucleus PLUS 1.14 *//* *//* COMPONENT *//* *//* TC - Thread Control *//* *//* DESCRIPTION *//* *//* This file contains error checking routines for the functions in *//* the Thread Control component. This permits easy removal of *//* error checking logic when it is not needed. *//* *//* DATA STRUCTURES *//* *//* None *//* *//* FUNCTIONS *//* *//* TCCE_Create_Task Create a task *//* TCCE_Create_HISR Create HISR *//* TCCE_Delete_HISR Delete HISR *//* TCCE_Delete_Task Delete a task *//* TCCE_Reset_Task Reset a task *//* TCCE_Terminate_Task Terminate a task *//* TCCE_Resume_Service Resume a task service call *//* TCCE_Suspend_Service Suspend a task service call *//* TCCE_Relinquish Relinquish task execution *//* TCCE_Task_Sleep Task sleep request *//* TCCE_Suspend_Error Check for suspend req error *//* TCCE_Activate_HISR Activate an HISR *//* TCCE_Validate_Resume Validates resume requests *//* *//* DEPENDENCIES *//* *//* tc_extr.h Thread Control functions *//* *//* HISTORY *//* *//* DATE REMARKS *//* *//* 03-01-1993 Created initial version 1.0 *//* 04-19-1993 Verified version 1.0 *//* 03-01-1994 Modified logic that checked task *//* status without protection of *//* scheduling structures, *//* resulting in version 1.0a *//* 03-01-1994 Verified version 1.0a *//* 03-01-1994 Moved non-core error checking *//* functions to a supplemental *//* file, and modified function *//* interfaces, added validate *//* resume service, resulting in *//* version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* 03-19-1996 Added error checking to *//* TCCE_Task_Sleep, resulting *//* in version 1.1+ (spr037) *//* 04-17-1996 updated to version 1.2 *//* 10-16-1996 Modified to save the current *//* thread's protection rather *//* than that of the task being *//* resumed (SPR212)(SPR268) *//* 03-24-1998 Released version 1.3. *//* 04-17-2002 Released version 1.13m *//* 11-07-2002 Released version 1.14 *//*************************************************************************/#define NU_SOURCE_FILE#include "tc_extr.h" /* Thread control functions *//* Define external inner-component global data references. */extern TC_TCB *TCD_Execute_Task;extern VOID *TCD_Current_Thread;/*************************************************************************//* *//* FUNCTION *//* *//* TCCE_Create_Task *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the create task function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* *//* TCC_Create_Task Actual create task function *//* *//* INPUTS *//* *//* task_ptr Task control block pointer *//* name Task name *//* task_entry Entry function of the task *//* argc Optional task parameter *//* argv Optional task parameter *//* stack_address Pointer to start of stack *//* stack_size Size of task stack in bytes *//* priority Task priority *//* time_slice Task time slice *//* preempt Task preemptability flag *//* auto_start Automatic task start *//* *//* OUTPUTS *//* *//* NU_SUCCESS Successful request *//* NU_INVALID_TASK Task control block pointer *//* is NULL *//* NU_INVALID_ENTRY Task entry function is NULL *//* NU_INVALID_MEMORY Stack pointer is NULL *//* NU_INVALID_SIZE Stack size is too small *//* NU_INVALID_PRIORITY Invalid task priority *//* NU_INVALID_PREEMPT Invalid preemption selection *//* NU_INVALID_START Invalid start selection *//* *//* 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, *//* resulting in version 1.1 *//* *//* 03-18-1994 Verified version 1.1 *//* *//*************************************************************************/STATUS TCCE_Create_Task(NU_TASK *task_ptr, CHAR *name, VOID (*task_entry)(UNSIGNED, VOID *), UNSIGNED argc, VOID *argv, VOID *stack_address, UNSIGNED stack_size, OPTION priority, UNSIGNED time_slice, OPTION preempt, OPTION auto_start){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; /* Check each parameter. */ if ((task == NU_NULL) || (task -> tc_id == TC_TASK_ID)) /* Invalid task control block pointer. */ status = NU_INVALID_TASK; else if (task_entry == NU_NULL) /* Invalid task 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 ((preempt != NU_PREEMPT) && (preempt != NU_NO_PREEMPT)) /* Invalid preemption. */ status = NU_INVALID_PREEMPT; else if ((auto_start != NU_START) && (auto_start != NU_NO_START)) /* Invalid start selection. */ status = NU_INVALID_START; else /* Call the actual function to create a task. All the parameters appear to be correct. */ status = TCC_Create_Task(task_ptr, name, task_entry, argc, argv, stack_address, stack_size, priority, time_slice, preempt, auto_start); /* Return completion status. */ return(status);}/*************************************************************************//* *//* FUNCTION *//* *//* TCCE_Create_HISR *//* *//* DESCRIPTION *//* *//* This function performs error checking on the parameters supplied *//* to the create HISR function. *//* *//* CALLED BY *//* *//* Application *//* *//* CALLS *//* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -