📄 os_core.lst
字号:
C51 COMPILER V8.17 OS_CORE 03/26/2009 14:24:24 PAGE 1
C51 COMPILER V8.17, COMPILATION OF MODULE OS_CORE
OBJECT MODULE PLACED IN .\out-files\os_core.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE uCOS II Files\os_core.c LARGE BROWSE INCDIR(.\smaRTC;.\SMBus) DEBUG OBJECTE
-XTEND PRINT(.\list-files\os_core.lst) TABS(2) OBJECT(.\out-files\os_core.obj)
line level source
1 /*
2 *********************************************************************************************************
3 * uC/OS-II
4 * The Real-Time Kernel
5 * CORE FUNCTIONS
6 *
7 * (c) Copyright 1992-2007, Micrium, Weston, FL
8 * All Rights Reserved
9 *
10 * File : OS_CORE.C
11 * By : Jean J. Labrosse
12 * Version : V2.86
13 *
14 * LICENSING TERMS:
15 * ---------------
16 * uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
-
17 * If you plan on using uC/OS-II in a commercial product you need to contact Micri祄 to properly license
18 * its use in your product. We provide ALL the source code for your convenience and to help you experience
19 * uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
20 * licensing fee.
21 *********************************************************************************************************
22 */
23
24 #ifndef OS_MASTER_FILE
25 #define OS_GLOBALS
26 #include "..\header files\includes.h"
27 #endif
28
29 /*
30 *********************************************************************************************************
31 * PRIORITY RESOLUTION TABLE
32 *
33 * Note: Index into table is bit pattern to resolve highest priority
34 * Indexed value corresponds to highest priority bit position (i.e. 0..7)
35 *********************************************************************************************************
36 */
37
38 INT8U const OSUnMapTbl[256] = {
39 0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x00 to 0x0F */
40 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x10 to 0x1F */
41 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x20 to 0x2F */
42 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x30 to 0x3F */
43 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x40 to 0x4F */
44 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x50 to 0x5F */
45 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x60 to 0x6F */
46 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x70 to 0x7F */
47 7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x80 to 0x8F */
48 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x90 to 0x9F */
49 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xA0 to 0xAF */
50 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xB0 to 0xBF */
51 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xC0 to 0xCF */
52 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xD0 to 0xDF */
53 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xE0 to 0xEF */
C51 COMPILER V8.17 OS_CORE 03/26/2009 14:24:24 PAGE 2
54 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* 0xF0 to 0xFF */
55 };
56
57 /*$PAGE*/
58 /*
59 *********************************************************************************************************
60 * FUNCTION PROTOTYPES
61 *********************************************************************************************************
62 */
63
64 static void OS_InitEventList(void);
65
66 static void OS_InitMisc(void);
67
68 static void OS_InitRdyList(void);
69
70 static void OS_InitTaskIdle(void);
71
72 #if OS_TASK_STAT_EN > 0
static void OS_InitTaskStat(void);
#endif
75
76 static void OS_InitTCBList(void);
77
78 static void OS_SchedNew(void) reentrant;
79
80 /*$PAGE*/
81 /*
82 *********************************************************************************************************
83 * GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
84 *
85 * Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
86 *
87 * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
88 * a mutex, a mailbox or a queue. Where this function is concerned, the actual
89 * type is irrelevant.
90 *
91 * pname is a pointer to an ASCII string that will receive the name of the semaphore,
92 * mutex, mailbox or queue. The string must be able to hold at least
93 * OS_EVENT_NAME_SIZE characters.
94 *
95 * perr is a pointer to an error code that can contain one of the following values:
96 *
97 * OS_ERR_NONE if the name was copied to 'pname'
98 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
99 * control block type.
100 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
101 * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
102 * OS_ERR_NAME_GET_ISR if you are trying to call this function from an ISR
103 *
104 * Returns : The length of the string or 0 if the 'pevent' is a NULL pointer.
105 *********************************************************************************************************
106 */
107
108 #if (OS_EVENT_EN) && (OS_EVENT_NAME_SIZE > 1)
INT8U OSEventNameGet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
{
INT8U len;
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
C51 COMPILER V8.17 OS_CORE 03/26/2009 14:24:24 PAGE 3
#if OS_ARG_CHK_EN > 0
if (perr == (INT8U *)0) { /* Validate 'perr' */
return (0);
}
if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
*perr = OS_ERR_PEVENT_NULL;
return (0);
}
if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
*perr = OS_ERR_PNAME_NULL;
return (0);
}
#endif
if (OSIntNesting > 0) { /* See if trying to call from an ISR */
*perr = OS_ERR_NAME_GET_ISR;
return (0);
}
switch (pevent->OSEventType) {
case OS_EVENT_TYPE_SEM:
case OS_EVENT_TYPE_MUTEX:
case OS_EVENT_TYPE_MBOX:
case OS_EVENT_TYPE_Q:
break;
default:
*perr = OS_ERR_EVENT_TYPE;
return (0);
}
OS_ENTER_CRITICAL();
len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
OS_EXIT_CRITICAL();
*perr = OS_ERR_NONE;
return (len);
}
#endif
153
154 /*$PAGE*/
155 /*
156 *********************************************************************************************************
157 * ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
158 *
159 * Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
160 *
161 * Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
162 * a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
163 * matter the actual type.
164 *
165 * pname is a pointer to an ASCII string that will be used as the name of the semaphore,
166 * mutex, mailbox or queue. The string must be able to hold at least
167 * OS_EVENT_NAME_SIZE characters.
168 *
169 * perr is a pointer to an error code that can contain one of the following values:
170 *
171 * OS_ERR_NONE if the requested task is resumed
172 * OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
173 * control block type.
174 * OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
175 * OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
176 * OS_ERR_NAME_SET_ISR if you called this function from an ISR
177 *
C51 COMPILER V8.17 OS_CORE 03/26/2009 14:24:24 PAGE 4
178 * Returns : None
179 *********************************************************************************************************
180 */
181
182 #if (OS_EVENT_EN) && (OS_EVENT_NAME_SIZE > 1)
void OSEventNameSet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
{
INT8U len;
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
#if OS_ARG_CHK_EN > 0
if (perr == (INT8U *)0) { /* Validate 'perr' */
return;
}
if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
*perr = OS_ERR_PEVENT_NULL;
return;
}
if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
*perr = OS_ERR_PNAME_NULL;
return;
}
#endif
if (OSIntNesting > 0) { /* See if trying to call from an ISR */
*perr = OS_ERR_NAME_SET_ISR;
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -