QNX IPC: Update MessageQCopy to Add Desc Field in Name Map
authorAngela Stegmaier <angelabaker@ti.com>
Wed, 13 Mar 2013 20:43:45 +0000 (15:43 -0500)
committerAngela Stegmaier <angelabaker@ti.com>
Mon, 18 Mar 2013 22:35:09 +0000 (17:35 -0500)
The BIOS-side NameMap module now sends a new desc field.
MessageQCopy, the module that receives the name map
messages, is updated to take this field into account.

As such, the callback that users of MessageQCopy can
register for notifications of remote core endpoint
creation is updated to give the desc field.  All users
of the MessageQCopy_registerNotify function must
be updated.

Signed-off-by: Angela Stegmaier <angelabaker@ti.com>
qnx/src/ipc3x_dev/ti/syslink/inc/ti/ipc/MessageQCopy.h
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQCopy.c
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/Qnx/MessageQCopyDrv.c
qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/rpmsg.h

index 374dd3ff1bd4a64418b596eae21b45c98df75228..468dc991403656d48272f3a1fd4af25452fc5657 100644 (file)
@@ -350,7 +350,7 @@ Int MessageQCopy_delete (MessageQCopy_Handle * handlePtr);
  */
 Int MessageQCopy_registerNotify (MessageQCopy_Handle handle,
                                  void(* cb)(MessageQCopy_Handle,
-                                            UInt16, UInt32, Bool));
+                                            UInt16, UInt32, Char *, Bool));
 
 /* =============================================================================
  *  MessageQCopy Per-instance Functions
index dd701ac84121fc5ccada522062e1dd926fe31170..54b27cb62fbb84c359ac15008589cf3f68b5a8d3 100644 (file)
@@ -141,6 +141,8 @@ typedef struct MessageQCopy_Object_tag {
     /*!< Address (endpoint) of this MessageQCopy instance */
     Char                name [RPMSG_NAME_SIZE];
     /*!< Name of this MessageQCopy instance (may not be set) */
+    Char                desc [RPMSG_NAME_SIZE];
+    /*!< Desc of this MessageQCopy instance (may not be set) */
     Bool                announce;
     /*!< Flag to indicate if creation/deletion of this instance should be
          announced to the remote cores. */
@@ -148,7 +150,7 @@ typedef struct MessageQCopy_Object_tag {
     /*!< Callback to invoke when a message is received for this addr.  */
     Void              * priv;
     /*!< Private data that is passed to the callback */
-    Void (*notifyCb)(MessageQCopy_Handle, UInt16, UInt32, Bool);
+    Void (*notifyCb)(MessageQCopy_Handle, UInt16, UInt32, Char *, Bool);
     /*!< Optional callback that can be registered to request notification when
          MQCopy objects of the same name are created */
 } MessageQCopy_Object;
@@ -170,7 +172,7 @@ _MessageQCopy_callback_bufReady (VirtQueue_Handle vq, void *arg);
 static
 MessageQCopy_Handle
 _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
-                      String name,
+                      String name, String desc,
                       Void (*cb)(MessageQCopy_Handle,
                                  Void *, Int, Void *, UInt32, UInt16),
                       Void *priv, UInt32 * endpoint);
@@ -732,7 +734,7 @@ MessageQCopy_detach (UInt16 remoteProcId)
 static
 MessageQCopy_Handle
 _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
-           String name,
+           String name, String desc,
            void (*cb)(MessageQCopy_Handle, void *, int, void *, UInt32, UInt16),
            Void *priv, UInt32 * endpoint)
 {
@@ -745,11 +747,12 @@ _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
     MessageQCopy_Handle *       mq              = NULL;
     Bool                        announce        = FALSE;
 
-    GT_4trace (curTrace, GT_ENTER, "_MessageQCopy_create",
-               handle, reserved, name, endpoint);
+    GT_5trace (curTrace, GT_ENTER, "_MessageQCopy_create",
+               handle, reserved, name, desc, endpoint);
 
     GT_assert (curTrace, (endpoint != NULL));
     /* name is optional and may be NULL. */
+    /* desc is optional and may be NULL. */
     /* handle is optional and may be NULL. */
 
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
@@ -785,6 +788,16 @@ _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
                              status,
                              "Invalid name argument provided");
     }
+    else if (desc && String_nlen(desc, RPMSG_NAME_SIZE - 1) == -1) {
+        /*! @retval  MessageQCopy_E_INVALIDARG Invalid name argument
+                                         provided. */
+        status = MessageQCopy_E_INVALIDARG;
+        GT_setFailureReason (curTrace,
+                             GT_4CLASS,
+                             "_MessageQCopy_create",
+                             status,
+                             "Invalid desc argument provided");
+    }
     else {
 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
         if (handle == NULL) {
@@ -830,6 +843,11 @@ _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
                 }
                 else
                     obj->name[0] = '\0';
+                if (desc) {
+                    String_cpy (obj->desc, desc);
+                }
+                else
+                    obj->desc[0] = '\0';
 
                 mq[queueIndex] = obj;
 
@@ -842,6 +860,10 @@ _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
                     msg.addr = obj->addr;
                     msg.flags = RPMSG_NS_CREATE;
                     String_ncpy (msg.name, obj->name, RPMSG_NAME_SIZE);
+                    if (obj->desc)
+                        String_ncpy (msg.desc, obj->desc, RPMSG_NAME_SIZE);
+                    else
+                        msg.desc[0] = '\0';
 
                     /* Send to all procs */
                     for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
@@ -879,6 +901,7 @@ _MessageQCopy_create (MessageQCopyTransport_Handle handle, UInt32 reserved,
                                                      MessageQCopy_module->mq[i],
                                                      obj->procId,
                                                      obj->addr,
+                                                     obj->desc,
                                                      TRUE);
                             }
                         }
