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

📄 os_cpu_c.lst

📁 将ucos-II 移植到 KeilC51 的小模式下。由于小模式运行速度比大模式运行速度快很多
💻 LST
字号:
C51 COMPILER V7.06   OS_CPU_C                                                              11/20/2008 19:25:21 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE OS_CPU_C
OBJECT MODULE PLACED IN .\OS_CPU_C.obj
COMPILER INVOKED BY: f:\Keil\C51\BIN\C51.EXE ..\uc_51\OS_CPU_C.C BROWSE DEBUG OBJECTEXTEND PRINT(.\OS_CPU_C.lst) TABS(2)
                    - 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          
  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.06   OS_CPU_C                                                              11/20/2008 19:25:21 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          void OSTickISR() interrupt 1
 111          {
 112   1        TL0 = TIMER_24M_25MS_L;
 113   1        TH0 = TIMER_24M_25MS_H;
 114   1      
 115   1        OSIntEnter();
C51 COMPILER V7.06   OS_CPU_C                                                              11/20/2008 19:25:21 PAGE 3   

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

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