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

📄 project.lst

📁 ucos在mega128的移植
💻 LST
📖 第 1 页 / 共 5 页
字号:
(0043) *
(0044) * Note(s)    : 1) Interrupts should be disabled during this call.
(0045) *********************************************************************************************************
(0046) */
(0047) #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
(0048) void  OSInitHookEnd (void)
(0049) {
(0050) }
_OSInitHookEnd:
    0179 9508      RET
(0051) #endif
(0052) 
(0053) /*$PAGE*/
(0054) /*
(0055) *********************************************************************************************************
(0056) *                                          TASK CREATION HOOK
(0057) *
(0058) * Description: This function is called when a task is created.
(0059) *
(0060) * Arguments  : ptcb   is a pointer to the task control block of the task being created.
(0061) *
(0062) * Note(s)    : 1) Interrupts are disabled during this call.
(0063) *********************************************************************************************************
(0064) */
(0065) #if OS_CPU_HOOKS_EN > 0 
(0066) void  OSTaskCreateHook (OS_TCB *ptcb)
(0067) {
(0068) #ifdef OS_VIEW_MODULE
(0069)     OSView_TaskCreateHook(ptcb);
(0070) #else
(0071)     ptcb = ptcb;                       /* Prevent compiler warning                                     */
(0072) #endif
(0073) }
_OSTaskCreateHook:
  ptcb                 --> R16
    017A 9508      RET
(0074) #endif
(0075) 
(0076) 
(0077) /*
(0078) *********************************************************************************************************
(0079) *                                           TASK DELETION HOOK
(0080) *
(0081) * Description: This function is called when a task is deleted.
(0082) *
(0083) * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
(0084) *
(0085) * Note(s)    : 1) Interrupts are disabled during this call.
(0086) *********************************************************************************************************
(0087) */
(0088) #if OS_CPU_HOOKS_EN > 0 
(0089) void  OSTaskDelHook (OS_TCB *ptcb)
(0090) {
(0091)     ptcb = ptcb;                       /* Prevent compiler warning                                     */
(0092) }
_OSTaskDelHook:
  ptcb                 --> R16
    017B 9508      RET
(0093) #endif
(0094) 
(0095) /*
(0096) *********************************************************************************************************
(0097) *                                             IDLE TASK HOOK
(0098) *
(0099) * Description: This function is called by the idle task.  This hook has been added to allow you to do  
(0100) *              such things as STOP the CPU to conserve power.
(0101) *
(0102) * Arguments  : none
(0103) *
(0104) * Note(s)    : 1) Interrupts are enabled during this call.
(0105) *********************************************************************************************************
(0106) */
(0107) #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
(0108) void  OSTaskIdleHook (void)
(0109) {
(0110) }
_OSTaskIdleHook:
    017C 9508      RET
(0111) #endif
(0112) 
(0113) /*
(0114) *********************************************************************************************************
(0115) *                                           STATISTIC TASK HOOK
(0116) *
(0117) * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
(0118) *              application to add functionality to the statistics task.
(0119) *
(0120) * Arguments  : none
(0121) *********************************************************************************************************
(0122) */
(0123) 
(0124) #if OS_CPU_HOOKS_EN > 0 
(0125) void  OSTaskStatHook (void)
(0126) {
(0127) }
_OSTaskStatHook:
    017D 9508      RET
_OSTaskStkInit:
  phard_stk            --> R10
  tmp                  --> R22
  psoft_stk            --> R20
  opt                  --> Y+8
  ptos                 --> Y+6
  p_arg                --> R18
  task                 --> R16
    017E 940E0E79  CALL	push_gset3
(0128) #endif
(0129) 
(0130) /*$PAGE*/
(0131) /*
(0132) **********************************************************************************************************
(0133) *                                       INITIALIZE A TASK'S STACK
(0134) *
(0135) * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
(0136) *              stack frame of the task being created. This function is highly processor specific.
(0137) *
(0138) * Arguments  : task          is a pointer to the task code
(0139) *
(0140) *              p_arg         is a pointer to a user supplied data area that will be passed to the task
(0141) *                            when the task first executes.
(0142) *
(0143) *              ptos          is a pointer to the top of stack. It is assumed that 'ptos' points to the
(0144) *                            highest valid address on the stack.
(0145) *
(0146) *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
(0147) *                            (see uCOS_II.H for OS_TASK_OPT_???).
(0148) *
(0149) * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
(0150) *              been placed on the stack in the proper order.
(0151) *
(0152) * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
(0153) *              SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
(0154) *              application code would be responsible for enabling interrupts at the beginning of the task
(0155) *              code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable interrupts.
(0156) *              Failure to do this will make your system crash!
(0157) *
(0158) *              The AVR return stack is placed OS_TASK_HARD_STK_SIZE bytes before the bottom of the task's
(0159) *              stack.
(0160) *
(0161) *              (1) IMPORTANT: The ICC compiler handles function pointers by actually passing the pointer
(0162) *                             to a location in Flash that actually contains the pointer to the function.
(0163) **********************************************************************************************************
(0164) */
(0165) 
(0166) OS_STK  *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
(0167) {
(0168)     INT8U  *psoft_stk;
(0169)     INT8U  *phard_stk;                      /* Temp. variable used for setting up AVR hardware stack    */
(0170)     INT16U  tmp;
(0171) 
(0172) 
(0173)     opt          = opt;                     /* 'opt' is not used, prevent warning                       */
(0174)     psoft_stk    = (INT8U *)ptos;
    0180 814E      LDD	R20,Y+6
    0181 815F      LDD	R21,Y+7
(0175)     phard_stk    = (INT8U *)ptos
    0182 90200102  LDS	R2,_OSTaskStkSize
    0184 90300103  LDS	R3,_OSTaskStkSize+1
    0186 012A      MOVW	R4,R20
    0187 1842      SUB	R4,R2
    0188 0853      SBC	R5,R3
    0189 90A00100  LDS	R10,_OSTaskHardStkSize
    018B 90B00101  LDS	R11,_OSTaskHardStkSize+1
    018D 0CA4      ADD	R10,R4
    018E 1CB5      ADC	R11,R5
(0176)                  - OSTaskStkSize            /* Task stack size                                          */
(0177)                  + OSTaskHardStkSize;       /* AVR return stack ("hardware stack")                      */
(0178) 
(0179)     tmp          = *(INT16U const *)task;   /* (1) ICC compiler handles function pointers indirectly!   */
    018F 01F8      MOVW	R30,R16
    0190 9165      LPM	R22,Z+
    0191 9174      LPM	R23,0(Z)
(0180) 
(0181)     *phard_stk-- = (INT8U)tmp;              /* Put task start address on top of "hardware stack"        */
    0192 0115      MOVW	R2,R10
    0193 01C1      MOVW	R24,R2
    0194 9701      SBIW	R24,1
    0195 01F1      MOVW	R30,R2
    0196 8360      STD	Z+0,R22
(0182)     *phard_stk-- = (INT8U)(tmp >> 8);
    0197 011C      MOVW	R2,R24
    0198 9701      SBIW	R24,1
    0199 015C      MOVW	R10,R24
    019A 012B      MOVW	R4,R22
    019B 2C45      MOV	R4,R5
    019C 2455      CLR	R5
    019D 01F1      MOVW	R30,R2
    019E 8240      STD	Z+0,R4
(0183) 
(0184)     *psoft_stk-- = (INT8U)0x00;             /* R0    = 0x00                                             */
    019F 011A      MOVW	R2,R20
    01A0 5041      SUBI	R20,1
    01A1 4050      SBCI	R21,0
    01A2 2444      CLR	R4
    01A3 01F1      MOVW	R30,R2
    01A4 8240      STD	Z+0,R4
(0185)     *psoft_stk-- = (INT8U)0x01;             /* R1    = 0x01                                             */
    01A5 011A      MOVW	R2,R20
    01A6 5041      SUBI	R20,1
    01A7 4050      SBCI	R21,0
    01A8 E081      LDI	R24,1
    01A9 01F1      MOVW	R30,R2
    01AA 8380      STD	Z+0,R24
(0186)     *psoft_stk-- = (INT8U)0x02;             /* R2    = 0x02                                             */
    01AB 011A      MOVW	R2,R20
    01AC 5041      SUBI	R20,1
    01AD 4050      SBCI	R21,0
    01AE E082      LDI	R24,2
    01AF 01F1      MOVW	R30,R2
    01B0 8380      STD	Z+0,R24
(0187)     *psoft_stk-- = (INT8U)0x03;             /* R3    = 0x03                                             */
    01B1 011A      MOVW	R2,R20
    01B2 5041      SUBI	R20,1
    01B3 4050      SBCI	R21,0
    01B4 E083      LDI	R24,3
    01B5 01F1      MOVW	R30,R2
    01B6 8380      STD	Z+0,R24
(0188)     *psoft_stk-- = (INT8U)0x04;             /* R4    = 0x04                                             */
    01B7 011A      MOVW	R2,R20
    01B8 5041      SUBI	R20,1
    01B9 4050      SBCI	R21,0
    01BA E084      LDI	R24,4
    01BB 01F1      MOVW	R30,R2
    01BC 8380      STD	Z+0,R24
(0189)     *psoft_stk-- = (INT8U)0x05;             /* R5    = 0x05                                             */
    01BD 011A      MOVW	R2,R20
    01BE 5041      SUBI	R20,1
    01BF 4050      SBCI	R21,0
    01C0 E085      LDI	R24,5
    01C1 01F1      MOVW	R30,R2
    01C2 8380      STD	Z+0,R24
(0190)     *psoft_stk-- = (INT8U)0x06;             /* R6    = 0x06                                             */
    01C3 011A      MOVW	R2,R20
    01C4 5041      SUBI	R20,1
    01C5 4050      SBCI	R21,0
    01C6 E086      LDI	R24,6
    01C7 01F1      MOVW	R30,R2
    01C8 8380      STD	Z+0,R24
(0191)     *psoft_stk-- = (INT8U)0x07;             /* R7    = 0x07                                             */
    01C9 011A      MOVW	R2,R20
    01CA 5041      SUBI	R20,1
    01CB 4050      SBCI	R21,0
    01CC E087      LDI	R24,7
    01CD 01F1      MOVW	R30,R2
    01CE 8380      STD	Z+0,R24
(0192)     *psoft_stk-- = (INT8U)0x08;             /* R8    = 0x08                                             */
    01CF 011A      MOVW	R2,R20
    01D0 5041      SUBI	R20,1
    01D1 4050      SBCI	R21,0
    01D2 E088      LDI	R24,0x8
    01D3 01F1      MOVW	R30,R2
    01D4 8380      STD	Z+0,R24
(0193)     *psoft_stk-- = (INT8U)0x09;             /* R9    = 0x09                                             */
    01D5 011A      MOVW	R2,R20
    01D6 5041      SUBI	R20,1
    01D7 4050      SBCI	R21,0
    01D8 E089      LDI	R24,0x9
    01D9 01F1      MOVW	R30,R2
    01DA 8380      STD	Z+0,R24
(0194)     *psoft_stk-- = (INT8U)0x10;             /* R10   = 0x10                                             */
    01DB 011A      MOVW	R2,R20
    01DC 5041      SUBI	R20,1
    01DD 4050      SBCI	R21,0
    01DE E180      LDI	R24,0x10
    01DF 01F1      MOVW	R30,R2
    01E0 8380      STD	Z+0,R24
(0195)     *psoft_stk-- = (INT8U)0x11;             /* R11   = 0x11                                             */
    01E1 011A      MOVW	R2,R20
    01E2 5041      SUBI	R20,1
    01E3 4050      SBCI	R21,0
    01E4 E181      LDI	R24,0x11
    01E5 01F1      MOVW	R30,R2
    01E6 8380      STD	Z+0,R24
(0196)     *psoft_stk-- = (INT8U)0x12;             /* R12   = 0x12                                             */
    01E7 011A      MOVW	R2,R20
    01E8 5041      SUBI	R20,1
    01E9 4050      SBCI	R21,0
    01EA E182      LDI	R24,0x12
    01EB 01F1      MOVW	R30,R2
    01EC 8380      STD	Z+0,R24
(0197)     *psoft_stk-- = (INT8U)0x13;             /* R13   = 0x13                                             */
    01ED 011A      MOVW	R2,R20
    01EE 5041      SUBI	R20,1
    01EF 4050      SBCI	R21,0
    01F0 E183      LDI	R24,0x13
    01F1 01F1      MOVW	R30,R2
    01F2 8380      STD	Z+0,R24
(0198)     *psoft_stk-- = (INT8U)0x14;             /* R14   = 0x14                                             */
    01F3 011A      MOVW	R2,R20
    01F4 5041      SUBI	R20,1
    01F5 4050      SBCI	R21,0
    01F6 E184      LDI	R24,0x14
    01F7 01F1      MOVW	R30,R2
    01F8 8380      STD	Z+0,R24
(0199)     *psoft_stk-- = (INT8U)0x15;             /* R15   = 0x15                                             */
    01F9 011A      MOVW	R2,R20
    01FA 5041      SUBI	R20,1
    01FB 4050      SBCI	R21,0
    01FC E185      LDI	R24,0x15
    01FD 01F1      MOVW	R30,R2
    01FE 8380      STD	Z+0,R24
(0200)     tmp          = (INT16U)p_arg;
    01FF 01B9      MOVW	R22,R18
(0201)     *psoft_stk-- = (INT8U)tmp;              /* 'p_arg' passed in R17:R16                                */
    0200 011A      MOVW	R2,R20
    0201 5041      SUBI	R20,1
    0202 4050      SBCI	R21,0
    0203 01F1      MOVW	R30,R2
    0204 8360      STD	Z+0,R22
(0202)     *psoft_stk-- = (INT8U)(tmp >> 8);
    0205 011A      MOVW	R2,R20
    0206 5041      SUBI	R20,1
    0207 4050      SBCI	R21,0
    0208 012B      MOVW	R4,R22
    0209 2C45      MOV	R4,R5
    020A 2455      CLR	R5
    020B 01F1      MOVW	R30,R2
    020C 8240      STD	Z+0,R4
(0203)     *psoft_stk-- = (INT8U)0x18;             /* R18   = 0x18                                             */
    020D 011A      MOVW	R2,R20
    020E 5041      SUBI	R20,1
    020F 4050      SBCI	R21,0
    0210 E188      LDI	R24,0x18
    0211 01F1      MOVW	R30,R2

⌨️ 快捷键说明

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