IPC API  3.40.00.06
MmRpc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2014, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
41 #ifndef ti_ipc_mm_MmRpc__include
42 #define ti_ipc_mm_MmRpc__include
43 
44 /* add includes here */
45 #include <stddef.h>
46 #include <stdint.h>
47 
48 #if defined(__cplusplus)
49 extern "C" {
50 #endif
51 
55 #define MmRpc_S_SUCCESS (0)
56 
60 #define MmRpc_E_FAIL (-1)
61 
65 #define MmRpc_E_INVALIDPARAM (-2)
66 
70 #define MmRpc_E_NOMEM (-3)
71 
75 #define MmRpc_E_SYS (-4)
76 
80 #define MmRpc_MAX_PARAMS (10)
81 
85 #define MmRpc_MAX_TRANSLATIONS (1024)
86 
102 #define MmRpc_OFFSET(base, field) ((unsigned int)(field)-(unsigned int)(base))
103 
107 typedef struct MmRpc_Object *MmRpc_Handle;
108 
112 typedef enum {
118 
122 typedef struct {
125  union {
126  struct {
127  size_t size;
128  size_t data;
129  } scalar;
130 
131  struct {
132  size_t size;
133  size_t addr;
134  size_t handle;
135  } ptr;
136 
137  struct {
138  size_t size;
139  size_t base;
140  size_t offset;
141  size_t handle;
142  } offPtr;
143 
144  } param;
145 } MmRpc_Param;
146 
147 typedef struct {
148  uint32_t index;
149  ptrdiff_t offset;
156  size_t base;
164  size_t handle;
165 } MmRpc_Xlt;
166 
170 typedef struct {
171  uint32_t fxn_id;
172  uint32_t num_params;
175  uint32_t num_xlts;
177 } MmRpc_FxnCtx;
178 
184 typedef enum {
187 } MmRpc_BufType;
188 
192 typedef union {
193  size_t handle;
195  struct {
196  size_t addr;
197  size_t size;
198  } ptr;
199 
200 } MmRpc_BufDesc;
201 
205 typedef struct {
206  int reserved;
207 } MmRpc_Params;
208 
222 int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret);
223 
238 int MmRpc_create(const char *service, const MmRpc_Params *params,
239  MmRpc_Handle *handlePtr);
240 
251 int MmRpc_delete(MmRpc_Handle *handlePtr);
252 
275 int MmRpc_release(MmRpc_Handle handle, MmRpc_BufType type, int num,
276  MmRpc_BufDesc *desc);
277 
318 int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num,
319  MmRpc_BufDesc *desc);
320 
325 void MmRpc_Params_init(MmRpc_Params *params);
326 
327 
328 #if defined(__cplusplus)
329 }
330 #endif
331 #endif /* ti_ipc_mm_MmRpc__include */
size_t addr
Definition: MmRpc.h:196
int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num, MmRpc_BufDesc *desc)
Declare the use of the given buffers.
struct MmRpc_Object * MmRpc_Handle
MmRpc_Handle type.
Definition: MmRpc.h:107
size_t handle
Definition: MmRpc.h:164
void MmRpc_Params_init(MmRpc_Params *params)
Initialize the instance create parameter structure.
size_t data
Definition: MmRpc.h:128
Definition: MmRpc.h:147
MmRpc_ParamType type
Definition: MmRpc.h:123
Definition: MmRpc.h:115
size_t handle
Definition: MmRpc.h:193
MmRpc_Param type.
Definition: MmRpc.h:122
Function call context structure.
Definition: MmRpc.h:170
Definition: MmRpc.h:185
Definition: MmRpc.h:114
size_t base
Definition: MmRpc.h:156
Memory buffer descriptor.
Definition: MmRpc.h:192
size_t base
Definition: MmRpc.h:139
int MmRpc_create(const char *service, const MmRpc_Params *params, MmRpc_Handle *handlePtr)
Create an MmRpc instance.
int MmRpc_call(MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
Invoke a remote procedure call.
Definition: MmRpc.h:116
size_t handle
Definition: MmRpc.h:134
Instance create parameters.
Definition: MmRpc.h:205
#define MmRpc_MAX_PARAMS
Size of parameter array in function context structure.
Definition: MmRpc.h:80
int MmRpc_release(MmRpc_Handle handle, MmRpc_BufType type, int num, MmRpc_BufDesc *desc)
Release buffers which were declared in use.
MmRpc_ParamType
MmRpc_ParamType enum.
Definition: MmRpc.h:112
size_t size
Definition: MmRpc.h:127
uint32_t num_params
Definition: MmRpc.h:172
size_t addr
Definition: MmRpc.h:133
uint32_t num_xlts
Definition: MmRpc.h:175
MmRpc_Xlt * xltAry
Definition: MmRpc.h:176
MmRpc_BufType
Memory buffer types.
Definition: MmRpc.h:184
size_t offset
Definition: MmRpc.h:140
uint32_t fxn_id
Definition: MmRpc.h:171
Definition: MmRpc.h:186
int reserved
Definition: MmRpc.h:206
ptrdiff_t offset
Definition: MmRpc.h:149
size_t size
Definition: MmRpc.h:197
Definition: MmRpc.h:113
uint32_t index
Definition: MmRpc.h:148
int MmRpc_delete(MmRpc_Handle *handlePtr)
Delete an MmRpc instance.
Copyright 2015, Texas Instruments Incorporated