1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __WMALLOC_H__ 20 #define __WMALLOC_H__ 21 22 #include "hi_type.h" 23 #include "hi_osal.h" 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif 29 #endif /* __cplusplus */ 30 31 /* CNcomment: 32 * Function: wmeminit 33 * Description: init memory pool. CNcomment: TDE memory pool initialization 34 * Return: success/error code. CNcomment: Success/error code 35 */ 36 hi_s32 wmeminit(void); 37 38 /* 39 * Function: wmemterm 40 * Description: Deinit memory pool. CNcomment:TDE memory pool initialization 41 */ 42 hi_void wmemterm(void); 43 44 /* 45 * Function: wgetphy 46 * Description: get the physics address of memory. CNcomment: To obtain the physical address of memory 47 * Input: ptr the pointer of memory. CNcomment: Pointer to the memory 48 * Output: physics address. CNcomment: Physical address 49 */ 50 hi_u64 wgetphy(hi_void *ptr); 51 52 /* 53 * Function: wgetphy 54 * Description: get the virtual address of memory. CNcomment: Access to the virtual address of memory 55 * Input: phyaddr physics address. CNcomment: Physical address 56 * Output: virtual address. CNcomment: A virtual address 57 */ 58 hi_void *wgetvrt(hi_u64 phyaddr); 59 60 /* 61 * Function: wgetfreenum 62 * Description:get the number of the free unit. CNcomment: Memory for the rest of the Unit cell number 63 * Return: the number of the free unit. CNcomment: The rest of the unit number 64 */ 65 hi_u32 wgetfreenum(hi_void); 66 #ifndef TDE_BOOT 67 osal_proc_entry_t *wprintinfo(osal_proc_entry_t *page); 68 #endif 69 70 #ifdef __cplusplus 71 #if __cplusplus 72 } 73 #endif 74 #endif /* __cplusplus */ 75 #endif /* __WMALLOC_H__ */ 76