Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/arch/xtensa/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ if(CONFIG_SMP)
smp/notifier.c
smp/schedule.c
smp/task.c
smp/work.c
)
else()
add_subdirectory(up)
Expand All @@ -173,7 +172,6 @@ else()
up/notifier.c
up/schedule.c
up/task.c
up/work.c
)
endif()

Expand Down
4 changes: 1 addition & 3 deletions src/arch/xtensa/smp/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ void cpu_power_down_core(void)

idc_free();

scheduler_free();

free_system_workq();
schedule_free();

free_system_notify();

Expand Down
10 changes: 6 additions & 4 deletions src/arch/xtensa/smp/idc.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void idc_irq_handler(void *arg)
idc->received_msg.extension =
idctefc & IPC_IDCTEFC_MSG_MASK;

schedule_task(&idc->idc_task, 0, IDC_DEADLINE);
schedule_task(&idc->idc_task, 0, IDC_DEADLINE, 0);

break;
}
Expand Down Expand Up @@ -263,7 +263,7 @@ static void idc_cmd(struct idc_msg *msg)
* \brief Handles received IDC message.
* \param[in,out] data Pointer to IDC data.
*/
static void idc_do_cmd(void *data)
static uint64_t idc_do_cmd(void *data)
{
struct idc *idc = data;
int core = arch_cpu_get_id();
Expand All @@ -279,6 +279,8 @@ static void idc_do_cmd(void *data)

/* enable BUSY interrupt */
idc_write(IPC_IDCCTL, core, idc->busy_bit_mask | idc->done_bit_mask);

return 0;
}

/**
Expand Down Expand Up @@ -343,8 +345,8 @@ int arch_idc_init(void)
(*idc)->done_bit_mask = idc_get_done_bit_mask(core);

/* process task */
schedule_task_init(&(*idc)->idc_task, idc_do_cmd, *idc);
schedule_task_config(&(*idc)->idc_task, TASK_PRI_IDC, core);
schedule_task_init(&(*idc)->idc_task, SOF_SCHEDULE_EDF,
SOF_TASK_PRI_IDC, idc_do_cmd, *idc, core, 0);

