/* * Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved. * Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list * of conditions and the following disclaimer in the documentation and/or other materials * provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used * to endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /**@defgroup los_debug * @ingroup kernel */ #ifndef _LOS_DEBUG_H #define _LOS_DEBUG_H #include "los_config.h" #include "los_compiler.h" #ifdef __cplusplus #if __cplusplus extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ #if (LOSCFG_PLATFORM_EXC == 1) enum MemMangType { MEM_MANG_MEMBOX, MEM_MANG_MEMORY, MEM_MANG_EMPTY }; typedef struct { UINT32 type; UINT32 startAddr; UINT32 size; VOID *blkAddrArray; } MemInfo; typedef struct { enum MemMangType type; UINT32 startAddr; UINT32 size; UINT32 free; UINT32 blockSize; UINT32 errorAddr; UINT32 errorLen; UINT32 errorOwner; } MemInfoCB; #endif typedef enum { EXC_REBOOT, EXC_ASSERT, EXC_PANIC, EXC_STACKOVERFLOW, EXC_INTERRUPT, EXC_TYPE_END } EXC_TYPE; typedef VOID (*ExcHookFn)(EXC_TYPE excType); VOID OsExcHookRegister(ExcHookFn excHookFn); VOID OsDoExcHook(EXC_TYPE excType); #define LOG_EMG_LEVEL 0 #define LOG_COMMON_LEVEL (LOG_EMG_LEVEL + 1) #define LOG_ERR_LEVEL (LOG_COMMON_LEVEL + 1) #define LOG_WARN_LEVEL (LOG_ERR_LEVEL + 1) #define LOG_INFO_LEVEL (LOG_WARN_LEVEL + 1) #define LOG_DEBUG_LEVEL (LOG_INFO_LEVEL + 1) #ifndef PRINT_LEVEL #define PRINT_LEVEL LOG_ERR_LEVEL #endif typedef enum { LOG_MODULE_KERNEL, LOG_MODULE_FS, LOS_MODULE_OTHERS } LogModuleType; /** * @ingroup los_printf * @brief Format and print data. * * @par Description: * Print argument(s) according to fmt. * * @attention *