task: make enum from task states

Makes enum from task states for better type
enforcement in the future.

Signed-off-by: Tomasz Lauda <tomasz.lauda@linux.intel.com>
This commit is contained in:
Tomasz Lauda 2019-08-02 10:48:56 +02:00 committed by Liam Girdwood
parent 99005e21bc
commit f4c6d35761
2 changed files with 13 additions and 11 deletions

View File

@ -25,20 +25,22 @@ struct sof;
#define SOF_TASK_PRI_IDC SOF_TASK_PRI_LOW
/* task states */
#define SOF_TASK_STATE_INIT 0
#define SOF_TASK_STATE_QUEUED 1
#define SOF_TASK_STATE_PENDING 2
#define SOF_TASK_STATE_RUNNING 3
#define SOF_TASK_STATE_PREEMPTED 4
#define SOF_TASK_STATE_COMPLETED 5
#define SOF_TASK_STATE_FREE 6
#define SOF_TASK_STATE_CANCEL 7
enum task_state {
SOF_TASK_STATE_INIT = 0,
SOF_TASK_STATE_QUEUED,
SOF_TASK_STATE_PENDING,
SOF_TASK_STATE_RUNNING,
SOF_TASK_STATE_PREEMPTED,
SOF_TASK_STATE_COMPLETED,
SOF_TASK_STATE_FREE,
SOF_TASK_STATE_CANCEL,
};
struct task {
uint16_t type;
uint64_t start;
uint16_t priority;
uint16_t state;
enum task_state state;
uint16_t core;
uint32_t flags;
void *data;

View File

@ -134,7 +134,7 @@ static int is_ll_pending(struct ll_schedule_data *queue)
SOF_TASK_STATE_PENDING;
pending_count++;
} else {
ll_task->state = 0;
ll_task->state = SOF_TASK_STATE_INIT;
}
} else {
/* mark pending work */
@ -145,7 +145,7 @@ static int is_ll_pending(struct ll_schedule_data *queue)
SOF_TASK_STATE_PENDING;
pending_count++;
} else {
ll_task->state = 0;
ll_task->state = SOF_TASK_STATE_INIT;
}
}
}