<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Arial; font-size: 10pt; color: #000000'><style>p { margin: 0; }</style><div style="font-family: Arial; font-size: 10pt; color: rgb(0, 0, 0);">Hi,<br><br>I'm running RTEMS 4.10 on Gaisler-RASTA platform with Leon2 processor.<br><br>I'm trying to run 2 tasks with priorities but failing to get my code to work. The code is:<br><br>--------------<br>#include <rtems.h><br>#include <bsp.h> /* for device driver prototypes */<br>#include <pthread.h><br>#include <stdio.h><br>#include <stdlib.h><br><br>#define CONFIGURE_INIT_TASK_ENTRY_POINT POSIX_Init<br><br>pthread_t task_2_id;<br><br>void* task_2(void* arg)<br>{<br> int type;<br> struct sched_param sch_params;<br> pthread_getschedparam(task_2_id, &type, &sch_params);<br> while(1)<br> {<br> printf("TASK 2 priority: %d\n", sch_params.sched_priority);<br> sleep(1);<br> }<br>}<br><br>//rtems_task Init(rtems_task_argument ignored) <br>//void* POSIX_Init() <br>void *POSIX_Init(void *argument)<br><br>{<br> int type;<br> int status;<br> pthread_attr_t attr;<br> struct sched_param sch_params;<br><br> pthread_attr_init(&attr);<br> sch_params.sched_priority = 100;<br> pthread_attr_setschedpolicy(&attr, SCHED_FIFO);<br> pthread_attr_setschedparam(&attr,&sch_params);<br><br> /* Main task with priority */<br> status = pthread_create(&task_2_id,<br> &attr,<br> task_2,<br> NULL);<br> printf("Status: %d\n", status);<br><br> pthread_getschedparam(pthread_self(), &type, &sch_params);<br><br> while(1)<br> {<br> printf("Maint task priority: %d\n", sch_params.sched_priority);<br> sleep(1);<br> }<br><br> exit(0);<br>}<br><br>#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER<br>#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER<br>#define CONFIGURE_MAXIMUM_POSIX_THREADS 4<br>#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br>/* #define CONFIGURE_MAXIMUM_TASKS 4 */<br><br>/* #define CONFIGURE_RTEMS_INIT_TASKS_TABLE */<br><br>/* #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) */<br><br>/* configuration information */<br>#define CONFIGURE_INIT<br>#include <confdefs.h> <br>--------------<br><span><br>But at the console I get:<br>-------------<br>Status: 0<br>Maint task priority: 2<br>TASK 2 priority: 2<br>Maint task priority: 2<br>TASK 2 priority: 2<br>Maint task priority: 2<br>TASK 2 priority: 2<br>-------------<br><br>Can some one point me to the right direction why. Thanks,<br>Indy<br><span></span><font size="1">________________________________________ <br>Inderjit Singh <br>Software Engineer<br>Avionics & Embedded Systems</font><font size="1"><br>Email: <a href="http://inderjit.singh@spaceapplications.com%20" target="_blank">inderjit.singh@spaceapplications.com </a><br><br>Space Applications Services <br>Leuvensesteenweg 325 <br>B-1932 Zaventem <br>Belgium <br>Direct Tel: +32-(0)2-416.05.27<br>Fax: +32 (0)2-721.54.44<br><span style="color: rgb(0, 153, 0);">Please consider the environment before printing this email</span></font><span></span><br></span><br></div></div></body></html>