os_tick.txt 41 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802
; generated by Component: ARM Compiler 5.06 update 6 (build 750) Tool: ArmCC [4d3637]
; commandline ArmCC [--c99 --list --split_sections --debug -c --asm --interleave -o.\flash\obj\os_tick.o --asm_dir=.\Flash\List\ --list_dir=.\Flash\List\ --depend=.\flash\obj\os_tick.d --cpu=Cortex-M4.fp --apcs=interwork -O1 --diag_suppress=9931,870 -I..\..\Libraries\CMSIS\Include -I..\..\Libraries\CMSIS\Device\ST\STM32F4xx\Include -I..\..\Libraries\STM32F4xx_StdPeriph_Driver\inc -I..\..\uCOS-III\uC-CPU -I..\..\uCOS-III\uC-LIB -I..\..\uCOS-III\uCOS-III\Ports -I..\..\uCOS-III\uCOS-III\Source -I..\..\uCOS-III\uC-CPU\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uC-LIB\Ports\ARM-Cortex-M4\RealView -I..\..\uCOS-III\uCOS-III\Ports\ARM-Cortex-M4\Generic\RealView -I..\..\User -I..\..\User\bsp -I..\..\User\bsp\inc -I..\..\User\libapp -I..\..\RL-ARM\Config -I..\..\RL-ARM\Driver -I..\..\RL-ARM\RL-RTX\inc -I..\..\User\bsp\BSP -I..\..\RL-ARM\RL-CAN -I..\..\Libraries\DSP_LIB\Include -I..\..\MODBUS\modbus\rtu -I..\..\MODBUS\BARE\port -I..\..\MODBUS\modbus\include -I..\..\User\bsp\BSP -I..\..\PLC -I..\..\Avoid -I..\..\User\parameter -I..\..\User\LaserMotionCtr -I..\..\User\W5100S -I..\..\User\bsp -I..\..\User\CHASSIS -I..\..\User\CONTROLFUNCTION -I..\..\User\DATAUPDATE -I..\..\User\HARAWARE -I..\..\User\MOTORDRIVER -I..\..\User\NAVAGATION -I..\..\User\PLATFORM -I..\..\User\SENSOR -I.\RTE\_Flash -IC:\Users\YDJ\AppData\Local\Arm\Packs\ARM\CMSIS\5.5.1\CMSIS\Core\Include -IC:\Users\YDJ\AppData\Local\Arm\Packs\Keil\STM32F4xx_DFP\2.13.0\Drivers\CMSIS\Device\ST\STM32F4xx\Include -D__UVISION_VERSION=527 -D_RTE_ -DSTM32F407xx -DUSE_STDPERIPH_DRIVER -DSTM32F40_41xxx -D__RTX -D__FPU_USED=1 --omf_browse=.\flash\obj\os_tick.crf ..\..\uCOS-III\uCOS-III\Source\os_tick.c]
                          THUMB

                          AREA ||i.OS_TickListInit||, CODE, READONLY, ALIGN=2

                  OS_TickListInit PROC
