diff --git a/linux/src/api/Ipc.c b/linux/src/api/Ipc.c
index 214c6264612627943c5e500607488ba11093372d..6dbb0b6cf622570d033405038a3e0689478c0bf2 100644 (file)
--- a/linux/src/api/Ipc.c
+++ b/linux/src/api/Ipc.c
/*
- * 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
* @brief Starts and stops user side Ipc
* All setup/destroy APIs on user side will be call from this
* module.
- *
- * @ver 0002
- *
*/
/* Standard headers */
/* IPC startup/shutdown stuff: */
#include <ti/ipc/MultiProc.h>
+#include <GateHWSpinlock.h>
+#include <_GateMP.h>
#include <_MultiProc.h>
#include <_MessageQ.h>
#include <_NameServer.h>
+GateHWSpinlock_Config _GateHWSpinlock_cfgParams;
+
static LAD_ClientHandle ladHandle;
static void cleanup(int arg);
/* Function to start Ipc */
Int Ipc_start (Void)
{
- MessageQ_Config msgqCfg;
- MultiProc_Config mpCfg;
- Int32 status;
- LAD_Status ladStatus;
- UInt16 rprocId;
- Int32 attachedAny = 0;
+ MessageQ_Config msgqCfg;
+ MultiProc_Config mpCfg;
+#if defined(GATEMP_SUPPORT)
+ GateHWSpinlock_Config gateHWCfg;
+#endif
+ Int32 status;
+ LAD_Status ladStatus;
+ UInt16 rprocId;
+ Int32 attachedAny = 0;
/* Catch ctrl-C, and cleanup: */
(void) signal(SIGINT, cleanup);
+ if (getenv("IPC_DEBUG") != NULL) {
+ /* turn on tracing */
+ if (getenv("IPC_DEBUG")[0] == '1') {
+ /* level 1 enables typical user API tracing */
+ _MessageQ_verbose = TRUE;
+ _MultiProc_verbose = TRUE;
+ _NameServer_verbose = TRUE;
+#if defined(GATEMP_SUPPORT)
+ _GateMP_verbose = TRUE;
+
+ _GateHWSpinlock_verbose = TRUE;
+#endif
+ }
+ else if ((getenv("IPC_DEBUG")[0] == '2') ||
+ (getenv("IPC_DEBUG")[0] == '3')) {
+ /* levels 2 and 3 add socket and LAD client tracing */
+ _MessageQ_verbose = TRUE;
+ _MultiProc_verbose = TRUE;
+ _NameServer_verbose = TRUE;
+
+#if defined(GATEMP_SUPPORT)
+ _GateMP_verbose = TRUE;
+
+ _GateHWSpinlock_verbose = TRUE;
+#endif
+
+ /* internals - should be declared in respective _*.h files */
+ extern Bool _SocketFxns_verbose;
+ extern Bool _LAD_Client_verbose;
+
+ _SocketFxns_verbose = TRUE;
+ _LAD_Client_verbose = TRUE;
+ }
+ }
+
ladStatus = LAD_connect(&ladHandle);
if (ladStatus != LAD_SUCCESS) {
printf("Ipc_start: LAD_connect() failed: %d\n", ladStatus);
goto exit;
}
- /*
+ /*
* Get MultiProc configuration from LAD and initialize local MultiProc
* config structure.
*/
status = Ipc_E_FAIL;
}
+ /* Start GateMP only if device has support */
+#if defined(GATEMP_SUPPORT)
+ if (GateMP_isSetup()) {
+ /*
+ * Get HWSpinlock base address and size from LAD and
+ * initialize the local config structure.
+ */
+ GateHWSpinlock_getConfig(&gateHWCfg);
+ _GateHWSpinlock_cfgParams = gateHWCfg;
+
+ status = GateHWSpinlock_start();
+ if (status < 0) {
+ printf("Ipc_start: GateHWSpinlock_start failed: %d\n",
+ status);
+ status = Ipc_E_FAIL;
+ goto gatehwspinlockstart_fail;
+ }
+ else {
+ status = GateMP_start();
+ if (status < 0) {
+ printf("Ipc_start: GateMP_start failed: %d\n",
+ status);
+ status = Ipc_E_FAIL;
+ goto gatempstart_fail;
+ }
+ }
+ }
+#endif
+ /* Success */
+ goto exit;
+#if defined(GATEMP_SUPPORT)
+gatempstart_fail:
+ GateHWSpinlock_stop();
+gatehwspinlockstart_fail:
+ for (rprocId = rprocId - 1; (rprocId > 0) && (status >= 0); rprocId--) {
+ MessageQ_detach(rprocId);
+ }
+#endif
+
exit:
return (status);
}