mirror of https://github.com/thesofproject/sof.git
pipeline: update sof_ipc_pipe_new struct
Updates sof_ipc_pipe_new struct to better handle different time domains: - Changes "deadline" to "period". - Changes "timer_delay" to "time_domain". Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
parent
6a0dcb3a10
commit
742f83ba2f
|
@ -810,7 +810,7 @@ static int pipeline_xrun_recover(struct pipeline *p)
|
|||
void pipeline_schedule_copy(struct pipeline *p, uint64_t start)
|
||||
{
|
||||
if (p->sched_comp->state == COMP_STATE_ACTIVE)
|
||||
schedule_task(&p->pipe_task, start, p->ipc_pipe.deadline, 0);
|
||||
schedule_task(&p->pipe_task, start, p->ipc_pipe.period, 0);
|
||||
}
|
||||
|
||||
/* notify pipeline that this component requires buffers emptied/filled
|
||||
|
@ -819,7 +819,7 @@ void pipeline_schedule_copy(struct pipeline *p, uint64_t start)
|
|||
*/
|
||||
void pipeline_schedule_copy_idle(struct pipeline *p)
|
||||
{
|
||||
schedule_task(&p->pipe_task, 0, p->ipc_pipe.deadline,
|
||||
schedule_task(&p->pipe_task, 0, p->ipc_pipe.period,
|
||||
SOF_SCHEDULE_FLAG_IDLE);
|
||||
}
|
||||
|
||||
|
@ -862,5 +862,5 @@ static uint64_t pipeline_task(void *arg)
|
|||
|
||||
sched:
|
||||
tracev_pipe("pipeline_task() sched");
|
||||
return p->ipc_pipe.timer_delay;
|
||||
return p->ipc_pipe.period;
|
||||
}
|
||||
|
|
|
@ -96,8 +96,9 @@
|
|||
/*
|
||||
* Static Pipeline Convenience Constructor
|
||||
*/
|
||||
#define SPIPE_PIPE(pid, pcore, pdeadline, ppriority) \
|
||||
{.pipeline_id = pid, .core = pcore, .deadline = pdeadline, .priority = ppriority}
|
||||
#define SPIPE_PIPE(pid, pcore, pperiod, ppriority) \
|
||||
{.pipeline_id = pid, .core = pcore, .period = pperiod, \
|
||||
.priority = ppriority}
|
||||
#define SPIPE_PIPE_CONNECT(psource, bsource, bid, psink, bsink) \
|
||||
{.pipeline_source_id = psource, .comp_source_id = bsource, \
|
||||
.buffer_id = bid, .pipeline_sink_id = psink, .comp_sink_id = bsink}
|
||||
|
@ -345,9 +346,9 @@ static struct spipe spipe[] = {
|
|||
|
||||
/* pipelines */
|
||||
struct sof_ipc_pipe_new pipeline[] = {
|
||||
SPIPE_PIPE(0, 0, 1000, SOF_TASK_PRI_HIGH),/* high pri - 1ms deadline */
|
||||
// SPIPE_PIPE(1, 0, 4000, SOF_TASK_PRI_MED),/* med pri - 4ms deadline */
|
||||
// SPIPE_PIPE(2, 0, 5000, SOF_TASK_PRI_LOW),/* low pri - 5ms deadline */
|
||||
SPIPE_PIPE(0, 0, 1000, SOF_TASK_PRI_HIGH),/* high pri - 1ms period */
|
||||
// SPIPE_PIPE(1, 0, 4000, SOF_TASK_PRI_MED),/* med pri - 4ms period */
|
||||
// SPIPE_PIPE(2, 0, 5000, SOF_TASK_PRI_LOW),/* low pri - 5ms period */
|
||||
};
|
||||
|
||||
int init_static_pipeline(struct ipc *ipc)
|
||||
|
|
|
@ -125,11 +125,11 @@ int tb_pipeline_params(struct ipc *ipc, int nch,
|
|||
struct sof_ipc_pcm_params params;
|
||||
char message[DEBUG_MSG_LEN];
|
||||
int fs_period;
|
||||
int deadline = ipc_pipe->deadline;
|
||||
int period = ipc_pipe->period;
|
||||
int ret = 0;
|
||||
|
||||
/* Compute period from sample rates */
|
||||
fs_period = (int)(0.9999 + tp->fs_in * deadline / 1e6);
|
||||
fs_period = (int)(0.9999 + tp->fs_in * period / 1e6);
|
||||
sprintf(message, "period sample count %d\n", fs_period);
|
||||
debug_print(message);
|
||||
|
||||
|
|
|
@ -288,10 +288,10 @@ int main(int argc, char **argv)
|
|||
|
||||
/* input and output sample rate */
|
||||
if (!tp.fs_in)
|
||||
tp.fs_in = ipc_pipe->deadline * ipc_pipe->frames_per_sched;
|
||||
tp.fs_in = ipc_pipe->period * ipc_pipe->frames_per_sched;
|
||||
|
||||
if (!tp.fs_out)
|
||||
tp.fs_out = ipc_pipe->deadline * ipc_pipe->frames_per_sched;
|
||||
tp.fs_out = ipc_pipe->period * ipc_pipe->frames_per_sched;
|
||||
|
||||
/* set pipeline params and trigger start */
|
||||
if (tb_pipeline_start(sof.ipc, TESTBENCH_NCH, ipc_pipe, &tp) < 0) {
|
||||
|
|
|
@ -55,7 +55,7 @@ struct testbench_prm {
|
|||
/*
|
||||
* input and output sample rate parameters
|
||||
* By default, these are calculated from pipeline frames_per_sched
|
||||
* and deadline but they can also be overridden via input arguments
|
||||
* and period but they can also be overridden via input arguments
|
||||
* to the testbench.
|
||||
*/
|
||||
uint32_t fs_in;
|
||||
|
|
|
@ -44,12 +44,12 @@
|
|||
#define SOF_TKN_BUF_CAPS 101
|
||||
|
||||
/* scheduling */
|
||||
#define SOF_TKN_SCHED_DEADLINE 200
|
||||
#define SOF_TKN_SCHED_PERIOD 200
|
||||
#define SOF_TKN_SCHED_PRIORITY 201
|
||||
#define SOF_TKN_SCHED_MIPS 202
|
||||
#define SOF_TKN_SCHED_CORE 203
|
||||
#define SOF_TKN_SCHED_FRAMES 204
|
||||
#define SOF_TKN_SCHED_TIMER 205
|
||||
#define SOF_TKN_SCHED_TIME_DOMAIN 205
|
||||
|
||||
/* volume */
|
||||
#define SOF_TKN_VOLUME_RAMP_STEP_TYPE 250
|
||||
|
@ -119,9 +119,9 @@ static const struct sof_topology_token buffer_tokens[] = {
|
|||
|
||||
/* scheduling */
|
||||
static const struct sof_topology_token sched_tokens[] = {
|
||||
{SOF_TKN_SCHED_DEADLINE, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
{SOF_TKN_SCHED_PERIOD, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
get_token_uint32_t,
|
||||
offsetof(struct sof_ipc_pipe_new, deadline), 0},
|
||||
offsetof(struct sof_ipc_pipe_new, period), 0},
|
||||
{SOF_TKN_SCHED_PRIORITY, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
get_token_uint32_t,
|
||||
offsetof(struct sof_ipc_pipe_new, priority), 0},
|
||||
|
@ -134,9 +134,9 @@ static const struct sof_topology_token sched_tokens[] = {
|
|||
{SOF_TKN_SCHED_FRAMES, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
get_token_uint32_t,
|
||||
offsetof(struct sof_ipc_pipe_new, frames_per_sched), 0},
|
||||
{SOF_TKN_SCHED_TIMER, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
{SOF_TKN_SCHED_TIME_DOMAIN, SND_SOC_TPLG_TUPLE_TYPE_WORD,
|
||||
get_token_uint32_t,
|
||||
offsetof(struct sof_ipc_pipe_new, timer_delay), 0},
|
||||
offsetof(struct sof_ipc_pipe_new, time_domain), 0},
|
||||
};
|
||||
|
||||
/* volume */
|
||||
|
|
|
@ -129,7 +129,7 @@ static inline bool pipeline_is_preload(struct pipeline *p)
|
|||
/* checks if pipeline is scheduled with timer */
|
||||
static inline bool pipeline_is_timer_driven(struct pipeline *p)
|
||||
{
|
||||
return p->ipc_pipe.timer_delay;
|
||||
return p->ipc_pipe.time_domain == SOF_TIME_DOMAIN_TIMER;
|
||||
}
|
||||
|
||||
/* pipeline creation and destruction */
|
||||
|
|
|
@ -248,6 +248,12 @@ struct sof_ipc_comp_reply {
|
|||
* Pipeline
|
||||
*/
|
||||
|
||||
/** \brief Types of pipeline scheduling time domains */
|
||||
enum sof_ipc_pipe_sched_time_domain {
|
||||
SOF_TIME_DOMAIN_DMA = 0, /**< DMA interrupt */
|
||||
SOF_TIME_DOMAIN_TIMER, /**< Timer interrupt */
|
||||
};
|
||||
|
||||
/* new pipeline - SOF_IPC_TPLG_PIPE_NEW */
|
||||
struct sof_ipc_pipe_new {
|
||||
struct sof_ipc_cmd_hdr hdr;
|
||||
|
@ -255,14 +261,12 @@ struct sof_ipc_pipe_new {
|
|||
uint32_t pipeline_id; /**< pipeline id */
|
||||
uint32_t sched_id; /**< Scheduling component id */
|
||||
uint32_t core; /**< core we run on */
|
||||
uint32_t deadline; /**< execution completion deadline in us*/
|
||||
uint32_t period; /**< execution period in us*/
|
||||
uint32_t priority; /**< priority level 0 (low) to 10 (max) */
|
||||
uint32_t period_mips; /**< worst case instruction count per period */
|
||||
uint32_t frames_per_sched;/**< output frames of pipeline, 0 is variable */
|
||||
uint32_t xrun_limit_usecs; /**< report xruns greater than limit */
|
||||
|
||||
/* non zero if timer scheduled, otherwise DAI DMA irq scheduled */
|
||||
uint32_t timer_delay;
|
||||
uint32_t time_domain; /**< scheduling time domain */
|
||||
} __attribute__((packed));
|
||||
|
||||
/* pipeline construction complete - SOF_IPC_TPLG_PIPE_COMPLETE */
|
||||
|
|
Loading…
Reference in New Issue