Re: [pok-devel] arinc 653 GET_PROCESS_ID, GET_MY_ID, GET_PROCESS_STATUS functions

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


> Also, as you seem now confident with POK code, I suggest you commit
> directly on the trunk repository. Of course, if you can fix the code
> according to the comments, that would be nice and if you want some
> code
> review, you are kindly welcome :-)


I'd rather make a code review and fix the code before the commit.
I have fixed the code (one syscall instead of three).
If this patch version is good, I will make the commit.

Matias
Index: misc/release-files
===================================================================
--- misc/release-files	(révision 31)
+++ misc/release-files	(copie de travail)
@@ -170,6 +170,7 @@
 libpok/arinc653/sampling.c
 libpok/arinc653/semaphore.c
 libpok/arinc653/time.c
+libpok/arinc653/arincutils.c
 libpok/core/allocator.c
 libpok/core/main.c
 libpok/core/Makefile
@@ -201,6 +202,7 @@
 libpok/core/threadid.c
 libpok/core/threadsleep.c
 libpok/core/threadperiod.c
+libpok/core/threadstatus.c
 libpok/core/timecomputedeadline.c
 libpok/core/timeget.c
 libpok/include/arch/x86/types.h
@@ -219,6 +221,7 @@
 libpok/include/arinc653/semaphore.h
 libpok/include/arinc653/time.h
 libpok/include/arinc653/types.h
+libpok/include/arinc653/arincutils.h
 libpok/include/core/allocator.h
 libpok/include/core/mutex.h
 libpok/include/core/semaphore.h
Index: examples/arinc653-events/model.aadl
===================================================================
--- examples/arinc653-events/model.aadl	(révision 31)
+++ examples/arinc653-events/model.aadl	(copie de travail)
@@ -63,12 +63,16 @@
 thread mythread1
 features
    output : out event port;
+properties
+   Priority => 1;
 end mythread1;
 
 thread mythread2
 features
    input : in event port
       {Compute_Entrypoint => classifier (arinc653_testevents::spg_receive_event);};
+properties
+   Priority => 1;
 end mythread2;
 
 thread implementation mythread1.impl
Index: examples/arinc653-buffer/model.aadl
===================================================================
--- examples/arinc653-buffer/model.aadl	(révision 31)
+++ examples/arinc653-buffer/model.aadl	(copie de travail)
@@ -68,11 +68,15 @@
 thread mythread1
 features
    output : out event data port myint {Compute_Deadline => 10ms;};
+properties
+   Priority => 1;
 end mythread1;
 
 thread mythread2
 features
    input : in event data port myint {Compute_Deadline => 20ms;};
+properties
+   Priority => 1;
 end mythread2;
 
 thread implementation mythread1.impl
Index: examples/arinc653-sampling/model.aadl
===================================================================
--- examples/arinc653-sampling/model.aadl	(révision 31)
+++ examples/arinc653-sampling/model.aadl	(copie de travail)
@@ -116,6 +116,7 @@
 features
    datain : in data port integer {ARINC653::Sampling_Refresh_Period => 10 ms;};
 properties
+   Priority => 1;
    Dispatch_Protocol => Periodic;
    Recover_Execution_Time => 10 ms .. 20 ms;
    Compute_Execution_Time => 1 ms .. 2 ms;
@@ -128,6 +129,7 @@
 features
    dataout : out data port integer {ARINC653::Sampling_Refresh_Period => 20 ms;};
 properties
+   Priority => 1;
    Dispatch_Protocol => Periodic;
    Period => 1000 Ms;
    Recover_Execution_Time => 10 ms .. 20 ms;
Index: examples/arinc653-blackboard/model.aadl
===================================================================
--- examples/arinc653-blackboard/model.aadl	(révision 31)
+++ examples/arinc653-blackboard/model.aadl	(copie de travail)
@@ -42,8 +42,8 @@
 subcomponents
    part1 : virtual processor partition.impl;
 properties
