]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - ipc/ipcdev.git/blobdiff - qnx/src/api/Ipc.c
Linux: Update user AF_RPMSG define for 5.15+ kernels
[ipc/ipcdev.git] / qnx / src / api / Ipc.c
index 23d50dbf035c0177d52a986db96886d8cb2519bd..763a17b3919b42cfb429bd487aede5419ca9dd4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Texas Instruments Incorporated
+ * Copyright (c) 2013-2015, Texas Instruments Incorporated
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #include <_NameServer.h>
 #include <_GateMP.h>
 #include <_GateMP_usr.h>
-#include <ti/syslink/inc/GateHWSpinlock.h>
+#include <_TiIpcFxns.h>
+#include <_IpcLog.h>
+#include <ti/syslink/inc/_GateHWSpinlock.h>
 #include <ti/syslink/inc/_MultiProc.h>
 
 MultiProc_Config _MultiProc_cfg;
 
+/* traces in this file are controlled via _Ipc_verbose */
+Bool _Ipc_verbose = FALSE;
+#define verbose _Ipc_verbose
+
 static void cleanup(int arg);
 
 /** ============================================================================
@@ -83,6 +89,38 @@ Int Ipc_start (Void)
     /* 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 */
+            _Ipc_verbose = TRUE;
+            _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 TiIpcFxns tracing */
+            _Ipc_verbose = TRUE;
+            _MessageQ_verbose = TRUE;
+            _MultiProc_verbose = TRUE;
+            _NameServer_verbose = TRUE;
+
+#if defined(GATEMP_SUPPORT)
+            _GateMP_verbose = TRUE;
+
+            _GateHWSpinlock_verbose = TRUE;
+#endif
+
+            _TiIpcFxns_verbose = TRUE;
+        }
+    }
+
     status = IpcDrv_open();
     if (status < 0) {
         printf("Ipc_start: IpcDrv_open() failed: %d\n", status);
@@ -115,6 +153,17 @@ Int Ipc_start (Void)
               goto messageqattach_fail;
            }
         }
+
+        /*
+         * Check if MultiProc config is valid and that
+         * MultiProc_getNumProcessors() is non-zero to make sure we are not
+         * in the middle of a recovery.
+         */
+        if (rprocId == 0) {
+            PRINTVERBOSE0("Ipc_start: MultiProc not yet configured\n")
+            status = Ipc_E_FAIL;
+            goto messageqattach_fail;
+        }
     }
     else {
         printf("Ipc_start: NameServer_setup() failed: %d\n", status);
@@ -125,6 +174,7 @@ Int Ipc_start (Void)
     /* Start GateMP only if it is setup in the resource manager */
 #if defined(GATEMP_SUPPORT)
     if (GateMP_isSetup()) {
+        /* Get GateHWSpinlock configuration from resource manager */
         status = GateHWSpinlock_start();
         if (status < 0) {
             printf("Ipc_start: GateHWSpinlock_start failed: %d\n",