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

📄 os_cpu_c.lis

📁 易于atmage128和ucos的手动机器人控制程序。
💻 LIS
📖 第 1 页 / 共 2 页
字号:
                        .module os_cpu_c.c
                        .area text(rom, con, rel)
                        .even
 0000           _OSInitHookBegin::
 0000           ; /*
 0000           ; *********************************************************************************************************
 0000           ; *                                              uC/OS-II
 0000           ; *                                        The Real-Time Kernel
 0000           ; * 
 0000           ; *                                       ATmega128 Specific code
 0000           ; *
 0000           ; * File     : OS_CPU_C.C
 0000           ; * By       : Ole Saether
 0000           ; *            Jean J. Labrosse
 0000           ; *********************************************************************************************************
 0000           ; */
 0000           ; 
 0000           ; #define  OS_CPU_GLOBALS
 0000           ; #include <includes.h>
 0000           ; 
 0000           ; /*
 0000           ; *********************************************************************************************************
 0000           ; *                                       OS INITIALIZATION HOOK
 0000           ; *                                            (BEGINNING)
 0000           ; *
 0000           ; * Description: This function is called by OSInit() at the beginning of OSInit().
 0000           ; *
 0000           ; * Arguments  : none
 0000           ; *
 0000           ; * Note(s)    : 1) Interrupts should be disabled during this call.
 0000           ; *********************************************************************************************************
 0000           ; */
 0000           ; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 0000           ; void  OSInitHookBegin (void)
 0000           ; {
 0000           ; }
 0000           L1:
 0000                   .dbline 0 ; func end
 0000 0895              ret
                        .even
 0002           _OSInitHookEnd::
 0002           ; #endif
 0002           ; 
 0002           ; /*
 0002           ; *********************************************************************************************************
 0002           ; *                                       OS INITIALIZATION HOOK
 0002           ; *                                               (END)
 0002           ; *
 0002           ; * Description: This function is called by OSInit() at the end of OSInit().
 0002           ; *
 0002           ; * Arguments  : none
 0002           ; *
 0002           ; * Note(s)    : 1) Interrupts should be disabled during this call.
 0002           ; *********************************************************************************************************
 0002           ; */
 0002           ; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
 0002           ; void  OSInitHookEnd (void)
 0002           ; {
 0002           ; }
 0002           L2:
 0002                   .dbline 0 ; func end
 0002 0895              ret
 0004           ;           ptcb -> R16,R17
                        .even
 0004           _OSTaskCreateHook::
 0004           ; #endif
 0004           ; 
 0004           ; /*$PAGE*/
 0004           ; /*
 0004           ; *********************************************************************************************************
 0004           ; *                                          TASK CREATION HOOK
 0004           ; *
 0004           ; * Description: This function is called when a task is created.
 0004           ; *
 0004           ; * Arguments  : ptcb   is a pointer to the task control block of the task being created.
 0004           ; *
 0004           ; * Note(s)    : 1) Interrupts are disabled during this call.
 0004           ; *********************************************************************************************************
 0004           ; */
 0004           ; #if OS_CPU_HOOKS_EN > 0 
 0004           ; void  OSTaskCreateHook (OS_TCB *ptcb)
 0004           ; {
 0004           ; #ifdef OS_VIEW_MODULE
 0004           ;     OSView_TaskCreateHook(ptcb);
 0004           ; #else
 0004           ;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
 0004           ; #endif
 0004           ; }
 0004           L3:
 0004                   .dbline 0 ; func end
 0004 0895              ret
 0006           ;           ptcb -> R16,R17
                        .even
 0006           _OSTaskDelHook::
 0006           ; #endif
 0006           ; 
 0006           ; 
 0006           ; /*
 0006           ; *********************************************************************************************************
 0006           ; *                                           TASK DELETION HOOK
 0006           ; *
 0006           ; * Description: This function is called when a task is deleted.
 0006           ; *
 0006           ; * Arguments  : ptcb   is a pointer to the task control block of the task being deleted.
 0006           ; *
 0006           ; * Note(s)    : 1) Interrupts are disabled during this call.
 0006           ; *********************************************************************************************************
 0006           ; */
 0006           ; #if OS_CPU_HOOKS_EN > 0 
 0006           ; void  OSTaskDelHook (OS_TCB *ptcb)
 0006           ; {
 0006           ;     ptcb = ptcb;                       /* Prevent compiler warning                                     */
 0006           ; }
 0006           L4:
 0006                   .dbline 0 ; func end
 0006 0895              ret
                        .even
 0008           _OSTaskIdleHook::
 0008           ; #endif
 0008           ; 
 0008           ; /*
 0008           ; *********************************************************************************************************
 0008           ; *                                             IDLE TASK HOOK
 0008           ; *
 0008           ; * Description: This function is called by the idle task.  This hook has been added to allow you to do  
 0008           ; *              such things as STOP the CPU to conserve power.
 0008           ; *
 0008           ; * Arguments  : none
 0008           ; *
 0008           ; * Note(s)    : 1) Interrupts are enabled during this call.
 0008           ; *********************************************************************************************************
 0008           ; */
 0008           ; #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
 0008           ; void  OSTaskIdleHook (void)
 0008           ; {
 0008           ; }
 0008           L5:
 0008                   .dbline 0 ; func end
 0008 0895              ret
                        .even
 000A           _OSTaskStatHook::
 000A           ; #endif
 000A           ; 
 000A           ; /*
 000A           ; *********************************************************************************************************
 000A           ; *                                           STATISTIC TASK HOOK
 000A           ; *
 000A           ; * Description: This function is called every second by uC/OS-II's statistics task.  This allows your 
 000A           ; *              application to add functionality to the statistics task.
 000A           ; *
 000A           ; * Arguments  : none
 000A           ; *********************************************************************************************************
 000A           ; */
 000A           ; 
 000A           ; #if OS_CPU_HOOKS_EN > 0 
 000A           ; void  OSTaskStatHook (void)
 000A           ; {
 000A           ; }
 000A           L6:
 000A                   .dbline 0 ; func end
 000A 0895              ret
 000C           ;      phard_stk -> R10,R11
 000C           ;            tmp -> R22,R23
 000C           ;      psoft_stk -> R20,R21
 000C           ;            opt -> y+8
 000C           ;           ptos -> y+6
 000C           ;          p_arg -> R18,R19
 000C           ;           task -> R16,R17
                        .even
 000C           _OSTaskStkInit::
 000C 0E940000          xcall push_gset3
 0010           ; #endif
 0010           ; 
 0010           ; /*$PAGE*/
 0010           ; /*
 0010           ; **********************************************************************************************************
 0010           ; *                                       INITIALIZE A TASK'S STACK
 0010           ; *
 0010           ; * Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
 0010           ; *              stack frame of the task being created. This function is highly processor specific.
 0010           ; *
 0010           ; * Arguments  : task          is a pointer to the task code
 0010           ; *
 0010           ; *              p_arg         is a pointer to a user supplied data area that will be passed to the task
 0010           ; *                            when the task first executes.
 0010           ; *
 0010           ; *              ptos          is a pointer to the top of stack. It is assumed that 'ptos' points to the
 0010           ; *                            highest valid address on the stack.
 0010           ; *
 0010           ; *              opt           specifies options that can be used to alter the behavior of OSTaskStkInit().
 0010           ; *                            (see uCOS_II.H for OS_TASK_OPT_???).
 0010           ; *
 0010           ; * Returns    : Always returns the location of the new top-of-stack' once the processor registers have
 0010           ; *              been placed on the stack in the proper order.
 0010           ; *
 0010           ; * Note(s)    : Interrupts are enabled when your task starts executing. You can change this by setting the
 0010           ; *              SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
 0010           ; *              application code would be responsible for enabling interrupts at the beginning of the task
 0010           ; *              code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable interrupts.
 0010           ; *              Failure to do this will make your system crash!
 0010           ; *
 0010           ; *              The AVR return stack is placed OS_TASK_HARD_STK_SIZE bytes before the bottom of the task's
 0010           ; *              stack.
 0010           ; *
 0010           ; *              (1) IMPORTANT: The ICC compiler handles function pointers by actually passing the pointer
 0010           ; *                             to a location in Flash that actually contains the pointer to the function.
 0010           ; **********************************************************************************************************
 0010           ; */
 0010           ; 
 0010           ; OS_STK  *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
 0010           ; {
 0010           ;     INT8U  *psoft_stk;
 0010           ;     INT8U  *phard_stk;                      /* Temp. variable used for setting up AVR hardware stack    */
 0010           ;     INT16U  tmp;
 0010           ; 
 0010           ; 
 0010           ;     opt          = opt;                     /* 'opt' is not used, prevent warning                       */
 0010           ;     psoft_stk    = (INT8U *)ptos;
 0010 4E81              ldd R20,y+6
 0012 5F81              ldd R21,y+7
 0014           ;     phard_stk    = (INT8U *)ptos
 0014 20900200          lds R2,_OSTaskStkSize
 0018 30900300          lds R3,_OSTaskStkSize+1
 001C 4E80              ldd R4,y+6
 001E 5F80              ldd R5,y+7
 0020 4218              sub R4,R2
 0022 5308              sbc R5,R3
 0024 A0900000          lds R10,_OSTaskHardStkSize
 0028 B0900100          lds R11,_OSTaskHardStkSize+1
 002C A40C              add R10,R4
 002E B51C              adc R11,R5
 0030           ;                  - OSTaskStkSize            /* Task stack size                                          */
 0030           ;                  + OSTaskHardStkSize;       /* AVR return stack ("hardware stack")                      */
 0030           ; 
 0030           ;     tmp          = *(INT16U const *)task;   /* (1) ICC compiler handles function pointers indirectly!   */
 0030 F801              movw R30,R16
 0032 6591              lpm R22,Z+
 0034 7491              lpm R23,Z
 0036           ; 
 0036           ;     *phard_stk-- = (INT8U)tmp;              /* Put task start address on top of "hardware stack"        */
 0036 1501              movw R2,R10
 0038 C101              movw R24,R2
 003A 0197              sbiw R24,1
 003C F101              movw R30,R2
 003E 6083              std z+0,R22
 0040           ;     *phard_stk-- = (INT8U)(tmp >> 8);
 0040 1C01              movw R2,R24
 0042 0197              sbiw R24,1
 0044 5C01              movw R10,R24
 0046 2B01              movw R4,R22
 0048 452C              mov R4,R5
 004A 5524              clr R5
 004C F101              movw R30,R2
 004E 4082              std z+0,R4
 0050           ; 
 0050           ;     *psoft_stk-- = (INT8U)0x00;             /* R0    = 0x00                                             */
 0050 1A01              movw R2,R20
 0052 4150              subi R20,1
 0054 5040              sbci R21,0
 0056 4424              clr R4
 0058 F101              movw R30,R2
 005A 4082              std z+0,R4
 005C           ;     *psoft_stk-- = (INT8U)0x01;             /* R1    = 0x01                                             */
 005C 1A01              movw R2,R20
 005E 4150              subi R20,1
 0060 5040              sbci R21,0
 0062 81E0              ldi R24,1
 0064 F101              movw R30,R2
 0066 8083              std z+0,R24
 0068           ;     *psoft_stk-- = (INT8U)0x02;             /* R2    = 0x02                                             */
 0068 1A01              movw R2,R20
 006A 4150              subi R20,1
 006C 5040              sbci R21,0
 006E 82E0              ldi R24,2
 0070 F101              movw R30,R2
 0072 8083              std z+0,R24
 0074           ;     *psoft_stk-- = (INT8U)0x03;             /* R3    = 0x03                                             */
 0074 1A01              movw R2,R20
 0076 4150              subi R20,1
 0078 5040              sbci R21,0
 007A 83E0              ldi R24,3
 007C F101              movw R30,R2
 007E 8083              std z+0,R24
 0080           ;     *psoft_stk-- = (INT8U)0x04;             /* R4    = 0x04                                             */
 0080 1A01              movw R2,R20
 0082 4150              subi R20,1
 0084 5040              sbci R21,0
 0086 84E0              ldi R24,4
 0088 F101              movw R30,R2
 008A 8083              std z+0,R24
 008C           ;     *psoft_stk-- = (INT8U)0x05;             /* R5    = 0x05                                             */
 008C 1A01              movw R2,R20
 008E 4150              subi R20,1
 0090 5040              sbci R21,0
 0092 85E0              ldi R24,5
 0094 F101              movw R30,R2

⌨️ 快捷键说明

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