-   POK::Architecture => ppc;
-   POK::BSP => prep;
+   POK::Architecture => x86;
+   POK::BSP => x86_qemu;
    POK::Major_Frame => 1000 ms;
    POK::Scheduler => static;
    POK::Slots => (1000 ms);
@@ -66,11 +66,15 @@
 thread mythread1
 features
    output : out data port myint;
+properties
+  Priority => 1;
 end mythread1;
 
 thread mythread2
 features
    input : in data port myint;
+properties
+  Priority => 1;
 end mythread2;
 
 thread implementation mythread1.impl
Index: examples/arinc653-threads/model.aadl
===================================================================
--- examples/arinc653-threads/model.aadl	(révision 31)
+++ examples/arinc653-threads/model.aadl	(copie de travail)
@@ -58,8 +58,8 @@
       {POK::Criticality => 2;
        Provided_Virtual_Bus_Class => (classifier (test::security_layer.topsecret));};
 properties
-   POK::Architecture => sparc;
-   POK::BSP => leon3;
+   POK::Architecture => x86;
+   POK::BSP => x86_qemu;
    ARINC653::Module_Major_Frame => 1000ms;
    ARINC653::Partition_Slots => (500ms, 500ms);
    ARINC653::Slots_Allocation => (reference (part1), reference (part2));
@@ -89,6 +89,7 @@
 calls 
    call1 : { pspg : subprogram hello_part1;};
 properties
+   Priority => 1;
    Initialize_Entrypoint => classifier (test::thread_starting);
    dispatch_protocol => periodic;
    period            => 1000ms;
@@ -105,6 +106,7 @@
 calls 
    call1 : { pspg : subprogram hello_part2;};
 properties
+   Priority => 1;
    compute_execution_time => 0ms .. 1ms;
    dispatch_Protocol => periodic;
    period            => 1000ms;
Index: examples/arinc653-errors/model.aadl
===================================================================
--- examples/arinc653-errors/model.aadl	(révision 31)
+++ examples/arinc653-errors/model.aadl	(copie de travail)
@@ -121,6 +121,7 @@
 features
    datain : in event data port integer;
 properties
+   Priority => 1;
    Initialize_Entrypoint => classifier (arinchm::thread_starting);
    Dispatch_Protocol => Periodic;
    Recover_Execution_Time => 10 ms .. 20 ms;
@@ -144,6 +145,7 @@
 features
    dataout : out event data port integer {Compute_Deadline => 40 ms;};
 properties
+   Priority => 1;
    Dispatch_Protocol => Periodic;
    Period => 1000 Ms;
    Recover_Execution_Time => 10 ms .. 20 ms;
Index: examples/arinc653-queueing/model.aadl
===================================================================
--- examples/arinc653-queueing/model.aadl	(révision 31)
+++ examples/arinc653-queueing/model.aadl	(copie de travail)
@@ -105,6 +105,7 @@
    tdatain : in event data port integer
                      {ARINC653::Timeout => 10 ms;};
 properties
+   Priority => 1;
    Dispatch_Protocol => Periodic;
    Compute_Execution_Time => 0 ms .. 1 ms;
    Period => 1000 Ms;
@@ -120,6 +121,7 @@
    tdataout : out event data port integer
                      {ARINC653::Timeout => 10 ms;};
 properties
+   Priority => 1;
    Dispatch_Protocol => Periodic;
    Period => 1000 Ms;
    Source_Data_Size => 40 bytes;
Index: kernel/core/syscall.c
===================================================================
--- kernel/core/syscall.c	(révision 31)
+++ kernel/core/syscall.c	(copie de travail)
@@ -121,6 +121,9 @@
          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));
+         break;
 
 #ifdef POK_NEEDS_ERROR_HANDLING
 
Index: kernel/core/sched.c
===================================================================
--- kernel/core/sched.c	(révision 31)
+++ kernel/core/sched.c	(copie de travail)
@@ -548,4 +548,22 @@
 }
 #endif
 
