LPC2xxx: add kernel test.
[bertos.git] / examples / lpc2378 / main.c
index 7ab7b8594bdb31f6fac10102e2358d509635c751..213e96117f2c6c3294002cacc539b1781f126419 100644 (file)
@@ -13,7 +13,10 @@ static void init(void)
        IRQ_ENABLE;
        kdbg_init();
        timer_init();
+       proc_init();
+       timer_delay(3000);
        kprintf("NXP LPC2378 BeRTOS port test\n");
+       timer_delay(3000);
        /* Turn off boot led */
        IODIR0 = (1<<21);       
        IOCLR0 = (1<<21);       
@@ -22,22 +25,42 @@ static void init(void)
        LED_OFF();
 }
 
-int main(void)
+static void NORETURN bertos_up(void)
 {
        char spinner[] = {'/', '-', '\\', '|'};
        int i = 0;
-
-       init();
        while (1)
        {
                i++;
+               proc_forbid();
                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();
-               timer_delay(500);
+               timer_delay(250);
                
                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;