aboutsummaryrefslogtreecommitdiff
path: root/encoder/irc_mem_req_and_acq.h
blob: 37f30fc303d0c5404fbb936446f486cbd3b61cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/******************************************************************************
 *
 * Copyright (C) 2015 The Android Open Source Project
 *
 * 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.
 *
 *****************************************************************************
 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
*/

/**
******************************************************************************
* @file
*  irc_mem_req_and_acq.h
*
* @brief
*  This file contains interface definitions for allocating rate control
*  memtabs
*
* @author
*  ittiam
*
* @remarks
*  none
*
*******************************************************************************
*/

#ifndef _RC_MEM_REQ_AND_ACQ_H_
#define _RC_MEM_REQ_AND_ACQ_H_

/*****************************************************************************/
/* Function Macros                                                           */
/*****************************************************************************/

#define FILL_MEMTAB(m_pv_mem_rec, m_j, m_mem_size, m_align, m_type)      \
{                                                                        \
    m_pv_mem_rec[m_j].u4_size = sizeof(iv_mem_rec_t);                    \
    m_pv_mem_rec[m_j].u4_mem_size = m_mem_size;                          \
    m_pv_mem_rec[m_j].u4_mem_alignment = m_align;                        \
    m_pv_mem_rec[m_j].e_mem_type = m_type;                               \
}

/*****************************************************************************/
/* Enums                                                                     */
/*****************************************************************************/
typedef enum
{
    ALIGN_BYTE = 1,
    ALIGN_WORD16 = 2,
    ALIGN_WORD32 = 4,
    ALIGN_WORD64 = 8,
    ALIGN_128_BYTE = 128
}ITT_MEM_ALIGNMENT_TYPE_E;

typedef enum
{
    SCRATCH = 0,
    PERSISTENT = 1,
    WRITEONCE  = 2
}ITT_MEM_USAGE_TYPE_E;

typedef enum
{
    L1D = 0,
    SL2 = 1,
    DDR = 3
}ITT_MEM_REGION_E;

typedef enum
{
    GET_NUM_MEMTAB = 0,
    FILL_MEMTAB = 1,
    USE_BASE = 2,
    FILL_BASE =3
}ITT_FUNC_TYPE_E;

/*****************************************************************************/
/* Structures                                                                */
/*****************************************************************************/

typedef struct
{
    /* Size in bytes */
    UWORD32 u4_size;

    /* Alignment in bytes */
    WORD32 i4_alignment;

    /* decides which memory region to be placed */
    ITT_MEM_REGION_E e_mem_region;

    /* memory is scratch or persistent */
    ITT_MEM_USAGE_TYPE_E e_usage;

    /* Base pointer for allocated memory */
    void *pv_base;
} itt_memtab_t;

/*****************************************************************************/
/* Function Declarations                                                     */
/*****************************************************************************/

void fill_memtab(itt_memtab_t *ps_mem_tab,
                 WORD32 u4_size,
                 WORD32 i4_alignment,
                 ITT_MEM_USAGE_TYPE_E e_usage,
                 ITT_MEM_REGION_E e_mem_region);

WORD32 use_or_fill_base(itt_memtab_t *ps_mem_tab,
                        void **ptr_to_be_filled,
                        ITT_FUNC_TYPE_E e_func_type);


#endif // _RC_MEM_REQ_AND_ACQ_H_