]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/commitdiff
Add MmServiceMgr_getId() to allow retrieval of service instance id 3.22 ipc-3.22-next 3.22.02.10_eng 3.22.02.11
authorvwan@ti.com <vwan@ti.com>
Wed, 16 Jul 2014 01:08:45 +0000 (18:08 -0700)
committerChris Ring <cring@ti.com>
Wed, 16 Jul 2014 01:38:36 +0000 (18:38 -0700)
This commit adds MmServiceMgr_getId() to allow skeleton functions and service
deletion functions to retrieve the instance id it is acting upon. It also
reverts previous support for MmRpc_getId() and MmServiceMgr_register2.

Signed-off-by: VW <vwan@ti.com>
packages/ti/grcm/RcmServer.c
packages/ti/ipc/mm/MmRpc.c
packages/ti/ipc/mm/MmRpc.h
packages/ti/ipc/mm/MmServiceMgr.c
packages/ti/ipc/mm/MmServiceMgr.h
packages/ti/ipc/tests/rpc_task.c
packages/ti/srvmgr/omaprpc/OmapRpc.c
packages/ti/srvmgr/omaprpc/OmapRpc.h
qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h
qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c

index e668738db7d83761ee51edd2374405570f9b2457..9a4031910add2e8f1510c4791bab42af566a91ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2013, Texas Instruments Incorporated
+ * Copyright (c) 2011-2014, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -58,6 +58,8 @@
 #include <xdc/runtime/knl/Thread.h>
 #include <xdc/runtime/System.h>
 
+#include <ti/sysbios/knl/Task.h>
+
 #define MSGBUFFERSIZE    512   /* Make global and move to RPMessage.h */
 
 #if defined(RCM_ti_ipc)
@@ -1527,6 +1529,7 @@ Int RcmServer_execMsg_I(RcmServer_Object *obj, RcmClient_Message *msg)
         System_printf("RcmServer_execMsg_I: Calling fxnIdx: %d\n",
                       (msg->fxnIdx & 0x0000FFFF));
 #endif
+        Task_setEnv(Task_self(), (Ptr)RcmServer_getLocalAddress(obj));
 #if USE_RPMESSAGE
         if (createFxn)  {
             msg->result = (*createFxn)(obj, msg->dataSize, msg->data);
@@ -1537,6 +1540,7 @@ Int RcmServer_execMsg_I(RcmServer_Object *obj, RcmClient_Message *msg)
 #else
         msg->result = (*fxn)(msg->dataSize, msg->data);
 #endif
+        Task_setEnv(Task_self(), NULL);
     }
 
     return(status);
