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

📄 os_cpu_c.lst

📁 在keil大模式下编译的ucos-2源码
💻 LST
字号:
C51 COMPILER V7.50   OS_CPU_C                                                              01/25/2007 14:15:00 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE OS_CPU_C
OBJECT MODULE PLACED IN os_cpu_c.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE os_cpu_c.c LARGE BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*
   2          /*******************************************************************************
   3                                                uS/OS-II v2.8
   4          文 件 名  : os_cpu_c.c
   5          作    者  : czn
   6          版    本  : v1.0
   7          ********************************************************************************
   8          */
   9          #define  OS_CPU_GLOBALS
  10          #include "includes.h"
  11          
  12          /*
  13          *******************************************************************************
  14                                          OSTaskStkInit()
  15          功能描述: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
  16                    stack frame of the task being created.  This function is highly processor specific.
  17          参    数: task      is a pointer to the task code
  18                    p_arg     is a pointer to a user supplied data area that will be passed to the task
  19                              when the task first executes.
  20                    ptos      is a pointer to the top of stack.  It is assumed that 'ptos' points to
  21                              a 'free' entry on the task stack.  If OS_STK_GROWTH is set to 1 then 
  22                              'ptos' will contain the HIGHEST valid address of the stack.  Similarly, if
  23                              OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
  24                              of the stack.
  25                    opt       specifies options that can be used to alter the behavior of OSTaskStkInit().
  26                              (see uCOS_II.H for OS_TASK_OPT_???).
  27          说    明: Interrupts are enabled when your task starts executing.
  28          *******************************************************************************
  29          */
  30          OS_STK *OSTaskStkInit(void (*task)(void *p_arg),void *p_arg, OS_STK *ptos, INT16U opt) reentrant
  31          {
  32   1          OS_STK *stk;
  33   1      
  34   1          p_arg = p_arg;
  35   1          opt    = opt;
  36   1          stk    = (OS_STK *)ptos;
  37   1          *stk++ = 15;                                /*用户堆栈长度              */
  38   1          *stk++ = (INT16U)task & 0xFF;               /*任务地址低8位             */
  39   1          *stk++ = (INT16U)task >> 8;                 /*任务地址高8位             */
  40   1          *stk++ = 0x00;                              /*PSW                       */
  41   1          *stk++ = 0x0A;                              /*ACC                       */
  42   1          *stk++ = 0x0B;                              /*B                         */
  43   1          *stk++ = 0x00;                              /*DPL                       */
  44   1          *stk++ = 0x00;                              /*DPH                       */
  45   1          *stk++ = 0x00;                              /*R0                        */
  46   1          
  47   1              /*R3、R2、R1用于传递任务参数ppdata,其中R3代表存储器类型,R2为高字节偏移,R1为低字节位移。*/
  48   1              /*通过分析KEIL汇编,了解到任务的void *ppdata参数恰好是用R3、R2、R1传递,不是通过虚拟堆栈。*/
  49   1          *stk++ = (INT16U)p_arg & 0xFF;             /*R1                        */
  50   1          *stk++ = (INT16U)p_arg >> 8;               /*R2                        */
  51   1          *stk++ = 0x01;                              /*R3  XDATA,存储器类型为1  */
  52   1      
  53   1          *stk++ = 0x04;                              /*R4                        */
  54   1          *stk++ = 0x05;                              /*R5                        */
  55   1          *stk++ = 0x06;                              /*R6                        */
C51 COMPILER V7.50   OS_CPU_C                                                              01/25/2007 14:15:00 PAGE 2   

  56   1          *stk++ = 0x07;                              /*R7                        */
  57   1                                                      /*不用保存SP,任务切换时根据用户堆栈长度计算得出。*/    
  58   1          *stk++ = (INT16U) (ptos+MaxStkSize) >> 8;   /*?C_XBP 仿真堆栈指针高8位  */
  59   1          *stk++ = (INT16U) (ptos+MaxStkSize) & 0xFF; /*?C_XBP 仿真堆栈指针低8位  */
  60   1      
  61   1          return ((void *)ptos);
  62   1      }
  63          /*
  64          *******************************************************************************
  65                                          OSTaskCreateHook()
  66          功能描述: This function is called when a task is created.
  67          参    数: ptcb   is a pointer to the task control block of the task being created.
  68          说    明: 1) Interrupts are disabled during this call.
  69          *******************************************************************************
  70          */
  71          #if OS_CPU_HOOKS_EN > 0 
  72          void OSTaskCreateHook(OS_TCB *ptcb) reentrant
  73          {
  74   1          ptcb = ptcb;                 /* Prevent compiler warning                 */
  75   1      }
  76          #endif
  77          /*
  78          *******************************************************************************
  79                                          OSTaskDelHook()
  80          功能描述: This function is called when a task is deleted.
  81          参    数: ptcb   is a pointer to the task control block of the task being deleted.
  82          说    明: 1) Interrupts are disabled during this call.
  83          *******************************************************************************
  84          */
  85          #if OS_CPU_HOOKS_EN > 0 
  86          void OSTaskDelHook(OS_TCB *ptcb) reentrant
  87          {
  88   1          ptcb = ptcb;                 /* Prevent compiler warning                 */
  89   1      }
  90          #endif
  91          /*
  92          *******************************************************************************
  93                                          OSTaskSwHook()
  94          功能描述: This function is called when a task switch is performed.  This allows you to perform other
  95                    operations during a context switch.
  96          参    数: none
  97          说    明: 1) Interrupts are disabled during this call.
  98                    2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
  99                       will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
 100                       task being switched out (i.e. the preempted task).
 101          *******************************************************************************
 102          */
 103          #if OS_CPU_HOOKS_EN > 0 
 104          void OSTaskSwHook(void) reentrant
 105          {
 106   1      }
 107          #endif
 108          /*
 109          *******************************************************************************
 110                                          OSTaskIdleHook()
 111          功能描述: This function is called by the idle task.  This hook has been added to allow you to do  
 112                    such things as STOP the CPU to conserve power.
 113          参    数: none
 114          说    明: 1) Interrupts are enabled during this call.
 115          *******************************************************************************
 116          */
 117          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
C51 COMPILER V7.50   OS_CPU_C                                                              01/25/2007 14:15:00 PAGE 3   

 118          void  OSTaskIdleHook (void)reentrant
 119          {
 120   1      }
 121          #endif
 122          /*
 123          *******************************************************************************
 124                                          OSTaskStatHook()
 125          功能描述: This function is called every second by uC/OS-II's statistics task.  This allows your 
 126                    application to add functionality to the statistics task.
 127          参    数: none
 128          说    明:
 129          *******************************************************************************
 130          */
 131          #if OS_CPU_HOOKS_EN > 0 
 132          void OSTaskStatHook(void) reentrant
 133          {
 134   1      }
 135          #endif
 136          /*
 137          *******************************************************************************
 138                                          OSTimeTickHook()
 139          功能描述: This function is called every tick.
 140          参    数: none
 141          说    明: 1) Interrupts may or may not be ENABLED during this call.
 142          *******************************************************************************
 143          */
 144          #if OS_CPU_HOOKS_EN > 0
 145          void OSTimeTickHook (void) reentrant
 146          {
 147   1      }
 148          #endif
 149          /*
 150          *******************************************************************************
 151                                          OSInitHookBegin()
 152          功能描述: This function is called by OSInit() at the beginning of OSInit().
 153          参    数: none
 154          说    明: 1) Interrupts should be disabled during this call.
 155          *******************************************************************************
 156          */
 157          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 158          void  OSInitHookBegin (void) reentrant
 159          {
 160   1      }
 161          #endif
 162          /*
 163          *******************************************************************************
 164                                          OSInitHookEnd()
 165          功能描述: This function is called by OSInit() at the beginning of OSInit().
 166          参    数: none
 167          说    明: 1) Interrupts should be disabled during this call.
 168          *******************************************************************************
 169          */
 170          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 171          void  OSInitHookEnd (void) reentrant
 172          {
 173   1      }
 174          #endif
 175          /*
 176          *******************************************************************************
 177                                          OSTCBInitHook()
 178          功能描述: This function is called by OS_TCBInit() after setting up most of the TCB.
 179          参    数: ptcb    is a pointer to the TCB of the task being created.
C51 COMPILER V7.50   OS_CPU_C                                                              01/25/2007 14:15:00 PAGE 4   

 180          说    明: 1) Interrupts may or may not be ENABLED during this call.
 181          *******************************************************************************
 182          */
 183          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 184          void  OSTCBInitHook (OS_TCB *ptcb) reentrant
 185          {
 186   1          ptcb = ptcb;                 /* Prevent Compiler warning                 */
 187   1      }
 188          #endif


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    758    ----
   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 + -