📄 mega16pro.lst
字号:
(0048) OS_CPU_TmrCtr = 0;
(0049) #endif
(0050) }
(0051) #endif
(0052)
(0053) /*
(0054) *********************************************************************************************************
(0055) * OS INITIALIZATION HOOK
(0056) * (END)
(0057) *
(0058) * Description: This function is called by OSInit() at the end of OSInit().
(0059) *
(0060) * Arguments : none
(0061) *
(0062) * Note(s) : 1) Interrupts should be disabled during this call.
(0063) *********************************************************************************************************
(0064) */
(0065) #if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
(0066) void OSInitHookEnd (void)
(0067) {
_OSInitHookEnd:
003B0 9508 RET
(0068) }
(0069) #endif
(0070)
(0071) /*
(0072) *********************************************************************************************************
(0073) * TASK CREATION HOOK
(0074) *
(0075) * Description: This function is called when a task is created.
(0076) *
(0077) * Arguments : ptcb is a pointer to the task control block of the task being created.
(0078) *
(0079) * Note(s) : 1) Interrupts are disabled during this call.
(0080) *********************************************************************************************************
(0081) */
(0082) #if OS_CPU_HOOKS_EN > 0
(0083) void OSTaskCreateHook (OS_TCB *ptcb)
(0084) {
(0085) ptcb = ptcb; /* Prevent compiler warning */
_OSTaskCreateHook:
ptcb --> Y,+0
003B1 9508 RET
(0086)
(0087) }
(0088) #endif
(0089)
(0090) /*
(0091) *********************************************************************************************************
(0092) * TASK DELETION HOOK
(0093) *
(0094) * Description: This function is called when a task is deleted.
(0095) *
(0096) * Arguments : ptcb is a pointer to the task control block of the task being deleted.
(0097) *
(0098) * Note(s) : 1) Interrupts are disabled during this call.
(0099) *********************************************************************************************************
(0100) */
(0101) #if OS_CPU_HOOKS_EN > 0
(0102) void OSTaskDelHook (OS_TCB *ptcb)
(0103) {
(0104) ptcb = ptcb; /* Prevent compiler warning */
_OSTaskDelHook:
ptcb --> Y,+0
003B2 9508 RET
(0105)
(0106) }
(0107) #endif
(0108)
(0109) /*
(0110) *********************************************************************************************************
(0111) * IDLE TASK HOOK
(0112) *
(0113) * Description: This function is called by the idle task. This hook has been added to allow you to do
(0114) * such things as STOP the CPU to conserve power.
(0115) *
(0116) * Arguments : none
(0117) *
(0118) * Note(s) : 1) Interrupts are enabled during this call.
(0119) *********************************************************************************************************
(0120) */
(0121) #if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
(0122) void OSTaskIdleHook (void)
(0123) {
_OSTaskIdleHook:
003B3 9508 RET
(0124) }
(0125) #endif
(0126)
(0127) /*
(0128) *********************************************************************************************************
(0129) * STATISTIC TASK HOOK
(0130) *
(0131) * Description: This function is called every second by uC/OS-II's statistics task. This allows your
(0132) * application to add functionality to the statistics task.
(0133) *
(0134) * Arguments : none
(0135) *********************************************************************************************************
(0136) */
(0137)
(0138) #if OS_CPU_HOOKS_EN > 0
(0139) void OSTaskStatHook (void)
(0140) {
_OSTaskStatHook:
003B4 9508 RET
_OSTaskStkInit:
phard_stk --> R10
tmp --> R22
psoft_stk --> R20
opt --> Y,+10
ptos --> R10
p_arg --> R18
task --> R16
003B5 940E 0F21 CALL push_xgsetF03C
003B7 84A8 LDD R10,Y+8
003B8 84B9 LDD R11,Y+9
(0141) }
(0142) #endif
(0143)
(0144) /*
(0145) ********************************************************************************
(0146) * INITIALIZE A TASK'S STACK
(0147) *
(0148) * Description:
(0149) * This function is called by either OSTaskCreate() or OSTaskCreateExt() to
(0150) * initialize the stack frame of the task being created. This function is
(0151) * highly processor specific.
(0152) *
(0153) *Arguments : task is a pointer to the task code
(0154) *
(0155) * p_arg is a pointer to a user supplied data area that will be passed to the task
(0156) * when the task first executes.
(0157) *
(0158) * ptos is a pointer to the top of stack. It is assumed that 'ptos' points to the
(0159) * highest valid address on the stack.
(0160) *
(0161) * opt specifies options that can be used to alter the behavior of OSTaskStkInit().
(0162) * (see uCOS_II.H for OS_TASK_OPT_???).
(0163) *
(0164) * Returns:
(0165) * Always returns the location of the new top-of-stack' once the processor
(0166) * registers have been placed on the stack in the proper order.
(0167) *
(0168) * Note(s):
(0169) * Interrupts are enabled when your task starts executing. You can change this
(0170) * by setting the SREG to 0x00 instead. In this case, interrupts would be
(0171) * disabled upon task startup. The application code would be responsible for
(0172) * enabling interrupts at the beginning of the task code. You will need to
(0173) * modify OSTaskIdle() and OSTaskStat() so that they enable interrupts. Failure
(0174) * to do this will make your system crash! The AVR return stack is placed 64
(0175) * bytes above the start of the (512 byte) stack. This provides 32 levels of
(0176) * function call nesting which should be more than enough for most applications
(0177) * (see the "read.me" file for more info).
(0178) *
(0179) ********************************************************************************
(0180) */
(0181)
(0182)
(0183) OS_STK *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt){
(0184)
(0185) INT8U *psoft_stk;
(0186) INT8U *phard_stk; /* Temp. variable used for setting up AVR hardware stack */
(0187) INT16U tmp;
(0188)
(0189)
(0190) (void)opt; /* 'opt' is not used, prevent warning */
(0191) psoft_stk = (INT8U *)ptos;
003B9 01A5 MOVW R20,R10
(0192) phard_stk = (INT8U *)ptos
003BA 9020 06FE LDS R2,OSTaskStkSize
003BC 9030 06FF LDS R3,OSTaskStkSize+1
003BE 0125 MOVW R4,R10
003BF 1842 SUB R4,R2
003C0 0853 SBC R5,R3
003C1 90A0 06FC LDS R10,OSTaskStkSizeHard
003C3 90B0 06FD LDS R11,OSTaskStkSizeHard+1
003C5 0CA4 ADD R10,R4
003C6 1CB5 ADC R11,R5
(0193) - OSTaskStkSize /* Task stack size */
(0194) + OSTaskStkSizeHard; /* AVR return stack ("hardware stack") */
(0195)
(0196) tmp = *(INT16U const *)task; /* (1) ICC compiler handles function pointers indirectly! */
003C7 01F8 MOVW R30,R16
003C8 8160 LD R22,Z
003C9 8171 LDD R23,Z+1
(0197)
(0198) *phard_stk-- = (INT8U)(tmp & 0xFF); /* Put task start address on top of "hardware stack" */
003CA 0115 MOVW R2,R10
003CB 01C1 MOVW R24,R2
003CC 9701 SBIW R24,1
003CD 015C MOVW R10,R24
003CE 01CB MOVW R24,R22
003CF 7090 ANDI R25,0
003D0 01F1 MOVW R30,R2
003D1 8380 ST Z,R24
(0199) tmp >>= 8;
003D2 2F67 MOV R22,R23
003D3 2777 CLR R23
(0200) *phard_stk-- = (INT8U)(tmp & 0xFF);
003D4 0115 MOVW R2,R10
003D5 01C1 MOVW R24,R2
003D6 9701 SBIW R24,1
003D7 015C MOVW R10,R24
003D8 01CB MOVW R24,R22
003D9 7090 ANDI R25,0
003DA 01F1 MOVW R30,R2
003DB 8380 ST Z,R24
(0201)
(0202) *psoft_stk-- = (INT8U)0x00; /* R0 = 0x00 */
003DC 016A MOVW R12,R20
003DD 5041 SUBI R20,1
003DE 4050 SBCI R21,0
003DF 2422 CLR R2
003E0 01F6 MOVW R30,R12
003E1 8220 ST Z,R2
(0203) *psoft_stk-- = (INT8U)0x01; /* R1 = 0x01 */
003E2 016A MOVW R12,R20
003E3 5041 SUBI R20,1
003E4 4050 SBCI R21,0
003E5 E081 LDI R24,1
003E6 01F6 MOVW R30,R12
003E7 8380 ST Z,R24
(0204) *psoft_stk-- = (INT8U)0x02; /* R2 = 0x02 */
003E8 016A MOVW R12,R20
003E9 5041 SUBI R20,1
003EA 4050 SBCI R21,0
003EB E082 LDI R24,2
003EC 01F6 MOVW R30,R12
003ED 8380 ST Z,R24
(0205) *psoft_stk-- = (INT8U)0x03; /* R3 = 0x03 */
003EE 016A MOVW R12,R20
003EF 5041 SUBI R20,1
003F0 4050 SBCI R21,0
003F1 E083 LDI R24,3
003F2 01F6 MOVW R30,R12
003F3 8380 ST Z,R24
(0206) *psoft_stk-- = (INT8U)0x04; /* R4 = 0x04 */
003F4 016A MOVW R12,R20
003F5 5041 SUBI R20,1
003F6 4050 SBCI R21,0
003F7 E084 LDI R24,4
003F8 01F6 MOVW R30,R12
003F9 8380 ST Z,R24
(0207) *psoft_stk-- = (INT8U)0x05; /* R5 = 0x05 */
003FA 016A MOVW R12,R20
003FB 5041 SUBI R20,1
003FC 4050 SBCI R21,0
003FD E085 LDI R24,5
003FE 01F6 MOVW R30,R12
003FF 8380 ST Z,R24
(0208) *psoft_stk-- = (INT8U)0x06; /* R6 = 0x06 */
00400 016A MOVW R12,R20
00401 5041 SUBI R20,1
00402 4050 SBCI R21,0
00403 E086 LDI R24,6
00404 01F6 MOVW R30,R12
00405 8380 ST Z,R24
(0209) *psoft_stk-- = (INT8U)0x07; /* R7 = 0x07 */
00406 016A MOVW R12,R20
00407 5041 SUBI R20,1
00408 4050 SBCI R21,0
00409 E087 LDI R24,7
0040A 01F6 MOVW R30,R12
0040B 8380 ST Z,R24
(0210) *psoft_stk-- = (INT8U)0x08; /* R8 = 0x08 */
0040C 016A MOVW R12,R20
0040D 5041 SUBI R20,1
0040E 4050 SBCI R21,0
0040F E088 LDI R24,0x8
00410 01F6 MOVW R30,R12
00411 8380 ST Z,R24
(0211) *psoft_stk-- = (INT8U)0x09; /* R9 = 0x09 */
00412 016A MOVW R12,R20
00413 5041 SUBI R20,1
00414 4050 SBCI R21,0
00415 E089 LDI R24,0x9
00416 01F6 MOVW R30,R12
00417 8380 ST Z,R24
(0212) *psoft_stk-- = (INT8U)0x10; /* R10 = 0x10 */
00418 016A MOVW R12,R20
00419 5041 SUBI R20,1
0041A 4050 SBCI R21,0
0041B E180 LDI R24,0x10
0041C 01F6 MOVW R30,R12
0041D 8380 ST Z,R24
(0213) *psoft_stk-- = (INT8U)0x11; /* R11 = 0x11 */
0041E 016A MOVW R12,R20
0041F 5041 SUBI R20,1
00420 4050 SBCI R21,0
00421 E181 LDI R24,0x11
00422 01F6 MOVW R30,R12
00423 8380 ST Z,R24
(0214) *psoft_stk-- = (INT8U)0x12; /* R12 = 0x12 */
00424 016A MOVW R12,R20
00425 5041 SUBI R20,1
00426 4050 SBCI R21,0
00427 E182 LDI R24,0x12
00428 01F6 MOVW R30,R12
00429 8380 ST Z,R24
(0215) *psoft_stk-- = (INT8U)0x13; /* R13 = 0x13 */
0042A 016A MOVW R12,R20
0042B 5041 SUBI R20,1
0042C 4050 SBCI R21,0
0042D E183 LDI R24,0x13
0042E 01F6 MOVW R30,R12
0042F 8380 ST Z,R24
(0216) *psoft_stk-- = (INT8U)0x14; /* R14 = 0x14 */
00430 016A MOVW R12,R20
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -