prima: Framework to print system information

Print state information of HDD, SME, PE, WDA and WDI layers
when active command timeout issue is seen. This can be extended
to print system information of other layers if there is necessity
for such information.

Change-Id: Ibce74761f60f33d37ffde0530c2d2635be46cdd7
CRs-Fixed: 851666
diff --git a/CORE/WDI/CP/src/wlan_qct_wdi.c b/CORE/WDI/CP/src/wlan_qct_wdi.c
index 8370a51..d8d523e 100644
--- a/CORE/WDI/CP/src/wlan_qct_wdi.c
+++ b/CORE/WDI/CP/src/wlan_qct_wdi.c
@@ -1575,6 +1575,30 @@
   }
 }
 
+/**
+ * wdi_state_info_dump() - prints state information of wdi layer
+ */
+static void wdi_state_info_dump(void)
+{
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "%s pending commands: %d", __func__,
+                gWDICb.wptPendingQueue.count);
+    WPAL_TRACE( eWLAN_MODULE_DAL_CTRL, eWLAN_PAL_TRACE_LEVEL_ERROR,
+                "uGlobalState %d wdiExpectedResponse: %d",
+                gWDICb.uGlobalState, gWDICb.wdiExpectedResponse);
+}
+
+
+/**
+ * wdi_register_debug_callback() - registration function for wdi layer
+ * to print WDI state information
+  */
+static void wdi_register_debug_callback(void)
+{
+    vos_register_debug_callback(VOS_MODULE_ID_WDI, &wdi_state_info_dump);
+}
+
+
 /*========================================================================
 
                              INITIALIZATION APIs
@@ -1810,6 +1834,9 @@
   pWdiDevCapability->bFrameXtlSupported = eWLAN_PAL_FALSE;
   pWdiDevCapability->ucMaxSTASupported  = gWDICb.ucMaxStations;
   pWdiDevCapability->ucMaxBSSSupported  = gWDICb.ucMaxBssids;
+
+  wdi_register_debug_callback();
+
   return WDI_STATUS_SUCCESS;
 
   /* ERROR handlers