1 /*
2 * Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 * Description: debug
15 *
16 * Create: 2021-12-16
17 */
18
19
20 #include <los_printf.h>
21 #include <los_config.h>
22 #include <los_printf_pri.h>
23 #include "soc_osal.h"
24 #include "los_exc.h"
25 #ifdef SW_UART_DEBUG
26 #include "debug_print.h"
27 #endif
28
osal_dump_stack(void)29 void osal_dump_stack(void)
30 {
31 OsBackTrace();
32 }
33
osal_panic(const char * fmt,const char * fun,int line,const char * cond)34 void osal_panic(const char *fmt, const char *fun, int line, const char *cond)
35 {
36 LOS_Panic(fmt, fun, line, cond);
37 }
38
osal_printk(const char * fmt,...)39 void osal_printk(const char *fmt, ...)
40 {
41 va_list args;
42
43 if (fmt == NULL) {
44 return;
45 }
46
47 va_start(args, fmt);
48 #ifdef HW_LITEOS_OPEN_VERSION_NUM
49 ConsoleVprintf(fmt, args);
50 #else
51 OsVprintf(fmt, args, CONSOLE_OUTPUT);
52 #endif
53 va_end(args);
54 }
55
osal_flush_cache(void)56 void osal_flush_cache(void)
57 {
58 ArchDCacheFlush();
59 }