LPC2xxx: add kernel test.
authorbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 12 Apr 2010 22:15:04 +0000 (22:15 +0000)
committerbatt <batt@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 12 Apr 2010 22:15:04 +0000 (22:15 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3421 38d2e660-2303-0410-9eaa-f027e97ec537

examples/lpc2378/cfg/cfg_monitor.h
examples/lpc2378/cfg/cfg_proc.h
examples/lpc2378/lpc2378.mk
examples/lpc2378/main.c

index b239eeb0332a8009a606caddb193aa9911d36d00..dcd07e1cc3426f404a2bacde2132deaa3d87ef9e 100644 (file)
@@ -43,6 +43,6 @@
  * Process monitor.
  * $WIZ$ type = "autoenabled"
  */
  * Process monitor.
  * $WIZ$ type = "autoenabled"
  */
-#define CONFIG_KERN_MONITOR 0
+#define CONFIG_KERN_MONITOR 1
 
 #endif /*  CFG_MONITOR_H */
 
 #endif /*  CFG_MONITOR_H */
index df1b13647100cbf42c9b4fa8c161b6a307ad9288..eebcbf22d67051043e60f6abbf7e1d0b2a460030 100644 (file)
@@ -44,7 +44,7 @@
  *
  * $WIZ$ type = "autoenabled"
  */
  *
  * $WIZ$ type = "autoenabled"
  */
-#define CONFIG_KERN 0
+#define CONFIG_KERN 1
 
 /**
  * Kernel interrupt supervisor. WARNING: Experimental, still incomplete!
 
 /**
  * Kernel interrupt supervisor. WARNING: Experimental, still incomplete!
@@ -59,7 +59,7 @@
  * $WIZ$ type = "boolean"
  * $WIZ$ conditional_deps = "timer"
  */
  * $WIZ$ type = "boolean"
  * $WIZ$ conditional_deps = "timer"
  */
-#define CONFIG_KERN_PREEMPT 0
+#define CONFIG_KERN_PREEMPT 1
 
 /**
  * Time sharing quantum (a prime number prevents interference effects) [ms].
 
 /**
  * Time sharing quantum (a prime number prevents interference effects) [ms].
  * Priority-based scheduling policy.
  * $WIZ$ type = "boolean"
  */
  * Priority-based scheduling policy.
  * $WIZ$ type = "boolean"
  */
-#define CONFIG_KERN_PRI 0
+#define CONFIG_KERN_PRI 1
 
 /**
  * Dynamic memory allocation for processes.
  * $WIZ$ type = "boolean"
  * $WIZ$ conditional_deps = "heap"
  */
 
 /**
  * Dynamic memory allocation for processes.
  * $WIZ$ type = "boolean"
  * $WIZ$ conditional_deps = "heap"
  */
-#define CONFIG_KERN_HEAP 0
+#define CONFIG_KERN_HEAP 1
 
 /**
  * Size of the dynamic memory pool used by processes.
  * $WIZ$ type = "int"
  * $WIZ$ min = 0
  */
 
 /**
  * Size of the dynamic memory pool used by processes.
  * $WIZ$ type = "int"
  * $WIZ$ min = 0
  */
-#define CONFIG_KERN_HEAP_SIZE 2048L
+#define CONFIG_KERN_HEAP_SIZE 16384L
 
 /**
  * Module logging level.
 
 /**
  * Module logging level.
index 50532020dc30538bfceefe851f27dcea24257bba..e5a3bc74a34086a35a5bb1e729b02fa8c0b246c7 100644 (file)
@@ -16,8 +16,17 @@ lpc2378_PROGRAMMER_PORT = none
 lpc2378_USER_CSRC = \
        examples/lpc2378/main.c \
        bertos/drv/timer.c \
 lpc2378_USER_CSRC = \
        examples/lpc2378/main.c \
        bertos/drv/timer.c \
+       bertos/drv/timer_test.c \
        bertos/cpu/arm/drv/vic_lpc2.c \
        bertos/cpu/arm/drv/timer_lpc2.c \
        bertos/cpu/arm/drv/vic_lpc2.c \
        bertos/cpu/arm/drv/timer_lpc2.c \
+       bertos/mware/event.c \
+       bertos/kern/proc.c \
+       bertos/kern/coop.c \
+       bertos/kern/preempt.c \
+       bertos/kern/proc_test.c \
+       bertos/kern/monitor.c \
+       bertos/mware/sprintf.c \
+       bertos/struct/heap.c \
        #
 
 # Files included by the user.
        #
 
 # Files included by the user.
@@ -26,6 +35,7 @@ lpc2378_USER_PCSRC = \
 
 # Files included by the user.
 lpc2378_USER_CPPASRC = \
 
 # Files included by the user.
 lpc2378_USER_CPPASRC = \
+       bertos/cpu/arm/hw/switch_ctx_arm.S \
        #
 
 # Files included by the user.
        #
 
 # Files included by the user.
index 7ab7b8594bdb31f6fac10102e2358d509635c751..213e96117f2c6c3294002cacc539b1781f126419 100644 (file)
@@ -13,7 +13,10 @@ static void init(void)
        IRQ_ENABLE;
        kdbg_init();
        timer_init();
        IRQ_ENABLE;
        kdbg_init();
        timer_init();
+       proc_init();
+       timer_delay(3000);
        kprintf("NXP LPC2378 BeRTOS port test\n");
        kprintf("NXP LPC2378 BeRTOS port test\n");
+       timer_delay(3000);
        /* Turn off boot led */
        IODIR0 = (1<<21);       
        IOCLR0 = (1<<21);       
        /* Turn off boot led */
        IODIR0 = (1<<21);       
        IOCLR0 = (1<<21);       
@@ -22,22 +25,42 @@ static void init(void)
        LED_OFF();
 }
 
        LED_OFF();
 }
 
-int main(void)
+static void NORETURN bertos_up(void)
 {
        char spinner[] = {'/', '-', '\\', '|'};
        int i = 0;
 {
        char spinner[] = {'/', '-', '\\', '|'};
        int i = 0;
-
-       init();
        while (1)
        {
                i++;
        while (1)
        {
                i++;
+               proc_forbid();
                kprintf("BeRTOS is up & running: %c\r",
                        spinner[i % countof(spinner)]);
                kprintf("BeRTOS is up & running: %c\r",
                        spinner[i % countof(spinner)]);
+               proc_permit();
+               timer_delay(100);
+       }
+}
+
+static void NORETURN status(void)
+{
+       while (1)
+       {
                LED_ON();
                LED_ON();
-               timer_delay(500);
+               timer_delay(250);
                
                LED_OFF();
                
                LED_OFF();
-               timer_delay(500);
+               timer_delay(250);
+       }
+}
+
+int main(void)
+{
+
+       init();
+       proc_testRun();
+       proc_new(bertos_up, NULL, KERN_MINSTACKSIZE * 3, NULL);
+       proc_new(status, NULL, 0, NULL);
+       while (1)
+       {
        }
 
        return 0;
        }
 
        return 0;