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

📄 os_core.lst

📁 时间触发式单片机最小系统
💻 LST
📖 第 1 页 / 共 4 页
字号:
             - */
                  }
                  for (;;) {
                      OS_ENTER_CRITICAL();
                      OSIdleCtrRun = OSIdleCtr;                /* Obtain the of the idle counter for the past second */
                      run          = OSIdleCtr;
                      OSIdleCtr    = 0L;                       /* Reset the idle counter for the next second         */
                      OS_EXIT_CRITICAL();
                      if (OSIdleCtrMax > 0L) {
                          usage = (INT8S)(100L - 100L * run / OSIdleCtrMax);
                          if (usage > 100) {
                              OSCPUUsage = 100;
                          } else if (usage < 0) {
                              OSCPUUsage =   0;
                          } else {
                              OSCPUUsage = usage;
                          }
                      } else {
                          OSCPUUsage = 0;
                      }
                      OSTaskStatHook();                        /* Invoke user definable hook                         */
                      OSTimeDly(OS_TICKS_PER_SEC);             /* Accumulate OSIdleCtr for the next second           */
                  }
              }
              #endif
 663          /*$PAGE*/
 664          /*
 665          *********************************************************************************************************
 666          *                                            INITIALIZE TCB
 667          *
 668          * Description: This function is internal to uC/OS-II and is used to initialize a Task Control Block when
 669          *              a task is created (see OSTaskCreate() and OSTaskCreateExt()).
 670          *
 671          * Arguments  : prio          is the priority of the task being created
 672          *
C51 COMPILER V7.10   OS_CORE                                                               08/23/2004 01:45:17 PAGE 12  

 673          *              ptos          is a pointer to the task's top-of-stack assuming that the CPU registers
 674          *                            have been placed on the stack.  Note that the top-of-stack corresponds to a 
 675          *                            'high' memory location is OS_STK_GROWTH is set to 1 and a 'low' memory
 676          *                            location if OS_STK_GROWTH is set to 0.  Note that stack growth is CPU
 677          *                            specific.
 678          *
 679          *              pbos          is a pointer to the bottom of stack.  A NULL pointer is passed if called by
 680          *                            'OSTaskCreate()'.
 681          *
 682          *              id            is the task's ID (0..65535)
 683          *
 684          *              stk_size      is the size of the stack (in 'stack units').  If the stack units are INT8Us
 685          *                            then, 'stk_size' contains the number of bytes for the stack.  If the stack
 686          *                            units are INT32Us then, the stack contains '4 * stk_size' bytes.  The stack
 687          *                            units are established by the #define constant OS_STK which is CPU
 688          *                            specific.  'stk_size' is 0 if called by 'OSTaskCreate()'.
 689          *
 690          *              pext          is a pointer to a user supplied memory area that is used to extend the task
 691          *                            control block.  This allows you to store the contents of floating-point
 692          *                            registers, MMU registers or anything else you could find useful during a 
 693          *                            context switch.  You can even assign a name to each task and store this name
 694          *                            in this TCB extension.  A NULL pointer is passed if called by OSTaskCreate().
 695          *
 696          *              opt           options as passed to 'OSTaskCreateExt()' or, 
 697          *                            0 if called from 'OSTaskCreate()'.
 698          *
 699          * Returns    : OS_NO_ERR         if the call was successful
 700          *              OS_NO_MORE_TCB    if there are no more free TCBs to be allocated and thus, the task cannot
 701          *                                be created.
 702          *
 703          * Note       : This function is INTERNAL to uC/OS-II and your application should not call it.
 704          *********************************************************************************************************
 705          */
 706          static OS_TCB *ptcb11;
 707          INT8U OSTCBInit (INT8U prio, 
 708                           OS_STK *ptos, 
 709                           OS_STK *pbos, 
 710                           INT16U id, 
 711                           INT16U stk_size, 
 712                           void *pext, 
 713                           INT16U opt)reentrant
 714          {
 715   1          OS_ENTER_CRITICAL();
 716   1          ptcb11 = OSTCBFreeList;                                  /* Get a free TCB from the free TCB list    *
             -/
 717   1          if (ptcb11 != (OS_TCB *)0) {
 718   2              OSTCBFreeList        = ptcb11->OSTCBNext;            /* Update pointer to free TCB list          *
             -/
 719   2              OS_EXIT_CRITICAL();
 720   2              ptcb11->OSTCBStkPtr    = ptos;                       /* Load Stack pointer in TCB                *
             -/
 721   2              ptcb11->OSTCBPrio      = (INT8U)prio;                /* Load task priority into TCB              *
             -/
 722   2              ptcb11->OSTCBStat      = OS_STAT_RDY;                /* Task is ready to run                     *
             -/
 723   2              ptcb11->OSTCBDly       = 0;                          /* Task is not delayed                      *
             -/
 724   2      
 725   2      #if OS_TASK_CREATE_EXT_EN        
                      ptcb11->OSTCBExtPtr    = pext;                       /* Store pointer to TCB extension           *
             -/
                      ptcb11->OSTCBStkSize   = stk_size;                   /* Store stack size                         *
C51 COMPILER V7.10   OS_CORE                                                               08/23/2004 01:45:17 PAGE 13  

             -/
                      ptcb11->OSTCBStkBottom = pbos;                       /* Store pointer to bottom of stack         *
             -/
                      ptcb11->OSTCBOpt       = opt;                        /* Store task options                       *
             -/
                      ptcb11->OSTCBId        = id;                         /* Store task ID                            *
             -/
              #else
 732   2              pext                 = pext;                       /* Prevent compiler warning if not used     */
 733   2              stk_size             = stk_size;
 734   2              pbos                 = pbos;
 735   2              opt                  = opt;
 736   2              id                   = id;
 737   2      #endif
 738   2      
 739   2      #if OS_TASK_DEL_EN        
                      ptcb11->OSTCBDelReq    = OS_NO_ERR;
              #endif
 742   2      
 743   2              ptcb11->OSTCBY         = prio >> 3;                  /* Pre-compute X, Y, BitX and BitY          *
             -/
 744   2              ptcb11->OSTCBBitY      = OSMapTbl[ptcb11->OSTCBY];
 745   2              ptcb11->OSTCBX         = prio & 0x07;
 746   2              ptcb11->OSTCBBitX      = OSMapTbl[ptcb11->OSTCBX];
 747   2      
 748   2      #if     OS_MBOX_EN || (OS_Q_EN && (OS_MAX_QS >= 2)) || OS_Sem_EN
 749   2              ptcb11->OSTCBEventPtr  = (OS_EVENT *)0;              /* Task is not pending on an event          *
             -/
 750   2      #endif
 751   2      
 752   2      #if     OS_MBOX_EN || (OS_Q_EN && (OS_MAX_QS >= 2))
                      ptcb11->OSTCBMsg       = (void *)0;                  /* No message received                      *
             -/
              #endif
 755   2      
 756   2              OS_ENTER_CRITICAL();
 757   2              OSTCBPrioTbl[prio]   = ptcb11;
 758   2              ptcb11->OSTCBNext      = OSTCBList;                  /* Link into TCB chain                      *
             -/
 759   2              ptcb11->OSTCBPrev      = (OS_TCB *)0;
 760   2              if (OSTCBList != (OS_TCB *)0) {
 761   3                  OSTCBList->OSTCBPrev = ptcb11;
 762   3              }
 763   2              OSTCBList               = ptcb11;
 764   2              OSRdyGrp               |= ptcb11->OSTCBBitY;         /* Make task ready to run                   *
             -/
 765   2              OSRdyTbl[ptcb11->OSTCBY] |= ptcb11->OSTCBBitX;
 766   2              OS_EXIT_CRITICAL();
 767   2              return (OS_NO_ERR);
 768   2          } else {
 769   2              OS_EXIT_CRITICAL();
 770   2              return (OS_NO_MORE_TCB);
 771   2          }
 772   1      }
 773          /*$PAGE*/
 774          /*
 775          *********************************************************************************************************
 776          *                                         PROCESS SYSTEM TICK
 777          *
 778          * Description: This function is used to signal to uC/OS-II the occurrence of a 'system tick' (also known
 779          *              as a 'clock tick').  This function should be called by the ticker ISR but, can also be
 780          *              called by a high priority task.
C51 COMPILER V7.10   OS_CORE                                                               08/23/2004 01:45:17 PAGE 14  

 781          *
 782          * Arguments  : none
 783          *
 784          * Returns    : none
 785          *********************************************************************************************************
 786          */
 787          
 788          void OSTimeTick (void)
 789          {
 790   1          OS_TCB *ptcb;
 791   1      
 792   1      
 793   1          OSTimeTickHook();                                      /* Call user definable hook                 */
 794   1          ptcb = OSTCBList;                                      /* Point at first TCB in TCB list           */
 795   1          while (ptcb->OSTCBPrio != OS_IDLE_PRIO) {              /* Go through all TCBs in TCB list          */
 796   2              OS_ENTER_CRITICAL();
 797   2              if (ptcb->OSTCBDly != 0) {                         /* Delayed or waiting for event with TO     */
 798   3                  if (--ptcb->OSTCBDly == 0) {                   /* Decrement nbr of ticks to end of delay   */
 799   4                      if (!(ptcb->OSTCBStat & OS_STAT_SUSPEND)) {    /* Is task suspended?                   */
 800   5                          OSRdyGrp               |= ptcb->OSTCBBitY; /* No,  Make task Rdy to Run (timed out)*/
 801   5                          OSRdyTbl[ptcb->OSTCBY] |= ptcb->OSTCBBitX;
 802   5                      } else {                                       /* Yes, Leave 1 tick to prevent ...     */
 803   5                          ptcb->OSTCBDly = 1;                        /* ... loosing the task when the ...    */
 804   5                      }                                              /* ... suspension is removed.           */
 805   4                  }
 806   3              }
 807   2              ptcb = ptcb->OSTCBNext;                            /* Point at next TCB in TCB list            */
 808   2              OS_EXIT_CRITICAL();
 809   2          }
 810   1          OS_ENTER_CRITICAL();                                   /* Update the 32-bit tick counter           */
 811   1          OSTime++;
 812   1          OS_EXIT_CRITICAL();
 813   1      }
 814          /*$PAGE*/
 815          /*
 816          *********************************************************************************************************
 817          *                                             GET VERSION
 818          *
 819          * Description: This function is used to return the version number of uC/OS-II.  The returned value
 820          *              corresponds to uC/OS-II's version number multiplied by 100.  In other words, version 2.00
 821          *              would be returned as 200.
 822          *
 823          * Arguments  : none
 824          *
 825          * Returns    : the version number of uC/OS-II multiplied by 100.
 826          *********************************************************************************************************
 827          */
 828          #if  OS_VERSION_CHK_EN
              INT16U OSVersion (void)reentrant
              {
                  return (OS_VERSION);
              }
              #endif
*** ERROR C249 IN LINE 832 OF OS_CORE.C: 'DATA': SEGMENT TOO LARGE

C51 COMPILATION COMPLETE.  0 WARNING(S),  1 ERROR(S)

⌨️ 快捷键说明

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