• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2009-2023 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;
20     uintptr_t intSave;
21 
22     intSave = PRT_HwiLock();
23     addr = g_memArithAPI.alloc(mid, ptNo, size);
24     PRT_HwiRestore(intSave);
25 
26     return addr;
27 }
28 
PRT_MemAllocAlign(U32 mid,U8 ptNo,U32 size,enum MemAlign alignPow)29 OS_SEC_TEXT void *PRT_MemAllocAlign(U32 mid, U8 ptNo, U32 size, enum MemAlign alignPow)
30 {
31     void *addr;
32     uintptr_t intSave;
33 
34     intSave = PRT_HwiLock();
35     addr = g_memArithAPI.allocAlign(mid, ptNo, size, alignPow);
36     PRT_HwiRestore(intSave);
37 
38     return addr;
39 }
40 
PRT_MemFree(U32 mid,void * addr)41 OS_SEC_TEXT U32 PRT_MemFree(U32 mid, void *addr)
42 {
43     U32 ret;
44     uintptr_t intSave;
45 
46     (void)mid;
47     intSave = PRT_HwiLock();
48     ret = g_memArithAPI.free(addr);
49     PRT_HwiRestore(intSave);
50 
51     return ret;
52 }
53