Clean up the code. Manage the reconnection. Use the lwip error, insted
[bertos.git] / bertos / kern / sem_test.c
index 8f88ced309f6b8d8f6d931b630f8c0b7e82e9bf1..6a1f471bee78d3e2478df1f8e51fc8749801da5c 100644 (file)
@@ -57,6 +57,8 @@
  * $test$: echo "#define CONFIG_KERN 1" >> $cfgdir/cfg_proc.h
  * $test$: echo  "#undef CONFIG_KERN_PRI" >> $cfgdir/cfg_proc.h
  * $test$: echo "#define CONFIG_KERN_PRI 1" >> $cfgdir/cfg_proc.h
+ * $test$: echo  "#undef CONFIG_KERN_PRI_INHERIT" >> $cfgdir/cfg_proc.h
+ * $test$: echo "#define CONFIG_KERN_PRI_INHERIT 1" >> $cfgdir/cfg_proc.h
  * $test$: cp bertos/cfg/cfg_sem.h $cfgdir/
  * $test$: echo  "#undef CONFIG_KERN_SEMAPHORES" >> $cfgdir/cfg_sem.h
  * $test$: echo "#define CONFIG_KERN_SEMAPHORES 1" >> $cfgdir/cfg_sem.h
@@ -150,13 +152,13 @@ Semaphore s1, s2;
 unsigned int loops = 0;        // For counting iterations
 int finishing_time[8];
 
-enum ProcType {NONE, S1, S2, S1S2};
+typedef enum ProcType {NONE, S1, S2, S1S2} ProcType;
 /*
  * Macros for the processes of the priority inversion test.
  */
 #define PROC_INV_TEST(num) static void proc_semInvTest##num(void) \
 { \
-       ProcType p_type = (ProcType)((long) proc_currentUserData()); \
+       ProcType p_type = (ProcType)((ssize_t) proc_currentUserData()); \
        int mult = p_type == NONE ? 5 : 1; \
        unsigned int i, local_count = 0; \
        ticks_t start; \
@@ -242,7 +244,7 @@ PROC_TEST_STACK(6)
 PROC_TEST_STACK(7)
 PROC_TEST_STACK(8)
 
-int sem_ser_test(void)
+static int sem_ser_test(void)
 {
        ticks_t start_time = timer_clock();
 
@@ -288,7 +290,7 @@ int sem_ser_test(void)
 
 #if CONFIG_KERN_PRI
 
-int sem_inv_test(void)
+static int sem_inv_test(void)
 {
        int i, orig_pri = proc_current()->link.pri;
        ticks_t fake, start_time;
@@ -336,7 +338,7 @@ int sem_inv_test(void)
                if (sem_attempt(&sem)) {
                        if (global_count >= loops*7 + loops*5) {
                                for (i = 0; i < 8; i++)
-                                       kprintf("> Main: I-O latency of %d = %dms\n", i+1, ms_to_ticks(finishing_time[i]));
+                                       kprintf("> Main: I-O latency of %d = %ldms\n", i+1, (long) ms_to_ticks(finishing_time[i]));
                                kputs("> Main: Test Finished..Ok!\n");
                                return 0;
                        }