tcce.c

来自「nucleus 2006 source code」· C语言 代码 · 共 942 行 · 第 1/4 页

C
942
字号
    
        /* 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.                                     */
/*                                                                       */
/* 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           */
/*                                                                       */
/*************************************************************************/
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.                                     */
/*                                                                       */
/* 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                    */
/*                                                                       */
/*************************************************************************/
STATUS  TCCE_Delete_HISR(NU_HISR *hisr_ptr)
{

TC_HCB         *hisr;                       /* HISR control block ptr    */
STATUS          status;                     /* Completion status         */


    /* Move input HISR control block pointer into internal pointer.  */
    hisr =  (TC_HCB *) hisr_ptr;
    
    /* Determine if the supplied HISR pointer is valid.  */
    if ((hisr) && (hisr -> tc_id == TC_HISR_ID))
    
        /* Valid HISR pointer, call the function to delete the HISR.  */
        status =  TCC_Delete_HISR(hisr_ptr);
    else
    
        /* Invalid HISR pointer, indicate with the status.  */
        status =  NU_INVALID_HISR;
        
    /* Return the completion status.  */
    return(status);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCCE_Reset_Task                                                  */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function performs error checking on the parameters supplied */
/*      to the reset task function.                                      */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCC_Reset_Task                      Actual reset task function   */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      task_ptr                            Task control block pointer   */
/*      argc                                Optional task parameter      */
/*      argv                                Optional task parameter      */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_INVALID_TASK                     Indicates task pointer is    */
/*                                            invalid                    */
/*                                                                       */
/*************************************************************************/
STATUS  TCCE_Reset_Task(NU_TASK *task_ptr, UNSIGNED argc, VOID *argv)
{

TC_TCB         *task;                       /* Task control block ptr   */
STATUS          status;                     /* Status of the request    */


    /* Move input task control block pointer into internal pointer.  */
    task =  (TC_TCB *) task_ptr;

    /* Determine if the task pointer is valid.  */
    if ((task == NU_NULL) || (task -> tc_id != TC_TASK_ID))
    
        /* Task pointer is invalid.  */
        status =  NU_INVALID_TASK;
    else
    
        /* Call actual function to reset the task.  */
        status =  TCC_Reset_Task(task_ptr, argc, argv);

    /* Return completion status.  */
    return(status);
}


/*************************************************************************/
/*                                                                       */
/* FUNCTION                                                              */
/*                                                                       */
/*      TCCE_Terminate_Task                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This function performs error checking on the parameters supplied */
/*      to the terminate task function.                                  */
/*                                                                       */
/* CALLED BY                                                             */
/*                                                                       */
/*      Application                                                      */
/*                                                                       */
/* CALLS                                                                 */
/*                                                                       */
/*      TCC_Terminate_Task                  Actual terminate task funct  */
/*                                                                       */
/* INPUTS                                                                */
/*                                                                       */
/*      task_ptr                            Task control block pointer   */
/*                                                                       */
/* OUTPUTS                                                               */
/*                                                                       */
/*      NU_INVALID_TASK                     Indicates task pointer is    */
/*                                            invalid                    */
/*                                                                       */
/*************************************************************************/
STATUS  TCCE_Terminate_Task(NU_TASK *task_ptr)
{

TC_TCB         *task;                       /* Task control block ptr    */
STATUS          status;                     /* Status return             */


    /* Move input task control block pointer into internal pointer.  */
    task =  (TC_TCB *) task_ptr;

    /* Determine if the task pointer is valid.  */
    if ((task == NU_NULL) || (task -> tc_id != TC_TASK_ID))

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?