From 4d9befbcbd7e7cea61c95db0d6c3d988379faf73 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 8 Dec 2008 16:59:46 +0000 Subject: [PATCH] Add LED support git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1434 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/ChangeLog | 3 + nuttx/Documentation/NuttX.html | 5 +- nuttx/configs/ez80f910200zco/include/board.h | 33 ++- nuttx/configs/ez80f910200zco/ostest/defconfig | 9 +- nuttx/configs/ez80f910200zco/src/Makefile | 9 +- nuttx/configs/ez80f910200zco/src/ez80_leds.c | 214 ++++++++++++++++++ .../ez80f910200zco/src/ez80f910200zco.h | 145 ++++++++++++ 7 files changed, 403 insertions(+), 15 deletions(-) create mode 100644 nuttx/configs/ez80f910200zco/src/ez80f910200zco.h diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index dafa400a0..025eb8d9e 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -601,4 +601,7 @@ 0.4.1 2008-xx-xx Gregory Nutt * Added board support fot the ZiLog ez80Acclaim! ez80f910200zco Development Kit. + * Fixed several compilation errors in fixed precision math library when built + against toolchains that do not support 64-bit type 'long long'. + * Fix errors in some function prototypes in dirent.h diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 0b9764209..8f816601a 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

NuttX RTOS

-

Last Updated: December 6, 2008

+

Last Updated: December 7 2008

