pipeline: add function for checking pipe execution core

Extracts check whether the pipeline should be executed
on the current core to separate method.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2019-08-05 15:01:06 +02:00 committed by Liam Girdwood
parent f14a8a7049
commit 4563f2c12d
3 changed files with 10 additions and 3 deletions

View File

@ -191,7 +191,7 @@ static int idc_pipeline_trigger(uint32_t cmd)
}
/* check whether we are executing from the right core */
if (arch_cpu_get_id() != pcm_dev->cd->pipeline->ipc_pipe.core)
if (!pipeline_is_this_cpu(pcm_dev->cd->pipeline))
return -EINVAL;
/* trigger pipeline */
@ -232,7 +232,7 @@ static int idc_component_command(uint32_t cmd)
*/
/* check whether we are executing from the right core */
if (arch_cpu_get_id() != comp_dev->cd->pipeline->ipc_pipe.core)
if (!pipeline_is_this_cpu(comp_dev->cd->pipeline))
return -EINVAL;
/* execute component command */

View File

@ -608,7 +608,7 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd)
trace_pipe_with_ids(p, "pipeline_trigger()");
/* if current core is different than requested */
if (p->ipc_pipe.core != cpu_get_id())
if (!pipeline_is_this_cpu(p))
return pipeline_trigger_on_core(p, host, cmd);
/* handle pipeline global checks before going into each components */

View File

@ -8,6 +8,7 @@
#ifndef __SOF_AUDIO_PIPELINE_H__
#define __SOF_AUDIO_PIPELINE_H__
#include <sof/lib/cpu.h>
#include <sof/schedule/task.h>
#include <sof/spinlock.h>
#include <sof/trace/trace.h>
@ -114,6 +115,12 @@ static inline bool pipeline_is_timer_driven(struct pipeline *p)
return p->ipc_pipe.time_domain == SOF_TIME_DOMAIN_TIMER;
}
/* checks if pipeline is scheduled on this core */
static inline bool pipeline_is_this_cpu(struct pipeline *p)
{
return p->ipc_pipe.core == cpu_get_id();
}
/* pipeline creation and destruction */
struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc,
struct comp_dev *cd);