index 9474875cd14c3cc1efb940df3c3834a3be6d13c0..ac932193db20f16310dfd0bbb3f9e262d6d4b756 100644 (file)
@@ -354,18 +354,6 @@ int MmRpc_use(MmRpc_Handle handle, MmRpc_BufType type, int num,
     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 88d1973496ee0a59dc21a4f2a221682e56d6010a..feee339acb2eea18a3a126ca128f414d4209b516 100644 (file)
@@ -318,20 +318,6 @@ int MmRpc_release(MmRpc_Handle handle, MmRpc_BufType type, int num,
 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 94207ed3bf5699a242fae0b00c784f2eb41f998d..de2d7b8db53a2ef47c9db67c9760d95d6515469f 100644 (file)
@@ -107,22 +107,11 @@ Int MmServiceMgr_register(const String name, RcmServer_Params *rcmParams,
     return(status);
 }
 
-
 /*
- *  ======== MmServiceMgr_register2 ========
+ *  ======== MmServiceMgr_getId ========
  */
-Int MmServiceMgr_register2(const String name, RcmServer_Params *rcmParams,
-        MmType_FxnSigTab *fxnSigTab, MmServiceMgr_DelFxn2 delFxn)
+UInt32 MmServiceMgr_getId()
 {
-    Int status = MmServiceMgr_S_SUCCESS;
-    OmapRpc_Handle handle;
-
-    handle = OmapRpc_createChannel2(name, MultiProc_getId("HOST"),
-            MmServiceMgr_PORT, rcmParams, fxnSigTab, delFxn);
-
-    if (handle == NULL) {
-        status = MmServiceMgr_E_FAIL;
-    }
-
-    return(status);
+    /* The id has been stashed onto the task environment */
+    return ((UInt32)Task_getEnv(Task_self()));
 }
index f0a7b5b6a1f38329ac40f07ec07ec21caecc6727..c5af4a106f9a0efef687988b0778084423ade903 100644 (file)
@@ -62,7 +62,6 @@ extern "C" {
 #define MmServiceMgr_E_FAIL (-1)
 
 typedef Void (*MmServiceMgr_DelFxn)(Void);
-typedef Void (*MmServiceMgr_DelFxn2)(UInt32);
 
 /*!
  *  @brief      Initialize the MmServiceMgr module
@@ -83,14 +82,6 @@ Void MmServiceMgr_exit(Void);
 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
@@ -100,6 +91,14 @@ Int MmServiceMgr_start(const String name, Int aryLen,
         OmapRpc_FuncSignature *sigAry);
 /*! @endcond */
 
+/*!
+ *  @brief      Get the ID of the current service instance
+ *              This function can only be called in the context of skeleton
+ *              functions or service deletion function registered for
+ *              a service.
+ *
+ */
+UInt32 MmServiceMgr_getId();
 
 #if defined (__cplusplus)
 }
index cf5f06f052c6af257c929e71660bddd5beccc75f..33425a113eff1d7ba4bebadc3b141bdf33b708bb 100644 (file)
@@ -146,10 +146,10 @@ static MmType_FxnSigTab rpc_fxnSigTab = {
 static RcmServer_Params rpc_Params;
 
 
-Void RPC_SKEL_SrvDelNotification(Uint32 id)
+Void RPC_SKEL_SrvDelNotification(Void)
 {
     System_printf("RPC_SKEL_SrvDelNotification: Nothing to cleanup for "
-        "MmRpc instance id=%d\n", id);
+        "MmRpc instance id=%d\n", MmServiceMgr_getId());
 }
 
 static Int32 RPC_SKEL_Init2(UInt32 size, UInt32 *data)
@@ -372,7 +372,7 @@ void register_MxServer(void)
                    MultiProc_self());
 
     /* register an example service */
-    status = MmServiceMgr_register2(mMServerName, &rpc_Params, &rpc_fxnSigTab,
+    status = MmServiceMgr_register(mMServerName, &rpc_Params, &rpc_fxnSigTab,
             RPC_SKEL_SrvDelNotification);
 
     if (status < 0) {
index 65c585accfee43cb08664246df0d875b5f46fb40..441d031fbdd0316737ef408796dc08255efb1b86 100644 (file)
@@ -62,15 +62,11 @@ typedef struct OmapRpc_Object {
     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");
@@ -168,12 +164,14 @@ static Void omapRpcTask(UArg arg0, UArg arg1)
                 OmapRpc_InstanceHandle *handle =
                                 OmapRpc_PAYLOAD(msg, OmapRpc_InstanceHandle);
 
+                /* Stash away endpointAddress for MmServiceMgr_getId to work */
+                Task_setEnv(Task_self(), (Ptr)handle->endpointAddress);
+
                 if (obj->srvDelCB != NULL) {
                     obj->srvDelCB();
                 }
-                else if (obj->srvDelCB2 != NULL) {
-                    obj->srvDelCB2(handle->endpointAddress);
-                }
+
+                Task_setEnv(Task_self(), NULL);
 
                 /* don't clear out the old data... */
                 System_printf("OMAPRPC: destroying instance addr: %d\n",
@@ -270,42 +268,6 @@ static Void omapRpcTask(UArg arg0, UArg arg1)
 OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
         UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
         OmapRpc_SrvDelNotifyFxn srvDelCBFunc)
-{
-    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;
@@ -348,6 +310,7 @@ static OmapRpc_Handle _OmapRpc_createChannel(String channelName, UInt16 dstProc,
     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 3491693ef859292a6d42bb8284083cf8678a78a8..7cb8e48b3aa0db5de0eb833230ad3e47fa9d8c1e 100644 (file)
@@ -157,7 +157,6 @@ typedef enum OmapRpc_ErrorType {
 
 typedef struct OmapRpc_CreateInstance {
     Char name[OMAPRPC_MAX_INST_NAMELEN];
-    UInt32 id;
 } OmapRpc_CreateInstance;
 
 typedef struct OmapRpc_ChannelInfo {
@@ -275,20 +274,11 @@ typedef struct OmapRpc_FuncDeclaration {
 
 typedef struct OmapRpc_Object *OmapRpc_Handle;
 typedef Void (*OmapRpc_SrvDelNotifyFxn)(Void);
-typedef Void (*OmapRpc_SrvDelNotifyFxn2)(UInt32);
 
 OmapRpc_Handle OmapRpc_createChannel(String channelName, UInt16 dstProc,
         UInt32 port, RcmServer_Params *rcmParams, MmType_FxnSigTab *fxnSigTab,
         OmapRpc_SrvDelNotifyFxn srvDelCBFunc);
 
-/*
- * 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);
 
 
index f17468f5fc8a25951f4845719ed03c687d5862aa..f6aac38d198f2b649f164558272da30fefe73085 100644 (file)
@@ -55,7 +55,7 @@ struct rppc_buf_fds {
  * ioctl definitions
  */
 #define RPPC_IOC_MAGIC    'r'
-#define RPPC_IOC_CREATE   _IOWR(RPPC_IOC_MAGIC, 1, struct rppc_create_instance)
+#define RPPC_IOC_CREATE   _IOW(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)
@@ -215,7 +215,6 @@ struct rppc_packet {
 /* Added below definition for use with CREATE ioctl in QNX */
 struct rppc_create_instance {
     char name[RPPC_MAX_CHANNEL_NAMELEN];
-    uint32_t  id;  /* id for this instance */
 };
 
 /**
index 8d8806badd07de22ededb47809050e65c927510c..19403fcc4a2410923fd8aa7049355cb56f500a4a 100644 (file)
@@ -670,8 +670,6 @@ _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 * 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;
@@ -710,10 +708,7 @@ _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;
-                /* 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)));
+                status = (_RESMGR_PTR(ctp, &msg->o, sizeof(msg->o)));
             }
             else if (status < 0) {
                 GT_0trace(curTrace, GT_4CLASS, "Semaphore pend failed.");