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

📄 os_cpu_c.lst

📁 uCOS 嵌入式操作系统的改进版,增加了网络通讯.
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   OS_CPU_C                                                              07/29/2003 20:45:08 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE OS_CPU_C
OBJECT MODULE PLACED IN .\os_cpu_c.obj
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE ..\keilc51\os_cpu_c.c LARGE 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-2002, Jean J. Labrosse, Weston, FL
   7          *                                          All Rights Reserved
   8          *
   9          *
  10          *                                       80x86/80x88 Specific code
  11          *                                          LARGE MEMORY MODEL
  12          *
  13          *                                          Borland C/C++ V4.51
  14          *
  15          * File         : OS_CPU_C.C
  16          * By           : Jean J. Labrosse
  17          *********************************************************************************************************
  18          */
  19          
  20          #define  OS_CPU_GLOBALS
  21          #include "includes.h"
  22          
  23          /*
  24          *********************************************************************************************************
  25          *                                       OS INITIALIZATION HOOK
  26          *                                            (BEGINNING)
  27          *
  28          * Description: This function is called by OSInit() at the beginning of OSInit().
  29          *
  30          * Arguments  : none
  31          *
  32          * Note(s)    : 1) Interrupts should be disabled during this call.
  33          *********************************************************************************************************
  34          */
  35          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
  36          void  OSInitHookBegin (void) reentrant //using 0
  37          {
  38   1      }
  39          #endif
  40          
  41          /*
  42          *********************************************************************************************************
  43          *                                       OS INITIALIZATION HOOK
  44          *                                               (END)
  45          *
  46          * Description: This function is called by OSInit() at the end of OSInit().
  47          *
  48          * Arguments  : none
  49          *
  50          * Note(s)    : 1) Interrupts should be disabled during this call.
  51          *********************************************************************************************************
  52          */
  53          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
  54          void  OSInitHookEnd (void) reentrant //using 0
