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: 1 addition & 1 deletion src/arch/xtensa/task.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static void _irq_task(void *arg)
uint32_t flags;

spin_lock_irq(&irq_task->lock, flags);
interrupt_clear(irq_task->irq);
list_for_item_safe(clist, tlist, &irq_task->list) {

task = container_of(clist, struct task, irq_list);
Expand All @@ -130,7 +131,6 @@ static void _irq_task(void *arg)
spin_lock_irq(&irq_task->lock, flags);
}

interrupt_clear(irq_task->irq);

spin_unlock_irq(&irq_task->lock, flags);
}
Expand Down
2 changes: 1 addition & 1 deletion src/include/sof/schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct sof;
#define TASK_PRI_MED 0
#define TASK_PRI_HIGH -20

#define TASK_PRI_IPC 1
#define TASK_PRI_IPC 6

/* maximun task time slice in microseconds */
#define SCHEDULE_TASK_MAX_TIME_SLICE 5000
Expand Down
56 changes: 28 additions & 28 deletions src/lib/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,9 @@ static inline struct task *edf_get_next(uint64_t current,
uint64_t delta;
uint64_t deadline;
int reschedule = 0;
uint32_t flags;

spin_lock_irq(&sch->lock, flags);

/* any tasks in the scheduler ? */
if (list_is_empty(&sch->list)) {
spin_unlock_irq(&sch->lock, flags);
return NULL;
}

Expand Down Expand Up @@ -160,7 +156,6 @@ static inline struct task *edf_get_next(uint64_t current,
}
}

spin_unlock_irq(&sch->lock, flags);
return next_task;
}

Expand All @@ -187,35 +182,40 @@ static struct task *schedule_edf(void)

tracev_pipe("edf");

/* get the current time */
current = platform_timer_get(platform_timer);

/* get next task to be scheduled */
task = edf_get_next(current, NULL);

interrupt_clear(PLATFORM_SCHEDULE_IRQ);

/* any tasks ? */
if (task == NULL)
return NULL;
while (!list_is_empty(&sch->list)) {
spin_lock_irq(&sch->lock, flags);

/* can task be started now ? */
if (task->start > current) {
/* no, then schedule wake up */
future_task = task;
} else {
/* yes, run current task */
task->start = current;
/* get the current time */
current = platform_timer_get(platform_timer);

/* init task for running */
wait_init(&task->complete);
spin_lock_irq(&sch->lock, flags);
task->state = TASK_STATE_RUNNING;
list_item_del(&task->list);
/* get next task to be scheduled */
task = edf_get_next(current, NULL);
spin_unlock_irq(&sch->lock, flags);

/* now run task at correct run level */
arch_run_task(task);
/* any tasks ? */
if (!task)
return NULL;

/* can task be started now ? */
if (task->start <= current) {
/* yes, run current task */
task->start = current;

/* init task for running */
spin_lock_irq(&sch->lock, flags);
task->state = TASK_STATE_RUNNING;
list_item_del(&task->list);
spin_unlock_irq(&sch->lock, flags);

/* now run task at correct run level */
arch_run_task(task);
} else {
/* no, then schedule wake up */
future_task = task;
break;
}
}

/* tell caller about future task */
Expand Down