diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQCopy.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/MessageQCopy.c
index dd701ac84121fc5ccada522062e1dd926fe31170..b03ae309b91fc3ed747c05f2f164539e0a6123fe 100644 (file)
/*
- * @file MessageqCopy.c
- *
- * @brief Implementation of MessageQCopy module.
- *
- * ============================================================================
- *
- * Copyright (c) 2011, Texas Instruments Incorporated
+ * Copyright (c) 2011-2014, Texas Instruments Incorporated
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- * Contact information for paper mail:
- * Texas Instruments
- * Post Office Box 655303
- * Dallas, Texas 75265
- * Contact information:
- * http://www-k.ext.ti.com/sc/technical-support/product-information-centers.htm?
- * DCMP=TIHomeTracking&HQS=Other+OT+home_d_contact
- * ============================================================================
- *
*/
#include <ti/syslink/utils/GateSpinlock.h>
#include <ti/syslink/utils/Memory.h>
#include <ti/syslink/utils/List.h>
+#include <ti/syslink/inc/Bitops.h>
#include <ti/ipc/MultiProc.h>
#include <OsalSemaphore.h>
-#ifdef SYSLINK_BUILDOS_LINUX
-#include <atomic_linux.h>
-#elif SYSLINK_BUILDOS_QNX
#include <atomic_qnx.h>
-#endif
/* Module headers */
+#include <ti/syslink/ProcMgr.h>
#include <ti/ipc/MessageQCopy.h>
#include <_MessageQCopyDefs.h>
#include <_MessageQCopy.h>
/*!< 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. */
/*!< 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;
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);
if (status >= 0) {
/* Startup the VirtQueue module for this procId. */
VirtQueue_startup(obj->procId,
- MessageQCopy_module->cfg.intId,
- vqPAddr);
+ MessageQCopy_module->cfg.intId[obj->procId],
+ vqPAddr);
/*
* The buffer area is divided into two parts, one
}
}
+ MessageQCopy_module->transport[remoteProcId] = NULL;
+
/* Delete the virtqueues */
for (i = 0; i < MessageQCopy_NUMVIRTQS; i++) {
VirtQueue_delete (&obj->vq[i]);
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)
{
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)
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) {
if (reserved != MessageQCopy_ADDRANY && name != NULL)
announce = TRUE;
}
- else
+ else {
mq = handle->mq;
+ }
/* Enter critical section protection. */
key = IGateProvider_enter (MessageQCopy_module->gateHandle);
}
else
obj->name[0] = '\0';
+ if (desc) {
+ String_cpy (obj->desc, desc);
+ }
+ else
+ obj->desc[0] = '\0';
mq[queueIndex] = obj;
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++) {
MessageQCopy_module->mq[i],
obj->procId,
obj->addr,
+ obj->desc,
TRUE);
}
}
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) {
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++) {
MessageQCopy_module->mq[i],
obj->procId,
obj->addr,
+ obj->desc,
FALSE);
}
}
/* 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;
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);
}
}
}
}
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!");
}
#if defined (__cplusplus)
}
#endif /* defined (__cplusplus) */
-