summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e01d168)
raw | patch | inline | side by side (parent: e01d168)
author | vwan@ti.com <vwan@ti.com> | |
Fri, 20 Jun 2014 17:24:48 +0000 (10:24 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Fri, 20 Jun 2014 22:43:06 +0000 (15:43 -0700) |
This commit adds the MmRpc_getId API on host to return a unique id for
each MmRpc instance of a service. This id is passed to the cleanup function
registered in the newly introduced MmServiceMgr_register2() so that it can
clean up after a given MmRpc instance.
This commit addresses SDOCM00108138
Signed-off-by: VW <vwan@ti.com>
each MmRpc instance of a service. This id is passed to the cleanup function
registered in the newly introduced MmServiceMgr_register2() so that it can
clean up after a given MmRpc instance.
This commit addresses SDOCM00108138
Signed-off-by: VW <vwan@ti.com>
index 0256c67b04051ca0966d6b91a10362bec1c92ff1..9474875cd14c3cc1efb940df3c3834a3be6d13c0 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
return(stat);
}
+#if defined(SYSLINK_BUILDOS_QNX)
+/*
+ * ======== MmRcp_getId ========
+ */
+uint32_t MmRpc_getId(MmRpc_Handle handle)
+{
+ MmRpc_Object *obj = (MmRpc_Object *)handle;
+
+ return obj->connect.id;
+}
+#endif
+
#if defined(KERNEL_INSTALL_DIR) || defined(IPC_BUILDOS_ANDROID)
/*
* ======== MmRpc_bufHandle ========
index feee339acb2eea18a3a126ca128f414d4209b516..88d1973496ee0a59dc21a4f2a221682e56d6010a 100644 (file)
int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num,
MmRpc_BufDesc *desc);
+/*!
+ * @brief Get the id of an MmRpc instance
+ * (currently only supported in QNX)
+ *
+ * @param[in] handle Service handle returned by MmRpc_create()
+ *
+ * @retval 32-bit id corresponding to the MmRpc instance
+ *
+ * @remark This returns the id corresponding to the MmRpc instance.
+ * This id can be used to identify the MmRpc instance
+ * on the slave core during instance deletion.
+ */
+uint32_t MmRpc_getId(MmRpc_Handle handle);
+
/*!
* @brief Initialize the instance create parameter structure
*
index 8e55a3dd1db320d464212afe1b2ee1288a4fe7d6..94207ed3bf5699a242fae0b00c784f2eb41f998d 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Int MmServiceMgr_register(const String name, RcmServer_Params *rcmParams,
MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn delFxn)
{
-#if 1
Int status = MmServiceMgr_S_SUCCESS;
OmapRpc_Handle handle;
}
return(status);
-#else
- Int status = MmServiceMgr_S_SUCCESS;
- MmServiceMgr_Client *obj;
- RcmServer_FxnDesc *fxnAry;
- Int func;
-
- System_printf("MmServiceMgr_register: -->\n");
-
- obj = Memory_calloc(NULL, sizeof(MmServiceMgr_Client), 0, NULL);
-
- if (obj == NULL) {
- System_printf("MmServiceMgr_register: Error: out of memory\n");
- status = MmServiceMgr_E_FAIL;
- goto leave;
- }
-
- /* Temporary: make a local copy of server create params in order
- * to add one more function to the function table. Will be removed.
- */
- memcpy(&obj->rcmParams, rcmParams, sizeof(RcmServer_Params));
- obj->rcmParams.fxns.length = rcmParams->fxns.length + 1;
-
- obj->rcmParams.fxns.elem = Memory_calloc(NULL, obj->rcmParams.fxns.length *
- sizeof(RcmServer_FxnDesc), 0, NULL);
-
- if (obj->rcmParams.fxns.elem == NULL) {
- System_printf("MmServiceMgr_register: Error: out of memory\n");
- status = MmServiceMgr_E_FAIL;
- goto leave;
- }
-
- /* Temporary: make a local copy of signature array in order
- * to add the "first function" signature. Will be removed.
- */
- obj->aryLen = aryLen + 1;
-
- obj->sigAry = Memory_calloc(NULL, obj->aryLen *
- sizeof(OmapRpc_FuncSignature), 0, NULL);
-
- if (obj->sigAry == NULL) {
- System_printf("MmServiceMgr_register: Error: out of memory\n");
- status = MmServiceMgr_E_FAIL;
- goto leave;
- }
-
- /* Temporary: insert the "first function" in slot 0, then copy
- * in the caller's functions. Eventually, the create function will be
- * removed.
- */
- obj->rcmParams.fxns.elem[0].name =
- OmapRpc_Stringerize(OmapRpc_GetSvrMgrHandle);
- obj->rcmParams.fxns.elem[0].addr.createFxn =
- (RcmServer_MsgCreateFxn)OmapRpc_GetSvrMgrHandle;
- strncpy(obj->sigAry[0].name, obj->rcmParams.fxns.elem[0].name,
- OMAPRPC_MAX_CHANNEL_NAMELEN);
- obj->sigAry[0].numParam = 0;
-
- fxnAry = rcmParams->fxns.elem;
-
- for (func = 0; func < rcmParams->fxns.length; func++) {
- obj->rcmParams.fxns.elem[func+1].name = fxnAry[func].name;
- obj->rcmParams.fxns.elem[func+1].addr.fxn = fxnAry[func].addr.fxn;
-
- memcpy(&obj->sigAry[func+1], &sigAry[func],
- sizeof(OmapRpc_FuncSignature));
- }
-
- if (!ServiceMgr_register(name, &obj->rcmParams)) {
- System_printf("MmServiceMgr_register: Error: service register failed, "
- "status=%d\n");
- status = MmServiceMgr_E_FAIL;
- goto leave;
- }
-
-leave:
- if (status < 0) {
- if ((obj != NULL) && (obj->sigAry != NULL)) {
- Memory_free(NULL, obj->sigAry,
- obj->aryLen * sizeof(OmapRpc_FuncDeclaration));
- }
- if ((obj != NULL) && (obj->rcmParams.fxns.elem != NULL)) {
- Memory_free(NULL, obj->rcmParams.fxns.elem,
- obj->rcmParams.fxns.length * sizeof(RcmServer_FxnDesc));
- }
- if (obj != NULL) {
- Memory_free(NULL, obj, sizeof(MmServiceMgr_Client));
- }
- }
-
- System_printf("MmServiceMgr_register: <--, status=%d\n", status);
- return(status);
-#endif
}
-#if 0
+
/*
- * ======== MmServiceMgr_start ========
+ * ======== MmServiceMgr_register2 ========
*/
-Int MmServiceMgr_start(const String name, Int aryLen,
- OmapRpc_FuncSignature *sigAry)
+Int MmServiceMgr_register2(const String name, RcmServer_Params *rcmParams,
+ MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn2 delFxn)
{
- extern Int OmapRpc_start(const String name, Int port, Int aryLen,
- OmapRpc_FuncSignature *sigAry);
-
Int status = MmServiceMgr_S_SUCCESS;
+ OmapRpc_Handle handle;
+
+ handle = OmapRpc_createChannel2(name, MultiProc_getId("HOST"),
+ MmServiceMgr_PORT, rcmParams, fxnSigTab, delFxn);
- OmapRpc_start(name, MmServiceMgr_PORT, aryLen, sigAry);
+ if (handle == NULL) {
+ status = MmServiceMgr_E_FAIL;
+ }
return(status);
}
-#endif
index 813b03170c41699cfe6e81a8d75d83a3d5378364..f0a7b5b6a1f38329ac40f07ec07ec21caecc6727 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#define MmServiceMgr_E_FAIL (-1)
typedef Void (*MmServiceMgr_DelFxn)(Void);
-
+typedef Void (*MmServiceMgr_DelFxn2)(UInt32);
/*!
* @brief Initialize the MmServiceMgr module
Int MmServiceMgr_register(const String name, RcmServer_Params *params,
MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn delFxn);
+/*!
+ * @brief Register a new service, when using MmServiceMgr_DelFxn2
+ * as delete function type
+ *
+ */
+Int MmServiceMgr_register2(const String name, RcmServer_Params *params,
+ MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn2 delFxn);
+
/*! @cond */
/*!
* @brief Start the service manager listener task
index 190eb84f5bbeee4f4ae221f60333e3e2537f620a..cf5f06f052c6af257c929e71660bddd5beccc75f 100644 (file)
static RcmServer_Params rpc_Params;
-Void RPC_SKEL_SrvDelNotification(Void)
+Void RPC_SKEL_SrvDelNotification(Uint32 id)
{
- System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup\n");
+ System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup for "
+ "MmRpc instance id=%d\n", id);
}
static Int32 RPC_SKEL_Init2(UInt32 size, UInt32 *data)
MultiProc_self());
/* register an example service */
- status = MmServiceMgr_register(mMServerName, &rpc_Params, &rpc_fxnSigTab,
+ status = MmServiceMgr_register2(mMServerName, &rpc_Params, &rpc_fxnSigTab,
RPC_SKEL_SrvDelNotification);
if (status < 0) {
index 41e1fa7d8362067445313330c1332ba22f95e327..65c585accfee43cb08664246df0d875b5f46fb40 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "OmapRpc.h"
typedef struct OmapRpc_Object {
- Char channelName[OMAPRPC_MAX_CHANNEL_NAMELEN];
- UInt16 dstProc;
- UInt32 port;
- RPMessage_Handle msgq;
- UInt32 localEndPt;
- Task_Handle taskHandle;
- Bool shutdown;
- Semaphore_Handle exitSem;
- OmapRpc_SrvDelNotifyFxn srvDelCB;
- RcmServer_Params rcmParams;
- UInt32 numFuncs;
- OmapRpc_FuncSignature *funcSigs;
+ Char channelName[OMAPRPC_MAX_CHANNEL_NAMELEN];
+ UInt16 dstProc;
+ UInt32 port;
+ RPMessage_Handle msgq;
+ UInt32 localEndPt;
+ Task_Handle taskHandle;
+ Bool shutdown;
+ Semaphore_Handle exitSem;
+ OmapRpc_SrvDelNotifyFxn srvDelCB;
+ OmapRpc_SrvDelNotifyFxn2 srvDelCB2;
+ RcmServer_Params rcmParams;
+ UInt32 numFuncs;
+ OmapRpc_FuncSignature *funcSigs;
} OmapRpc_Object;
+static OmapRpc_Handle _OmapRpc_createChannel(String channelName, UInt16 dstProc,
+ UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab);
+
Int32 OmapRpc_GetSvrMgrHandle(Void *srvc, Int32 num, Int32 *params)
{
System_printf("OMAPRPC: Calling RCM Service Manager Create Function!\n");
if (obj->srvDelCB != NULL) {
obj->srvDelCB();
}
+ else if (obj->srvDelCB2 != NULL) {
+ obj->srvDelCB2(handle->endpointAddress);
+ }
/* don't clear out the old data... */
System_printf("OMAPRPC: destroying instance addr: %d\n",
/*
* ======== OmapRpc_createChannel ========
*/
-#if 0
-OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
- UInt32 port, UInt32 numFuncs, OmapRpc_FuncDeclaration *fxns,
- OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
-#else
OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
-#endif
+{
+ OmapRpc_Object * obj;
+
+ obj = _OmapRpc_createChannel(channelName, dstProc, port, rcmParams,
+ fxnSigTab);
+ if (obj != NULL) {
+ obj->srvDelCB = srvDelCBFunc;
+ }
+
+ return (obj);
+}
+
+/*
+ * ======== OmapRpc_createChannel2 ========
+ */
+OmapRpc_Handle OmapRpc_createChannel2(String channelName, UInt16 dstProc,
+ UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
+ OmapRpc_SrvDelNotifyFxn2 srvDelCBFunc2)
+{
+ OmapRpc_Object * obj;
+
+ obj = _OmapRpc_createChannel(channelName, dstProc, port, rcmParams,
+ fxnSigTab);
+ if (obj != NULL) {
+ obj->srvDelCB2 = srvDelCBFunc2;
+ }
+
+ return (obj);
+}
+
+
+/*
+ * ======== _OmapRpc_createChannel ========
+ */
+static OmapRpc_Handle _OmapRpc_createChannel(String channelName, UInt16 dstProc,
+ UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab)
{
Task_Params taskParams;
UInt32 func;
obj->port = port;
strncpy(obj->channelName, channelName, OMAPRPC_MAX_CHANNEL_NAMELEN-1);
obj->channelName[OMAPRPC_MAX_CHANNEL_NAMELEN-1]='\0';
- obj->srvDelCB = srvDelCBFunc;
obj->funcSigs = Memory_alloc(NULL, obj->numFuncs *
sizeof(OmapRpc_FuncSignature), 0, NULL);
index c39a1e74f17fcaced1465adfbad7b5ea938129eb..3491693ef859292a6d42bb8284083cf8678a78a8 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014, Texas Instruments Incorporated
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
typedef struct OmapRpc_CreateInstance {
Char name[OMAPRPC_MAX_INST_NAMELEN];
+ UInt32 id;
} OmapRpc_CreateInstance;
typedef struct OmapRpc_ChannelInfo {
typedef struct OmapRpc_Object *OmapRpc_Handle;
typedef Void (*OmapRpc_SrvDelNotifyFxn)(Void);
+typedef Void (*OmapRpc_SrvDelNotifyFxn2)(UInt32);
-#if 0
-OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
- UInt32 port, UInt32 numFuncs, OmapRpc_FuncDeclaration* fxns,
- OmapRpc_SrvDelNotifyFxn func);
-#else
OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
OmapRpc_SrvDelNotifyFxn srvDelCBFunc);
-#endif
+
+/*
+ * OmapRpc_createChannel2
+ * Same as OmapRpc_createChannel but with OmapRpc_SrvDelNotifyFxn2
+ */
+OmapRpc_Handle OmapRpc_createChannel2(String channelName, UInt16 dstProc,
+ UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
+ OmapRpc_SrvDelNotifyFxn2 srvDelCBFunc);
Int OmapRpc_deleteChannel(OmapRpc_Handle handle);
diff --git a/qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h b/qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h
index e37c74f0ab0817c8498c1cfcbe43ee42e5792987..f17468f5fc8a25951f4845719ed03c687d5862aa 100644 (file)
/*
* Remote Processor Procedure Call Driver
*
- * Copyright(c) 2012-2013 Texas Instruments. All rights reserved.
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated.
+ * All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/*
* ioctl definitions
*/
-#define RPPC_IOC_MAGIC 'r'
-#define RPPC_IOC_CREATE _IOW(RPPC_IOC_MAGIC, 1, struct rppc_create_instance)
+#define RPPC_IOC_MAGIC 'r'
+#define RPPC_IOC_CREATE _IOWR(RPPC_IOC_MAGIC, 1, struct rppc_create_instance)
#define RPPC_IOC_BUFREGISTER _IOW(RPPC_IOC_MAGIC, 2, struct rppc_buf_fds)
#define RPPC_IOC_BUFUNREGISTER _IOW(RPPC_IOC_MAGIC, 3, struct rppc_buf_fds)
-#define RPPC_IOC_MAXNR (4)
+#define RPPC_IOC_MAXNR (4)
#define RPPC_MAX_PARAMETERS (10)
#define RPPC_MAX_TRANSLATIONS (1024)
//#ifdef __KERNEL__
-#define RPPC_MAX_NUM_FUNCS (1024)
-#define RPPC_MAX_CHANNEL_NAMELEN (64)
-#define RPPC_MAX_FUNC_NAMELEN (64)
-#define RPPC_MAX_NUM_PARAMS (10)
-#define RPPC_MAX_INST_NAMELEN (48)
+#define RPPC_MAX_NUM_FUNCS (1024)
+#define RPPC_MAX_CHANNEL_NAMELEN (64)
+#define RPPC_MAX_FUNC_NAMELEN (64)
+#define RPPC_MAX_NUM_PARAMS (10)
+#define RPPC_MAX_INST_NAMELEN (48)
/* Added below definition for use with CREATE ioctl in QNX */
struct rppc_create_instance {
- char name[RPPC_MAX_CHANNEL_NAMELEN];
+ char name[RPPC_MAX_CHANNEL_NAMELEN];
+ uint32_t id; /* id for this instance */
};
/**
diff --git a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c
index 28432a8b8a31aa122bb5976b0512d453bc903e36..8d8806badd07de22ededb47809050e65c927510c 100644 (file)
/*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2014, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -669,7 +669,9 @@ _rpmsg_rpc_create(resmgr_context_t *ctp, io_devctl_t *msg, rpmsg_rpc_ocb_t *ocb)
{
Int status = EOK;
struct rppc_create_instance * cargs =
- (struct rppc_create_instance *)(_DEVCTL_DATA (msg->i));
+ (struct rppc_create_instance *)(_DEVCTL_DATA (msg->i));
+ struct rppc_create_instance * out =
+ (struct rppc_create_instance *) (_DEVCTL_DATA (msg->o));
struct rppc_msg_header * msg_hdr = NULL;
rpmsg_rpc_object * rpc = ocb->rpc;
Char * msg_data = NULL;
@@ -708,7 +710,10 @@ _rpmsg_rpc_create(resmgr_context_t *ctp, io_devctl_t *msg, rpmsg_rpc_ocb_t *ocb)
status = OsalSemaphore_pend(rpmsg_rpc_state.sem, 5000);
if (rpc->created == TRUE) {
msg->o.ret_val = EOK;
- status = (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
+ /* Use the remote endpoint address to identify this instance */
+ out->id = rpc->remoteAddr;
+ status = (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o) +
+ sizeof(struct rppc_create_instance)));
}
else if (status < 0) {
GT_0trace(curTrace, GT_4CLASS, "Semaphore pend failed.");