?? ucosii.lst
字號:
(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
011F 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
0120 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:
0121 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:
0122 9508 RET
_OSTaskStkInit:
phard_stk --> R10
tmp --> R22
psoft_stk --> R20
opt --> Y+8
ptos --> Y+6
p_arg --> R18
task --> R16
0123 940E0E0A 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;
0125 814E LDD R20,Y+6
0126 815F LDD R21,Y+7
(0175) phard_stk = (INT8U *)ptos
0127 90200102 LDS R2,_OSTaskStkSize
0129 90300103 LDS R3,_OSTaskStkSize+1
012B 012A MOVW R4,R20
012C 1842 SUB R4,R2
012D 0853 SBC R5,R3
012E 90A00100 LDS R10,_OSTaskHardStkSize
0130 90B00101 LDS R11,_OSTaskHardStkSize+1
0132 0CA4 ADD R10,R4
0133 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! */
0134 01F8 MOVW R30,R16
0135 9165 LPM R22,Z+
0136 9174 LPM R23,0(Z)
(0180)
(0181) *phard_stk-- = (INT8U)tmp; /* Put task start address on top of "hardware stack" */
0137 0115 MOVW R2,R10
0138 01C1 MOVW R24,R2
0139 9701 SBIW R24,1
013A 01F1 MOVW R30,R2
013B 8360 STD Z+0,R22
(0182) *phard_stk-- = (INT8U)(tmp >> 8);
013C 011C MOVW R2,R24
013D 9701 SBIW R24,1
013E 015C MOVW R10,R24
013F 012B MOVW R4,R22
0140 2C45 MOV R4,R5
0141 2455 CLR R5
0142 01F1 MOVW R30,R2
0143 8240 STD Z+0,R4
(0183)
(0184) *psoft_stk-- = (INT8U)0x00; /* R0 = 0x00 */
0144 011A MOVW R2,R20
0145 5041 SUBI R20,1
0146 4050 SBCI R21,0
0147 2444 CLR R4
0148 01F1 MOVW R30,R2
0149 8240 STD Z+0,R4
(0185) *psoft_stk-- = (INT8U)0x01; /* R1 = 0x01 */
014A 011A MOVW R2,R20
014B 5041 SUBI R20,1
014C 4050 SBCI R21,0
014D E081 LDI R24,1
014E 01F1 MOVW R30,R2
014F 8380 STD Z+0,R24
(0186) *psoft_stk-- = (INT8U)0x02; /* R2 = 0x02 */
0150 011A MOVW R2,R20
0151 5041 SUBI R20,1
0152 4050 SBCI R21,0
0153 E082 LDI R24,2
0154 01F1 MOVW R30,R2
0155 8380 STD Z+0,R24
(0187) *psoft_stk-- = (INT8U)0x03; /* R3 = 0x03 */
0156 011A MOVW R2,R20
0157 5041 SUBI R20,1
0158 4050 SBCI R21,0
0159 E083 LDI R24,3
015A 01F1 MOVW R30,R2
015B 8380 STD Z+0,R24
(0188) *psoft_stk-- = (INT8U)0x04; /* R4 = 0x04 */
015C 011A MOVW R2,R20
015D 5041 SUBI R20,1
015E 4050 SBCI R21,0
015F E084 LDI R24,4
0160 01F1 MOVW R30,R2
0161 8380 STD Z+0,R24
(0189) *psoft_stk-- = (INT8U)0x05; /* R5 = 0x05 */
0162 011A MOVW R2,R20
0163 5041 SUBI R20,1
0164 4050 SBCI R21,0
0165 E085 LDI R24,5
0166 01F1 MOVW R30,R2
0167 8380 STD Z+0,R24
(0190) *psoft_stk-- = (INT8U)0x06; /* R6 = 0x06 */
0168 011A MOVW R2,R20
0169 5041 SUBI R20,1
016A 4050 SBCI R21,0
016B E086 LDI R24,6
016C 01F1 MOVW R30,R2
016D 8380 STD Z+0,R24
(0191) *psoft_stk-- = (INT8U)0x07; /* R7 = 0x07 */
016E 011A MOVW R2,R20
016F 5041 SUBI R20,1
0170 4050 SBCI R21,0
0171 E087 LDI R24,7
0172 01F1 MOVW R30,R2
0173 8380 STD Z+0,R24
(0192) *psoft_stk-- = (INT8U)0x08; /* R8 = 0x08 */
0174 011A MOVW R2,R20
0175 5041 SUBI R20,1
0176 4050 SBCI R21,0
0177 E088 LDI R24,0x8
0178 01F1 MOVW R30,R2
0179 8380 STD Z+0,R24
(0193) *psoft_stk-- = (INT8U)0x09; /* R9 = 0x09 */
017A 011A MOVW R2,R20
017B 5041 SUBI R20,1
017C 4050 SBCI R21,0
017D E089 LDI R24,0x9
017E 01F1 MOVW R30,R2
017F 8380 STD Z+0,R24
(0194) *psoft_stk-- = (INT8U)0x10; /* R10 = 0x10 */
0180 011A MOVW R2,R20
0181 5041 SUBI R20,1
0182 4050 SBCI R21,0
0183 E180 LDI R24,0x10
0184 01F1 MOVW R30,R2
0185 8380 STD Z+0,R24
(0195) *psoft_stk-- = (INT8U)0x11; /* R11 = 0x11 */
0186 011A MOVW R2,R20
0187 5041 SUBI R20,1
0188 4050 SBCI R21,0
0189 E181 LDI R24,0x11
018A 01F1 MOVW R30,R2
018B 8380 STD Z+0,R24
(0196) *psoft_stk-- = (INT8U)0x12; /* R12 = 0x12 */
018C 011A MOVW R2,R20
018D 5041 SUBI R20,1
018E 4050 SBCI R21,0
018F E182 LDI R24,0x12
0190 01F1 MOVW R30,R2
0191 8380 STD Z+0,R24
(0197) *psoft_stk-- = (INT8U)0x13; /* R13 = 0x13 */
0192 011A MOVW R2,R20
0193 5041 SUBI R20,1
0194 4050 SBCI R21,0
0195 E183 LDI R24,0x13
0196 01F1 MOVW R30,R2
0197 8380 STD Z+0,R24
(0198) *psoft_stk-- = (INT8U)0x14; /* R14 = 0x14 */
0198 011A MOVW R2,R20
0199 5041 SUBI R20,1
019A 4050 SBCI R21,0
019B E184 LDI R24,0x14
019C 01F1 MOVW R30,R2
019D 8380 STD Z+0,R24
(0199) *psoft_stk-- = (INT8U)0x15; /* R15 = 0x15 */
019E 011A MOVW R2,R20
019F 5041 SUBI R20,1
01A0 4050 SBCI R21,0
01A1 E185 LDI R24,0x15
01A2 01F1 MOVW R30,R2
01A3 8380 STD Z+0,R24
(0200) tmp = (INT16U)p_arg;
01A4 01B9 MOVW R22,R18
(0201) *psoft_stk-- = (INT8U)tmp; /* 'p_arg' passed in R17:R16 */
01A5 011A MOVW R2,R20
01A6 5041 SUBI R20,1
01A7 4050 SBCI R21,0
01A8 01F1 MOVW R30,R2
01A9 8360 STD Z+0,R22
(0202) *psoft_stk-- = (INT8U)(tmp >> 8);
01AA 011A MOVW R2,R20
01AB 5041 SUBI R20,1
01AC 4050 SBCI R21,0
01AD 012B MOVW R4,R22
01AE 2C45 MOV R4,R5
01AF 2455 CLR R5
01B0 01F1 MOVW R30,R2
01B1 8240 STD Z+0,R4
(0203) *psoft_stk-- = (INT8U)0x18; /* R18 = 0x18 */
01B2 011A MOVW R2,R20
01B3 5041 SUBI R20,1
01B4 4050 SBCI R21,0
01B5 E188 LDI R24,0x18
01B6 01F1 MOVW R30,R2
01B7 8380 STD Z+0,R24
(0204) *psoft_stk-- = (INT8U)0x19; /* R19 = 0x19 */
01B8 011A MOVW R2,R20
01B9 5041 SUBI R20,1
01BA 4050 SBCI R21,0
01BB E189 LDI R24,0x19
01BC 01F1 MOVW R30,R2
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -