os_q.txt

来自「针对STM32F103的UCOS移植」· 文本 代码 · 共 1,204 行 · 第 1/5 页

TXT
1,204 行
字号
00034c  2302              MOVS     r3,#2                 ;525
00034e  2204              MOVS     r2,#4                 ;525
000350  2100              MOVS     r1,#0                 ;525
000352  4628              MOV      r0,r5                 ;525
000354  f7fffffe          BL       OS_EventTaskRdy
000358  1c60              ADDS     r0,r4,#1              ;526
00035a  b2c4              UXTB     r4,r0                 ;526
00035c  7aa9              LDRB     r1,[r5,#0xa]          ;524
00035e  2900              CMP      r1,#0                 ;524
000360  d1f4              BNE      |L1.844|
000362  e006              B        |L1.882|
                  |L1.868|
000364  2302              MOVS     r3,#2                 ;532
000366  2204              MOVS     r2,#4                 ;532
000368  2100              MOVS     r1,#0                 ;532
00036a  4628              MOV      r0,r5                 ;532
00036c  f7fffffe          BL       OS_EventTaskRdy
000370  2401              MOVS     r4,#1                 ;533
                  |L1.882|
000372  4638              MOV      r0,r7                 ;536
000374  f7fffffe          BL       OS_CPU_SR_Restore
000378  f7fffffe          BL       OS_Sched
00037c  200e              MOVS     r0,#0xe               ;538
00037e  7030              STRB     r0,[r6,#0]            ;538
000380  4620              MOV      r0,r4                 ;539
000382  e8bd81f0          POP      {r4-r8,pc}
                  |L1.902|
000386  4638              MOV      r0,r7                 ;541
000388  f7fffffe          BL       OS_CPU_SR_Restore
00038c  2000              MOVS     r0,#0                 ;542
00038e  7030              STRB     r0,[r6,#0]            ;542
000390  e8bd81f0          POP      {r4-r8,pc}
;;;545    #endif
                          ENDP

                  OSQPost PROC
;;;568    INT8U  OSQPost (OS_EVENT *pevent, void *pmsg)
;;;569    {
000394  b570              PUSH     {r4-r6,lr}
000396  4604              MOV      r4,r0
000398  460d              MOV      r5,r1
;;;570        OS_Q      *pq;
;;;571    #if OS_CRITICAL_METHOD == 3                            /* Allocate storage for CPU status register     */
;;;572        OS_CPU_SR  cpu_sr = 0;
;;;573    #endif
;;;574    
;;;575    
;;;576    
;;;577    #if OS_ARG_CHK_EN > 0
;;;578        if (pevent == (OS_EVENT *)0) {                     /* Validate 'pevent'                            */
00039a  b90c              CBNZ     r4,|L1.928|
;;;579            return (OS_ERR_PEVENT_NULL);
00039c  2004              MOVS     r0,#4
;;;580        }
;;;581    #endif
;;;582        if (pevent->OSEventType != OS_EVENT_TYPE_Q) {      /* Validate event block type                    */
;;;583            return (OS_ERR_EVENT_TYPE);
;;;584        }
;;;585        OS_ENTER_CRITICAL();
;;;586        if (pevent->OSEventGrp != 0) {                     /* See if any task pending on queue             */
;;;587                                                           /* Ready highest priority task waiting on event */
;;;588            (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_Q, OS_STAT_PEND_OK);
;;;589            OS_EXIT_CRITICAL();
;;;590            OS_Sched();                                    /* Find highest priority task ready to run      */
;;;591            return (OS_ERR_NONE);
;;;592        }
;;;593        pq = (OS_Q *)pevent->OSEventPtr;                   /* Point to queue control block                 */
;;;594        if (pq->OSQEntries >= pq->OSQSize) {               /* Make sure queue is not full                  */
;;;595            OS_EXIT_CRITICAL();
;;;596            return (OS_ERR_Q_FULL);
;;;597        }
;;;598        *pq->OSQIn++ = pmsg;                               /* Insert message into queue                    */
;;;599        pq->OSQEntries++;                                  /* Update the nbr of entries in the queue       */
;;;600        if (pq->OSQIn == pq->OSQEnd) {                     /* Wrap IN ptr if we are at end of queue        */
;;;601            pq->OSQIn = pq->OSQStart;
;;;602        }
;;;603        OS_EXIT_CRITICAL();
;;;604        return (OS_ERR_NONE);
;;;605    }
00039e  bd70              POP      {r4-r6,pc}
                  |L1.928|
0003a0  7820              LDRB     r0,[r4,#0]            ;582
0003a2  2802              CMP      r0,#2                 ;582
0003a4  d001              BEQ      |L1.938|
0003a6  2001              MOVS     r0,#1                 ;583
0003a8  bd70              POP      {r4-r6,pc}
                  |L1.938|
0003aa  f7fffffe          BL       OS_CPU_SR_Save
0003ae  4606              MOV      r6,r0                 ;585
0003b0  7aa0              LDRB     r0,[r4,#0xa]          ;586
0003b2  b160              CBZ      r0,|L1.974|
0003b4  2300              MOVS     r3,#0                 ;588
0003b6  2204              MOVS     r2,#4                 ;588
0003b8  4629              MOV      r1,r5                 ;588
0003ba  4620              MOV      r0,r4                 ;588
0003bc  f7fffffe          BL       OS_EventTaskRdy
0003c0  4630              MOV      r0,r6                 ;589
0003c2  f7fffffe          BL       OS_CPU_SR_Restore
0003c6  f7fffffe          BL       OS_Sched
0003ca  2000              MOVS     r0,#0                 ;591
0003cc  bd70              POP      {r4-r6,pc}
                  |L1.974|
0003ce  6860              LDR      r0,[r4,#4]            ;593
0003d0  8ac1              LDRH     r1,[r0,#0x16]         ;594
0003d2  8a82              LDRH     r2,[r0,#0x14]         ;594
0003d4  4291              CMP      r1,r2                 ;594
0003d6  d304              BCC      |L1.994|
0003d8  4630              MOV      r0,r6                 ;595
0003da  f7fffffe          BL       OS_CPU_SR_Restore
0003de  201e              MOVS     r0,#0x1e              ;596
0003e0  bd70              POP      {r4-r6,pc}
                  |L1.994|
0003e2  68c1              LDR      r1,[r0,#0xc]          ;598
0003e4  1d0a              ADDS     r2,r1,#4              ;598
0003e6  60c2              STR      r2,[r0,#0xc]          ;598
0003e8  600d              STR      r5,[r1,#0]            ;598
0003ea  8ac1              LDRH     r1,[r0,#0x16]         ;599
0003ec  1c49              ADDS     r1,r1,#1              ;599
0003ee  82c1              STRH     r1,[r0,#0x16]         ;599
0003f0  6882              LDR      r2,[r0,#8]            ;600
0003f2  68c1              LDR      r1,[r0,#0xc]          ;600
0003f4  4291              CMP      r1,r2                 ;600
0003f6  d101              BNE      |L1.1020|
0003f8  6841              LDR      r1,[r0,#4]            ;601
0003fa  60c1              STR      r1,[r0,#0xc]          ;601
                  |L1.1020|
0003fc  4630              MOV      r0,r6                 ;603
0003fe  f7fffffe          BL       OS_CPU_SR_Restore
000402  2000              MOVS     r0,#0                 ;604
000404  bd70              POP      {r4-r6,pc}
;;;606    #endif
                          ENDP

                  OSQPostFront PROC
;;;630    INT8U  OSQPostFront (OS_EVENT *pevent, void *pmsg)
;;;631    {
000406  b570              PUSH     {r4-r6,lr}
000408  4604              MOV      r4,r0
00040a  460d              MOV      r5,r1
;;;632        OS_Q      *pq;
;;;633    #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
;;;634        OS_CPU_SR  cpu_sr = 0;
;;;635    #endif
;;;636    
;;;637    
;;;638    
;;;639    #if OS_ARG_CHK_EN > 0
;;;640        if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
00040c  b90c              CBNZ     r4,|L1.1042|
;;;641            return (OS_ERR_PEVENT_NULL);
00040e  2004              MOVS     r0,#4
;;;642        }
;;;643    #endif
;;;644        if (pevent->OSEventType != OS_EVENT_TYPE_Q) {     /* Validate event block type                     */
;;;645            return (OS_ERR_EVENT_TYPE);
;;;646        }
;;;647        OS_ENTER_CRITICAL();
;;;648        if (pevent->OSEventGrp != 0) {                    /* See if any task pending on queue              */
;;;649                                                          /* Ready highest priority task waiting on event  */
;;;650            (void)OS_EventTaskRdy(pevent, pmsg, OS_STAT_Q, OS_STAT_PEND_OK);
;;;651            OS_EXIT_CRITICAL();
;;;652            OS_Sched();                                   /* Find highest priority task ready to run       */
;;;653            return (OS_ERR_NONE);
;;;654        }
;;;655        pq = (OS_Q *)pevent->OSEventPtr;                  /* Point to queue control block                  */
;;;656        if (pq->OSQEntries >= pq->OSQSize) {              /* Make sure queue is not full                   */
;;;657            OS_EXIT_CRITICAL();
;;;658            return (OS_ERR_Q_FULL);
;;;659        }
;;;660        if (pq->OSQOut == pq->OSQStart) {                 /* Wrap OUT ptr if we are at the 1st queue entry */
;;;661            pq->OSQOut = pq->OSQEnd;
;;;662        }
;;;663        pq->OSQOut--;
;;;664        *pq->OSQOut = pmsg;                               /* Insert message into queue                     */
;;;665        pq->OSQEntries++;                                 /* Update the nbr of entries in the queue        */
;;;666        OS_EXIT_CRITICAL();
;;;667        return (OS_ERR_NONE);
;;;668    }
000410  bd70              POP      {r4-r6,pc}
                  |L1.1042|
000412  7820              LDRB     r0,[r4,#0]            ;644
000414  2802              CMP      r0,#2                 ;644
000416  d001              BEQ      |L1.1052|
000418  2001              MOVS     r0,#1                 ;645
00041a  bd70              POP      {r4-r6,pc}
                  |L1.1052|
00041c  f7fffffe          BL       OS_CPU_SR_Save
000420  4606              MOV      r6,r0                 ;647
000422  7aa0              LDRB     r0,[r4,#0xa]          ;648
000424  b160              CBZ      r0,|L1.1088|
000426  2300              MOVS     r3,#0                 ;650
000428  2204              MOVS     r2,#4                 ;650
00042a  4629              MOV      r1,r5                 ;650
00042c  4620              MOV      r0,r4                 ;650
00042e  f7fffffe          BL       OS_EventTaskRdy
000432  4630              MOV      r0,r6                 ;651
000434  f7fffffe          BL       OS_CPU_SR_Restore
000438  f7fffffe          BL       OS_Sched
00043c  2000              MOVS     r0,#0                 ;653
00043e  bd70              POP      {r4-r6,pc}
                  |L1.1088|
000440  6860              LDR      r0,[r4,#4]            ;655
000442  8ac1              LDRH     r1,[r0,#0x16]         ;656
000444  8a82              LDRH     r2,[r0,#0x14]         ;656
000446  4291              CMP      r1,r2                 ;656
000448  d30e              BCC      |L1.1128|
00044a  4630              MOV      r0,r6                 ;657
00044c  f7fffffe          BL       OS_CPU_SR_Restore
000450  201e              MOVS     r0,#0x1e              ;658
                  |L1.1106|
000452  bd70              POP      {r4-r6,pc}
                  |L1.1108|
000454  00000000          DCD      OSIntNesting
                  |L1.1112|
000458  00000000          DCD      OSEventFreeList
                  |L1.1116|
00045c  00000000          DCD      OSQFreeList
                  |L1.1120|
000460  00000000          DCD      OSLockNesting
                  |L1.1124|
000464  00000000          DCD      OSTCBCur
                  |L1.1128|
000468  6842              LDR      r2,[r0,#4]            ;660
00046a  6901              LDR      r1,[r0,#0x10]         ;660
00046c  4291              CMP      r1,r2                 ;660
00046e  d101              BNE      |L1.1140|
000470  6881              LDR      r1,[r0,#8]            ;661
000472  6101              STR      r1,[r0,#0x10]         ;661
                  |L1.1140|
000474  6901              LDR      r1,[r0,#0x10]         ;663
000476  1f09              SUBS     r1,r1,#4              ;663
000478  6101              STR      r1,[r0,#0x10]         ;663
00047a  600d              STR      r5,[r1,#0]            ;664
00047c  8ac1              LDRH     r1,[r0,#0x16]         ;665
00047e  1c49              ADDS     r1,r1,#1              ;665
000480  82c1              STRH     r1,[r0,#0x16]         ;665
000482  4630              MOV      r0,r6                 ;666
000484  f7fffffe          BL       OS_CPU_SR_Restore
000488  2000              MOVS     r0,#0                 ;667
00048a  e7e2              B        |L1.1106|
;;;669    #endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?