test.lst
来自「将本站的UCOSFORAVR128V276版本升级到了280版」· LST 代码 · 共 1,505 行 · 第 1/5 页
LST
1,505 行
(0340) ; Use the POP_SREG macro to restore the SREG register
(0341) ; Use the POP_ALL macro to restore the remaining registers
(0342) ; Return (DO NOT use a RETI instruction);
(0343) ;********************************************************************************************************
(0344)
(0345) _OSTickISR::
(0346) PUSH_ALL ; Save all registers and status register
0210 930A ST R16,-Y
(0347) IN R16,SREG ; Save the SREG but with interrupts enabled
0211 B70F IN R16,0x3F
(0348) SBR R16,BIT07
0212 6800 ORI R16,0x80
(0349) ST -Y,R16
0213 930A ST R16,-Y
0214 B70E IN R16,0x3E
0215 930A ST R16,-Y
0216 B70D IN R16,0x3D
(0350) PUSH_SP ; Save the task's hardware stack pointer onto task's stack
0217 930A ST R16,-Y
(0351)
(0352) LDS R16,_OSIntNesting ; Notify uC/OS-II of ISR
0218 9100071D LDS R16,_OSIntNesting
(0353) INC R16 ;
021A 9503 INC R16
(0354) STS _OSIntNesting,R16 ;
021B 9300071D STS _OSIntNesting,R16
(0355)
(0356) CPI R16,1 ; if (OSIntNesting == 1) {
021D 3001 CPI R16,1
(0357) BRNE OSTickISR_1
021E F431 BNE 0x0225
(0358)
(0359) LDS R30,_OSTCBCur ; OSTCBCur->OSTCBStkPtr = Y
021F 91E0060E LDS R30,_OSTCBCur
(0360) LDS R31,_OSTCBCur+1
0221 91F0060F LDS R31,_OSTCBCur+1
(0361) ST Z+,R28
0223 93C1 ST R28,Z+
(0362) ST Z+,R29 ; }
0224 93D1 ST R29,Z+
(0363)
(0364) OSTickISR_1:
(0365) CALL _OSTickISR_Handler ; Handle the tick ISR
0225 940E045E CALL _OSTickISR_Handler
(0366)
(0367) CALL _OSIntExit ; Notify uC/OS-II about end of ISR
0227 940E075D CALL _OSIntExit
0229 9109 LD R16,Y+
022A BF0D OUT 0x3D,R16
022B 9109 LD R16,Y+
(0368)
(0369) POP_SP ; Restore the hardware stack pointer from task's stack
022C BF0E OUT 0x3E,R16
022D 9109 LD R16,Y+
(0370) POP_SREG ; Restore the SREG register
022E BF0F OUT 0x3F,R16
022F 9109 LD R16,Y+
0230 BF0B OUT 0x3B,R16
0231 91F9 LD R31,Y+
0232 91E9 LD R30,Y+
0233 91B9 LD R27,Y+
0234 91A9 LD R26,Y+
0235 9199 LD R25,Y+
0236 9189 LD R24,Y+
0237 9179 LD R23,Y+
0238 9169 LD R22,Y+
0239 9159 LD R21,Y+
023A 9149 LD R20,Y+
023B 9139 LD R19,Y+
023C 9129 LD R18,Y+
023D 9119 LD R17,Y+
023E 9109 LD R16,Y+
023F 90F9 LD R15,Y+
0240 90E9 LD R14,Y+
0241 90D9 LD R13,Y+
0242 90C9 LD R12,Y+
0243 90B9 LD R11,Y+
0244 90A9 LD R10,Y+
0245 9099 LD R9,Y+
0246 9089 LD R8,Y+
0247 9079 LD R7,Y+
0248 9069 LD R6,Y+
0249 9059 LD R5,Y+
024A 9049 LD R4,Y+
024B 9039 LD R3,Y+
024C 9029 LD R2,Y+
024D 9019 LD R1,Y+
(0371) POP_ALL ; Restore all registers
024E 9009 LD R0,Y+
(0372)
(0373) RET ; Note: RET instead of RETI
024F 9508 RET
FILE: E:\ypt050912\XIAZAI\xinzai\UCOSAVR128\ICC\os_cpu_c.c
(0001) /*
(0002) *********************************************************************************************************
(0003) * uC/OS-II
(0004) * The Real-Time Kernel
(0005) *
(0006) * ATmega128 Specific code
(0007) *
(0008) * File : OS_CPU_C.C
(0009) * By : Ole Saether
(0010) * Jean J. Labrosse
(0011) *********************************************************************************************************
(0012) */
(0013)
(0014) #define OS_CPU_GLOBALS
(0015) #include <includes.h>
(0016)
(0017) /*
(0018) *********************************************************************************************************
(0019) * OS INITIALIZATION HOOK
(0020) * (BEGINNING)
(0021) *
(0022) * Description: This function is called by OSInit() at the beginning of OSInit().
(0023) *
(0024) * Arguments : none
(0025) *
(0026) * Note(s) : 1) Interrupts should be disabled during this call.
(0027) *********************************************************************************************************
(0028) */
(0029) #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
(0030) void OSInitHookBegin (void)
(0031) {
_OSInitHookBegin:
0250 9508 RET
(0032) }
(0033) #endif
(0034)
(0035) /*
(0036) *********************************************************************************************************
(0037) * OS INITIALIZATION HOOK
(0038) * (END)
(0039) *
(0040) * Description: This function is called by OSInit() at the end of OSInit().
(0041) *
(0042) * Arguments : none
(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) {
_OSInitHookEnd:
0251 9508 RET
(0050) }
(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 */
_OSTaskCreateHook:
ptcb --> R16
0252 9508 RET
(0072) #endif
(0073) }
(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 */
_OSTaskDelHook:
ptcb --> R16
0253 9508 RET
(0092) }
(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) {
_OSTaskIdleHook:
0254 9508 RET
(0110) }
(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) {
_OSTaskStatHook:
0255 9508 RET
_OSTaskStkInit:
phard_stk --> R10
tmp --> R22
psoft_stk --> R20
opt --> Y+8
ptos --> Y+6
p_arg --> R18
task --> R16
0256 940E0C9F CALL push_gset3
(0127) }
(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;
0258 814E LDD R20,Y+6
0259 815F LDD R21,Y+7
(0175) phard_stk = (INT8U *)ptos
025A 90200102 LDS R2,_OSTaskStkSize
025C 90300103 LDS R3,_OSTaskStkSize+1
025E 012A MOVW R4,R20
025F 1842 SUB R4,R2
0260 0853 SBC R5,R3
0261 90A00100 LDS R10,_OSTaskHardStkSize
0263 90B00101 LDS R11,_OSTaskHardStkSize+1
0265 0CA4 ADD R10,R4
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?