diff options
author | vwan@ti.com <vwan@ti.com> | 2014-07-15 18:08:45 -0700 |
---|---|---|
committer | Chris Ring <cring@ti.com> | 2014-07-15 18:38:36 -0700 |
commit | d8683f8d4897f8b60f8deab2f1d68e1664619676 (patch) | |
tree | 3bf322b93b829f16df47c1fb7c6be14360e2c2cc | |
parent | 80a025d28016bf9974a653eb0ed96161963674e2 (diff) | |
download | ipc-3.22.tar.gz |
Add MmServiceMgr_getId() to allow retrieval of service instance id3.22.02.113.22.02.10_engipc-3.22-next3.22
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>
-rw-r--r-- | packages/ti/grcm/RcmServer.c | 6 | ||||
-rw-r--r-- | packages/ti/ipc/mm/MmRpc.c | 12 | ||||
-rw-r--r-- | packages/ti/ipc/mm/MmRpc.h | 14 | ||||
-rw-r--r-- | packages/ti/ipc/mm/MmServiceMgr.c | 19 | ||||
-rw-r--r-- | packages/ti/ipc/mm/MmServiceMgr.h | 17 | ||||
-rw-r--r-- | packages/ti/ipc/tests/rpc_task.c | 6 | ||||
-rw-r--r-- | packages/ti/srvmgr/omaprpc/OmapRpc.c | 49 | ||||
-rw-r--r-- | packages/ti/srvmgr/omaprpc/OmapRpc.h | 10 | ||||
-rw-r--r-- | qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/rpmsg_rpc.h | 3 | ||||
-rw-r--r-- | qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c | 7 |
10 files changed, 28 insertions, 115 deletions
diff --git a/packages/ti/grcm/RcmServer.c b/packages/ti/grcm/RcmServer.c index e668738..9a40319 100644 --- a/packages/ti/grcm/RcmServer.c +++ b/packages/ti/grcm/RcmServer.c @@ -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); diff --git a/packages/ti/ipc/mm/MmRpc.c b/packages/ti/ipc/mm/MmRpc.c index 9474875..ac93219 100644 --- a/packages/ti/ipc/mm/MmRpc.c +++ b/packages/ti/ipc/mm/MmRpc.c @@ -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 ======== diff --git a/packages/ti/ipc/mm/MmRpc.h b/packages/ti/ipc/mm/MmRpc.h index 88d1973..feee339 100644 --- a/packages/ti/ipc/mm/MmRpc.h +++ b/packages/ti/ipc/mm/MmRpc.h @@ -319,20 +319,6 @@ 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 * */ diff --git a/packages/ti/ipc/mm/MmServiceMgr.c b/packages/ti/ipc/mm/MmServiceMgr.c index 94207ed..de2d7b8 100644 --- a/packages/ti/ipc/mm/MmServiceMgr.c +++ b/packages/ti/ipc/mm/MmServiceMgr.c @@ -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())); } diff --git a/packages/ti/ipc/mm/MmServiceMgr.h b/packages/ti/ipc/mm/MmServiceMgr.h index f0a7b5b..c5af4a1 100644 --- a/packages/ti/ipc/mm/MmServiceMgr.h +++ b/packages/ti/ipc/mm/MmServiceMgr.h @@ -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) } diff --git a/packages/ti/ipc/tests/rpc_task.c b/packages/ti/ipc/tests/rpc_task.c index cf5f06f..33425a1 100644 --- a/packages/ti/ipc/tests/rpc_task.c +++ b/packages/ti/ipc/tests/rpc_task.c @@ -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) { diff --git a/packages/ti/srvmgr/omaprpc/OmapRpc.c b/packages/ti/srvmgr/omaprpc/OmapRpc.c index 65c585a..441d031 100644 --- a/packages/ti/srvmgr/omaprpc/OmapRpc.c +++ b/packages/ti/srvmgr/omaprpc/OmapRpc.c @@ -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", @@ -271,42 +269,6 @@ 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); diff --git a/packages/ti/srvmgr/omaprpc/OmapRpc.h b/packages/ti/srvmgr/omaprpc/OmapRpc.h index 3491693..7cb8e48 100644 --- a/packages/ti/srvmgr/omaprpc/OmapRpc.h +++ b/packages/ti/srvmgr/omaprpc/OmapRpc.h @@ -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); 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 f17468f..f6aac38 100644 --- 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 @@ -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 */ }; /** 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 8d8806b..19403fc 100644 --- a/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c +++ b/qnx/src/ipc3x_dev/ti/syslink/rpmsg-rpc/rpmsg-rpc.c @@ -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."); |