qcacmn: Add ascii dump support to qdf hex dump API

The existing hex dump API dumps hex data only.
Add API so that the ascii data can also be
dumped along with hex dump

Change-Id: Icbe74b26f47601a249e3d7ac701f2a19d70fb83b
CRs-Fixed: 2464738
diff --git a/qdf/inc/qdf_trace.h b/qdf/inc/qdf_trace.h
index d9e3b6c..4d9334f 100644
--- a/qdf/inc/qdf_trace.h
+++ b/qdf/inc/qdf_trace.h
@@ -1042,9 +1042,40 @@
 
 #endif /* TSOSEG_DEBUG */
 
+/**
+ * qdf_trace_hex_dump() - externally called hex dump function
+ * @module: Module identifier a member of the QDF_MODULE_ID enumeration that
+ * identifies the module issuing the trace message.
+ * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating
+ * the severity of the condition causing the trace message to be
+ * issued. More severe conditions are more likely to be logged.
+ * @data: The base address of the buffer to be logged.
+ * @buf_len: The size of the buffer to be logged.
+ *
+ * Checks the level of severity and accordingly prints the trace messages
+ *
+ * Return:  None
+ */
 void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
 			void *data, int buf_len);
 
+/**
+ * qdf_trace_hex_ascii_dump() - externally called hex and ascii dump function
+ * @module: Module identifier a member of the QDF_MODULE_ID enumeration that
+ * identifies the module issuing the trace message.
+ * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating
+ * the severity of the condition causing the trace message to be
+ * issued. More severe conditions are more likely to be logged.
+ * @data: The base address of the buffer to be logged.
+ * @buf_len: The size of the buffer to be logged.
+ *
+ * Checks the level of severity and accordingly prints the trace messages
+ *
+ * Return:  None
+ */
+void qdf_trace_hex_ascii_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
+			      void *data, int buf_len);
+
 #define ERROR_CODE                      -1
 #define QDF_MAX_NAME_SIZE               32
 #define MAX_PRINT_CONFIG_SUPPORTED      32
diff --git a/qdf/linux/src/qdf_trace.c b/qdf/linux/src/qdf_trace.c
index 99150eb..b124b8f 100644
--- a/qdf/linux/src/qdf_trace.c
+++ b/qdf/linux/src/qdf_trace.c
@@ -156,22 +156,8 @@
 /* Buffer size = data bytes(2 hex chars plus space) + NULL */
 #define BUFFER_SIZE ((QDF_DP_TRACE_RECORD_SIZE * 3) + 1)
 
-/**
- * qdf_trace_hex_dump() - externally called hex dump function
- * @module: Module identifier a member of the QDF_MODULE_ID enumeration that
- * identifies the module issuing the trace message.
- * @level: Trace level a member of the QDF_TRACE_LEVEL enumeration indicating
- * the severity of the condition causing the trace message to be
- * issued. More severe conditions are more likely to be logged.
- * @data: The base address of the buffer to be logged.
- * @buf_len: The size of the buffer to be logged.
- *
- * Checks the level of severity and accordingly prints the trace messages
- *
- * Return:  None
- */
-void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
-			void *data, int buf_len)
+static void __qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
+				 void *data, int buf_len, bool print_ascii)
 {
 	const u8 *ptr = data;
 	int i = 0;
@@ -186,15 +172,30 @@
 		buf_len -= ROW_SIZE;
 
 		hex_dump_to_buffer(ptr, linelen, ROW_SIZE, 1,
-				linebuf, sizeof(linebuf), false);
+				   linebuf, sizeof(linebuf), print_ascii);
 
 		qdf_trace_msg(module, level, "%.8x: %s", i, linebuf);
 		ptr += ROW_SIZE;
 		i += ROW_SIZE;
 	}
 }
+
+void qdf_trace_hex_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
+			void *data, int buf_len)
+{
+	__qdf_trace_hex_dump(module, level, data, buf_len, false);
+}
+
 qdf_export_symbol(qdf_trace_hex_dump);
 
+void qdf_trace_hex_ascii_dump(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
+			      void *data, int buf_len)
+{
+	__qdf_trace_hex_dump(module, level, data, buf_len, true);
+}
+
+qdf_export_symbol(qdf_trace_hex_ascii_dump);
+
 #endif
 
 #ifdef TRACE_RECORD