1 /*
2  * Copyright 2021 Rockchip Electronics Co. LTD
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 #ifndef __MPP_MEM_POOL_H__
18 #define __MPP_MEM_POOL_H__
19 
20 #include <stdlib.h>
21 #include "mpp_mem.h"
22 #include "mpp_common.h"
23 
24 typedef void* MppMemPool;
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define mpp_mem_pool_init(size)     mpp_mem_pool_init_f(__FUNCTION__, size)
31 #define mpp_mem_pool_deinit(pool)   mpp_mem_pool_deinit_f(__FUNCTION__, pool);
32 
33 #define mpp_mem_pool_get(pool)      mpp_mem_pool_get_f(__FUNCTION__, pool)
34 #define mpp_mem_pool_put(pool, p)   mpp_mem_pool_put_f(__FUNCTION__, pool, p)
35 
36 MppMemPool mpp_mem_pool_init_f(const char *caller, size_t size);
37 void mpp_mem_pool_deinit_f(const char *caller, MppMemPool pool);
38 
39 void *mpp_mem_pool_get_f(const char *caller, MppMemPool pool);
40 void mpp_mem_pool_put_f(const char *caller, MppMemPool pool, void *p);
41 
42 #ifdef __cplusplus
43 }
44 #endif
45 
46 #endif /*__MPP_MEM_POOL_H__*/
47