[pok-devel] [37] Add ARINC653 set_priority function

[ Thread Index | Date Index | More lists.tuxfamily.org/pok-devel Archives ]


Revision: 37
Author:   mha
Date:     2012-08-29 12:04:41 +0200 (Wed, 29 Aug 2012)
Log Message:
-----------
Add ARINC653 set_priority function

Modified Paths:
--------------
    trunk/kernel/core/syscall.c
    trunk/kernel/core/thread.c
    trunk/kernel/include/core/syscall.h
    trunk/kernel/include/core/thread.h
    trunk/kernel/include/errno.h
    trunk/libpok/arinc653/process.c
    trunk/libpok/core/Makefile
    trunk/libpok/include/core/syscall.h
    trunk/libpok/include/core/thread.h
    trunk/libpok/include/errno.h
    trunk/misc/release-files

Modified: trunk/kernel/core/syscall.c
===================================================================
--- trunk/kernel/core/syscall.c	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/kernel/core/syscall.c	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Wed Oct 21 13:12:27 2009 
+ * Created by julien on Wed Oct 21 13:12:27 2009
  */
 
 #include <bsp.h>
@@ -81,7 +81,7 @@
 
 #endif
 
-#if defined POK_NEEDS_GETTICK 
+#if defined POK_NEEDS_GETTICK
       case POK_SYSCALL_GETTICK:
          POK_CHECK_PTR_OR_RETURN(infos->partition, args->arg1 + infos->base_addr)
          return pok_gettick_by_pointer ((uint64_t*) (args->arg1 + infos->base_addr));
@@ -121,10 +121,14 @@
          return pok_sched_get_current ((uint32_t*) (args->arg1 + infos->base_addr));
          break;
 #endif
-      case POK_SYSCALL_THREAD_STATUS:
-	return pok_thread_get_status (args->arg1, (pok_thread_attr_t*) (args->arg2 + infos->base_addr));
+   case POK_SYSCALL_THREAD_STATUS:
+	      return pok_thread_get_status (args->arg1, (pok_thread_attr_t*) (args->arg2 + infos->base_addr));
          break;
 
+   case POK_SYSCALL_THREAD_SET_PRIORITY:
+	   return pok_thread_set_priority (args->arg1, args->arg2);
+	   break;
+
 #ifdef POK_NEEDS_ERROR_HANDLING
 
 /**

Modified: trunk/kernel/core/thread.c
===================================================================
--- trunk/kernel/core/thread.c	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/kernel/core/thread.c	2012-08-29 10:04:41 UTC (rev 37)
@@ -303,7 +303,7 @@
 pok_ret_t pok_thread_get_status (const uint32_t id, pok_thread_attr_t *attr)
 {
   if (POK_CURRENT_PARTITION.thread_index_low > id || POK_CURRENT_PARTITION.thread_index_high < id)
-    return POK_ERRNO_THREADATTR;
+    return POK_ERRNO_PARAM;
   attr->deadline = pok_threads[id].end_time;
   attr->state = pok_threads[id].state;
   attr->priority = pok_threads[id].priority;
@@ -313,4 +313,15 @@
   attr->stack_size = POK_USER_STACK_SIZE;
   return POK_ERRNO_OK;
 }
+
+pok_ret_t      pok_thread_set_priority (const uint32_t id, const uint32_t priority)
+{
+	if (POK_CURRENT_PARTITION.thread_index_low > id || POK_CURRENT_PARTITION.thread_index_high < id)
+		return POK_ERRNO_PARAM;
+	pok_threads[id].priority = priority;
+	/* preemption is always enabled so ... */
+	pok_sched();
+	return POK_ERRNO_OK;
+}
+
 #endif

Modified: trunk/kernel/include/core/syscall.h
===================================================================
--- trunk/kernel/include/core/syscall.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/kernel/include/core/syscall.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 #ifndef __POK_SYSCALL_H__
@@ -35,6 +35,7 @@
    POK_SYSCALL_THREAD_STOPSELF                     =  57,
    POK_SYSCALL_THREAD_ID                           =  58,
    POK_SYSCALL_THREAD_STATUS                       =  59,
+   POK_SYSCALL_THREAD_SET_PRIORITY								 =  60,
 #ifdef POK_NEEDS_PORTS_SAMPLING
    POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
    POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,

Modified: trunk/kernel/include/core/thread.h
===================================================================
--- trunk/kernel/include/core/thread.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/kernel/include/core/thread.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 
@@ -37,7 +37,7 @@
 #define POK_THREAD_DEFAULT_TIME_CAPACITY 10
 
 /*
-#define KERNEL_THREAD		POK_CONFIG_NB_THREADS 
+#define KERNEL_THREAD		POK_CONFIG_NB_THREADS
 #define IDLE_THREAD        POK_CONFIG_NB_THREADS + 1
 */
 
@@ -74,7 +74,7 @@
    uint32_t	   sp;
    uint32_t    init_stack_addr;
    /* stack pointer
-    * FIXME: this is platform-dependent code, we have to handle that ! */                      
+    * FIXME: this is platform-dependent code, we have to handle that ! */
 } pok_thread_t;
 
 typedef struct
@@ -100,6 +100,7 @@
 pok_ret_t      pok_thread_suspend (void);
 pok_ret_t      pok_thread_restart (const uint32_t tid);
 pok_ret_t      pok_thread_get_status (const uint32_t id, pok_thread_attr_t *attr);
+pok_ret_t      pok_thread_set_priority (const uint32_t id, const uint32_t priority);
 
 #ifdef POK_NEEDS_PARTITIONS
 pok_ret_t		pok_partition_thread_create (uint32_t* thread_id,

Modified: trunk/kernel/include/errno.h
===================================================================
--- trunk/kernel/include/errno.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/kernel/include/errno.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 
@@ -20,48 +20,49 @@
 
 typedef enum
 {
-    POK_ERRNO_OK                    =   0,
-    POK_ERRNO_EINVAL                =   1,
+		POK_ERRNO_OK                    =   0,
+		POK_ERRNO_EINVAL                =   1,
 
-    POK_ERRNO_UNAVAILABLE           =   2,
-    POK_ERRNO_TOOMANY               =   5,
-    POK_ERRNO_EPERM                 =   6,
-    POK_ERRNO_EXISTS                =   7,
+		POK_ERRNO_UNAVAILABLE           =   2,
+		POK_ERRNO_PARAM									=   3,
+		POK_ERRNO_TOOMANY               =   5,
+		POK_ERRNO_EPERM                 =   6,
+		POK_ERRNO_EXISTS                =   7,
 
-    POK_ERRNO_ERANGE                =   8,
-    POK_ERRNO_EDOM                  =   9,
-    POK_ERRNO_HUGE_VAL              =  10,
+		POK_ERRNO_ERANGE                =   8,
+		POK_ERRNO_EDOM                  =   9,
+		POK_ERRNO_HUGE_VAL              =  10,
 
-    POK_ERRNO_EFAULT                =  11,
+		POK_ERRNO_EFAULT                =  11,
 
-    POK_ERRNO_THREAD                =  49,
-    POK_ERRNO_THREADATTR            =  50,
+		POK_ERRNO_THREAD                =  49,
+		POK_ERRNO_THREADATTR            =  50,
 
-    POK_ERRNO_TIME                 =  100,
+		POK_ERRNO_TIME                 =  100,
 
-    POK_ERRNO_PARTITION_ATTR        = 200,
+		POK_ERRNO_PARTITION_ATTR        = 200,
 
-    POK_ERRNO_PORT                 =  301,
-    POK_ERRNO_NOTFOUND             =  302,
-    POK_ERRNO_DIRECTION            =  303,
-    POK_ERRNO_SIZE                 =  304,
-    POK_ERRNO_DISCIPLINE           =  305,
-    POK_ERRNO_PORTPART             =  307,
-    POK_ERRNO_EMPTY                =  308,
-    POK_ERRNO_KIND                 =  309,
-    POK_ERRNO_FULL                 =  311,
-    POK_ERRNO_READY                =  310,
-    POK_ERRNO_TIMEOUT              =  250,
-    POK_ERRNO_MODE                 =  251,
+		POK_ERRNO_PORT                 =  301,
+		POK_ERRNO_NOTFOUND             =  302,
+		POK_ERRNO_DIRECTION            =  303,
+		POK_ERRNO_SIZE                 =  304,
+		POK_ERRNO_DISCIPLINE           =  305,
+		POK_ERRNO_PORTPART             =  307,
+		POK_ERRNO_EMPTY                =  308,
+		POK_ERRNO_KIND                 =  309,
+		POK_ERRNO_FULL                 =  311,
+		POK_ERRNO_READY                =  310,
+		POK_ERRNO_TIMEOUT              =  250,
+		POK_ERRNO_MODE                 =  251,
 
-    POK_ERRNO_LOCKOBJ_UNAVAILABLE  =  500,
-    POK_ERRNO_LOCKOBJ_NOTREADY     =  501,
-    POK_ERRNO_LOCKOBJ_KIND         =  502,
-    POK_ERRNO_LOCKOBJ_POLICY       =  503,
+		POK_ERRNO_LOCKOBJ_UNAVAILABLE  =  500,
+		POK_ERRNO_LOCKOBJ_NOTREADY     =  501,
+		POK_ERRNO_LOCKOBJ_KIND         =  502,
+		POK_ERRNO_LOCKOBJ_POLICY       =  503,
 
-    POK_ERRNO_PARTITION_MODE       =  601,
+		POK_ERRNO_PARTITION_MODE       =  601,
 
-    POK_ERRNO_PARTITION            =  401
+		POK_ERRNO_PARTITION            =  401
 } pok_ret_t;
 
 

Modified: trunk/libpok/arinc653/process.c
===================================================================
--- trunk/libpok/arinc653/process.c	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/libpok/arinc653/process.c	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 
@@ -26,168 +26,185 @@
 #include <libc/string.h>
 
 void GET_PROCESS_ID (PROCESS_NAME_TYPE process_name[MAX_NAME_LENGTH],
-                     PROCESS_ID_TYPE   *process_id,
-                     RETURN_CODE_TYPE  *return_code )
+										 PROCESS_ID_TYPE   *process_id,
+										 RETURN_CODE_TYPE  *return_code )
 {
-  int id;
+	int id;
 
-  if ((id = process_name_exist(process_name)) == 0)
-    {
-      *process_id = id;
-      *return_code = INVALID_CONFIG;
-    }
-  else
-    {
-      *process_id = id;
-      *return_code = NO_ERROR;
-    }
+	if ((id = process_name_exist(process_name)) == 0)
+		{
+			*process_id = id;
+			*return_code = INVALID_CONFIG;
+		}
+	else
+		{
+			*process_id = id;
+			*return_code = NO_ERROR;
+		}
 }
 
 void GET_MY_ID (PROCESS_ID_TYPE   *process_id,
 		RETURN_CODE_TYPE  *return_code )
 {
-  pok_ret_t         core_ret;
-  uint32_t	    thread_id;  
+	pok_ret_t         core_ret;
+	uint32_t			thread_id;
 
-  core_ret = pok_thread_id (&thread_id);
-  if (core_ret != 0)
-    *return_code = INVALID_MODE;
-  *process_id = thread_id;
-  *return_code = NO_ERROR;
+	core_ret = pok_thread_id (&thread_id);
+	if (core_ret != 0)
+		*return_code = INVALID_MODE;
+	*process_id = thread_id;
+	*return_code = NO_ERROR;
 }
 
 void GET_PROCESS_STATUS (PROCESS_ID_TYPE     process_id,
-                         PROCESS_STATUS_TYPE *process_status,
-                         RETURN_CODE_TYPE    *return_code )
+												 PROCESS_STATUS_TYPE *process_status,
+												 RETURN_CODE_TYPE    *return_code )
 {
-  pok_thread_attr_t	attr;
-  pok_ret_t		core_ret;
+	pok_thread_attr_t	attr;
+	pok_ret_t		core_ret;
 
-  core_ret = pok_thread_status (process_id, &attr);
-  if (core_ret != 0)
-    {
-      *return_code =  INVALID_CONFIG;
-      return ;
-    }
-  process_status->DEADLINE_TIME = attr.deadline;
-  process_status->PROCESS_STATE = attr.state;
-  strcpy(process_status->ATTRIBUTES.NAME, arinc_process_attribute[process_id].NAME);
-  process_status->ATTRIBUTES.BASE_PRIORITY = arinc_process_attribute[process_id].BASE_PRIORITY;
-  process_status->ATTRIBUTES.DEADLINE = HARD;
-  process_status->CURRENT_PRIORITY = attr.priority;
-  process_status->ATTRIBUTES.PERIOD = attr.period;
-  process_status->ATTRIBUTES.TIME_CAPACITY = attr.time_capacity;
-  process_status->ATTRIBUTES.ENTRY_POINT = attr.entry;
-  process_status->ATTRIBUTES.STACK_SIZE = attr.stack_size;
-  *return_code = NO_ERROR;
+	core_ret = pok_thread_status (process_id, &attr);
+	if (core_ret ==  POK_ERRNO_PARAM)
+		{
+			*return_code =  INVALID_PARAM;
+			return ;
+		}
+	process_status->DEADLINE_TIME = attr.deadline;
+	process_status->PROCESS_STATE = attr.state;
+	strcpy(process_status->ATTRIBUTES.NAME, arinc_process_attribute[process_id].NAME);
+	process_status->ATTRIBUTES.BASE_PRIORITY = arinc_process_attribute[process_id].BASE_PRIORITY;
+	process_status->ATTRIBUTES.DEADLINE = HARD;
+	process_status->CURRENT_PRIORITY = attr.priority;
+	process_status->ATTRIBUTES.PERIOD = attr.period;
+	process_status->ATTRIBUTES.TIME_CAPACITY = attr.time_capacity;
+	process_status->ATTRIBUTES.ENTRY_POINT = attr.entry;
+	process_status->ATTRIBUTES.STACK_SIZE = attr.stack_size;
+	*return_code = NO_ERROR;
 }
 
 void CREATE_PROCESS (PROCESS_ATTRIBUTE_TYPE  *attributes,
-                     PROCESS_ID_TYPE         *process_id,
-                     RETURN_CODE_TYPE        *return_code )
+										 PROCESS_ID_TYPE         *process_id,
+										 RETURN_CODE_TYPE        *return_code )
 {
-   pok_thread_attr_t core_attr;
-   pok_ret_t         core_ret;
-   uint32_t          core_process_id;
+	 pok_thread_attr_t core_attr;
+	 pok_ret_t         core_ret;
+	 uint32_t          core_process_id;
 
-   if (process_name_exist(&attributes->NAME))
-     {
-       *return_code = NO_ACTION;
-       return;
-     }
-   if (attributes->BASE_PRIORITY > MAX_PRIORITY_VALUE || attributes->BASE_PRIORITY < MIN_PRIORITY_VALUE)
-     {
-       *return_code = INVALID_PARAM;
-       return;
-     }
-   core_attr.priority        = (uint8_t) attributes->BASE_PRIORITY;
-   core_attr.entry           = attributes->ENTRY_POINT;
-   core_attr.period          = attributes->PERIOD;
-   core_attr.deadline        = attributes->DEADLINE;
-   core_attr.time_capacity   = attributes->TIME_CAPACITY;
-   core_attr.stack_size      = attributes->STACK_SIZE;
+	 if (process_name_exist(&attributes->NAME))
+		 {
+			 *return_code = NO_ACTION;
+			 return;
+		 }
+	 if (attributes->BASE_PRIORITY > MAX_PRIORITY_VALUE || attributes->BASE_PRIORITY < MIN_PRIORITY_VALUE)
+		 {
+			 *return_code = INVALID_PARAM;
+			 return;
+		 }
+	 core_attr.priority        = (uint8_t) attributes->BASE_PRIORITY;
+	 core_attr.entry           = attributes->ENTRY_POINT;
+	 core_attr.period          = attributes->PERIOD;
+	 core_attr.deadline        = attributes->DEADLINE;
+	 core_attr.time_capacity   = attributes->TIME_CAPACITY;
+	 core_attr.stack_size      = attributes->STACK_SIZE;
 
-   core_ret = pok_thread_create (&core_process_id, &core_attr);
-   arinc_process_attribute[core_process_id].BASE_PRIORITY = attributes->BASE_PRIORITY;
-   strcpy(arinc_process_attribute[core_process_id].NAME, attributes->NAME);
-   *process_id = core_process_id;
-   *return_code = core_ret;
+	 core_ret = pok_thread_create (&core_process_id, &core_attr);
+	 arinc_process_attribute[core_process_id].BASE_PRIORITY = attributes->BASE_PRIORITY;
+	 strcpy(arinc_process_attribute[core_process_id].NAME, attributes->NAME);
+	 *process_id = core_process_id;
+	 *return_code = core_ret;
 }
 
 void STOP_SELF ()
 {
-   pok_thread_stop_self ();
+	 pok_thread_stop_self ();
 }
 
 
-
-#ifndef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE
 void SET_PRIORITY (PROCESS_ID_TYPE  process_id,
-                   PRIORITY_TYPE    priority,
-                   RETURN_CODE_TYPE *return_code )
+									 PRIORITY_TYPE    priority,
+									 RETURN_CODE_TYPE *return_code )
 {
-   (void) process_id;
-   (void) priority;
-   *return_code = NOT_AVAILABLE;
+	pok_thread_attr_t core_attr;
+	pok_ret_t         core_ret;
+
+	core_ret = pok_thread_status (process_id, &core_attr);
+	if (core_ret != POK_ERRNO_OK)
+		{
+			*return_code =  INVALID_PARAM;
+			return;
+		}
+	if (priority > MAX_PRIORITY_VALUE || priority < MIN_PRIORITY_VALUE)
+		{
+			*return_code = INVALID_PARAM;
+			return;
+		}
+	if (core_attr.state == DORMANT)
+		{
+			*return_code = INVALID_MODE;
+			return;
+		}
+	core_ret = pok_thread_set_priority(process_id, priority);
+	*return_code = core_ret;
 }
 
+#ifndef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE
 void SUSPEND_SELF (SYSTEM_TIME_TYPE time_out,
-                   RETURN_CODE_TYPE *return_code )
+									 RETURN_CODE_TYPE *return_code )
 {
-   (void) time_out;
-   *return_code = NOT_AVAILABLE;
+	 (void) time_out;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void SUSPEND (PROCESS_ID_TYPE    process_id,
-              RETURN_CODE_TYPE   *return_code )
+							RETURN_CODE_TYPE   *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	 (void) process_id;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void RESUME (PROCESS_ID_TYPE     process_id,
-             RETURN_CODE_TYPE    *return_code )
+						 RETURN_CODE_TYPE    *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	 (void) process_id;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void STOP (PROCESS_ID_TYPE    process_id,
-           RETURN_CODE_TYPE   *return_code )
+					 RETURN_CODE_TYPE   *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	 (void) process_id;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void START (PROCESS_ID_TYPE   process_id,
-            RETURN_CODE_TYPE *return_code )
+						RETURN_CODE_TYPE *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	 (void) process_id;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void DELAYED_START (PROCESS_ID_TYPE   process_id,
-		    SYSTEM_TIME_TYPE  delay_time,
-		    RETURN_CODE_TYPE *return_code )
+				SYSTEM_TIME_TYPE  delay_time,
+				RETURN_CODE_TYPE *return_code )
 {
-   (void) process_id;
-   (void) delay_time;
-   *return_code = NOT_AVAILABLE;
+	 (void) process_id;
+	 (void) delay_time;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void LOCK_PREEMPTION (LOCK_LEVEL_TYPE     *lock_level,
-                      RETURN_CODE_TYPE    *return_code )
+											RETURN_CODE_TYPE    *return_code )
 {
-   (void) lock_level;
-   *return_code = NOT_AVAILABLE;
+	 (void) lock_level;
+	 *return_code = NOT_AVAILABLE;
 }
 
 void UNLOCK_PREEMPTION (LOCK_LEVEL_TYPE   *lock_level,
-                        RETURN_CODE_TYPE  *return_code )
+												RETURN_CODE_TYPE  *return_code )
 
 {
-   (void) lock_level;
-   *return_code = NOT_AVAILABLE;
+	 (void) lock_level;
+	 *return_code = NOT_AVAILABLE;
 }
 #endif
 

Modified: trunk/libpok/core/Makefile
===================================================================
--- trunk/libpok/core/Makefile	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/libpok/core/Makefile	2012-08-29 10:04:41 UTC (rev 37)
@@ -36,7 +36,8 @@
 			threadperiod.o \
 			threadsleep.o \
 			threadstatus.o \
-			threadid.o 
+			threadid.o \
+			threadpriority.o
 
 LO_DEPS=
 

Modified: trunk/libpok/include/core/syscall.h
===================================================================
--- trunk/libpok/include/core/syscall.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/libpok/include/core/syscall.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 #ifndef __LIBPOK_SYSCALL_H__
@@ -22,78 +22,76 @@
 
 typedef enum
 {
-   POK_SYSCALL_CONSWRITE                           =  10,
-   POK_SYSCALL_GETTICK                             =  20,
-   POK_SYSCALL_INT_NUMBER                          =  42,
-   POK_SYSCALL_THREAD_CREATE                       =  50,
-   POK_SYSCALL_THREAD_SLEEP_UNTIL                  =  51,
-   POK_SYSCALL_THREAD_SLEEP                        =  52,
-   POK_SYSCALL_THREAD_SUSPEND                      =  53,
-   POK_SYSCALL_THREAD_RESTART                      =  54,
-   POK_SYSCALL_THREAD_STOP                         =  55,
-   POK_SYSCALL_THREAD_PERIOD                       =  56,
-   POK_SYSCALL_THREAD_STOPSELF                     =  57,
-   POK_SYSCALL_THREAD_ID                           =  58,
-   POK_SYSCALL_THREAD_STATUS                       =  59,
-   POK_SYSCALL_THREAD_DEADLINE                     =  60,
-   POK_SYSCALL_THREAD_STATE                        =  61,
-
+	 POK_SYSCALL_CONSWRITE                           =  10,
+	 POK_SYSCALL_GETTICK                             =  20,
+	 POK_SYSCALL_INT_NUMBER                          =  42,
+	 POK_SYSCALL_THREAD_CREATE                       =  50,
+	 POK_SYSCALL_THREAD_SLEEP_UNTIL                  =  51,
+	 POK_SYSCALL_THREAD_SLEEP                        =  52,
+	 POK_SYSCALL_THREAD_SUSPEND                      =  53,
+	 POK_SYSCALL_THREAD_RESTART                      =  54,
+	 POK_SYSCALL_THREAD_STOP                         =  55,
+	 POK_SYSCALL_THREAD_PERIOD                       =  56,
+	 POK_SYSCALL_THREAD_STOPSELF                     =  57,
+	 POK_SYSCALL_THREAD_ID                           =  58,
+	 POK_SYSCALL_THREAD_STATUS                       =  59,
+	 POK_SYSCALL_THREAD_SET_PRIORITY								 =  60,
 #ifdef POK_NEEDS_PORTS_SAMPLING
-   POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
-   POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,
-   POK_SYSCALL_MIDDLEWARE_SAMPLING_STATUS          = 103,
-   POK_SYSCALL_MIDDLEWARE_SAMPLING_WRITE           = 104,
-   POK_SYSCALL_MIDDLEWARE_SAMPLING_CREATE          = 105,
+	 POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
+	 POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,
+	 POK_SYSCALL_MIDDLEWARE_SAMPLING_STATUS          = 103,
+	 POK_SYSCALL_MIDDLEWARE_SAMPLING_WRITE           = 104,
+	 POK_SYSCALL_MIDDLEWARE_SAMPLING_CREATE          = 105,
 #endif
 #ifdef POK_NEEDS_PORTS_QUEUEING
-   POK_SYSCALL_MIDDLEWARE_QUEUEING_CREATE          = 110,
-   POK_SYSCALL_MIDDLEWARE_QUEUEING_SEND            = 111,
-   POK_SYSCALL_MIDDLEWARE_QUEUEING_RECEIVE         = 112,
-   POK_SYSCALL_MIDDLEWARE_QUEUEING_ID              = 113,
-   POK_SYSCALL_MIDDLEWARE_QUEUEING_STATUS          = 114,
+	 POK_SYSCALL_MIDDLEWARE_QUEUEING_CREATE          = 110,
+	 POK_SYSCALL_MIDDLEWARE_QUEUEING_SEND            = 111,
+	 POK_SYSCALL_MIDDLEWARE_QUEUEING_RECEIVE         = 112,
+	 POK_SYSCALL_MIDDLEWARE_QUEUEING_ID              = 113,
+	 POK_SYSCALL_MIDDLEWARE_QUEUEING_STATUS          = 114,
 #endif
 #ifdef POK_NEEDS_PORTS_VIRTUAL
-   POK_SYSCALL_MIDDLEWARE_VIRTUAL_CREATE           = 150,
-   POK_SYSCALL_MIDDLEWARE_VIRTUAL_NB_DESTINATIONS  = 151,
-   POK_SYSCALL_MIDDLEWARE_VIRTUAL_DESTINATION      = 152,
-   POK_SYSCALL_MIDDLEWARE_VIRTUAL_GET_GLOBAL       = 153,
+	 POK_SYSCALL_MIDDLEWARE_VIRTUAL_CREATE           = 150,
+	 POK_SYSCALL_MIDDLEWARE_VIRTUAL_NB_DESTINATIONS  = 151,
+	 POK_SYSCALL_MIDDLEWARE_VIRTUAL_DESTINATION      = 152,
+	 POK_SYSCALL_MIDDLEWARE_VIRTUAL_GET_GLOBAL       = 153,
 #endif
 #if defined (POK_NEEDS_LOCKOBJECTS) || defined (POK_NEEDS_MUTEXES) || defined (POK_NEEDS_SEMAPHORES) || defined (POK_NEEDS_EVENTS) || defined (POK_NEEDS_BUFFERS) || defined (POK_NEEDS_BLACKBOARDS)
-   POK_SYSCALL_LOCKOBJ_CREATE                      = 201,
-   POK_SYSCALL_LOCKOBJ_OPERATION                   = 202,
+	 POK_SYSCALL_LOCKOBJ_CREATE                      = 201,
+	 POK_SYSCALL_LOCKOBJ_OPERATION                   = 202,
 #endif
 #ifdef POK_NEEDS_ERROR_HANDLING
-   POK_SYSCALL_ERROR_HANDLER_CREATE                = 301,
-   POK_SYSCALL_ERROR_HANDLER_SET_READY             = 302,
-   POK_SYSCALL_ERROR_RAISE_APPLICATION_ERROR       = 303,
-   POK_SYSCALL_ERROR_GET                           = 304,
+	 POK_SYSCALL_ERROR_HANDLER_CREATE                = 301,
+	 POK_SYSCALL_ERROR_HANDLER_SET_READY             = 302,
+	 POK_SYSCALL_ERROR_RAISE_APPLICATION_ERROR       = 303,
+	 POK_SYSCALL_ERROR_GET                           = 304,
 #endif
 #ifdef POK_NEEDS_PARTITIONS
-   POK_SYSCALL_PARTITION_SET_MODE                  = 404,
-   POK_SYSCALL_PARTITION_GET_ID	                   = 405,
-   POK_SYSCALL_PARTITION_GET_PERIOD                = 406,
-   POK_SYSCALL_PARTITION_GET_DURATION              = 407,
-   POK_SYSCALL_PARTITION_GET_LOCK_LEVEL            = 408,
-   POK_SYSCALL_PARTITION_GET_OPERATING_MODE        = 409,
-   POK_SYSCALL_PARTITION_GET_START_CONDITION       = 410,
+	 POK_SYSCALL_PARTITION_SET_MODE                  = 404,
+	 POK_SYSCALL_PARTITION_GET_ID										 = 405,
+	 POK_SYSCALL_PARTITION_GET_PERIOD                = 406,
+	 POK_SYSCALL_PARTITION_GET_DURATION              = 407,
+	 POK_SYSCALL_PARTITION_GET_LOCK_LEVEL            = 408,
+	 POK_SYSCALL_PARTITION_GET_OPERATING_MODE        = 409,
+	 POK_SYSCALL_PARTITION_GET_START_CONDITION       = 410,
 #endif
 #ifdef POK_NEEDS_IO
-   POK_SYSCALL_INB                                 = 501,
-   POK_SYSCALL_OUTB                                = 502,
+	 POK_SYSCALL_INB                                 = 501,
+	 POK_SYSCALL_OUTB                                = 502,
 #endif
 #ifdef POK_NEEDS_PCI
-   POK_SYSCALL_PCI_REGISTER                        = 601,
+	 POK_SYSCALL_PCI_REGISTER                        = 601,
 #endif
 } pok_syscall_id_t;
 
 typedef struct
 {
-   uint32_t             nargs;
-   uint32_t             arg1;
-   uint32_t             arg2;
-   uint32_t             arg3;
-   uint32_t             arg4;
-   uint32_t             arg5;
+	 uint32_t             nargs;
+	 uint32_t             arg1;
+	 uint32_t             arg2;
+	 uint32_t             arg3;
+	 uint32_t             arg4;
+	 uint32_t             arg5;
 } pok_syscall_args_t;
 
 
@@ -103,47 +101,47 @@
  * only one function to perform the syscall, the other are just maccro
  * This optimization was done only for x86 architecture.
  */
-   pok_ret_t pok_do_syscall (pok_syscall_id_t syscall_id, pok_syscall_args_t* args);
+	 pok_ret_t pok_do_syscall (pok_syscall_id_t syscall_id, pok_syscall_args_t* args);
 
-   #define pok_syscall1(sid,arg1) \
-           pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,0,0,0,0}))
+	 #define pok_syscall1(sid,arg1) \
+					 pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,0,0,0,0}))
 
-   #define pok_syscall2(sid,arg1,arg2) \
-           pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,0,0,0}))
+	 #define pok_syscall2(sid,arg1,arg2) \
+					 pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,0,0,0}))
 
-   #define pok_syscall3(sid,arg1,arg2,arg3) \
-           pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,0,0}))
+	 #define pok_syscall3(sid,arg1,arg2,arg3) \
+					 pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,0,0}))
 
-   #define pok_syscall4(sid,arg1,arg2,arg3,arg4) \
-           pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,arg4,0}))
+	 #define pok_syscall4(sid,arg1,arg2,arg3,arg4) \
+					 pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,arg4,0}))
 
-   #define pok_syscall5(sid,arg1,arg2,arg3,arg4,arg5) \
-           pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,arg4,arg5}))
+	 #define pok_syscall5(sid,arg1,arg2,arg3,arg4,arg5) \
+					 pok_do_syscall(sid,&((pok_syscall_args_t){2,arg1,arg2,arg3,arg4,arg5}))
 #else
 
 pok_ret_t pok_syscall1  (pok_syscall_id_t syscall_id,
-                         uint32_t arg1);
- 
+												 uint32_t arg1);
+
 pok_ret_t pok_syscall2  (pok_syscall_id_t syscall_id,
-                         uint32_t         arg1,
-                         uint32_t         arg2);
- 
+												 uint32_t         arg1,
+												 uint32_t         arg2);
+
 pok_ret_t pok_syscall3 (pok_syscall_id_t  syscall_id,
-                        uint32_t          arg1,
-                        uint32_t          arg2,
-                        uint32_t          arg3);
+												uint32_t          arg1,
+												uint32_t          arg2,
+												uint32_t          arg3);
 
 pok_ret_t pok_syscall4 (pok_syscall_id_t  syscall_id,
-                        uint32_t          arg1,
-                        uint32_t          arg2,
-                        uint32_t          arg3,
-                        uint32_t          arg4);
- 
+												uint32_t          arg1,
+												uint32_t          arg2,
+												uint32_t          arg3,
+												uint32_t          arg4);
+
 pok_ret_t pok_syscall5 (pok_syscall_id_t  syscall_id,
-                        uint32_t arg1,
-                        uint32_t arg2,
-                        uint32_t arg3,
-                        uint32_t arg4,
-                        uint32_t arg5);
+												uint32_t arg1,
+												uint32_t arg2,
+												uint32_t arg3,
+												uint32_t arg4,
+												uint32_t arg5);
 #endif
 #endif /* __LIBPOK_SYSCALL_H__ */

