• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2009-2022 Huawei Technologies Co., Ltd. All rights reserved.
3  *
4  * UniProton is licensed under Mulan PSL v2.
5  * You can use this software according to the terms and conditions of the Mulan PSL v2.
6  * You may obtain a copy of Mulan PSL v2 at:
7  *          http://license.coscl.org.cn/MulanPSL2
8  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
9  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
10  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
11  * See the Mulan PSL v2 for more details.
12  * Create: 2009-12-22
13  * Description: 内存基本功能的C文件。
14  */
15 #include "prt_mem_internal.h"
16 
PRT_MemAlloc(U32 mid,U8 ptNo,U32 size)17 OS_SEC_TEXT void *PRT_MemAlloc(U32 mid, U8 ptNo, U32 size)
18 {
19     void *addr = NULL;
20     uintptr_t intSave;
21 
22     (void)ptNo;
23 
24     intSave = PRT_HwiLock();
25     addr = g_memArithAPI.alloc(mid, size);
26     PRT_HwiRestore(intSave);
27 
28     return addr;
29 }
30 
PRT_MemFree(U32 mid,void * addr)31 OS_SEC_TEXT U32 PRT_MemFree(U32 mid, void *addr)
32 {
33     U32 ret;
34     uintptr_t intSave;
35 
36     (void)mid;
37     intSave = PRT_HwiLock();
38     ret = g_memArithAPI.free(addr);
39     PRT_HwiRestore(intSave);
40 
41     return ret;
42 }
43