From 31f99a1041b66fbac89f9412273a02b4e1a53568 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 25 Jan 2008 17:49:43 +0000 Subject: [PATCH] Add z16f system exception handling logic. git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@564 42af7a65-404d-4744-a932-0658087f49c3 --- configs/z16f2800100zcog/include/board.h | 9 ++-- configs/z16f2800100zcog/ostest/defconfig | 5 +- configs/z16f2800100zcog/src/z16f_leds.c | 60 ++---------------------- 3 files changed, 14 insertions(+), 60 deletions(-) diff --git a/configs/z16f2800100zcog/include/board.h b/configs/z16f2800100zcog/include/board.h index 492106abb7..774ca92c19 100644 --- a/configs/z16f2800100zcog/include/board.h +++ b/configs/z16f2800100zcog/include/board.h @@ -57,10 +57,11 @@ #define LED_STARTED 0 #define LED_HEAPALLOCATE 1 #define LED_IRQSENABLED 2 -#define LED_IDLE 3 -#define LED_INIRQ 4 -#define LED_ASSERTION 5 -#define LED_PANIC 6 +#define LED_STACKCREATED 3 +#define LED_IDLE 4 +#define LED_INIRQ 5 +#define LED_ASSERTION 6 +#define LED_PANIC 7 /**************************************************************************** * Public Functions diff --git a/configs/z16f2800100zcog/ostest/defconfig b/configs/z16f2800100zcog/ostest/defconfig index 20a1799df5..9963672dab 100644 --- a/configs/z16f2800100zcog/ostest/defconfig +++ b/configs/z16f2800100zcog/ostest/defconfig @@ -47,7 +47,9 @@ # CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence, # the board that supports the particular chip or SoC. # CONFIG_ARCH_BOARD_name - for use in C code +# CONFIG_BOARD_LOOPSPERMSEC - for delay loops # CONFIG_DRAM_SIZE - Describes the installed DRAM. +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to z16f. # CONFIG_ARCH=z16 CONFIG_ARCH_Z16=y @@ -59,8 +61,9 @@ CONFIG_ARCH_CHIP_Z16F3211=n CONFIG_ARCH_CHIP_Z16F6411=n CONFIG_ARCH_BOARD=z16f2800100zcog CONFIG_ARCH_BOARD_Z16F2800100ZCOG=y +CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_DRAM_SIZE=65536 - +CONFIG_ARCH_LEDS=y # # Z16F specific device driver settings # diff --git a/configs/z16f2800100zcog/src/z16f_leds.c b/configs/z16f2800100zcog/src/z16f_leds.c index 54175a9b54..49e47282e8 100644 --- a/configs/z16f2800100zcog/src/z16f_leds.c +++ b/configs/z16f2800100zcog/src/z16f_leds.c @@ -47,6 +47,7 @@ #include #include +#include #include "up_internal.h" /**************************************************************************** @@ -84,38 +85,10 @@ void up_ledinit(void) void up_ledon(int led) { - ubyte paout = getreg8(Z16F_GPIOA_OUT) & 0xf8; - switch (led) + if ((unsigned)led <= 7) { - case LED_STARTED: - break; - - case LED_HEAPALLOCATE: - paout |= 1; - break; - - case LED_IRQSENABLED: - paout |= 2; - break; - - case LED_IDLE: - paout |= 3; - break; - - case LED_INIRQ: - paout |= 4; - break; - - case LED_ASSERTION : - paout |= 5; - break; - - case LED_PANIC: - default: - paout |= 6; - break; + putreg8(((getreg8(Z16F_GPIOA_OUT) & 0xf8) | led), Z16F_GPIOA_OUT); } - putreg8(paout, Z16F_GPIOA_OUT); } /**************************************************************************** @@ -124,32 +97,9 @@ void up_ledon(int led) void up_ledoff(int led) { - switch (led) + if (led >= 1) { - case LED_STARTED: - break; - - case LED_HEAPALLOCATE: - up_ledoff(LED_STARTED); - break; - - case LED_IRQSENABLED: - up_ledoff(LED_IRQSENABLED); - break; - - case LED_IDLE: - up_ledoff(LED_IRQSENABLED); - break; - - case LED_INIRQ: - case LED_ASSERTION : - up_ledoff(LED_IDLE); - break; - - case LED_PANIC: - default: - up_ledoff(LED_ASSERTION); - break; + up_ledon(led-1); } } #endif /* CONFIG_ARCH_LEDS */