[Sound-open-firmware] [RFC PATCH v2 29/29] Change macro definition and trace calling for IPC.

yan.wang at linux.intel.com yan.wang at linux.intel.com
Fri May 11 08:36:11 CEST 2018


From: Yan Wang <yan.wang at linux.intel.com>

It will use IPC trace class and global DMA trace API.

Signed-off-by: Yan Wang <yan.wang at linux.intel.com>
---
Test with:
CNL nocodec
SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775
SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c
https://github.com/plbossart/sound/tree/topic/sof-v4.14:
d09db67c5a9d6dfc85f700669fa2e43c678c8d51
---
 src/include/sof/ipc.h | 13 ++++++++++---
 src/ipc/handler.c     | 24 ++++++++++++------------
 src/ipc/ipc.c         | 16 ++++++++--------
 3 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/src/include/sof/ipc.h b/src/include/sof/ipc.h
index 67cf25f..d8ac1bb 100644
--- a/src/include/sof/ipc.h
+++ b/src/include/sof/ipc.h
@@ -45,9 +45,16 @@
 struct sof;
 struct dai_config;
 
-#define trace_ipc(__e)	trace_event(TRACE_CLASS_IPC, __e)
-#define tracev_ipc(__e)	tracev_event(TRACE_CLASS_IPC, __e)
-#define trace_ipc_error(__e)	trace_error(TRACE_CLASS_IPC, __e)
+#define trace_ipc(__e) \
+	trace_global_event(NORMAL_LEVEL, TRACE_CLASS_IPC, __e)
+#define tracev_ipc(__e) \
+	trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_IPC, __e)
+#define trace_ipc_error(__e) \
+	trace_global_event(ERROR_LEVEL, TRACE_CLASS_IPC, __e)
+#define trace_ipc_value(x) \
+	trace_global_value(NORMAL_LEVEL, x)
+#define trace_ipc_error_value(x) \
+	trace_global_value(ERROR_LEVEL, x)
 
 #define MSG_QUEUE_SIZE		12
 
diff --git a/src/ipc/handler.c b/src/ipc/handler.c
index 41290ca..4dc0ffe 100644
--- a/src/ipc/handler.c
+++ b/src/ipc/handler.c
@@ -110,14 +110,14 @@ static int ipc_stream_pcm_params(uint32_t stream)
 	pcm_dev = ipc_get_comp(_ipc, pcm_params->comp_id);
 	if (pcm_dev == NULL) {
 		trace_ipc_error("eAC");
-		trace_error_value(pcm_params->comp_id);
+		trace_ipc_error_value(pcm_params->comp_id);
 		return -EINVAL;
 	}
 
 	/* sanity check comp */
 	if (pcm_dev->cd->pipeline == NULL) {
 		trace_ipc_error("eA1");
-		trace_error_value(pcm_params->comp_id);
+		trace_ipc_error_value(pcm_params->comp_id);
 		return -EINVAL;
 	}
 
@@ -224,7 +224,7 @@ static int ipc_stream_pcm_free(uint32_t header)
 	/* sanity check comp */
 	if (pcm_dev->cd->pipeline == NULL) {
 		trace_ipc_error("eF1");
-		trace_error_value(free_req->comp_id);
+		trace_ipc_error_value(free_req->comp_id);
 		return -EINVAL;
 	}
 
@@ -343,7 +343,7 @@ static int ipc_stream_trigger(uint32_t header)
 	ret = pipeline_trigger(pcm_dev->cd->pipeline, pcm_dev->cd, cmd);
 	if (ret < 0) {
 		trace_ipc_error("eRc");
-		trace_error_value(ipc_cmd);
+		trace_ipc_error_value(ipc_cmd);
 	}
 
 	return ret;
@@ -389,8 +389,8 @@ static int ipc_dai_config(uint32_t header)
 	dai = dai_get(config->type, config->id);
 	if (dai == NULL) {
 		trace_ipc_error("eDi");
-		trace_error_value(config->type);
-		trace_error_value(config->id);
+		trace_ipc_error_value(config->type);
+		trace_ipc_error_value(config->id);
 		return -ENODEV;
 	}
 
@@ -416,7 +416,7 @@ static int ipc_glb_dai_message(uint32_t header)
 		//return ipc_comp_set_value(header, COMP_CMD_LOOPBACK);
 	default:
 		trace_ipc_error("eDc");
-		trace_error_value(header);
+		trace_ipc_error_value(header);
 		return -EINVAL;
 	}
 }
@@ -651,7 +651,7 @@ static int ipc_glb_debug_message(uint32_t header)
 		return ipc_dma_trace_levels(header);
 	default:
 		trace_ipc_error("eDc");
-		trace_error_value(header);
+		trace_ipc_error_value(header);
 		return -EINVAL;
 	}
 }
@@ -673,7 +673,7 @@ static int ipc_comp_value(uint32_t header, uint32_t cmd)
 	comp_dev = ipc_get_comp(_ipc, data->comp_id);
 	if (comp_dev == NULL){
 		trace_ipc_error("eVg");
-		trace_error_value(data->comp_id);
+		trace_ipc_error_value(data->comp_id);
 		return -ENODEV;
 	}
 	
@@ -704,7 +704,7 @@ static int ipc_glb_comp_message(uint32_t header)
 		return ipc_comp_value(header, COMP_CMD_GET_DATA);
 	default:
 		trace_ipc_error("eCc");
-		trace_error_value(header);
+		trace_ipc_error_value(header);
 		return -EINVAL;
 	}
 }
@@ -833,7 +833,7 @@ static int ipc_glb_tplg_message(uint32_t header)
 		return ipc_glb_tplg_free(header, ipc_buffer_free);
 	default:
 		trace_ipc_error("eTc");
-		trace_error_value(header);
+		trace_ipc_error_value(header);
 		return -EINVAL;
 	}
 }
@@ -874,7 +874,7 @@ int ipc_cmd(void)
 		return ipc_glb_debug_message(hdr->cmd);
 	default:
 		trace_ipc_error("eGc");
-		trace_error_value(type);
+		trace_ipc_error_value(type);
 		return -EINVAL;
 	}
 }
diff --git a/src/ipc/ipc.c b/src/ipc/ipc.c
index d613d1f..026501f 100644
--- a/src/ipc/ipc.c
+++ b/src/ipc/ipc.c
@@ -143,7 +143,7 @@ int ipc_comp_new(struct ipc *ipc, struct sof_ipc_comp *comp)
 	icd = ipc_get_comp(ipc, comp->id);
 	if (icd != NULL) {
 		trace_ipc_error("eCe");
-		trace_error_value(comp->id);
+		trace_ipc_error_value(comp->id);
 		return -EINVAL;
 	}
 
@@ -197,7 +197,7 @@ int ipc_buffer_new(struct ipc *ipc, struct sof_ipc_buffer *desc)
 	ibd = ipc_get_comp(ipc, desc->comp.id);
 	if (ibd != NULL) {
 		trace_ipc_error("eBe");
-		trace_error_value(desc->comp.id);
+		trace_ipc_error_value(desc->comp.id);
 		return -EINVAL;
 	}
 
@@ -250,14 +250,14 @@ int ipc_comp_connect(struct ipc *ipc,
 	icd_source = ipc_get_comp(ipc, connect->source_id);
 	if (icd_source == NULL) {
 		trace_ipc_error("eCr");
-		trace_error_value(connect->source_id);
+		trace_ipc_error_value(connect->source_id);
 		return -EINVAL;
 	}
 
 	icd_sink = ipc_get_comp(ipc, connect->sink_id);
 	if (icd_sink == NULL) {
 		trace_ipc_error("eCn");
-		trace_error_value(connect->sink_id);
+		trace_ipc_error_value(connect->sink_id);
 		return -EINVAL;
 	}
 
@@ -272,8 +272,8 @@ int ipc_comp_connect(struct ipc *ipc,
 			icd_source->cd, icd_sink->cb);
 	else {
 		trace_ipc_error("eCt");
-		trace_error_value(connect->source_id);
-		trace_error_value(connect->sink_id);
+		trace_ipc_error_value(connect->source_id);
+		trace_ipc_error_value(connect->sink_id);
 		return -EINVAL;
 	}
 }
@@ -290,7 +290,7 @@ int ipc_pipeline_new(struct ipc *ipc,
 	ipc_pipe = ipc_get_comp(ipc, pipe_desc->comp_id);
 	if (ipc_pipe != NULL) {
 		trace_ipc_error("ePi");
-		trace_error_value(pipe_desc->comp_id);
+		trace_ipc_error_value(pipe_desc->comp_id);
 		return -EINVAL;
 	}
 
@@ -298,7 +298,7 @@ int ipc_pipeline_new(struct ipc *ipc,
 	icd = ipc_get_comp(ipc, pipe_desc->sched_id);
 	if (icd == NULL) {
 		trace_ipc_error("ePs");
-		trace_error_value(pipe_desc->sched_id);
+		trace_ipc_error_value(pipe_desc->sched_id);
 		return -EINVAL;
 	}
 	if (icd->type != COMP_TYPE_COMPONENT) {
-- 
2.14.3



More information about the Sound-open-firmware mailing list