summaryrefslogtreecommitdiff
path: root/drivers/staging/nmf-cm/cm/engine/memory/inc/memory_type.h
blob: dbdba4c3d9dc6bfb96a6b307f6dd3e05bc283950 (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
 * Copyright (C) ST-Ericsson SA 2010
 * Author: Jean-Philippe FASSINO <jean-philippe.fassino@stericsson.com> for ST-Ericsson.
 * License terms:  GNU General Public License (GPL), version 2, with
 * user space exemption described in the top-level COPYING file in
 * the Linux kernel source tree.
 */
/*!
 * \brief Public Component Manager Memory API type.
 *
 * This file contains the Component Manager API type for manipulating memory.
 */
#ifndef __INC_MEMORY_TYPE_H
#define __INC_MEMORY_TYPE_H

#include <cm/inc/cm_type.h>

/*!
 * @defgroup t_cm_mpc_memory_type t_cm_mpc_memory_type
 * \brief Definition of symbols used to reference the various type of Media Processor Core adressable memory
 * @{
 * \ingroup MEMORY
 */
typedef t_uint8 t_cm_mpc_memory_type;                            //!< Fake enumeration type
#define CM_MM_MPC_TCM16_X           ((t_cm_mpc_memory_type)0)
#define CM_MM_MPC_TCM24_X           ((t_cm_mpc_memory_type)1)
#define CM_MM_MPC_ESRAM16           ((t_cm_mpc_memory_type)2)
#define CM_MM_MPC_ESRAM24           ((t_cm_mpc_memory_type)3)
#define CM_MM_MPC_SDRAM16           ((t_cm_mpc_memory_type)4)
#define CM_MM_MPC_SDRAM24           ((t_cm_mpc_memory_type)5)
#define CM_MM_MPC_TCM16_Y           ((t_cm_mpc_memory_type)6)
#define CM_MM_MPC_TCM24_Y           ((t_cm_mpc_memory_type)7)
#define CM_MM_MPC_TCM16             CM_MM_MPC_TCM16_X
#define CM_MM_MPC_TCM24             CM_MM_MPC_TCM24_X

/* @} */

/*!
 * @defgroup t_cm_memory_alignment t_cm_memory_alignment
 * \brief Definition of symbols used to constraint the alignment of the allocated memory
 * @{
 * \ingroup MEMORY
 */
typedef t_uint16 t_cm_memory_alignment;                            //!< Fake enumeration type
#define CM_MM_ALIGN_NONE            ((t_cm_memory_alignment)0x00000000)
#define CM_MM_ALIGN_BYTE            ((t_cm_memory_alignment)CM_MM_ALIGN_NONE)
#define CM_MM_ALIGN_HALFWORD        ((t_cm_memory_alignment)0x00000001)
#define CM_MM_ALIGN_WORD            ((t_cm_memory_alignment)0x00000003)
#define CM_MM_ALIGN_2WORDS          ((t_cm_memory_alignment)0x00000007)
#define CM_MM_ALIGN_16BYTES         ((t_cm_memory_alignment)0x0000000F)
#define CM_MM_ALIGN_4WORDS          ((t_cm_memory_alignment)0x0000000F)
#define CM_MM_ALIGN_AHB_BURST       ((t_cm_memory_alignment)0x0000000F)
#define CM_MM_ALIGN_32BYTES         ((t_cm_memory_alignment)0x0000001F)
#define CM_MM_ALIGN_8WORDS          ((t_cm_memory_alignment)0x0000001F)
#define CM_MM_ALIGN_64BYTES         ((t_cm_memory_alignment)0x0000003F)
#define CM_MM_ALIGN_16WORDS         ((t_cm_memory_alignment)0x0000003F)
#define CM_MM_ALIGN_128BYTES        ((t_cm_memory_alignment)0x0000007F)
#define CM_MM_ALIGN_32WORDS         ((t_cm_memory_alignment)0x0000007F)
#define CM_MM_ALIGN_256BYTES        ((t_cm_memory_alignment)0x000000FF)
#define CM_MM_ALIGN_64WORDS         ((t_cm_memory_alignment)0x000000FF)
#define CM_MM_ALIGN_512BYTES        ((t_cm_memory_alignment)0x000001FF)
#define CM_MM_ALIGN_128WORDS        ((t_cm_memory_alignment)0x000001FF)
#define CM_MM_ALIGN_1024BYTES       ((t_cm_memory_alignment)0x000003FF)
#define CM_MM_ALIGN_256WORDS        ((t_cm_memory_alignment)0x000003FF)
#define CM_MM_ALIGN_2048BYTES       ((t_cm_memory_alignment)0x000007FF)
#define CM_MM_ALIGN_512WORDS        ((t_cm_memory_alignment)0x000007FF)
#define CM_MM_ALIGN_4096BYTES       ((t_cm_memory_alignment)0x00000FFF)
#define CM_MM_ALIGN_1024WORDS       ((t_cm_memory_alignment)0x00000FFF)
#define CM_MM_ALIGN_65536BYTES      ((t_cm_memory_alignment)0x0000FFFF)
#define CM_MM_ALIGN_16384WORDS      ((t_cm_memory_alignment)0x0000FFFF)
/* @} */

/*!
 * @defgroup t_cm_mpc_memory_alignment t_cm_mpc_memory_alignment
 * \brief Definition of symbols used to constraint the alignment of the allocated mpc memory
 * @{
 * \ingroup MEMORY
 */
typedef t_uint16 t_cm_mpc_memory_alignment;                            //!< Fake enumeration type
#define CM_MM_MPC_ALIGN_NONE        ((t_cm_mpc_memory_alignment)0x00000000)
#define CM_MM_MPC_ALIGN_HALFWORD    ((t_cm_mpc_memory_alignment)0x00000001)
#define CM_MM_MPC_ALIGN_WORD        ((t_cm_mpc_memory_alignment)0x00000003)
#define CM_MM_MPC_ALIGN_2WORDS      ((t_cm_mpc_memory_alignment)0x00000007)
#define CM_MM_MPC_ALIGN_4WORDS      ((t_cm_mpc_memory_alignment)0x0000000F)
#define CM_MM_MPC_ALIGN_8WORDS      ((t_cm_mpc_memory_alignment)0x0000001F)
#define CM_MM_MPC_ALIGN_16WORDS     ((t_cm_mpc_memory_alignment)0x0000003F)
#define CM_MM_MPC_ALIGN_32WORDS     ((t_cm_mpc_memory_alignment)0x0000007F)
#define CM_MM_MPC_ALIGN_64WORDS     ((t_cm_mpc_memory_alignment)0x000000FF)
#define CM_MM_MPC_ALIGN_128WORDS    ((t_cm_mpc_memory_alignment)0x000001FF)
#define CM_MM_MPC_ALIGN_256WORDS    ((t_cm_mpc_memory_alignment)0x000003FF)
#define CM_MM_MPC_ALIGN_512WORDS    ((t_cm_mpc_memory_alignment)0x000007FF)
#define CM_MM_MPC_ALIGN_1024WORDS   ((t_cm_mpc_memory_alignment)0x00000FFF)
#define CM_MM_MPC_ALIGN_65536BYTES  ((t_cm_mpc_memory_alignment)0x0000FFFF)
#define CM_MM_MPC_ALIGN_16384WORDS  ((t_cm_mpc_memory_alignment)0x0000FFFF)
/* @} */

/*!
 * \brief Identifier of a memory handle
 * \ingroup MEMORY
 */
typedef t_uint32 t_cm_memory_handle;

/*!
 * \brief Description of a memory segment
 *
 * <=> allocable addressable space
 * \ingroup MEMORY
 */
typedef struct {
    t_cm_system_address systemAddr; //!< Logical AND physical segment start address
    t_uint32 size;                //!< segment size (in bytes)
} t_nmf_memory_segment;
#define INIT_MEMORY_SEGMENT {{0, 0}, 0}

/*!
 * \brief Definition of structure used for an allocator status
 * \ingroup MEMORY
 */
typedef struct
{
    struct {
        t_uint32 size;              //!< size of the allocator
        /* Block counters */
        t_uint16 used_block_number; //!< used block number
        t_uint16 free_block_number; //!< free block number

        /* Free memory min/max */
        t_uint32 maximum_free_size; //!< maximum free size
        t_uint32 minimum_free_size; //!< minimum free size

        /* Accumulation of free and used memory */
        t_uint32 accumulate_free_memory; //!< accumulate free memory
        t_uint32 accumulate_used_memory; //!< accumulate used memory
    } global;

    struct {
        t_uint32 size;       //!< size of the domain
        t_uint32 maximum_free_size; //!< maximum free size in the given domain
        t_uint32 minimum_free_size; //!< minimum free size in the given domain
        t_uint32 accumulate_free_memory; //all free memory of the given domain
        t_uint32 accumulate_used_memory; //all used memory of the given domain
    } domain;

    struct {
        t_uint32 sizes[3];
    } stack[NB_CORE_IDS];

} t_cm_allocator_status;

#endif /* __INC_MEMORY_TYPE_H */