⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tcc.c

📁 test file nucleus source
💻 C
📖 第 1 页 / 共 5 页
字号:
#ifdef  NU_ENABLE_HISTORY    /* Make an entry that corresponds to this function in the system history       log.  */    HIC_Make_History_Entry(NU_CREATE_HISR_ID, (UNSIGNED) hisr,                                (UNSIGNED) name, (UNSIGNED) hisr_entry);#endif    /* First, clear the HISR ID just in case it is an old HISR       Control Block.  */    hisr -> tc_id =             0;    /* Fill in the HISR name.  */    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;    /* Initialize additional kernel options data */#if (NU_SUPERV_USER_MODE == 1)    hisr->tc_su_mode = 1;                   /* TCT_HISR_Shell in Supervisor mode */    hisr->tc_module = 0;                    /* Not initially bound to a module */#endif    /* 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;#if defined(NU_MODULE_SUPPORT) && (NU_MODULE_SUPPORT > 0)    /* If executing in a thread's context, bind to that thread's module */    if(TCD_Current_Thread != NU_NULL)    {        if (((TC_TCB*)TCD_Current_Thread) -> tc_id == TC_TASK_ID)        {            status = MSC_Bind_Module_HISR(              (MS_MODULE*)(((TC_TCB*)(TCD_Current_Thread))->tc_module), hisr);        }        else        {            status = MSC_Bind_Module_HISR(              (MS_MODULE*)(((TC_HCB*)(TCD_Current_Thread))->tc_module), hisr);        }    }    else /* It must be initialization time, so use the current module */    {        status = MSC_Bind_Module_HISR(msd_current_module, hisr);    }#endif /* NU_MODULE_SUPPORT */    /* 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++;#ifdef INCLUDE_PROVIEW    _RTProf_DumpHisr(hisr,RT_PROF_CREATE_HISR);#endif    /* Release the protection.  */    TCT_Unprotect();    /* Return to user mode */    NU_USER_MODE();    /* Return successful completion.  */    return(status);}/*************************************************************************//*                                                                       *//* 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.       *//*                                                                       *//* 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                                                               *//*                                                                       *//*         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  TCC_Delete_Task(NU_TASK *task_ptr){R1 TC_TCB  *task;                           /* Task control block ptr    */NU_SUPERV_USER_VARIABLES    /* Switch to supervisor mode */    NU_SUPERVISOR_MODE();    /* 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);#ifdef INCLUDE_PROVIEW    _RTProf_DumpTask(task,RT_PROF_DELETE_TASK);#endif /*INCLUDE_PROVIEW*/    /* 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 to user mode */    NU_USER_MODE();    /* 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.                   *//*                                                                       *//* 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                                                               *//*                                                                       *//*         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  TCC_Delete_HISR(NU_HISR *hisr_ptr){R1 TC_HCB  *hisr;                           /* HISR control block ptr    */NU_SUPERV_USER_VARIABLES    /* Switch to supervisor mode */    NU_SUPERVISOR_MODE();    /* Move input HISR pointer into internal pointer.  */    hisr =  (TC_HCB *) hisr_ptr;

⌨️ 快捷键说明

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