[pok-devel] [18] * case study osadl11 that works!

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


Revision: 18
Author:   julien
Date:     2011-08-28 00:16:06 +0200 (Sun, 28 Aug 2011)
Log Message:
-----------
 * case study osadl11 that works!

Modified Paths:
--------------
    trunk/examples/arinc653-blackboard/model.aadl
    trunk/examples/case-study-osadl11/model.aadl
    trunk/examples/case-study-osadl11/receive.c
    trunk/kernel/core/loader.c
    trunk/kernel/core/partition.c
    trunk/kernel/core/thread.c
    trunk/kernel/include/middleware/port.h
    trunk/kernel/middleware/portqueueingcreate.c
    trunk/kernel/middleware/portqueueingreceive.c
    trunk/kernel/middleware/portutils.c

Modified: trunk/examples/arinc653-blackboard/model.aadl
===================================================================
--- trunk/examples/arinc653-blackboard/model.aadl	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/examples/arinc653-blackboard/model.aadl	2011-08-27 22:16:06 UTC (rev 18)
@@ -42,8 +42,8 @@
 subcomponents
    part1 : virtual processor partition.impl;
 properties
-   POK::Architecture => x86;
-   POK::BSP => x86_qemu;
+   POK::Architecture => ppc;
+   POK::BSP => prep;
    POK::Major_Frame => 1000 ms;
    POK::Scheduler => static;
    POK::Slots => (1000 ms);

Modified: trunk/examples/case-study-osadl11/model.aadl
===================================================================
--- trunk/examples/case-study-osadl11/model.aadl	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/examples/case-study-osadl11/model.aadl	2011-08-27 22:16:06 UTC (rev 18)
@@ -81,6 +81,7 @@
                               reference (partition_receiver));
    POK::Recovery_Errors => (Kernel_Init, Kernel_Scheduling);
    POK::Recovery_Actions => (Kernel_Stop, Kernel_Stop);
+   POK::Additional_Features   => (console, libc_stdio, libc);
 end pok_kernel.i;
 
 thread recv_thr

Modified: trunk/examples/case-study-osadl11/receive.c
===================================================================
--- trunk/examples/case-study-osadl11/receive.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/examples/case-study-osadl11/receive.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -15,15 +15,13 @@
 
 #include <types.h>
 #include <libc/stdio.h>
+static int step = 0;
 
 void user_receive (int t)
 {
    int d;
-   d = 1;
-   if (t == 10)
-   {
-      d = 0;
-   }
+   d = (t + 1) % 3;
+   printf ("Step %d\n", step++);
    printf ("Received value %d\n", t);
-   printf("Computed value %d\n", t / d);
+   printf ("Computed value %d\n", t / d);
 }

Modified: trunk/kernel/core/loader.c
===================================================================
--- trunk/kernel/core/loader.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/core/loader.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -89,7 +89,7 @@
    void*       elf_entry = NULL;
    extern char __archive2_begin;
    uint32_t    size;
-   uint16_t    t;
+   uint8_t     t;
 
    size = 0;
    t    = 0;

Modified: trunk/kernel/core/partition.c
===================================================================
--- trunk/kernel/core/partition.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/core/partition.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -38,6 +38,8 @@
 #include <core/partition.h>
 #include <core/instrumentation.h>
 
+#include <libc.h>
+
 /**
  * \brief The array that contains ALL partitions in the system.
  */
@@ -93,6 +95,7 @@
    pok_partitions[pid].thread_index = 0;
    pok_partitions[pid].current_thread = pok_partitions[pid].thread_index_low;
    pok_partitions[pid].prev_current_thread =  IDLE_THREAD;
+
 #ifdef POK_NEEDS_ERROR_HANDLING
    pok_partitions[pid].thread_error = 0;
    pok_partitions[pid].error_status.failed_thread = 0;

Modified: trunk/kernel/core/thread.c
===================================================================
--- trunk/kernel/core/thread.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/core/thread.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -144,7 +144,6 @@
 {
    uint32_t id;
    uint32_t stack_vaddr;
-
    /**
     * We can create a thread only if the partition is in INIT mode
     */

Modified: trunk/kernel/include/middleware/port.h
===================================================================
--- trunk/kernel/include/middleware/port.h	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/include/middleware/port.h	2011-08-27 22:16:06 UTC (rev 18)
@@ -158,7 +158,7 @@
 uint8_t           pok_port_lid_to_gid (uint8_t lid);
 pok_port_size_t   pok_port_available_size (uint8_t gid);
 pok_port_size_t   pok_port_consumed_size (uint8_t gid);
-pok_ret_t         pok_port_get (const uint8_t gid, void *data, const pok_port_size_t size);
+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 

Modified: trunk/kernel/middleware/portqueueingcreate.c
===================================================================
--- trunk/kernel/middleware/portqueueingcreate.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/middleware/portqueueingcreate.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -39,6 +39,17 @@
 
    ret = pok_port_create (name, size, direction, POK_PORT_KIND_QUEUEING, id);
 
+   /*
+    * FIXME: should be done using another way by reinitializing
+    * ports when a partition is restarted. At this time, when
+    * a partition is restarted, the ports are not reinitialized
+    * so that when the partition restart, it tries to reopen
+    * ports already created. We pass over actually and keep
+    * the port in the previous step, but we should reinitialize
+    * the port while reinitializing the partition AND also
+    * does not report an OK return code (see below) when trying to re
+    * create a port that was already created.
+    */
    if (ret == POK_ERRNO_EXISTS)
    {
       return POK_ERRNO_OK;

Modified: trunk/kernel/middleware/portqueueingreceive.c
===================================================================
--- trunk/kernel/middleware/portqueueingreceive.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/middleware/portqueueingreceive.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -26,6 +26,8 @@
 #include <middleware/port.h>
 #include <middleware/queue.h>
 
+#include <libc.h>
+
 extern pok_port_t    pok_ports[POK_CONFIG_NB_PORTS];
 
 pok_ret_t pok_port_queueing_receive (const pok_port_id_t    id, 
@@ -34,6 +36,7 @@
                                      void*                  data, 
                                      pok_port_size_t*       len)
 {
+
    pok_port_size_t   clen;
    pok_port_size_t   rlen;
    pok_ret_t ret;
@@ -41,6 +44,9 @@
    pok_lockobj_lockattr_t lockattr;
    (void) lockattr;
 
+   memset (data, '\0', maxlen);
+
+   *len = 0;
    if (maxlen <= 0)
    {
       return POK_ERRNO_EINVAL;
@@ -58,6 +64,7 @@
 
    if (pok_ports[id].ready != TRUE)
    {
+
       return POK_ERRNO_PORT;
    }
 
@@ -87,7 +94,6 @@
    {
       return ret;
    }
-
    while (pok_ports[id].empty == TRUE)
    {
       if (timeout == 0)
@@ -117,9 +123,16 @@
       rlen = maxlen;
    }
 
-   pok_port_get (id, data, rlen);
-   *len =  rlen;
 
+   if (pok_port_get (id, data, rlen) == POK_ERRNO_OK)
+   {
+      *len =  rlen;
+   }
+   else
+   {
+      *len = 0;
+   }
+
    pok_lockobj_unlock (&pok_ports[id].lock, NULL);
 
    return POK_ERRNO_OK;

Modified: trunk/kernel/middleware/portutils.c
===================================================================
--- trunk/kernel/middleware/portutils.c	2011-08-27 17:58:07 UTC (rev 17)
+++ trunk/kernel/middleware/portutils.c	2011-08-27 22:16:06 UTC (rev 18)
@@ -67,7 +67,7 @@
 }
 
 
-pok_ret_t pok_port_get (const uint8_t pid, void *data, const pok_port_size_t size)
+pok_ret_t pok_port_get (const uint32_t pid, void *data, const pok_port_size_t size)
 {
 
 #ifdef POK_NEEDS_PORTS_QUEUEING


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