📄 os_cpu_c.lis
字号:
.module OS_CPU_C.C
.area vector(rom, abs)
.org 64
0040 0C940000 jmp _OSTickISR
.area text(rom, con, rel)
.even
0000 _OSInitHookBegin::
0000 L1:
0000 .dbline 0 ; func end
0000 0895 ret
.even
0002 _OSInitHookEnd::
0002 ; /*
0002 ; *********************************************************************************************************
0002 ; * uC/OS-II
0002 ; * The Real-Time Kernel
0002 ; *
0002 ; * ATmega128 Specific code
0002 ; *
0002 ; * File : OS_CPU_C.C
0002 ; * By : Ole Saether
0002 ; * Jean J. Labrosse
0002 ; *********************************************************************************************************
0002 ; */
0002 ;
0002 ; #define OS_CPU_GLOBALS
0002 ; #include <ucos_ii.h>
0002 ;
0002 ; /*
0002 ; *********************************************************************************************************
0002 ; * OS INITIALIZATION HOOK
0002 ; * (BEGINNING)
0002 ; *
0002 ; * Description: This function is called by OSInit() at the beginning 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 OSInitHookBegin (void)
0002 ; {
0002 ; }
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 L2:
0002 .dbline 0 ; func end
0002 0895 ret
0004 ; ptcb -> R16,R17
.even
0004 _OSTaskCreateHook::
0004 ; }
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 L3:
0004 .dbline 0 ; func end
0004 0895 ret
0006 ; ptcb -> R16,R17
.even
0006 _OSTaskDelHook::
0006 ; #endif
0006 ; }
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 L4:
0006 .dbline 0 ; func end
0006 0895 ret
.even
0008 _OSTaskIdleHook::
0008 ; }
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 L5:
0008 .dbline 0 ; func end
0008 0895 ret
.even
000A _OSTaskStatHook::
000A ; }
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 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 ; }
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 2A01 movw R4,R20
001E 4218 sub R4,R2
0020 5308 sbc R5,R3
0022 A0900000 lds R10,_OSTaskHardStkSize
0026 B0900100 lds R11,_OSTaskHardStkSize+1
002A A40C add R10,R4
002C B51C adc R11,R5
002E ; - OSTaskStkSize /* Task stack size */
002E ; + OSTaskHardStkSize; /* AVR return stack ("hardware stack") */
002E ;
002E ; tmp = *(INT16U const *)task; /* (1) ICC compiler handles function pointers indirectly! */
002E F801 movw R30,R16
0030 6591 lpm R22,Z+
0032 7491 lpm R23,Z
0034 ;
0034 ; *phard_stk-- = (INT8U)tmp; /* Put task start address on top of "hardware stack" */
0034 1501 movw R2,R10
0036 C101 movw R24,R2
0038 0197 sbiw R24,1
003A F101 movw R30,R2
003C 6083 std z+0,R22
003E ; *phard_stk-- = (INT8U)(tmp >> 8);
003E 1C01 movw R2,R24
0040 0197 sbiw R24,1
0042 5C01 movw R10,R24
0044 2B01 movw R4,R22
0046 452C mov R4,R5
0048 5524 clr R5
004A F101 movw R30,R2
004C 4082 std z+0,R4
004E ;
004E ; *psoft_stk-- = (INT8U)0x00; /* R0 = 0x00 */
004E 1A01 movw R2,R20
0050 4150 subi R20,1
0052 5040 sbci R21,0
0054 4424 clr R4
0056 F101 movw R30,R2
0058 4082 std z+0,R4
005A ; *psoft_stk-- = (INT8U)0x01; /* R1 = 0x01 */
005A 1A01 movw R2,R20
005C 4150 subi R20,1
005E 5040 sbci R21,0
0060 81E0 ldi R24,1
0062 F101 movw R30,R2
0064 8083 std z+0,R24
0066 ; *psoft_stk-- = (INT8U)0x02; /* R2 = 0x02 */
0066 1A01 movw R2,R20
0068 4150 subi R20,1
006A 5040 sbci R21,0
006C 82E0 ldi R24,2
006E F101 movw R30,R2
0070 8083 std z+0,R24
0072 ; *psoft_stk-- = (INT8U)0x03; /* R3 = 0x03 */
0072 1A01 movw R2,R20
0074 4150 subi R20,1
0076 5040 sbci R21,0
0078 83E0 ldi R24,3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -