1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #include "chre/platform/memory.h" 18 #include "chre/platform/slpi/memory.h" 19 20 extern "C" { 21 22 #include "qurt.h" 23 #include "sns_memmgr.h" 24 25 } // extern "C" 26 27 namespace chre { 28 memoryAlloc(size_t size)29void *memoryAlloc(size_t size) { 30 #ifdef CHRE_SLPI_UIMG_ENABLED 31 return SNS_OS_U_MALLOC(SNS_CHRE, size); 32 #else 33 return malloc(size); 34 #endif // CHRE_SLPI_UIMG_ENABLED 35 } 36 memoryAllocBigImage(size_t size)37void *memoryAllocBigImage(size_t size) { 38 return malloc(size); 39 } 40 palSystemApiMemoryAlloc(size_t size)41void *palSystemApiMemoryAlloc(size_t size) { 42 return malloc(size); 43 } 44 memoryFree(void * pointer)45void memoryFree(void *pointer) { 46 #ifdef CHRE_SLPI_UIMG_ENABLED 47 SNS_OS_FREE(pointer); 48 #else 49 free(pointer); 50 #endif // CHRE_SLPI_UIMG_ENABLED 51 } 52 memoryFreeBigImage(void * pointer)53void memoryFreeBigImage(void *pointer) { 54 free(pointer); 55 } 56 palSystemApiMemoryFree(void * pointer)57void palSystemApiMemoryFree(void *pointer) { 58 free(pointer); 59 } 60 61 } // namespace chre 62