@@ -941,7 +964,8 @@ MessageQCopy_create (UInt32 reserved, String name,
     else {
 #endif /* if !defined(SYSLINK_BUILD_OPTIMIZE) */
 
-        obj = _MessageQCopy_create (NULL, reserved, name, cb, priv, endpoint);
+        obj = _MessageQCopy_create (NULL, reserved, name, NULL, cb, priv,
+                                    endpoint);
 
 #if !defined(SYSLINK_BUILD_OPTIMIZE)
         if (obj == NULL) {
@@ -1048,6 +1072,10 @@ MessageQCopy_delete (      MessageQCopy_Handle * handlePtr)
                 msg.addr = obj->addr;
                 msg.flags = RPMSG_NS_DESTROY;
                 String_ncpy(msg.name, obj->name, RPMSG_NAME_SIZE);
+                if (obj->desc)
+                    String_ncpy(msg.desc, obj->desc, RPMSG_NAME_SIZE);
+                else
+                    msg.desc[0] = '\0';
 
                 /* Send to all procs */
                 for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
@@ -1082,6 +1110,7 @@ MessageQCopy_delete (      MessageQCopy_Handle * handlePtr)
                                                      MessageQCopy_module->mq[i],
                                                      obj->procId,
                                                      obj->addr,
+                                                     obj->desc,
                                                      FALSE);
                         }
                     }
@@ -1121,7 +1150,7 @@ MessageQCopy_delete (      MessageQCopy_Handle * handlePtr)
 /* Register to be notified of a MQ created on the remote core. */
 Int
 MessageQCopy_registerNotify (MessageQCopy_Handle handle,
-                          Void (*cb)(MessageQCopy_Handle, UInt16, UInt32, Bool))
+                  Void (*cb)(MessageQCopy_Handle, UInt16, UInt32, Char *, Bool))
 {
     Int32                               status      = MessageQCopy_S_SUCCESS;
     MessageQCopyTransport_Object *      obj         = NULL;
@@ -1210,7 +1239,8 @@ MessageQCopy_registerNotify (MessageQCopy_Handle handle,
                                                   obj->mq[i]->name,
                                                   RPMSG_NAME_SIZE) ) {
                                     /* call the callback */
-                                    cb(handle, j, obj->mq[i]->addr, TRUE);
+                                    cb(handle, j, obj->mq[i]->addr,
+                                       obj->mq[i]->desc, TRUE);
                                 }
                             }
                         }
@@ -1481,7 +1511,7 @@ MessageQCopy_send (UInt16 dstProc, UInt16 srcProc, UInt32 dstEndpt,
             }
             else {
                 if (!_MessageQCopy_create (transport, msg->addr, msg->name,
-                                           NULL, NULL, &endpoint)) {
+                                           msg->desc, NULL, NULL, &endpoint)) {
                     GT_0trace (curTrace, GT_4CLASS,
                                "creating of MQ in NS Callback failed!");
                 }
index 6810dfa0e5d2f3021f99859f868dd972b752bf5b..99d17149d5e94ce3e96ac0cd7d0ea2a5b59acba8 100644 (file)
@@ -299,7 +299,8 @@ void mqcopy_client_test_cb(MessageQCopy_Handle handle, void * data, int len, voi
     }
 }
 
-void mqcopy_client_test_notify_cb (MessageQCopy_Handle handle, UInt16 procId, UInt32 endpoint, Bool create)
+void mqcopy_client_test_notify_cb (MessageQCopy_Handle handle, UInt16 procId,
+                                   UInt32 endpoint, Char * desc, Bool create)
 {
     Int i = 0;
     Bool found = FALSE;
@@ -362,7 +363,8 @@ void mqcopy_error_test_cb(MessageQCopy_Handle handle, void * data, int len, void
                  handle, srcProc, src);
 }
 
-void mqcopy_error_test_notify_cb (MessageQCopy_Handle handle, UInt16 procId, UInt32 endpoint, Bool create)
+void mqcopy_error_test_notify_cb (MessageQCopy_Handle handle, UInt16 procId,
+                                  UInt32 endpoint, Char * desc, Bool create)
 {
     Osal_printf ("mqcopy_error_test_notify_cb for handle %d from procId %d endpoint %d",
                  handle, procId, endpoint);
index 04c3a061a65d3699219bbb7156f82381f9b3d513..1b020df481dccfacf03343a346e17e5c885888dd 100644 (file)
@@ -71,6 +71,7 @@ enum rpmsg_ns_flags {
 
 struct rpmsg_ns_msg {
     char name[RPMSG_NAME_SIZE];
+    char desc[RPMSG_NAME_SIZE];
     uint32_t addr;
     uint32_t flags;
 } __packed;