+#ifdef POK_NEEDS_PARTITIONS
+
+uint32_t pok_sched_get_current(uint32_t *thread_id)
+{
+#if defined (POK_NEEDS_ERROR_HANDLING)
+  if (pok_partitions[pok_current_partition].thread_error == 0)
+    return POK_ERRNO_THREAD;
+#endif
+  if (KERNEL_THREAD == POK_SCHED_CURRENT_THREAD 
+      || IDLE_THREAD == POK_SCHED_CURRENT_THREAD)
+    {
+      return POK_ERRNO_THREAD;
+    }
+  *thread_id=POK_SCHED_CURRENT_THREAD;
+  return POK_ERRNO_OK;
+}
+#endif
+
 #endif /* __POK_NEEDS_SCHED */
Index: kernel/core/thread.c
===================================================================
--- kernel/core/thread.c	(révision 31)
+++ kernel/core/thread.c	(copie de travail)
@@ -109,15 +109,14 @@
    pok_threads[IDLE_THREAD].time_capacity              = 0;
    pok_threads[IDLE_THREAD].next_activation            = 0;
    pok_threads[IDLE_THREAD].remaining_time_capacity    = 0;
-   pok_threads[IDLE_THREAD].wakeup_time		            = 0;
-   pok_threads[IDLE_THREAD].entry		                  = pok_arch_idle;
-   pok_threads[IDLE_THREAD].priority		               = pok_sched_get_priority_min(0);
-   pok_threads[IDLE_THREAD].state		                  = POK_STATE_RUNNABLE;
+   pok_threads[IDLE_THREAD].wakeup_time		       = 0;
+   pok_threads[IDLE_THREAD].entry		       = pok_arch_idle;
+   pok_threads[IDLE_THREAD].priority		       = pok_sched_get_priority_min(0);
+   pok_threads[IDLE_THREAD].state		       = POK_STATE_RUNNABLE;
 
-   pok_threads[IDLE_THREAD].sp			      = pok_context_create
-                                                   (IDLE_THREAD,
-								                            IDLE_STACK_SIZE,
-								                            (uint32_t)pok_arch_idle);
+   pok_threads[IDLE_THREAD].sp			       = pok_context_create
+                                                   (IDLE_THREAD,								             IDLE_STACK_SIZE,
+						   (uint32_t)pok_arch_idle);
 
    for (i = 0; i < POK_CONFIG_NB_THREADS; ++i)
    {
@@ -301,4 +300,17 @@
 }
 #endif
 
+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;
+  attr->deadline = pok_threads[id].end_time;
+  attr->state = pok_threads[id].state;
+  attr->priority = pok_threads[id].priority;
+  attr->entry = pok_threads[id].entry;
+  attr->period = pok_threads[id].period;
+  attr->time_capacity = pok_threads[id].time_capacity;
+  attr->stack_size = POK_USER_STACK_SIZE;
+  return POK_ERRNO_OK;
+}
 #endif
Index: kernel/include/core/thread.h
===================================================================
--- kernel/include/core/thread.h	(révision 31)
+++ kernel/include/core/thread.h	(copie de travail)
@@ -85,6 +85,7 @@
    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
@@ -98,6 +99,7 @@
 void           pok_thread_start (void (*entry)(), unsigned int id);
 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);
 
 #ifdef POK_NEEDS_PARTITIONS
 pok_ret_t		pok_partition_thread_create (uint32_t* thread_id,
Index: kernel/include/core/syscall.h
===================================================================
--- kernel/include/core/syscall.h	(révision 31)
+++ kernel/include/core/syscall.h	(copie de travail)
@@ -34,6 +34,7 @@
    POK_SYSCALL_THREAD_PERIOD                       =  56,
    POK_SYSCALL_THREAD_STOPSELF                     =  57,
    POK_SYSCALL_THREAD_ID                           =  58,
+   POK_SYSCALL_THREAD_STATUS                       =  59,
 #ifdef POK_NEEDS_PORTS_SAMPLING
    POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
    POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,
Index: kernel/include/core/sched.h
===================================================================
--- kernel/include/core/sched.h	(révision 31)
+++ kernel/include/core/sched.h	(copie de travail)
@@ -75,7 +75,7 @@
 void pok_sched_activate_error_thread (void);
 #endif
 
-#define pok_sched_get_current(thread_id) *thread_id=POK_SCHED_CURRENT_THREAD
+uint32_t pok_sched_get_current(uint32_t *thread_id);
 
 #endif /* POK_NEEDS.... */
 
Index: libpok/include/core/thread.h
===================================================================
--- libpok/include/core/thread.h	(révision 31)
+++ libpok/include/core/thread.h	(copie de travail)
@@ -37,6 +37,7 @@
    uint64_t     deadline;
    uint64_t     time_capacity;
    uint32_t     stack_size;
+   uint32_t  state;
 } pok_thread_attr_t;
 
 
