summaryrefslogtreecommitdiff
path: root/drivers/staging/nmf-cm/cm/engine/elf/inc/elfapi.h
blob: cce6d158b4e974172e4ca8191953dde6d25c56c3 (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
/*
 * 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.
 */
/*!
 * \internal
 * \brief Elf loder internal methods.
 *
 * \defgroup ELFLOADER MMDSP ELF loader.
 */
#ifndef __INC_CM_ELFLOADER_H
#define __INC_CM_ELFLOADER_H

#include <cm/engine/elf/inc/common.h>

/*!
 * \internal
 * \brief ELF Parsing & checking
 * \ingroup ELFLOADER
 */
t_cm_error cm_ELF_CheckFile(
        const char              *elfdata,
        t_bool                  temporaryDescription,
        t_elfdescription        **elfhandlePtr);

void cm_ELF_ReleaseDescription(
        t_uint32 requireNumber, t_interface_require *requires,
        t_uint32 attributeNumber, t_attribute *attributes,
        t_uint32 propertyNumber, t_property *properties,
        t_uint32 provideNumber, t_interface_provide *provides);

/*!
 * \internal
 * \brief ELF closing
 * \ingroup ELFLOADER
 */
void cm_ELF_CloseFile(
        t_bool                  temporaryDescription,
        t_elfdescription        *elfhandle);

/*!
 * \internal
 * \brief Load a component template shared memories.
 *
 * \note In case of error, part of memory could have been allocated and must be free by calling cm_DSPABI_FreeTemplate.
 */
t_cm_error cm_ELF_LoadTemplate(
        t_cm_domain_id          domainId,
        t_elfdescription        *elfhandle,
        t_memory_handle         sharedMemories[NUMBER_OF_MMDSP_MEMORY],
        t_bool                  isSingleton);

/*!
 * \internal
 * \brief Clean cache memory of a component template shared code.
 */
void cm_ELF_FlushTemplate(
        t_nmf_core_id coreId,
        t_memory_handle sharedMemories[NUMBER_OF_MMDSP_MEMORY]);

void cm_ELF_FlushInstance(
        t_nmf_core_id coreId,
        t_memory_handle sharedMemories[NUMBER_OF_MMDSP_MEMORY],
        t_memory_handle privateMemories[NUMBER_OF_MMDSP_MEMORY]);

/*!
 * \internal
 * \brief Load a component instance private memories.
 *
 * \note In case of error, part of memory could have been allocated and must be free by calling cm_DSPABI_FreeInstance.
 */
t_cm_error cm_ELF_LoadInstance(
        t_cm_domain_id          domainId,
        t_elfdescription        *elfhandle,
        t_memory_handle         sharedMemories[NUMBER_OF_MMDSP_MEMORY],
        t_memory_handle         privateMemories[NUMBER_OF_MMDSP_MEMORY],
        t_bool                  isSingleton);

void cm_ELF_FreeInstance(
        t_nmf_core_id coreId,
        t_memory_handle sharedMemories[NUMBER_OF_MMDSP_MEMORY],
        t_memory_handle privateMemories[NUMBER_OF_MMDSP_MEMORY]);
void cm_ELF_FreeTemplate(
        t_nmf_core_id coreId,
        t_memory_handle sharedMemories[NUMBER_OF_MMDSP_MEMORY]);


t_cm_error cm_ELF_relocateSharedSegments(
        t_memory_handle *memories,
        t_elfdescription *elfhandle,
        void                        *cbContext);
t_cm_error cm_ELF_relocatePrivateSegments(
        t_memory_handle *memories,
        t_elfdescription *elfhandle,
        void                        *cbContext);
void cm_ELF_performRelocation(
        t_uint32                    type,
        const char                  *symbol_name,
        t_uint32                    symbol_addr,
        char                        *reloc_addr);
t_cm_error cm_ELF_GetMemory(
        t_elfdescription            *elf,
        t_tmp_elfdescription        *elftmp,
        t_uint32                    address,
        t_memory_purpose            purpose,
        t_memory_reference          *memory);


#include <cm/engine/component/inc/component_type.h>

t_cm_error cm_DSPABI_AddLoadMap(
        t_cm_domain_id domainId,
        const char* templateName,
        const char* localname,
        t_memory_handle *memories,
        void *componentHandle);
t_cm_error cm_DSPABI_RemoveLoadMap(
        t_cm_domain_id domainId,
        const char* templateName,
        t_memory_handle *memories,
        const char* localname,
        void *componentHandle);

#endif