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

📄 serial.lst

📁 1. UC/OS 8051中完全应用。 2. 显示各个任务的执行时间, 执行时间占总时间百分比, tick计数器 3.任务中信号量,消息以及消息队列的使用。 我自己仔细测试过了
💻 LST
📖 第 1 页 / 共 5 页
字号:
           =2     INT8U   OSValue;                        /* Mutex value (0 = used, 1 = available)                   */
           =2     INT8U   OSOwnerPrio;                    /* Mutex owner's task priority or 0xFF if no owner         */
           =2     INT8U   OSMutexPIP;                     /* Priority Inheritance Priority or 0xFF if no owner       */
           =2 } OS_MUTEX_DATA;
           =2 #endif
 305      =2  
 306      =2  /*
 307      =2  *********************************************************************************************************
 308      =2  *                                          MESSAGE QUEUE DATA
 309      =2  *********************************************************************************************************
 310      =2  */
 311      =2  
 312      =2  #if OS_Q_EN > 0
           =2 typedef struct os_q {                   /* QUEUE CONTROL BLOCK                                         */
           =2     struct os_q   *OSQPtr;              /* Link to next queue control block in list of free blocks     */
           =2     void         **OSQStart;            /* Pointer to start of queue data                              */
           =2     void         **OSQEnd;              /* Pointer to end   of queue data                              */
           =2     void         **OSQIn;               /* Pointer to where next message will be inserted  in   the Q  */
           =2     void         **OSQOut;              /* Pointer to where next message will be extracted from the Q  */
           =2     INT16U         OSQSize;             /* Size of queue (maximum number of entries)                   */
           =2     INT16U         OSQEntries;          /* Current number of entries in the queue                      */
           =2 } OS_Q;
           =2 
           =2 
           =2 typedef struct {
           =2     void          *OSMsg;               /* Pointer to next message to be extracted from queue          */
           =2     INT16U         OSNMsgs;             /* Number of messages in message queue                         */
           =2     INT16U         OSQSize;             /* Size of message queue                                       */
           =2     INT8U          OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur         */
           =2     INT8U          OSEventGrp;          /* Group corresponding to tasks waiting for event to occur     */
           =2 } OS_Q_DATA;
           =2 #endif
 332      =2  
 333      =2  /*
 334      =2  *********************************************************************************************************
 335      =2  *                                           SEMAPHORE DATA
 336      =2  *********************************************************************************************************
 337      =2  */
 338      =2  
 339      =2  #if OS_SEM_EN > 0
           =2 typedef struct {
           =2     INT16U  OSCnt;                          /* Semaphore count                                         */
           =2     INT8U   OSEventTbl[OS_EVENT_TBL_SIZE];  /* List of tasks waiting for event to occur                */
           =2     INT8U   OSEventGrp;                     /* Group corresponding to tasks waiting for event to occur */
           =2 } OS_SEM_DATA;
           =2 #endif
 346      =2  
 347      =2  /*
 348      =2  *********************************************************************************************************
 349      =2  *                                            TASK STACK DATA
 350      =2  *********************************************************************************************************
 351      =2  */
 352      =2  
 353      =2  #if OS_TASK_CREATE_EXT_EN > 0
           =2 typedef struct {
           =2     INT32U  OSFree;                    /* Number of free bytes on the stack                            */
           =2     INT32U  OSUsed;                    /* Number of bytes used on the stack                            */
           =2 } OS_STK_DATA;
           =2 #endif
 359      =2  
C51 COMPILER V8.08   SERIAL                                                                08/06/2008 16:11:38 PAGE 16  

 360      =2  /*
 361      =2  *********************************************************************************************************
 362      =2  *                                          TASK CONTROL BLOCK
 363      =2  *********************************************************************************************************
 364      =2  */
 365      =2  
 366      =2  typedef struct os_tcb {
 367      =2      OS_STK        *OSTCBStkPtr;        /* Pointer to current top of stack                              */
 368      =2  
 369      =2  #if OS_TASK_CREATE_EXT_EN > 0
           =2     void          *OSTCBExtPtr;        /* Pointer to user definable data for TCB extension             */
           =2     OS_STK        *OSTCBStkBottom;     /* Pointer to bottom of stack                                   */
           =2     INT32U         OSTCBStkSize;       /* Size of task stack (in number of stack elements)             */
           =2     INT16U         OSTCBOpt;           /* Task options as passed by OSTaskCreateExt()                  */
           =2     INT16U         OSTCBId;            /* Task ID (0..65535)                                           */
           =2 #endif
 376      =2  
 377      =2      struct os_tcb *OSTCBNext;          /* Pointer to next     TCB in the TCB list                      */
 378      =2      struct os_tcb *OSTCBPrev;          /* Pointer to previous TCB in the TCB list                      */
 379      =2  
 380      =2  #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0) || (OS_SEM_EN > 0) || (OS_MUTEX_EN > 0)
           =2     OS_EVENT      *OSTCBEventPtr;      /* Pointer to event control block                               */
           =2 #endif
 383      =2  
 384      =2  #if ((OS_Q_EN > 0) && (OS_MAX_QS > 0)) || (OS_MBOX_EN > 0)
           =2     void          *OSTCBMsg;           /* Message received from OSMboxPost() or OSQPost()              */
           =2 #endif
 387      =2  
 388      =2  #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
           =2 #if OS_TASK_DEL_EN > 0
           =2     OS_FLAG_NODE  *OSTCBFlagNode;      /* Pointer to event flag node                                   */
           =2 #endif    
           =2     OS_FLAGS       OSTCBFlagsRdy;      /* Event flags that made task ready to run                      */
           =2 #endif
 394      =2  
 395      =2      INT16U         OSTCBDly;           /* Nbr ticks to delay task or, timeout waiting for event        */
 396      =2      INT8U          OSTCBStat;          /* Task status                                                  */
 397      =2      INT8U          OSTCBPrio;          /* Task priority (0 == highest, 63 == lowest)                   */
 398      =2  
 399      =2      INT8U          OSTCBX;             /* Bit position in group  corresponding to task priority (0..7) */
 400      =2      INT8U          OSTCBY;             /* Index into ready table corresponding to task priority        */
 401      =2      INT8U          OSTCBBitX;          /* Bit mask to access bit position in ready table               */
 402      =2      INT8U          OSTCBBitY;          /* Bit mask to access bit position in ready group               */
 403      =2  
 404      =2  #if OS_TASK_DEL_EN > 0
           =2     BOOLEAN        OSTCBDelReq;        /* Indicates whether a task needs to delete itself              */
           =2 #endif
 407      =2  } OS_TCB;
 408      =2  
 409      =2  /*
 410      =2  *********************************************************************************************************
 411      =2  *                                            GLOBAL VARIABLES
 412      =2  *********************************************************************************************************
 413      =2  */
 414      =2  
 415      =2  OS_EXT idata INT32U       OSCtxSwCtr;               /* Counter of number of context switches           */
 416      =2  
 417      =2  #if (OS_EVENT_EN > 0) && (OS_MAX_EVENTS > 0)
           =2 OS_EXT  OS_EVENT         *OSEventFreeList;          /* Pointer to list of free EVENT control blocks    */
           =2 OS_EXT  OS_EVENT          OSEventTbl[OS_MAX_EVENTS];/* Table of EVENT control blocks                   */
           =2 #endif
 421      =2  