@@ -1289,6 +1289,9 @@ buildroot-0.1.2 2007-11-06 <spudmonkey@racsa.co.cr>
    nuttx-0.4.1 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> * Added board support fot the ZiLog ez80Acclaim! ez80f910200zco Development Kit. + * Fixed several compilation errors in fixed precision math library when built + against toolchains that do not support 64-bit type 'long long'. + * Fix errors in some function prototypes in dirent.h pascal-0.1.3 2008-xx-xx Gregory Nutt <spudmonkey@racsa.co.cr> diff --git a/nuttx/configs/ez80f910200zco/include/board.h b/nuttx/configs/ez80f910200zco/include/board.h index 28d15541c..e43c337c1 100644 --- a/nuttx/configs/ez80f910200zco/include/board.h +++ b/nuttx/configs/ez80f910200zco/include/board.h @@ -43,18 +43,24 @@ /**************************************************************************** * Definitions ****************************************************************************/ - -/* LED pattern definitions */ -#define LED_STARTED 0 -#define LED_HEAPALLOCATE 1 -#define LED_IRQSENABLED 2 -#define LED_STACKCREATED 3 -#define LED_IDLE 4 -#define LED_INIRQ 5 -#define LED_ASSERTION 6 -#define LED_SIGNAL 6 -#define LED_PANIC 7 +/* LED pattern definitions ON OFF */ + +#define LED_STARTED 0 /* '0' N/A */ +#define LED_HEAPALLOCATE 1 /* 'H' N/A */ +#define LED_IRQSENABLED 2 /* 'E' N/A */ +#define LED_STACKCREATED 3 /* 'C' N/A */ +#define LED_IDLE 4 /* 'R' N/A */ +#define LED_INIRQ 5 /* 'I' (previous) */ +#define LED_ASSERTION 6 /* 'A' (previous) */ +#define LED_SIGNAL 7 /* 'S' (previous) */ +#define LED_PANIC 8 /* '*' (previous) */ + +/* Button definitions */ + +#define BUTTON_PB0 0x01 /* PB0: SW1 Bit 0 of GPIO Port B */ +#define BUTTON_PB1 0x02 /* PB1: SW2 Bit 1 of GPIO Port B */ +#define BUTTON_PB2 0x04 /* PB2: SW3 Bit 2 of GPIO Port B */ /**************************************************************************** * Public Functions @@ -68,6 +74,11 @@ extern "C" { #define EXTERN extern #endif +#ifdef CONFIG_ARCH_BUTTONS +EXTERN void up_buttoninit(void); +EXTERN ubyte up_buttons(void); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig index a5340414c..d244bc68b 100644 --- a/nuttx/configs/ez80f910200zco/ostest/defconfig +++ b/nuttx/configs/ez80f910200zco/ostest/defconfig @@ -61,7 +61,9 @@ # CONFIG_ENDIAN_BIG - Define for big-endian operation # CONFIG_ENDIAN_BIG - define if big endian (default is little endian) # CONFIG_DRAM_SIZE - Describes the installed DRAM. -# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to z8 board architecture. +# CONFIG_ARCH_LEDS - Use LEDs to show state. Unique to board architecture. +# CONFIG_ARCH_BUTTONS - Provide button APIs. Unique to board architecture. +# CONFIG_ARCH_TIMERHOOK - Provide board-specific hooks into periodic timer logic. # CONFIG_ARCH=z80 CONFIG_ARCH_Z80=y @@ -77,7 +79,10 @@ CONFIG_ARCH_IRQPRIO=n CONFIG_BOARD_LOOPSPERMSEC=1250 CONFIG_ENDIAN_BIG=y CONFIG_DRAM_SIZE=65536 -CONFIG_ARCH_LEDS=n +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_BUTTONS=n +CONFIG_ARCH_TIMERHOOK=y + # # eZ8 specific device driver settings # diff --git a/nuttx/configs/ez80f910200zco/src/Makefile b/nuttx/configs/ez80f910200zco/src/Makefile index 29273e093..66b05da7d 100644 --- a/nuttx/configs/ez80f910200zco/src/Makefile +++ b/nuttx/configs/ez80f910200zco/src/Makefile @@ -43,7 +43,14 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(INCLUDES) $(ARCH ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -CSRCS = ez80_lowinit.c ez80_leds.c + +CSRCS = ez80_lowinit.c +ifeq ($(CONFIG_ARCH_LEDS),y) +CSRCS += ez80_leds.c +endif +ifeq ($(CONFIG_ARCH_BUTTONS),y) +CSRCS += ez80_buttons.c +endif COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/configs/ez80f910200zco/src/ez80_leds.c b/nuttx/configs/ez80f910200zco/src/ez80_leds.c index 60ba6fdc5..fc18a1d4e 100644 --- a/nuttx/configs/ez80f910200zco/src/ez80_leds.c +++ b/nuttx/configs/ez80f910200zco/src/ez80_leds.c @@ -54,6 +54,151 @@ * Private Data ****************************************************************************/ +/* 5x7 LED matrix character glyphs. Each glyph consists of 6 bytes, one + * each row and each containing 7 bits of data, one for each column + */ + +#if 0 /* Not used */ +static const ubyte g_chblock[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* block */ +#endif + +static const ubyte g_chspace[] = 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f}; /* space */ + +#if 0 /* Not used */ +static const ubyte g_chexclam[] = 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1f, 0x1b}; /* ! */ +static const ubyte g_chquote[] = 0x15, 0x15, 0x15, 0x1f, 0x1f, 0x1f, 0x1f}; /* " */ +static const ubyte g_chnum[] = 0x1f, 0x15, 0x00, 0x15, 0x00, 0x15, 0x1f}; /* # */ +static const ubyte g_chdollar[] = 0x1b, 0x11, 0x0a, 0x11, 0x0a, 0x11, 0x1b}; /* $ */ +static const ubyte g_chpct[] = 0x1f, 0x1e, 0x15, 0x1b, 0x15, 0x0f, 0x1f}; /* % */ +static const ubyte g_champ[] = 0x11, 0x0e, 0x0e, 0x11, 0x15, 0x0e, 0x10}; /* & */ +static const ubyte g_chsquote[] = 0x1b, 0x1b, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f}; /* ' */ +static const ubyte g_chlparen[] = 0x1d, 0x1b, 0x17, 0x17, 0x17, 0x1b, 0x1d}; /* ( */ +static const ubyte g_chrparen[] = 0x17, 0x1b, 0x1d, 0x1d, 0x1d, 0x1b, 0x17}; /* ) */ +#endif + +static const ubyte g_chast[] = 0x1f, 0x0a, 0x11, 0x00, 0x11, 0x0a, 0x1f}; /* * */ + +#if 0 /* Not used */ +static const ubyte g_chplus[] = 0x1f, 0x1b, 0x1b, 0x00, 0x1b, 0x1b, 0x1f}; /* + */ +static const ubyte g_chcomma[] = 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1b, 0x17}; /* , */ +static const ubyte g_chhyphen[] = 0x1f, 0x1f, 0x1f, 0x00, 0x1f, 0x1f, 0x1f}; /* - */ +static const ubyte g_chperiod[] = 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1b}; /* . */ +static const ubyte g_chslash[] = 0x1f, 0x1e, 0x1d, 0x1b, 0x17, 0x0f, 0x1f}; /* / */ +#endif + +static const ubyte g_ch0[] = 0x11, 0x0e, 0x0c, 0x0a, 0x06, 0x0e, 0x11}; /* 0 */ + +#if 0 /* Not used */ +static const ubyte g_ch1[] = 0x1b, 0x13, 0x1b, 0x1b, 0x1b, 0x1b, 0x11}; /* 1 */ +static const ubyte g_ch2[] = 0x11, 0x0e, 0x1d, 0x1b, 0x17, 0x0f, 0x00}; /* 2 */ +static const ubyte g_ch3[] = 0x11, 0x0e, 0x1e, 0x19, 0x1e, 0x0e, 0x11}; /* 3 */ +static const ubyte g_ch4[] = 0x0e, 0x0e, 0x0e, 0x10, 0x1e, 0x1e, 0x1e}; /* 4 */ +static const ubyte g_ch5[] = 0x00, 0x0f, 0x0f, 0x01, 0x1e, 0x0e, 0x11}; /* 5 */ +static const ubyte g_ch6[] = 0x11, 0x0f, 0x0f, 0x01, 0x0e, 0x0e, 0x11}; /* 6 */ +static const ubyte g_ch7[] = 0x00, 0x1e, 0x1e, 0x1d, 0x1b, 0x1b, 0x1b}; /* 7 */ +static const ubyte g_ch8[] = 0x11, 0x0e, 0x0e, 0x11, 0x0e, 0x0e, 0x11}; /* 8 */ +static const ubyte g_ch9[] = 0x11, 0x0e, 0x0e, 0x10, 0x1e, 0x1d, 0x1b}; /* 9 */ +static const ubyte g_chcolon[] = 0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x1f, 0x1f}; /* : */ +static const ubyte g_shsemi[] = 0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x17, 0x1f}; /* ; */ +static const ubyte g_chlt[] = 0x1d, 0x1b, 0x17, 0x0f, 0x17, 0x1b, 0x1d}; /* < */ +static const ubyte g_cheq[] = 0x1f, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x1f}; /* = */ +static const ubyte g_chgt[] = 0x17, 0x1b, 0x1d, 0x1e, 0x1d, 0x1b, 0x17}; /* > */ +static const ubyte g_chquest[] = 0x11, 0x0e, 0x0d, 0x1b, 0x1b, 0x1f, 0x1b}; /* ? */ +static const ubyte g_chat[] = 0x11, 0x0a, 0x04, 0x04, 0x05, 0x0a, 0x11}; /* @ */ +#endif + +static const ubyte g_chA[] = 0x11, 0x0e, 0x0e, 0x0e, 0x00, 0x0e, 0x0e}; /* A */ + +#if 0 /* Not used */ +static const ubyte g_chB[] = 0x01, 0x0e, 0x0e, 0x01, 0x0e, 0x0e, 0x01}; /* B */ +#endif + +static const ubyte g_chC[] = 0x11, 0x0e, 0x0f, 0x0f, 0x0f, 0x0e, 0x11}; /* C */ + +s#if 0 /* Not used */ +tatic const ubyte g_chD[] = 0x01, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x01}; /* D */ +#endif + +static const ubyte g_chE[] = 0x00, 0x0f, 0x0f, 0x01, 0x0f, 0x0f, 0x00}; /* E */ + +#if 0 /* Not used */ +static const ubyte g_chF[] = 0x00, 0x0f, 0x0f, 0x01, 0x0f, 0x0f, 0x0f}; /* F */ +static const ubyte g_chG[] = 0x11, 0x0e, 0x0f, 0x08, 0x0e, 0x0e, 0x11}; /* G */ +#endif + +static const ubyte g_chH[] = 0x0e, 0x0e, 0x0e, 0x00, 0x0e, 0x0e, 0x0e}; /* H */ +static const ubyte g_chI[] = 0x00, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x00}; /* I */ + +#if 0 /* Not used */ +static const ubyte g_chJ[] = 0x00, 0x1d, 0x1d, 0x1d, 0x0d, 0x0d, 0x13}; /* J */ +static const ubyte g_chK[] = 0x0e, 0x0d, 0x0b, 0x07, 0x0b, 0x0d, 0x0e}; /* K */ +static const ubyte g_chL[] = 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x00}; /* L */ +static const ubyte g_chM[] = 0x0e, 0x04, 0x0a, 0x0a, 0x0e, 0x0e, 0x0e}; /* M */ +static const ubyte g_chN[] = 0x0e, 0x0e, 0x06, 0x0a, 0x0c, 0x0e, 0x0e}; /* N */ +static const ubyte g_chO[] = 0x11, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x11}; /* O */ +static const ubyte g_chP[] = 0x01, 0x0e, 0x0e, 0x01, 0x0f, 0x0f, 0x0f}; /* P */ +static const ubyte g_chQ[] = 0x11, 0x0e, 0x0e, 0x0e, 0x0a, 0x0c, 0x10}; /* Q */ +#endif + +static const ubyte g_chR[] = 0x01, 0x0e, 0x0e, 0x01, 0x0b, 0x0d, 0x0e}; /* R */ +static const ubyte g_chS[] = 0x11, 0x0e, 0x0f, 0x11, 0x1e, 0x0e, 0x11}; /* S */ + +#if 0 /* Not used */ +static const ubyte g_chT[] = 0x00, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b}; /* T */ +static const ubyte g_chU[] = 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x11}; /* U */ +static const ubyte g_chV[] = 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x15, 0x1b}; /* V */ +static const ubyte g_chW[] = 0x0e, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x15}; /* W */ +static const ubyte g_chX[] = 0x0e, 0x0e, 0x15, 0x1b, 0x15, 0x0e, 0x0e}; /* X */ +static const ubyte g_chY[] = 0x0e, 0x0e, 0x15, 0x1b, 0x1b, 0x1b, 0x1b}; /* Y */ +static const ubyte g_chZ[] = 0x00, 0x1e, 0x1d, 0x1b, 0x17, 0x0f, 0x00}; /* Z */ +static const ubyte g_chlbrack[] = 0x03, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x03}; /* [ */ +static const ubyte g_chbslash[] = 0x1f, 0x0f, 0x17, 0x1b, 0x1d, 0x1e, 0x1f}; /* backslash */ +static const ubyte g_chrbrack[] = 0x1c, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c}; /* ] */ +static const ubyte g_chcaret[] = 0x1b, 0x15, 0x0e, 0x1f, 0x1f, 0x1f, 0x1f}; /* ^ */ +static const ubyte g_chunder[] = 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00}; /* _ */ +static const ubyte g_chgrave[] = 0x1b, 0x1b, 0x1b, 0x1f, 0x1f, 0x1f, 0x1f}; /* ' */ +static const ubyte g_cha[] = 0x1f, 0x1f, 0x19, 0x16, 0x16, 0x16, 0x18}; /* a */ +static const ubyte g_chb[] = 0x17, 0x17, 0x11, 0x16, 0x16, 0x16, 0x11}; /* b */ +static const ubyte g_chc[] = 0x1f, 0x1f, 0x19, 0x16, 0x17, 0x16, 0x19}; /* c */ +static const ubyte g_chd[] = 0x1e, 0x1e, 0x18, 0x16, 0x16, 0x16, 0x18}; /* d */ +static const ubyte g_che[] = 0x1f, 0x1f, 0x19, 0x10, 0x17, 0x16, 0x19}; /* e */ +static const ubyte g_chf[] = 0x1d, 0x1a, 0x1b, 0x11, 0x1b, 0x1b, 0x1b}; /* f */ +static const ubyte g_chg[] = 0x1f, 0x19, 0x16, 0x16, 0x18, 0x16, 0x19}; /* g */ +static const ubyte g_chh[] = 0x17, 0x17, 0x11, 0x16, 0x16, 0x16, 0x16}; /* h */ +static const ubyte g_chi[] = 0x1f, 0x1f, 0x1b, 0x1f, 0x1b, 0x1b, 0x1b}; /* i */ +static const ubyte g_chj[] = 0x1f, 0x1d, 0x1f, 0x1d, 0x1d, 0x1d, 0x13}; /* j */ +static const ubyte g_chk[] = 0x17, 0x17, 0x15, 0x13, 0x13, 0x15, 0x16}; /* k */ +static const ubyte g_chl[] = 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b}; /* l */ +static const ubyte g_chm[] = 0x1f, 0x1f, 0x05, 0x0a, 0x0a, 0x0a, 0x0a}; /* m */ +static const ubyte g_chn[] = 0x1f, 0x1f, 0x11, 0x16, 0x16, 0x16, 0x16}; /* n */ +static const ubyte g_cho[] = 0x1f, 0x1f, 0x19, 0x16, 0x16, 0x16, 0x19}; /* o */ +static const ubyte g_chp[] = 0x1f, 0x11, 0x16, 0x16, 0x11, 0x17, 0x17}; /* p */ +static const ubyte g_chq[] = 0x1f, 0x18, 0x16, 0x16, 0x18, 0x1e, 0x1e}; /* q */ +static const ubyte g_chr[] = 0x1f, 0x1f, 0x11, 0x16, 0x17, 0x17, 0x17}; /* r */ +static const ubyte g_chs[] = 0x1f, 0x1f, 0x18, 0x17, 0x19, 0x1e, 0x11}; /* s */ +static const ubyte g_cht[] = 0x1f, 0x1f, 0x1b, 0x11, 0x1b, 0x1b, 0x1b}; /* t */ +static const ubyte g_chu[] = 0x1f, 0x1f, 0x16, 0x16, 0x16, 0x16, 0x18}; /* u */ +static const ubyte g_chv[] = 0x1f, 0x1f, 0x16, 0x16, 0x16, 0x16, 0x19}; /* v */ +static const ubyte g_chw[] = 0x1f, 0x1f, 0x0a, 0x0a, 0x0a, 0x0a, 0x15}; /* w */ +static const ubyte g_chx[] = 0x1f, 0x1f, 0x0e, 0x15, 0x1b, 0x15, 0x0e}; /* x */ +static const ubyte g_chy[] = 0x1f, 0x1a, 0x1a, 0x1a, 0x1d, 0x1b, 0x17}; /* y */ +static const ubyte g_cha[] = 0x1f, 0x1f, 0x10, 0x1d, 0x1b, 0x17, 0x10}; /* z */ +static const ubyte g_chlbrace[] = 0x1d, 0x1b, 0x1b, 0x17, 0x1b, 0x1b, 0x1d}; /* { */ +static const ubyte g_chvbar[] = 0x1b, 0x1b, 0x1b, 0x1f, 0x1b, 0x1b, 0x1b}; /* | */ +static const ubyte g_chrbrace[] = 0x17, 0x1b, 0x1b, 0x1d, 0x1b, 0x1b, 0x17}; /* } */ +static const ubyte g_chtilde[] = 0x1f, 0x1a, 0x15, 0x1f, 0x1f, 0x1f, 0x1f}; /* ~ */ +#endif + +/* The current and previously selected glyph */ + +static const ubyte *g_currglyph = g_chspace; +static const ubyte *g_prevglyph = g_chspace; + +/* Current row and column */ + +static ubyte g_anodecol = 1; +static ubyte g_cathoderow = 0; + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -69,6 +214,10 @@ #ifdef CONFIG_ARCH_LEDS void up_ledinit(void) { + g_currglyph = g_chspace; + g_prevglyph = g_chspace; + g_anodecol = 1; + g_cathoderow = 0; } /**************************************************************************** @@ -77,6 +226,50 @@ void up_ledinit(void) void up_ledon(int led) { + FAR const char *tmp = g_currglyph; + switch (led) + { + case LED_STARTED: + g_currglyph = g_ch0; + break; + + case LED_HEAPALLOCATE: + g_currglyph = g_chH; + break; + + case LED_IRQSENABLED: + g_currglyph = g_chE; + break; + + case LED_STACKCREATED: + g_currglyph = g_chC; + break; + + case LED_IDLE: + g_currglyph = g_chR; + break; + + case LED_INIRQ: + g_currglyph = g_chI; + break; + + case LED_ASSERTION: + g_currglyph = g_chA; + break; + + case LED_SIGNAL: + g_currglyph = g_chS; + break; + + case LED_PANIC: + g_currglyph = g_chast; + break; + + default: + return; + } + + g_prevglyph = tmp; } /**************************************************************************** @@ -85,5 +278,26 @@ void up_ledon(int led) void up_ledoff(int led) { + g_currglyph = g_prevglyph; } + +/**************************************************************************** + * Name: up_timerhook + ****************************************************************************/ + + void up_timerhook(void) +{ + if (g_cathoderow > 6) + { + g_anodecol = 1; + g_cathoderow = 0; + } + + ez80_putmmreg8(g_anodecol, EZ80_LEDANODE); + ez80_putmmreg8(g_currglyph[g_cathoderow], EZ80_LEDCATHODE); + + g_cathoderow++; + g_anodecol = g_anodecol << 1; +} + #endif /* CONFIG_ARCH_LEDS */ diff --git a/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h b/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h new file mode 100644 index 000000000..bb8cc9b4e --- /dev/null +++ b/nuttx/configs/ez80f910200zco/src/ez80f910200zco.h @@ -0,0 +1,145 @@ +/**************************************************************************** + * arch/ez80f910200zco/src/ez80f910200zco.h + * + * Copyright (C) 2008 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ****************************************************************************/ + +#ifndef _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO+H +#define _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO+H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Memory map */ + +#define EZ80_ONCHIPFLASH 0x000000 /* CS0: 256Kb of on-chip flash */ +#define EZ80_OFFCHIPFLASH 0x400000 /* CS0: Off chip flash (Up to 4Mb-256Kb) */ +#define EZ80_LEDGPIOCNTRL 0x800000 /* CS2: (See below) */ +#define EZ80_PLTFMSRAM 0xb80000 /* CS2: Platform SRAM (512Kb) */ +#define EZ80_MODULESRAM 0xc00000 /* CS1: Module SRAM (up to 2Mb) */ +#define EZ80_ONCHIPFLASH 0xffe000 /* On-chip SRAM (8Kb) */ + +/* LED and port emulation memory register addresses */ + +#define EZ80_LEDANODE 0x800000 /* WR: LED anode/GPIO port output control */ +#define EZ80_GPIOCNTRL EZ80_LEDANODE +#define EZ80_LEDCATHODE 0x800001 /* WR: LED cathode/Modem/Trig */ +#define EZ80_MODEM EZ80_LEDCATHODE +#define EZ80_TRIGGERS EZ80_LEDCATHODE +#define EZ80_GPIODATA 0x800002 /* RD/WR: GPIO data */ + +#define getmmreg(a) (*(ubyte*)(a)) +#define putmmreg(v,a) (*(ubyte*)(a) = (v)) + +/* LED anode/GPIO port output control bit definitions */ + +#define EZ80_ANODECOL1 0x01 +#define EZ80_ANODECOL2 0x02 +#define EZ80_ANODECOL3 0x04 +#define EZ80_ANODECOL4 0x08 +#define EZ80_ANODECOL5 0x10 +#define EZ80_ANODECOL6 0x20 +#define EZ80_ANODECOL7 0x40 +#define EZ80_GPIOOUTPUT 0x80 + +/* LED cathode/Modem/Trig bit definitions */ + +#define EZ80_CATHODEROW5 0x01 +#define EZ80_CATHODEROW4 0x02 +#define EZ80_CATHODEROW3 0x04 +#define EZ80_CATHODEROW2 0x08 +#define EZ80_CATHODEROW1 0x10 +#define EZ80_MODEMRESET 0x20 +#define EZ80_TRIG1 0x40 +#define EZ80_TRIG2 0x80 + +/* GPIO data bit definitions */ + +#define EZ80_GPIOD0 0x01 +#define EZ80_GPIOD1 0x02 +#define EZ80_GPIOD2 0x04 +#define EZ80_GPIOD3 0x08 +#define EZ80_GPIOD4 0x10 +#define EZ80_GPIOD5 0x20 +#define EZ80_GPIOD6 0x40 +#define EZ80_GPIOD7 0x80 + +/* Modem Signals: + * + * DCD: + * The Data Carrier Detect (DCD) signal at D1 indicates that a good carrier + * signal is being received from the remove mode. + * RX: + * The RX signal at D2 indicates that data is received from the modem. + * DTR: + * The Data Terminal Ready (DTR) signal at D3 informs the modem that the PC + * is ready. + * TX: + * The TX signal at D4 indicates that data is tranmitted to the modem. + */ + + /* Push buttons: + * + * PB0 SW1 Bit 0 of GPIO Port B + * PB1 SW2 Bit 1 of GPIO Port B + * PB2 SW3 Bit 2 of GPIO Port B + * RESET SW4 + */ + +#define EZ80_PB0_IRQ EZ80_PORTB0_IRQ /* Vector Oxa0 */ +#define EZ80_PB1_IRQ EZ80_PORTB1_IRQ /* Vector Oxa4 */ +#define EZ80_PB2_IRQ EZ80_PORTB2_IRQ /* Vector Oxa8 */ + + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* _CONFIGS_EZ80F910200ZCO_SRC_EZ80F910200ZCO+H */