📄 os_cpu_a.lst
字号:
129 129 ; + 7 PC(H)
130 130 ; + 8 PC(L)
131 131 ;********************************************************************************************************
132 132
133 133 OSCtxSw:
134 134 00000C FExx xx ldx OSTCBCur ; 3~, Point to current task's TCB
135 135 00000F 6F00 sts 0,x ; 3~, Save stack pointer in preempted task's TCB
136 136
137 137 000011 16xx xx jsr OSTaskSwHook ; 4~, Call user task switch hook
138 138
139 139 000014 FExx xx ldx OSTCBHighRdy ; 3~, OSTCBCur = OSTCBHighRdy
140 140 000017 7Exx xx stx OSTCBCur ; 3~
141 141
142 142 00001A F6xx xx ldab OSPrioHighRdy ; 3~, OSPrioCur = OSPrioHighRdy
143 143 00001D 7Bxx xx stab OSPrioCur ; 3~
144 144
145 145 000020 EF00 lds 0,x ; 3~, Load SP into 68HC12
146 146
147 147 000022 0B rti ; 8~, Run task
148 148
149 149 ;********************************************************************************************************
150 150 ; INTERRUPT LEVEL CONTEXT SWITCH
151 151 ;
152 152 ; Description : This function is called by OSIntExit() to perform a context switch to a task that has
153 153 ; been made ready-to-run by an ISR.
154 154 ;
155 155 ; Arguments : none
156 156 ;
157 157 ; Note(s) : 1) Stack frame upon entry (Assuming OS_CRITICAL_METHOD is 1):
158 158 ;
159 159 ; ---- SP + 0 -> PC(H) \ Return address from call to OSIntCtxSw()
160 160 ; SP Adjustment | SP + 1 -> PC(L) /
161 161 ; (+4) | SP + 2 -> PC(H) \ Return address from call to OSIntExit()
162 162 ; | SP + 3 -> PC(L) /
163 163 ; --> SP + 4 -> CCR \
164 164 ; SP + 5 -> B |
165 165 ; SP + 6 -> A |
166 166 ; SP + 7 -> X(H) | Stack frame from interrupt stacking.
167 167 ; SP + 8 -> X(L) |
168 168 ; SP + 9 -> Y(H) |
169 169 ; SP + 10 -> Y(L) |
170 170 ; SP + 11 -> PC(H) |
171 171 ; SP + 12 -> PC(L) /
172 172 ;********************************************************************************************************
173 173
174 174 OSIntCtxSw:
175 175 000023 1B84 leas 4,sp ; 2~, Clean up stack (Uncomment if OS_CRITICAL_METHOD is 1)
176 176 ; leas 5,sp ; 2~, Clean up stack (Uncomment if OS_CRITICAL_METHOD is 2)
177 177
178 178 000025 FDxx xx ldy OSTCBCur ; 3~, OSTCBCur->OSTCBStkPtr = Stack Pointer
179 179 000028 6F40 sts 0,y ; 3~,
180 180
181 181 00002A 16xx xx jsr OSTaskSwHook ; 4~, Call user task switch hook
182 182
183 183 00002D FExx xx ldx OSTCBHighRdy ; 3~, OSTCBCur = OSTCBHighRdy
184 184 000030 7Exx xx stx OSTCBCur ; 3~
185 185
186 186 000033 F6xx xx ldab OSPrioHighRdy ; 3~, OSPrioCur = OSPrioHighRdy
187 187 000036 7Bxx xx stab OSPrioCur ; 3~
188 188
189 189 000039 EF00 lds 0,x ; 3~, Load SP into 68HC12
190 190
191 191 00003B 0B rti ; 8~, Run task
192 192
Freescale HC12-Assembler
(c) Copyright Freescale 1987-2005
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
193 193 ;********************************************************************************************************
194 194 ; SYSTEM TICK ISR
195 195 ;
196 196 ; Description : This function is the ISR used to notify uC/OS-II that a system tick has occurred. You
197 197 ; must setup the 68HC12's interrupt vector table so that an OUTPUT COMPARE interrupt
198 198 ; vectors to this function.
199 199 ;
200 200 ; Arguments : none
201 201 ;
202 202 ; Notes : 1) The 'tick ISR' assumes the we are using the Output Compare specified by OS_TICK_OC
203 203 ; (see OS_CFG.H and this file) to generate a tick that occurs every OS_TICK_OC_CNTS
204 204 ; (see OS_CFG.H and this file) which corresponds to the number of FRT (Free Running
205 205 ; Timer) counts to the next interrupt.
206 206 ;
207 207 ; 2) You must specify which output compare will be used by the tick ISR as follows:
208 208 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 0 to use OUTPUT COMPARE #0
209 209 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 1 to use OUTPUT COMPARE #1
210 210 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 2 to use OUTPUT COMPARE #2
211 211 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 3 to use OUTPUT COMPARE #3
212 212 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 4 to use OUTPUT COMPARE #4
213 213 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 5 to use OUTPUT COMPARE #5
214 214 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 6 to use OUTPUT COMPARE #6
215 215 ; Set OS_TICK_OC in OS_CFG.H (AND in this file) to 7 to use OUTPUT COMPARE #7
216 216 ;
217 217 ; 3) TFLG1, TC0 ... TC7 are defined in this file.
218 218 ;********************************************************************************************************
219 219
220 220 OSTickISR:
221 221 00003C 72xx xx inc OSIntNesting ; 4~, Notify uC/OS-II about ISR
222 222
223 223 0000 0000 if OS_TICK_OC == 0
229 229 endif
230 230
231 231 0000 0000 if OS_TICK_OC == 1
237 237 endif
238 238
239 239 0000 0000 if OS_TICK_OC == 2
245 245 endif
246 246
247 247 0000 0000 if OS_TICK_OC == 3
253 253 endif
254 254
255 255 0000 0000 if OS_TICK_OC == 4
261 261 endif
262 262
263 263 0000 0000 if OS_TICK_OC == 5
269 269 endif
270 270
271 271 0000 0000 if OS_TICK_OC == 6
277 277 endif
278 278
279 279 0000 0001 if OS_TICK_OC == 7
280 280 00003F C680 ldab #$80 ; 2~, Clear C7F interrupt flag (bit 7)
281 281 000041 5B8E stab TFLG1 ; 4~
282 282 000043 DC9E ldd TC7 ; 5~, Set TC7 to present time + desired counts to next ISR
283 283 000045 C313 88 addd #OS_TICK_OC_CNTS ; 4~
284 284 000048 5C9E std TC7 ; 5~
285 285 endif
286 286
287 287 00004A 10EF cli ; 2~, Enable interrupts to allow interrupt nesting
288 288
289 289 00004C 16xx xx jsr OSTimeTick ; 6~+, Call uC/OS-II's tick updating function
290 290
291 291 00004F 16xx xx jsr OSIntExit ; 6~+, Notify uC/OS-II about end of ISR
Freescale HC12-Assembler
(c) Copyright Freescale 1987-2005
Abs. Rel. Loc Obj. code Source line
---- ---- ------ --------- -----------
292 292
293 293 000052 0B rti ; 12~, Return from interrupt, no higher priority tasks ready.
294 294 _Null
295 295 000053 183E stop
296 296
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -