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

📄 tcd.c

📁 关于nucleus系统的教程文档
💻 C
📖 第 1 页 / 共 2 页
字号:
/*************************************************************************/
/*                                                                       */
/*        Copyright (c) 1993-2001 Accelerated Technology, Inc.           */
/*                                                                       */
/* PROPRIETARY RIGHTS of Accelerated Technology are involved in the      */
/* subject matter of this material.  All manufacturing, reproduction,    */
/* use, and sales rights pertaining to this subject matter are governed  */
/* by the license agreement.  The recipient of this software implicitly  */
/* accepts the terms of the license.                                     */
/*                                                                       */
/*************************************************************************/

/*************************************************************************/
/*                                                                       */
/* FILE NAME                                            VERSION          */
/*                                                                       */
/*      tcd.c                                           PLUS  1.13       */
/*                                                                       */
/* COMPONENT                                                             */
/*                                                                       */
/*      TC - Thread Control                                              */
/*                                                                       */
/* DESCRIPTION                                                           */
/*                                                                       */
/*      This file contains global data structures for use within this    */
/*      component.                                                       */
/*                                                                       */
/* AUTHOR                                                                */
/*                                                                       */
/*      Accelerated Technology, Inc.                                     */
/*                                                                       */
/* DATA STRUCTURES                                                       */
/*                                                                       */
/*      TCD_Created_Tasks_List              Pointer to the linked-list   */
/*                                            of created tasks           */
/*      TCD_Total_Tasks                     Total number of created tasks*/
/*      TCD_Priority_List                   Array of pointers to ready   */
/*                                            tasks, indexed by priority */
/*      TCD_Execute_Task                    Highest priority task to     */
/*                                            execute                    */
/*      TCD_Priority_Groups                 Bit map of 32 groups of task */
/*                                            priority                   */
/*      TCD_Sub_Priority_Groups             An array of 32 sub-priority  */
/*                                            groups                     */
/*      TCD_Lowest_Set_Bit                  Lookup table to find the     */
/*                                            lowest bit set in a byte   */
/*      TCD_Highest_Priority                Highest priority ready       */
/*      TCD_Created_HISRs_List              Pointer to the linked-list   */
/*                                            of created HISRs           */
/*      TCD_Total_HISRs                     Total number of created HISRs*/
/*      TCD_Active_HISR_Heads               Active HISR list head ptrs   */
/*      TCD_Active_HISR_Tails               Active HISR list tail ptrs   */
/*      TCD_Execute_HISR                    Highest priority HISR to     */
/*                                            execute                    */
/*      TCD_Current_Thread                  Pointer to the currently     */
/*                                            executing thread           */
/*      TCD_Registered_LISRs                List of registered LISRs     */
/*      TCD_LISR_Pointers                   Actual LISR pointers         */
/*      TCD_Interrupt_Count                 Count of ISRs in progress    */
/*      TCD_Stack_Switched                  Flag indicating that stack   */
/*                                            was switched in an ISR     */
/*      TCD_List_Protect                    Task list protection         */
/*      TCD_System_Protect                  System protection            */
/*      TCD_System_Stack                    System stack pointer - top   */
/*      TCD_LISR_Protect                    Protect LISR registration    */
/*      TCD_HISR_Protect                    Protect the list of created  */
/*                                            HISRs                      */
/*      TCD_Interrupt_Level                 Enable interrupt level       */
/*      TCD_Unhandled_Interrupt             Contains the most recent     */
/*                                            unhandled interrupt in     */
/*                                            system error conditions    */
/*                                                                       */
/* FUNCTIONS                                                             */
/*                                                                       */
/*      None                                                             */
/*                                                                       */
/* DEPENDENCIES                                                          */
/*                                                                       */
/*      cs_defs.h                           Common Service constants     */
/*      tc_defs.h                           Thread Control constants     */
/*                                                                       */
/* HISTORY                                                               */
/*                                                                       */
/*         DATE                    REMARKS                               */
/*                                                                       */
/*      03-01-1993      Created initial version 1.0                      */
/*      04-19-1993      Verified version 1.0                             */
/*      01-01-1993      Added variable to save last                      */
/*                        unhandled interrupt in system                  */
/*                        error conditions, resulting in                 */
/*                        version 1.0a                                   */
/*      11-01-1993      Verified version 1.0a                            */
/*      03-01-1994      Change schedule protection to a                  */
/*                        system protection to improve                   */
/*                        performance, resulting in                      */
/*                        version 1.1                                    */
/*                                                                       */
/*      03-18-1994      Verified version 1.1                             */
/*      04-17-1996      updated to version 1.2                           */
/*      03-24-1998      Released version 1.3.                            */
/*      04-23-2001      Made TCD_LISR_Pointers array an exclusive count  */
/*                                                                       */
/*************************************************************************/
#define         NU_SOURCE_FILE

#include        "cs_defs.h"                 /* Common Service constants  */
#include        "tc_defs.h"                 /* Thread Control constants  */


/* TCD_Created_Tasks_List is the head pointer of the linked list of 
   created tasks.  If the list is NU_NULL, there are no tasks created.  */
   
CS_NODE        *TCD_Created_Tasks_List;


/* TCD_Total_Tasks contains the number of currently created tasks.  */

UNSIGNED        TCD_Total_Tasks;


/* TCD_Priority_List is an array of TCB pointers.  Each element of the array 
   is effectively the head pointer of the list of tasks ready for execution
   at that priority.  If the pointer is NULL, there are no tasks ready
   for execution at that priority.  The array is indexed by priority.  */

TC_TCB         *TCD_Priority_List[TC_PRIORITIES];


/* TCD_Priority_Groups is a 32-bit unsigned integer that is used as a bit 
   map.  Each bit corresponds to an 8-priority group.  For example, if bit 0 
   is set, at least one task of priority 0 through 8 is ready for execution. */

UNSIGNED        TCD_Priority_Groups;


/* TCD_Sub_Priority_Groups is an array of sub-priority groups.  These are 
   also used as bit maps.  Index 0 of this array corresponds to priorities 
   0 through 8.  Bit 0 of this element represents priority 0, while bit 7 
   represents priority 7.  */
   
DATA_ELEMENT    TCD_Sub_Priority_Groups[TC_MAX_GROUPS];


/* TCD_Lowest_Set_Bit is nothing more than a standard lookup table.  The 
   table is indexed by values ranging from 1 to 255.  The value at that 
   position in the table indicates the number of the lowest set bit.  This is 
   used to determine the highest priority task represented in the previously 
   defined bit maps.  */

UNSIGNED_CHAR  TCD_Lowest_Set_Bit[] = {0, 

⌨️ 快捷键说明

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