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

📄 os_sem.txt

📁 uc/os在lpc2100系列的KEIL模板 uc/os在lpc2100系列的real view模板 uc/os在lpc210X系列的real view模板
💻 TXT
📖 第 1 页 / 共 2 页
字号:
; generated by ARM/Thumb C/C++ Compiler with , RVCT3.1 [Build 934] for uVision
; commandline ArmCC [--debug -c --asm --interleave -o.\rvmdk\os_sem.o --depend=.\rvmdk\os_sem.d --device=DARMP --apcs=interwork -O1 -I. -I..\BSP -I..\..\..\..\uCOS-II\Ports\ARM\Generic\RealView -I..\..\..\..\uCOS-II\Source -I..\..\..\..\uC-CPU -I..\..\..\..\uC-CPU\ARM\RealView -I..\..\..\..\uC-LIB -I..\..\..\..\uC-TCPIP\IF -I..\..\..\..\uC-TCPIP\IF\Ether -I..\..\..\..\uC-TCPIP\NIC\ETHER\LPC2378 -I..\..\..\..\uC-TCPIP\NIC\ETHER\PHY -I..\..\..\..\uC-TCPIP\NIC\ETHER\PHY\DP83848 -I..\..\..\..\uC-TCPIP\OS\uCOS-II -I..\..\..\..\uC-TCPIP\Source -I..\..\..\..\uC-LCD\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\RS-232\Source -I..\..\..\..\uC-Probe\Target\Communication\Generic\TCPIP\Source -I..\..\..\..\uC-Probe\Target\Plugins\uCOS-II -Ie:\Keil_ARM\ARM\INC\Philips -D__IN_CHIP --omf_browse=.\rvmdk\os_sem.crf ..\Source\OS_SEM.C]
                          ARM

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

                  OSSemAccept PROC
;;;39     INT16U  OSSemAccept (OS_EVENT *pevent)
;;;40     {
000000  e92d4070          PUSH     {r4-r6,lr}
000004  e1a04000          MOV      r4,r0
;;;41     #if OS_CRITICAL_METHOD == 3                           /* Allocate storage for CPU status register      */
;;;42         OS_CPU_SR  cpu_sr;
;;;43     #endif    
;;;44         INT16U     cnt;
;;;45     
;;;46     
;;;47     #if OS_ARG_CHK_EN > 0
;;;48         if (pevent == (OS_EVENT *)0) {                    /* Validate 'pevent'                             */
000008  e3540000          CMP      r4,#0
00000c  1a000002          BNE      |L1.28|
;;;49             return (0);
000010  e3a00000          MOV      r0,#0
                  |L1.20|
000014  e8bd4070          POP      {r4-r6,lr}
;;;50         }
;;;51         if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {   /* Validate event block type                     */
;;;52             return (0);
;;;53         }
;;;54     #endif
;;;55         OS_ENTER_CRITICAL();
;;;56         cnt = pevent->OSEventCnt;
;;;57         if (cnt > 0) {                                    /* See if resource is available                  */
;;;58             pevent->OSEventCnt--;                         /* Yes, decrement semaphore and notify caller    */
;;;59         }
;;;60         OS_EXIT_CRITICAL();
;;;61         return (cnt);                                     /* Return semaphore count                        */
;;;62     }
000018  e12fff1e          BX       lr
                  |L1.28|
00001c  e5d40000          LDRB     r0,[r4,#0]            ;51
000020  e3500003          CMP      r0,#3                 ;51
000024  0a000001          BEQ      |L1.48|
000028  e3a00000          MOV      r0,#0                 ;52
00002c  eafffff8          B        |L1.20|
                  |L1.48|
000030  ef000002          SVC      #0x2                  ;55
000034  e1d450b2          LDRH     r5,[r4,#2]            ;56
000038  e3550000          CMP      r5,#0                 ;57
00003c  0a000001          BEQ      |L1.72|
000040  e2450001          SUB      r0,r5,#1              ;58
000044  e1c400b2          STRH     r0,[r4,#2]            ;58
                  |L1.72|
000048  ef000003          SVC      #0x3                  ;60
00004c  e1a00005          MOV      r0,r5                 ;61
000050  eaffffef          B        |L1.20|
;;;63     #endif    
                          ENDP

                  OSSemCreate PROC
;;;83     OS_EVENT  *OSSemCreate (INT16U cnt)
;;;84     {
000054  e92d4070          PUSH     {r4-r6,lr}
000058  e1a05000          MOV      r5,r0
;;;85     #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;86         OS_CPU_SR  cpu_sr;
;;;87     #endif    
;;;88         OS_EVENT  *pevent;
;;;89     
;;;90     
;;;91         if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
00005c  e59f037c          LDR      r0,|L1.992|
000060  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
000064  e3500000          CMP      r0,#0
000068  0a000002          BEQ      |L1.120|
;;;92             return ((OS_EVENT *)0);                            /* ... can't CREATE from an ISR             */
00006c  e3a00000          MOV      r0,#0
                  |L1.112|
000070  e8bd4070          POP      {r4-r6,lr}
;;;93         }
;;;94         OS_ENTER_CRITICAL();
;;;95         pevent = OSEventFreeList;                              /* Get next free event control block        */
;;;96         if (OSEventFreeList != (OS_EVENT *)0) {                /* See if pool of free ECB pool was empty   */
;;;97             OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
;;;98         }
;;;99         OS_EXIT_CRITICAL();
;;;100        if (pevent != (OS_EVENT *)0) {                         /* Get an event control block               */
;;;101            pevent->OSEventType = OS_EVENT_TYPE_SEM;
;;;102            pevent->OSEventCnt  = cnt;                         /* Set semaphore value                      */
;;;103            pevent->OSEventPtr  = (void *)0;                   /* Unlink from ECB free list                */
;;;104            OS_EventWaitListInit(pevent);                      /* Initialize to 'nobody waiting' on sem.   */
;;;105        }
;;;106        return (pevent);
;;;107    }
000074  e12fff1e          BX       lr
                  |L1.120|
000078  ef000002          SVC      #0x2                  ;94
00007c  e59f0360          LDR      r0,|L1.996|
000080  e5904000          LDR      r4,[r0,#0]            ;95  ; OSEventFreeList
000084  e3540000          CMP      r4,#0                 ;96
000088  0a000001          BEQ      |L1.148|
00008c  e5941004          LDR      r1,[r4,#4]            ;97
000090  e5801000          STR      r1,[r0,#0]            ;97  ; OSEventFreeList
                  |L1.148|
000094  ef000003          SVC      #0x3                  ;99
000098  e3540000          CMP      r4,#0                 ;100
00009c  0a000006          BEQ      |L1.188|
0000a0  e3a00003          MOV      r0,#3                 ;101
0000a4  e5c40000          STRB     r0,[r4,#0]            ;101
0000a8  e1c450b2          STRH     r5,[r4,#2]            ;102
0000ac  e3a00000          MOV      r0,#0                 ;103
0000b0  e5840004          STR      r0,[r4,#4]            ;103
0000b4  e1a00004          MOV      r0,r4                 ;104
0000b8  ebfffffe          BL       OS_EventWaitListInit
                  |L1.188|
0000bc  e1a00004          MOV      r0,r4                 ;106
0000c0  eaffffea          B        |L1.112|
;;;108    
                          ENDP

                  OSSemDel PROC
;;;148    OS_EVENT  *OSSemDel (OS_EVENT *pevent, INT8U opt, INT8U *err)
;;;149    {
0000c4  e92d47f0          PUSH     {r4-r10,lr}
0000c8  e1a04000          MOV      r4,r0
0000cc  e1a07001          MOV      r7,r1
0000d0  e1a05002          MOV      r5,r2
;;;150    #if OS_CRITICAL_METHOD == 3                                /* Allocate storage for CPU status register */
;;;151        OS_CPU_SR  cpu_sr;
;;;152    #endif    
;;;153        BOOLEAN    tasks_waiting;
;;;154    
;;;155    
;;;156        if (OSIntNesting > 0) {                                /* See if called from ISR ...               */
0000d4  e59f0304          LDR      r0,|L1.992|
0000d8  e5d00000          LDRB     r0,[r0,#0]  ; OSIntNesting
0000dc  e3500000          CMP      r0,#0
0000e0  0a000004          BEQ      |L1.248|
;;;157            *err = OS_ERR_DEL_ISR;                             /* ... can't DELETE from an ISR             */
0000e4  e3a0008c          MOV      r0,#0x8c
0000e8  e5c50000          STRB     r0,[r5,#0]
;;;158            return (pevent);
0000ec  e1a00004          MOV      r0,r4
                  |L1.240|
0000f0  e8bd47f0          POP      {r4-r10,lr}
;;;159        }
;;;160    #if OS_ARG_CHK_EN > 0
;;;161        if (pevent == (OS_EVENT *)0) {                         /* Validate 'pevent'                        */
;;;162            *err = OS_ERR_PEVENT_NULL;
;;;163            return (pevent);
;;;164        }
;;;165        if (pevent->OSEventType != OS_EVENT_TYPE_SEM) {        /* Validate event block type                */
;;;166            *err = OS_ERR_EVENT_TYPE;
;;;167            return (pevent);
;;;168        }
;;;169    #endif
;;;170        OS_ENTER_CRITICAL();
;;;171        if (pevent->OSEventGrp != 0x00) {                      /* See if any tasks waiting on semaphore    */
;;;172            tasks_waiting = TRUE;                              /* Yes                                      */
;;;173        } else {
;;;174            tasks_waiting = FALSE;                             /* No                                       */
;;;175        }
;;;176        switch (opt) {
;;;177            case OS_DEL_NO_PEND:                               /* Delete semaphore only if no task waiting */
;;;178                 if (tasks_waiting == FALSE) {
;;;179                     pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
;;;180                     pevent->OSEventPtr  = OSEventFreeList;    /* Return Event Control Block to free list  */
;;;181                     OSEventFreeList     = pevent;             /* Get next free event control block        */
;;;182                     OS_EXIT_CRITICAL();
;;;183                     *err = OS_NO_ERR;
;;;184                     return ((OS_EVENT *)0);                   /* Semaphore has been deleted               */
;;;185                 } else {
;;;186                     OS_EXIT_CRITICAL();
;;;187                     *err = OS_ERR_TASK_WAITING;
;;;188                     return (pevent);
;;;189                 }
;;;190    
;;;191            case OS_DEL_ALWAYS:                                /* Always delete the semaphore              */
;;;192                 while (pevent->OSEventGrp != 0x00) {          /* Ready ALL tasks waiting for semaphore    */
;;;193                     OS_EventTaskRdy(pevent, (void *)0, OS_STAT_SEM);
;;;194                 }
;;;195                 pevent->OSEventType = OS_EVENT_TYPE_UNUSED;
;;;196                 pevent->OSEventPtr  = OSEventFreeList;        /* Return Event Control Block to free list  */
;;;197                 OSEventFreeList     = pevent;                 /* Get next free event control block        */
;;;198                 OS_EXIT_CRITICAL();
;;;199                 if (tasks_waiting == TRUE) {                  /* Reschedule only if task(s) were waiting  */
;;;200                     OS_Sched();                               /* Find highest priority task ready to run  */
;;;201                 }
;;;202                 *err = OS_NO_ERR;
;;;203                 return ((OS_EVENT *)0);                       /* Semaphore has been deleted               */
;;;204    
;;;205            default:
;;;206                 OS_EXIT_CRITICAL();
;;;207                 *err = OS_ERR_INVALID_OPT;
;;;208                 return (pevent);
;;;209        }
;;;210    }
0000f4  e12fff1e          BX       lr
                  |L1.248|
0000f8  e3540000          CMP      r4,#0                 ;161
0000fc  1a000003          BNE      |L1.272|
000100  e3a00004          MOV      r0,#4                 ;162
000104  e5c50000          STRB     r0,[r5,#0]            ;162
000108  e1a00004          MOV      r0,r4                 ;163
00010c  eafffff7          B        |L1.240|
                  |L1.272|
000110  e5d40000          LDRB     r0,[r4,#0]            ;165
000114  e3500003          CMP      r0,#3                 ;165
000118  0a000003          BEQ      |L1.300|
00011c  e3a00001          MOV      r0,#1                 ;166
000120  e5c50000          STRB     r0,[r5,#0]            ;166
000124  e1a00004          MOV      r0,r4                 ;167
000128  eafffff0          B        |L1.240|
                  |L1.300|
00012c  ef000002          SVC      #0x2                  ;170
000130  e5d40001          LDRB     r0,[r4,#1]            ;171
000134  e3500000          CMP      r0,#0                 ;171
000138  0a000001          BEQ      |L1.324|
00013c  e3a06001          MOV      r6,#1                 ;172
000140  ea000000          B        |L1.328|
                  |L1.324|
000144  e3a06000          MOV      r6,#0                 ;174
                  |L1.328|
000148  e59f8294          LDR      r8,|L1.996|
00014c  e3570000          CMP      r7,#0                 ;176
000150  e3a09000          MOV      r9,#0                 ;174
000154  0a000002          BEQ      |L1.356|
000158  e3570001          CMP      r7,#1                 ;176
00015c  1a000021          BNE      |L1.488|
000160  ea000012          B        |L1.432|
                  |L1.356|
000164  e3560000          CMP      r6,#0                 ;178
000168  1a000007          BNE      |L1.396|
00016c  e5c49000          STRB     r9,[r4,#0]            ;179
000170  e5980000          LDR      r0,[r8,#0]            ;180  ; OSEventFreeList
000174  e5840004          STR      r0,[r4,#4]            ;180
000178  e5884000          STR      r4,[r8,#0]            ;181  ; OSEventFreeList
00017c  ef000003          SVC      #0x3                  ;182
000180  e5c59000          STRB     r9,[r5,#0]            ;183
000184  e3a00000          MOV      r0,#0                 ;184
000188  eaffffd8          B        |L1.240|
                  |L1.396|
00018c  ef000003          SVC      #0x3                  ;186
000190  e3a00008          MOV      r0,#8                 ;187
000194  e5c50000          STRB     r0,[r5,#0]            ;187
000198  e1a00004          MOV      r0,r4                 ;188
00019c  eaffffd3          B        |L1.240|
                  |L1.416|
0001a0  e3a02001          MOV      r2,#1                 ;193
0001a4  e3a01000          MOV      r1,#0                 ;193
0001a8  e1a00004          MOV      r0,r4                 ;193
0001ac  ebfffffe          BL       OS_EventTaskRdy
                  |L1.432|
0001b0  e5d40001          LDRB     r0,[r4,#1]            ;192
0001b4  e3500000          CMP      r0,#0                 ;192
0001b8  1afffff8          BNE      |L1.416|
0001bc  e5c49000          STRB     r9,[r4,#0]            ;195
0001c0  e5980000          LDR      r0,[r8,#0]            ;196  ; OSEventFreeList
0001c4  e5840004          STR      r0,[r4,#4]            ;196
0001c8  e5884000          STR      r4,[r8,#0]            ;197  ; OSEventFreeList
0001cc  ef000003          SVC      #0x3                  ;198
0001d0  e3560001          CMP      r6,#1                 ;199
0001d4  1a000000          BNE      |L1.476|
0001d8  ebfffffe          BL       OS_Sched
                  |L1.476|
0001dc  e5c59000          STRB     r9,[r5,#0]            ;202
0001e0  e3a00000          MOV      r0,#0                 ;203
0001e4  eaffffc1          B        |L1.240|
                  |L1.488|
0001e8  ef000003          SVC      #0x3                  ;206
0001ec  e3a00007          MOV      r0,#7                 ;207
0001f0  e5c50000          STRB     r0,[r5,#0]            ;207
0001f4  e1a00004          MOV      r0,r4                 ;208
0001f8  eaffffbc          B        |L1.240|
;;;211    #endif
                          ENDP

                  OSSemPend PROC
;;;244    void  OSSemPend (OS_EVENT *pevent, INT16U timeout, INT8U *err)
;;;245    {
0001fc  e92d41f0          PUSH     {r4-r8,lr}
000200  e1a05000          MOV      r5,r0

⌨️ 快捷键说明

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