1 /******************************************************************************
2  *
3  * Copyright (C) 2018 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 #ifndef IMPD_MEMORY_STANDARDS_H
22 #define IMPD_MEMORY_STANDARDS_H
23 
24 /*****************************************************************************/
25 /* Type definitions                                                          */
26 /*****************************************************************************/
27 /* standard memory table descriptor for libraries */
28 typedef struct {
29   UWORD32 ui_size;         /* size of the memory in bytes  */
30   UWORD32 ui_alignment;    /* alignment in bytes           */
31   UWORD32 ui_type;         /* type of memory               */
32   UWORD32 ui_placement[2]; /* 64 bit placement info        */
33   UWORD32 ui_priority;     /* the importance for placement */
34   UWORD32 ui_placed[2];    /* the o_red location for placement */
35 } ia_mem_info_struct;
36 
37 /*****************************************************************************/
38 /* Constant hash defines                                                     */
39 /*****************************************************************************/
40 /* when you don't need alignment, pass this to memory library */
41 #define IA_MEM_NO_ALIGN 0x01
42 
43 /* ittiam standard memory types */
44 /* to be used inter frames */
45 #define IA_MEMTYPE_PERSIST 0x00
46 /* read write, to be used intra frames */
47 #define IA_MEMTYPE_SCRATCH 0x01
48 /* read only memory, intra frame */
49 #define IA_MEMTYPE_INPUT 0x02
50 /* read-write memory, for usable output, intra frame */
51 #define IA_MEMTYPE_OUTPUT 0x03
52 /* readonly memory, inter frame */
53 #define IA_MEMTYPE_TABLE 0x04
54 /* input buffer before mem tabs allocation */
55 #define IA_MEMTYPE_PRE_FRAME_INPUT 0x05
56 /* input buffer before mem tabs allocation */
57 #define IA_MEMTYPE_PRE_FRAME_SCRATCH 0x06
58 /* for local variables */
59 #define IA_MEMTYPE_AUTO_VAR 0x80
60 
61 /* ittiam standard memory priorities */
62 #define IA_MEMPRIORITY_ANYWHERE 0x00
63 #define IA_MEMPRIORITY_LOWEST 0x01
64 #define IA_MEMPRIORITY_LOW 0x02
65 #define IA_MEMPRIORITY_NORM 0x03
66 #define IA_MEMPRIORITY_ABOVE_NORM 0x04
67 #define IA_MEMPRIORITY_HIGH 0x05
68 #define IA_MEMPRIORITY_HIGHER 0x06
69 #define IA_MEMPRIORITY_CRITICAL 0x07
70 
71 /* ittiam standard memory placements */
72 /* placement is defined by 64 bits */
73 
74 #define IA_MEMPLACE_FAST_RAM_0 0x000001
75 #define IA_MEMPLACE_FAST_RAM_1 0x000002
76 #define IA_MEMPLACE_FAST_RAM_2 0x000004
77 #define IA_MEMPLACE_FAST_RAM_3 0x000008
78 #define IA_MEMPLACE_FAST_RAM_4 0x000010
79 #define IA_MEMPLACE_FAST_RAM_5 0x000020
80 #define IA_MEMPLACE_FAST_RAM_6 0x000040
81 #define IA_MEMPLACE_FAST_RAM_7 0x000080
82 
83 #define IA_MEMPLACE_INT_RAM_0 0x000100
84 #define IA_MEMPLACE_INT_RAM_1 0x000200
85 #define IA_MEMPLACE_INT_RAM_2 0x000400
86 #define IA_MEMPLACE_INT_RAM_3 0x000800
87 #define IA_MEMPLACE_INT_RAM_4 0x001000
88 #define IA_MEMPLACE_INT_RAM_5 0x002000
89 #define IA_MEMPLACE_INT_RAM_6 0x004000
90 #define IA_MEMPLACE_INT_RAM_7 0x008000
91 
92 #define IA_MEMPLACE_EXT_RAM_0 0x010000
93 #define IA_MEMPLACE_EXT_RAM_1 0x020000
94 #define IA_MEMPLACE_EXT_RAM_2 0x040000
95 #define IA_MEMPLACE_EXT_RAM_3 0x080000
96 #define IA_MEMPLACE_EXT_RAM_4 0x100000
97 #define IA_MEMPLACE_EXT_RAM_5 0x200000
98 #define IA_MEMPLACE_EXT_RAM_6 0x400000
99 #define IA_MEMPLACE_EXT_RAM_7 0x800000
100 
101 #define IA_MEMPLACE_DONTCARE_H 0xFFFFFFFF
102 #define IA_MEMPLACE_DONTCARE_L 0xFFFFFFFF
103 
104 /* the simple common PC RAM */
105 #define IA_PC_RAM_H 0x00000000
106 #define IA_PC_RAM_L IA_MEMPLACE_EXT_RAM_0
107 
108 #endif
109