C51 COMPILER V7.06   OS_CPU_C                                                              07/29/2003 20:45:08 PAGE 2   

  55          {
  56   1      }
  57          #endif
  58          
  59          /*$PAGE*/
  60          /*
  61          *********************************************************************************************************
  62          *                                          TASK CREATION HOOK
  63          *
  64          * Description: This function is called when a task is created.
  65          *
  66          * Arguments  : ptcb   is a pointer to the task control block of the task being created.
  67          *
  68          * Note(s)    : 1) Interrupts are disabled during this call.
  69          *********************************************************************************************************
  70          */
  71          #if OS_CPU_HOOKS_EN > 0 
  72          void  OSTaskCreateHook (OS_TCB *ptcb) reentrant //using 0
  73          {
  74   1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
  75   1      }
  76          #endif
  77          
  78          
  79          /*
  80          *********************************************************************************************************
  81          *                                           TASK DELETION HOOK
  82          *
  83          * Description: This function is called when a task is deleted.
  84          *
  85          * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
  86          *
  87          * Note(s)    : 1) Interrupts are disabled during this call.
  88          *********************************************************************************************************
  89          */
  90          #if OS_CPU_HOOKS_EN > 0 
  91          void  OSTaskDelHook (OS_TCB *ptcb) reentrant //using 0
  92          {
  93   1          ptcb = ptcb;                       /* Prevent compiler warning                                     */
  94   1      }
  95          #endif
  96          
  97          /*
  98          *********************************************************************************************************
  99          *                                             IDLE TASK HOOK
 100          *
 101          * Description: This function is called by the idle task.  This hook has been added to allow you to do  
 102          *              such things as STOP the CPU to conserve power.
 103          *
 104          * Arguments  : none
 105          *
 106          * Note(s)    : 1) Interrupts are enabled during this call.
 107          *********************************************************************************************************
 108          */
 109          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
 110          void  OSTaskIdleHook (void) reentrant //using 0
 111          {
 112   1              
 113   1      }
 114          #endif
 115          
 116          /*
C51 COMPILER V7.06   OS_CPU_C                                                              07/29/2003 20:45:08 PAGE 3   

 117          *********************************************************************************************************
 118          *                                           STATISTIC TASK HOOK
 119          *
 120          * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
 121          *              application to add functionality to the statistics task.
 122          *
 123          * Arguments  : none
 124          *********************************************************************************************************
 125          */
 126          
 127          #if OS_CPU_HOOKS_EN > 0 
 128          void  OSTaskStatHook (void) reentrant //using 0
 129          {
 130   1      }
 131          #endif
 132          
 133          /*$PAGE*/
 134          /*
 135          *********************************************************************************************************
 136          *                                        INITIALIZE A TASK'S STACK
 137          *
 138          * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
 139          *              stack frame of the task being created.  This function is highly processor specific.
 140          *
 141          * Arguments  : task          is a pointer to the task code
 142          *
 143          *              pdata         is a pointer to a user supplied data area that will be passed to the task
 144          *                            when the task first executes.
 145          *
 146          *              ptos          is a pointer to the top of stack.  It is assumed that 'ptos' points to
 147          *                            a 'free' entry on the task stack.  If OS_STK_GROWTH is set to 1 then 
 148          *                            'ptos' will contain the HIGHEST valid address of the stack.  Similarly, if
 149          *                            OS_STK_GROWTH is set to 0, the 'ptos' will contains the LOWEST valid address
 150          *                            of the stack.
 151          *
 152          *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
 153          *                            (see uCOS_II.H for OS_TASK_OPT_???).
 154          *
 155          * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
 156          *              been placed on the stack in the proper order.
 157          *
 158          * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
 159          *              PSW to 0x0002 instead.  In this case, interrupts would be disabled upon task startup.  The
 160          *              application code would be responsible for enabling interrupts at the beginning of the task
 161          *              code.  You will need to modify OSTaskIdle() and OSTaskStat() so that they enable 
 162          *              interrupts.  Failure to do this will make your system crash!
 163          *********************************************************************************************************
 164          */
 165          //#Lin@20030715#need to modify
 166          //#define       UserMaxStkSize  100
 167          
 168          OS_STK  *OSTaskStkInit (void (*task)(void *pd), void *pndata, OS_STK *ptos, INT16U opt) reentrant //using 
             -0
 169          {
 170   1      //    INT16U *stk;
 171   1      
 172   1      
 173   1      
 174   1      #if     0//#Lin
                  stk    = (INT16U *)ptos;                /* Load stack pointer                                      */
                  *stk-- = (INT16U)FP_SEG(pdatap);         /* Simulate call to function with argument                 */
                  *stk-- = (INT16U)FP_OFF(pdatap);         
C51 COMPILER V7.06   OS_CPU_C                                                              07/29/2003 20:45:08 PAGE 4   

                  *stk-- = (INT16U)FP_SEG(task);
                  *stk-- = (INT16U)FP_OFF(task);
                  *stk-- = (INT16U)0x0202;                /* SW = Interrupts enabled                                 */
                  *stk-- = (INT16U)FP_SEG(task);          /* Put pointer to task   on top of stack                   */
                  *stk-- = (INT16U)FP_OFF(task);
                  *stk-- = (INT16U)0xAAAA;                /* AX = 0xAAAA                                             */
                  *stk-- = (INT16U)0xCCCC;                /* CX = 0xCCCC                                             */
                  *stk-- = (INT16U)0xDDDD;                /* DX = 0xDDDD                                             */
                  *stk-- = (INT16U)0xBBBB;                /* BX = 0xBBBB                                             */
                  *stk-- = (INT16U)0x0000;                /* SP = 0x0000                                             */
                  *stk-- = (INT16U)0x1111;                /* BP = 0x1111                                             */
                  *stk-- = (INT16U)0x2222;                /* SI = 0x2222                                             */
                  *stk-- = (INT16U)0x3333;                /* DI = 0x3333                                             */
                  *stk-- = (INT16U)0x4444;                /* ES = 0x4444                                             */
                  *stk   = _DS;                           /* DS = Current value of DS                                */
              #else
 194   1      
 195   1          OS_STK      *stk;
 196   1      //    OS_STK    idata   *UsrStkSP;
 197   1      
 198   1      //      *UsrStkSP = SP;
 199   1          opt    = opt;                           /* 'opt' is not used, prevent warning                      */
 200   1              pndata = pndata;
 201   1      
 202   1          stk    = (OS_STK *)ptos;                    //
 203   1          *stk++ = 15;                                //Count
 204   1          *stk++ = (INT16U)task & 0xFF;               //task RET
 205   1          *stk++ = (INT16U)task >> 8;                 //task RET
 206   1      //    *stk++ = 0x00;                              //isr reti
 207   1      //    *stk++ = 0x00;                              //isr reti
 208   1          *stk++ = 0x0A;                              //ACC
 209   1          *stk++ = 0x0B;                              //B
 210   1          *stk++ = 0x00;                              //DPH
 211   1          *stk++ = 0x00;                              //DPL
 212   1          *stk++ = 0x00;                              //PSW
 213   1          *stk++ = 0x00;                              //R0
 214   1          *stk++ = 0x01;                              //R1
 215   1          *stk++ = 0x02;                              //R2
 216   1          *stk++ = 0x03;                              //R3
 217   1          *stk++ = 0x04;                              //R4
 218   1          *stk++ = 0x05;                              //R5
 219   1          *stk++ = 0x06;                              //R6
 220   1          *stk++ = 0x07;                              //R7
 221   1      //    *stk++ = UsrStkSP & 0xff;                              //R7
 222   1      //    *stk++ = UsrStkSP >> 8;                              //R7
 223   1      
 224   1      /*
 225   1              PUSH    ACC
 226   1              PUSH    B
 227   1              PUSH    DPH
 228   1              PUSH    DPL

⌨️ 快捷键说明

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