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

📄 os_cpu_c.lst

📁 本文面向首次接触uC/OS-II的程序员
💻 LST
📖 第 1 页 / 共 2 页
字号:
 155          * Note(s)    : 1) stack stored as following format
 156          
 157          ;       CONTENT                                                                                                 START POSITION IN OSTCBStk      
 158          ;       ----------                                                                                              ----------------------          
 159          ;       AR7                                                                     
 160          ;       AR6
 161          ;       AR5
 162          ;       AR4
 163          ;       AR3
 164          ;       AR2
 165          ;       AR1
 166          ;       AR0
 167          ;       PSW
 168          ;       DPL
 169          ;       DPH
 170          ;       B
 171          ;       ACC                                                             
 172          ;       HARDWARE STACK CONTENT(NOT INCLUDE REGISTERS)                   2+SmltStkSize                                           
 173          ;       HARDWARE STACK SIZE(INCLUDE REGISTERS)                                  1+SmltStkSize           
 174          ;       SIMULATED STACK CONTENT                                                                 1                               
 175          ;       ?C_IBP                                                                                                  0
 176                                  
 177          *********************************************************************************************************
 178          */
C51 COMPILER V7.06   OS_CPU_C                                                              07/07/2005 22:40:45 PAGE 4   

 179          OS_STK  *OSTaskStkInit (void (*task)(void *pd) reentrant, void *os_pdata, OS_STK *ptos, INT16U opt) reentr
             -ant
 180          {
 181   1              OS_STK *stk;
 182   1      
 183   1          os_pdata = os_pdata;
 184   1          opt    = opt;                               //opt没被用到,保留此语句防止告警产生
 185   1          
 186   1          stk    = (OS_STK *)ptos;                    //用户堆栈最低有效地址
 187   1      
 188   1              *stk++ = 2 + 13;                                                        /* tow bytes of return address and 13 byte registers */
 189   1          *stk++ = (INT16U)task & 0xFF;               /* low byte of return address   */
 190   1              *stk++ = (INT16U)task >> 8;                 /* high byte of return address      */
 191   1          *stk++ = 0x0A;                              /* ACC          */
 192   1          *stk++ = 0x0B;                              /* B            */
 193   1          *stk++ = 0xD1;                              /* DPH          */
 194   1          *stk++ = 0xD0;                              /* DPL          */
 195   1              *stk++ = 0x00;                              /* PSW              */
 196   1          *stk++ = 0x00;                              /* R0           */
 197   1          *stk++ = 0x01;                              /* R1           */
 198   1          *stk++ = 0x02;                              /* R2           */
 199   1          *stk++ = 0x03;                              /* R3           */
 200   1          *stk++ = 0x04;                              /* R4           */
 201   1          *stk++ = 0x05;                              /* R5           */
 202   1          *stk++ = 0x06;                              /* R6           */
 203   1          *stk++ = 0x07;                              /* R7           */
 204   1              
 205   1          return ((void *)ptos);
 206   1      }
 207          
 208          /*$PAGE*/
 209          
 210          /*
 211          *********************************************************************************************************
 212          *                                           TASK SWITCH HOOK
 213          *
 214          * Description: This function is called when a task switch is performed.  This allows you to perform other
 215          *              operations during a context switch.
 216          *
 217          * Arguments  : none
 218          *
 219          * Note(s)    : 1) Interrupts are disabled during this call.
 220          *              2) It is assumed that the global pointer 'OSTCBHighRdy' points to the TCB of the task that
 221          *                 will be 'switched in' (i.e. the highest priority task) and, 'OSTCBCur' points to the 
 222          *                 task being switched out (i.e. the preempted task).
 223          *********************************************************************************************************
 224          */
 225          #if OS_CPU_HOOKS_EN > 0 
 226          void  OSTaskSwHook (void) reentrant
 227          {
 228   1      }
 229          #endif
 230          
 231          /*
 232          *********************************************************************************************************
 233          *                                           OSTCBInit() HOOK
 234          *
 235          * Description: This function is called by OS_TCBInit() after setting up most of the TCB.
 236          *
 237          * Arguments  : ptcb    is a pointer to the TCB of the task being created.
 238          *
 239          * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
C51 COMPILER V7.06   OS_CPU_C                                                              07/07/2005 22:40:45 PAGE 5   

 240          *********************************************************************************************************
 241          */
 242          #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 243          void  OSTCBInitHook (OS_TCB *ptcb) reentrant
 244          {
 245   1          ptcb = ptcb;                                           /* Prevent Compiler warning                 */
 246   1      }
 247          #endif
 248          
 249          
 250          /*
 251          *********************************************************************************************************
 252          *                                               TICK HOOK
 253          *
 254          * Description: This function is called every tick.
 255          *
 256          * Arguments  : none
 257          *
 258          * Note(s)    : 1) Interrupts may or may not be ENABLED during this call.
 259          *********************************************************************************************************
 260          */
 261          #if OS_CPU_HOOKS_EN > 0 
 262          void  OSTimeTickHook (void) reentrant
 263          {
 264   1      }
 265          #endif
 266          
 267          
 268          /*
 269          *********************************************************************************************************
 270          *                                                                                       中断服务程序外挂
 271          *               NOTE  :  注意:所有中断外挂都在临界区之外,用户可以自行控制进/退临界区
 272          *********************************************************************************************************
 273          */
 274          #if OS_ISR_T1_EN > 0
              void    OSISR_T1HOOK (void) reentrant
              {
                              /* 请在这里输入中断服务程序                             */
              }
              #endif
 280          
 281          #if OS_ISR_INT0_EN > 0
              void    OSISR_INT0HOOK (void) reentrant
              {
                              /* 请在这里输入中断服务程序                             */
              }
              #endif
 287          
 288          #if OS_ISR_INT1_EN > 0
              void    OSISR_INT1HOOK (void) reentrant
              {
                              /* 请在这里输入中断服务程序                             */
              }
              #endif
 294          
 295          #if OS_ISR_S0_EN > 0
 296          void    OSISR_S0HOOK (void) reentrant
 297          {
 298   1                      /* 请在这里输入中断服务程序                             */
 299   1      }
 300          #endif

C51 COMPILER V7.06   OS_CPU_C                                                              07/07/2005 22:40:45 PAGE 6   


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