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

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


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

It will use SCH 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/schedule.h | 10 ++++++++++
 src/lib/schedule.c         | 20 ++++++++++----------
 2 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/src/include/sof/schedule.h b/src/include/sof/schedule.h
index 7e5b3b2..b4b4b31 100644
--- a/src/include/sof/schedule.h
+++ b/src/include/sof/schedule.h
@@ -55,6 +55,16 @@ struct sof;
 #define TASK_PRI_MED	0
 #define TASK_PRI_HIGH	-20
 
+#define trace_sch(__e) \
+	trace_global_event(NORMAL_LEVEL, TRACE_CLASS_SCH, __e)
+#define tracev_sch(__e) \
+	trace_global_event(VERBOSE_LEVEL, TRACE_CLASS_SCH, __e)
+#define trace_sch_error(__e) \
+	trace_global_event(ERROR_LEVEL, TRACE_CLASS_SCH, __e)
+#define trace_sch_value(x) \
+	trace_global_value(NORMAL_LEVEL, x)
+#define trace_sch_error_value(x) \
+	trace_global_value(ERROR_LEVEL, x)
 
 /* task descriptor */
 struct task {
diff --git a/src/lib/schedule.c b/src/lib/schedule.c
index b98934d..6ed7c32 100644
--- a/src/lib/schedule.c
+++ b/src/lib/schedule.c
@@ -138,7 +138,7 @@ static inline struct task *edf_get_next(uint64_t current,
 
 		} else {
 			/* missed scheduling - will be rescheduled */
-			trace_pipe("ed!");
+			trace_sch("ed!");
 
 			/* have we already tried to rescheule ? */
 			if (reschedule++)
@@ -158,7 +158,7 @@ static inline struct task *edf_get_next(uint64_t current,
 /* work set in the future when next task can be scheduled */
 static uint64_t sch_work(void *data, uint64_t delay)
 {
-	tracev_pipe("wrk");
+	tracev_sch("wrk");
 	schedule();
 	return 0;
 }
@@ -175,7 +175,7 @@ static struct task *schedule_edf(void)
 	struct task *future_task = NULL;
 	uint64_t current;
 
-	tracev_pipe("edf");
+	tracev_sch("edf");
 
 	/* get the current time */
 	current = platform_timer_get(platform_timer);
@@ -211,7 +211,7 @@ static int schedule_task_del(struct task *task)
 	uint32_t flags;
 	int ret = 0;
 
-	tracev_pipe("del");
+	tracev_sch("del");
 
 	/* add task to list */
 	spin_lock_irq(&sch->lock, flags);
@@ -237,13 +237,13 @@ static int _schedule_task(struct task *task, uint64_t start, uint64_t deadline)
 	uint32_t flags;
 	uint64_t current;
 
-	tracev_pipe("ad!");
+	tracev_sch("ad!");
 
 	spin_lock_irq(&sch->lock, flags);
 
 	/* is task already running ? - not enough MIPS to complete ? */
 	if (task->state == TASK_STATE_RUNNING) {
-		trace_pipe("tsk");
+		trace_sch("tsk");
 		spin_unlock_irq(&sch->lock, flags);
 		return 0;
 	}
@@ -307,7 +307,7 @@ void schedule_task_complete(struct task *task)
 {
 	uint32_t flags;
 
-	tracev_pipe("com");
+	tracev_sch("com");
 
 	spin_lock_irq(&sch->lock, flags);
 	list_item_del(&task->list);
@@ -319,7 +319,7 @@ static void scheduler_run(void *unused)
 {
 	struct task *future_task;
 
-	tracev_pipe("run");
+	tracev_sch("run");
 
 	/* EDF is only scheduler supported atm */
 	future_task = schedule_edf();
@@ -334,7 +334,7 @@ void schedule(void)
 	struct task *task;
 	uint32_t flags;
 
-	tracev_pipe("sch");
+	tracev_sch("sch");
 
 	spin_lock_irq(&sch->lock, flags);
 
@@ -367,7 +367,7 @@ schedule:
 /* Initialise the scheduler */
 int scheduler_init(struct sof *sof)
 {
-	trace_pipe("ScI");
+	trace_sch("ScI");
 
 	sch = rzalloc(RZONE_SYS, SOF_MEM_CAPS_RAM, sizeof(*sch));
 	list_init(&sch->list);
-- 
2.14.3



More information about the Sound-open-firmware mailing list