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

📄 os_cpu_c.lis

📁 把UCOSII移植到AVR MEGA8上的程序 应用程序为驱动1602显示器,虽说有些简单,但可测试UCOS的运行
💻 LIS
📖 第 1 页 / 共 3 页
字号:
 000E           ; * Arguments  : task          is a pointer to the task code
 000E           ; *
 000E           ; *              p_arg         is a pointer to a user supplied data area that will be passed to the task
 000E           ; *                            when the task first executes.
 000E           ; *
 000E           ; *              ptos          is a pointer to the top of stack. It is assumed that 'ptos' points to the
 000E           ; *                            highest valid address on the stack.
 000E           ; *
 000E           ; *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
 000E           ; *                            (see uCOS_II.H for OS_TASK_OPT_???).
 000E           ; *
 000E           ; * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
 000E           ; *              been placed on the stack in the proper order.
 000E           ; *
 000E           ; * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
 000E           ; *              SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
 000E           ; *              application code would be responsible for enabling interrupts at the beginning of the task
 000E           ; *              code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable interrupts.
 000E           ; *              Failure to do this will make your system crash!
 000E           ; *
 000E           ; *              The AVR return stack is placed OS_TASK_HARD_STK_SIZE bytes before the bottom of the task's
 000E           ; *              stack.
 000E           ; *
 000E           ; *              (1) IMPORTANT: The ICC compiler handles function pointers by actually passing the pointer
 000E           ; *                             to a location in Flash that actually contains the pointer to the function.
 000E           ; **********************************************************************************************************
 000E           ; */
 000E           ; 
 000E           ; OS_STK  *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
 000E           ; {
 000E                   .dbline 173
 000E           ;     INT8U  *psoft_stk;
 000E           ;     INT8U  *phard_stk;                      /* Temp. variable used for setting up AVR hardware stack    */
 000E           ;     INT16U  tmp;
 000E           ; 
 000E           ; 
 000E           ;     opt          = opt;                     /* 'opt' is not used, prevent warning                       */
 000E                   .dbline 174
 000E           ;     psoft_stk    = (INT8U *)ptos;
 000E 4E81              ldd R20,y+6
 0010 5F81              ldd R21,y+7
 0012                   .dbline 175
 0012           ;     phard_stk    = (INT8U *)ptos
 0012 20900200          lds R2,_OSTaskStkSize
 0016 30900300          lds R3,_OSTaskStkSize+1
 001A 2A01              movw R4,R20
 001C 4218              sub R4,R2
 001E 5308              sbc R5,R3
 0020 A0900000          lds R10,_OSTaskHardStkSize
 0024 B0900100          lds R11,_OSTaskHardStkSize+1
 0028 A40C              add R10,R4
 002A B51C              adc R11,R5
 002C                   .dbline 179
 002C           ;                  - OSTaskStkSize            /* Task stack size                                          */
 002C           ;                  + OSTaskHardStkSize;       /* AVR return stack ("hardware stack")                      */
 002C           ; 
 002C           ;     tmp          = *(INT16U const *)task;   /* (1) ICC compiler handles function pointers indirectly!   */
 002C F801              movw R30,R16
 002E 6591              lpm R22,Z+
 0030 7491              lpm R23,Z
 0032                   .dbline 181
 0032           ; 
 0032           ;     *phard_stk-- = (INT8U)tmp;              /* Put task start address on top of "hardware stack"        */
 0032 1501              movw R2,R10
 0034 C101              movw R24,R2
 0036 0197              sbiw R24,1
 0038 F101              movw R30,R2
 003A 6083              std z+0,R22
 003C                   .dbline 182
 003C           ;     *phard_stk-- = (INT8U)(tmp >> 8);
 003C 1C01              movw R2,R24
 003E 0197              sbiw R24,1
 0040 5C01              movw R10,R24
 0042 2B01              movw R4,R22
 0044 452C              mov R4,R5
 0046 5524              clr R5
 0048 F101              movw R30,R2
 004A 4082              std z+0,R4
 004C                   .dbline 184
 004C           ; 
 004C           ;     *psoft_stk-- = (INT8U)0x00;             /* R0    = 0x00                                             */
 004C 1A01              movw R2,R20
 004E 4150              subi R20,1
 0050 5040              sbci R21,0
 0052 4424              clr R4
 0054 F101              movw R30,R2
 0056 4082              std z+0,R4
 0058                   .dbline 185
 0058           ;     *psoft_stk-- = (INT8U)0x01;             /* R1    = 0x01                                             */
 0058 1A01              movw R2,R20
 005A 4150              subi R20,1
 005C 5040              sbci R21,0
 005E 81E0              ldi R24,1
 0060 F101              movw R30,R2
 0062 8083              std z+0,R24
 0064                   .dbline 186
 0064           ;     *psoft_stk-- = (INT8U)0x02;             /* R2    = 0x02                                             */
 0064 1A01              movw R2,R20
 0066 4150              subi R20,1
 0068 5040              sbci R21,0
 006A 82E0              ldi R24,2
 006C F101              movw R30,R2
 006E 8083              std z+0,R24
 0070                   .dbline 187
 0070           ;     *psoft_stk-- = (INT8U)0x03;             /* R3    = 0x03                                             */
 0070 1A01              movw R2,R20
 0072 4150              subi R20,1
 0074 5040              sbci R21,0
 0076 83E0              ldi R24,3
 0078 F101              movw R30,R2
 007A 8083              std z+0,R24
 007C                   .dbline 188
 007C           ;     *psoft_stk-- = (INT8U)0x04;             /* R4    = 0x04                                             */
 007C 1A01              movw R2,R20
 007E 4150              subi R20,1
 0080 5040              sbci R21,0
 0082 84E0              ldi R24,4
 0084 F101              movw R30,R2
 0086 8083              std z+0,R24
 0088                   .dbline 189
 0088           ;     *psoft_stk-- = (INT8U)0x05;             /* R5    = 0x05                                             */
 0088 1A01              movw R2,R20
 008A 4150              subi R20,1
 008C 5040              sbci R21,0
 008E 85E0              ldi R24,5
 0090 F101              movw R30,R2
 0092 8083              std z+0,R24
 0094                   .dbline 190
 0094           ;     *psoft_stk-- = (INT8U)0x06;             /* R6    = 0x06                                             */
 0094 1A01              movw R2,R20
 0096 4150              subi R20,1
 0098 5040              sbci R21,0
 009A 86E0              ldi R24,6
 009C F101              movw R30,R2
 009E 8083              std z+0,R24
 00A0                   .dbline 191
 00A0           ;     *psoft_stk-- = (INT8U)0x07;             /* R7    = 0x07                                             */
 00A0 1A01              movw R2,R20
 00A2 4150              subi R20,1
 00A4 5040              sbci R21,0
 00A6 87E0              ldi R24,7
 00A8 F101              movw R30,R2
 00AA 8083              std z+0,R24
 00AC                   .dbline 192
 00AC           ;     *psoft_stk-- = (INT8U)0x08;             /* R8    = 0x08                                             */
 00AC 1A01              movw R2,R20
 00AE 4150              subi R20,1
 00B0 5040              sbci R21,0
 00B2 88E0              ldi R24,8
 00B4 F101              movw R30,R2
 00B6 8083              std z+0,R24
 00B8                   .dbline 193
 00B8           ;     *psoft_stk-- = (INT8U)0x09;             /* R9    = 0x09                                             */
 00B8 1A01              movw R2,R20
 00BA 4150              subi R20,1
 00BC 5040              sbci R21,0
 00BE 89E0              ldi R24,9
 00C0 F101              movw R30,R2
 00C2 8083              std z+0,R24
 00C4                   .dbline 194
 00C4           ;     *psoft_stk-- = (INT8U)0x10;             /* R10   = 0x10                                             */
 00C4 1A01              movw R2,R20
 00C6 4150              subi R20,1
 00C8 5040              sbci R21,0
 00CA 80E1              ldi R24,16
 00CC F101              movw R30,R2
 00CE 8083              std z+0,R24
 00D0                   .dbline 195
 00D0           ;     *psoft_stk-- = (INT8U)0x11;             /* R11   = 0x11                                             */
 00D0 1A01              movw R2,R20
 00D2 4150              subi R20,1
 00D4 5040              sbci R21,0
 00D6 81E1              ldi R24,17
 00D8 F101              movw R30,R2
 00DA 8083              std z+0,R24
 00DC                   .dbline 196
 00DC           ;     *psoft_stk-- = (INT8U)0x12;             /* R12   = 0x12                                             */
 00DC 1A01              movw R2,R20
 00DE 4150              subi R20,1
 00E0 5040              sbci R21,0
 00E2 82E1              ldi R24,18
 00E4 F101              movw R30,R2
 00E6 8083              std z+0,R24
 00E8                   .dbline 197
 00E8           ;     *psoft_stk-- = (INT8U)0x13;             /* R13   = 0x13                                             */
 00E8 1A01              movw R2,R20
 00EA 4150              subi R20,1
 00EC 5040              sbci R21,0
 00EE 83E1              ldi R24,19
 00F0 F101              movw R30,R2
 00F2 8083              std z+0,R24
 00F4                   .dbline 198
 00F4           ;     *psoft_stk-- = (INT8U)0x14;             /* R14   = 0x14                                             */
 00F4 1A01              movw R2,R20
 00F6 4150              subi R20,1
 00F8 5040              sbci R21,0
 00FA 84E1              ldi R24,20
 00FC F101              movw R30,R2
 00FE 8083              std z+0,R24
 0100                   .dbline 199
 0100           ;     *psoft_stk-- = (INT8U)0x15;             /* R15   = 0x15                                             */
 0100 1A01              movw R2,R20
 0102 4150              subi R20,1
 0104 5040              sbci R21,0
 0106 85E1              ldi R24,21
 0108 F101              movw R30,R2
 010A 8083              std z+0,R24
 010C                   .dbline 200
 010C           ;     tmp          = (INT16U)p_arg;
 010C B901              movw R22,R18
 010E                   .dbline 201
 010E           ;     *psoft_stk-- = (INT8U)tmp;              /* 'p_arg' passed in R17:R16                                */
 010E 1A01              movw R2,R20
 0110 4150              subi R20,1
 0112 5040              sbci R21,0
 0114 F101              movw R30,R2
 0116 6083              std z+0,R22
 0118                   .dbline 202
 0118           ;     *psoft_stk-- = (INT8U)(tmp >> 8);
 0118 1A01              movw R2,R20
 011A 4150              subi R20,1
 011C 5040              sbci R21,0
 011E 2B01              movw R4,R22
 0120 452C              mov R4,R5
 0122 5524              clr R5
 0124 F101              movw R30,R2
 0126 4082              std z+0,R4
 0128                   .dbline 203
 0128           ;     *psoft_stk-- = (INT8U)0x18;             /* R18   = 0x18                                             */
 0128 1A01              movw R2,R20
 012A 4150              subi R20,1
 012C 5040              sbci R21,0
 012E 88E1              ldi R24,24
 0130 F101              movw R30,R2
 0132 8083              std z+0,R24
 0134                   .dbline 204
 0134           ;     *psoft_stk-- = (INT8U)0x19;             /* R19   = 0x19                                             */
 0134 1A01              movw R2,R20
 0136 4150              subi R20,1

⌨️ 快捷键说明

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