tsi_malloc.h
Go to the documentation of this file.
1
2
/** @addtogroup GRAPHICS_SDK Graphics
3
* @{
4
*/
5
6
/** @defgroup TSI_MALLOC GPU memory interfaces
7
* @brief GPU memory manage interfaces
8
* @{
9
*/
10
11
#ifndef TSI_MALLOC_H__
12
#define TSI_MALLOC_H__
13
14
15
#ifdef __cplusplus
16
extern
"C"
{
17
#endif
18
19
/**
20
* @defgroup TSI_MALLOC_MACRO Definations
21
* @{
22
*/
23
24
#define tsi_malloc_init(base_virt, base_phys, size, reset) \
25
tsi_malloc_init_pool(0, base_virt, base_phys, size, reset)
/**< Tsi_malloc_init define */
26
27
#define tsi_malloc(size) tsi_malloc_pool(0, size)
/**< Tsi_malloc define */
28
29
/** @} */
30
31
/**
32
* @defgroup TSI_MALLOC_FUNCTION Functions
33
* @{
34
*/
35
36
/**
37
*****************************************************************************************
38
* @brief Initial memory pool, command list memory malloc base on pool
39
* @param[in] pool: Pool id, the value is fixed -- 0
40
* @param[in] base_virt: Virtual addr, equel physical address
41
* @param[in] base_phys: Physical address
42
* @param[in] size: Pool memory size
43
* @param[in] reset: If 0, reset the memory
44
* @return Return Negative mean initial failure
45
*****************************************************************************************
46
*/
47
int
tsi_malloc_init_pool
(
int
pool
,
48
void
*base_virt,
49
uintptr_t base_phys,
50
int
size,
51
int
reset);
52
53
/**
54
*****************************************************************************************
55
* @brief Malloc memory from pool
56
* @param[in] pool: Pool id, the value is fixed -- 0
57
* @param[in] size: Malloc size
58
* @return Return the malloc memory addr
59
*****************************************************************************************
60
*/
61
void
*
tsi_malloc_pool
(
int
pool
,
int
size);
62
63
/**
64
*****************************************************************************************
65
* @brief Free memory
66
* @param[in] ptr: Memory addr
67
*****************************************************************************************
68
*/
69
void
tsi_free
(
void
*ptr);
70
71
/**
72
*****************************************************************************************
73
* @brief Free memory
74
* @param[in] addr: Memory virtual addr, equel physical address
75
* @return Return memory addr
76
*****************************************************************************************
77
*/
78
uintptr_t
tsi_virt2phys
(
void
*addr);
79
80
/** @} */
81
82
#ifdef __cplusplus
83
}
84
#endif
85
86
#endif
87
88
/** @} */
89
/** @} */
90
tsi_malloc_init_pool
int tsi_malloc_init_pool(int pool, void *base_virt, uintptr_t base_phys, int size, int reset)
Initial memory pool, command list memory malloc base on pool.
tsi_free
void tsi_free(void *ptr)
Free memory.
tsi_malloc_pool
void * tsi_malloc_pool(int pool, int size)
Malloc memory from pool.
tsi_virt2phys
uintptr_t tsi_virt2phys(void *addr)
Free memory.
pool
memory pool structure
Definition:
tsi_malloc_intern.h:60