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

📄 os_cpu_c.lst

📁 移植的ucos
💻 LST
📖 第 1 页 / 共 2 页
字号:
##############################################################################
#                                                                            #
# IAR AT90S C-Compiler V1.41C/386                                            #
#                                                                            #
#       Compile time  =  05/Aug/2001  14:39:15                               #
#       Target option =  Max 64 KB data +   8 KB code (8515 4414...)         #
#       Memory model  =  small                                               #
#       Source file   =  os_cpu_c.c                                          #
#       List file     =  ..\lst\os_cpu_c.lst                                 #
#       Object file   =  ..\obj\os_cpu_c.r90                                 #
#       Command line  =  -C -r -ms -v1 -K -e -y -z9 -q -o                    #
#                        ..\obj\os_cpu_c.r90 -l ..\lst\os_cpu_c os_cpu_c.c   #
#                                                                            #
#                           Copyright 1998 IAR Systems. All rights reserved. #
##############################################################################

   \                     	NAME	os_cpu_c(17)
   \                     	RSEG	CODE(0)
   \                     	PUBLIC	OSInitHookBegin
   \                     	PUBLIC	OSInitHookEnd
   \                     	PUBLIC	OSTCBInitHook
   \                     	PUBLIC	OSTaskCreateHook
   \                     	PUBLIC	OSTaskDelHook
   \                     	PUBLIC	OSTaskIdleHook
   \                     	PUBLIC	OSTaskStatHook
   \                     	PUBLIC	OSTaskStkInit
   \                     	PUBLIC	OSTaskSwHook
   \                     	PUBLIC	OSTimeTickHook
   \                     	EXTERN	?CL1S_1_40_L08
   \                     	RSEG	CODE
   \                     OSTaskStkInit:
      1          /*
      2           *********************************************************************************************************
      3           *                                              uC/OS-II
      4           *                                        The Real-Time Kernel
      5           *
      6           *                                          AVR Specific code
      7           *
      8           * File     : OS_CPU_C.C
      9           * By       : Ole Saether
     10           *
     11           * $Modtime: 19.07.01 22:34 $
     12           * $Revision: 3 $
     13           * 
     14           *********************************************************************************************************
     15          */
     16          
     17          #define  OS_CPU_GLOBALS
     18          #include "includes.h"
     19          
     20          /*
     21          **********************************************************************************************************
     22          *                                        INITIALIZE A TASK'S STACK
     23          *
     24          * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
     25          *              stack frame of the task being created. This function is highly processor specific.
     26          *
     27          * Arguments  : task          is a pointer to the task code
     28          *
     29          *              pdata         is a pointer to a user supplied data area that will be passed to the task
     30          *                            when the task first executes.
     31          *
     32          *              ptos          is a pointer to the top of stack. It is assumed that 'ptos' points to the
     33          *                            highest valid address on the stack.
     34          *
     35          *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
     36          *                            (see uCOS_II.H for OS_TASK_OPT_???).
     37          *
     38          * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
     39          *              been placed on the stack in the proper order.
     40          *
     41          * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
     42          *              SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
     43          *              application code would be responsible for enabling interrupts at the beginning of the task
     44          *              code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable
     45          *              interrupts. Failure to do this will make your system crash!
     46          *
     47          *              The AVR return stack is placed 64 bytes above the start of the (512 byte) stack. This
     48          *              provides 32 levels of function call nesting which should be more than enough for most
     49          *              applications (see the file "readme.txt" in the Doc folder for more info).
     50          *
     51          **********************************************************************************************************
     52          */
     53          
     54          OS_STK *OSTaskStkInit (void (*task)(void *pd), void *pdata, OS_STK *ptos, INT16U opt)
     55          {
   \   00000000   2E00                       MOV     R0,R16
   \   00000002   2E11                       MOV     R1,R17
   \   00000004   8108                       LDD     R16,Y+0
   \   00000006   8119                       LDD     R17,Y+1
   \   00000008   812A                       LDD     R18,Y+2
   \   0000000A   813B                       LDD     R19,Y+3
     56              INT8U  *stk;
     57              INT8U  *stks;                           /* Temp. variable used for setting up AVR hardware stack    */
     58              INT16U  tmp;
     59          
     60          
     61              opt     = opt;                          /* 'opt' is not used, prevent warning                       */
     62              stk     = (INT8U *)ptos;
   \   0000000C   2F60                       MOV     R22,R16
   \   0000000E   2F71                       MOV     R23,R17
     63              stks    = (INT8U *)(ptos)-(OS_TASK_DEF_STK_SIZE-64);/* AVR return stack ("hardware stack")          */
   \   00000010   5C00                       SUBI    R16,LOW(192)
   \   00000012   4011                       SBCI    R17,LOW(1)
     64              tmp     = (INT16U)task;
     65              *stks-- = (INT8U)tmp;                   /* Put task start address on top of hardware stack          */
   \   00000014   D02D                       RCALL   ?0048
   \   00000016   8200                       ST      Z,R0
     66              *stks-- = (INT8U)(tmp >> 8);
   \   00000018   D02B                       RCALL   ?0048
   \   0000001A   8210                       ST      Z,R1
     67          
     68              *stk-- = (INT8U)0x00;                   /* R0  = 0x00                                               */
   \   0000001C   2400                       CLR     R0
   \   0000001E   D02D                       RCALL   ?0049
     69              *stk-- = (INT8U)0x00;                   /* R1  = 0x00                                               */
   \   00000020   D02D                       RCALL   ?0050
     70              *stk-- = (INT8U)0x00;                   /* R2  = 0x00                                               */
   \   00000022   D02C                       RCALL   ?0050
     71              *stk-- = (INT8U)0x00;                   /* R3  = 0x00                                               */
   \   00000024   D02B                       RCALL   ?0050
     72              *stk-- = (INT8U)0x00;                   /* R4  = 0x00                                               */
   \   00000026   D02A                       RCALL   ?0050
     73              *stk-- = (INT8U)0x00;                   /* R5  = 0x00                                               */
   \   00000028   D029                       RCALL   ?0050
     74              *stk-- = (INT8U)0x00;                   /* R6  = 0x00                                               */
   \   0000002A   D028                       RCALL   ?0050
     75              *stk-- = (INT8U)0x00;                   /* R7  = 0x00                                               */
   \   0000002C   D027                       RCALL   ?0050
     76              *stk-- = (INT8U)0x00;                   /* R8  = 0x00                                               */
   \   0000002E   D026                       RCALL   ?0050
     77              *stk-- = (INT8U)0x00;                   /* R9  = 0x00                                               */
   \   00000030   D025                       RCALL   ?0050
     78              *stk-- = (INT8U)0x00;                   /* R10 = 0x00                                               */
   \   00000032   D024                       RCALL   ?0050
     79              *stk-- = (INT8U)0x00;                   /* R11 = 0x00                                               */
   \   00000034   D023                       RCALL   ?0050
     80              *stk-- = (INT8U)0x00;                   /* R12 = 0x00                                               */
   \   00000036   D022                       RCALL   ?0050
     81              *stk-- = (INT8U)0x00;                   /* R13 = 0x00                                               */
   \   00000038   D021                       RCALL   ?0050
     82              *stk-- = (INT8U)0x00;                   /* R14 = 0x00                                               */
   \   0000003A   D020                       RCALL   ?0050
     83              *stk-- = (INT8U)0x00;                   /* R15 = 0x00                                               */
   \   0000003C   D01F                       RCALL   ?0050
     84              tmp    = (INT16U)pdata;
     85              *stk-- = (INT8U)tmp;                    /* Simulate call to function with argument                  */
   \   0000003E   D020                       RCALL   ?0051
     86              *stk-- = (INT8U)(tmp >> 8);
   \   00000040   8350                       ST      Z,R21
     87              *stk-- = (INT8U)0x00;                   /* R18 = 0x00                                               */
   \   00000042   D01B                       RCALL   ?0049
     88              *stk-- = (INT8U)0x00;                   /* R19 = 0x00                                               */
   \   00000044   D01B                       RCALL   ?0050
     89              *stk-- = (INT8U)0x00;                   /* R20 = 0x00                                               */
   \   00000046   D01A                       RCALL   ?0050
     90              *stk-- = (INT8U)0x00;                   /* R21 = 0x00                                               */
   \   00000048   D019                       RCALL   ?0050
     91              *stk-- = (INT8U)0x00;                   /* R22 = 0x00                                               */
   \   0000004A   D018                       RCALL   ?0050
     92              *stk-- = (INT8U)0x00;                   /* R23 = 0x00                                               */
   \   0000004C   D017                       RCALL   ?0050
     93              *stk-- = (INT8U)0x00;                   /* R24 = 0x00                                               */
   \   0000004E   D016                       RCALL   ?0050
     94              *stk-- = (INT8U)0x00;                   /* R25 = 0x00                                               */
   \   00000050   D015                       RCALL   ?0050
     95              *stk-- = (INT8U)0x00;                   /* R26 = 0x00                                               */
   \   00000052   D014                       RCALL   ?0050
     96              *stk-- = (INT8U)0x00;                   /* R27 = 0x00                                               */
   \   00000054   D013                       RCALL   ?0050
     97                                                      /* will not store the heap pointer Y=R29:R28                */
     98              *stk-- = (INT8U)0x00;                   /* R30 = 0x00                                               */
   \   00000056   D012                       RCALL   ?0050
     99              *stk-- = (INT8U)0x00;                   /* R31 = 0x00                                               */
   \   00000058   8200                       ST      Z,R0
    100              *stk-- = (INT8U)0x80;                   /* SREG = Interrupts enabled                                */
   \   0000005A   E840                       LDI     R20,128
   \   0000005C   D012                       RCALL   ?0053
   \   0000005E   D010                       RCALL   ?0051
    101              tmp    = (INT16U)(stks);
    102              *stk-- = (INT8U)(tmp >> 8);             /* SPH                                                      */
   \   00000060   8310                       ST      Z,R17
    103              *stk   = (INT8U)(tmp);                  /* SPL                                                      */
   \   00000062   2FE6                       MOV     R30,R22
   \   00000064   2FF7                       MOV     R31,R23
   \   00000066   8300                       ST      Z,R16
    104              return ((void *)stk);
   \   00000068   2F06                       MOV     R16,R22
   \   0000006A   2F17                       MOV     R17,R23
    105          }
   \   0000006C   9624                       ADIW    R28,LOW(4)
   \   0000006E   9508                       RET     
   \                     ?0048:
   \   00000070   2FE0                       MOV     R30,R16
   \   00000072   2FF1                       MOV     R31,R17
   \   00000074   5001                       SUBI    R16,LOW(1)
   \   00000076   4010                       SBCI    R17,LOW(0)
   \   00000078   9508                       RET     
   \                     ?0049:
   \   0000007A   D003                       RCALL   ?0053
   \                     ?0050:
   \   0000007C   8200                       ST      Z,R0
   \   0000007E   C001                       RJMP    ?0053

⌨️ 快捷键说明

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