Merge from trunk.
[bertos.git] / bertos / kern / proc_test.c
index b4f64c6a97a6751e80e52831c6d0d51b4ecd6bff..b2319faafdb18d09333af17745e5212004db1061 100644 (file)
  * $test$: echo "#define CONFIG_KERN_PRI 1" >> $cfgdir/cfg_proc.h
  * $test$: echo  "#undef CONFIG_KERN_PREEMPT" >> $cfgdir/cfg_proc.h
  * $test$: echo "#define CONFIG_KERN_PREEMPT 1" >> $cfgdir/cfg_proc.h
+ * $test$: echo  "#undef CONFIG_KERN_HEAP" >> $cfgdir/cfg_proc.h
+ * $test$: echo "#define CONFIG_KERN_HEAP 1" >> $cfgdir/cfg_proc.h
+ * $test$: echo  "#undef CONFIG_KERN_HEAP_SIZE" >> $cfgdir/cfg_proc.h
+ * $test$: echo "#define CONFIG_KERN_HEAP_SIZE 2097152L" >> $cfgdir/cfg_proc.h
  * $test$: cp bertos/cfg/cfg_monitor.h $cfgdir/
  * $test$: sed -i "s/CONFIG_KERN_MONITOR 0/CONFIG_KERN_MONITOR 1/" $cfgdir/cfg_monitor.h
  * $test$: cp bertos/cfg/cfg_signal.h $cfgdir/
@@ -91,7 +95,7 @@ static cpu_atomic_t main_barrier;
 #define DELAY  5
 
 // Define process stacks for test.
-#define WORKER_STACK_SIZE KERN_MINSTACKSIZE * 2
+#define WORKER_STACK_SIZE KERN_MINSTACKSIZE * 3
 
 #if CONFIG_KERN_HEAP
 #define WORKER_STACK(id)        NULL
@@ -112,7 +116,7 @@ STATIC_ASSERT(TASKS <= countof(prime_numbers));
 /* Time to run each preemptible thread (in seconds) */
 #define TIME   10
 
-static unsigned int preempt_counter[TASKS];
+static unsigned long preempt_counter[TASKS];
 static unsigned int preempt_done[TASKS];
 #endif
 
@@ -198,7 +202,7 @@ static int worker_test(void)
 static void preempt_worker(void)
 {
        ssize_t pid = (ssize_t)proc_currentUserData();
-       unsigned int *my_count = &preempt_counter[pid - 1];
+       unsigned long *my_count = &preempt_counter[pid - 1];
        ticks_t start, stop;
        int i;
 
@@ -217,7 +221,7 @@ static void preempt_worker(void)
                if (UNLIKELY(*my_count == (unsigned int)~0))
                        *my_count = 1;
        }
-       PROC_ATOMIC(kprintf("> %s[%zd] completed: (counter = %d)\n",
+       PROC_ATOMIC(kprintf("> %s[%zd] completed: (counter = %lu)\n",
                                __func__, pid, *my_count));
        for (i = 0; i < TASKS; i++)
                if (!preempt_counter[i])
@@ -292,7 +296,7 @@ static int preempt_worker_test(void)
 { \
        struct Process *main_proc = (struct Process *) proc_currentUserData(); \
        kputs("> Process: " #num "\n"); \
-       sig_signal(main_proc, SIG_USER##num); \
+       sig_send(main_proc, SIG_USER##num); \
 }
 
 // Default priority is 0