diff --git a/osal/inc/rk_malloc.h b/osal/inc/rk_malloc.h index 5d021599..b94dd7fc 100644 --- a/osal/inc/rk_malloc.h +++ b/osal/inc/rk_malloc.h @@ -17,6 +17,8 @@ #ifndef __RK_MALLOC_H__ #define __RK_MALLOC_H__ +#include + #define rk_malloc(type, count) (type*)rk_mpp_malloc(sizeof(type) * (count)) #define rk_free(ptr) rk_mpp_free(ptr) diff --git a/osal/linux/os_malloc.c b/osal/linux/os_malloc.c new file mode 100644 index 00000000..19f648f6 --- /dev/null +++ b/osal/linux/os_malloc.c @@ -0,0 +1,29 @@ +/* + * Copyright 2010 Rockchip Electronics S.LSI Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include "os_malloc.h" + +int os_malloc(void **memptr, size_t alignment, size_t size) +{ + return posix_memalign(memptr, alignment, size); +} + +void os_free(void *ptr) +{ + free(ptr); +} +