43#ifdef LOSCFG_SHELL_DMESG
46#ifdef LOSCFG_SAVE_EXCINFO
71 const CHAR *p =
"Output illegal string! vsnprintf_s failed!\n";
77#ifdef LOSCFG_SHELL_DMESG
81 if (isLock != UART_WITHOUT_LOCK) {
89#ifdef LOSCFG_PLATFORM_CONSOLE
97 cnt = write(STDOUT_FILENO, str + written, (
size_t)toWrite);
98 if ((cnt < 0) || ((cnt == 0) && ((!
OsPreemptable()) || (OS_INT_ACTIVE))) || (toWrite == cnt)) {
111#ifdef LOSCFG_PLATFORM_CONSOLE
132 if (bufLen != SIZEBUF) {
141 const CHAR *errMsgMalloc =
"OsVprintf, malloc failed!\n";
142 const CHAR *errMsgLen =
"OsVprintf, length overflow!\n";
143 CHAR aBuf[SIZEBUF] = {0};
149 len = vsnprintf_s(bBuf, bufLen, bufLen - 1, fmt, ap);
150 if ((len == -1) && (*bBuf ==
'\0')) {
160 bufLen = bufLen << 1;
161 if ((
INT32)bufLen <= 0) {
167 UartPuts(errMsgMalloc, (
UINT32)strlen(errMsgMalloc), UART_WITH_LOCK);
170 len = vsnprintf_s(bBuf, bufLen, bufLen - 1, fmt, ap);
178 *(bBuf + len) =
'\0';
181 if ((systemStatus == OS_SYSTEM_NORMAL) || (systemStatus == OS_SYSTEM_EXC_OTHER_CPU)) {
183 }
else if (systemStatus == OS_SYSTEM_EXC_CURR_CPU) {
202#ifndef LOSCFG_LIBC_NEWLIB
208#ifdef LOSCFG_SAVE_EXCINFO
220#ifdef LOSCFG_SAVE_EXCINFO
227#ifdef LOSCFG_SHELL_DMESG
234#ifdef LOSCFG_PLATFORM_UART_WITHOUT_VFS
269#ifdef LOSCFG_SAVE_EXCINFO
275#ifndef LOSCFG_SHELL_LK
280 if (level > PRINT_LEVEL) {
284 if ((level != LOS_COMMON_LEVEL) && ((level > LOS_EMG_LEVEL) && (level <= LOS_TRACE_LEVEL))) {
292#ifdef LOSCFG_SAVE_EXCINFO
BOOL ConsoleEnable(VOID)
控制台使能
UINT32 OsCheckUartLock(VOID)
INT32 OsLogMemcpyRecord(const CHAR *buf, UINT32 logLen)
内存拷贝日志
VOID * LOS_MemAlloc(VOID *pool, UINT32 size)
从指定内存池中申请size长度的内存,注意这可不是从内核堆空间中申请内存
UINT32 LOS_MemFree(VOID *pool, VOID *ptr)
释放从指定动态内存中申请的内存
UINT8 * m_aucSysMem0
异常交互动态内存池地址的起始地址,当不支持异常交互特性时,m_aucSysMem0等于m_aucSysMem1。
void dprintf(const char *fmt,...)
Format and print data.
VOID LOS_LkPrint(INT32 level, const CHAR *func, INT32 line, const CHAR *fmt,...)
print log.
UINT32 OsGetSystemStatus(VOID)
获取系统状态
VOID WriteExcBufVa(const CHAR *format, va_list arglist)
vsnprintf 为C标准库可变参数的实现函数 见于 ..\third_party\musl\kernel\src\stdio\vsnprintf.c
VOID LkDprintf(const CHAR *fmt, va_list ap)
LK 注者的理解是 log kernel(内核日志)
VOID OsVprintf(const CHAR *fmt, va_list ap, OutputType type)
printf由 print 和 format 两个单词构成,格式化输出函数, 一般用于向标准输出设备按规定格式输出信息
VOID UartVprintf(const CHAR *fmt, va_list ap)
串口方式输入printf内容
STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
控制台输出
const CHAR * OsLogLvGet(INT32 level)
VOID PrintExcInfo(const CHAR *fmt,...)
打印异常信息
STATIC VOID ErrorMsg(VOID)
STATIC VOID UartOutput(const CHAR *str, UINT32 len, BOOL isLock)
串口输出,打印消息的本质就是向串口输出buf
STATIC VOID OsVprintfFree(CHAR *buf, UINT32 bufLen)
const CHAR * g_logString[]
__attribute__((noinline))
attribute((noinline)) 意思是告诉编译器 这是非内联函数
VOID OutputControl(const CHAR *str, UINT32 len, OutputType type)
VOID DmesgPrintf(const CHAR *fmt, va_list ap)
STATIC INLINE LosProcessCB * OsCurrProcessGet(VOID)
STATIC INLINE LosTaskCB * OsCurrTaskGet(VOID)
STATIC INLINE BOOL OsPreemptable(VOID)
VOID UartPuts(const CHAR *s, UINT32 len, BOOL isLock)