Saturday, October 21st 2017, 6:50am UTC+2

You are not logged in.

  • Login
  • Register

Dear visitor, welcome to SEGGER Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

pawdrexel

Beginner

Date of registration: Nov 15th 2011

Posts: 4

Location: Coquitlam, BC, Canada

Occupation: Electrical Engineer

1

Thursday, December 15th 2011, 6:35pm

Task Priorities Question

All of the MainTask() task functions of embOS/IP example applications are structured like this...

C/C++ Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void MainTask(void) {
  IP_Init();
  OS_SetPriority(OS_GetTaskID(), 255);                              	// This task has highest prio!
  OS_CREATETASK(&_TCB,   	"IP_Task", IP_Task, 150, _Stack);
#if USE_RX_TASK
  OS_CREATETASK(&_IPRxTCB, "IP_RxTask", IP_RxTask, 140, _IPRxStack);   // Start the IP_RxTask, optional.
#endif
  while (IP_IFaceIsReady() == 0) {
	OS_Delay(50);
  }
  //
  // Start ... task if interface ready.
  //
  OS_CREATETASK_EX(...);
  while (1) {
	BSP_ToggleLED(1);
	OS_Delay (200);
  }
}


In the embOS/IP manual UM07001 on p. 64 the note for IP_Task() reads "The priority of task IP_Task should be higher then the priority of an application
task which uses the stack." I understand that, but why does the code above appear to be setting the priority of MainTask() to maximum (higher than IP_Task)?