/* configure interrupt */
ret = interrupt_register(PLATFORM_IDC_INTERRUPT(core), IRQ_AUTO_UNMASK,
Expand Down
5 changes: 1 addition & 4 deletions src/arch/xtensa/smp/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,10 @@ int slave_core_init(struct sof *sof)
init_system_notify(sof);

trace_point(TRACE_BOOT_SYS_SCHED);
scheduler_init(sof);
scheduler_init();

platform_interrupt_init();
Comment thread
bkokoszx marked this conversation as resolved.
Outdated

trace_point(TRACE_BOOT_SYS_WORK);
init_system_workq(&platform_generic_queue[cpu_get_id()]);

/* initialize IDC mechanism */
trace_point(TRACE_BOOT_PLATFORM_IDC);
err = idc_init();
Expand Down
4 changes: 2 additions & 2 deletions src/arch/xtensa/smp/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
#include <arch/cpu.h>
#include <sof/schedule.h>

struct schedule_data **arch_schedule_get(void)
struct schedule_data **arch_schedule_get_data(void)
{
struct core_context *ctx = (struct core_context *)cpu_read_threadptr();

return &ctx->sch;
return &ctx->sch_data;
}
4 changes: 1 addition & 3 deletions src/arch/xtensa/smp/xtos/xtos-structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct idc;
struct irq_task;
struct notify;
struct schedule_data;
struct work_queue;

struct thread_data {
xtos_structures_pointers xtos_ptrs;
Expand All @@ -58,8 +57,7 @@ struct core_context {
struct irq_task *irq_low_task;
struct irq_task *irq_med_task;
struct irq_task *irq_high_task;
struct schedule_data *sch;
struct work_queue *queue;
struct schedule_data *sch_data;
struct notify *notify;
struct idc *idc;
};
Expand Down
24 changes: 11 additions & 13 deletions src/arch/xtensa/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
#include <sof/debug.h>
#include <sof/interrupt.h>
#include <sof/schedule.h>

#include <platform/platform.h>

#include <arch/task.h>

/**
Expand All @@ -53,13 +51,13 @@ static uint32_t task_get_irq(struct task *task)
uint32_t irq;

switch (task->priority) {
case TASK_PRI_MED + 1 ... TASK_PRI_LOW:
case SOF_TASK_PRI_LOW ... SOF_TASK_PRI_MED - 1:
irq = PLATFORM_IRQ_TASK_LOW;
break;
case TASK_PRI_HIGH ... TASK_PRI_MED - 1:
case SOF_TASK_PRI_MED + 1 ... SOF_TASK_PRI_HIGH:
irq = PLATFORM_IRQ_TASK_HIGH;
break;
case TASK_PRI_MED:
case SOF_TASK_PRI_MED:
default:
irq = PLATFORM_IRQ_TASK_MED;
break;
Expand All @@ -80,24 +78,24 @@ static int task_set_data(struct task *task)

switch (task->priority) {
#ifdef CONFIG_TASK_HAVE_PRIORITY_MEDIUM
case TASK_PRI_MED + 1 ... TASK_PRI_LOW:
case SOF_TASK_PRI_LOW ... SOF_TASK_PRI_MED - 1:
irq_task = *task_irq_low_get();
break;
case TASK_PRI_HIGH ... TASK_PRI_MED - 1:
case SOF_TASK_PRI_MED + 1 ... SOF_TASK_PRI_HIGH:
irq_task = *task_irq_high_get();
break;
case TASK_PRI_MED:
case SOF_TASK_PRI_MED:
irq_task = *task_irq_med_get();
break;
#elif CONFIG_TASK_HAVE_PRIORITY_LOW
case TASK_PRI_MED ... TASK_PRI_LOW:
case SOF_TASK_PRI_LOW ... SOF_TASK_PRI_MED:
irq_task = *task_irq_low_get();
break;
case TASK_PRI_HIGH ... TASK_PRI_MED - 1:
case SOF_TASK_PRI_MED + 1 ... SOF_TASK_PRI_HIGH:
irq_task = *task_irq_high_get();
break;
#else
case TASK_PRI_HIGH ... TASK_PRI_LOW:
case SOF_TASK_PRI_LOW ... SOF_TASK_PRI_HIGH:
irq_task = *task_irq_high_get();
break;
#endif
Expand Down Expand Up @@ -134,11 +132,11 @@ static void _irq_task(void *arg)
interrupt_clear(irq_task->irq);

list_for_item_safe(clist, tlist, &irq_task->list) {

task = container_of(clist, struct task, irq_list);
list_item_del(clist);

if (task->func && task->state == TASK_STATE_PENDING) {
if (task->func &&
task->state == SOF_TASK_STATE_PENDING) {
schedule_task_running(task);
run_task = 1;
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/arch/xtensa/up/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

#include <sof/schedule.h>

/** \brief Schedule data pointer. */
/** \brief Schedule data pointer */
static struct schedule_data *sch;

struct schedule_data **arch_schedule_get(void)
struct schedule_data **arch_schedule_get_data(void)
{
return &sch;
}
2 changes: 1 addition & 1 deletion src/audio/eq_iir.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <sof/list.h>
#include <sof/stream.h>
#include <sof/alloc.h>
#include <sof/work.h>
#include <sof/schedule.h>
#include <sof/clk.h>
#include <sof/ipc.h>
#include <sof/audio/component.h>
Expand Down
10 changes: 6 additions & 4 deletions src/audio/kpb.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
static void kpb_event_handler(int message, void *cb_data, void *event_data);
static int kpb_register_client(struct comp_data *kpb, struct kpb_client *cli);
static void kpb_init_draining(struct comp_data *kpb, struct kpb_client *cli);
static void kpb_draining_task(void *arg);
static uint64_t kpb_draining_task(void *arg);
static void kpb_buffer_data(struct comp_data *kpb, struct comp_buffer *source);

/**
Expand Down Expand Up @@ -225,7 +225,8 @@ static int kpb_prepare(struct comp_dev *dev)
notifier_register(&cd->kpb_events);

/* initialie draining task */
schedule_task_init(&cd->draining_task, kpb_draining_task, cd);
schedule_task_init(&cd->draining_task, SOF_SCHEDULE_EDF, 0,
kpb_draining_task, cd, 0, 0);

/* search for the channel selector sink.
* NOTE! We assume here that channel selector component device
Expand Down Expand Up @@ -517,15 +518,16 @@ static void kpb_init_draining(struct comp_data *kpb, struct kpb_client *cli)
"sink not ready for draining");
} else {
/* add one-time draining task into the scheduler */
schedule_task(&kpb->draining_task, 0, 0);
schedule_task(&kpb->draining_task, 0, 0, 0);
}
}

static void kpb_draining_task(void *arg)
static uint64_t kpb_draining_task(void *arg)
{
/* TODO: while loop drainning history buffer accoriding to
* clients request
*/
return 0;
}

