1 /****************************************************************************** 2 * 3 * Copyright (C) 2015 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ***************************************************************************** 18 * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore 19 */ 20 21 /** 22 ****************************************************************************** 23 * @file 24 * irc_mem_req_and_acq.h 25 * 26 * @brief 27 * This file contains interface definitions for allocating rate control 28 * memtabs 29 * 30 * @author 31 * ittiam 32 * 33 * @remarks 34 * none 35 * 36 ******************************************************************************* 37 */ 38 39 #ifndef _RC_MEM_REQ_AND_ACQ_H_ 40 #define _RC_MEM_REQ_AND_ACQ_H_ 41 42 /*****************************************************************************/ 43 /* Function Macros */ 44 /*****************************************************************************/ 45 46 #define FILL_MEMTAB(m_pv_mem_rec, m_j, m_mem_size, m_align, m_type) \ 47 { \ 48 m_pv_mem_rec[m_j].u4_size = sizeof(iv_mem_rec_t); \ 49 m_pv_mem_rec[m_j].u4_mem_size = m_mem_size; \ 50 m_pv_mem_rec[m_j].u4_mem_alignment = m_align; \ 51 m_pv_mem_rec[m_j].e_mem_type = m_type; \ 52 } 53 54 /*****************************************************************************/ 55 /* Enums */ 56 /*****************************************************************************/ 57 typedef enum 58 { 59 ALIGN_BYTE = 1, 60 ALIGN_WORD16 = 2, 61 ALIGN_WORD32 = 4, 62 ALIGN_WORD64 = 8, 63 ALIGN_128_BYTE = 128 64 }ITT_MEM_ALIGNMENT_TYPE_E; 65 66 typedef enum 67 { 68 SCRATCH = 0, 69 PERSISTENT = 1, 70 WRITEONCE = 2 71 }ITT_MEM_USAGE_TYPE_E; 72 73 typedef enum 74 { 75 L1D = 0, 76 SL2 = 1, 77 DDR = 3 78 }ITT_MEM_REGION_E; 79 80 typedef enum 81 { 82 GET_NUM_MEMTAB = 0, 83 FILL_MEMTAB = 1, 84 USE_BASE = 2, 85 FILL_BASE =3 86 }ITT_FUNC_TYPE_E; 87 88 /*****************************************************************************/ 89 /* Structures */ 90 /*****************************************************************************/ 91 92 typedef struct 93 { 94 /* Size in bytes */ 95 UWORD32 u4_size; 96 97 /* Alignment in bytes */ 98 WORD32 i4_alignment; 99 100 /* decides which memory region to be placed */ 101 ITT_MEM_REGION_E e_mem_region; 102 103 /* memory is scratch or persistent */ 104 ITT_MEM_USAGE_TYPE_E e_usage; 105 106 /* Base pointer for allocated memory */ 107 void *pv_base; 108 } itt_memtab_t; 109 110 /*****************************************************************************/ 111 /* Function Declarations */ 112 /*****************************************************************************/ 113 114 void fill_memtab(itt_memtab_t *ps_mem_tab, 115 WORD32 u4_size, 116 WORD32 i4_alignment, 117 ITT_MEM_USAGE_TYPE_E e_usage, 118 ITT_MEM_REGION_E e_mem_region); 119 120 WORD32 use_or_fill_base(itt_memtab_t *ps_mem_tab, 121 void **ptr_to_be_filled, 122 ITT_FUNC_TYPE_E e_func_type); 123 124 125 #endif // _RC_MEM_REQ_AND_ACQ_H_ 126 127