C51 COMPILER V8.08   SERIAL                                                                08/06/2008 16:11:38 PAGE 17  

 422      =2  #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
           =2 OS_EXT  OS_FLAG_GRP       OSFlagTbl[OS_MAX_FLAGS];  /* Table containing event flag groups              */
           =2 OS_EXT  OS_FLAG_GRP      *OSFlagFreeList;           /* Pointer to free list of event flag groups       */
           =2 #endif
 426      =2  
 427      =2  #if OS_TASK_STAT_EN > 0
           =2 OS_EXT  INT8S             OSCPUUsage;               /* Percentage of CPU used                          */
           =2 OS_EXT  INT32U            OSIdleCtrMax;             /* Max. value that idle ctr can take in 1 sec.     */
           =2 OS_EXT  INT32U            OSIdleCtrRun;             /* Val. reached by idle ctr at run time in 1 sec.  */
           =2 OS_EXT  BOOLEAN           OSStatRdy;                /* Flag indicating that the statistic task is rdy  */
           =2 //OS_EXT  OS_STK            OSTaskStatStk[OS_TASK_STAT_STK_SIZE];      /* Statistics task stack          *
             -/
           =2 #endif
 434      =2  
 435      =2  OS_EXT idata INT8U        OSIntNesting;             /* Interrupt nesting level                         */
 436      =2  OS_EXT idata INT8U        OSIntExitY;
 437      =2  
 438      =2  OS_EXT idata INT8U        OSLockNesting;            /* Multitasking lock nesting level                 */
 439      =2  
 440      =2  OS_EXT idata INT8U        OSPrioCur;                /* Priority of current task                        */
 441      =2  OS_EXT idata INT8U        OSPrioHighRdy;            /* Priority of highest priority task               */
 442      =2  
 443      =2  OS_EXT idata INT8U        OSRdyGrp;                        /* Ready list group                         */
 444      =2  OS_EXT  INT8U             OSRdyTbl[OS_RDY_TBL_SIZE];       /* Table of tasks which are ready to run    */
 445      =2  
 446      =2  OS_EXT idata BOOLEAN      OSRunning;                       /* Flag indicating that kernel is running   */
 447      =2  
 448      =2  OS_EXT idata INT8U        OSTaskCtr;                       /* Number of tasks created                  */
 449      =2  
 450      =2  OS_EXT idata INT32U       OSIdleCtr;                                 /* Idle counter                   */
 451      =2  
 452      =2  OS_EXT  OS_STK            OSTaskIdleStk[OS_TASK_IDLE_STK_SIZE];      /* Idle task stack                */
 453      =2  
 454      =2  /*
 455      =2  原来的变量定义是:
 456      =2  OS_EXT  OS_TCB *OSTCBCur;                        // Pointer to currently running TCB         
 457      =2  OS_EXT  OS_TCB *OSTCBHighRdy;                    // Pointer to highest priority TCB R-to-R   
 458      =2  
 459      =2  因为这2个变量调用频繁,放在idata中比xdata中访问快
 460      =2  */
 461      =2  
 462      =2  OS_EXT  idata OS_TCB     *OSTCBCur;                     /* Pointer to currently running TCB         */
 463      =2  OS_EXT  OS_TCB           *OSTCBFreeList;                   /* Pointer to list of free TCBs             */
 464      =2  OS_EXT  idata OS_TCB     *OSTCBHighRdy;                 /* Pointer to highest priority TCB R-to-R   */
 465      =2  OS_EXT  OS_TCB           *OSTCBList;                       /* Pointer to doubly linked list of TCBs    */
 466      =2  OS_EXT  OS_TCB           *OSTCBPrioTbl[OS_LOWEST_PRIO + 1];/* Table of pointers to created TCBs        */
 467      =2  OS_EXT  OS_TCB            OSTCBTbl[OS_MAX_TASKS + OS_N_SYS_TASKS];   /* Table of TCBs                  */
 468      =2  
 469      =2  #if (OS_MEM_EN > 0) && (OS_MAX_MEM_PART > 0)
           =2 OS_EXT  OS_MEM           *OSMemFreeList;            /* Pointer to free list of memory partitions       */
           =2 OS_EXT  OS_MEM            OSMemTbl[OS_MAX_MEM_PART];/* Storage for memory partition manager            */
           =2 #endif
 473      =2  
 474      =2  #if (OS_Q_EN > 0) && (OS_MAX_QS > 0)
           =2 OS_EXT  OS_Q             *OSQFreeList;              /* Pointer to list of free QUEUE control blocks    */
           =2 OS_EXT  OS_Q              OSQTbl[OS_MAX_QS];        /* Table of QUEUE control blocks                   */
           =2 #endif
 478      =2  
 479      =2  #if OS_TIME_GET_SET_EN > 0   
 480      =2  OS_EXT  volatile  INT32U  OSTime;                   /* Current value of system time (in ticks)         */
 481      =2  #endif
 482      =2  
C51 COMPILER V8.08   SERIAL                                                                08/06/2008 16:11:38 PAGE 18  

 483      =2  //#ifndef   OS_GLOBALS
 484      =2  extern  INT8U  code      OSMapTbl[];               /* Priority->Bit Mask lookup table                 */
 485      =2  extern  INT8U  code      OSUnMapTbl[];             /* Priority->Index    lookup table                 */
 486      =2  //#endif
 487      =2  
 488      =2  /*
 489      =2  *********************************************************************************************************
 490      =2  *                                          FUNCTION PROTOTYPES
 491      =2  *                                     (Target Independent Functions)
 492      =2  *********************************************************************************************************
 493      =2  */
 494      =2  
 495      =2  /*
 496      =2  *********************************************************************************************************
 497      =2  *                                         EVENT FLAGS MANAGEMENT
 498      =2  *********************************************************************************************************
 499      =2  */
 500      =2  
 501      =2  #if (OS_VERSION >= 251) && (OS_FLAG_EN > 0) && (OS_MAX_FLAGS > 0)
           =2 
           =2 #if OS_FLAG_ACCEPT_EN > 0
           =2 OS_FLAGS      OSFlagAccept(OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT8U *err) reentrant;
           =2 #endif
           =2 
           =2 OS_FLAG_GRP  *OSFlagCreate(OS_FLAGS flags, INT8U *err) reentrant;
           =2 
           =2 #if OS_FLAG_DEL_EN > 0
           =2 OS_FLAG_GRP  *OSFlagDel(OS_FLAG_GRP *pgrp, INT8U opt, INT8U *err) reentrant;
           =2 #endif
           =2 
           =2 OS_FLAGS      OSFlagPend(OS_FLAG_GRP *pgrp, OS_FLAGS flags, INT8U wait_type, INT16U timeout, INT8U *err) r
             -e

⌨️ 快捷键说明

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