;;;165    
;;;166    void  OS_TickListInit (void)
000000  b510              PUSH     {r4,lr}
;;;167    {
;;;168        OS_TICK_SPOKE_IX   i;
;;;169        OS_TICK_SPOKE     *p_spoke;
;;;170    
;;;171    
;;;172    
;;;173        for (i = 0u; i < OSCfg_TickWheelSize; i++) {
000002  2000              MOVS     r0,#0
000004  2200              MOVS     r2,#0
;;;174            p_spoke                = (OS_TICK_SPOKE *)&OSCfg_TickWheel[i];
000006  4b07              LDR      r3,|L1.36|
000008  4c07              LDR      r4,|L1.40|
00000a  e006              B        |L1.26|
                  |L1.12|
00000c  eb0301c0          ADD      r1,r3,r0,LSL #3
;;;175            p_spoke->FirstPtr      = (OS_TCB        *)0;
000010  600a              STR      r2,[r1,#0]
;;;176            p_spoke->NbrEntries    = (OS_OBJ_QTY     )0u;
000012  808a              STRH     r2,[r1,#4]
;;;177            p_spoke->NbrEntriesMax = (OS_OBJ_QTY     )0u;
000014  80ca              STRH     r2,[r1,#6]
000016  1c40              ADDS     r0,r0,#1              ;173
000018  b280              UXTH     r0,r0                 ;173
                  |L1.26|
00001a  8821              LDRH     r1,[r4,#0]            ;173  ; OSCfg_TickWheelSize
00001c  4288              CMP      r0,r1                 ;173
00001e  d3f5              BCC      |L1.12|
;;;178        }
;;;179    }
000020  bd10              POP      {r4,pc}
;;;180    
                          ENDP

000022  0000              DCW      0x0000
                  |L1.36|
                          DCD      OSCfg_TickWheel
                  |L1.40|
                          DCD      OSCfg_TickWheelSize

                          AREA ||i.OS_TickListInsert||, CODE, READONLY, ALIGN=2

                  OS_TickListInsert PROC
;;;219    
;;;220    void  OS_TickListInsert (OS_TCB   *p_tcb,
000000  b5f0              PUSH     {r4-r7,lr}
;;;221                             OS_TICK   time,
;;;222                             OS_OPT    opt,
;;;223                             OS_ERR   *p_err)
;;;224    {
;;;225        OS_TICK            tick_delta;
;;;226        OS_TICK            tick_next;
;;;227        OS_TICK_SPOKE     *p_spoke;
;;;228        OS_TCB            *p_tcb0;
;;;229        OS_TCB            *p_tcb1;
;;;230        OS_TICK_SPOKE_IX   spoke;
;;;231    
;;;232    
;;;233    
;;;234        if (opt == OS_OPT_TIME_MATCH) {                              /* Task time is absolute.                            */
;;;235            tick_delta = time - OSTickCtr - 1u;
000002  4e38              LDR      r6,|L2.228|
000004  2500              MOVS     r5,#0
;;;236            if (tick_delta > OS_TICK_TH_RDY) {                       /* If delay already occurred, ...                    */
;;;237                p_tcb->TickCtrMatch = (OS_TICK        )0u;
;;;238                p_tcb->TickRemain   = (OS_TICK        )0u;
;;;239                p_tcb->TickSpokePtr = (OS_TICK_SPOKE *)0;
;;;240               *p_err               =  OS_ERR_TIME_ZERO_DLY;         /* ... do NOT delay.                                 */
000006  f247277e          MOV      r7,#0x727e
00000a  6834              LDR      r4,[r6,#0]            ;234
00000c  2a04              CMP      r2,#4                 ;234
00000e  d008              BEQ      |L2.34|
;;;241                return;
;;;242            }
;;;243            p_tcb->TickCtrMatch = time;
;;;244            p_tcb->TickRemain   = tick_delta + 1u;
;;;245    
;;;246        } else if (time > (OS_TICK)0u) {
000010  b399              CBZ      r1,|L2.122|
000012  4637              MOV      r7,r6                 ;235
;;;247            if (opt == OS_OPT_TIME_PERIODIC) {                       /* Task time is periodic.                            */
000014  2a08              CMP      r2,#8
000016  683f              LDR      r7,[r7,#0]            ;235
;;;248                tick_next  = p_tcb->TickCtrPrev + time;
;;;249                tick_delta = tick_next - OSTickCtr - 1u;
;;;250                if (tick_delta < time) {                             /* If next periodic delay did NOT already occur, ... */
;;;251                    p_tcb->TickCtrMatch = tick_next;                 /* ... set  next  periodic delay;                ... */
;;;252                } else {
;;;253                    p_tcb->TickCtrMatch = OSTickCtr + time;          /* ... else reset periodic delay.                    */
000018  440f              ADD      r7,r7,r1
00001a  d010              BEQ      |L2.62|
;;;254                }
;;;255                p_tcb->TickRemain   = p_tcb->TickCtrMatch - OSTickCtr;
;;;256                p_tcb->TickCtrPrev  = p_tcb->TickCtrMatch;
;;;257    
;;;258            } else {                                                 /* Task time is relative to current.                 */
;;;259                p_tcb->TickCtrMatch = OSTickCtr + time;
00001c  64c7              STR      r7,[r0,#0x4c]
;;;260                p_tcb->TickRemain   = time;
00001e  6501              STR      r1,[r0,#0x50]
000020  e01c              B        |L2.92|
                  |L2.34|
000022  1b0a              SUBS     r2,r1,r4              ;235
000024  1e52              SUBS     r2,r2,#1              ;235
000026  f5123f80          CMN      r2,#0x10000           ;236
00002a  d904              BLS      |L2.54|
00002c  64c5              STR      r5,[r0,#0x4c]         ;237
00002e  6505              STR      r5,[r0,#0x50]         ;238
000030  61c5              STR      r5,[r0,#0x1c]         ;239
000032  801f              STRH     r7,[r3,#0]            ;240
;;;261            }
;;;262    
;;;263        } else {                                                     /* Zero time delay; ...                              */
;;;264            p_tcb->TickCtrMatch = (OS_TICK        )0u;
;;;265            p_tcb->TickRemain   = (OS_TICK        )0u;
;;;266            p_tcb->TickSpokePtr = (OS_TICK_SPOKE *)0;
;;;267           *p_err               =  OS_ERR_TIME_ZERO_DLY;             /* ... do NOT delay.                                 */
;;;268            return;
;;;269        }
;;;270    
;;;271    
;;;272        spoke   = (OS_TICK_SPOKE_IX)(p_tcb->TickCtrMatch % OSCfg_TickWheelSize);
;;;273        p_spoke = &OSCfg_TickWheel[spoke];
;;;274    
;;;275        if (p_spoke->NbrEntries == (OS_OBJ_QTY)0u) {                 /* First entry in the spoke                          */
;;;276            p_tcb->TickNextPtr   = (OS_TCB   *)0;
;;;277            p_tcb->TickPrevPtr   = (OS_TCB   *)0;
;;;278            p_spoke->FirstPtr    =  p_tcb;
;;;279            p_spoke->NbrEntries  = (OS_OBJ_QTY)1u;
;;;280        } else {
;;;281            p_tcb1     = p_spoke->FirstPtr;                          /* Point to current first TCB in the list            */
;;;282            while (p_tcb1 != (OS_TCB *)0) {
;;;283                p_tcb1->TickRemain = p_tcb1->TickCtrMatch            /* Compute time remaining of current TCB in list     */
;;;284                                   - OSTickCtr;
;;;285                if (p_tcb->TickRemain > p_tcb1->TickRemain) {        /* Do we need to insert AFTER current TCB in list?   */
;;;286                    if (p_tcb1->TickNextPtr != (OS_TCB *)0) {        /* Yes, are we pointing at the last TCB in the list? */
;;;287                        p_tcb1               =  p_tcb1->TickNextPtr; /* No,  Point to next TCB in the list                */
;;;288                    } else {
;;;289                        p_tcb->TickNextPtr   = (OS_TCB *)0;
;;;290                        p_tcb->TickPrevPtr   =  p_tcb1;
;;;291                        p_tcb1->TickNextPtr  =  p_tcb;               /* Yes, TCB to add is now new last entry in the list */
;;;292                        p_tcb1               = (OS_TCB *)0;          /* Break loop                                        */
;;;293                    }
;;;294                } else {                                             /* Insert before the current TCB                     */
;;;295                    if (p_tcb1->TickPrevPtr == (OS_TCB *)0) {        /* Are we inserting before the first TCB?            */
;;;296                        p_tcb->TickPrevPtr   = (OS_TCB *)0;
;;;297                        p_tcb->TickNextPtr   =  p_tcb1;
;;;298                        p_tcb1->TickPrevPtr  =  p_tcb;
;;;299                        p_spoke->FirstPtr    =  p_tcb;
;;;300                    } else {                                         /* Insert in between 2 TCBs already in the list      */
;;;301                        p_tcb0               =  p_tcb1->TickPrevPtr;
;;;302                        p_tcb->TickPrevPtr   =  p_tcb0;
;;;303                        p_tcb->TickNextPtr   =  p_tcb1;
;;;304                        p_tcb0->TickNextPtr  =  p_tcb;
;;;305                        p_tcb1->TickPrevPtr  =  p_tcb;
;;;306                    }
;;;307                    p_tcb1 = (OS_TCB *)0;                            /* Break loop                                        */
;;;308                }
;;;309            }
;;;310            p_spoke->NbrEntries++;
;;;311        }
;;;312        if (p_spoke->NbrEntriesMax < p_spoke->NbrEntries) {          /* Keep track of maximum # of entries in each spoke  */
;;;313            p_spoke->NbrEntriesMax = p_spoke->NbrEntries;
;;;314        }
;;;315        p_tcb->TickSpokePtr = p_spoke;                               /* Link back to tick spoke                           */
;;;316       *p_err               = OS_ERR_NONE;
;;;317    }
000034  bdf0              POP      {r4-r7,pc}
                  |L2.54|
000036  64c1              STR      r1,[r0,#0x4c]         ;243
000038  1c52              ADDS     r2,r2,#1              ;244
00003a  6502              STR      r2,[r0,#0x50]         ;244
00003c  e00e              B        |L2.92|
                  |L2.62|
00003e  6c82              LDR      r2,[r0,#0x48]         ;248
000040  440a              ADD      r2,r2,r1              ;248
000042  eba20c04          SUB      r12,r2,r4             ;249
000046  f1ac0c01          SUB      r12,r12,#1            ;249
00004a  458c              CMP      r12,r1                ;250
00004c  d201              BCS      |L2.82|
00004e  64c2              STR      r2,[r0,#0x4c]         ;251
000050  e000              B        |L2.84|
                  |L2.82|
000052  64c7              STR      r7,[r0,#0x4c]         ;253
                  |L2.84|
000054  6cc1              LDR      r1,[r0,#0x4c]         ;255
000056  1b0a              SUBS     r2,r1,r4              ;255
000058  6502              STR      r2,[r0,#0x50]         ;255
00005a  6481              STR      r1,[r0,#0x48]         ;256
                  |L2.92|
00005c  4a22              LDR      r2,|L2.232|
00005e  6cc1              LDR      r1,[r0,#0x4c]         ;272
000060  8812              LDRH     r2,[r2,#0]            ;272  ; OSCfg_TickWheelSize
000062  fbb1f4f2          UDIV     r4,r1,r2              ;272
000066  fb021114          MLS      r1,r2,r4,r1           ;272
00006a  b289              UXTH     r1,r1                 ;272
00006c  4a1f              LDR      r2,|L2.236|
00006e  eb0202c1          ADD      r2,r2,r1,LSL #3       ;273
000072  8891              LDRH     r1,[r2,#4]            ;275
000074  b139              CBZ      r1,|L2.134|
000076  6811              LDR      r1,[r2,#0]            ;281
000078  e022              B        |L2.192|
                  |L2.122|
00007a  e7ff              B        |L2.124|
                  |L2.124|
00007c  64c5              STR      r5,[r0,#0x4c]         ;264
00007e  6505              STR      r5,[r0,#0x50]         ;265
000080  61c5              STR      r5,[r0,#0x1c]         ;266
000082  801f              STRH     r7,[r3,#0]            ;267
000084  bdf0              POP      {r4-r7,pc}
                  |L2.134|
000086  6145              STR      r5,[r0,#0x14]         ;276
000088  6185              STR      r5,[r0,#0x18]         ;277
00008a  6010              STR      r0,[r2,#0]            ;278
00008c  2101              MOVS     r1,#1                 ;279
00008e  8091              STRH     r1,[r2,#4]            ;279
000090  e01b              B        |L2.202|
                  |L2.146|
000092  6ccc              LDR      r4,[r1,#0x4c]         ;283
000094  6837              LDR      r7,[r6,#0]            ;283  ; OSTickCtr
000096  1be4              SUBS     r4,r4,r7              ;283
000098  650c              STR      r4,[r1,#0x50]         ;283
00009a  6d07              LDR      r7,[r0,#0x50]         ;285
00009c  42a7              CMP      r7,r4                 ;285
00009e  d908              BLS      |L2.178|
0000a0  694c              LDR      r4,[r1,#0x14]         ;286
0000a2  b10c              CBZ      r4,|L2.168|
0000a4  4621              MOV      r1,r4                 ;287
0000a6  e00b              B        |L2.192|
                  |L2.168|
0000a8  6145              STR      r5,[r0,#0x14]         ;289
0000aa  6181              STR      r1,[r0,#0x18]         ;290
0000ac  6148              STR      r0,[r1,#0x14]         ;291
0000ae  2100              MOVS     r1,#0                 ;292
0000b0  e006              B        |L2.192|
                  |L2.178|
0000b2  698c              LDR      r4,[r1,#0x18]         ;295
0000b4  b18c              CBZ      r4,|L2.218|
0000b6  6184              STR      r4,[r0,#0x18]         ;302
0000b8  6141              STR      r1,[r0,#0x14]         ;303
0000ba  6160              STR      r0,[r4,#0x14]         ;304
0000bc  6188              STR      r0,[r1,#0x18]         ;305
                  |L2.190|
0000be  2100              MOVS     r1,#0                 ;307
                  |L2.192|
0000c0  2900              CMP      r1,#0                 ;282
0000c2  d1e6              BNE      |L2.146|
0000c4  8891              LDRH     r1,[r2,#4]            ;310
0000c6  1c49              ADDS     r1,r1,#1              ;310
0000c8  8091              STRH     r1,[r2,#4]            ;310
                  |L2.202|
0000ca  88d4              LDRH     r4,[r2,#6]            ;312
0000cc  8891              LDRH     r1,[r2,#4]            ;312
0000ce  428c              CMP      r4,r1                 ;312
0000d0  d200              BCS      |L2.212|
0000d2  80d1              STRH     r1,[r2,#6]            ;313
                  |L2.212|
0000d4  61c2              STR      r2,[r0,#0x1c]         ;315
0000d6  801d              STRH     r5,[r3,#0]            ;316
0000d8  bdf0              POP      {r4-r7,pc}
                  |L2.218|
0000da  6185              STR      r5,[r0,#0x18]         ;296
0000dc  6141              STR      r1,[r0,#0x14]         ;297
0000de  6188              STR      r0,[r1,#0x18]         ;298
0000e0  6010              STR      r0,[r2,#0]            ;299
0000e2  e7ec              B        |L2.190|
;;;318    
                          ENDP

                  |L2.228|
                          DCD      OSTickCtr
                  |L2.232|
                          DCD      OSCfg_TickWheelSize
                  |L2.236|
                          DCD      OSCfg_TickWheel

                          AREA ||i.OS_TickListRemove||, CODE, READONLY, ALIGN=1

                  OS_TickListRemove PROC
;;;336    
;;;337    void  OS_TickListRemove (OS_TCB  *p_tcb)
000000  b510              PUSH     {r4,lr}
;;;338    {
;;;339        OS_TICK_SPOKE  *p_spoke;
;;;340        OS_TCB         *p_tcb1;
;;;341        OS_TCB         *p_tcb2;
;;;342    
;;;343    
;;;344    
;;;345        p_spoke = p_tcb->TickSpokePtr;
000002  69c1              LDR      r1,[r0,#0x1c]
;;;346        if (p_spoke != (OS_TICK_SPOKE *)0) {                              /* Confirm that task is in tick list            */
000004  2900              CMP      r1,#0
000006  d015              BEQ      |L3.52|
;;;347            p_tcb->TickRemain = (OS_TICK)0u;
000008  2400              MOVS     r4,#0
00000a  6504              STR      r4,[r0,#0x50]
;;;348            if (p_spoke->FirstPtr == p_tcb) {                             /* Is timer to remove at the beginning of list? */
00000c  680a              LDR      r2,[r1,#0]
00000e  4282              CMP      r2,r0
000010  d104              BNE      |L3.28|
;;;349                p_tcb1            = (OS_TCB *)p_tcb->TickNextPtr;         /* Yes                                          */
000012  6942              LDR      r2,[r0,#0x14]
;;;350                p_spoke->FirstPtr = p_tcb1;
000014  600a              STR      r2,[r1,#0]
;;;351                if (p_tcb1 != (OS_TCB *)0) {
000016  b132              CBZ      r2,|L3.38|
;;;352                    p_tcb1->TickPrevPtr = (OS_TCB *)0;
000018  6194              STR      r4,[r2,#0x18]
00001a  e004              B        |L3.38|
                  |L3.28|
;;;353                }
;;;354            } else {
;;;355                p_tcb1              = p_tcb->TickPrevPtr;                 /* No, remove timer from somewhere in the list  */
00001c  6983              LDR      r3,[r0,#0x18]
;;;356                p_tcb2              = p_tcb->TickNextPtr;
00001e  6942              LDR      r2,[r0,#0x14]
;;;357                p_tcb1->TickNextPtr = p_tcb2;
000020  615a              STR      r2,[r3,#0x14]
;;;358                if (p_tcb2 != (OS_TCB *)0) {
000022  b102              CBZ      r2,|L3.38|
;;;359                    p_tcb2->TickPrevPtr = p_tcb1;
000024  6193              STR      r3,[r2,#0x18]
                  |L3.38|
;;;360                }
;;;361            }
;;;362            p_tcb->TickNextPtr  = (OS_TCB        *)0;
000026  6144              STR      r4,[r0,#0x14]
;;;363            p_tcb->TickPrevPtr  = (OS_TCB        *)0;
000028  6184              STR      r4,[r0,#0x18]
;;;364            p_tcb->TickSpokePtr = (OS_TICK_SPOKE *)0;
00002a  61c4              STR      r4,[r0,#0x1c]
;;;365            p_tcb->TickCtrMatch = (OS_TICK        )0u;
00002c  64c4              STR      r4,[r0,#0x4c]
;;;366            p_spoke->NbrEntries--;
00002e  8888              LDRH     r0,[r1,#4]
000030  1e40              SUBS     r0,r0,#1
000032  8088              STRH     r0,[r1,#4]
                  |L3.52|
;;;367        }
;;;368    }
000034  bd10              POP      {r4,pc}
;;;369    
                          ENDP


                          AREA ||i.OS_TickListResetPeak||, CODE, READONLY, ALIGN=2

                  OS_TickListResetPeak PROC
;;;385    
;;;386    void  OS_TickListResetPeak (void)
000000  b510              PUSH     {r4,lr}
;;;387    {
;;;388        OS_TICK_SPOKE_IX   i;
;;;389        OS_TICK_SPOKE     *p_spoke;
;;;390    
;;;391    
;;;392    
;;;393        for (i = 0u; i < OSCfg_TickWheelSize; i++) {
000002  2000              MOVS     r0,#0
000004  2200              MOVS     r2,#0
;;;394            p_spoke                = (OS_TICK_SPOKE *)&OSCfg_TickWheel[i];
000006  4b06              LDR      r3,|L4.32|
000008  4c06              LDR      r4,|L4.36|
00000a  e004              B        |L4.22|
                  |L4.12|
00000c  eb0301c0          ADD      r1,r3,r0,LSL #3
;;;395            p_spoke->NbrEntriesMax = (OS_OBJ_QTY     )0u;
000010  80ca              STRH     r2,[r1,#6]
000012  1c40              ADDS     r0,r0,#1              ;393
000014  b280              UXTH     r0,r0                 ;393
                  |L4.22|
000016  8821              LDRH     r1,[r4,#0]            ;393  ; OSCfg_TickWheelSize
000018  4288              CMP      r0,r1                 ;393
00001a  d3f7              BCC      |L4.12|
;;;396        }
;;;397    }
00001c  bd10              POP      {r4,pc}
;;;398    
                          ENDP

00001e  0000              DCW      0x0000
                  |L4.32|
                          DCD      OSCfg_TickWheel
                  |L4.36|
                          DCD      OSCfg_TickWheelSize

                          AREA ||i.OS_TickListUpdate||, CODE, READONLY, ALIGN=2

                  OS_TickListUpdate PROC
;;;414    
;;;415    void  OS_TickListUpdate (void)
000000  e92d4ff8          PUSH     {r3-r11,lr}
;;;416    {
;;;417        CPU_BOOLEAN        done;
;;;418        OS_TICK_SPOKE     *p_spoke;
;;;419        OS_TCB            *p_tcb;
;;;420        OS_TCB            *p_tcb_next;
;;;421        OS_TICK_SPOKE_IX   spoke;
;;;422        CPU_TS             ts_start;
;;;423        CPU_TS             ts_end;
;;;424        CPU_SR_ALLOC();
;;;425    
;;;426    
;;;427        OS_CRITICAL_ENTER();
000004  f7fffffe          BL       CPU_SR_Save
000008  9000              STR      r0,[sp,#0]
;;;428        ts_start = OS_TS_GET();
00000a  f04f0b00          MOV      r11,#0
;;;429        OSTickCtr++;                                                       /* Keep track of the number of ticks           */
00000e  4e3e              LDR      r6,|L5.264|
000010  6830              LDR      r0,[r6,#0]  ; OSTickCtr
000012  1c40              ADDS     r0,r0,#1
000014  6030              STR      r0,[r6,#0]  ; OSTickCtr
;;;430        spoke    = (OS_TICK_SPOKE_IX)(OSTickCtr % OSCfg_TickWheelSize);
000016  493d              LDR      r1,|L5.268|
000018  8809              LDRH     r1,[r1,#0]  ; OSCfg_TickWheelSize
00001a  fbb0f2f1          UDIV     r2,r0,r1
00001e  fb010012          MLS      r0,r1,r2,r0
000022  b280              UXTH     r0,r0
;;;431        p_spoke  = &OSCfg_TickWheel[spoke];
000024  493a              LDR      r1,|L5.272|
000026  eb0100c0          ADD      r0,r1,r0,LSL #3
;;;432        p_tcb    = p_spoke->FirstPtr;
00002a  6804              LDR      r4,[r0,#0]
;;;433        done     = DEF_FALSE;
00002c  2500              MOVS     r5,#0
;;;434        while (done == DEF_FALSE) {
00002e  46a8              MOV      r8,r5
;;;435            if (p_tcb != (OS_TCB *)0) {
;;;436                p_tcb_next = p_tcb->TickNextPtr;                           /* Point to next TCB to update                 */
;;;437                switch (p_tcb->TaskState) {
000030  f04f0903          MOV      r9,#3
;;;438                    case OS_TASK_STATE_RDY:
;;;439                    case OS_TASK_STATE_PEND:
;;;440                    case OS_TASK_STATE_SUSPENDED:
;;;441                    case OS_TASK_STATE_PEND_SUSPENDED:
;;;442                         break;
;;;443    
;;;444                    case OS_TASK_STATE_DLY:
;;;445                         p_tcb->TickRemain = p_tcb->TickCtrMatch           /* Compute time remaining of current TCB       */
;;;446                                           - OSTickCtr;
;;;447                         if (OSTickCtr == p_tcb->TickCtrMatch) {           /* Process each TCB that expires               */
;;;448                             p_tcb->TaskState = OS_TASK_STATE_RDY;
;;;449                             OS_TaskRdy(p_tcb);                            /* Make task ready to run                      */
;;;450                         } else {
;;;451                             done             = DEF_TRUE;                  /* Don't find a match, we're done!             */
;;;452                         }
;;;453                         break;
;;;454    
;;;455                    case OS_TASK_STATE_PEND_TIMEOUT:
;;;456                         p_tcb->TickRemain = p_tcb->TickCtrMatch           /* Compute time remaining of current TCB       */
;;;457                                           - OSTickCtr;
;;;458                         if (OSTickCtr == p_tcb->TickCtrMatch) {           /* Process each TCB that expires               */
;;;459    #if (OS_MSG_EN > 0u)
;;;460                             p_tcb->MsgPtr     = (void      *)0;
;;;461                             p_tcb->MsgSize    = (OS_MSG_SIZE)0u;
;;;462    #endif
;;;463                             p_tcb->TS         = OS_TS_GET();
;;;464                             OS_PendListRemove(p_tcb);                     /* Remove from wait list                       */
;;;465                             OS_TaskRdy(p_tcb);
;;;466                             p_tcb->TaskState  = OS_TASK_STATE_RDY;
;;;467                             p_tcb->PendStatus = OS_STATUS_PEND_TIMEOUT;   /* Indicate pend timed out                     */
;;;468                             p_tcb->PendOn     = OS_TASK_PEND_ON_NOTHING;  /* Indicate no longer pending                  */
;;;469                         } else {
;;;470                             done              = DEF_TRUE;                 /* Don't find a match, we're done!             */
;;;471                         }
;;;472                         break;
;;;473    
;;;474                    case OS_TASK_STATE_DLY_SUSPENDED:
;;;475                         p_tcb->TickRemain = p_tcb->TickCtrMatch           /* Compute time remaining of current TCB       */
;;;476                                           - OSTickCtr;
;;;477                         if (OSTickCtr == p_tcb->TickCtrMatch) {           /* Process each TCB that expires               */
;;;478                             p_tcb->TaskState  = OS_TASK_STATE_SUSPENDED;
000034  f04f0a04          MOV      r10,#4
                  |L5.56|
000038  b37c              CBZ      r4,|L5.154|
00003a  6967              LDR      r7,[r4,#0x14]         ;436
00003c  f8940036          LDRB     r0,[r4,#0x36]         ;437
000040  2808              CMP      r0,#8                 ;437
000042  d24f              BCS      |L5.228|
000044  e8dff000          TBB      [pc,r0]               ;437
000048  4e044e12          DCB      0x4e,0x04,0x4e,0x12
00004c  4e2a4e38          DCB      0x4e,0x2a,0x4e,0x38
000050  6ce0              LDR      r0,[r4,#0x4c]         ;445
000052  6831              LDR      r1,[r6,#0]            ;445  ; OSTickCtr
000054  1a42              SUBS     r2,r0,r1              ;445
000056  6522              STR      r2,[r4,#0x50]         ;445
000058  4288              CMP      r0,r1                 ;447
00005a  d105              BNE      |L5.104|
00005c  f8848036          STRB     r8,[r4,#0x36]         ;448
000060  4620              MOV      r0,r4                 ;449
000062  f7fffffe          BL       OS_TaskRdy
000066  e03d              B        |L5.228|
                  |L5.104|
000068  2501              MOVS     r5,#1                 ;451
00006a  e03b              B        |L5.228|
00006c  6ce0              LDR      r0,[r4,#0x4c]         ;456
00006e  6831              LDR      r1,[r6,#0]            ;456  ; OSTickCtr
000070  1a42              SUBS     r2,r0,r1              ;456
000072  6522              STR      r2,[r4,#0x50]         ;456
000074  4288              CMP      r0,r1                 ;458
000076  d10e              BNE      |L5.150|
000078  f8c48040          STR      r8,[r4,#0x40]         ;463
00007c  4620              MOV      r0,r4                 ;464
00007e  f7fffffe          BL       OS_PendListRemove
000082  4620              MOV      r0,r4                 ;465
000084  f7fffffe          BL       OS_TaskRdy
000088  f8848036          STRB     r8,[r4,#0x36]         ;466
00008c  f8849035          STRB     r9,[r4,#0x35]         ;467
000090  f8848034          STRB     r8,[r4,#0x34]         ;468
000094  e026              B        |L5.228|
                  |L5.150|
000096  2501              MOVS     r5,#1                 ;470
000098  e024              B        |L5.228|
                  |L5.154|
00009a  e025              B        |L5.232|
00009c  6ce0              LDR      r0,[r4,#0x4c]         ;475
00009e  6831              LDR      r1,[r6,#0]            ;475  ; OSTickCtr
0000a0  1a42              SUBS     r2,r0,r1              ;475
0000a2  6522              STR      r2,[r4,#0x50]         ;475
0000a4  4288              CMP      r0,r1                 ;477
0000a6  d105              BNE      |L5.180|
0000a8  f884a036          STRB     r10,[r4,#0x36]
;;;479                             OS_TickListRemove(p_tcb);                     /* Remove from current wheel spoke             */
0000ac  4620              MOV      r0,r4
0000ae  f7fffffe          BL       OS_TickListRemove
0000b2  e017              B        |L5.228|
                  |L5.180|
;;;480                         } else {
;;;481                             done              = DEF_TRUE;                 /* Don't find a match, we're done!             */
0000b4  2501              MOVS     r5,#1
0000b6  e015              B        |L5.228|
;;;482                         }
;;;483                         break;
;;;484    
;;;485                    case OS_TASK_STATE_PEND_TIMEOUT_SUSPENDED:
;;;486                         p_tcb->TickRemain = p_tcb->TickCtrMatch           /* Compute time remaining of current TCB       */
0000b8  6ce0              LDR      r0,[r4,#0x4c]
0000ba  6831              LDR      r1,[r6,#0]  ; OSTickCtr
0000bc  1a42              SUBS     r2,r0,r1
0000be  6522              STR      r2,[r4,#0x50]
;;;487                                           - OSTickCtr;
;;;488                         if (OSTickCtr == p_tcb->TickCtrMatch) {           /* Process each TCB that expires               */
0000c0  4288              CMP      r0,r1
0000c2  d10e              BNE      |L5.226|
;;;489    #if (OS_MSG_EN > 0u)
;;;490                             p_tcb->MsgPtr     = (void      *)0;
;;;491                             p_tcb->MsgSize    = (OS_MSG_SIZE)0u;
;;;492    #endif
;;;493                             p_tcb->TS         = OS_TS_GET();
0000c4  f8c48040          STR      r8,[r4,#0x40]
;;;494                             OS_PendListRemove(p_tcb);                     /* Remove from wait list                       */
0000c8  4620              MOV      r0,r4
0000ca  f7fffffe          BL       OS_PendListRemove
;;;495                             OS_TickListRemove(p_tcb);                     /* Remove from current wheel spoke             */
0000ce  4620              MOV      r0,r4
0000d0  f7fffffe          BL       OS_TickListRemove
;;;496                             p_tcb->TaskState  = OS_TASK_STATE_SUSPENDED;
0000d4  f884a036          STRB     r10,[r4,#0x36]
;;;497                             p_tcb->PendStatus = OS_STATUS_PEND_TIMEOUT;   /* Indicate pend timed out                     */
0000d8  f8849035          STRB     r9,[r4,#0x35]
;;;498                             p_tcb->PendOn     = OS_TASK_PEND_ON_NOTHING;  /* Indicate no longer pending                  */
0000dc  f8848034          STRB     r8,[r4,#0x34]
0000e0  e000              B        |L5.228|
                  |L5.226|
;;;499                         } else {
;;;500                             done              = DEF_TRUE;                 /* Don't find a match, we're done!             */
0000e2  2501              MOVS     r5,#1
                  |L5.228|
;;;501                         }
;;;502                         break;
;;;503    
;;;504                    default:
;;;505                         break;
;;;506                }
;;;507                p_tcb = p_tcb_next;
0000e4  463c              MOV      r4,r7
0000e6  e000              B        |L5.234|
                  |L5.232|
;;;508            } else {
;;;509                done  = DEF_TRUE;
0000e8  2501              MOVS     r5,#1
                  |L5.234|
0000ea  2d00              CMP      r5,#0                 ;434
0000ec  d0a4              BEQ      |L5.56|
;;;510            }
;;;511        }
;;;512        ts_end = OS_TS_GET() - ts_start;                                   /* Measure execution time of tick task         */
0000ee  f1cb0000          RSB      r0,r11,#0
;;;513        if (OSTickTaskTimeMax < ts_end) {
0000f2  4908              LDR      r1,|L5.276|
0000f4  680a              LDR      r2,[r1,#0]  ; OSTickTaskTimeMax
0000f6  4282              CMP      r2,r0
0000f8  d200              BCS      |L5.252|
;;;514            OSTickTaskTimeMax = ts_end;
0000fa  6008              STR      r0,[r1,#0]  ; OSTickTaskTimeMax
                  |L5.252|
;;;515        }
;;;516        OS_CRITICAL_EXIT();
0000fc  9800              LDR      r0,[sp,#0]
0000fe  e8bd4ff8          POP      {r3-r11,lr}
000102  f7ffbffe          B.W      CPU_SR_Restore
;;;517    }
                          ENDP

000106  0000              DCW      0x0000
                  |L5.264|
                          DCD      OSTickCtr
                  |L5.268|
                          DCD      OSCfg_TickWheelSize
                  |L5.272|
                          DCD      OSCfg_TickWheel
                  |L5.276|
                          DCD      OSTickTaskTimeMax

                          AREA ||i.OS_TickTask||, CODE, READONLY, ALIGN=2

                  OS_TickTask PROC
;;;60     
;;;61     void  OS_TickTask (void  *p_arg)
000000  b51c              PUSH     {r2-r4,lr}
;;;62     {
;;;63         OS_ERR  err;
;;;64         CPU_TS  ts;
;;;65     
;;;66     
;;;67         p_arg = p_arg;                                          /* Prevent compiler warning                               */
;;;68     
;;;69         while (DEF_ON) {
;;;70             (void)OSTaskSemPend((OS_TICK  )0,
;;;71                                 (OS_OPT   )OS_OPT_PEND_BLOCKING,
;;;72                                 (CPU_TS  *)&ts,
;;;73                                 (OS_ERR  *)&err);               /* Wait for signal from tick interrupt                    */
;;;74             if (err == OS_ERR_NONE) {
;;;75                 if (OSRunning == OS_STATE_OS_RUNNING) {
000002  4c08              LDR      r4,|L6.36|
                  |L6.4|
000004  2100              MOVS     r1,#0                 ;70
000006  ab01              ADD      r3,sp,#4              ;70
000008  466a              MOV      r2,sp                 ;70
00000a  4608              MOV      r0,r1                 ;70
00000c  f7fffffe          BL       OSTaskSemPend
000010  f8bd0004          LDRH     r0,[sp,#4]            ;74
000014  2800              CMP      r0,#0                 ;74
000016  d1f5              BNE      |L6.4|
000018  7820              LDRB     r0,[r4,#0]  ; OSRunning
00001a  2801              CMP      r0,#1
00001c  d1f2              BNE      |L6.4|
;;;76                     OS_TickListUpdate();                        /* Update all tasks waiting for time                      */
00001e  f7fffffe          BL       OS_TickListUpdate
000022  e7ef              B        |L6.4|
;;;77                 }
;;;78             }
;;;79         }
;;;80     }
;;;81     
                          ENDP

                  |L6.36|
                          DCD      OSRunning

                          AREA ||i.OS_TickTaskInit||, CODE, READONLY, ALIGN=2

                  OS_TickTaskInit PROC
;;;103    
;;;104    void  OS_TickTaskInit (OS_ERR  *p_err)
000000  b530              PUSH     {r4,r5,lr}
;;;105    {
000002  b089              SUB      sp,sp,#0x24
000004  4604              MOV      r4,r0
;;;106    #ifdef OS_SAFETY_CRITICAL
;;;107        if (p_err == (OS_ERR *)0) {
;;;108            OS_SAFETY_CRITICAL_EXCEPTION();
;;;109            return;
;;;110        }
;;;111    #endif
;;;112    
;;;113        OSTickCtr         = (OS_TICK)0u;                        /* Clear the tick counter                                 */
000006  481b              LDR      r0,|L7.116|
000008  2500              MOVS     r5,#0
00000a  6005              STR      r5,[r0,#0]  ; OSTickCtr
;;;114    
;;;115        OSTickTaskTimeMax = (CPU_TS)0u;
00000c  481a              LDR      r0,|L7.120|
00000e  6005              STR      r5,[r0,#0]  ; OSTickTaskTimeMax
;;;116    
;;;117    
;;;118        OS_TickListInit();                                      /* Initialize the tick list data structures               */
000010  f7fffffe          BL       OS_TickListInit
;;;119    
;;;120                                                                /* ---------------- CREATE THE TICK TASK ---------------- */
;;;121        if (OSCfg_TickTaskStkBasePtr == (CPU_STK *)0) {
000014  4819              LDR      r0,|L7.124|
000016  6801              LDR      r1,[r0,#0]  ; OSCfg_TickTaskStkBasePtr
000018  b151              CBZ      r1,|L7.48|
;;;122           *p_err = OS_ERR_TICK_STK_INVALID;
;;;123            return;
;;;124        }
;;;125    
;;;126        if (OSCfg_TickTaskStkSize < OSCfg_StkSizeMin) {
00001a  4919              LDR      r1,|L7.128|
00001c  4b19              LDR      r3,|L7.132|
00001e  680a              LDR      r2,[r1,#0]  ; OSCfg_TickTaskStkSize
000020  681b              LDR      r3,[r3,#0]  ; OSCfg_StkSizeMin
000022  429a              CMP      r2,r3
000024  d208              BCS      |L7.56|
;;;127           *p_err = OS_ERR_TICK_STK_SIZE_INVALID;
000026  f2472013          MOV      r0,#0x7213
00002a  8020              STRH     r0,[r4,#0]
                  |L7.44|
;;;128            return;
;;;129        }
;;;130    
;;;131        if (OSCfg_TickTaskPrio >= (OS_CFG_PRIO_MAX - 1u)) {     /* Only one task at the 'Idle Task' priority              */
;;;132           *p_err = OS_ERR_TICK_PRIO_INVALID;
;;;133            return;
;;;134        }
;;;135    
;;;136        OSTaskCreate((OS_TCB     *)&OSTickTaskTCB,
;;;137                     (CPU_CHAR   *)((void *)"uC/OS-III Tick Task"),
;;;138                     (OS_TASK_PTR )OS_TickTask,
;;;139                     (void       *)0,
;;;140                     (OS_PRIO     )OSCfg_TickTaskPrio,
;;;141                     (CPU_STK    *)OSCfg_TickTaskStkBasePtr,
;;;142                     (CPU_STK_SIZE)OSCfg_TickTaskStkLimit,
;;;143                     (CPU_STK_SIZE)OSCfg_TickTaskStkSize,
;;;144                     (OS_MSG_QTY  )0u,
;;;145                     (OS_TICK     )0u,
;;;146                     (void       *)0,
;;;147                     (OS_OPT      )(OS_OPT_TASK_STK_CHK | OS_OPT_TASK_STK_CLR | OS_OPT_TASK_NO_TLS),
;;;148                     (OS_ERR     *)p_err);
;;;149    }
00002c  b009              ADD      sp,sp,#0x24
00002e  bd30              POP      {r4,r5,pc}
                  |L7.48|
000030  f2472012          MOV      r0,#0x7212            ;122
000034  8020              STRH     r0,[r4,#0]            ;122
000036  e7f9              B        |L7.44|
                  |L7.56|
000038  4a13              LDR      r2,|L7.136|
00003a  7813              LDRB     r3,[r2,#0]            ;131  ; OSCfg_TickTaskPrio
00003c  2b0f              CMP      r3,#0xf               ;131
00003e  d303              BCC      |L7.72|
000040  f2472011          MOV      r0,#0x7211            ;132
000044  8020              STRH     r0,[r4,#0]            ;132
000046  e7f1              B        |L7.44|
                  |L7.72|
000048  230b              MOVS     r3,#0xb               ;136
00004a  e9cd5306          STRD     r5,r3,[sp,#0x18]      ;136
00004e  9505              STR      r5,[sp,#0x14]         ;136
000050  9408              STR      r4,[sp,#0x20]         ;136
000052  4b0e              LDR      r3,|L7.140|
000054  6809              LDR      r1,[r1,#0]            ;136  ; OSCfg_TickTaskStkSize
000056  6800              LDR      r0,[r0,#0]            ;136  ; OSCfg_TickTaskStkBasePtr
000058  681b              LDR      r3,[r3,#0]            ;136  ; OSCfg_TickTaskStkLimit
00005a  e9cd1503          STRD     r1,r5,[sp,#0xc]       ;136
00005e  e9cd0301          STRD     r0,r3,[sp,#4]         ;136
000062  7810              LDRB     r0,[r2,#0]            ;136  ; OSCfg_TickTaskPrio
000064  9000              STR      r0,[sp,#0]            ;136
000066  2300              MOVS     r3,#0                 ;136
000068  4a09              LDR      r2,|L7.144|
00006a  a10a              ADR      r1,|L7.148|
00006c  480e              LDR      r0,|L7.168|
00006e  f7fffffe          BL       OSTaskCreate
000072  e7db              B        |L7.44|
;;;150    
                          ENDP

                  |L7.116|
                          DCD      OSTickCtr
                  |L7.120|
                          DCD      OSTickTaskTimeMax
                  |L7.124|
                          DCD      OSCfg_TickTaskStkBasePtr
                  |L7.128|
                          DCD      OSCfg_TickTaskStkSize
                  |L7.132|
                          DCD      OSCfg_StkSizeMin
                  |L7.136|
                          DCD      OSCfg_TickTaskPrio
                  |L7.140|
                          DCD      OSCfg_TickTaskStkLimit
                  |L7.144|
                          DCD      OS_TickTask
                  |L7.148|
000094  75432f4f          DCB      "uC/OS-III Tick Task",0
000098  532d4949
00009c  49205469
0000a0  636b2054
0000a4  61736b00
                  |L7.168|
                          DCD      OSTickTaskTCB