📄 cpu_core.lst
字号:
171 *
172 * Caller(s) : Your Product's Application.
173 *
174 * This function is a CPU initialization function & MAY be called by application/
175 * initialization function(s).
176 *
177 * Note(s) : (2) CPU_Init() MUST be called ... :
178 *
179 * (a) ONLY ONCE from a product's application; ...
180 * (b) BEFORE product's application calls any core CPU module function(s)
181 *
182 * (3) The following initialization functions MUST be sequenced as follows :
183 *
184 * (a) CPU_TS_Init() SHOULD precede ALL calls to other CPU timestamp functions
185 *
186 * (b) CPU_IntDisMeasInit() SHOULD precede ALL calls to CPU_CRITICAL_ENTER()/CPU_CRITICAL_EXIT()
187 * & other CPU interrupts disabled time measurement functions
188 *********************************************************************************************************
189 */
190
\ In section .text, align 2, keep-with-next
191 void CPU_Init (void)
192 {
\ CPU_Init:
\ 00000000 80B5 PUSH {R7,LR}
193 /* --------------------- INIT TS ---------------------- */
194 #if ((CPU_CFG_TS_EN == DEF_ENABLED) || \
195 (CPU_CFG_TS_TMR_EN == DEF_ENABLED))
196 CPU_TS_Init(); /* See Note #3a. */
197 #endif
198 /* -------------- INIT INT DIS TIME MEAS -------------- */
199 #ifdef CPU_CFG_INT_DIS_MEAS_EN
200 CPU_IntDisMeasInit(); /* See Note #3b. */
201 #endif
202
203 /* ------------------ INIT CPU NAME ------------------- */
204 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
205 CPU_NameInit();
\ 00000002 ........ BL CPU_NameInit
206 #endif
207 }
\ 00000006 01BD POP {R0,PC} ;; return
208
209
210 /*$PAGE*/
211 /*
212 *********************************************************************************************************
213 * CPU_SW_Exception()
214 *
215 * Description : Trap unrecoverable software exception.
216 *
217 * Argument(s) : none.
218 *
219 * Return(s) : none.
220 *
221 * Caller(s) : various.
222 *
223 * Note(s) : (1) CPU_SW_Exception() deadlocks the current code execution -- whether multi-tasked/
224 * -processed/-threaded or single-threaded -- when the current code execution cannot
225 * gracefully recover or report a fault or exception condition.
226 *
227 * See also 'cpu_core.h CPU_SW_EXCEPTION() Note #1'.
228 *********************************************************************************************************
229 */
230
\ In section .text, align 2, keep-with-next
231 void CPU_SW_Exception (void)
232 {
233 while (DEF_ON) {
\ CPU_SW_Exception:
\ ??CPU_SW_Exception_0:
\ 00000000 FEE7 B.N ??CPU_SW_Exception_0
234 ;
235 }
236 }
237
238
239 /*$PAGE*/
240 /*
241 *********************************************************************************************************
242 * CPU_NameClr()
243 *
244 * Description : Clear CPU Name.
245 *
246 * Argument(s) : none.
247 *
248 * Return(s) : none.
249 *
250 * Caller(s) : CPU_NameInit(),
251 * Application.
252 *
253 * This function is a CPU module application interface (API) function & MAY be called by
254 * application function(s).
255 *
256 * Note(s) : none.
257 *********************************************************************************************************
258 */
259
260 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
\ In section .text, align 2, keep-with-next
261 void CPU_NameClr (void)
262 {
\ CPU_NameClr:
\ 00000000 10B5 PUSH {R4,LR}
263 CPU_SR_ALLOC();
\ 00000002 0024 MOVS R4,#+0
264
265
266 CPU_CRITICAL_ENTER();
\ 00000004 ........ BL CPU_SR_Save
\ 00000008 0400 MOVS R4,R0
267 Mem_Clr((void *)&CPU_Name[0],
268 (CPU_SIZE_T) CPU_CFG_NAME_SIZE);
\ 0000000A 1021 MOVS R1,#+16
\ 0000000C .... LDR.N R0,??DataTable2
\ 0000000E ........ BL Mem_Clr
269 CPU_CRITICAL_EXIT();
\ 00000012 2000 MOVS R0,R4
\ 00000014 ........ BL CPU_SR_Restore
270 }
\ 00000018 10BD POP {R4,PC} ;; return
271 #endif
272
273
274 /*$PAGE*/
275 /*
276 *********************************************************************************************************
277 * CPU_NameGet()
278 *
279 * Description : Get CPU host name.
280 *
281 * Argument(s) : p_name Pointer to an ASCII character array that will receive the return CPU host
282 * name ASCII string from this function (see Note #1).
283 *
284 * p_err Pointer to variable that will receive the return error code from this function :
285 *
286 * CPU_ERR_NONE CPU host name successfully returned.
287 * CPU_ERR_NULL_PTR Argument 'p_name' passed a NULL pointer.
288 *
289 * Return(s) : none.
290 *
291 * Caller(s) : Application.
292 *
293 * This function is a CPU module application interface (API) function & MAY be called by
294 * application function(s).
295 *
296 * Note(s) : (1) The size of the ASCII character array that will receive the return CPU host name
297 * ASCII string :
298 *
299 * (a) MUST be greater than or equal to the current CPU host name's ASCII string
300 * size including the terminating NULL character;
301 * (b) SHOULD be greater than or equal to CPU_CFG_NAME_SIZE
302 *********************************************************************************************************
303 */
304
305 #if (CPU_CFG_NAME_EN == DEF_ENABLED)
\ In section .text, align 2, keep-with-next
306 void CPU_NameGet (CPU_CHAR *p_name,
307 CPU_ERR *p_err)
308 {
\ CPU_NameGet:
\ 00000000 F8B5 PUSH {R3-R7,LR}
\ 00000002 0400 MOVS R4,R0
\ 00000004 0D00 MOVS R5,R1
309 CPU_SR_ALLOC();
\ 00000006 0026 MOVS R6,#+0
310
311
312 if (p_err == (CPU_ERR *)0) {
\ 00000008 002D CMP R5,#+0
\ 0000000A 01D1 BNE.N ??CPU_NameGet_0
313 CPU_SW_EXCEPTION(;);
\ 0000000C ........ BL CPU_SW_Exception
314 }
315
316 if (p_name == (CPU_CHAR *)0) {
\ ??CPU_NameGet_0:
\ 00000010 002C CMP R4,#+0
\ 00000012 02D1 BNE.N ??CPU_NameGet_1
317 *p_err = CPU_ERR_NULL_PTR;
\ 00000014 0A20 MOVS R0,#+10
\ 00000016 2880 STRH R0,[R5, #+0]
318 return;
\ 00000018 0DE0 B.N ??CPU_NameGet_2
319 }
320
321 CPU_CRITICAL_ENTER();
\ ??CPU_NameGet_1:
\ 0000001A ........ BL CPU_SR_Save
\ 0000001E 0600 MOVS R6,R0
322 (void)Str_Copy_N((CPU_CHAR *) p_name,
323 (CPU_CHAR *)&CPU_Name[0],
324 (CPU_SIZE_T) CPU_CFG_NAME_SIZE);
\ 00000020 1022 MOVS R2,#+16
\ 00000022 .... LDR.N R1,??DataTable2
\ 00000024 2000 MOVS R0,R4
\ 00000026 ........ BL Str_Copy_N
\ 0000002A 0700 MOVS R7,R0
325 CPU_CRITICAL_EXIT();
\ 0000002C 3000 MOVS R0,R6
\ 0000002E ........ BL CPU_SR_Restore
326
327 *p_err = CPU_ERR_NONE;
\ 00000032 0020 MOVS R0,#+0
\ 00000034 2880 STRH R0,[R5, #+0]
328 }
\ ??CPU_NameGet_2:
\ 00000036 F1BD POP {R0,R4-R7,PC} ;; return
329 #endif
330
331
332 /*$PAGE*/
333 /*
334 *********************************************************************************************************
335 * CPU_NameSet()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -