⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_sem.txt

📁 ucos2.86版本结合STM板极支持包
💻 TXT
📖 第 1 页 / 共 3 页
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 914] for uVision
; commandline ArmCC [--debug -c --asm --interleave -o.\rvmdk\os_sem.o --depend=.\rvmdk\os_sem.d --device=DARMSTM -O1 -Otime -I. -I..\BSP -I..\..\..\..\..\uCOS-II\Ports\arm-cortex-m3\Generic\RealView -I..\..\..\..\..\uCOS-II\Source -I..\..\..\..\..\CPU\ST\STM32\inc -I..\..\..\..\..\uC-CPU -I..\..\..\..\..\uC-CPU\Arm-Cortex-M3\RealView -I..\..\..\..\..\uC-LIB -I..\..\..\..\..\uC-Probe\Target\Plugins\uCOS-II -I..\..\..\..\..\uC-Probe\Target\Communication\Generic\Source -I..\..\..\..\..\uC-Probe\Target\Communication\Generic\RS-232\Ports\ST\STM32 -I..\..\..\..\..\uC-Probe\Target\Communication\Generic\RS-232\Source -ID:\Keil\ARM\INC\ST\STM32F10x ..\..\..\..\..\uCOS-II\Source\os_sem.c]
                          THUMB

                          AREA ||.text||, CODE, READONLY, ALIGN=2

                  OSSemAccept PROC
;;;49     INT16U  OSSemAccept (OS_EVENT *pevent)
;;;50     {
000000  b570              PUSH     {r4-r6,lr}
000002  4604              MOV      r4,r0
;;;51         INT16U     cnt;
;;;52     #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
;;;53         OS_CPU_SR  cpu_sr = 0;
;;;54     #endif
;;;55     
;;;56     
;;;57     
;;;58     #if OS_ARG_CHK_EN > 0
;;;59         if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
000004  b90c              CBNZ     r4,|L1.10|
;;;60             return (0);
000006  2000              MOVS     r0,#0
;;;61         }
;;;62     #endif
;;;63         if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
;;;64             return (0);
;;;65         }
;;;66         OS_ENTER_CRITICAL();
;;;67         cnt = pevent->OSEventCnt;
;;;68         if (cnt > 0) {                                    /* See if resource is available                  */
;;;69             pevent->OSEventCnt--;                         /* Yes, decrement semaphore and notify caller    */
;;;70         }
;;;71         OS_EXIT_CRITICAL();
;;;72         return (cnt);                                     /* Return semaphore count                        */
;;;73     }
000008  bd70              POP      {r4-r6,pc}
                  |L1.10|
00000a  7820              LDRB     r0,[r4,#0]
00000c  2803              CMP      r0,#3
00000e  d001              BEQ      |L1.20|
000010  2000              MOVS     r0,#0
000012  bd70              POP      {r4-r6,pc}
                  |L1.20|
000014  f7fff7ff          BL       OS_CPU_SR_Save
000018  8925              LDRH     r5,[r4,#8]
00001a  b10d              CBZ      r5,|L1.32|
00001c  1e69              SUBS     r1,r5,#1
00001e  8121              STRH     r1,[r4,#8]
                  |L1.32|
000020  f7fff7ff          BL       OS_CPU_SR_Restore
000024  4628              MOV      r0,r5
000026  bd70              POP      {r4-r6,pc}
;;;74     #endif
                          ENDP

                  OSSemCreate PROC
;;;94     OS_EVENT  *OSSemCreate (INT16U cnt)
;;;95     {
000028  b570              PUSH     {r4-r6,lr}
00002a  4605              MOV      r5,r0
;;;96         OS_EVENT  *pevent;
;;;97     #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;98         OS_CPU_SR  cpu_sr = 0;
;;;99     #endif
;;;100    
;;;101    
;;;102    
;;;103        if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
00002c  48d6              LDR      r0,|L1.904|
00002e  7800              LDRB     r0,[r0,#0]  ; OSIntNesting
000030  b108              CBZ      r0,|L1.54|
;;;104            return ((OS_EVENT *)0);                            /* ... can't CREATE from an ISR             */
000032  2000              MOVS     r0,#0
;;;105        }
;;;106        OS_ENTER_CRITICAL();
;;;107        pevent = OSEventFreeList;                              /* Get next free event control block        */
;;;108        if (OSEventFreeList != (OS_EVENT *)0) {                /* See if pool of free ECB pool was empty   */
;;;109            OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
;;;110        }
;;;111        OS_EXIT_CRITICAL();
;;;112        if (pevent != (OS_EVENT *)0) {                         /* Get an event control block               */
;;;113            pevent->OSEventType    = OS_EVENT_TYPE_SEM;
;;;114            pevent->OSEventCnt     = cnt;                      /* Set semaphore value                      */
;;;115            pevent->OSEventPtr     = (void *)0;                /* Unlink from ECB free list                */
;;;116    #if OS_EVENT_NAME_SIZE > 1
;;;117            pevent->OSEventName[0] = '?';                      /* Unknown name                             */
;;;118            pevent->OSEventName[1] = OS_ASCII_NUL;
;;;119    #endif
;;;120            OS_EventWaitListInit(pevent);                      /* Initialize to 'nobody waiting' on sem.   */
;;;121        }
;;;122        return (pevent);
;;;123    }
000034  bd70              POP      {r4-r6,pc}
                  |L1.54|
000036  f7fff7ff          BL       OS_CPU_SR_Save
00003a  49d4              LDR      r1,|L1.908|
00003c  680c              LDR      r4,[r1,#0]  ; OSEventFreeList
00003e  b10c              CBZ      r4,|L1.68|
000040  6862              LDR      r2,[r4,#4]
000042  600a              STR      r2,[r1,#0]  ; OSEventFreeList
                  |L1.68|
000044  f7fff7ff          BL       OS_CPU_SR_Restore
000048  b154              CBZ      r4,|L1.96|
00004a  2003              MOVS     r0,#3
00004c  7020              STRB     r0,[r4,#0]
00004e  8125              STRH     r5,[r4,#8]
000050  2000              MOVS     r0,#0
000052  6060              STR      r0,[r4,#4]
000054  213f              MOVS     r1,#0x3f
000056  73e1              STRB     r1,[r4,#0xf]
000058  7420              STRB     r0,[r4,#0x10]
00005a  4620              MOV      r0,r4
00005c  f7fff7ff          BL       OS_EventWaitListInit
                  |L1.96|
000060  4620              MOV      r0,r4
000062  bd70              POP      {r4-r6,pc}
;;;124    
                          ENDP

                  OSSemDel PROC
;;;164    OS_EVENT  *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U *perr)
;;;165    {
000064  e92de92d          PUSH     {r4-r12,lr}
000068  4604              MOV      r4,r0
00006a  468b              MOV      r11,r1
00006c  4615              MOV      r5,r2
;;;166        BOOLEAN    tasks_waiting;
;;;167        OS_EVENT  *pevent_return;
;;;168    #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;169        OS_CPU_SR  cpu_sr = 0;
;;;170    #endif
;;;171    
;;;172    
;;;173    
;;;174    #if OS_ARG_CHK_EN > 0
;;;175        if (perr == (INT8U *)0) {                              /* Validate 'perr'                          */
00006e  b915              CBNZ     r5,|L1.118|
;;;176            return (pevent);
000070  4620              MOV      r0,r4
000072  e8bde8bd          POP      {r4-r12,pc}
                  |L1.118|
;;;177        }
;;;178        if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
000076  b924              CBNZ     r4,|L1.130|
;;;179            *perr = OS_ERR_PEVENT_NULL;
000078  2004              MOVS     r0,#4
00007a  7028              STRB     r0,[r5,#0]
;;;180            return (pevent);
00007c  4620              MOV      r0,r4
00007e  e8bde8bd          POP      {r4-r12,pc}
                  |L1.130|
;;;181        }
;;;182    #endif
;;;183        if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
000082  7820              LDRB     r0,[r4,#0]
000084  2803              CMP      r0,#3
000086  d004              BEQ      |L1.146|
;;;184            *perr = OS_ERR_EVENT_TYPE;
000088  2001              MOVS     r0,#1
00008a  7028              STRB     r0,[r5,#0]
;;;185            return (pevent);
00008c  4620              MOV      r0,r4
00008e  e8bde8bd          POP      {r4-r12,pc}
                  |L1.146|
;;;186        }
;;;187        if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
000092  48bd              LDR      r0,|L1.904|
000094  7800              LDRB     r0,[r0,#0]  ; OSIntNesting
000096  b120              CBZ      r0,|L1.162|
;;;188            *perr = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
000098  200f              MOVS     r0,#0xf
00009a  7028              STRB     r0,[r5,#0]
;;;189            return (pevent);
00009c  4620              MOV      r0,r4
00009e  e8bde8bd          POP      {r4-r12,pc}
                  |L1.162|
;;;190        }
;;;191        OS_ENTER_CRITICAL();
0000a2  f7fff7ff          BL       OS_CPU_SR_Save
0000a6  4682              MOV      r10,r0
;;;192        if (pevent->OSEventGrp != 0) {                         /* See if any tasks waiting on semaphore    */
0000a8  7aa0              LDRB     r0,[r4,#0xa]
0000aa  b108              CBZ      r0,|L1.176|
;;;193            tasks_waiting = OS_TRUE;                           /* Yes                                      */
0000ac  2601              MOVS     r6,#1
0000ae  e000              B        |L1.178|
                  |L1.176|
;;;194        } else {
;;;195            tasks_waiting = OS_FALSE;                          /* No                                       */
0000b0  2600              MOVS     r6,#0
                  |L1.178|
;;;196        }
;;;197        switch (opt) {
0000b2  273f              MOVS     r7,#0x3f
0000b4  f8dff8df          LDR      r8,|L1.908|
0000b8  f04ff04f          MOV      r9,#0
0000bc  f1bbf1bb          CMP      r11,#0
0000c0  d004              BEQ      |L1.204|
0000c2  f1bbf1bb          CMP      r11,#1
0000c6  d13f              BNE      |L1.328|
0000c8  b330              CBZ      r0,|L1.280|
;;;198            case OS_DEL_NO_PEND:                               /* Delete semaphore only if no task waiting */
;;;199                 if (tasks_waiting == OS_FALSE) {
;;;200    #if OS_EVENT_NAME_SIZE > 1
;;;201                     pevent->OSEventName[0] = '?';             /* Unknown name                             */
;;;202                     pevent->OSEventName[1] = OS_ASCII_NUL;
;;;203    #endif
;;;204                     pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
;;;205                     pevent->OSEventPtr     = OSEventFreeList; /* Return Event Control Block to free list  */
;;;206                     pevent->OSEventCnt     = 0;
;;;207                     OSEventFreeList        = pevent;          /* Get next free event control block        */
;;;208                     OS_EXIT_CRITICAL();
;;;209                     *perr                  = OS_ERR_NONE;
;;;210                     pevent_return          = (OS_EVENT *)0;   /* Semaphore has been deleted               */
;;;211                 } else {
;;;212                     OS_EXIT_CRITICAL();
;;;213                     *perr                  = OS_ERR_TASK_WAITING;
;;;214                     pevent_return          = pevent;
;;;215                 }
;;;216                 break;
;;;217    
;;;218            case OS_DEL_ALWAYS:                                /* Always delete the semaphore              */
;;;219                 while (pevent->OSEventGrp != 0) {             /* Ready ALL tasks waiting for semaphore    */
0000ca  e01c              B        |L1.262|
                  |L1.204|
0000cc  b99e              CBNZ     r6,|L1.246|
0000ce  73e7              STRB     r7,[r4,#0xf]
0000d0  f884f884          STRB     r9,[r4,#0x10]
0000d4  f884f884          STRB     r9,[r4,#0]
0000d8  f8d8f8d8          LDR      r0,[r8,#0]  ; OSEventFreeList
0000dc  6060              STR      r0,[r4,#4]
0000de  f8a4f8a4          STRH     r9,[r4,#8]
0000e2  f8c8f8c8          STR      r4,[r8,#0]  ; OSEventFreeList
0000e6  4650              MOV      r0,r10
0000e8  f7fff7ff          BL       OS_CPU_SR_Restore
0000ec  f885f885          STRB     r9,[r5,#0]
0000f0  2000              MOVS     r0,#0
0000f2  e8bde8bd          POP      {r4-r12,pc}
                  |L1.246|
0000f6  4650              MOV      r0,r10
0000f8  f7fff7ff          BL       OS_CPU_SR_Restore
0000fc  2049              MOVS     r0,#0x49
0000fe  7028              STRB     r0,[r5,#0]
000100  4620              MOV      r0,r4
000102  e8bde8bd          POP      {r4-r12,pc}
                  |L1.262|
000106  2300              MOVS     r3,#0
000108  2201              MOVS     r2,#1
00010a  4619              MOV      r1,r3
00010c  4620              MOV      r0,r4
00010e  f7fff7ff          BL       OS_EventTaskRdy
000112  7aa0              LDRB     r0,[r4,#0xa]
000114  2800              CMP      r0,#0
000116  d1f6              BNE      |L1.262|
                  |L1.280|
;;;220                     (void)OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM, OS_STAT_PEND_OK);
;;;221                 }
;;;222    #if OS_EVENT_NAME_SIZE > 1
;;;223                 pevent->OSEventName[0] = '?';                 /* Unknown name                             */
000118  73e7              STRB     r7,[r4,#0xf]
;;;224                 pevent->OSEventName[1] = OS_ASCII_NUL;
00011a  f884f884          STRB     r9,[r4,#0x10]
;;;225    #endif
;;;226                 pevent->OSEventType    = OS_EVENT_TYPE_UNUSED;
00011e  f884f884          STRB     r9,[r4,#0]
;;;227                 pevent->OSEventPtr     = OSEventFreeList;     /* Return Event Control Block to free list  */
000122  f8d8f8d8          LDR      r0,[r8,#0]  ; OSEventFreeList
000126  6060              STR      r0,[r4,#4]
;;;228                 pevent->OSEventCnt     = 0;
000128  f8a4f8a4          STRH     r9,[r4,#8]

⌨️ 快捷键说明

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