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

📄 os_cpu_c.lst

📁 ucos移植学习
💻 LST
字号:
C51 COMPILER V7.02a   OS_CPU_C                                                             10/16/2006 15:27:52 PAGE 1   


C51 COMPILER V7.02a, COMPILATION OF MODULE OS_CPU_C
OBJECT MODULE PLACED IN .\OS_CPU_C.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE ..\uc_51\OS_CPU_C.C BROWSE DEBUG OBJECTEXTEND PRINT(.\OS_CPU_C.lst) OBJECT(
                    -.\OS_CPU_C.obj)

stmt level    source

   1          /*
   2          *********************************************************************************************************
   3          *                                               uC/OS-II
   4          *                                         The Real-Time Kernel
   5          *
   6          *                        (c) Copyright 1992-1998, Jean J. Labrosse, Plantation, FL
   7          *                                          All Rights Reserved
   8          *
   9          *
  10          *                                          KeilC51 Specific code
  11          *                                          SMALL MEMORY MODEL
  12          *
  13          * File : OS_CPU_C.C
  14          * By   : Jean J. Labrosse
  15          * Refer to Code Written By              : Yang Yi (http://www.zlgmcu.com/philips/philips-embedsys.asp)
  16          * Port to KeilC51 Small Mode By : Li Zhanglin (wzzlin@nankai.edu.cn)
  17          *********************************************************************************************************
  18          */
  19          #define  OS_CPU_GLOBALS
  20          #include "..\uc_os_II\includes.h"
  21           extern  void  MboxPost(); 
  22          /*
  23          *********************************************************************************************************
  24          *                                          OSTaskStkInit
  25          *
  26          * Description: Init stack before task running.
  27          *
  28          * Arguments  : task          is a pointer to the task code
  29          *
  30          *              pdata         is a pointer to a user supplied data area that will be passed to the task
  31          *                            when the task first executes.
  32          *
  33          *              ptos          is a pointer to the top of stack.  It is assumed that 'ptos' points to
  34          *                            a 'free' entry on the task stack.  If OS_STK_GROWTH is set to 1 then 
  35          *                            'ptos' will contain the HIGHEST valid address of the stack.  Similarly, if
  36          *                            OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
  37          *                            of the stack.
  38          *
  39          *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
  40          *                            (see uCOS_II.H for OS_TASK_OPT_???).
  41          *
  42          * Returns    : Always returns the bottom of stack.
  43          *
  44          * Note(s)    : 1) stack stored as following format
  45          
  46          ;       CONTENT                                                                                                 START POSITION IN OSTCBStk      
  47          ;       ----------                                                                                              ----------------------          
  48          ;       AR7                                                                     
  49          ;       AR6
  50          ;       AR5
  51          ;       AR4
  52          ;       AR3
  53          ;       AR2
  54          ;       AR1
C51 COMPILER V7.02a   OS_CPU_C                                                             10/16/2006 15:27:52 PAGE 2   

  55          ;       AR0
  56          ;       PSW
  57          ;       DPL
  58          ;       DPH
  59          ;       B
  60          ;       ACC                                                             
  61          ;       HARDWARE STACK CONTENT(NOT INCLUDE REGISTERS)                   2+SmltStkSize                                           
  62          ;       HARDWARE STACK SIZE(INCLUDE REGISTERS)                                  1+SmltStkSize           
  63          ;       SIMULATED STACK CONTENT                                                                 1                               
  64          ;       ?C_IBP                                                                                                  0
  65                                  
  66          *********************************************************************************************************
  67          */
  68          
  69          void DT_XDATA *OSTaskStkInit (void (DT_CODE *task)(void DT_XDATA *pd), void DT_XDATA *ppdata, void DT_XDAT
             -A *ptos, INT16U opt) REENTRANT
  70          {
  71   1          OS_STK DT_XDATA *stk;
  72   1      
  73   1          ppdata = ppdata;                                                    
  74   1          opt    = opt;                               
  75   1      
  76   1          stk    = (OS_STK DT_XDATA *)ptos;           /* bottom of stack                              */
  77   1          *stk++ = (0xFF + 1);                        /* C_IBP                                                */
  78   1                                                                                                      /* simulated stack size == 0    */
  79   1              *stk++ = 2 + 13;                                                        /* tow bytes of return address and 13 byte registers */
  80   1          *stk++ = (INT16U)task & 0xFF;               /* low byte of return address   */
  81   1              *stk++ = (INT16U)task >> 8;                 /* high byte of return address      */
  82   1          *stk++ = 0x0A;                              /* ACC          */
  83   1          *stk++ = 0x0B;                              /* B            */
  84   1          *stk++ = 0xD1;                              /* DPH          */
  85   1          *stk++ = 0xD0;                              /* DPL          */
  86   1              *stk++ = 0x00;                              /* PSW              */
  87   1          *stk++ = 0x00;                              /* R0           */
  88   1          *stk++ = 0x01;                              /* R1           */
  89   1          *stk++ = 0x02;                              /* R2           */
  90   1          *stk++ = 0x03;                              /* R3           */
  91   1          *stk++ = 0x04;                              /* R4           */
  92   1          *stk++ = 0x05;                              /* R5           */
  93   1          *stk++ = 0x06;                              /* R6           */
  94   1          *stk++ = 0x07;                              /* R7           */
  95   1                                                      
  96   1          return ((void DT_XDATA *)ptos);                             /* note return ptos, not stk */
  97   1      }
  98          
  99          /*
 100          *********************************************************************************************************
 101          *                                          OS Time ISR
 102          *
 103          * Description: use T0.
 104          *
 105          * Arguments  : 
 106          *
 107          * Note(s)    : in default, OSTickISR using register bank 0. Register pushing code will added by keilC.
 108          *********************************************************************************************************
 109          */
 110          extern  OS_EVENT  *DispSem;
 111          void OSTickISR() interrupt 1
 112          {
 113   1      
 114   1               TL0 = TIMER_24M_25MS_L;
 115   1           TH0 = TIMER_24M_25MS_H;//15mHZ,10ms定时,任务切换100次/秒
C51 COMPILER V7.02a   OS_CPU_C                                                             10/16/2006 15:27:52 PAGE 3   

 116   1              //TF0 = 0;
 117   1        // OSSemPost(DispSem); 
 118   1          //SBUF = 0X55;
 119   1              OSIntEnter();
 120   1              OSTimeTick();
 121   1              OSIntExit();
 122   1      }
 123          
 124          
 125          /*$PAGE*/
 126          #if OS_CPU_HOOKS_EN
 127          /*
 128          *********************************************************************************************************
 129          *                                          TASK CREATION HOOK
 130          *
 131          * Description: This function is called when a task is created.
 132          *
 133          * Arguments  : ptcb   is a pointer to the task control block of the task being created.
 134          *
 135          * Note(s)    : 1) Interrupts are disabled during this call.
 136          *********************************************************************************************************
 137          */
 138          void OSTaskCreateHook (OS_TCB DT_XDATA *ptcb) REENTRANT
 139          {
 140   1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
 141   1      }
 142          
 143          
 144          /*
 145          *********************************************************************************************************
 146          *                                           TASK DELETION HOOK
 147          *
 148          * Description: This function is called when a task is deleted.
 149          *
 150          * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
 151          *
 152          * Note(s)    : 1) Interrupts are disabled during this call.
 153          *********************************************************************************************************
 154          */
 155          void OSTaskDelHook (OS_TCB DT_XDATA *ptcb) REENTRANT
 156          {
 157   1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
 158   1      }
 159          
 160          /*
 161          *********************************************************************************************************
 162          *                                           TASK SWITCH HOOK
 163          *
 164          * Description: This function is called when a task switch is performed.  This allows you to perform other
 165          *              operations during a context switch.
 166          *
 167          * Arguments  : none
 168          *
 169          * Note(s)    : 1) Interrupts are disabled during this call.
 170          *              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
 171          *                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
 172          *                 task being switched out (i.e. the preempted task).
 173          *********************************************************************************************************
 174          */
 175          void OSTaskSwHook (void) REENTRANT
 176          {
 177   1      }
C51 COMPILER V7.02a   OS_CPU_C                                                             10/16/2006 15:27:52 PAGE 4   

 178          
 179          /*
 180          *********************************************************************************************************
 181          *                                           STATISTIC TASK HOOK
 182          *
 183          * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
 184          *              application to add functionality to the statistics task.
 185          *
 186          * Arguments  : none
 187          *********************************************************************************************************
 188          */
 189          void OSTaskStatHook (void) REENTRANT
 190          {
 191   1      }
 192          
 193          /*
 194          *********************************************************************************************************
 195          *                                               TICK HOOK
 196          *
 197          * Description: This function is called every tick.
 198          *
 199          * Arguments  : none
 200          *
 201          * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
 202          *********************************************************************************************************
 203          */
 204          void OSTimeTickHook (void) REENTRANT
 205          {
 206   1      }
 207          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    572    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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