1 /* ---------------------------------------------------------------------------- 2 * Copyright (c) Huawei Technologies Co., Ltd. 2013-2015. All rights reserved. 3 * Description: LiteOS memory Module Implementation 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 1. Redistributions of source code must retain the above copyright notice, this list of 7 * conditions and the following disclaimer. 8 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 9 * of conditions and the following disclaimer in the documentation and/or other materials 10 * provided with the distribution. 11 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 12 * to endorse or promote products derived from this software without specific prior written 13 * permission. 14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 16 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 21 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 22 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 24 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * --------------------------------------------------------------------------- */ 26 27 #ifndef _LOS_MEMCHECK_H 28 #define _LOS_MEMCHECK_H 29 30 #include "los_base.h" 31 32 #ifdef __cplusplus 33 #if __cplusplus 34 extern "C" { 35 #endif /* __cplusplus */ 36 #endif /* __cplusplus */ 37 38 #define MEM_INFO_SIZE ((sizeof(MEM_INFO) * OS_SYS_MEM_NUM) + 4) 39 extern UINT8 g_memMang[]; 40 41 enum _MEM_MANG_TYPE { 42 MEM_MANG_MEMBOX, 43 MEM_MANG_MEMORY, 44 MEM_MANG_EMPTY, 45 }; 46 47 enum _MEM_MANG_SOUCE { 48 MEM_MANG_UNUSED, 49 MEM_MANG_INIT, 50 MEM_MANG_INT, 51 MEM_MANG_TASK, 52 }; 53 54 typedef struct _MEM_INFO { 55 UINT32 uwType; 56 UINT32 uwStartAddr; 57 UINT32 uwSize; 58 }MEM_INFO; 59 60 typedef struct _SLAB_INFO { 61 UINT32 item_sz; 62 UINT32 item_cnt; 63 UINT32 cur_usage; 64 }SLAB_INFO; 65 66 #define SLAB_CLASS_NUM (4U) 67 typedef struct _MEM_INFO_S { 68 UINT32 uwType; 69 UINT32 uwStartAddr; 70 UINT32 uwSize; 71 UINT32 uwFree; 72 UINT32 uwBlockSize; 73 UINT32 uwErrorAddr; 74 UINT32 uwErrorLen; 75 UINT32 uwErrorOwner; 76 SLAB_INFO stSlabInfo[SLAB_CLASS_NUM]; 77 }MEM_INFO_S; 78 79 /** 80 * @ingroup los_memboxcheck 81 * @brief Get the information of the exc memory. 82 * 83 * @par Description: 84 * <ul> 85 * <li>This API is used to get the information of the exc memory.</li> 86 * </ul> 87 * @attention 88 * <ul> 89 * <li>None.</li> 90 * </ul> 91 * 92 * @param memNum [IN] Type #UINT32 Memory pool number. 93 * @param memExcInfo [IN/OUT] Type #MEM_INFO_S * information of the exc memory. 94 * 95 * @retval UINT32 Get information result. 96 * @par Dependency: 97 * <ul> 98 * <li>los_memboxcheck.h: the header file that contains the API declaration.</li> 99 * </ul> 100 * @see None. 101 */ 102 UINT32 LOS_MemExcInfoGet(UINT32 memNum, MEM_INFO_S *memExcInfo); 103 104 #ifdef __cplusplus 105 #if __cplusplus 106 } 107 #endif /* __cplusplus */ 108 #endif /* __cplusplus */ 109 110 #endif /* _LOS_MEMCHECK_H */ 111