struct comp_driver comp_kpb = {
Expand Down
25 changes: 16 additions & 9 deletions src/audio/pipeline.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <sof/cpu.h>
#include <sof/idc.h>
#include <platform/idc.h>
#include <sof/schedule.h>

/* generic pipeline data used by pipeline_comp_* functions */
struct pipeline_data {
Expand All @@ -58,13 +59,14 @@ struct pipeline_data {
int cmd;
};

static void pipeline_task(void *arg);
static uint64_t pipeline_task(void *arg);

/* create new pipeline - returns pipeline id or negative error */
struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc,
struct comp_dev *cd)
{
struct pipeline *p;
uint32_t type;

trace_pipe("pipeline_new()");

Expand All @@ -78,12 +80,16 @@ struct pipeline *pipeline_new(struct sof_ipc_pipe_new *pipe_desc,
/* init pipeline */
p->sched_comp = cd;
p->status = COMP_STATE_INIT;
schedule_task_init(&p->pipe_task, pipeline_task, p);
schedule_task_config(&p->pipe_task, pipe_desc->priority,
pipe_desc->core);

spinlock_init(&p->lock);
memcpy(&p->ipc_pipe, pipe_desc, sizeof(*pipe_desc));

/* get pipeline task type */
type = pipeline_is_timer_driven(p) ? SOF_SCHEDULE_LL :
SOF_SCHEDULE_EDF;
schedule_task_init(&p->pipe_task, type, pipe_desc->priority,
pipeline_task, p, pipe_desc->core, 0);

return p;
}

Expand Down Expand Up @@ -797,8 +803,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);

schedule_task(&p->pipe_task, start, p->ipc_pipe.deadline, 0);
}

/* notify pipeline that this component requires buffers emptied/filled
Expand All @@ -807,7 +812,8 @@ void pipeline_schedule_copy(struct pipeline *p, uint64_t start)
*/
void pipeline_schedule_copy_idle(struct pipeline *p)
{
schedule_task_idle(&p->pipe_task, p->ipc_pipe.deadline);
schedule_task(&p->pipe_task, 0, p->ipc_pipe.deadline,
SOF_SCHEDULE_FLAG_IDLE);
}

void pipeline_schedule_cancel(struct pipeline *p)
Expand All @@ -822,7 +828,7 @@ void pipeline_schedule_cancel(struct pipeline *p)
"failed, err = %d", err);
}

static void pipeline_task(void *arg)
static uint64_t pipeline_task(void *arg)
{
struct pipeline *p = arg;
int err;
Expand All @@ -843,10 +849,11 @@ static void pipeline_task(void *arg)
err = pipeline_xrun_recover(p);
if (err < 0) {
trace_pipe_error_with_ids(p, "pipeline_task(): xrun recover failed! pipeline will be stopped!");
return; /* failed - host will stop this pipeline */
goto sched; /* failed - host will stop this pipeline */
}
}

sched:
tracev_pipe("pipeline_task() sched");
return p->ipc_pipe.timer_delay;
}
6 changes: 3 additions & 3 deletions src/audio/pipeline_static.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ static struct spipe spipe[] = {

/* pipelines */
struct sof_ipc_pipe_new pipeline[] = {
SPIPE_PIPE(0, 0, 1000, TASK_PRI_HIGH), /* high pri - 1ms deadline */
// SPIPE_PIPE(1, 0, 4000, TASK_PRI_MED), /* med pri - 4ms deadline */
// SPIPE_PIPE(2, 0, 5000, TASK_PRI_LOW), /* low pri - 5ms deadline */
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 */
};

int init_static_pipeline(struct ipc *ipc)
Expand Down
1 change: 0 additions & 1 deletion src/audio/selector.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
#include <sof/list.h>
#include <sof/stream.h>
#include <sof/alloc.h>
#include <sof/work.h>
#include <sof/clk.h>
#include <sof/ipc.h>
#include "selector.h"
Expand Down
2 changes: 1 addition & 1 deletion src/audio/src.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <sof/list.h>
#include <sof/stream.h>
#include <sof/alloc.h>
#include <sof/work.h>
#include <sof/schedule.h>
#include <sof/clk.h>
#include <sof/ipc.h>
#include <sof/audio/component.h>
Expand Down
2 changes: 1 addition & 1 deletion src/audio/tone.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <sof/list.h>
#include <sof/stream.h>
#include <sof/alloc.h>
#include <sof/work.h>
#include <sof/schedule.h>
#include <sof/clk.h>
#include <sof/ipc.h>
#include <sof/audio/component.h>
Expand Down
Loading