This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TaskCreate只有一个任务被执行



hi,

我调用TaskCreate创建两个任务,但只有第一个被执行,请问下是哪里配置不对?

代码如下:

static void alg1_process_thread(void *context1, void *context2, void *context3)
{
struct alg *alg;
struct dsp_chip *chip;

chip = get_dsp_chip();
alg = &chip->alg;

DBG(DBG_INFO, "alg1 task running\n");

while(alg->task_running){
struct video_frame *frame;
struct list_head *list;

/*alg function*/
if(!list_empty(&alg->busy)){
DBG(DBG_DEBUG, "\n");
lock(&alg->lock);
list = list_del_head(&alg->busy);
unlock(&alg->lock);
frame = (struct video_frame *)list->private;
/*process frame*/

/*call upp driver free*/
if(frame->free_fn){
frame->free_fn(frame, frame->free_context);
}
/*add node to free list*/
lock(&alg->lock);
list_add_tail(list, &alg->free);
unlock(&alg->lock);
}else{
TaskYield();
}
}

TaskBlock( TaskSelf() );
}

static void alg2_process_thread(void *context1, void *context2, void *context3)
{
struct alg *alg;
struct dsp_chip *chip;

chip = get_dsp_chip();
alg = &chip->alg;

DBG(DBG_INFO, "alg2 task running\n");

while(alg->task_running){
struct video_frame *frame;
struct list_head *list;

/*alg function*/
if(!list_empty(&alg->busy)){
DBG(DBG_DEBUG, "\n");
lock(&alg->lock);
list = list_del_head(&alg->busy);
unlock(&alg->lock);
frame = (struct video_frame *)list->private;
/*process frame*/

/*call upp driver free*/
if(frame->free_fn){
frame->free_fn(frame, frame->free_context);
}
/*add node to free list*/
lock(&alg->lock);
list_add_tail(list, &alg->free);
unlock(&alg->lock);
}else{
TaskYield();
}
}

TaskBlock( TaskSelf() );
}

alg->task1 = TaskCreate( alg1_process_thread, "alg1", OS_TASKPRINORM, 0x1400, (UINT32 )alg, 0, 0 );

alg->task2 = TaskCreate( alg2_process_thread, "alg2", OS_TASKPRINORM, 0x1400, (UINT32 )alg, 0, 0 );

平台:

DSP:C6657

bios:6.37.5.35