IPC API  3.40.00.06
Data Structures | Macros | Typedefs | Enumerations | Functions
MmRpc.h File Reference

Detailed Description

Multi-Media derived Remote Procedure Call.

Note
MmRpc is currently only available for HLOS (Linux, QNX, Android).
#include <stddef.h>
#include <stdint.h>
Include dependency graph for MmRpc.h:

Go to the source code of this file.

Data Structures

struct  MmRpc_Param
 MmRpc_Param type. More...
 
struct  MmRpc_Xlt
 
struct  MmRpc_FxnCtx
 Function call context structure. More...
 
union  MmRpc_BufDesc
 Memory buffer descriptor. More...
 
struct  MmRpc_Params
 Instance create parameters. More...
 

Macros

#define MmRpc_S_SUCCESS   (0)
 Operation is successful. More...
 
#define MmRpc_E_FAIL   (-1)
 Operation failed. More...
 
#define MmRpc_E_INVALIDPARAM   (-2)
 Invalid parameter type. More...
 
#define MmRpc_E_NOMEM   (-3)
 Memory allocation failed. More...
 
#define MmRpc_E_SYS   (-4)
 A system call failed. More...
 
#define MmRpc_MAX_PARAMS   (10)
 Size of parameter array in function context structure. More...
 
#define MmRpc_MAX_TRANSLATIONS   (1024)
 Maximum size of translation array in function context structure. More...
 
#define MmRpc_OFFSET(base, field)   ((unsigned int)(field)-(unsigned int)(base))
 Macro for computing offset to a field of a structure. More...
 

Typedefs

typedef struct MmRpc_Object * MmRpc_Handle
 MmRpc_Handle type. More...
 

Enumerations

enum  MmRpc_ParamType {
  MmRpc_ParamType_Scalar = 1,
  MmRpc_ParamType_Ptr,
  MmRpc_ParamType_OffPtr,
  MmRpc_ParamType_Elem
}
 MmRpc_ParamType enum. More...
 
enum  MmRpc_BufType {
  MmRpc_BufType_Handle,
  MmRpc_BufType_Ptr
}
 Memory buffer types. More...
 

Functions

int MmRpc_call (MmRpc_Handle handle, MmRpc_FxnCtx *ctx, int32_t *ret)
 Invoke a remote procedure call. More...
 
int MmRpc_create (const char *service, const MmRpc_Params *params, MmRpc_Handle *handlePtr)
 Create an MmRpc instance. More...
 
int MmRpc_delete (MmRpc_Handle *handlePtr)
 Delete an MmRpc instance. More...
 
int MmRpc_release (MmRpc_Handle handle, MmRpc_BufType type, int num, MmRpc_BufDesc *desc)
 Release buffers which were declared in use. More...
 
int MmRpc_use (MmRpc_Handle handle, MmRpc_BufType type, int num, MmRpc_BufDesc *desc)
 Declare the use of the given buffers. More...
 
void MmRpc_Params_init (MmRpc_Params *params)
 Initialize the instance create parameter structure. More...
 

Macro Definition Documentation

#define MmRpc_S_SUCCESS   (0)

Operation is successful.

#define MmRpc_E_FAIL   (-1)

Operation failed.

#define MmRpc_E_INVALIDPARAM   (-2)

Invalid parameter type.

#define MmRpc_E_NOMEM   (-3)

Memory allocation failed.

#define MmRpc_E_SYS   (-4)

A system call failed.

#define MmRpc_MAX_PARAMS   (10)

Size of parameter array in function context structure.

#define MmRpc_MAX_TRANSLATIONS   (1024)

Maximum size of translation array in function context structure.

#define MmRpc_OFFSET (   base,
  field 
)    ((unsigned int)(field)-(unsigned int)(base))

Macro for computing offset to a field of a structure.

1 struct foobar {
2  int a;
3  int *p;
4 };
5 
6 struct foobar *sp = ...;
7 offset = MmRpc_OFFSET(sp, &sp->p);
8 struct foobar st = ...;
9 offset = MmRpc_OFFSET(&st, &st.p);

Typedef Documentation

typedef struct MmRpc_Object* MmRpc_Handle

MmRpc_Handle type.

Enumeration Type Documentation

MmRpc_ParamType enum.

Enumerator
MmRpc_ParamType_Scalar 

pass by value

MmRpc_ParamType_Ptr 

data pointer

MmRpc_ParamType_OffPtr 

buffer at offset in memory block

MmRpc_ParamType_Elem 

array element

Memory buffer types.

Remarks
Not all operating systems support all buffer types.
Enumerator
MmRpc_BufType_Handle 

memory allocator handle

MmRpc_BufType_Ptr 

buffer address

Function Documentation

int MmRpc_call ( MmRpc_Handle  handle,
MmRpc_FxnCtx ctx,
int32_t *  ret 
)

Invoke a remote procedure call.

Parameters
[in]handleMmRpc handle, obtained from MmRpc_create()
[in]ctxContext with which to invoke the remote service
[in,out]retReturn value from the remotely invoked service
Precondition
handle must be a valid handle for the service instance returned by an earlier call to MmRpc_create().
See also
MmRpc_create()
MmRpc_delete()
int MmRpc_create ( const char *  service,
const MmRpc_Params params,
MmRpc_Handle handlePtr 
)

Create an MmRpc instance.

Parameters
[in]serviceName of the service to create
[in]paramsInitialized MmRpc parameters
[in,out]handlePtrSpace to hold the MmRpc handle
Return values
MmRpc_S_SUCCESSOperation is successful.
MmRpc_E_FAILOperation failed.
Remarks
This instantiates an instance of the service on a remote core. Each remote instance consists of a unique thread listening for requests made via a call to MmRpc_call().
int MmRpc_delete ( MmRpc_Handle handlePtr)

Delete an MmRpc instance.

Parameters
[in]handlePtrMmRpc handle, obtained from MmRpc_create()
Precondition
handlePtr must be a valid handle for the service instance returned by an earlier call to MmRpc_create()
See also
MmRpc_create()
int MmRpc_release ( MmRpc_Handle  handle,
MmRpc_BufType  type,
int  num,
MmRpc_BufDesc desc 
)

Release buffers which were declared in use.

Parameters
[in]handleService handle returned by MmRpc_create()
[in]typeBuffer descriptor type
[in]numNumber of elements in desc array
[in]descPointer to array of buffer descriptors
Precondition
handle must be a valid handle for the service instance returned by an earlier call to MmRpc_create().
Remarks
When the remote processor no longer needs a reference to a buffer, calling MmRpc_release() will release the buffer and any associated resources.
Return values
MmRpc_S_SUCCESSOperation is successful.
MmRpc_E_INVALIDPARAMInvalid parameter type.
MmRpc_E_NOMEMMemory allocation failed.
MmRpc_E_SYSA system call failed.
See also
MmRpc_use()
int MmRpc_use ( MmRpc_Handle  handle,
MmRpc_BufType  type,
int  num,
MmRpc_BufDesc desc 
)

Declare the use of the given buffers.

Parameters
[in]handleService handle returned by MmRpc_create()
[in]typeBuffer descriptor type
[in]numNumber of elements in desc array
[in]descPointer to array of buffer descriptors
Precondition
handle must be a valid handle for the service instance returned by an earlier call to MmRpc_create().
Remarks
When using MmRpc_call() to invoke remote function calls, any referenced buffers will be made available to the remote processor only for the duration of the remote function call. If the remote processor maintains a reference to the buffer across multiple invocations of MmRpc_call(), then the application must declare the buffer "in use". This will make the buffer persistent.
The application must release the buffer when it is no longer needed.
1 #include <ti/ipc/mm/MmRpc.h>
2 
3 MmRpc_BufDesc desc[2];
4 
5 desc[0].handle = fd1;
6 desc[1].handle = fd2;
7 
8 MmRpc_use(h, MmRpc_BufType_Handle, 2, desc);
Return values
MmRpc_S_SUCCESSOperation is successful.
MmRpc_E_INVALIDPARAMInvalid parameter type.
MmRpc_E_NOMEMMemory allocation failed.
MmRpc_E_SYSA system call failed.
See also
MmRpc_release()
void MmRpc_Params_init ( MmRpc_Params params)

Initialize the instance create parameter structure.

Copyright 2015, Texas Instruments Incorporated