@@ -49,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);
+pok_ret_t      pok_thread_status(const uint32_t thread_id, pok_thread_attr_t* attr);
 
-void pok_thread_init (void);
 
 #define pok_thread_sleep_until(time) pok_syscall2(POK_SYSCALL_THREAD_SLEEP_UNTIL,(uint32_t)time,0)
 
Index: libpok/include/core/syscall.h
===================================================================
--- libpok/include/core/syscall.h	(révision 31)
+++ libpok/include/core/syscall.h	(copie de travail)
@@ -34,6 +34,10 @@
    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,
+
 #ifdef POK_NEEDS_PORTS_SAMPLING
    POK_SYSCALL_MIDDLEWARE_SAMPLING_ID              = 101,
    POK_SYSCALL_MIDDLEWARE_SAMPLING_READ            = 102,
Index: libpok/include/core/dependencies.h
===================================================================
--- libpok/include/core/dependencies.h	(révision 31)
+++ libpok/include/core/dependencies.h	(copie de travail)
@@ -118,6 +118,17 @@
 
 #ifdef POK_NEEDS_ARINC653_PROCESS
    #define POK_NEEDS_THREADS 1
+   #ifndef POK_CONFIG_NEEDS_FUNC_STRCPY
+   #define POK_CONFIG_NEEDS_FUNC_STRCPY 1
+   #endif
+
+   #ifndef POK_CONFIG_NEEDS_FUNC_STRCMP
+   #define POK_CONFIG_NEEDS_FUNC_STRCMP 1
+   #endif
+
+   #ifndef POK_NEEDS_THREAD_ID
+   #define POK_NEEDS_THREAD_ID 1
+   #endif
 #endif
 
 #ifdef POK_NEEDS_ARINC653_PARTITION
@@ -187,8 +198,6 @@
    #ifndef POK_CONFIG_NEEDS_FUNC_STRLEN
    #define POK_CONFIG_NEEDS_FUNC_STRLEN 1
    #endif
-
-
 #endif
 
 #ifdef POK_NEEDS_ARINC653_SEMAPHORE
Index: libpok/include/arinc653/arincutils.h
===================================================================
--- libpok/include/arinc653/arincutils.h	(révision 0)
+++ libpok/include/arinc653/arincutils.h	(révision 0)
@@ -0,0 +1,36 @@
+/*
+ *                               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 Wed May 04 09:34:13 2012 
+ */
+
+#ifdef POK_NEEDS_ARINC653_PROCESS
+
+#include <arinc653/process.h>
+
+/**
+ * Struct for save data
+ * NAME => Not use by pok
+ * BASE_PRIORITY => This value, in pok, is modified. Here we save the base value
+ */
+typedef struct {
+  PROCESS_NAME_TYPE       NAME;
+  PRIORITY_TYPE           BASE_PRIORITY;
+  STACK_SIZE_TYPE         STACK_SIZE;
+} ARINC_ATTRIBUTE;
+
+ARINC_ATTRIBUTE              arinc_process_attribute[POK_CONFIG_NB_THREADS];
+
+uint32_t process_name_exist (PROCESS_NAME_TYPE *process_name);
+
+#endif
Index: libpok/core/threadid.c
===================================================================
--- libpok/core/threadid.c	(révision 31)
+++ libpok/core/threadid.c	(copie de travail)
@@ -17,9 +17,7 @@
 
 #include <core/dependencies.h>
 
-#ifndef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE
-
-#ifdef POK_NEEDS_THREADS
+#ifdef POK_NEEDS_THREAD_ID
 #include <arch.h>
 #include <types.h>
 #include <core/syscall.h>
@@ -32,5 +30,4 @@
 }
 #endif
 
-#endif /* POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE */
 
Index: libpok/core/Makefile
===================================================================
--- libpok/core/Makefile	(révision 31)
+++ libpok/core/Makefile	(copie de travail)
@@ -35,6 +35,7 @@
 			threadattrinit.o \
 			threadperiod.o \
 			threadsleep.o \
+			threadstatus.o \
 			threadid.o 
 
 LO_DEPS=
Index: libpok/core/threadstatus.c
===================================================================
--- libpok/core/threadstatus.c	(révision 0)
+++ libpok/core/threadstatus.c	(révision 0)
@@ -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-2012 POK team 
+ *
+ * Created by matias on Wed Feb 29 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_status (const uint32_t thread_id, pok_thread_attr_t* attr)
+{
+  return pok_syscall2  (POK_SYSCALL_THREAD_STATUS,
+			(uint32_t)thread_id,
+			(uint32_t)attr);
+}
+
+#endif
Index: libpok/arinc653/Makefile
===================================================================
--- libpok/arinc653/Makefile	(révision 31)
+++ libpok/arinc653/Makefile	(copie de travail)
@@ -15,7 +15,8 @@
 			semaphore.o \
 			partition.o  \
 			error.o \
-			event.o
+			event.o \
+			arincutils.o
 
 LO_DEPS=
 
Index: libpok/arinc653/arincutils.c
===================================================================
--- libpok/arinc653/arincutils.c	(révision 0)
+++ libpok/arinc653/arincutils.c	(révision 0)
@@ -0,0 +1,36 @@
+/*
+ *                               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 Wed Apr 04 09:34:13 2012
+ */
+
+#ifdef POK_NEEDS_ARINC653_PROCESS
+
+#include  <arinc653/arincutils.h>
+#include <libc/string.h>
+
+/**
+ * Simple function to check if the process exist
+ * process_name => Name of the checked process
+ */
+uint32_t process_name_exist (PROCESS_NAME_TYPE *process_name)
+{
+  int i;
+
+  for (i = 0; i < POK_CONFIG_NB_THREADS; i++)
+    if (!strcmp(*process_name, arinc_process_attribute[i].NAME))
+      return i;
+  return 0;
+}
+
+#endif
Index: libpok/arinc653/process.c
===================================================================
--- libpok/arinc653/process.c	(révision 31)
+++ libpok/arinc653/process.c	(copie de travail)
@@ -20,37 +20,67 @@
 #include <core/dependencies.h>
 
 #include <core/thread.h>
-
+#include <arinc653/arincutils.h>
 #include <arinc653/types.h>
 #include <arinc653/process.h>
+#include <libc/string.h>
 
-
-#ifndef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE
 void GET_PROCESS_ID (PROCESS_NAME_TYPE process_name[MAX_NAME_LENGTH],
                      PROCESS_ID_TYPE   *process_id,
                      RETURN_CODE_TYPE  *return_code )
 {
-   (void) process_name;
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+  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;
+    }
 }
 
 void GET_MY_ID (PROCESS_ID_TYPE   *process_id,
 		RETURN_CODE_TYPE  *return_code )
 {
-   (void) process_id;
-   *return_code = NOT_AVAILABLE;
+  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;
 }
 
 void GET_PROCESS_STATUS (PROCESS_ID_TYPE     process_id,
                          PROCESS_STATUS_TYPE *process_status,
                          RETURN_CODE_TYPE    *return_code )
 {
-   (void) process_id;
-   (void) process_status;
-   *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_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;
 }
-#endif
 
 void CREATE_PROCESS (PROCESS_ATTRIBUTE_TYPE  *attributes,
                      PROCESS_ID_TYPE         *process_id,
@@ -60,6 +90,16 @@
    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;
@@ -68,9 +108,9 @@
    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;
 }
 


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