[pok-devel] [41] Ajout des priorite et de suspend/resume

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


Revision: 41
Author:   jrosen
Date:     2012-09-28 18:04:57 +0200 (Fri, 28 Sep 2012)
Log Message:
-----------
Ajout des priorite et de suspend/resume

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/kernel/include/middleware/port.h
    trunk/kernel/middleware/portcreate.c
    trunk/kernel/middleware/portsamplingid.c
    trunk/libpok/arinc653/process.c
    trunk/libpok/arinc653/sampling.c
    trunk/libpok/core/Makefile
    trunk/libpok/core/threadid.c
    trunk/libpok/include/core/syscall.h
    trunk/libpok/include/core/thread.h
    trunk/libpok/include/errno.h
    trunk/misc/conf-env.pl
    trunk/misc/release-files
    trunk/misc/send-release.sh

Added Paths:
-----------
    trunk/libpok/core/threadpriority.c
    trunk/libpok/core/threadresume.c

Modified: trunk/kernel/core/syscall.c
===================================================================
--- trunk/kernel/core/syscall.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/core/syscall.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,21 @@
          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;
+
+   case POK_SYSCALL_THREAD_RESUME:
+	   return pok_thread_resume (args->arg1);
+	   break;
+   case POK_SYSCALL_THREAD_SUSPEND_TARGET:
+	   return pok_thread_suspend_target (args->arg1);
+	   break;
+
 #ifdef POK_NEEDS_ERROR_HANDLING
 
 /**

Modified: trunk/kernel/core/thread.c
===================================================================
--- trunk/kernel/core/thread.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/core/thread.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,34 @@
   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;
+}
+
+pok_ret_t pok_thread_resume (const uint32_t id)
+{
+	if (POK_CURRENT_PARTITION.thread_index_low > id || POK_CURRENT_PARTITION.thread_index_high < id)
+		return POK_ERRNO_THREADATTR;
+	pok_threads[id].wakeup_time = POK_GETTICK();
+	pok_threads[id].state = POK_STATE_RUNNABLE;
+	/* preemption is always enabled */
+	pok_sched();
+	return POK_ERRNO_OK;
+}
+
+pok_ret_t pok_thread_suspend_target (const uint32_t id)
+{
+	if (POK_CURRENT_PARTITION.thread_index_low > id || POK_CURRENT_PARTITION.thread_index_high < id || id == POK_SCHED_CURRENT_THREAD)
+		return POK_ERRNO_THREADATTR;
+	pok_threads[id].state = POK_STATE_STOPPED;
+	return POK_ERRNO_OK;
+}
+
 #endif

Modified: trunk/kernel/include/core/syscall.h
===================================================================
--- trunk/kernel/include/core/syscall.h	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/include/core/syscall.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,9 @@
    POK_SYSCALL_THREAD_STOPSELF                     =  57,
    POK_SYSCALL_THREAD_ID                           =  58,
    POK_SYSCALL_THREAD_STATUS                       =  59,
+   POK_SYSCALL_THREAD_SET_PRIORITY								 =  60,
+   POK_SYSCALL_THREAD_RESUME                       =  61,
+   POK_SYSCALL_THREAD_SUSPEND_TARGET               =  62,
 #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-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/include/core/thread.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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
 */
 
@@ -57,35 +57,35 @@
 
 typedef struct
 {
-   uint8_t      priority;
-   uint64_t     period;
-   uint64_t     deadline;
-   uint64_t     time_capacity;
-   uint64_t     remaining_time_capacity;
-   uint64_t     next_activation;
-   pok_state_t  state;
-   uint64_t	end_time;
-   uint64_t     wakeup_time;
+	 uint8_t      priority;
+	 uint64_t     period;
+	 uint64_t     deadline;
+	 uint64_t     time_capacity;
+	 uint64_t     remaining_time_capacity;
+	 uint64_t     next_activation;
+	 pok_state_t  state;
+	 uint64_t	end_time;
+	 uint64_t     wakeup_time;
 #ifdef POK_NEEDS_SCHED_HFPPS
-   uint64_t	payback; /**< Payback for HFPPS scheduling algorithm */
+	 uint64_t	payback; /**< Payback for HFPPS scheduling algorithm */
 #endif /* POK_NEEDS_SCHED_HFPPS */
-   void		   *entry;
-   uint8_t	   partition;
-   uint32_t	   sp;
-   uint32_t    init_stack_addr;
-   /* stack pointer
-    * FIXME: this is platform-dependent code, we have to handle that ! */                      
+	 void			 *entry;
+	 uint8_t		 partition;
+	 uint32_t		 sp;
+	 uint32_t    init_stack_addr;
+	 /* stack pointer
+		* FIXME: this is platform-dependent code, we have to handle that ! */
 } pok_thread_t;
 
 typedef struct
 {
-   uint8_t      priority;         /* Priority is from 0 to 255 */
-   void*        entry;            /* entrypoint of the thread  */
-   uint64_t     period;
-   uint64_t     deadline;
-   uint64_t     time_capacity;
-   uint32_t     stack_size;
-   pok_state_t  state;
+	 uint8_t      priority;         /* Priority is from 0 to 255 */
+	 void*        entry;            /* entrypoint of the thread  */
+	 uint64_t     period;
+	 uint64_t     deadline;
+	 uint64_t     time_capacity;
+	 uint32_t     stack_size;
+	 pok_state_t  state;
 } pok_thread_attr_t;
 /*
  * Attributes given to create a thread
@@ -100,11 +100,14 @@
 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);
+pok_ret_t      pok_thread_resume (const uint32_t id);
+pok_ret_t      pok_thread_suspend_target (const uint32_t id);
 
 #ifdef POK_NEEDS_PARTITIONS
 pok_ret_t		pok_partition_thread_create (uint32_t* thread_id,
-                                            const pok_thread_attr_t* attr,
-                                            const uint8_t  partition_id);
+																						const pok_thread_attr_t* attr,
+																						const uint8_t  partition_id);
 #endif
 
 extern pok_thread_t              pok_threads[POK_CONFIG_NB_THREADS];

Modified: trunk/kernel/include/errno.h
===================================================================
--- trunk/kernel/include/errno.h	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/include/errno.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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/kernel/include/middleware/port.h
===================================================================
--- trunk/kernel/include/middleware/port.h	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/include/middleware/port.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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
  */
 
 /**
@@ -32,80 +32,80 @@
 
 typedef enum
 {
-   POK_PORT_QUEUEING_DISCIPLINE_FIFO      = 1,
-   POK_PORT_QUEUEING_DISCIPLINE_PRIORITY  = 2
+	 POK_PORT_QUEUEING_DISCIPLINE_FIFO      = 1,
+	 POK_PORT_QUEUEING_DISCIPLINE_PRIORITY  = 2
 } pok_port_queueing_disciplines_t;
 
 typedef enum
 {
-   POK_PORT_DIRECTION_IN   = 1,
-   POK_PORT_DIRECTION_OUT  = 2
+	 POK_PORT_DIRECTION_IN   = 1,
+	 POK_PORT_DIRECTION_OUT  = 2
 } pok_port_directions_t;
 
 typedef pok_queueing_discipline_t pok_port_queueing_discipline_t;
 
 typedef enum
 {
-   POK_PORT_KIND_QUEUEING  = 1,
-   POK_PORT_KIND_SAMPLING  = 2,
+	 POK_PORT_KIND_QUEUEING  = 1,
+	 POK_PORT_KIND_SAMPLING  = 2,
 #ifdef POK_NEEDS_PORTS_VIRTUAL
-   POK_PORT_KIND_VIRTUAL   = 2,
+	 POK_PORT_KIND_VIRTUAL   = 2,
 #endif
-   POK_PORT_KIND_INVALID   = 10
+	 POK_PORT_KIND_INVALID   = 10
 } pok_port_kinds_t;
 
 typedef struct
 {
-   pok_port_id_t                    identifier;
-   pok_partition_id_t               partition;
-   pok_port_size_t                  index;
-   bool_t                           full;
-   pok_port_size_t                  size;
-   pok_port_size_t                  off_b; /* Offset of the beginning of the buffer */
-   pok_port_size_t                  off_e; /* Offset of the end of the buffer */
-   pok_port_direction_t             direction;
-   pok_port_queueing_discipline_t   discipline;
-   pok_bool_t                       ready;
-   bool_t                           empty;
-   uint8_t                          kind;
-   uint64_t                         refresh;
-   uint64_t                         last_receive;
-   pok_lockobj_t                    lock;
-   bool_t                           must_be_flushed;
+	 pok_port_id_t                    identifier;
+	 pok_partition_id_t               partition;
+	 pok_port_size_t                  index;
+	 bool_t                           full;
+	 pok_port_size_t                  size;
+	 pok_port_size_t                  off_b; /* Offset of the beginning of the buffer */
+	 pok_port_size_t                  off_e; /* Offset of the end of the buffer */
+	 pok_port_direction_t             direction;
+	 pok_port_queueing_discipline_t   discipline;
+	 pok_bool_t                       ready;
+	 bool_t                           empty;
+	 uint8_t                          kind;
+	 uint64_t                         refresh;
+	 uint64_t                         last_receive;
+	 pok_lockobj_t                    lock;
+	 bool_t                           must_be_flushed;
 }pok_port_t;
 
 #ifdef POK_NEEDS_PORTS_QUEUEING
 /* Queueing port functions */
 typedef struct
 {
-   pok_port_size_t      size;
-   pok_port_direction_t direction;
-   uint8_t              waiting_processes;
+	 pok_port_size_t      size;
+	 pok_port_direction_t direction;
+	 uint8_t              waiting_processes;
 }pok_port_queueing_status_t;
 
 
-pok_ret_t pok_port_queueing_create (char*                                     name, 
-                                    const pok_port_size_t                     size, 
-                                    const pok_port_direction_t                direction, 
-                                    const pok_port_queueing_discipline_t      discipline,
-                                    pok_port_id_t*                            id);
+pok_ret_t pok_port_queueing_create (char*                                     name,
+																		const pok_port_size_t                     size,
+																		const pok_port_direction_t                direction,
+																		const pok_port_queueing_discipline_t      discipline,
+																		pok_port_id_t*                            id);
 
-pok_ret_t pok_port_queueing_receive (const pok_port_id_t                      id, 
-                                     uint64_t                                 timeout, 
-                                     const pok_port_size_t                    maxlen, 
-                                     void*                                    data, 
-                                     pok_port_size_t*                         len);
+pok_ret_t pok_port_queueing_receive (const pok_port_id_t                      id,
+																		 uint64_t                                 timeout,
+																		 const pok_port_size_t                    maxlen,
+																		 void*                                    data,
+																		 pok_port_size_t*                         len);
 
-pok_ret_t pok_port_queueing_send (const pok_port_id_t                         id, 
-                                  const void*                                 data, 
-                                  const pok_port_size_t                       len, 
-                                  uint64_t                              timeout);
+pok_ret_t pok_port_queueing_send (const pok_port_id_t                         id,
+																	const void*                                 data,
+																	const pok_port_size_t                       len,
+																	uint64_t                              timeout);
 
 pok_ret_t pok_port_queueing_status (const pok_port_id_t                    id,
-                                    pok_port_queueing_status_t*      status);
+																		pok_port_queueing_status_t*      status);
 
 pok_ret_t pok_port_queueing_id     (char*                                     name,
-                                    pok_port_id_t*                            id);
+																		pok_port_id_t*                            id);
 #endif
 
 #ifdef POK_NEEDS_PORTS_SAMPLING
@@ -113,45 +113,45 @@
 
 typedef struct
 {
-   pok_port_size_t      size;
-   pok_port_direction_t direction;
-   uint64_t             refresh;
-   bool_t               validity;
+	 pok_port_size_t      size;
+	 pok_port_direction_t direction;
+	 uint64_t             refresh;
+	 bool_t               validity;
 }pok_port_sampling_status_t;
 
 
 pok_ret_t pok_port_sampling_create (char*                                     name,
-                                    const pok_port_size_t                     size,
-                                    const pok_port_direction_t                direction, 
-                                    const uint64_t                            refresh,
-                                    pok_port_id_t*                            id);
+																		const pok_port_size_t                     size,
+																		const pok_port_direction_t                direction,
+																		const uint64_t                            refresh,
+																		pok_port_id_t*                            id);
 
 pok_ret_t pok_port_sampling_write (const pok_port_id_t                        id,
-                                   const void*                                data,
-                                   const pok_port_size_t                      len);
+																	 const void*                                data,
+																	 const pok_port_size_t                      len);
 
 pok_ret_t pok_port_sampling_read (const pok_port_id_t                      id,
-                                  void*                                    message,
-                                  pok_port_size_t*                         len,
-                                  bool_t*                                  valid);
+																	void*                                    message,
+																	pok_port_size_t*                         len,
+																	bool_t*                                  valid);
 
 pok_ret_t pok_port_sampling_id     (char*                                     name,
-                                    pok_port_id_t*                            id);
+																		pok_port_id_t*                            id);
 
 pok_ret_t pok_port_sampling_status (const pok_port_id_t                       id,
-                                    pok_port_sampling_status_t*               status);
+																		pok_port_sampling_status_t*               status);
 #endif
 
 #if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
 /* Generic functions */
-pok_ret_t pok_port_create (char*                                  name, 
-                           const pok_port_size_t                  size, 
-                           const pok_port_direction_t             direction,
-                           uint8_t                                kind,
-                           pok_port_id_t*                         id);
+pok_ret_t pok_port_create (char*                                  name,
+													 const pok_port_size_t                  size,
+													 const pok_port_direction_t             direction,
+													 uint8_t                                kind,
+													 pok_port_id_t*                         id);
 
-pok_ret_t pok_port_transfer (const uint8_t gid_dst, 
-                             const uint8_t gid_src);
+pok_ret_t pok_port_transfer (const uint8_t gid_dst,
+														 const uint8_t gid_src);
 
 void              pok_port_init(void);
 void              pok_port_queueing_flushall (void);
@@ -161,12 +161,12 @@
 pok_ret_t         pok_port_get (const uint32_t gid, void *data, const pok_port_size_t size);
 pok_ret_t         pok_port_write (const uint8_t gid, const void *data, const pok_port_size_t size);
 bool_t            pok_own_port (const uint8_t partition, const uint8_t port);
-#endif 
+#endif
 
 
 #ifdef POK_NEEDS_PORTS_VIRTUAL
-pok_ret_t pok_port_virtual_id (char*            name, 
-                               pok_port_id_t*   id);
+pok_ret_t pok_port_virtual_id (char*            name,
+															 pok_port_id_t*   id);
 
 pok_ret_t pok_port_virtual_nb_destinations (const pok_port_id_t id, uint32_t* result);
 pok_ret_t pok_port_virtual_destination (const pok_port_id_t id, const uint32_t n, uint32_t* result);

Modified: trunk/kernel/middleware/portcreate.c
===================================================================
--- trunk/kernel/middleware/portcreate.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/middleware/portcreate.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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
  */
 
 #if defined (POK_NEEDS_PORTS_SAMPLING) || defined (POK_NEEDS_PORTS_QUEUEING)
@@ -30,104 +30,104 @@
 extern pok_port_t    pok_ports[POK_CONFIG_NB_PORTS];
 extern pok_queue_t   pok_queue;
 
-pok_ret_t pok_port_create (char* name, 
-                           const pok_port_size_t size,
-                           const pok_port_direction_t direction,
-                           uint8_t kind, pok_port_id_t* id)
+pok_ret_t pok_port_create (char* name,
+													 const pok_port_size_t size,
+													 const pok_port_direction_t direction,
+													 uint8_t kind, pok_port_id_t* id)
 {
-   uint8_t   gid;
-   pok_ret_t ret;
+	 uint8_t   gid;
+	 pok_ret_t ret;
 
-   ret = POK_ERRNO_OK;
+	 ret = POK_ERRNO_OK;
 
 
-   if (size > POK_PORT_MAX_SIZE)
-   {
+	 if (size > POK_PORT_MAX_SIZE)
+	 {
 #if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
-      POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+			POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
 #endif
-      return POK_ERRNO_PORT;
-   }
+			return POK_ERRNO_PORT;
+	 }
 
-   if (size > pok_queue.available_size)
-   {
+	 if (size > pok_queue.available_size)
+	 {
 #if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
-      POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+			POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
 #endif
-      return POK_ERRNO_PORT;
-   }
+			return POK_ERRNO_PORT;
+	 }
 
-   if ((direction != POK_PORT_DIRECTION_IN) &&
-       (direction != POK_PORT_DIRECTION_OUT))
-   {
+	 if ((direction != POK_PORT_DIRECTION_IN) &&
+			 (direction != POK_PORT_DIRECTION_OUT))
+	 {
 #if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
-      POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
+			POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_CONFIGURATION);
 #endif
-      return POK_ERRNO_PORT;
-   }
+			return POK_ERRNO_PORT;
+	 }
 
-   switch (kind)
-   {
-      case POK_PORT_KIND_SAMPLING:
-         {
+	 switch (kind)
+	 {
+			case POK_PORT_KIND_SAMPLING:
+				 {
 #ifdef POK_NEEDS_PORTS_SAMPLING
-            ret = pok_port_sampling_id (name, &gid);
+						ret = pok_port_sampling_id (name, &gid);
 #endif
-            break;
-         }
-      case POK_PORT_KIND_QUEUEING:
-         {
+						break;
+				 }
+			case POK_PORT_KIND_QUEUEING:
+				 {
 #ifdef POK_NEEDS_PORTS_QUEUEING
-            ret = pok_port_queueing_id (name, &gid);
+						ret = pok_port_queueing_id (name, &gid);
 #endif
-            break;
-         }
-      default:
-         {
-            return POK_ERRNO_EINVAL;
-            break;
-         }
-   }
+						break;
+				 }
+			default:
+				 {
+						return POK_ERRNO_EINVAL;
+						break;
+				 }
+	 }
 
-   if (ret != POK_ERRNO_OK)
-   {
+	 if (ret != POK_ERRNO_OK)
+	 {
 #if (defined POK_NEEDS_PARTITIONS) && (defined POK_NEEDS_ERROR_HANDLING)
-      POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_INIT);
+			POK_ERROR_CURRENT_PARTITION(POK_ERROR_KIND_PARTITION_INIT);
 #endif
-      return ret;
-   }
-        
-   if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, gid))
-   {
-      return POK_ERRNO_PORT;
-   }
+			return ret;
+	 }
 
-   /*
-    * Check if the port was already created
-    * If it's already created, we return ERRNO_EXISTS but indicate
-    * the right port-id. This should not be taken as an assumption
-    * but could help the developper when a partition is restarted.
-    */
-   if (pok_ports[gid].ready == TRUE)
-   {
-      *id = gid;
-      return POK_ERRNO_EXISTS;
-   }
+	 if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, gid))
+	 {
+			return POK_ERRNO_PORT;
+	 }
 
-   pok_ports[gid].index      = pok_queue.size - pok_queue.available_size;
-   pok_ports[gid].off_b      = 0;
-   pok_ports[gid].off_e      = 0;
-   pok_ports[gid].size       = size;
-   pok_ports[gid].full       = FALSE;
-   pok_ports[gid].partition  = pok_current_partition;
-   pok_ports[gid].direction  = direction;
-   pok_ports[gid].ready      = TRUE;
-   pok_ports[gid].kind       = kind;
+	 /*
+		* Check if the port was already created
+		* If it's already created, we return ERRNO_EXISTS but indicate
+		* the right port-id. This should not be taken as an assumption
+		* but could help the developper when a partition is restarted.
+		*/
+	 if (pok_ports[gid].ready == TRUE)
+	 {
+			*id = gid;
+			return POK_ERRNO_EXISTS;
+	 }
 
-   pok_queue.available_size  = pok_queue.available_size - size;
+	 pok_ports[gid].index      = pok_queue.size - pok_queue.available_size;
+	 pok_ports[gid].off_b      = 0;
+	 pok_ports[gid].off_e      = 0;
+	 pok_ports[gid].size       = size;
+	 pok_ports[gid].full       = FALSE;
+	 pok_ports[gid].partition  = pok_current_partition;
+	 pok_ports[gid].direction  = direction;
+	 pok_ports[gid].ready      = TRUE;
+	 pok_ports[gid].kind       = kind;
 
-   *id = gid;
+	 pok_queue.available_size  = pok_queue.available_size - size;
 
-   return POK_ERRNO_OK;
+	 *id = gid;
+
+	 return POK_ERRNO_OK;
 }
 #endif

Modified: trunk/kernel/middleware/portsamplingid.c
===================================================================
--- trunk/kernel/middleware/portsamplingid.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/kernel/middleware/portsamplingid.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,23 +26,23 @@
 
 pok_ret_t pok_port_sampling_id (char* name, pok_port_id_t* id)
 {
-   uint8_t i;
+	 uint8_t i;
 
-   for (i = 0; i < POK_CONFIG_NB_PORTS ; i++)
-   {
-      if ( (strcmp (name, pok_ports_names[i]) == 0) && (pok_ports_kind[i] == POK_PORT_KIND_SAMPLING))
-      {
-         if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, i))
-         {
-            return POK_ERRNO_PORT;
-         }
+	 for (i = 0; i < POK_CONFIG_NB_PORTS ; i++)
+	 {
+			if ( (strcmp (name, pok_ports_names[i]) == 0) && (pok_ports_kind[i] == POK_PORT_KIND_SAMPLING))
+			{
+				 if (! pok_own_port (POK_SCHED_CURRENT_PARTITION, i))
+				 {
+						return POK_ERRNO_PORT;
+				 }
 
-         *id = i;
+				 *id = i;
 
-         return POK_ERRNO_OK;
-      }
-   }
-   return POK_ERRNO_NOTFOUND;
+				 return POK_ERRNO_OK;
+			}
+	 }
+	 return POK_ERRNO_NOTFOUND;
 }
 
 #endif

Modified: trunk/libpok/arinc653/process.c
===================================================================
--- trunk/libpok/arinc653/process.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/arinc653/process.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,231 @@
 #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;
 }
 
+#endif
+
 void SUSPEND (PROCESS_ID_TYPE    process_id,
-              RETURN_CODE_TYPE   *return_code )
+							RETURN_CODE_TYPE   *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	pok_thread_attr_t  attr;
+	pok_ret_t    core_ret;
+
+	core_ret = pok_thread_status (process_id, &attr);
+	if (attr.state == DORMANT)
+		{
+			*return_code = INVALID_MODE;
+			return ;
+		}
+	if (attr.period == INFINITE_TIME_VALUE)
+		{
+			*return_code = INVALID_MODE;
+			return ;
+		}
+	if (attr.state == WAITING)
+		{
+			*return_code = NO_ACTION;
+			return ;
+		}
+	core_ret = pok_thread_suspend_target (process_id);
+	*return_code = core_ret;
 }
 
 void RESUME (PROCESS_ID_TYPE     process_id,
-             RETURN_CODE_TYPE    *return_code )
+						 RETURN_CODE_TYPE    *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+	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_PARAM;
+			return ;
+		}
+	if (attr.state == DORMANT)
+		{
+			*return_code = INVALID_MODE;
+			return ;
+		}
+	if (attr.period == INFINITE_TIME_VALUE)
+		{
+			*return_code = INVALID_MODE;
+			return ;
+		}
+	if (attr.state != WAITING)
+		{
+			*return_code = INVALID_MODE;
+			return ;
+		}
+	core_ret = pok_thread_resume (process_id);
+	*return_code = core_ret;
 }
 
+#ifndef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE
 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/arinc653/sampling.c
===================================================================
--- trunk/libpok/arinc653/sampling.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/arinc653/sampling.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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
  */
 
 
@@ -21,82 +21,114 @@
 #include <middleware/port.h>
 #include <arinc653/types.h>
 #include <arinc653/sampling.h>
- 
-void CREATE_SAMPLING_PORT ( 
-       /*in */ SAMPLING_PORT_NAME_TYPE    SAMPLING_PORT_NAME, 
-       /*in */ MESSAGE_SIZE_TYPE          MAX_MESSAGE_SIZE, 
-       /*in */ PORT_DIRECTION_TYPE        PORT_DIRECTION, 
-       /*in */ SYSTEM_TIME_TYPE           REFRESH_PERIOD, 
-       /*out*/ SAMPLING_PORT_ID_TYPE      *SAMPLING_PORT_ID, 
-       /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
+#include <arinc653/partition.h>
+#include <core/thread.h>
+
+void CREATE_SAMPLING_PORT (
+			 /*in */ SAMPLING_PORT_NAME_TYPE    SAMPLING_PORT_NAME,
+			 /*in */ MESSAGE_SIZE_TYPE          MAX_MESSAGE_SIZE,
+			 /*in */ PORT_DIRECTION_TYPE        PORT_DIRECTION,
+			 /*in */ SYSTEM_TIME_TYPE           REFRESH_PERIOD,
+			 /*out*/ SAMPLING_PORT_ID_TYPE      *SAMPLING_PORT_ID,
+			 /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
 {
-   pok_port_direction_t core_direction;
-   pok_port_id_t        core_id;
-   pok_ret_t            core_ret;
+	 pok_port_direction_t core_direction;
+	 pok_port_id_t        core_id;
+	 pok_ret_t            core_ret;
+	 pok_thread_attr_t     attr;
+	 uint32_t							process_id;
 
-   switch (PORT_DIRECTION)
-   {
-      case SOURCE:
-         core_direction = POK_PORT_DIRECTION_OUT;
-         break;
-      
-      case DESTINATION:
-         core_direction = POK_PORT_DIRECTION_IN;
-         break;
+	 pok_thread_id(&process_id);
+	 core_ret = pok_thread_status (process_id, &attr);
+	 if (attr.state == NORMAL)
+		 {
+			 *RETURN_CODE = INVALID_MODE;
+			 return ;
+		 }
+	 if (MAX_MESSAGE_SIZE <= 0 || REFRESH_PERIOD < 0)
+		 {
+			 *RETURN_CODE = INVALID_CONFIG;
+			 return ;
+		 }
 
-      default:
-         *RETURN_CODE = INVALID_PARAM;
-         return;
-   }
+	 switch (PORT_DIRECTION)
+	 {
+			case SOURCE:
+				 core_direction = POK_PORT_DIRECTION_OUT;
+				 break;
 
-   core_ret = pok_port_sampling_create (SAMPLING_PORT_NAME, MAX_MESSAGE_SIZE, core_direction, REFRESH_PERIOD, &core_id);
+			case DESTINATION:
+				 core_direction = POK_PORT_DIRECTION_IN;
+				 break;
 
-   *SAMPLING_PORT_ID = core_id;
+			default:
+				 *RETURN_CODE = INVALID_PARAM;
+				 return;
+	 }
 
-   *RETURN_CODE = core_ret;
+	 core_ret = pok_port_sampling_create (SAMPLING_PORT_NAME, MAX_MESSAGE_SIZE, core_direction, REFRESH_PERIOD, &core_id);
+
+	 *SAMPLING_PORT_ID = core_id;
+
+	 *RETURN_CODE = core_ret;
 }
- 
-void WRITE_SAMPLING_MESSAGE ( 
-       /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID, 
-       /*in */ MESSAGE_ADDR_TYPE          MESSAGE_ADDR,     /* by reference */ 
-       /*in */ MESSAGE_SIZE_TYPE          LENGTH, 
-       /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
+
+void WRITE_SAMPLING_MESSAGE (
+			 /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID,
+			 /*in */ MESSAGE_ADDR_TYPE          MESSAGE_ADDR,     /* by reference */
+			 /*in */ MESSAGE_SIZE_TYPE          LENGTH,
+			 /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
 {
-   pok_ret_t core_ret;
-   core_ret = pok_port_sampling_write (SAMPLING_PORT_ID, MESSAGE_ADDR, LENGTH);
-   *RETURN_CODE = core_ret;
+	 pok_ret_t core_ret;
+
+	 if (LENGTH <= 0)
+		 {
+			 *RETURN_CODE = INVALID_PARAM;
+			 return;
+		 }
+	 core_ret = pok_port_sampling_write (SAMPLING_PORT_ID, MESSAGE_ADDR, LENGTH);
+	 *RETURN_CODE = core_ret;
 }
- 
-void READ_SAMPLING_MESSAGE ( 
-       /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID, 
-       /*out*/ MESSAGE_ADDR_TYPE          MESSAGE_ADDR, 
-       /*out*/ MESSAGE_SIZE_TYPE          *LENGTH, 
-       /*out*/ VALIDITY_TYPE              *VALIDITY, 
-       /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
+
+void READ_SAMPLING_MESSAGE (
+			 /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID,
+			 /*out*/ MESSAGE_ADDR_TYPE          MESSAGE_ADDR,
+			 /*out*/ MESSAGE_SIZE_TYPE          *LENGTH,
+			 /*out*/ VALIDITY_TYPE              *VALIDITY,
+			 /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
 {
-   pok_ret_t core_ret;
-   core_ret = pok_port_sampling_read (SAMPLING_PORT_ID, MESSAGE_ADDR, (pok_port_size_t*) LENGTH, (pok_bool_t*) VALIDITY);
-   *RETURN_CODE = core_ret;
+	 pok_ret_t core_ret;
+	 core_ret = pok_port_sampling_read (SAMPLING_PORT_ID, MESSAGE_ADDR, (pok_port_size_t*) LENGTH, (pok_bool_t*) VALIDITY);
+	 *RETURN_CODE = core_ret;
 }
- 
-void GET_SAMPLING_PORT_ID ( 
-       /*in */ SAMPLING_PORT_NAME_TYPE    SAMPLING_PORT_NAME, 
-       /*out*/ SAMPLING_PORT_ID_TYPE      *SAMPLING_PORT_ID, 
-       /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
+
+void GET_SAMPLING_PORT_ID (
+			 /*in */ SAMPLING_PORT_NAME_TYPE    SAMPLING_PORT_NAME,
+			 /*out*/ SAMPLING_PORT_ID_TYPE      *SAMPLING_PORT_ID,
+			 /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
 {
-   (void) SAMPLING_PORT_NAME;
-   (void) SAMPLING_PORT_ID;
-   *RETURN_CODE = NOT_AVAILABLE;
+	pok_ret_t core_ret;
+	pok_port_id_t id;
+
+	core_ret = pok_port_sampling_id(SAMPLING_PORT_NAME, &id);
+	*SAMPLING_PORT_ID = id;
+	*RETURN_CODE = core_ret;
 }
- 
-void GET_SAMPLING_PORT_STATUS ( 
-       /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID, 
-       /*out*/ SAMPLING_PORT_STATUS_TYPE  *SAMPLING_PORT_STATUS, 
-       /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
+
+void GET_SAMPLING_PORT_STATUS (
+			 /*in */ SAMPLING_PORT_ID_TYPE      SAMPLING_PORT_ID,
+			 /*out*/ SAMPLING_PORT_STATUS_TYPE  *SAMPLING_PORT_STATUS,
+			 /*out*/ RETURN_CODE_TYPE           *RETURN_CODE )
 {
-   (void) SAMPLING_PORT_ID;
-   (void) SAMPLING_PORT_STATUS;
-   *RETURN_CODE = NOT_AVAILABLE;
+	pok_ret_t core_ret;
+	pok_port_sampling_status_t status;
+
+	core_ret = pok_port_sampling_status(SAMPLING_PORT_ID, &status);
+	SAMPLING_PORT_STATUS->REFRESH_PERIOD = status.refresh;
+	SAMPLING_PORT_STATUS->MAX_MESSAGE_SIZE = status.size;
+	SAMPLING_PORT_STATUS->PORT_DIRECTION = status.direction;
+	SAMPLING_PORT_STATUS->LAST_MSG_VALIDITY = status.validity;
+	*RETURN_CODE = core_ret;
 }
 
 #endif

Modified: trunk/libpok/core/Makefile
===================================================================
--- trunk/libpok/core/Makefile	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/core/Makefile	2012-09-28 16:04:57 UTC (rev 41)
@@ -36,7 +36,9 @@
 			threadperiod.o \
 			threadsleep.o \
 			threadstatus.o \
-			threadid.o 
+			threadid.o \
+			threadpriority.o \
+			threadresume.o
 
 LO_DEPS=
 

Modified: trunk/libpok/core/threadid.c
===================================================================
--- trunk/libpok/core/threadid.c	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/core/threadid.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -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 Tue Aug 25 19:43:46 2009 
+ * Created by julien on Tue Aug 25 19:43:46 2009
  */
 
 
@@ -26,8 +26,6 @@
 
 pok_ret_t pok_thread_id (uint32_t* thread_id)
 {
-   return pok_syscall2 (POK_SYSCALL_THREAD_ID, (uint32_t)thread_id, 0);
+	 return pok_syscall2 (POK_SYSCALL_THREAD_ID, (uint32_t)thread_id, 0);
 }
 #endif
-
-

Added: trunk/libpok/core/threadpriority.c
===================================================================
--- trunk/libpok/core/threadpriority.c	                        (rev 0)
+++ trunk/libpok/core/threadpriority.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -0,0 +1,32 @@
+/*
+ *                               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
+ *
+ * For more information on the POK licence, please see our LICENCE FILE
+ *
+ * Please follow the coding guidelines described in doc/CODING_GUIDELINES
+ *
+ *                                      Copyright (c) 2007-2009 POK team
+ *
+ * Created by matias on Thu May 10 10:34:13 2012
+ */
+
+#include <core/dependencies.h>
+
+#ifdef POK_NEEDS_THREADS
+#include <arch.h>
+#include <types.h>
+#include <core/syscall.h>
+#include <core/thread.h>
+
+pok_ret_t      pok_thread_set_priority(const uint32_t thread_id, const uint32_t priority)
+{
+		return pok_syscall2  (POK_SYSCALL_THREAD_SET_PRIORITY,
+																thread_id,
+																priority);
+}
+
+#endif

Added: trunk/libpok/core/threadresume.c
===================================================================
--- trunk/libpok/core/threadresume.c	                        (rev 0)
+++ trunk/libpok/core/threadresume.c	2012-09-28 16:04:57 UTC (rev 41)
@@ -0,0 +1,31 @@
+/*
+ *                               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
+ *
+ * For more information on the POK licence, please see our LICENCE FILE
+ *
+ * Please follow the coding guidelines described in doc/CODING_GUIDELINES
+ *
+ *                                      Copyright (c) 2007-2012 POK team
+ *
+ * Created by matias on Wed May 11 14:15:08 2012
+ */
+
+#include <core/dependencies.h>
+
+#ifdef POK_NEEDS_THREADS
+#include <arch.h>
+#include <types.h>
+#include <core/syscall.h>
+#include <core/thread.h>
+
+pok_ret_t pok_thread_resume (const uint32_t thread_id)
+{
+	return pok_syscall2  (POK_SYSCALL_THREAD_RESUME,
+	                      (uint32_t)thread_id, 0);
+}
+
+#endif

Modified: trunk/libpok/include/core/syscall.h
===================================================================
--- trunk/libpok/include/core/syscall.h	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/include/core/syscall.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,78 @@
 
 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,
+	 POK_SYSCALL_THREAD_RESUME                       =  61,
+	 POK_SYSCALL_THREAD_SUSPEND_TARGET               =  62,
 #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 +103,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-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/include/core/thread.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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,21 +50,25 @@
 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);
+pok_ret_t      pok_thread_resume(const uint32_t thread_id);
 
-
 #define pok_thread_sleep_until(time) pok_syscall2(POK_SYSCALL_THREAD_SLEEP_UNTIL,(uint32_t)time,0)
 
 #define pok_thread_wait_infinite() pok_thread_suspend()
 
 #define pok_thread_suspend() pok_syscall2(POK_SYSCALL_THREAD_SUSPEND,NULL,NULL)
+
+#define pok_thread_suspend_target(thread_id) pok_syscall2(POK_SYSCALL_THREAD_SUSPEND_TARGET,thread_id,0)
+
 /*
  * Similar to: pok_ret_t      pok_thread_suspend (void);
  */

Modified: trunk/libpok/include/errno.h
===================================================================
--- trunk/libpok/include/errno.h	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/libpok/include/errno.h	2012-09-28 16:04:57 UTC (rev 41)
@@ -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/conf-env.pl
===================================================================
--- trunk/misc/conf-env.pl	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/misc/conf-env.pl	2012-09-28 16:04:57 UTC (rev 41)
@@ -84,23 +84,23 @@
 
 $tools_arch{"ppc"} =
 {
- "AR" 	      =>  ["powerpc-elf-ar"],
- "CC"          =>  ["powerpc-elf-gcc"],
- "LD"	         =>  ["powerpc-elf-ld"],
- "OBJDUMP"     =>  ["powerpc-elf-objdump"],
- "OBJCOPY"     =>  ["powerpc-elf-objcopy"],
- "RANLIB"      =>  ["powerpc-elf-ranlib"],
+ "AR" 	      =>  ["powerpc-elf-ar","powerpc-linux-gnu-ar"],
+ "CC"          =>  ["powerpc-elf-gcc","powerpc-linux-gnu-gcc"],
+ "LD"	         =>  ["powerpc-elf-ld","powerpc-linux-gnu-ld"],
+ "OBJDUMP"     =>  ["powerpc-elf-objdump","powerpc-linux-gnu-objdump"],
+ "OBJCOPY"     =>  ["powerpc-elf-objcopy","powerpc-linux-gnu-objcopy"],
+ "RANLIB"      =>  ["powerpc-elf-ranlib","powerpc-linux-gnu-ranlib"],
  "QEMU"        =>  ["qemu-system-ppc", "ppc-softmmu"],
  };
 
 $tools_arch{"sparc"} =
 {
- "AR" 	      =>  ["sparc-elf-ar"],
- "CC"          =>  ["sparc-elf-gcc"],
- "LD"	         =>  ["sparc-elf-ld"],
- "OBJDUMP"     =>  ["sparc-elf-objdump"],
- "OBJCOPY"     =>  ["sparc-elf-objcopy"],
- "RANLIB"      =>  ["sparc-elf-ranlib"],
+ "AR" 	      =>  ["sparc-elf-ar","sparc-linux-gnu-ar"],
+ "CC"          =>  ["sparc-elf-gcc","sparc-linux-gnu-gcc"],
+ "LD"	         =>  ["sparc-elf-ld","sparc-linux-gnu-ld"],
+ "OBJDUMP"     =>  ["sparc-elf-objdump","sparc-linux-gnu-objdump"],
+ "OBJCOPY"     =>  ["sparc-elf-objcopy","sparc-linux-gnu-objcopy"],
+ "RANLIB"      =>  ["sparc-elf-ranlib","sparc-linux-gnu-ranlib"],
  "QEMU"        =>  ["qemu-system-sparc", "sparc-softmmu"],
  "TSIM"        =>  ["tsim-leon3"],
  };

Modified: trunk/misc/release-files
===================================================================
--- trunk/misc/release-files	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/misc/release-files	2012-09-28 16:04:57 UTC (rev 41)
@@ -203,8 +203,10 @@
 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/core/threadresume.c
 libpok/include/arch/x86/types.h
 libpok/include/arch/x86/ioports.h
 libpok/include/arch/x86/pci.h

Modified: trunk/misc/send-release.sh
===================================================================
--- trunk/misc/send-release.sh	2012-09-25 09:15:12 UTC (rev 40)
+++ trunk/misc/send-release.sh	2012-09-28 16:04:57 UTC (rev 41)
@@ -3,23 +3,23 @@
 VERSION=`date '+%Y%m%d'` 
 HOST=ssh.tuxfamily.org
 REMOTE_DIR=/home/pok/pok-repository/snapshots/
+SCP_LOGIN=${TUXLOGIN:-$(whoami)}
+echo "Sending pok-$VERSION to $SCP_LOGIN@$HOST:$REMOTE_DIR/"
+scp pok-$VERSION.tgz $SCP_LOGIN@$HOST:$REMOTE_DIR
 
-echo "Sending pok-$VERSION to $HOST:$REMOTE_DIR/"
-scp pok-$VERSION.tgz $HOST:$REMOTE_DIR
+echo "Sending pok-$VERSION to $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-current.tgz"
+scp pok-$VERSION.tgz $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-current.tgz
 
-echo "Sending pok-$VERSION to $HOST:$REMOTE_DIR/pok-current.tgz"
-scp pok-$VERSION.tgz $HOST:$REMOTE_DIR/pok-current.tgz
+echo "Sending userguide to $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-userguide.pdf"
+scp pok-$VERSION.tgz $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-current.tgz
+scp doc/userguide/pok-user.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-userguide-$VERSION.pdf
+scp doc/userguide/pok-user.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-userguide-current.pdf
+scp doc/kernel-refman.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-kernel-refman-$VERSION.pdf
+scp doc/kernel-refman.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-kernel-refman-current.pdf
+scp doc/libpok-refman.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-libpok-refman-$VERSION.pdf
+scp doc/libpok-refman.pdf $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-libpok-refman-current.pdf
+scp -r doc/userguide/html $SCP_LOGIN@$HOST:$REMOTE_DIR/pok-userguide-current-html
+scp -r doc/doxygen-kernel/html $SCP_LOGIN@$HOST:$REMOTE_DIR/kernel-refman-current-html
+scp -r doc/doxygen-libpok/html $SCP_LOGIN@$HOST:$REMOTE_DIR/libpok-refman-current-html
 
-echo "Sending userguide to $HOST:$REMOTE_DIR/pok-userguide.pdf"
-scp pok-$VERSION.tgz $HOST:$REMOTE_DIR/pok-current.tgz
-scp doc/userguide/pok-user.pdf $HOST:$REMOTE_DIR/pok-userguide-$VERSION.pdf
-scp doc/userguide/pok-user.pdf $HOST:$REMOTE_DIR/pok-userguide-current.pdf
-scp doc/kernel-refman.pdf $HOST:$REMOTE_DIR/pok-kernel-refman-$VERSION.pdf
-scp doc/kernel-refman.pdf $HOST:$REMOTE_DIR/pok-kernel-refman-current.pdf
-scp doc/libpok-refman.pdf $HOST:$REMOTE_DIR/pok-libpok-refman-$VERSION.pdf
-scp doc/libpok-refman.pdf $HOST:$REMOTE_DIR/pok-libpok-refman-current.pdf
-scp -r doc/userguide/html $HOST:$REMOTE_DIR/pok-userguide-current-html
-scp -r doc/doxygen-kernel/html $HOST:$REMOTE_DIR/kernel-refman-current-html
-scp -r doc/doxygen-libpok/html $HOST:$REMOTE_DIR/libpok-refman-current-html
 
-


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