Modified: trunk/libpok/include/core/thread.h
===================================================================
--- trunk/libpok/include/core/thread.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/libpok/include/core/thread.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 #ifndef __POK_THREAD_H__
@@ -31,13 +31,13 @@
 
 typedef struct
 {
-   uint8_t      priority;
-   void*        entry;
-   uint64_t     period;
-   uint64_t     deadline;
-   uint64_t     time_capacity;
-   uint32_t     stack_size;
-   uint32_t  state;
+	 uint8_t      priority;
+	 void*        entry;
+	 uint64_t     period;
+	 uint64_t     deadline;
+	 uint64_t     time_capacity;
+	 uint32_t     stack_size;
+	 uint32_t  state;
 } pok_thread_attr_t;
 
 
@@ -50,14 +50,15 @@
 pok_ret_t      pok_thread_yield ();
 unsigned int   pok_thread_current (void);
 void           pok_thread_start (void (*entry)(), uint32_t id);
-void	       pok_thread_switch (uint32_t elected_id);
+void				 pok_thread_switch (uint32_t elected_id);
 pok_ret_t      pok_thread_wait_infinite ();
 void           pok_thread_wrapper ();
 pok_ret_t      pok_thread_attr_init (pok_thread_attr_t* attr);
 pok_ret_t      pok_thread_period ();
 pok_ret_t      pok_thread_id (uint32_t* thread_id);
-void	       pok_thread_init (void);
+void				 pok_thread_init (void);
 pok_ret_t      pok_thread_status(const uint32_t thread_id, pok_thread_attr_t* attr);
+pok_ret_t      pok_thread_set_priority(const uint32_t thread_id, const uint32_t priority);
 
 
 #define pok_thread_sleep_until(time) pok_syscall2(POK_SYSCALL_THREAD_SLEEP_UNTIL,(uint32_t)time,0)

Modified: trunk/libpok/include/errno.h
===================================================================
--- trunk/libpok/include/errno.h	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/libpok/include/errno.h	2012-08-29 10:04:41 UTC (rev 37)
@@ -1,6 +1,6 @@
 /*
  *                               POK header
- * 
+ *
  * The following file is a part of the POK project. Any modification should
  * made according to the POK licence. You CANNOT use this file or a part of
  * this file is this part of a file for your own project
@@ -9,9 +9,9 @@
  *
  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
  *
- *                                      Copyright (c) 2007-2009 POK team 
+ *                                      Copyright (c) 2007-2009 POK team
  *
- * Created by julien on Thu Jan 15 23:34:13 2009 
+ * Created by julien on Thu Jan 15 23:34:13 2009
  */
 
 #include <types.h>
@@ -23,49 +23,50 @@
 
 typedef enum
 {
-    POK_ERRNO_OK                    =   0,
-    POK_ERRNO_EINVAL                =   1,
+		POK_ERRNO_OK                    =   0,
+		POK_ERRNO_EINVAL                =   1,
 
-    POK_ERRNO_UNAVAILABLE           =   2,
-    POK_ERRNO_TOOMANY               =   5,
-    POK_ERRNO_EPERM                 =   6,
-    POK_ERRNO_EXISTS                =   7,
+		POK_ERRNO_UNAVAILABLE           =   2,
+		POK_ERRNO_PARAM                 =   3,
+		POK_ERRNO_TOOMANY               =   5,
+		POK_ERRNO_EPERM                 =   6,
+		POK_ERRNO_EXISTS                =   7,
 
 
-    POK_ERRNO_ERANGE                =   8,
-    POK_ERRNO_EDOM                  =   9,
-    POK_ERRNO_HUGE_VAL              =  10,
+		POK_ERRNO_ERANGE                =   8,
+		POK_ERRNO_EDOM                  =   9,
+		POK_ERRNO_HUGE_VAL              =  10,
 
-    POK_ERRNO_EFAULT                =  11,
+		POK_ERRNO_EFAULT                =  11,
 
-    POK_ERRNO_THREAD                =  49,
-    POK_ERRNO_THREADATTR            =  50,
+		POK_ERRNO_THREAD                =  49,
+		POK_ERRNO_THREADATTR            =  50,
 
-    POK_ERRNO_TIME                 =  100,
+		POK_ERRNO_TIME                 =  100,
 
-    POK_ERRNO_PARTITION_ATTR        = 200,
+		POK_ERRNO_PARTITION_ATTR        = 200,
 
-    POK_ERRNO_PORT                 =  301,
-    POK_ERRNO_NOTFOUND             =  302,
-    POK_ERRNO_DIRECTION            =  303,
-    POK_ERRNO_SIZE                 =  304,
-    POK_ERRNO_DISCIPLINE           =  305,
-    POK_ERRNO_PORTPART             =  307,
-    POK_ERRNO_EMPTY                =  308,
-    POK_ERRNO_KIND                 =  309,
-    POK_ERRNO_FULL                 =  311,
-    POK_ERRNO_READY                =  310,
-    POK_ERRNO_TIMEOUT              =  250,
-    POK_ERRNO_MODE                 =  251,
+		POK_ERRNO_PORT                 =  301,
+		POK_ERRNO_NOTFOUND             =  302,
+		POK_ERRNO_DIRECTION            =  303,
+		POK_ERRNO_SIZE                 =  304,
+		POK_ERRNO_DISCIPLINE           =  305,
+		POK_ERRNO_PORTPART             =  307,
+		POK_ERRNO_EMPTY                =  308,
+		POK_ERRNO_KIND                 =  309,
+		POK_ERRNO_FULL                 =  311,
+		POK_ERRNO_READY                =  310,
+		POK_ERRNO_TIMEOUT              =  250,
+		POK_ERRNO_MODE                 =  251,
 
-    POK_ERRNO_LOCKOBJ_UNAVAILABLE  =  500,
-    POK_ERRNO_LOCKOBJ_NOTREADY     =  501,
-    POK_ERRNO_LOCKOBJ_KIND         =  502,
-    POK_ERRNO_LOCKOBJ_POLICY       =  503,
+		POK_ERRNO_LOCKOBJ_UNAVAILABLE  =  500,
+		POK_ERRNO_LOCKOBJ_NOTREADY     =  501,
+		POK_ERRNO_LOCKOBJ_KIND         =  502,
+		POK_ERRNO_LOCKOBJ_POLICY       =  503,
 
-    POK_ERRNO_PARTITION_MODE       =  601,
+		POK_ERRNO_PARTITION_MODE       =  601,
 
-    POK_ERRNO_PARTITION            =  401
+		POK_ERRNO_PARTITION            =  401
 } pok_ret_t;
 
 

Modified: trunk/misc/release-files
===================================================================
--- trunk/misc/release-files	2012-07-12 15:39:14 UTC (rev 36)
+++ trunk/misc/release-files	2012-08-29 10:04:41 UTC (rev 37)
@@ -203,6 +203,7 @@
 libpok/core/threadsleep.c
 libpok/core/threadperiod.c
 libpok/core/threadstatus.c
+libpok/core/threadpriority.c
 libpok/core/timecomputedeadline.c
 libpok/core/timeget.c
 libpok/include/arch/x86/types.h


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/