os_sem.lst
来自「在51上运行的小的OS系统」· LST 代码 · 共 578 行 · 第 1/3 页
LST
578 行
C51 COMPILER V8.08 OS_SEM 08/04/2008 21:49:52 PAGE 1
C51 COMPILER V8.08, COMPILATION OF MODULE OS_SEM
OBJECT MODULE PLACED IN OS_SEM.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE uCosii\OS_SEM.C DEBUG OBJECTEXTEND PRINT(.\OS_SEM.lst) OBJECT(OS_SEM.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * SEMAPHORE MANAGEMENT
6 *
7 * (c) Copyright 1992-2005, Jean J. Labrosse, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_SEM.C
11 * By : Jean J. Labrosse
12 * Version : V2.80
13 *********************************************************************************************************
14 */
15
16 #ifndef OS_MASTER_FILE
17 #include "..\arm\includes.h"
*** ERROR C141 IN LINE 83 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x00'
*** ERROR C132 IN LINE 83 OF UCOSII\..\ARM\OS_CPU.H: 'OS_TASK_SW': not in formal parameter list
*** ERROR C141 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x01'
*** ERROR C132 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 84 OF UCOSII\..\ARM\OS_CPU.H: '_OSStartHighRdy': not in formal parameter list
*** ERROR C141 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x02'
*** ERROR C132 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 85 OF UCOSII\..\ARM\OS_CPU.H: 'OS_ENTER_CRITICAL': not in formal parameter list
*** ERROR C141 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x03'
*** ERROR C132 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 86 OF UCOSII\..\ARM\OS_CPU.H: 'OS_EXIT_CRITICAL': not in formal parameter list
*** ERROR C141 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x40'
*** ERROR C132 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 88 OF UCOSII\..\ARM\OS_CPU.H: '_GetOSFunctionAddr': not in formal parameter list
*** ERROR C141 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x41'
*** ERROR C132 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 89 OF UCOSII\..\ARM\OS_CPU.H: '_GetUsrFunctionAddr': not in formal parameter list
*** ERROR C141 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x42'
*** ERROR C132 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 90 OF UCOSII\..\ARM\OS_CPU.H: 'OSISRBegin': not in formal parameter list
*** ERROR C141 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x43'
*** ERROR C132 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'int'
*** ERROR C132 IN LINE 91 OF UCOSII\..\ARM\OS_CPU.H: 'OSISRNeedSwap': not in formal parameter list
*** ERROR C141 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x80'
*** ERROR C132 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 93 OF UCOSII\..\ARM\OS_CPU.H: 'ChangeToSYSMode': not in formal parameter list
*** ERROR C141 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x81'
*** ERROR C132 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 94 OF UCOSII\..\ARM\OS_CPU.H: 'ChangeToUSRMode': not in formal parameter list
C51 COMPILER V8.08 OS_SEM 08/04/2008 21:49:52 PAGE 2
*** ERROR C141 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x82'
*** ERROR C132 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 95 OF UCOSII\..\ARM\OS_CPU.H: '_TaskIsARM': not in formal parameter list
*** ERROR C141 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: syntax error near '0x83'
*** ERROR C132 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: '__swi': not in formal parameter list
*** ERROR C141 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: syntax error near 'void'
*** ERROR C132 IN LINE 96 OF UCOSII\..\ARM\OS_CPU.H: '_TaskIsTHUMB': not in formal parameter list
*** ERROR C127 IN LINE 113 OF UCOSII\..\ARM\OS_CPU.H: 'OsEnterSum': invalid storage class
*** ERROR C127 IN LINE 284 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_EVENT': invalid storage class
*** ERROR C127 IN LINE 301 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_FLAGS': invalid storage class
*** ERROR C141 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OS_FLAGS'
*** ERROR C127 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: 'OS_FLAGS': invalid storage class
*** ERROR C141 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OSFlagFlags'
*** ERROR C127 IN LINE 312 OF UCOSII\..\UCOSII\UCOS_II.H: 'OSFlagFlags': invalid storage class
*** ERROR C132 IN LINE 314 OF UCOSII\..\UCOSII\UCOS_II.H: 'OSFlagName': not in formal parameter list
*** ERROR C141 IN LINE 316 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near '}'
*** ERROR C141 IN LINE 325 OF UCOSII\..\UCOSII\UCOS_II.H: syntax error near 'OS_FLAGS'
*** ERROR C129 IN LINE 325 OF UCOSII\..\UCOSII\UCOS_II.H: missing ';' before 'OSFlagNodeFlags'
18 #endif
19
20 #if OS_SEM_EN > 0
21 /*
22 *********************************************************************************************************
23 * ACCEPT SEMAPHORE
24 *
25 * Description: This function checks the semaphore to see if a resource is available or, if an event
26 * occurred. Unlike OSSemPend(), OSSemAccept() does not suspend the calling task if the
27 * resource is not available or the event did not occur.
28 *
29 * Arguments : pevent is a pointer to the event control block
30 *
31 * Returns : > 0 if the resource is available or the event did not occur the semaphore is
32 * decremented to obtain the resource.
33 * == 0 if the resource is not available or the event did not occur or,
34 * if 'pevent' is a NULL pointer or,
35 * if you didn't pass a pointer to a semaphore
36 *********************************************************************************************************
37 */
38
39 #if OS_SEM_ACCEPT_EN > 0
40 INT16U OSSemAccept (OS_EVENT *pevent)
41 {
42 INT16U cnt;
43 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
46
47
48
49 #if OS_ARG_CHK_EN > 0
50 if (pevent == (OS_EVENT *)0) { /* Validate 'pevent' */
51 return (0);
52 }
53 #endif
54 if (pevent->OSEventType != OS_EVENT_TYPE_SEM) { /* Validate event block type */
55 return (0);
56 }
57 OS_ENTER_CRITICAL();
58 cnt = pevent->OSEventCnt;
59 if (cnt > 0) { /* See if resource is available */
60 pevent->OSEventCnt--; /* Yes, decrement semaphore and notify caller */
C51 COMPILER V8.08 OS_SEM 08/04/2008 21:49:52 PAGE 3
61 }
62 OS_EXIT_CRITICAL();
63 return (cnt); /* Return semaphore count */
64 }
65 #endif
66
67 /*$PAGE*/
68 /*
69 *********************************************************************************************************
70 * CREATE A SEMAPHORE
71 *
72 * Description: This function creates a semaphore.
73 *
74 * Arguments : cnt is the initial value for the semaphore. If the value is 0, no resource is
75 * available (or no event has occurred). You initialize the semaphore to a
76 * non-zero value to specify how many resources are available (e.g. if you have
77 * 10 resources, you would initialize the semaphore to 10).
78 *
79 * Returns : != (void *)0 is a pointer to the event control clock (OS_EVENT) associated with the
80 * created semaphore
81 * == (void *)0 if no event control blocks were available
82 *********************************************************************************************************
83 */
84
85 OS_EVENT *OSSemCreate (INT16U cnt)
86 {
87 OS_EVENT *pevent;
88 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
91
92
93
94 if (OSIntNesting > 0) { /* See if called from ISR ... */
95 return ((OS_EVENT *)0); /* ... can't CREATE from an ISR */
96 }
97 OS_ENTER_CRITICAL();
98 pevent = OSEventFreeList; /* Get next free event control block */
99 if (OSEventFreeList != (OS_EVENT *)0) { /* See if pool of free ECB pool was empty */
100 OSEventFreeList = (OS_EVENT *)OSEventFreeList->OSEventPtr;
101 }
102 OS_EXIT_CRITICAL();
103 if (pevent != (OS_EVENT *)0) { /* Get an event control block */
104 pevent->OSEventType = OS_EVENT_TYPE_SEM;
105 pevent->OSEventCnt = cnt; /* Set semaphore value */
106 pevent->OSEventPtr = (void *)0; /* Unlink from ECB free list */
107 #if OS_EVENT_NAME_SIZE > 1
108 pevent->OSEventName[0] = '?'; /* Unknown name */
109 pevent->OSEventName[1] = OS_ASCII_NUL;
110 #endif
111 OS_EventWaitListInit(pevent); /* Initialize to 'nobody waiting' on sem. */
112 }
113 return (pevent);
114 }
115
116 /*$PAGE*/
117 /*
118 *********************************************************************************************************
119 * DELETE A SEMAPHORE
120 *
121 * Description: This function deletes a semaphore and readies all tasks pending on the semaphore.
122 *
C51 COMPILER V8.08 OS_SEM 08/04/2008 21:49:52 PAGE 4
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?