Scheduling question for MQX

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Scheduling question for MQX

ソリューションへジャンプ
695件の閲覧回数
dongshengwang
Contributor I

I tested the following project in FRDM-k64F.

/* MQX task IDs */

#define KTEST1_TASK          1U

#define CANADA_TASK          2U

#define WORLD_TASK           3U

/* MQX task stack sizes */

#define KTEST1_TASK_STACK_SIZE 1024

const TASK_TEMPLATE_STRUCT MQX_template_list[] =

{

  /* Task: Ktest1 */

  {

    /* Task number                    */  KTEST1_TASK,

    /* Entry point                    */  (TASK_FPTR)Ktest1_task,

    /* Stack size                     */  KTEST1_TASK_STACK_SIZE,

    /* Task priority                  */  8U,

    /* Task name                      */  "ktest1",

    /* Task attributes                */  (MQX_AUTO_START_TASK),

    /* Task parameter                 */  (uint32_t)(0),

    /* Task time slice                */  (uint32_t)(0)

  },     

  /* Task: CANADA */

  {

    /* Task number                    */  CANADA_TASK,

    /* Entry point                    */  (TASK_FPTR)Canada_task,

    /* Stack size                     */  KTEST1_TASK_STACK_SIZE,

    /* Task priority                  */  8U,

    /* Task name                      */  "Canada",

    /* Task attributes                */  (MQX_TIME_SLICE_TASK),

    /* Task parameter                 */  (uint32_t)(0),

    /* Task time slice                */  (uint32_t)(100)

  },

  /* Task: WORLD */

  {

    /* Task number                    */  WORLD_TASK,

    /* Entry point                    */  (TASK_FPTR)World_task,

    /* Stack size                     */  KTEST1_TASK_STACK_SIZE,

    /* Task priority                  */  8U,

    /* Task name                      */  "World",

    /* Task attributes                */  (MQX_TIME_SLICE_TASK),

    /* Task parameter                 */  (uint32_t)(0),

    /* Task time slice                */  (uint32_t)(100)

  },

  TASK_TEMPLATE_LIST_END

};

void Ktest1_task(uint32_t task_init_data)

{

  _task_id ktest1child;

  ktest1child = _task_create(0, CANADA_TASK, 0);

  if(ktest1child==MQX_NULL_TASK_ID)

  {

  printf("\nFailed to create task Canada\n");

  }

  else

  printf("\nSuccess to create task Canada\n");

  ktest1child = _task_create(0, WORLD_TASK, 0);

  if(ktest1child==MQX_NULL_TASK_ID)

  printf("\nfailed to create task World\n");

  else

  printf("\nsuccess to create task World\n");

  _task_block();

}

void Canada_task(uint32_t task_init_data)

{

  int counter = 0;

  printf("\nHellow Canada\n");

  while(1) {

    counter++;

    /* Write your code here ... */

  }

}

void World_task(uint32_t task_init_data)

{

  int counter = 0;

  printf("\nHellow World\n");

  while(1) {

    counter++;

    /* Write your code here ... */

  }

}

When I run this project, the status of task ktest1 is blocked. the status of _mqx_init_task is terminating. the status of task Canada is always active, and the status of task World is always ready, even I set the Canada_task as MQX_TIME_SLICE_TASK. It still looks like FIFO Scheduling.

0 件の賞賛
返信
1 解決策
456件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi,

Could you please double check you enable the time slice you need in the user_config.h?

#define MQX_HAS_TIME_SLICE                        1

Which  MQX version are you using? Are you using CW???


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
457件の閲覧回数
soledad
NXP Employee
NXP Employee

Hi,

Could you please double check you enable the time slice you need in the user_config.h?

#define MQX_HAS_TIME_SLICE                        1

Which  MQX version are you using? Are you using CW???


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信