📄 os_tmr.lst
字号:
\ ??OSTmrDel_6:
\ 0000004C 2800 MOVS R0,R5
\ 0000004E ........ BL OSTmr_Free
245 OSTmr_Unlock();
\ 00000052 ........ BL OSTmr_Unlock
246 *perr = OS_ERR_NONE;
\ 00000056 0020 MOVS R0,#+0
\ 00000058 2070 STRB R0,[R4, #+0]
247 return (OS_TRUE);
\ 0000005A 0120 MOVS R0,#+1
\ 0000005C 30BD POP {R4,R5,PC}
248
249 case OS_TMR_STATE_UNUSED: /* Already deleted */
250 OSTmr_Unlock();
\ ??OSTmrDel_5:
\ 0000005E ........ BL OSTmr_Unlock
251 *perr = OS_ERR_TMR_INACTIVE;
\ 00000062 8720 MOVS R0,#+135
\ 00000064 2070 STRB R0,[R4, #+0]
\ 00000066 CFE7 B.N ??OSTmrDel_1
252 return (OS_FALSE);
253
254 default:
255 OSTmr_Unlock();
\ ??OSTmrDel_7:
\ 00000068 ........ BL OSTmr_Unlock
256 *perr = OS_ERR_TMR_INVALID_STATE;
\ 0000006C 8D20 MOVS R0,#+141
\ 0000006E 2070 STRB R0,[R4, #+0]
\ 00000070 CAE7 B.N ??OSTmrDel_1
257 return (OS_FALSE);
258 }
259 }
260 #endif
261
262 /*$PAGE*/
263 /*
264 ************************************************************************************************************************
265 * GET THE NAME OF A TIMER
266 *
267 * Description: This function is called to obtain the name of a timer.
268 *
269 * Arguments : ptmr Is a pointer to the timer to obtain the name for
270 *
271 * pdest Is a pointer to where the name of the timer will be placed. It is the caller's responsibility
272 * to ensure that he has sufficient storage in the destination, i.e. at least OS_TMR_CFG_NAME_SIZE
273 *
274 * perr Is a pointer to an error code. '*perr' will contain one of the following:
275 * OS_ERR_NONE The call was successful
276 * OS_ERR_TMR_INVALID_DEST 'pdest' is a NULL pointer
277 * OS_ERR_TMR_INVALID 'ptmr' is a NULL pointer
278 * OS_ERR_TMR_INVALID_TYPE 'ptmr' is not pointing to an OS_TMR
279 * OS_ERR_NAME_GET_ISR if the call was made from an ISR
280 * OS_ERR_TMR_INACTIVE 'ptmr' points to a timer that is not active
281 * OS_ERR_TMR_INVALID_STATE the timer is in an invalid state
282 *
283 * Returns : The length of the string or 0 if the timer does not exist.
284 ************************************************************************************************************************
285 */
286
287 #if OS_TMR_EN > 0 && OS_TMR_CFG_NAME_SIZE > 0
\ In segment CODE, align 4, keep-with-next
288 INT8U OSTmrNameGet (OS_TMR *ptmr,
289 INT8U *pdest,
290 INT8U *perr)
291 {
\ OSTmrNameGet:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0500 MOVS R5,R0
\ 00000004 0E00 MOVS R6,R1
\ 00000006 1400 MOVS R4,R2
292 INT8U len;
293
294
295 #if OS_ARG_CHK_EN > 0
296 if (perr == (INT8U *)0) {
\ 00000008 01D1 BNE.N ??OSTmrNameGet_0
297 return (0);
\ ??OSTmrNameGet_1:
\ 0000000A 0020 MOVS R0,#+0
\ 0000000C 70BD POP {R4-R6,PC} ;; return
298 }
299 if (pdest == (INT8U *)0) {
\ ??OSTmrNameGet_0:
\ 0000000E 002E CMP R6,#+0
\ 00000010 02D1 BNE.N ??OSTmrNameGet_2
300 *perr = OS_ERR_TMR_INVALID_DEST;
\ 00000012 8820 MOVS R0,#+136
\ 00000014 2070 STRB R0,[R4, #+0]
\ 00000016 F8E7 B.N ??OSTmrNameGet_1
301 return (0);
302 }
303 if (ptmr == (OS_TMR *)0) {
\ ??OSTmrNameGet_2:
\ 00000018 002D CMP R5,#+0
\ 0000001A 02D1 BNE.N ??OSTmrNameGet_3
304 *perr = OS_ERR_TMR_INVALID;
\ 0000001C 8A20 MOVS R0,#+138
\ 0000001E 2070 STRB R0,[R4, #+0]
\ 00000020 F3E7 B.N ??OSTmrNameGet_1
305 return (0);
306 }
307 #endif
308 if (ptmr->OSTmrType != OS_TMR_TYPE) { /* Validate timer structure */
\ ??OSTmrNameGet_3:
\ 00000022 2878 LDRB R0,[R5, #+0]
\ 00000024 6428 CMP R0,#+100
\ 00000026 02D0 BEQ.N ??OSTmrNameGet_4
309 *perr = OS_ERR_TMR_INVALID_TYPE;
\ 00000028 8920 MOVS R0,#+137
\ 0000002A 2070 STRB R0,[R4, #+0]
\ 0000002C EDE7 B.N ??OSTmrNameGet_1
310 return (0);
311 }
312 if (OSIntNesting > 0) { /* See if trying to call from an ISR */
\ ??OSTmrNameGet_4:
\ 0000002E .... LDR.N R0,??DataTable6 ;; OSIntNesting
\ 00000030 0078 LDRB R0,[R0, #+0]
\ 00000032 0028 CMP R0,#+0
\ 00000034 02D0 BEQ.N ??OSTmrNameGet_5
313 *perr = OS_ERR_NAME_GET_ISR;
\ 00000036 1120 MOVS R0,#+17
\ 00000038 2070 STRB R0,[R4, #+0]
\ 0000003A E6E7 B.N ??OSTmrNameGet_1
314 return (0);
315 }
316 OSTmr_Lock();
\ ??OSTmrNameGet_5:
\ 0000003C ........ BL OSTmr_Lock
317 switch (ptmr->OSTmrState) {
\ 00000040 95F83100 LDRB R0,[R5, #+49]
\ 00000044 0028 CMP R0,#+0
\ 00000046 0ED0 BEQ.N ??OSTmrNameGet_6
\ 00000048 401E SUBS R0,R0,#+1
\ 0000004A 0228 CMP R0,#+2
\ 0000004C 10D8 BHI.N ??OSTmrNameGet_7
318 case OS_TMR_STATE_RUNNING:
319 case OS_TMR_STATE_STOPPED:
320 case OS_TMR_STATE_COMPLETED:
321 len = OS_StrCopy(pdest, ptmr->OSTmrName);
\ 0000004E 2035 ADDS R5,R5,#+32
\ 00000050 2900 MOVS R1,R5
\ 00000052 3000 MOVS R0,R6
\ 00000054 ........ _BLF OS_StrCopy,??OS_StrCopy??rT
\ 00000058 0500 MOVS R5,R0
322 OSTmr_Unlock();
\ 0000005A ........ BL OSTmr_Unlock
323 *perr = OS_ERR_NONE;
\ 0000005E 0020 MOVS R0,#+0
\ 00000060 2070 STRB R0,[R4, #+0]
324 return (len);
\ 00000062 2800 MOVS R0,R5
\ 00000064 70BD POP {R4-R6,PC}
325
326 case OS_TMR_STATE_UNUSED: /* Timer is not allocated */
327 OSTmr_Unlock();
\ ??OSTmrNameGet_6:
\ 00000066 ........ BL OSTmr_Unlock
328 *perr = OS_ERR_TMR_INACTIVE;
\ 0000006A 8720 MOVS R0,#+135
\ 0000006C 2070 STRB R0,[R4, #+0]
\ 0000006E CCE7 B.N ??OSTmrNameGet_1
329 return (0);
330
331 default:
332 OSTmr_Unlock();
\ ??OSTmrNameGet_7:
\ 00000070 ........ BL OSTmr_Unlock
333 *perr = OS_ERR_TMR_INVALID_STATE;
\ 00000074 8D20 MOVS R0,#+141
\ 00000076 2070 STRB R0,[R4, #+0]
\ 00000078 C7E7 B.N ??OSTmrNameGet_1
334 return (0);
335 }
336 }
337 #endif
338
339 /*$PAGE*/
340 /*
341 ************************************************************************************************************************
342 * GET HOW MUCH TIME IS LEFT BEFORE A TIMER EXPIRES
343 *
344 * Description: This function is called to get the number of ticks before a timer times out.
345 *
346 * Arguments : ptmr Is a pointer to the timer to obtain the remaining time from.
347 *
348 * perr Is a pointer to an error code. '*perr' will contain one of the following:
349 * OS_ERR_NONE
350 * OS_ERR_TMR_INVALID 'ptmr' is a NULL pointer
351 * OS_ERR_TMR_INVALID_TYPE 'ptmr' is not pointing to an OS_TMR
352 * OS_ERR_TMR_ISR if the call was made from an ISR
353 * OS_ERR_TMR_INACTIVE 'ptmr' points to a timer that is not active
354 * OS_ERR_TMR_INVALID_STATE the timer is in an invalid state
355 *
356 * Returns : The time remaining for the timer to expire. The time represents 'timer' increments. In other words, if
357 * OSTmr_Task() is signaled every 1/10 of a second then the returned value represents the number of 1/10 of
358 * a second remaining before the timer expires.
359 ************************************************************************************************************************
360 */
361
362 #if OS_TMR_EN > 0
\ In segment CODE, align 4, keep-with-next
363 INT32U OSTmrRemainGet (OS_TMR *ptmr,
364 INT8U *perr)
365 {
\ OSTmrRemainGet:
\ 00000000 70B5 PUSH {R4-R6,LR}
\ 00000002 0600 MOVS R6,R0
\ 00000004 0C00 MOVS R4,R1
366 INT32U remain;
367
368
369 #if OS_ARG_CHK_EN > 0
370 if (perr == (INT8U *)0) {
\ 00000006 01D1 BNE.N ??OSTmrRemainGet_1
371 return (0);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -