From: batt Date: Mon, 12 Apr 2010 22:15:04 +0000 (+0000) Subject: LPC2xxx: add kernel test. X-Git-Tag: 2.5.0~487 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;ds=sidebyside;h=751e05a8c44d88d8676527b2dcc377ba28735e0d;p=bertos.git LPC2xxx: add kernel test. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3421 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/examples/lpc2378/cfg/cfg_monitor.h b/examples/lpc2378/cfg/cfg_monitor.h index b239eeb0..dcd07e1c 100644 --- a/examples/lpc2378/cfg/cfg_monitor.h +++ b/examples/lpc2378/cfg/cfg_monitor.h @@ -43,6 +43,6 @@ * Process monitor. * $WIZ$ type = "autoenabled" */ -#define CONFIG_KERN_MONITOR 0 +#define CONFIG_KERN_MONITOR 1 #endif /* CFG_MONITOR_H */ diff --git a/examples/lpc2378/cfg/cfg_proc.h b/examples/lpc2378/cfg/cfg_proc.h index df1b1364..eebcbf22 100644 --- a/examples/lpc2378/cfg/cfg_proc.h +++ b/examples/lpc2378/cfg/cfg_proc.h @@ -44,7 +44,7 @@ * * $WIZ$ type = "autoenabled" */ -#define CONFIG_KERN 0 +#define CONFIG_KERN 1 /** * Kernel interrupt supervisor. WARNING: Experimental, still incomplete! @@ -59,7 +59,7 @@ * $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]. @@ -73,21 +73,21 @@ * 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" */ -#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 */ -#define CONFIG_KERN_HEAP_SIZE 2048L +#define CONFIG_KERN_HEAP_SIZE 16384L /** * Module logging level. diff --git a/examples/lpc2378/lpc2378.mk b/examples/lpc2378/lpc2378.mk index 50532020..e5a3bc74 100644 --- a/examples/lpc2378/lpc2378.mk +++ b/examples/lpc2378/lpc2378.mk @@ -16,8 +16,17 @@ lpc2378_PROGRAMMER_PORT = none 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/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. @@ -26,6 +35,7 @@ lpc2378_USER_PCSRC = \ # Files included by the user. lpc2378_USER_CPPASRC = \ + bertos/cpu/arm/hw/switch_ctx_arm.S \ # # Files included by the user. diff --git a/examples/lpc2378/main.c b/examples/lpc2378/main.c index 7ab7b859..213e9611 100644 --- a/examples/lpc2378/main.c +++ b/examples/lpc2378/main.c @@ -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;