📄 os_core.lst
字号:
\ 030001000200
\ 0100040001
\ 00000073 000200010003 DC8 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 7, 0, 1, 0, 2, 0, 1, 0, 3, 0
\ 000100020001
\ 000700010002
\ 0001000300
\ 0000008A 010002000100 DC8 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5
\ 040001000200
\ 010003000100
\ 0200010005
\ 000000A1 000100020001 DC8 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0
\ 000300010002
\ 000100040001
\ 0002000100
\ 000000B8 030001000200 DC8 3, 0, 1, 0, 2, 0, 1, 0, 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1
\ 010006000100
\ 020001000300
\ 0100020001
\ 000000CF 000400010002 DC8 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 5, 0, 1, 0, 2, 0
\ 000100030001
\ 000200010005
\ 0001000200
\ 000000E6 010003000100 DC8 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2
\ 020001000400
\ 010002000100
\ 0300010002
\ 000000FD 000100 DC8 0, 1, 0
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 */
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
73 static void OS_InitTaskStat(void);
74 #endif
75
76 static void OS_InitTCBList(void);
77
78 static void OS_SchedNew(void);
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)
\ In segment CODE, align 4, keep-with-next
109 INT8U OSEventNameGet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
110 {
\ OSEventNameGet:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0600 MOVS R6,R0
\ 00000004 0F00 MOVS R7,R1
\ 00000006 1400 MOVS R4,R2
111 INT8U len;
112 #if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
113 OS_CPU_SR cpu_sr = 0;
114 #endif
115
116
117
118 #if OS_ARG_CHK_EN > 0
119 if (perr == (INT8U *)0) { /* Validate 'perr' */
120 return (0);
121 }
122 if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
123 *perr = OS_ERR_PEVENT_NULL;
124 return (0);
125 }
126 if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
127 *perr = OS_ERR_PNAME_NULL;
128 return (0);
129 }
130 #endif
131 if (OSIntNesting > 0) { /* See if trying to call from an ISR */
\ 00000008 .... LDR.N R0,??DataTable1 ;; OSCPUUsage + 2
\ 0000000A 0078 LDRB R0,[R0, #+0]
\ 0000000C 0028 CMP R0,#+0
\ 0000000E 03D0 BEQ.N ??OSEventNameGet_0
132 *perr = OS_ERR_NAME_GET_ISR;
\ 00000010 1120 MOVS R0,#+17
\ 00000012 2070 STRB R0,[R4, #+0]
133 return (0);
\ 00000014 0020 MOVS R0,#+0
\ 00000016 F0BD POP {R4-R7,PC}
134 }
135 switch (pevent->OSEventType) {
\ ??OSEventNameGet_0:
\ 00000018 3078 LDRB R0,[R6, #+0]
\ 0000001A 401E SUBS R0,R0,#+1
\ 0000001C 0328 CMP R0,#+3
\ 0000001E 0FD8 BHI.N ??OSEventNameGet_1
136 case OS_EVENT_TYPE_SEM:
137 case OS_EVENT_TYPE_MUTEX:
138 case OS_EVENT_TYPE_MBOX:
139 case OS_EVENT_TYPE_Q:
140 break;
141
142 default:
143 *perr = OS_ERR_EVENT_TYPE;
144 return (0);
145 }
146 OS_ENTER_CRITICAL();
\ 00000020 ........ _BLF OS_CPU_SR_Save,??OS_CPU_SR_Save??rT
\ 00000024 0500 MOVS R5,R0
147 len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
\ 00000026 0F36 ADDS R6,R6,#+15
\ 00000028 3100 MOVS R1,R6
\ 0000002A 3800 MOVS R0,R7
\ 0000002C ........ BL OS_StrCopy
\ 00000030 0600 MOVS R6,R0
148 OS_EXIT_CRITICAL();
\ 00000032 2800 MOVS R0,R5
\ 00000034 ........ _BLF OS_CPU_SR_Restore,??OS_CPU_SR_Restore??rT
149 *perr = OS_ERR_NONE;
\ 00000038 0020 MOVS R0,#+0
\ 0000003A 2070 STRB R0,[R4, #+0]
150 return (len);
\ 0000003C 3000 MOVS R0,R6
\ 0000003E F0BD POP {R4-R7,PC}
\ ??OSEventNameGet_1:
\ 00000040 0120 MOVS R0,#+1
\ 00000042 2070 STRB R0,[R4, #+0]
\ 00000044 0020 MOVS R0,#+0
\ 00000046 F0BD POP {R4-R7,PC} ;; return
151 }
152 #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 *
178 * Returns : None
179 *********************************************************************************************************
180 */
181
182 #if (OS_EVENT_EN) && (OS_EVENT_NAME_SIZE > 1)
\ In segment CODE, align 4, keep-with-next
183 void OSEventNameSet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
184 {
\ OSEventNameSet:
\ 00000000 F0B5 PUSH {R4-R7,LR}
\ 00000002 0400 MOVS R4,R0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -