From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27835 invoked by alias); 7 Nov 2008 18:30:53 -0000 Received: (qmail 25494 invoked by uid 22791); 7 Nov 2008 18:30:10 -0000 X-Spam-Status: No, hits=1.1 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_23,J_CHICKENPOX_24,J_CHICKENPOX_34,SPF_PASS,ZMIde_GENERICSPAM1 X-Spam-Check-By: sourceware.org Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.191) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 07 Nov 2008 18:29:27 +0000 Received: by nf-out-0910.google.com with SMTP id g16so708635nfd.16 for ; Fri, 07 Nov 2008 10:29:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=ufphn3yeU6x4akB9DSQsN7cpmAHFxHuGwuY7inWF9Sg=; b=mmWpwmF/A4uic5P8vE/YGAn0G0IxAIV1Vq6WPbequK29KRQwMfuimZtsTB/Twr542H 9/TYYqDABDCFVcs3LX3iyS+KJBYaSO40Ws1E7Ho3ES7CrsN2T2VIaPHlecal8efwtZyN c1gs/w6TgEJZhvlEfAN+ajyM0eKSaSP8nhaPg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=it02ny83ZFv5gxCQyVsQZcGgejAlIPnmgVz++XsKibB7dnjA8PwSf51ndGpWzdRMdu JNwuzkyflI3Spr3ofeIg4fJaqct8HANRt1en7IGwVzwiPPTsc/4uwfKrOg0C9DfyF0mA PivKq62cWap02qslqFfLx3qbGQSegc44sxT+I= Received: by 10.210.127.13 with SMTP id z13mr4292617ebc.11.1226082562127; Fri, 07 Nov 2008 10:29:22 -0800 (PST) Received: from smtp.gmail.com ([86.57.141.19]) by mx.google.com with ESMTPS id f3sm2178674nfh.2.2008.11.07.10.29.15 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 07 Nov 2008 10:29:20 -0800 (PST) Date: Fri, 07 Nov 2008 18:30:00 -0000 From: Sergei Gavrikov To: eCos patches list Subject: Re: Support for Olimex LPC-H2294, LPC-E2294, LPC-L2294-1M targets Message-ID: <20081107182918.GA13070@ubuntu.local> References: <20081103205406.GA9692@ubuntu.local> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="9amGYk9869ThD9tj" Content-Disposition: inline In-Reply-To: <20081103205406.GA9692@ubuntu.local> User-Agent: Mutt/1.5.17+20080114 (2008-01-14) X-IsSubscribed: yes Mailing-List: contact ecos-patches-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-patches-owner@ecos.sourceware.org X-SW-Source: 2008-11/txt/msg00020.txt.bz2 --9amGYk9869ThD9tj Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1130 On Mon, Nov 03, 2008 at 10:54:06PM +0200, Sergei Gavrikov wrote: > Hello, > > Got the assignment from FSF, I ask about merge my old code with eCos > anonymous CVS tree. Those were 3 targets for ARM7TDMI boards from > Olimex: LPC-H2294, LPC-E2294, LPC-L2294-1M ...Thinking that patch is > too big to attach it, I did upload the assignment in PDF and gziped > patch for all targets into incoming folder at eCosCentric FTP. It was > possible to upload, but I can't list anything. I think that's normal. > If I remember I read somewhere in the past that we must use incoming > folder for same patches. But, perhaps, I forgot the URL. If I've done > a wrong thing, please, correct me. Hello, Well, it seems I copied that stuff into /dev/null :-) I do repost that in a few patches: olpce2294.patch, olpch2294.patch, olpcl2294.patch are patches for 3 targets, ecos.db.patch is "an appendix" for ecos.db and the last in line (devs_eth_cl_cs8900a.patch) is the patch to make eth CL CS8900A to work in an 8-bit mode. Note: OLPC-E2294 target needs the CL CS8900A patch. I'm sorry, but I do not know where to send PDF copy my C.A. Sergei --9amGYk9869ThD9tj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="olpce2294.patch" Content-length: 84059 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpce2294/current/cdl/olpce2294_eth_drivers.cdl devo/ecos/packages/devs/eth/arm/olpce2294/current/cdl/olpce2294_eth_drivers.cdl --- clean/ecos/packages/devs/eth/arm/olpce2294/current/cdl/olpce2294_eth_drivers.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpce2294/current/cdl/olpce2294_eth_drivers.cdl 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,123 @@ +# ==================================================================== +# +# olpce2294_eth_drivers.cdl +# +# Ethernet drivers - platform dependent support for OLPCE2294 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_OLPCE2294 { + display "LAN ethernet driver for Olimex LPC-E2294" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 + + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + + requires CYGPKG_DEVS_ETH_CL_CS8900A + + # Olimex LPC-E2294 development board has Cirrus Logic CS8900A ethernet + # controller had been wired in a dumb 8-bit mode. + requires CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT + + include_dir cyg/io + + description " + Ethernet driver for Olimex LPC-E2294 board." + + cdl_interface CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED { + display "CL CS8900A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGSEM_DEVS_ETH_CL_CS8900A_NOINTS { + display "Interrupts are not supported" + calculated 1 + description " + Interrups are not supported in 8-bit mode. Polled mode must + be used." + } + + cdl_component CYGPKG_DEVS_ETH_ARM_OLPCE2294_ETH0 { + display "OLPCE2294 ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + OLPCE2294 port." + + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + implements CYGINT_DEVS_ETH_CL_CS8900A_DATABUS_8BIT + + cdl_option CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_OLPCE2294_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 1 + description "Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration." + + cdl_option CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpce2294/current/ChangeLog devo/ecos/packages/devs/eth/arm/olpce2294/current/ChangeLog --- clean/ecos/packages/devs/eth/arm/olpce2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpce2294/current/ChangeLog 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,6 @@ +2008-08-31 Sergei Gavrikov + + * Ethernet driver for LPC-E2294 development board + * cdl/olpce2294_eth_drivers.cdl + * include/devs_eth_arm_olpce2294.h + * include/devs_eth_arm_olpce2294.inl diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpce2294/current/doc/README devo/ecos/packages/devs/eth/arm/olpce2294/current/doc/README --- clean/ecos/packages/devs/eth/arm/olpce2294/current/doc/README 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpce2294/current/doc/README 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,14 @@ +Olimex LPC-E2294 development board has a Cirrus Logic CS8900A ethernet +controller had been wired to MPU in 8-bit mode. This mode does have a +few limitations: + + Interrupts are not supported. Polled mode must be used; + + The DMA engine only uses 16 bit memory access and does not + support 8 bit transfers; + + The packet page pointer has an auto increment feature that + cannot be used in 8-bit mode; + + EEPROM is not supported. + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.h devo/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.h --- clean/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.h 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,56 @@ +#ifndef _CYGONCE_DEVS_ETH_ARM_OLPCE2294_H +#define _CYGONCE_DEVS_ETH_ARM_OLPCE2294_H +//========================================================================== +// +// devs_eth_arm_olpce2294.h +// +// OLPCE2294 ethernet configuration +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: OLPCE2294 ethernet configuration +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + + +#endif // _CYGONCE_DEVS_ETH_ARM_OLPCE2294_H +//-------------------------------------------------------------------------- +// EOF devs_eth_arm_olpce2294.h diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.inl devo/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.inl --- clean/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.inl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpce2294/current/include/devs_eth_arm_olpce2294.inl 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,173 @@ +//========================================================================== +// +// devs_eth_arm_olpce2294.inl +// +// OLPCE2294 ethernet I/O definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: OLPCE2294 ethernet definitions +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +#ifdef CYGPKG_REDBOOT +# include +# ifdef CYGSEM_REDBOOT_FLASH_CONFIG +# include +# include +# endif +#endif + +#ifdef __WANT_CONFIG +//#define DEBUG 0xf + +// This is done by reading the low order byte first +#define CS_IN( _b_, _o_, _d_) \ + CYG_MACRO_START \ + cyg_uint8 x, y; \ + HAL_READ_UINT8 ((cyg_addrword_t)(_b_)+(_o_), x); \ + _d_ = x; \ + HAL_READ_UINT8 ((cyg_addrword_t)(_b_)+(_o_)+1, y); \ + _d_ |= y << 8; \ + CYG_MACRO_END + +// This is done by writing the low order byte first +#define CS_OUT( _b_, _o_, _d_) \ + CYG_MACRO_START \ + HAL_WRITE_UINT8 ((cyg_addrword_t)(_b_)+(_o_), _d_); \ + HAL_WRITE_UINT8 ((cyg_addrword_t)(_b_)+(_o_)+1, (_d_) >> 8);\ + CYG_MACRO_END + +#endif // __WANT_CONFIG + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_ARM_OLPCE2294_ETH0 + +#ifndef CYGSEM_DEVS_ETH_ARM_OLPCE2294_ETH0_SET_ESA +#if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG) +RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_NAME " network hardware address [MAC]", + eth0_esa, + ALWAYS_ENABLED, true, + CONFIG_BOOL, false + ); +RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_NAME " network hardware address [MAC]", + eth0_esa_data, + "eth0_esa", true, + CONFIG_ESA, 0 + ); +#endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG + +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +// Note that this section *is* active in an application, outside RedBoot, +// where the above section is not included. + +# include + +# ifndef CONFIG_ESA +# define CONFIG_ESA (6) +# endif +# ifndef CONFIG_BOOL +# define CONFIG_BOOL (1) +# endif + +cyg_bool +_olpce2294_provide_eth0_esa(struct cs8900a_priv_data* cpd) +{ + cyg_bool set_esa; + int ok; + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa", &set_esa, CONFIG_BOOL); + if (ok && set_esa) { + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa_data", cpd->esa, CONFIG_ESA); + } + return ok && set_esa; +} + +# endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +#endif // ! CYGSEM_DEVS_ETH_ARM_OLPCE2294_ETH0_SET_ESA + +static cs8900a_priv_data_t cs8900a_eth0_priv_data = { + base : (cyg_addrword_t) 0x82000000, + interrupt : CYGNUM_HAL_INTERRUPT_NONE, +#ifdef CYGSEM_DEVS_ETH_ARM_OLPCE2294_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + provide_esa : &_olpce2294_provide_eth0_esa, +# else + provide_esa : NULL, +# endif +#endif +}; + +ETH_DRV_SC(cs8900a_sc, + &cs8900a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_NAME, + cs8900a_start, + cs8900a_stop, + cs8900a_control, + cs8900a_can_send, + cs8900a_send, + cs8900a_recv, + cs8900a_deliver, // "pseudoDSR" called from fast net thread + cs8900a_poll, // poll function, encapsulates ISR and DSR + cs8900a_int_vector); + +NETDEVTAB_ENTRY(cs8900a_netdev, + "cs8900a_" CYGDAT_DEVS_ETH_ARM_OLPCE2294_ETH0_NAME, + cs8900a_init, + &cs8900a_sc); + +#endif // CYGPKG_DEVS_ETH_ARM_OLPCE2294_ETH0 + +#endif // __WANT_DEVS + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF devs_eth_arm_olpce2294.inl + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpce2294/current/cdl/flash_olpce2294.cdl devo/ecos/packages/devs/flash/arm/olpce2294/current/cdl/flash_olpce2294.cdl --- clean/ecos/packages/devs/flash/arm/olpce2294/current/cdl/flash_olpce2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpce2294/current/cdl/flash_olpce2294.cdl 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,63 @@ +# ==================================================================== +# +# flash_olpce2294.cdl +# +# FLASH memory - Hardware support on Olimex LPC-E2294 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_ARM_OLPCE2294 { + display "ARM OLPCE2294 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 + implements CYGHWR_IO_FLASH_DEVICE + + compile arm_olpce2294_flash.c + + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" + } + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_INTEL_28F320C3 +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpce2294/current/ChangeLog devo/ecos/packages/devs/flash/arm/olpce2294/current/ChangeLog --- clean/ecos/packages/devs/flash/arm/olpce2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpce2294/current/ChangeLog 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,5 @@ +2008-08-31 Sergei Gavrikov + + * Flash driver for LPC-E2294 development board + * cdl/flash_olpce2294.cdl + * src/arm_olpce2294_flash.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpce2294/current/src/arm_olpce2294_flash.c devo/ecos/packages/devs/flash/arm/olpce2294/current/src/arm_olpce2294_flash.c --- clean/ecos/packages/devs/flash/arm/olpce2294/current/src/arm_olpce2294_flash.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpce2294/current/src/arm_olpce2294_flash.c 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,65 @@ +//========================================================================== +// +// arm_olpce2294_flash.c +// +// Flash programming for Intel FlashFile devices on Olimex LPC-E2294 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +// The Olimex LPC-E2294 development board has alone Intel 28F320C3 flash memory +// part. + +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x80000000u) + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// ------------------------------------------------------------------------ +// EOF arm_olpce2294_flash.c + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/cdl/hal_arm_lpc2xxx_olpce2294.cdl devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/cdl/hal_arm_lpc2xxx_olpce2294.cdl --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/cdl/hal_arm_lpc2xxx_olpce2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/cdl/hal_arm_lpc2xxx_olpce2294.cdl 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,295 @@ +# ==================================================================== +# +# hal_arm_lpc2xxx_olpce2294.cdl +# +# ARM LPC2XXX OLPCE2294 development board package configuration +# data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 { + display "Olimex LPC-E2294 development board HAL" + parent CYGPKG_HAL_ARM_LPC2XXX + define_header hal_arm_lpc2xxx_olpce2294.h + include_dir cyg/hal + hardware + description " + The OLPCE2294 HAL package provides the support needed to run + eCos on Olimex LPC-E2294 development board." + + compile olpce2294_misc.c + + requires { CYGHWR_HAL_ARM_LPC2XXX == "LPC2294" } + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM7TDMI-S\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Olimex LPC-E2294 development board\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description "Choose RAM or ROM startup type." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 3 + description " + Channel 0: UART0, Channel 1: UART1, Channel 2: LCD." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to 1 + default_value 0 + description " + Olimex LPC-E2294 board has two serial ports. This option + chooses which port will be used to connect to a host + running GDB." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + Olimex LPC-E2294 board has two serial ports and a LCD. This + option chooses which port will be used for diagnostic + output." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic + port." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB + connection." + } + + # Real-time clock/counter specifics + cdl_option CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ { + display "CPU xtal frequency" + flavor data + default_value {14745600} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL { + display "CPU PLL multiplier" + flavor data + default_value {4} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_CLOCK_SPEED { + display "CPU clock speed" + flavor data + calculated { CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL * CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over compiler flags, + linker flags and choice of toolchain." + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by default. Individual + packages may define options which override these global + flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static -g -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global + flags." + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM"} + description " + Enable this option if this program is to be used as a + ROM monitor, i.e. applications will be loaded into RAM on + the board, and this ROM monitor may process exceptions or + interrupts generated from the application. This enables + features such as utilizing a separate interrupt stack when + exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM + monitor. This support changes various eCos semantics such + as the encoding of diagnostic output, or the overriding of + hardware interrupt vectors. + Firstly there is \"Generic\" support which prevents the + HAL from overriding the hardware vectors that it does not + use, to instead allow an installed ROM monitor to handle + them. This is the most basic support which is likely to be + common to most implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included + in the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid + Redboot configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + requires { !CYGBLD_BUILD_REDBOOT_WITH_EXEC } + default_value 1 + no_define + description " + This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a redboot_cmds.c + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O ihex $< $(@:.bin=.hex) + $(OBJCOPY) -O binary $< $@ + } + + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { (CYG_HAL_STARTUP == "RAM") ? "arm_lpc2xxx_olpce2294_ram" : + "arm_lpc2xxx_olpce2294_rom" } + + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + "" } + } + } +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/ChangeLog devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/ChangeLog --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/ChangeLog 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,14 @@ +2008-08-31 Sergei Gavrikov + + * LPC-E2294 development board package + * cdl/hal_arm_lpc2xxx_olpce2294.cdl + * include/hal_platform_setup.h + * include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.h + * include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.ldi + * include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.h + * include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.ldi + * include/plf_io.h + * misc/redboot_ROM.ecm + * src/btn_drv.c + * src/olpce2294_misc.c + * src/redboot_cmds.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/hal_platform_setup.h devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/hal_platform_setup.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/hal_platform_setup.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/hal_platform_setup.h 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,230 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: Olimex LPC-E2294 platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include + + // There are no diagnostic leds on the board, but there is a LCD there + // with BACKLIGHT feature. No way to display some info on LCD here, but + // we can drive by BACKLIGHT put to a cathode a static signal. + + .macro _led_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0DIR] + orr r1,r1,#(1<<10) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0DIR] + + .endm // _led_init + + .macro _led x + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,=(1<<10) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0CLR] + ldr r1,=((\x & 1)<<10) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0SET] + + .endm // _led + + .macro _pll_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + + mov r2,#0xAA + mov r3,#0x55 + + // enable PLL + mov r1,#1 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + + mov r1,#(0x20 | (CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL - 1)) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCFG] + + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + // wait for it to lock +1: + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLSTAT] + ands r1,r1,#(1<<10) + beq 1b + + // connect PLL + mov r1,#3 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + .endm // _pll_init + + .macro _mem_init + // copy first 64 bytes from ROM to on-chip RAM + mov r0,#0 + mov r1,#0x40000000 + mov r2,#0x40 +1: + ldr r3,[r0,#4]! + str r3,[r1,#4]! + cmps r0,r2 + bne 1b + + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + mov r1,#2 // interrupt vector table is mapped to RAM + str r1, [r0,#CYGARC_HAL_LPC2XXX_REG_MEMMAP] + + // flash timings + mov r1,#4 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMTIM] + mov r1,#2 // 2, full MAM + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMCR] + + // External memory interface depends on the bank width (32, 16 or 8 bit + // selected via MW bits in corresponding BCFG register). Furthermore, + // choice of the memory chip(s) will require an adequate setup of RBLE + // bit in BCFG register, too. RBLE = 0 in case of 8-bit based external + // memories, while memory chips capable of accepting 16 or 32 bit wide + // data will work with RBLE = 1. + // + // BANK0: 4M FLASH + // TE28F320C3BD70 (1024Kx32 x 1, 70nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG0 + ldr r1,= (0x3 << 0) /* IDCY=3, idle timing */\ + | (0x4 << 5) /* WST1=4, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x6 << 11) /* WST2=6, write timing */\ + | (0x1 << 28) /* MW=1, 16-bits */ + str r1,[r0] + + // BANK1: 1M RAM + // K6R4016V1D (512Kx16 x 2, 10nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG1 + // Warning: changed these timings, you can fall dramatically the eCos + // kernel performance. Check it then using the eCos 'tm_basic' test. + ldr r1,= (0x0 << 0) /* IDCY=0, idle cycles */\ + | (0x0 << 5) /* WST1=0, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x0 << 11) /* WST2=0, write timing */\ + | (0x2 << 28) /* MW=2, 32-bits */ + str r1,[r0] + + // BANK2: Ethernet + // CS8900A (8-bit, no interrupt driven mode) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG2 + ldr r1,= (0x1 << 0) /* IDCY=1, idle cycles */\ + | (0x8 << 5) /* WST1=8, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x6 << 11) /* WST2=6, write timing */\ + | (0x0 << 28) /* MW=0, 8-bits */ + str r1,[r0] + + .endm // _mem_init + + .macro _gpio_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_PIN_BASE + + // Configure P0.15:0 as PIO, but UART0, UART1, EINT2 ('B1' button) + ldr r1,= (0x1 << 0) /* P0.0 as TxD0 */\ + | (0x1 << 2) /* P0.1 as RxD0 */\ + | (0x1 << 16) /* P0.1 as TxD1 */\ + | (0x1 << 18) /* P0.1 as RxD1 */\ + | (0x2 << 30) /* P0.15 as EINT2 */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL0] + + // Configure P0.30:16 as PIO, but EINT0 ('B2' button) + ldr r1,= (0x1 << 0) /* P0.16 as EINT0 */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL1] + + // GPIO P1.25:16, P3.24 are used as PIO + ldr r1,= (0x1 << 2) /* P1.36:26 Debug port */\ + | (0x2 << 4) /* D31:0,CS0,OE,BLS0-3 */\ + | (0x1 << 8) /* WE enabled */\ + | (0x1 << 11) /* CS1 enabled */\ + | (0x1 << 14) /* CS2 enabled */\ + | (0x1 << 23) /* A0 enabled */\ + | (0x1 << 24) /* A1 enabled */\ + | (0x7 << 25) /* A23:2 enabled */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL2] + + .endm // _gpio_init + +#define CYGHWR_LED_MACRO _led \x + +#if defined(CYG_HAL_STARTUP_ROM) + + .macro _setup + + _pll_init + + _mem_init + + _gpio_init + + _led_init + + .endm + +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +#else + + .macro _setup + + .endm + +#endif // CYG_HAL_STARTUP_ROM + +#define PLATFORM_SETUP1 _setup + +#endif // CYGONCE_HAL_PLATFORM_SETUP_H + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.h devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.h 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,19 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_ram.ldi 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,25 @@ +#include + +MEMORY +{ + ram0 : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram0, 0x40000020, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x81010000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.h devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.h 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,22 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_rom (0x00000000) +#define CYGMEM_REGION_rom_SIZE (0x00040000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpce2294_rom.ldi 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,26 @@ +#include + +MEMORY +{ + ram0 : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 + rom : ORIGIN = 0x00000000, LENGTH = 0x40000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x00000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram0, 0x40000020, LMA_EQ_VMA) + SECTION_data (ram, 0x81000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/plf_io.h devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/plf_io.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/plf_io.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/include/plf_io.h 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,88 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H +//============================================================================= +// +// plf_io.h +// +// Olimex LPC-E2294 board specific registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: Olimex LPC-E2294 board specific registers +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +// On-chip device base addresses + +#ifndef __ASSEMBLER__ +extern void hal_plf_hardware_init(void); +#define HAL_PLF_HARDWARE_INIT() \ + hal_plf_hardware_init() + +#define IO0PIN (*(volatile unsigned int *)0xE0028000) +#define IO0SET (*(volatile unsigned int *)0xE0028004) +#define IO0DIR (*(volatile unsigned int *)0xE0028008) +#define IO0CLR (*(volatile unsigned int *)0xE002800C) + +#define IO1PIN (*(volatile unsigned int *)0xE0028010) +#define IO1SET (*(volatile unsigned int *)0xE0028014) +#define IO1DIR (*(volatile unsigned int *)0xE0028018) +#define IO1CLR (*(volatile unsigned int *)0xE002801C) + +#define IO2PIN (*(volatile unsigned int *)0xE0028020) +#define IO2SET (*(volatile unsigned int *)0xE0028024) +#define IO2DIR (*(volatile unsigned int *)0xE0028028) +#define IO2CLR (*(volatile unsigned int *)0xE002802C) + +#define IO3PIN (*(volatile unsigned int *)0xE0028030) +#define IO3SET (*(volatile unsigned int *)0xE0028034) +#define IO3DIR (*(volatile unsigned int *)0xE0028038) +#define IO3CLR (*(volatile unsigned int *)0xE002803C) + +#define PINSEL0 (*(volatile unsigned int *)0xE002C00) +#define PINSEL1 (*(volatile unsigned int *)0xE002C04) + +#endif // __ASSEMBLER__ + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_HAL_PLF_IO_H + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/misc/redboot_ROM.ecm devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/misc/redboot_ROM.ecm --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/misc/redboot_ROM.ecm 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/misc/redboot_ROM.ecm 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,127 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware olpce2294 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_OLPCE2294 current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_OLPCE2294 current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_IO_SERIAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_CRC current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_NS_DNS current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT { + inferred_value 1 +}; + +cdl_option CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGHWR_HAL_ARM_LPC2XXX { + inferred_value LPC2294 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_GUNZIP { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_LOAD_INTO_FLASH { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_EXEC { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F320C3 { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/olpce2294_misc.c devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/olpce2294_misc.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/olpce2294_misc.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/olpce2294_misc.c 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,561 @@ +//========================================================================== +// +// olpce2294_misc.c +// +// HAL misc board support code for Olimex LPC-E2294 development board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include // IO macros +#include // base types + +#include +#include + +#include // Interrupt macros +#include // SAVE/RESTORE GP +#include +#include // HAL_DELAY_US + +extern void cyg_hal_plf_serial_init (void); + +static void cyg_hal_plf_lcd_init (void); + +// There are no diagnostic leds on the board, but there is a LCD there with a +// BACKLIGHT feature. So, we can drive by BACKLIGHT put on a cathode a static +// signal. + +inline static void +_fake_led (bool state) +{ + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO0CLR, (1 << 10)); + if (state) { + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO0SET, (1 << 10)); + } +} + +//-------------------------------------------------------------------------- +// hal_lpc2xxx_set_leds -- +// +void +hal_lpc2xxx_set_leds (int mask) +{ + _fake_led (mask & 1); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_comms_init -- +// +void +cyg_hal_plf_comms_init (void) +{ + static int initialized = 0; + + if (initialized) + return; + initialized = 1; + + cyg_hal_plf_serial_init (); + cyg_hal_plf_lcd_init (); +} + +//-------------------------------------------------------------------------- +// LCD driver (It is based on powerpc/cogent code) +// +// Olimex LPC-E2294 development board has a LCD 16x2 display (GDM1602K) with +// a built-in controller (KS0066U). The controller is the Hitachi HD44780 +// compliant chip. Note: the LCD is driven in a 4-bit mode. +//-------------------------------------------------------------------------- + +#define LCD_BASE (void *)NULL + +#define LCD_DATA 0x00 // read/write lcd data +#define LCD_STAT 0x08 // read lcd busy status +#define LCD_CMD 0x08 // write lcd command + +// status register bit definitions +#define LCD_STAT_BUSY 0x80 // 1 = display busy +#define LCD_STAT_ADD 0x7F // bits 0-6 return current display address + +// command register definitions +#define LCD_CMD_RST 0x01 // clear entire display and reset display address +#define LCD_CMD_HOME 0x02 // reset display address and reset any shifting +#define LCD_CMD_ECL 0x04 // move cursor left one position on next data write +#define LCD_CMD_ESL 0x05 // shift display left one position on next data write +#define LCD_CMD_ECR 0x06 // move cursor right one position on next data write +#define LCD_CMD_ESR 0x07 // shift display right one position on next data write +#define LCD_CMD_DOFF 0x08 // display off, cursor off, blinking off +#define LCD_CMD_BL 0x09 // blink character at current cursor position +#define LCD_CMD_CUR 0x0A // enable cursor on +#define LCD_CMD_DON 0x0C // turn display on +#define LCD_CMD_CL 0x10 // move cursor left one position +#define LCD_CMD_SL 0x14 // shift display left one position +#define LCD_CMD_CR 0x18 // move cursor right one position +#define LCD_CMD_SR 0x1C // shift display right one position +#define LCD_CMD_MODE 0x28 // sets 4 bits, 2 lines, 5x8 characters +#define LCD_CMD_ACG 0x40 // bits 0-5 sets the character generator address +#define LCD_CMD_ADD 0x80 // bits 0-6 sets the display data address to line 1 + + +// LCD status values +#define LCD_OK 0x00 +#define LCD_ERR 0x01 + +#define LCD_LINE0 0x00 // DRAM address from 0x00 to 0x0f +#define LCD_LINE1 0x40 // DRAM address from 0x40 to 0x4f +#define LCD_LINE_LENGTH 16 + +static char lcd_line0[LCD_LINE_LENGTH + 1]; +static char lcd_line1[LCD_LINE_LENGTH + 1]; +static char *lcd_line[2] = { lcd_line0, lcd_line1 }; + +static int lcd_curline = 0; +static int lcd_linepos = 0; + +// the LCD controller <--> MPU interface +#define MPU_DB 0x000000f0 // DB7...DB4 wired to P0.7...P0.4 +#define MPU_RS 0x10000000 // RS wired to P0.28 +#define MPU_EN 0x20000000 // EN wired to P0.29 +#define MPU_RW 0x40000000 // RW wired to P0.30 +#define MPU_XX 0x700000f0 // all MPU lines + +// LCD DARKLIGHT cathode +#define DARKLIGHT 0x00000020 // P0.10 + +// Bus timing characteristics for Hitachi HD44780 compliant chips (when Vcc = +// 4.5 to 5.5 V): +// tcycE - enable cycle time, min 500 ns +// tPWEH - enable pulse width (high level), min 230 ns +// tAS - address setup time (RS, R/W to E), min 40 ns +// tAH - address hold time, min 10 ns +// tDDR - data delay time (read operations), max 160 ns +// tDSW - data setup time (write operations), min 80 ns + +#define LCD_DELAY_US(_us_) HAL_DELAY_US (_us_) + +// It should overrite the data delay time, i.e. be grater than 160 ns. +// WARNING: be careful with the delay value, more shorter delay would +// occur a dead loop when the BF (busy flag) is checked. +#define LCD_NANO_DELAY() \ + CYG_MACRO_START \ + int i; \ + for (i = 0; i < 1; i++); \ + CYG_MACRO_END + +// It should overwrite the tPWEH (enable pulse width) +#define LCD_MICRO_DELAY() \ + CYG_MACRO_START \ + int i; \ + for (i = 0; i < 3; i++); \ + CYG_MACRO_END + +// Set RS, R/W to read data +#define LCD_RS_READ_DATA() \ + CYG_MACRO_START \ + IO0SET |= MPU_RW; \ + IO0SET |= MPU_RS; \ + CYG_MACRO_END + +// Set RS, R/W to read a busy flag and address counter +#define LCD_RS_READ_STAT() \ + CYG_MACRO_START \ + IO0SET |= MPU_RW; \ + IO0CLR |= MPU_RS; \ + CYG_MACRO_END + +// Set RS, R/W to write data +#define LCD_RS_WRITE_DATA() \ + CYG_MACRO_START \ + IO0CLR |= MPU_RW; \ + IO0SET |= MPU_RS; \ + CYG_MACRO_END + +// Set RS, R/W to write an instruction +#define LCD_RS_WRITE_CMD() \ + CYG_MACRO_START \ + IO0CLR |= MPU_RW; \ + IO0CLR |= MPU_RS; \ + CYG_MACRO_END + +#define LCD_ENABLE_HIGH() \ + IO0SET |= MPU_EN; + +#define LCD_ENABLE_LOW() \ + IO0CLR |= MPU_EN; + +// High-level enable pulse +#define LCD_ENABLE_PULSE() \ + CYG_MACRO_START \ + LCD_ENABLE_HIGH (); \ + LCD_MICRO_DELAY (); \ + LCD_ENABLE_LOW (); \ + LCD_MICRO_DELAY (); \ + CYG_MACRO_END + +// Read a nibble of data from LCD controller +#define LCD_READ_NIBBLE( _n_) \ + CYG_MACRO_START \ + IO0DIR &= ~MPU_DB; \ + _n_ = (IO0PIN & MPU_DB) >> 4; \ + _n_ &= 15; \ + CYG_MACRO_END + +// Write a nibble of data to LCD controller +#define LCD_WRITE_NIBBLE( _n_) \ + CYG_MACRO_START \ + IO0DIR |= MPU_DB; \ + IO0CLR |= MPU_DB; \ + IO0SET |= ((_n_) & 15) << 4; \ + CYG_MACRO_END + +//-------------------------------------------------------------------------- +// _lcd_read -- +// +static void +_lcd_read (int sel, cyg_uint8 * dat) +{ + cyg_uint8 n; + + if (sel == LCD_DATA) + LCD_RS_READ_DATA (); + else + LCD_RS_READ_STAT (); + + // read D7-D4 nibble + LCD_ENABLE_HIGH (); + LCD_NANO_DELAY (); + LCD_READ_NIBBLE (n); + *dat = n << 4; + LCD_MICRO_DELAY (); + LCD_ENABLE_LOW (); + LCD_MICRO_DELAY (); + + // read D3-D0 nibble + LCD_ENABLE_HIGH (); + LCD_NANO_DELAY (); + LCD_READ_NIBBLE (n); + *dat |= n; + LCD_MICRO_DELAY (); + LCD_ENABLE_LOW (); + LCD_MICRO_DELAY (); +} + +//-------------------------------------------------------------------------- +// _lcd_write -- +// +static void +_lcd_write (int sel, cyg_uint8 dat) +{ + if (sel == LCD_DATA) + LCD_RS_WRITE_DATA (); + else + LCD_RS_WRITE_CMD (); + + // write D7-D4 nibble + LCD_WRITE_NIBBLE ((dat >> 4) & 15); + LCD_ENABLE_HIGH (); + LCD_MICRO_DELAY (); + LCD_ENABLE_LOW (); + LCD_MICRO_DELAY (); + + // write D3-D0 nibble + LCD_WRITE_NIBBLE (dat & 15); + LCD_ENABLE_HIGH (); + LCD_MICRO_DELAY (); + LCD_ENABLE_LOW (); + LCD_MICRO_DELAY (); +} + +#define LCD_READ( _register_, _data_) \ + _lcd_read(_register_, &(_data_)) + +#define LCD_WRITE( _register_, _data_) \ + _lcd_write(_register_, _data_) + +#ifdef CYG_HAL_STARTUP_ROM +//-------------------------------------------------------------------------- +// _lcd_pots_init -- +// +// This routine is an early LCD intitializing on power-on event (from KS0066U +// flow diagram). +// +static void +_lcd_pots_init (void) +{ + + // around power on + IO0DIR |= MPU_XX; + IO0CLR |= MPU_XX; + + // wait for more than 30 ms after Vdd rises to 4.5 V + LCD_DELAY_US (32000); + + // at first, point on a using of 4-bit mode + LCD_WRITE_NIBBLE (2); + LCD_ENABLE_PULSE (); + + LCD_WRITE_NIBBLE (2); + LCD_ENABLE_PULSE (); + LCD_WRITE_NIBBLE (8); + LCD_ENABLE_PULSE (); + + // wait for more than 39 us + LCD_DELAY_US (40); + + // BF (busy flag) can be checked +} +#endif + +// The portion of a code below is a bit adopted the LCD driver code for a +// PowerPC Cogent board. + +static void lcd_dis (int add, char *s, cyg_uint8 * base); + +//-------------------------------------------------------------------------- +// init_lcd_channel -- +// +static void +init_lcd_channel (cyg_uint8 * base) +{ + cyg_uint8 stat; + int i; + +#ifdef CYG_HAL_STARTUP_ROM + _lcd_pots_init (); +#endif + + // Wait for not busy + do { + LCD_READ (LCD_STAT, stat); + } while (stat & LCD_STAT_BUSY); + + // Configure the LCD for 4 bits/char, 2 lines and 5x8 dot matrix + LCD_WRITE (LCD_CMD, LCD_CMD_MODE); + + // Wait for not busy + do { + LCD_READ (LCD_STAT, stat); + } while (stat & LCD_STAT_BUSY); + + // Turn the LCD display on + LCD_WRITE (LCD_CMD, LCD_CMD_DON); + + lcd_curline = 0; + lcd_linepos = 0; + + for (i = 0; i < LCD_LINE_LENGTH; i++) + lcd_line[0][i] = lcd_line[1][i] = ' '; + + lcd_line[0][LCD_LINE_LENGTH] = lcd_line[1][LCD_LINE_LENGTH] = 0; + + lcd_dis (LCD_LINE0, lcd_line[0], base); + lcd_dis (LCD_LINE1, lcd_line[1], base); +} + +//-------------------------------------------------------------------------- +// lcd_dis -- +// +// This routine writes the string to the LCD display after setting the address +// to add. +// +static void +lcd_dis (int add, char *s, cyg_uint8 * base) +{ + cyg_uint8 stat; + int i; + + // Wait for not busy + do { + LCD_READ (LCD_STAT, stat); + } while (stat & LCD_STAT_BUSY); + + // Write the address + LCD_WRITE (LCD_CMD, (LCD_CMD_ADD + add)); + + // Write the string out to the display stopping when we reach 0 + for (i = 0; *s != '\0'; i++) { + // Wait for not busy + do { + LCD_READ (LCD_STAT, stat); + } while (stat & LCD_STAT_BUSY); + + // Write the data + LCD_WRITE (LCD_DATA, *s++); + } +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_putc -- +// +void +cyg_hal_plf_lcd_putc (void *__ch_data, cyg_uint8 c) +{ + cyg_uint8 *base = (cyg_uint8 *) __ch_data; + unsigned long __state; + int i; + + // Ignore CR + if (c == '\r') + return; + + CYGARC_HAL_SAVE_GP (); + HAL_DISABLE_INTERRUPTS (__state); + + if (c == '\n') { + lcd_dis (LCD_LINE0, &lcd_line[lcd_curline ^ 1][0], base); + lcd_dis (LCD_LINE1, &lcd_line[lcd_curline][0], base); + + // Do a line feed + lcd_curline ^= 1; + lcd_linepos = 0; + + for (i = 0; i < LCD_LINE_LENGTH; i++) + lcd_line[lcd_curline][i] = ' '; + + goto _exit_putc; + } + + // Only allow to be output if there is room on the LCD line + if (lcd_linepos < LCD_LINE_LENGTH) + lcd_line[lcd_curline][lcd_linepos++] = c; + +_exit_putc: + HAL_RESTORE_INTERRUPTS (__state); + CYGARC_HAL_RESTORE_GP (); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_getc -- +// +cyg_uint8 +cyg_hal_plf_lcd_getc (void *__ch_data) +{ + return 0; +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_write -- +// +static void +cyg_hal_plf_lcd_write (void *__ch_data, const cyg_uint8 * __buf, + cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP (); + + while (__len-- > 0) + cyg_hal_plf_lcd_putc (__ch_data, *__buf++); + + CYGARC_HAL_RESTORE_GP (); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_read -- +// +static void +cyg_hal_plf_lcd_read (void *__ch_data, cyg_uint8 * __buf, cyg_uint32 __len) +{ + CYGARC_HAL_SAVE_GP (); + + while (__len-- > 0) + *__buf++ = cyg_hal_plf_lcd_getc (__ch_data); + + CYGARC_HAL_RESTORE_GP (); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_control -- +// +static int +cyg_hal_plf_lcd_control (void *__ch_data, __comm_control_cmd_t __func, ...) +{ + return 0; +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_lcd_init -- +// +static void +cyg_hal_plf_lcd_init (void) +{ + hal_virtual_comm_table_t *comm; + int cur = + CYGACC_CALL_IF_SET_CONSOLE_COMM + (CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + + // Init channel + init_lcd_channel ((cyg_uint8 *) NULL); + + // Setup procs in the vector table + + // Set channel 2 + CYGACC_CALL_IF_SET_CONSOLE_COMM (2); + comm = CYGACC_CALL_IF_CONSOLE_PROCS (); + CYGACC_COMM_IF_CH_DATA_SET (*comm, LCD_BASE); + CYGACC_COMM_IF_WRITE_SET (*comm, cyg_hal_plf_lcd_write); + CYGACC_COMM_IF_READ_SET (*comm, cyg_hal_plf_lcd_read); + CYGACC_COMM_IF_PUTC_SET (*comm, cyg_hal_plf_lcd_putc); + CYGACC_COMM_IF_GETC_SET (*comm, cyg_hal_plf_lcd_getc); + CYGACC_COMM_IF_CONTROL_SET (*comm, cyg_hal_plf_lcd_control); + + // Restore original console + CYGACC_CALL_IF_SET_CONSOLE_COMM (cur); +} + +#ifdef HAL_PLF_HARDWARE_INIT +//-------------------------------------------------------------------------- +// hal_plf_hardware_init -- +// +void +hal_plf_hardware_init (void) +{ + // Cyrrently, it does nothing +} +#endif // HAL_PLF_HARDWARE_INIT + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF olpce2294_misc.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/redboot_cmds.c devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/redboot_cmds.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/redboot_cmds.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpce2294/current/src/redboot_cmds.c 2008-11-07 19:30:48.000000000 +0200 @@ -0,0 +1,177 @@ +//========================================================================== +// +// redboot_cmds.c +// +// OLPCE2294 [platform] specific RedBoot commands +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include + +#include + +// CLI functions +local_cmd_entry ("clear", "Clean up LCD entires", "", lcd_clear, LCD_cmds); + +local_cmd_entry ("dark", "Turn LCD lighting off", "", lcd_dark, LCD_cmds); + +local_cmd_entry ("echo", + "Output the args. If -n is specified, the trailing newline is suppressed.", + "-n [arg ...]", lcd_echo, LCD_cmds); + +local_cmd_entry ("light", "Turn LCD lighting on", "", lcd_light, LCD_cmds); + +CYG_HAL_TABLE_BEGIN (__LCD_cmds_TAB__, LCD_cmds); +CYG_HAL_TABLE_END (__LCD_cmds_TAB_END__, LCD_cmds); + +extern struct cmd __LCD_cmds_TAB__[], __LCD_cmds_TAB_END__; + +static cmd_fun do_lcd; +RedBoot_nested_cmd ("lcd", + "Manage LCD display", + "{cmds}", + do_lcd, __LCD_cmds_TAB__, &__LCD_cmds_TAB_END__); + +//-------------------------------------------------------------------------- +// lcd_usage -- +// +static void +lcd_usage (char *why) +{ + diag_printf ("*** invalid 'lcd' command: %s\n", why); + cmd_usage (__LCD_cmds_TAB__, &__LCD_cmds_TAB_END__, "lcd "); +} + +//-------------------------------------------------------------------------- +// do_lcd -- +// +static void +do_lcd (int argc, char *argv[]) +{ + struct cmd *cmd; + + if (argc < 2) { + lcd_usage ("too few arguments"); + return; + } + if ((cmd = cmd_search (__LCD_cmds_TAB__, &__LCD_cmds_TAB_END__, + argv[1])) != (struct cmd *) 0) { + (cmd->fun) (argc, argv); + return; + } + lcd_usage ("unrecognized command"); +} + +//-------------------------------------------------------------------------- +// lcd_echo -- +// +static void +lcd_echo (int argc, char *argv[]) +{ + bool newline; + int cur = + CYGACC_CALL_IF_SET_CONSOLE_COMM + (CYGNUM_CALL_IF_SET_COMM_ID_QUERY_CURRENT); + CYGACC_CALL_IF_SET_CONSOLE_COMM (2); + + newline = true; + if (argc > 2) { + int i = 2; + if (strncmp (&argv[i][0], "-n", 2) == 0) { + newline = false; + i++; + } + for (; i < argc; i++) { + diag_write_string (&argv[i][0]); + if ((argc - i) > 1) + diag_write_char (' '); + } + } + if (newline) + diag_write_char ('\n'); + + CYGACC_CALL_IF_SET_CONSOLE_COMM (cur); + return; +} + +//-------------------------------------------------------------------------- +// lcd_clear -- +// +static void +lcd_clear (int argc, char *argv[]) +{ + // It clears a LCD screen. It doesn't touch a LCD controller, just a + // scrolling. + redboot_exec ("lcd", "echo", 0); + redboot_exec ("lcd", "echo", 0); + redboot_exec ("lcd", "echo", 0); + return; +} + +//-------------------------------------------------------------------------- +// lcd_dark -- +// +static void +lcd_dark (int argc, char *argv[]) +{ + hal_diag_led (0); + return; +} + +//-------------------------------------------------------------------------- +// lcd_light -- +// +static void +lcd_light (int argc, char *argv[]) +{ + hal_diag_led (1); + return; +} + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF redboot_cmds.c --9amGYk9869ThD9tj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="olpch2294.patch" Content-length: 53889 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpch2294/current/cdl/flash_olpch2294.cdl devo/ecos/packages/devs/flash/arm/olpch2294/current/cdl/flash_olpch2294.cdl --- clean/ecos/packages/devs/flash/arm/olpch2294/current/cdl/flash_olpch2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpch2294/current/cdl/flash_olpch2294.cdl 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,63 @@ +# ==================================================================== +# +# flash_olpch2294.cdl +# +# FLASH memory - Hardware support on Olimex LPC-H2294 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_ARM_OLPCH2294 { + display "ARM OLPCH2294 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 + implements CYGHWR_IO_FLASH_DEVICE + + compile arm_olpch2294_flash.c + + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" + } + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_INTEL_28F320C3 +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpch2294/current/ChangeLog devo/ecos/packages/devs/flash/arm/olpch2294/current/ChangeLog --- clean/ecos/packages/devs/flash/arm/olpch2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpch2294/current/ChangeLog 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,5 @@ +2008-08-31 Sergei Gavrikov + + * Flash driver for LPC-L2294 header board + * cdl/flash_olpch2294.cdl + * src/arm_olpch2294_flash.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpch2294/current/src/arm_olpch2294_flash.c devo/ecos/packages/devs/flash/arm/olpch2294/current/src/arm_olpch2294_flash.c --- clean/ecos/packages/devs/flash/arm/olpch2294/current/src/arm_olpch2294_flash.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpch2294/current/src/arm_olpch2294_flash.c 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,65 @@ +//========================================================================== +// +// arm_olpch2294_flash.c +// +// Flash programming for Intel FlashFile devices on Olimex LPC-H2294 +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +// The Olimex LPC-H2294 header board has alone Intel 28F320C3 flash memory +// part. + +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x80000000u) + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +// ------------------------------------------------------------------------ +// EOF arm_olpch2294_flash.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/cdl/hal_arm_lpc2xxx_olpch2294.cdl devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/cdl/hal_arm_lpc2xxx_olpch2294.cdl --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/cdl/hal_arm_lpc2xxx_olpch2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/cdl/hal_arm_lpc2xxx_olpch2294.cdl 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,289 @@ +# ==================================================================== +# +# hal_arm_lpc2xxx_olpch2294.cdl +# +# ARM LPC2XXX OLPCH2294 header board package configuration data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 { + display "Olimex LPC-H2294 header board HAL" + parent CYGPKG_HAL_ARM_LPC2XXX + define_header hal_arm_lpc2xxx_olpch2294.h + include_dir cyg/hal + hardware + description " + The OLPCH2294 HAL package provides the support needed to run + eCos on Olimex LPC-H2294 header board." + + compile olpch2294_misc.c + + requires { CYGHWR_HAL_ARM_LPC2XXX == "LPC2294" } + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM7TDMI-S\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Olimex LPC-H2294 header board\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM" "ROMRAM"} + no_define + define -file system.h CYG_HAL_STARTUP + description "Choose RAM, ROM or ROMRAM startup type." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + There is one USB connector on the board." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + There is one USB connector on the board." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic + port." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB + connection." + } + + # Real-time clock/counter specifics + cdl_option CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ { + display "CPU xtal frequency" + flavor data + default_value {14745600} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL { + display "CPU PLL multiplier" + flavor data + default_value {4} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_CLOCK_SPEED { + display "CPU clock speed" + flavor data + calculated { CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL * CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over compiler flags, + linker flags and choice of toolchain." + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by default. Individual + packages may define options which override these global + flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static -g -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global + flags." + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" || CYG_HAL_STARTUP == "ROMRAM" } + description " + Enable this option if this program is to be used as a + ROM monitor, i.e. applications will be loaded into RAM on + the board, and this ROM monitor may process exceptions or + interrupts generated from the application. This enables + features such as utilizing a separate interrupt stack when + exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM + monitor. This support changes various eCos semantics such + as the encoding of diagnostic output, or the overriding of + hardware interrupt vectors. + Firstly there is \"Generic\" support which prevents the + HAL from overriding the hardware vectors that it does not + use, to instead allow an installed ROM monitor to handle + them. This is the most basic support which is likely to be + common to most implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included + in the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid + Redboot configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + requires { !CYGBLD_BUILD_REDBOOT_WITH_EXEC } + default_value 1 + no_define + description " + This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a redboot_cmds.c + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O ihex $< $(@:.bin=.hex) + $(OBJCOPY) -O binary $< $@ + } + + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { (CYG_HAL_STARTUP == "RAM") ? "arm_lpc2xxx_olpch2294_ram" : + "arm_lpc2xxx_olpch2294_rom" } + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + (CYG_HAL_STARTUP == "ROMRAM") ? "" : + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + (CYG_HAL_STARTUP == "ROMRAM") ? "" : + "" } + } + } +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/ChangeLog devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/ChangeLog --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/ChangeLog 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,15 @@ +2008-08-31 Sergei Gavrikov + + * LPC-H2294 header board package + * cdl/hal_arm_lpc2xxx_olpch2294.cdl + * include/hal_platform_setup.h + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.h + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.ldi + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.h + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.ldi + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.h + * include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.ldi + * include/plf_io.h + * misc/redboot_ROM.ecm + * src/olpch2294_misc.c + * src/redboot_cmds.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/hal_platform_setup.h devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/hal_platform_setup.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/hal_platform_setup.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/hal_platform_setup.h 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,236 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H + +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: LPC-H2294 platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include CYGHWR_MEMORY_LAYOUT_H +#include + + // There is one LED on the board. + // |P0.30 470 Om LED + // |------\/\/\/-----|<|-----> 3.3 V + // | + .macro _led_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0DIR] + orr r1,r1,#(1<<30) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0DIR] + + .endm // _led_init + + .macro _led x + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,=(1<<30) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0SET] + ldr r1,=((\x & 1)<<30) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO0CLR] + + .endm // _led + + .macro _pll_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + + mov r2,#0xAA + mov r3,#0x55 + + // enable PLL + mov r1,#1 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + + mov r1,#(0x20 | (CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL - 1)) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCFG] + + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + // wait for it to lock +1: + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLSTAT] + ands r1,r1,#(1<<10) + beq 1b + + // connect PLL + mov r1,#3 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + .endm // _pll_init + + .macro _mem_init + // copy first 64 bytes from ROM to on-chip RAM + mov r0,#0 + mov r1,#0x40000000 + mov r2,#0x40 +1: + ldr r3,[r0,#4]! + str r3,[r1,#4]! + cmps r0,r2 + bne 1b + + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + mov r1,#2 // interrupt vector table is mapped to RAM + str r1, [r0,#CYGARC_HAL_LPC2XXX_REG_MEMMAP] + + // flash timings + mov r1,#4 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMTIM] + mov r1,#2 // 2, full MAM + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMCR] + + // External memory interface depends on the bank width (32, 16 or 8 bit + // selected via MW bits in corresponding BCFG register). Furthermore, + // choice of the memory chip(s) will require an adequate setup of RBLE + // bit in BCFG register, too. RBLE = 0 in case of 8-bit based external + // memories, while memory chips capable of accepting 16 or 32 bit wide + // data will work with RBLE = 1. + // + // BANK0: 4M FLASH + // TE28F320C3BD70 (1024Kx32 x 1, 70nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG0 + ldr r1,= (0x3 << 0) /* IDCY=3, idle timing */\ + | (0x4 << 5) /* WST1=4, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x6 << 11) /* WST2=6, write timing */\ + | (0x1 << 28) /* MW=1, 16-bits */ + str r1,[r0] + + // BANK1: 1M RAM + // IDT71V416L (512Kx16 x 2, 12nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG1 + // Warning: changed these timings, you can fall dramatically the eCos + // kernel performance. Check it then using the eCos 'tm_basic' test. + ldr r1,= (0x0 << 0) /* IDCY=0, idle cycles */\ + | (0x0 << 5) /* WST1=0, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x0 << 11) /* WST2=0, write timing */\ + | (0x2 << 28) /* MW=2, 32-bits */ + str r1,[r0] + + .endm // _mem_init + + .macro _gpio_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_PIN_BASE + + // Configure P0.15:0 as PIO, but UART0 + ldr r1,= (0x1 << 0) /* P0.0 as TxD0 */\ + | (0x1 << 2) /* P0.1 as RxD0 */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL0] + + // Configure P0.30:16 as PIO + ldr r1,=0 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL1] + + // GPIO P1.25:16, P3.0, P3.25:24 are used as PIO + ldr r1,= (0x1 << 2) /* P1.36:26 Debug port */\ + | (0x2 << 4) /* D31:0,CS0,OE,BLS0-3 */\ + | (0x1 << 8) /* WE enabled */\ + | (0x1 << 11) /* CS1 enabled */\ + | (0x1 << 24) /* A1 enabled */\ + | (0x7 << 25) /* A23:2 enabled */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL2] + + .endm // _gpio_init + + .macro _relocate + // Relocate ROM/FLASH to RAM + ldr r0,= -8192 + and r0,r0,pc + ldr r1,=(CYGMEM_REGION_ram) + ldr r2,=(CYGMEM_REGION_ram+0x3E000) +10: ldr r3,[r0],#4 + str r3,[r1],#4 + cmp r1,r2 + bne 10b + ldr r0,=20f + mov pc,r0 +20: + .endm // relocate + +#define CYGHWR_LED_MACRO _led \x + +#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM) + + .macro _setup + + _pll_init + + _mem_init + + _gpio_init + +#if defined(CYG_HAL_STARTUP_ROMRAM) + _relocate +#endif + _led_init + + .endm + + +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +#else + + .macro _setup + + .endm + +#endif // CYG_HAL_STARTUP_ROM + +#define PLATFORM_SETUP1 _setup + +//----------------------------------------------------------------------------- +// end of hal_platform_setup.h +#endif // CYGONCE_HAL_PLATFORM_SETUP_H diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.h devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.h 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,22 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_sram (0x40000000) +#define CYGMEM_REGION_sram_SIZE (0x00004000) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_ram.ldi 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,25 @@ +#include + +MEMORY +{ + sram : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (sram, 0x40000020, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x81008000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.h devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.h 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,25 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_rom (0x00000000) +#define CYGMEM_REGION_rom_SIZE (0x00040000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_sram (0x40000000) +#define CYGMEM_REGION_sram_SIZE (0x00004000) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_rom.ldi 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,26 @@ +#include + +MEMORY +{ + sram : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 + rom : ORIGIN = 0x00000000, LENGTH = 0x40000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x00000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (sram, 0x40000020, LMA_EQ_VMA) + SECTION_data (ram, 0x81000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.h devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.h 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,25 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_rom (0x00000000) +#define CYGMEM_REGION_rom_SIZE (0x00040000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_sram (0x40000000) +#define CYGMEM_REGION_sram_SIZE (0x00004000) +#define CYGMEM_REGION_sram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpch2294_romram.ldi 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,25 @@ +#include + +MEMORY +{ + sram : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (sram, 0x40000020, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x81000000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/plf_io.h devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/plf_io.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/plf_io.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/include/plf_io.h 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,93 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H +//============================================================================= +// +// plf_io.h +// +// Olimex LPC-H2294 board specific registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: Olimex LPC-H2294 board specific registers +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +// On-chip device base addresses + +#ifndef __ASSEMBLER__ + +extern void hal_plf_hardware_init (void); +#define HAL_PLF_HARDWARE_INIT() \ + hal_plf_hardware_init() + +#define IO0PIN (*(volatile unsigned int *)0xE0028000) +#define IO0SET (*(volatile unsigned int *)0xE0028004) +#define IO0DIR (*(volatile unsigned int *)0xE0028008) +#define IO0CLR (*(volatile unsigned int *)0xE002800C) + +#define IO1PIN (*(volatile unsigned int *)0xE0028010) +#define IO1SET (*(volatile unsigned int *)0xE0028014) +#define IO1DIR (*(volatile unsigned int *)0xE0028018) +#define IO1CLR (*(volatile unsigned int *)0xE002801C) + +#define IO2PIN (*(volatile unsigned int *)0xE0028020) +#define IO2SET (*(volatile unsigned int *)0xE0028024) +#define IO2DIR (*(volatile unsigned int *)0xE0028028) +#define IO2CLR (*(volatile unsigned int *)0xE002802C) + +#define IO3PIN (*(volatile unsigned int *)0xE0028030) +#define IO3SET (*(volatile unsigned int *)0xE0028034) +#define IO3DIR (*(volatile unsigned int *)0xE0028038) +#define IO3CLR (*(volatile unsigned int *)0xE002803C) + +#define PINSEL0 (*(volatile unsigned int *)0xE002C00) +#define PINSEL1 (*(volatile unsigned int *)0xE002C04) + +#define _LED_ON() IO0CLR |= 1 << 30; +#define _LED_OFF() IO0SET |= 1 << 30; +#define _TOGGLE_LED() IO0PIN ^= 1 << 30; + +#endif // __ASSEMBLER__ + +#endif // CYGONCE_HAL_PLF_IO_H +//----------------------------------------------------------------------------- +// end of plf_io.h + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/misc/redboot_ROM.ecm devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/misc/redboot_ROM.ecm --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/misc/redboot_ROM.ecm 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/misc/redboot_ROM.ecm 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,120 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware olpch2294 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_OLPCH2294 current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_IO_SERIAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_CRC current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_COMPRESS_ZLIB current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGHWR_HAL_ARM_LPC2XXX { + inferred_value LPC2294 +}; + +cdl_component CYG_HAL_STARTUP { + inferred_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_GUNZIP { + user_value 1 +}; + +cdl_option CYGBLD_REDBOOT_LOAD_INTO_FLASH { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_CACHES { + user_value 0 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_EXEC { + inferred_value 0 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_IOMEM { + user_value 1 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F320C3 { + inferred_value 1 +}; + + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/olpch2294_misc.c devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/olpch2294_misc.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/olpch2294_misc.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/olpch2294_misc.c 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,112 @@ +//========================================================================== +// +// olpch2294_misc.c +// +// HAL misc board support code for Olimex LPC-H2294 header board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include // IO macros + +#include // base types +#include + +// Newlib provides support for building the run-time elements of C++ +// within the toolchain. Modern newlib stuff looks for a _impure_ptr +// entry. +void *_impure_ptr; + +extern void cyg_hal_plf_serial_init (void); + +// There is alone diagnostic LED on the board. +static __inline__ void +_led (bool state) +{ + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO0SET, (1 << 30)); + if (state) + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO0CLR, (1 << 30)); +} + +//-------------------------------------------------------------------------- +// hal_lpc2xxx_set_leds -- +// +void +hal_lpc2xxx_set_leds (int mask) +{ + _led (mask & 1); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_comms_init -- +// +void +cyg_hal_plf_comms_init (void) +{ + static int initialized = 0; + + if (initialized) + return; + initialized = 1; + + cyg_hal_plf_serial_init (); +} + +#ifdef HAL_PLF_HARDWARE_INIT +//-------------------------------------------------------------------------- +// hal_plf_hardware_init -- +// +void +hal_plf_hardware_init (void) +{ + // Currently, it does nothing +} +#endif // HAL_PLF_HARDWARE_INIT + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF olpch2294_misc.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/redboot_cmds.c devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/redboot_cmds.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/redboot_cmds.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpch2294/current/src/redboot_cmds.c 2008-11-07 19:23:19.000000000 +0200 @@ -0,0 +1,114 @@ +//========================================================================== +// +// redboot_cmds.c +// +// OLPCH2294 [platform] specific RedBoot commands +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +// CLI functions +static void do_echo (int argc, char *argv[]); +RedBoot_cmd ("echo", + "Outputs the args. If -n is specified, the trailing newline is suppressed.", + "-n [arg ...]", do_echo); + +static void do_led (int argc, char *argv[]); +RedBoot_cmd ("led", "Manage diagnostic led(s)", "[-m mask]", do_led); + +//-------------------------------------------------------------------------- +// do_echo -- +// +static void +do_echo (int argc, char *argv[]) +{ + bool newline = true; + if (argc > 1) { + int i = 1; + if (strncmp (&argv[i][0], "-n", 2) == 0) { + newline = false; + i++; + } + for (; i < argc; i++) { + diag_write_string (&argv[i][0]); + if ((argc - i) > 1) + diag_write_char (' '); + } + } + if (newline) + diag_write_char ('\n'); + return; +} + +//-------------------------------------------------------------------------- +// do_led -- +// +static void +do_led (int argc, char *argv[]) +{ + struct option_info opts[1]; + unsigned long mask; + bool mask_set; + + init_opts (&opts[0], 'm', true, OPTION_ARG_TYPE_NUM, + &mask, &mask_set, "mask"); + if (!scan_opts (argc, argv, 1, opts, 1, 0, 0, "")) { + return; + } + if (!mask_set) { + diag_printf ("led what ?\n"); + return; + } + hal_lpc2xxx_set_leds (mask); + return; +} + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF redboot_cmds.c --9amGYk9869ThD9tj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="olpcl2294.patch" Content-length: 65772 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpcl2294/current/cdl/olpcl2294_eth_drivers.cdl devo/ecos/packages/devs/eth/arm/olpcl2294/current/cdl/olpcl2294_eth_drivers.cdl --- clean/ecos/packages/devs/eth/arm/olpcl2294/current/cdl/olpcl2294_eth_drivers.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpcl2294/current/cdl/olpcl2294_eth_drivers.cdl 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,109 @@ +# ==================================================================== +# +# olpcl2294_eth_drivers.cdl +# +# Ethernet drivers - platform dependent support for OLPCL2294 +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_ETH_ARM_OLPCL2294 { + display "LAN ethernet driver for Olimex LPC-L2294-1MB" + + parent CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_IO_ETH_DRIVERS + active_if CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 + + include_dir cyg/io + + description " + Ethernet driver for Olimex LPC-L2294-1MB board." + + # FIXME: This really belongs in the CL CS8900A package + cdl_interface CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED { + display "Cirrus Logic CS8900A ethernet driver required" + } + + define_proc { + puts $::cdl_system_header "/***** ethernet driver proc output start *****/" + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_INL " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_CL_CS8900A_CFG " + puts $::cdl_system_header "/***** ethernet driver proc output end *****/" + } + + cdl_component CYGPKG_DEVS_ETH_ARM_OLPCL2294_ETH0 { + display "OLPCL2294 ethernet port driver" + flavor bool + default_value 1 + description " + This option includes the ethernet device driver for the + OLPCL2294 port." + + implements CYGHWR_NET_DRIVER_ETH0 + implements CYGINT_DEVS_ETH_CL_CS8900A_REQUIRED + + cdl_option CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_NAME { + display "Device name for the ETH0 ethernet driver" + flavor data + default_value {"\"eth0\""} + description " + This option sets the name of the ethernet device." + } + + cdl_component CYGSEM_DEVS_ETH_ARM_OLPCL2294_ETH0_SET_ESA { + display "Set the ethernet station address" + flavor bool + calculated 1 + description " + Enabling this option will allow the ethernet + station address to be forced to the value set by the + configuration. This may be required if the hardware + does not include a serial EEPROM for the ESA." + + cdl_option CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_ESA { + display "The ethernet station address" + flavor data + default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"} + description "The ethernet station address" + } + } + } +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpcl2294/current/ChangeLog devo/ecos/packages/devs/eth/arm/olpcl2294/current/ChangeLog --- clean/ecos/packages/devs/eth/arm/olpcl2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpcl2294/current/ChangeLog 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,6 @@ +2008-08-31 Sergei Gavrikov + + * Ethernet driver for LPC-L2294 development board + * cdl/olpcl2294_eth_drivers.cdl + * include/devs_eth_arm_olpcl2294.h + * include/devs_eth_arm_olpcl2294.inl diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.h devo/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.h --- clean/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.h 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,56 @@ +#ifndef _CYGONCE_DEVS_ETH_ARM_OLPCL2294_H +#define _CYGONCE_DEVS_ETH_ARM_OLPCL2294_H +//========================================================================== +// +// devs_eth_arm_olpcl2294.h +// +// OLPCL2294 ethernet configuration +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: OLPCL2294 ethernet configuration +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + + +#endif // _CYGONCE_DEVS_ETH_ARM_OLPCL2294_H +//-------------------------------------------------------------------------- +// EOF devs_eth_arm_olpcl2294.h diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.inl devo/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.inl --- clean/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.inl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/eth/arm/olpcl2294/current/include/devs_eth_arm_olpcl2294.inl 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,168 @@ +//========================================================================== +// +// devs_eth_arm_olpcl2294.inl +// +// OLPCL2294 ethernet I/O definitions +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: OLPCL2294 ethernet definitions +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +#ifdef CYGPKG_REDBOOT +# include +# ifdef CYGSEM_REDBOOT_FLASH_CONFIG +# include +# include +# endif +#endif + +#ifdef __WANT_CONFIG +//#define DEBUG 0x0f +#endif // __WANT_CONFIG + +#ifdef __WANT_DEVS + +#ifdef CYGPKG_DEVS_ETH_ARM_OLPCL2294_ETH0 + +#ifndef CYGSEM_DEVS_ETH_ARM_OLPCL2294_ETH0_SET_ESA +# if defined(CYGPKG_REDBOOT) && defined(CYGSEM_REDBOOT_FLASH_CONFIG) +RedBoot_config_option("Set " CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_NAME " network hardware address [MAC]", + eth0_esa, + ALWAYS_ENABLED, true, + CONFIG_BOOL, false + ); +RedBoot_config_option(CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_NAME " network hardware address [MAC]", + eth0_esa_data, + "eth0_esa", true, + CONFIG_ESA, 0 + ); +# endif // CYGPKG_REDBOOT && CYGSEM_REDBOOT_FLASH_CONFIG + +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +// Note that this section *is* active in an application, outside RedBoot, +// where the above section is not included. + +# include + +# ifndef CONFIG_ESA +# define CONFIG_ESA (6) +# endif +# ifndef CONFIG_BOOL +# define CONFIG_BOOL (1) +# endif + +cyg_bool +_olpcl2294_provide_eth0_esa(struct cs8900a_priv_data* cpd) +{ + cyg_bool set_esa; + int ok; + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa", &set_esa, CONFIG_BOOL); + if (ok && set_esa) { + ok = CYGACC_CALL_IF_FLASH_CFG_OP( CYGNUM_CALL_IF_FLASH_CFG_GET, + "eth0_esa_data", cpd->esa, CONFIG_ESA); + } + return ok && set_esa; +} + +# endif // CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT +#endif // ! CYGSEM_DEVS_ETH_ARM_OLPCL2294_ETH0_SET_ESA + +static __inline__ void +post_reset(cyg_addrword_t base) +{ + // Toggle A0 connected to the SBHE# line + HAL_WRITE_UINT8( 0x82000000, 1 ); + HAL_WRITE_UINT8( 0x82000001, 2 ); + HAL_WRITE_UINT8( 0x82000000, 3 ); + HAL_WRITE_UINT8( 0x82000001, 0 ); +} + +#undef CYGHWR_CL_CS8900A_PLF_POST_RESET +#define CYGHWR_CL_CS8900A_PLF_POST_RESET(base) post_reset(base) + +static cs8900a_priv_data_t cs8900a_eth0_priv_data = { + base : (cyg_addrword_t) 0x82000000, + interrupt : CYGNUM_HAL_INTERRUPT_EINT2, +#ifdef CYGSEM_DEVS_ETH_ARM_OLPCL2294_ETH0_SET_ESA + esa : CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_ESA, + hardwired_esa : true, +#else + hardwired_esa : false, +# ifdef CYGSEM_HAL_VIRTUAL_VECTOR_SUPPORT + provide_esa : &_olpcl2294_provide_eth0_esa, +# else + provide_esa : NULL, +# endif +#endif +}; + +ETH_DRV_SC(cs8900a_sc, + &cs8900a_eth0_priv_data, // Driver specific data + CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_NAME, + cs8900a_start, + cs8900a_stop, + cs8900a_control, + cs8900a_can_send, + cs8900a_send, + cs8900a_recv, + cs8900a_deliver, // "pseudoDSR" called from fast net thread + cs8900a_poll, // poll function, encapsulates ISR and DSR + cs8900a_int_vector); + +NETDEVTAB_ENTRY(cs8900a_netdev, + "cs8900a_" CYGDAT_DEVS_ETH_ARM_OLPCL2294_ETH0_NAME, + cs8900a_init, + &cs8900a_sc); + +#endif // CYGPKG_DEVS_ETH_ARM_OLPCL2294_ETH0 + +#endif // __WANT_DEVS + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF devs_eth_arm_olpcl2294.inl + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpcl2294/current/cdl/flash_olpcl2294.cdl devo/ecos/packages/devs/flash/arm/olpcl2294/current/cdl/flash_olpcl2294.cdl --- clean/ecos/packages/devs/flash/arm/olpcl2294/current/cdl/flash_olpcl2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpcl2294/current/cdl/flash_olpcl2294.cdl 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,63 @@ +# ==================================================================== +# +# flash_olpcl2294.cdl +# +# FLASH memory - Hardware support on Olimex LPC-L2294-1MB +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_DEVS_FLASH_ARM_OLPCL2294 { + display "ARM OLPCL2294 FLASH memory support" + + parent CYGPKG_IO_FLASH + active_if CYGPKG_IO_FLASH + requires CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 + implements CYGHWR_IO_FLASH_DEVICE + + compile arm_olpcl2294_flash.c + + cdl_interface CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED { + display "Generic Intel FlashFile driver required" + } + implements CYGINT_DEVS_FLASH_INTEL_28FXXX_REQUIRED + requires CYGHWR_DEVS_FLASH_INTEL_28F160C3B +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpcl2294/current/ChangeLog devo/ecos/packages/devs/flash/arm/olpcl2294/current/ChangeLog --- clean/ecos/packages/devs/flash/arm/olpcl2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpcl2294/current/ChangeLog 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,5 @@ +2008-08-31 Sergei Gavrikov + + * Flash driver for LPC-L2294 development board + * cdl/flash_olpcl2294.cdl + * src/arm_olpcl2294_flash.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/flash/arm/olpcl2294/current/src/arm_olpcl2294_flash.c devo/ecos/packages/devs/flash/arm/olpcl2294/current/src/arm_olpcl2294_flash.c --- clean/ecos/packages/devs/flash/arm/olpcl2294/current/src/arm_olpcl2294_flash.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/devs/flash/arm/olpcl2294/current/src/arm_olpcl2294_flash.c 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,66 @@ +//========================================================================== +// +// arm_olpcl2294_flash.c +// +// Flash programming for Intel FlashFile devices on Olimex +// LPC-L2294-1MB board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +// The Olimex LPC-L2294-1MB development board has alone Intel 28F160C3 flash +// memory part. + +#define CYGNUM_FLASH_INTERLEAVE (1) +#define CYGNUM_FLASH_SERIES (1) +#define CYGNUM_FLASH_WIDTH (16) +#define CYGNUM_FLASH_BASE (0x80000000u) + +//-------------------------------------------------------------------------- +// Now include the driver code. +#include "cyg/io/flash_28fxxx.inl" + +// ------------------------------------------------------------------------ +// EOF arm_olpcl2294_flash.c + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/cdl/hal_arm_lpc2xxx_olpcl2294.cdl devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/cdl/hal_arm_lpc2xxx_olpcl2294.cdl --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/cdl/hal_arm_lpc2xxx_olpcl2294.cdl 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/cdl/hal_arm_lpc2xxx_olpcl2294.cdl 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,290 @@ +# ==================================================================== +# +# hal_arm_lpc2xxx_olpcl2294.cdl +# +# ARM LPC2XXX OLPCL2294 development board package configuration +# data +# +# ==================================================================== +#####ECOSGPLCOPYRIGHTBEGIN#### +## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +## Copyright (C) 2008 eCosCentric Limited +## +## eCos is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free +## Software Foundation; either version 2 or (at your option) any later version. +## +## eCos is distributed in the hope that it will be useful, but WITHOUT ANY +## WARRANTY; without even the implied warranty of MERCHANTABILITY or +## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +## for more details. +## +## You should have received a copy of the GNU General Public License along +## with eCos; if not, write to the Free Software Foundation, Inc., +## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +## +## As a special exception, if other files instantiate templates or use macros +## or inline functions from this file, or you compile this file and link it +## with other works to produce a work based on this file, this file does not +## by itself cause the resulting work to be covered by the GNU General Public +## License. However the source code for this file must still be made available +## in accordance with section (3) of the GNU General Public License. +## +## This exception does not invalidate any other reasons why a work based on +## this file might be covered by the GNU General Public License. +## ------------------------------------------- +#####ECOSGPLCOPYRIGHTEND#### +# ==================================================================== +######DESCRIPTIONBEGIN#### +# +# Author(s): Sergei Gavrikov +# Contributors: Sergei Gavrikov +# Date: 2008-08-31 +# +#####DESCRIPTIONEND#### +# +# ==================================================================== + +cdl_package CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 { + display "Olimex LPC-L2294-1MB development board HAL" + parent CYGPKG_HAL_ARM_LPC2XXX + define_header hal_arm_lpc2xxx_olpcl2294.h + include_dir cyg/hal + hardware + description " + The OLPCL2294 HAL package provides the support needed to run + eCos on Olimex LPC-L2294-1MB development board." + + compile olpcl2294_misc.c + + requires { CYGHWR_HAL_ARM_LPC2XXX == "LPC2294" } + + define_proc { + puts $::cdl_system_header "#define CYGBLD_HAL_TARGET_H " + puts $::cdl_system_header "#define CYGBLD_HAL_VARIANT_H " + puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H " + puts $::cdl_header "#define HAL_PLATFORM_CPU \"ARM7TDMI-S\"" + puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Olimex LPC-L2294 development board\"" + puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\"" + } + + cdl_component CYG_HAL_STARTUP { + display "Startup type" + flavor data + default_value {"RAM"} + legal_values {"RAM" "ROM"} + no_define + define -file system.h CYG_HAL_STARTUP + description "Choose RAM or ROM startup type." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT { + display "Default console channel." + flavor data + calculated 0 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS { + display "Number of communication channels on the board" + flavor data + calculated 1 + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL { + display "Debug serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value 0 + description " + There is one serial connector on the board." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL { + display "Diagnostic serial port" + active_if CYGPRI_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_CONFIGURABLE + flavor data + legal_values 0 to CYGNUM_HAL_VIRTUAL_VECTOR_COMM_CHANNELS-1 + default_value CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_DEFAULT + description " + There is one serial connector on the board." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_CONSOLE_CHANNEL_BAUD { + display "Diagnostic serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option selects the baud rate used for the diagnostic + port." + } + + cdl_option CYGNUM_HAL_VIRTUAL_VECTOR_DEBUG_CHANNEL_BAUD { + display "GDB serial port baud rate" + flavor data + legal_values 9600 19200 38400 57600 115200 + default_value 38400 + description " + This option controls the baud rate used for the GDB + connection." + } + + # Real-time clock/counter specifics + cdl_option CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ { + display "CPU xtal frequency" + flavor data + default_value {14745600} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL { + display "CPU PLL multiplier" + flavor data + default_value {4} + } + + cdl_option CYGNUM_HAL_ARM_LPC2XXX_CLOCK_SPEED { + display "CPU clock speed" + flavor data + calculated { CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL * CYGNUM_HAL_ARM_LPC2XXX_XTAL_FREQ } + } + + cdl_component CYGBLD_GLOBAL_OPTIONS { + display "Global build options" + flavor none + parent CYGPKG_NONE + description " + Global build options including control over compiler flags, + linker flags and choice of toolchain." + + cdl_option CYGBLD_GLOBAL_COMMAND_PREFIX { + display "Global command prefix" + flavor data + no_define + default_value { "arm-elf" } + description " + This option specifies the command prefix used when + invoking the build tools." + } + + cdl_option CYGBLD_GLOBAL_CFLAGS { + display "Global compiler flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority" } + description " + This option controls the global compiler flags which + are used to compile all packages by default. Individual + packages may define options which override these global + flags." + } + + cdl_option CYGBLD_GLOBAL_LDFLAGS { + display "Global linker flags" + flavor data + no_define + default_value { (CYGHWR_THUMB ? "-mthumb " : "") . (CYGBLD_ARM_ENABLE_THUMB_INTERWORK ? "-mthumb-interwork " : "") . "-mcpu=arm7tdmi -Wl,--gc-sections -Wl,-static -g -nostdlib" } + description " + This option controls the global linker flags. Individual + packages may define options which override these global + flags." + } + } + + cdl_option CYGSEM_HAL_ROM_MONITOR { + display "Behave as a ROM monitor" + flavor bool + default_value 0 + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "ROM" } + description " + Enable this option if this program is to be used as a + ROM monitor, i.e. applications will be loaded into RAM on + the board, and this ROM monitor may process exceptions or + interrupts generated from the application. This enables + features such as utilizing a separate interrupt stack when + exceptions are generated." + } + + cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + display "Work with a ROM monitor" + flavor booldata + legal_values { "Generic" "GDB_stubs" } + default_value { CYG_HAL_STARTUP == "RAM" ? "GDB_stubs" : 0 } + parent CYGPKG_HAL_ROM_MONITOR + requires { CYG_HAL_STARTUP == "RAM" } + description " + Support can be enabled for different varieties of ROM + monitor. This support changes various eCos semantics such + as the encoding of diagnostic output, or the overriding of + hardware interrupt vectors. + Firstly there is \"Generic\" support which prevents the + HAL from overriding the hardware vectors that it does not + use, to instead allow an installed ROM monitor to handle + them. This is the most basic support which is likely to be + common to most implementations of ROM monitor. + \"GDB_stubs\" provides support when GDB stubs are included + in the ROM monitor or boot ROM." + } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid + Redboot configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + requires { !CYGBLD_BUILD_REDBOOT_WITH_EXEC } + default_value 1 + no_define + description " + This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a redboot_cmds.c + + compile -library=libextras.a redboot_cmds.c + + make -priority 325 { + /bin/redboot.bin : /bin/redboot.elf + $(OBJCOPY) --strip-debug $< $(@:.bin=.img) + $(OBJCOPY) -O srec $< $(@:.bin=.srec) + $(OBJCOPY) -O ihex $< $(@:.bin=.hex) + $(OBJCOPY) -O binary $< $@ + } + + } + } + + cdl_component CYGHWR_MEMORY_LAYOUT { + display "Memory layout" + flavor data + no_define + calculated { (CYG_HAL_STARTUP == "RAM") ? "arm_lpc2xxx_olpcl2294_ram" : + "arm_lpc2xxx_olpcl2294_rom" } + cdl_option CYGHWR_MEMORY_LAYOUT_LDI { + display "Memory layout linker script fragment" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_LDI + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + "" } + } + + cdl_option CYGHWR_MEMORY_LAYOUT_H { + display "Memory layout header file" + flavor data + no_define + define -file system.h CYGHWR_MEMORY_LAYOUT_H + calculated { (CYG_HAL_STARTUP == "RAM") ? "" : + "" } + } + } +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/ChangeLog devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/ChangeLog --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/ChangeLog 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/ChangeLog 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,13 @@ +2008-08-31 Sergei Gavrikov + + * LPC-L2294 development board package + * cdl/hal_arm_lpc2xxx_olpcl2294.cdl + * include/hal_platform_setup.h + * include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.h + * include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.ldi + * include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.h + * include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.ldi + * include/plf_io.h + * misc/redboot_ROM.ecm + * src/olpcl2294_misc.c + * src/redboot_cmds.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/hal_platform_setup.h devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/hal_platform_setup.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/hal_platform_setup.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/hal_platform_setup.h 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,229 @@ +#ifndef CYGONCE_HAL_PLATFORM_SETUP_H +#define CYGONCE_HAL_PLATFORM_SETUP_H +/*============================================================================= +// +// hal_platform_setup.h +// +// Platform specific support for HAL (assembly code) +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: Olimex LPC-L2294-1MB platform specific support routines +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//===========================================================================*/ + +#include +#include +#include + + // There is one only diagnostic led marked STAT on the board + // |P1.23 330 Om LED + // |------\/\/\/-----|<|-----> 3.3 V + // | + + .macro _led_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO1DIR] + orr r1,r1,#(1<<23) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO1DIR] + + .endm // _led_init + + .macro _led x + ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE + ldr r1,=(1<<23) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO1SET] + ldr r1,=((\x & 1)<<23) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IO1CLR] + + .endm // _led + + .macro _pll_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + + mov r2,#0xAA + mov r3,#0x55 + + // enable PLL + mov r1,#1 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + + mov r1,#(0x20 | (CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL - 1)) + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCFG] + + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + // wait for it to lock +1: + ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLSTAT] + ands r1,r1,#(1<<10) + beq 1b + + // connect PLL + mov r1,#3 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON] + + // update PLL registers + str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] + + .endm // _pll_init + + .macro _mem_init + // copy first 64 bytes from ROM to on-chip RAM + mov r0,#0 + mov r1,#0x40000000 + mov r2,#0x40 +1: + ldr r3,[r0,#4]! + str r3,[r1,#4]! + cmps r0,r2 + bne 1b + + ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE + mov r1,#2 // interrupt vector table is mapped to RAM + str r1, [r0,#CYGARC_HAL_LPC2XXX_REG_MEMMAP] + // flash timings + mov r1,#4 + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMTIM] + mov r1,#2 // 2, full MAM + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMCR] + + // External memory interface depends on the bank width (32, 16 or 8 bit + // selected via MW bits in corresponding BCFG register). Furthermore, + // choice of the memory chip(s) will require an adequate setup of RBLE + // bit in BCFG register, too. RBLE = 0 in case of 8-bit based external + // memories, while memory chips capable of accepting 16 or 32 bit wide + // data will work with RBLE = 1. + // + // BANK0: 2M FLASH + // TE28F160C3BD70 (1024Kx16 x 1, 70nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG0 + ldr r1,= (0x3 << 0) /* IDCY=3, idle timing */\ + | (0x4 << 5) /* WST1=4, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x6 << 11) /* WST2=6, write timing */\ + | (0x1 << 28) /* MW=1, 16-bits */ + str r1,[r0] + + // BANK1: 1M RAM + // K6R4016V1D (512Kx16 x 2, 10nS) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG1 + // Warning: changed these timings, you can fall dramatically the eCos + // kernel performance. Check it then using the eCos 'tm_basic' test. + ldr r1,= (0x0 << 0) /* IDCY=0, idle cycles */\ + | (0x0 << 5) /* WST1=0, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x0 << 11) /* WST2=0, write timing */\ + | (0x2 << 28) /* MW=2, 32-bits */ + str r1,[r0] + + // BANK2: Ethernet + // CS8900A (16-bit, an interrupt driven mode) + ldr r0,=CYGARC_HAL_LPC2XXX_REG_BCFG2 + ldr r1,= (0x1 << 0) /* IDCY=1, idle cycles */\ + | (0x8 << 5) /* WST1=8, read timing */\ + | (0x1 << 10) /* RBLE=1 */\ + | (0x6 << 11) /* WST2=6, write timing */\ + | (0x1 << 28) /* MW=1, 16-bits */ + str r1,[r0] + + .endm // _mem_init + + .macro _gpio_init + ldr r0,=CYGARC_HAL_LPC2XXX_REG_PIN_BASE + + // Configure P0.15:0 as PIO, but UART0, EINT2 + ldr r1,= (0x1 << 0) /* P0.0 as TxD0 */\ + | (0x1 << 2) /* P0.1 as RxD0 */\ + | (0x2 << 30) /* P0.1 as EINT2(CL/IRQ)*/ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL0] + + // Configure P0.30:16 as PIO, but EINT0 ('BUT' button) + ldr r1,= (0x1 << 0) /* P0.16 as EINT0 */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL1] + + // GPIO P1.25:16, P3.24 are used as PIO + ldr r1,= (0x1 << 2) /* P1.36:26 Debug port */\ + | (0x2 << 4) /* D31:0,CS0,OE,BLS0-3 */\ + | (0x1 << 8) /* WE enabled */\ + | (0x1 << 11) /* CS1 enabled */\ + | (0x1 << 14) /* CS2 enabled */\ + | (0x1 << 23) /* A0 enabled */\ + | (0x1 << 24) /* A1 enabled */\ + | (0x7 << 25) /* A23:2 enabled */ + str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL2] + + .endm // _gpio_init + +#define CYGHWR_LED_MACRO _led \x + +#if defined(CYG_HAL_STARTUP_ROM) + + .macro _setup + + _pll_init + + _mem_init + + _gpio_init + + _led_init + + .endm + +#define CYGSEM_HAL_ROM_RESET_USES_JUMP + +#else + + .macro _setup + + .endm + +#endif // CYG_HAL_STARTUP_ROM + +#define PLATFORM_SETUP1 _setup + +#endif // CYGONCE_HAL_PLATFORM_SETUP_H + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.h devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.h 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,19 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_ram.ldi 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,25 @@ +#include + +MEMORY +{ + ram0 : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_fixed_vectors (ram0, 0x40000020, LMA_EQ_VMA) + SECTION_rom_vectors (ram, 0x81010000, LMA_EQ_VMA) + SECTION_text (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_data (ram, ALIGN (0x4), LMA_EQ_VMA) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.h devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.h 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,22 @@ +#ifndef __ASSEMBLER__ +#include +#include + +#endif + +#define CYGMEM_REGION_rom (0x00000000) +#define CYGMEM_REGION_rom_SIZE (0x00040000) +#define CYGMEM_REGION_rom_ATTR (CYGMEM_REGION_ATTR_R) +#define CYGMEM_REGION_ram (0x81000000) +#define CYGMEM_REGION_ram_SIZE (0x00100000) +#define CYGMEM_REGION_ram_ATTR (CYGMEM_REGION_ATTR_R | CYGMEM_REGION_ATTR_W) + +#ifndef __ASSEMBLER__ +extern char CYG_LABEL_NAME (__heap1) []; + +#endif + +#define CYGMEM_SECTION_heap1 (CYG_LABEL_NAME (__heap1)) + +#define CYGMEM_SECTION_heap1_SIZE (0x81100000 - (size_t) CYG_LABEL_NAME (__heap1)) + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.ldi devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.ldi --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.ldi 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/pkgconf/mlt_arm_lpc2xxx_olpcl2294_rom.ldi 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,26 @@ +#include + +MEMORY +{ + ram0 : ORIGIN = 0x40000000, LENGTH = 0x4000 + ram : ORIGIN = 0x81000000, LENGTH = 0x100000 + rom : ORIGIN = 0x00000000, LENGTH = 0x40000 +} + +SECTIONS +{ + SECTIONS_BEGIN + SECTION_rom_vectors (rom, 0x00000000, LMA_EQ_VMA) + SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA) + SECTION_fixed_vectors (ram0, 0x40000020, LMA_EQ_VMA) + SECTION_data (ram, 0x81000000, FOLLOWING (.gcc_except_table)) + SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA) + CYG_LABEL_DEFN(__heap1) = ALIGN (0x8); + SECTIONS_END +} + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/plf_io.h devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/plf_io.h --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/plf_io.h 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/include/plf_io.h 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,88 @@ +#ifndef CYGONCE_HAL_PLF_IO_H +#define CYGONCE_HAL_PLF_IO_H +//============================================================================= +// +// plf_io.h +// +// Olimex LPC-L2294-1MB board specific registers +// +//============================================================================= +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//============================================================================= +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: Olimex LPC-L2294-1MB board specific registers +// Description: +// Usage: #include +// +//####DESCRIPTIONEND#### +// +//============================================================================= +// On-chip device base addresses + +#ifndef __ASSEMBLER__ +extern void hal_plf_hardware_init(void); +#define HAL_PLF_HARDWARE_INIT() \ + hal_plf_hardware_init() + +#define IO0PIN (*(volatile unsigned int *)0xE0028000) +#define IO0SET (*(volatile unsigned int *)0xE0028004) +#define IO0DIR (*(volatile unsigned int *)0xE0028008) +#define IO0CLR (*(volatile unsigned int *)0xE002800C) + +#define IO1PIN (*(volatile unsigned int *)0xE0028010) +#define IO1SET (*(volatile unsigned int *)0xE0028014) +#define IO1DIR (*(volatile unsigned int *)0xE0028018) +#define IO1CLR (*(volatile unsigned int *)0xE002801C) + +#define IO2PIN (*(volatile unsigned int *)0xE0028020) +#define IO2SET (*(volatile unsigned int *)0xE0028024) +#define IO2DIR (*(volatile unsigned int *)0xE0028028) +#define IO2CLR (*(volatile unsigned int *)0xE002802C) + +#define IO3PIN (*(volatile unsigned int *)0xE0028030) +#define IO3SET (*(volatile unsigned int *)0xE0028034) +#define IO3DIR (*(volatile unsigned int *)0xE0028038) +#define IO3CLR (*(volatile unsigned int *)0xE002803C) + +#define PINSEL0 (*(volatile unsigned int *)0xE002C00) +#define PINSEL1 (*(volatile unsigned int *)0xE002C04) + +#endif // __ASSEMBLER__ + +//----------------------------------------------------------------------------- +// end of plf_io.h +#endif // CYGONCE_HAL_PLF_IO_H + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/misc/redboot_ROM.ecm devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/misc/redboot_ROM.ecm --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/misc/redboot_ROM.ecm 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/misc/redboot_ROM.ecm 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,115 @@ +cdl_savefile_version 1; +cdl_savefile_command cdl_savefile_version {}; +cdl_savefile_command cdl_savefile_command {}; +cdl_savefile_command cdl_configuration { description hardware template package }; +cdl_savefile_command cdl_package { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_component { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_option { value_source user_value wizard_value inferred_value }; +cdl_savefile_command cdl_interface { value_source user_value wizard_value inferred_value }; + +cdl_configuration eCos { + description "" ; + hardware olpcl2294 ; + template redboot ; + package -hardware CYGPKG_HAL_ARM current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 current ; + package -hardware CYGPKG_DEVS_FLASH_INTEL_28FXXX current ; + package -hardware CYGPKG_DEVS_FLASH_ARM_OLPCL2294 current ; + package -hardware CYGPKG_DEVS_ETH_CL_CS8900A current ; + package -hardware CYGPKG_DEVS_ETH_ARM_OLPCL2294 current ; + package -hardware CYGPKG_IO_SERIAL_GENERIC_16X5X current ; + package -hardware CYGPKG_IO_SERIAL_ARM_LPC2XXX current ; + package -hardware CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX current ; + package -template CYGPKG_HAL current ; + package -template CYGPKG_INFRA current ; + package -template CYGPKG_REDBOOT current ; + package -template CYGPKG_ISOINFRA current ; + package -template CYGPKG_LIBC_STRING current ; + package -template CYGPKG_CRC current ; + package CYGPKG_IO_FLASH current ; + package CYGPKG_IO_ETH_DRIVERS current ; + package CYGPKG_NS_DNS current ; +}; + +cdl_option CYGFUN_LIBC_STRING_BSD_FUNCS { + inferred_value 0 +}; + +cdl_option CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK { + inferred_value 0 +}; + +cdl_option CYGNUM_HAL_COMMON_INTERRUPTS_STACK_SIZE { + user_value 6144 +}; + +cdl_option CYGDBG_HAL_COMMON_INTERRUPTS_SAVE_MINIMUM_CONTEXT { + user_value 0 +}; + +cdl_option CYGDBG_HAL_COMMON_CONTEXT_SAVE_MINIMUM { + inferred_value 0 +}; + +cdl_option CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_ROM_MONITOR { + inferred_value 1 +}; + +cdl_option CYGSEM_HAL_USE_ROM_MONITOR { + inferred_value 0 0 +}; + +cdl_component CYGHWR_HAL_ARM_LPC2XXX { + inferred_value LPC2294 +}; + +cdl_component CYG_HAL_STARTUP { + user_value ROM +}; + +cdl_component CYGBLD_BUILD_REDBOOT { + user_value 1 +}; + +cdl_option CYGBLD_BUILD_REDBOOT_WITH_EXEC { + inferred_value 0 +}; + +cdl_option CYGBLD_ISO_STRTOK_R_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER { + inferred_value 1 +}; + +cdl_option CYGBLD_ISO_DNS_HEADER { + inferred_value 1 +}; + +cdl_option CYGHWR_DEVS_FLASH_INTEL_28F160C3B { + inferred_value 1 +}; + +cdl_option CYGPKG_NS_DNS_BUILD { + inferred_value 0 +}; + + diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/olpcl2294_misc.c devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/olpcl2294_misc.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/olpcl2294_misc.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/olpcl2294_misc.c 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,113 @@ +//========================================================================== +// +// olpcl2294_misc.c +// +// HAL misc board support code for Olimex LPC-L2294-1MB development +// board +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: HAL board support +// Description: Implementations of HAL board interfaces +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include // IO macros +#include // Register state info + +#include // base types +#include + +#include +#include + +// Newlib provides support for building the run-time elements of C++ +// within the toolchain. Modern newlib stuff looks for a _impure_ptr +// entry. +void *_impure_ptr; + +extern void cyg_hal_plf_serial_init (void); + +//-------------------------------------------------------------------------- +// hal_lpc2xxx_set_leds -- +// +// There is one diagnostic LED marked 'STAT' on the board +// +void +hal_lpc2xxx_set_leds (int mask) +{ + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO1SET, (1 << 23)); + if (mask & 1) + HAL_WRITE_UINT32 (CYGARC_HAL_LPC2XXX_REG_IO_BASE + + CYGARC_HAL_LPC2XXX_REG_IO1CLR, (1 << 23)); +} + +//-------------------------------------------------------------------------- +// cyg_hal_plf_comms_init -- +// +void +cyg_hal_plf_comms_init (void) +{ + static int initialized = 0; + + if (initialized) + return; + initialized = 1; + + cyg_hal_plf_serial_init (); +} + +#ifdef HAL_PLF_HARDWARE_INIT +//-------------------------------------------------------------------------- +// hal_plf_hardware_init -- +// +void +hal_plf_hardware_init (void) +{ + // configure IRQ level from CL CS8900A + cyg_drv_interrupt_configure (CYGNUM_HAL_INTERRUPT_EINT2, 0, 1); +} +#endif // HAL_PLF_HARDWARE_INIT + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF olpcl2294_misc.c diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/redboot_cmds.c devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/redboot_cmds.c --- clean/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/redboot_cmds.c 1970-01-01 03:00:00.000000000 +0300 +++ devo/ecos/packages/hal/arm/lpc2xxx/olpcl2294/current/src/redboot_cmds.c 2008-11-07 19:28:01.000000000 +0200 @@ -0,0 +1,114 @@ +//========================================================================== +// +// redboot_cmds.c +// +// OLPCL2294 [platform] specific RedBoot commands +// +//========================================================================== +//####ECOSGPLCOPYRIGHTBEGIN#### +// ------------------------------------------- +// This file is part of eCos, the Embedded Configurable Operating System. +// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. +// Copyright (C) 2008 eCosCentric Limited +// +// eCos is free software; you can redistribute it and/or modify it under +// the terms of the GNU General Public License as published by the Free +// Software Foundation; either version 2 or (at your option) any later version. +// +// eCos is distributed in the hope that it will be useful, but WITHOUT ANY +// WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +// for more details. +// +// You should have received a copy of the GNU General Public License along +// with eCos; if not, write to the Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +// +// As a special exception, if other files instantiate templates or use macros +// or inline functions from this file, or you compile this file and link it +// with other works to produce a work based on this file, this file does not +// by itself cause the resulting work to be covered by the GNU General Public +// License. However the source code for this file must still be made available +// in accordance with section (3) of the GNU General Public License. +// +// This exception does not invalidate any other reasons why a work based on +// this file might be covered by the GNU General Public License. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Sergei Gavrikov +// Contributors: Sergei Gavrikov +// Date: 2008-08-31 +// Purpose: +// Description: +// +// This code is part of RedBoot (tm). +// +//####DESCRIPTIONEND#### +// +//========================================================================*/ + +#include +#include + +// CLI functions +static void do_echo (int argc, char *argv[]); +RedBoot_cmd ("echo", + "Outputs the args. If -n is specified, the trailing newline is suppressed.", + "-n [arg ...]", do_echo); + +static void do_led (int argc, char *argv[]); +RedBoot_cmd ("led", "Manage diagnostic led(s)", "[-m mask]", do_led); + +//-------------------------------------------------------------------------- +// do_echo -- +// +static void +do_echo (int argc, char *argv[]) +{ + bool newline = true; + if (argc > 1) { + int i = 1; + if (strncmp (&argv[i][0], "-n", 2) == 0) { + newline = false; + i++; + } + for (; i < argc; i++) { + diag_write_string (&argv[i][0]); + if ((argc - i) > 1) + diag_write_char (' '); + } + } + if (newline) + diag_write_char ('\n'); + return; +} + +//-------------------------------------------------------------------------- +// do_led -- +// +static void +do_led (int argc, char *argv[]) +{ + struct option_info opts[1]; + unsigned long mask; + bool mask_set; + + init_opts (&opts[0], 'm', true, OPTION_ARG_TYPE_NUM, + &mask, &mask_set, "mask"); + if (!scan_opts (argc, argv, 1, opts, 1, 0, 0, "")) { + return; + } + if (!mask_set) { + diag_printf ("led what ?\n"); + return; + } + hal_lpc2xxx_set_leds (mask); + return; +} + +// indent: --indent-level4 -br -nut; vim: expandtab tabstop=4 shiftwidth=4 +//-------------------------------------------------------------------------- +// EOF redboot_cmds.c --9amGYk9869ThD9tj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ecos.db.patch" Content-length: 5793 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/ecos.db devo/ecos/packages/ecos.db --- clean/ecos/packages/ecos.db 2008-11-04 20:54:59.000000000 +0200 +++ devo/ecos/packages/ecos.db 2008-11-07 20:13:55.000000000 +0200 @@ -6774,7 +6774,137 @@ } description "The stm3210e_eval target provides the packages needed to run eCos on the STM3210E EVAL board." } +package CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 { + alias { "Olimex LPC-E2294 development board" hal_olpce2294_arm } + directory hal/arm/lpc2xxx/olpce2294 + script hal_arm_lpc2xxx_olpce2294.cdl + hardware + description " + The olpce2294 HAL package provides the support needed to + run eCos on Olimex LPC-E2294 development board." +} + +package CYGPKG_DEVS_FLASH_ARM_OLPCE2294 { + alias { "Support for Flash memory on Olimex LPC-E2294 board" flash_olpce2294 } + directory devs/flash/arm/olpce2294 + script flash_olpce2294.cdl + hardware + description " + This package provides a hardware support for flash memory + on the Olimex LPC-E2294 development board." +} + +package CYGPKG_DEVS_ETH_ARM_OLPCE2294 { + alias { "Ethernet driver for Olimex LPC-E2294 board" olpce2294_eth_driver } + hardware + directory devs/eth/arm/olpce2294 + script olpce2294_eth_drivers.cdl + description " + Ethernet device driver for Olimex LPC-E2294 board." +} + +target olpce2294 { + alias { "Olimex LPC-E2294 development board" olpce2294 } + packages { CYGPKG_HAL_ARM + CYGPKG_HAL_ARM_LPC2XXX + CYGPKG_HAL_ARM_LPC2XXX_OLPCE2294 + CYGPKG_DEVS_FLASH_INTEL_28FXXX + CYGPKG_DEVS_FLASH_ARM_OLPCE2294 + CYGPKG_DEVS_ETH_CL_CS8900A + CYGPKG_DEVS_ETH_ARM_OLPCE2294 + CYGPKG_IO_SERIAL_GENERIC_16X5X + CYGPKG_IO_SERIAL_ARM_LPC2XXX + CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX + } + description " + The olpce2294 target provides the packages needed to run + eCos on Olimex LPC-E2294 development board." +} + +package CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 { + alias { "Olimex LPC-H2294 header board" hal_olpch2294_arm } + directory hal/arm/lpc2xxx/olpch2294 + script hal_arm_lpc2xxx_olpch2294.cdl + hardware + description " + The olpch2294 HAL package provides the support needed to + run eCos on the Olimex LPC-H2294 header board." +} + +package CYGPKG_DEVS_FLASH_ARM_OLPCH2294 { + alias { "Support for Flash memory on Olimex LPC-H2294 board" flash_olpch2294 } + directory devs/flash/arm/olpch2294 + script flash_olpch2294.cdl + hardware + description " + This package contains hardware support for flash memory parts + on the Olimex LPC-H2294 platform." +} + +target olpch2294 { + alias { "Olimex LPC-H2294 header board" olpch2294 } + packages { CYGPKG_HAL_ARM + CYGPKG_HAL_ARM_LPC2XXX + CYGPKG_HAL_ARM_LPC2XXX_OLPCH2294 + CYGPKG_DEVS_FLASH_INTEL_28FXXX + CYGPKG_DEVS_FLASH_ARM_OLPCH2294 + CYGPKG_IO_SERIAL_GENERIC_16X5X + CYGPKG_IO_SERIAL_ARM_LPC2XXX + CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX + } + description " + The olpch2294 target provides the packages needed to run + eCos on Olimex LPC-H2294 header board." +} + +package CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 { + alias { "Olimex LPC-L2294-1MB development board" hal_olpcl2294_arm } + directory hal/arm/lpc2xxx/olpcl2294 + script hal_arm_lpc2xxx_olpcl2294.cdl + hardware + description " + The olpcl2294 HAL package provides the support needed to run + eCos on Olimex LPC-L2294-1MB development board." +} + +package CYGPKG_DEVS_FLASH_ARM_OLPCL2294 { + alias { "Support for Flash memory on Olimex LPC-L2294-1MB board" flash_olpcl2294 } + directory devs/flash/arm/olpcl2294 + script flash_olpcl2294.cdl + hardware + description " + This package provides a hardware support for flash memory + on the Olimex LPC-L2294-1MB development board." +} + +package CYGPKG_DEVS_ETH_ARM_OLPCL2294 { + alias { "Ethernet driver for Olimex LPC-L2294-1MB board" olpcl2294_eth_driver } + hardware + directory devs/eth/arm/olpcl2294 + script olpcl2294_eth_drivers.cdl + description " + Ethernet device driver for Olimex LPC-L2294-1MB board." +} + +target olpcl2294 { + alias { "Olimex LPC-L2294-1MB development board" olpcl2294 } + packages { CYGPKG_HAL_ARM + CYGPKG_HAL_ARM_LPC2XXX + CYGPKG_HAL_ARM_LPC2XXX_OLPCL2294 + CYGPKG_DEVS_FLASH_INTEL_28FXXX + CYGPKG_DEVS_FLASH_ARM_OLPCL2294 + CYGPKG_DEVS_ETH_CL_CS8900A + CYGPKG_DEVS_ETH_ARM_OLPCL2294 + CYGPKG_IO_SERIAL_GENERIC_16X5X + CYGPKG_IO_SERIAL_ARM_LPC2XXX + CYGPKG_DEVICES_WATCHDOG_ARM_LPC2XXX + } + description " + The olpcl2294 target provides the packages needed to run + eCos on Olimex LPC-L2294-1MB development board." +} + # ========================================================================== # End of ecos.db --9amGYk9869ThD9tj Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="devs_eth_cl_cs8900a.patch" Content-length: 12993 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/cl/cs8900a/current/cdl/cl_cs8900a_eth_drivers.cdl devo/ecos/packages/devs/eth/cl/cs8900a/current/cdl/cl_cs8900a_eth_drivers.cdl --- clean/ecos/packages/devs/eth/cl/cs8900a/current/cdl/cl_cs8900a_eth_drivers.cdl 2005-05-08 12:29:39.000000000 +0300 +++ devo/ecos/packages/devs/eth/cl/cs8900a/current/cdl/cl_cs8900a_eth_drivers.cdl 2008-11-07 19:39:27.000000000 +0200 @@ -78,10 +78,26 @@ into the EEPROM associated with the interface, so that the new MAC address is permanently recorded. Doing this should be a carefully chosen decision, hence this option." } + cdl_option CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT { + display "8-bit data bus" + flavor bool + requires !CYGSEM_DEVS_ETH_CL_CS8900A_WRITE_EEPROM + requires CYGSEM_DEVS_ETH_CL_CS8900A_NOINTS + default_value 0 + description " + The CS8900A can been use in 8-bit mode. From AN181 from + Cirrus Logic... Unsupported functions in 8-bit mode: + Interrupts are not supported. Polled mode must be used; + The DMA engine only uses 16 bit memory access and does not + support 8 bit transfers; The packet page pointer has an + auto increment feature that cannot be used in 8-bit mode; + An EEPROM is not supported." + } + cdl_option CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED { display "Byte swapped data bus" flavor bool default_value 0 description " diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog devo/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog --- clean/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog 2007-09-11 20:37:22.000000000 +0300 +++ devo/ecos/packages/devs/eth/cl/cs8900a/current/ChangeLog 2008-11-07 19:43:43.000000000 +0200 @@ -1,5 +1,17 @@ +2008-11-07 Sergei Gavrikov + + * cdl/cl_cs8900a_eth_drivers.cdl: Added + CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT option to manage chip in 8-bit + mode. + * include/cs8900.h + * src/if_cs8900a.c: Added a support for the 8-bit access for CS8900A. + All access to CS8900A registers wrapped via CS_IN, CS_OUT macros (the + macros were defined in past, but, still not used). In common way the + macros use the eCos macros: HAL_READ_UINT16, HAL_WRITE_UINT16 , but, + in other (rare) conditions they can use 8-bit access too. + 2007-09-04 Stephen Finney * add timeout to potential infinite loop in cs8900a_send per bugzilla report 1000281 diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/cl/cs8900a/current/include/cs8900.h devo/ecos/packages/devs/eth/cl/cs8900a/current/include/cs8900.h --- clean/ecos/packages/devs/eth/cl/cs8900a/current/include/cs8900.h 2005-11-23 23:26:50.000000000 +0200 +++ devo/ecos/packages/devs/eth/cl/cs8900a/current/include/cs8900.h 2008-11-07 19:39:27.000000000 +0200 @@ -78,11 +78,13 @@ // 0 disables all debug output // 1 for process debug output // 2 for added data IO output: get_reg, put_reg // 4 for packet allocation/free output // 8 for only startup status, so we can tell we're installed OK -#define DEBUG 0x0 +#ifndef DEBUG +# define DEBUG 0x0 +#endif #if DEBUG & 1 #define DEBUG_FUNCTION() do { diag_printf("%s\n", __FUNCTION__); } while (0) #define DEBUG_LINE() do { diag_printf("%d\n", __LINE__); } while (0) #else @@ -438,24 +440,24 @@ // "page pointer" access functions static __inline__ cyg_uint16 get_reg(cyg_addrword_t base, int regno) { cyg_uint16 val; - HAL_WRITE_UINT16(base+CS8900A_PPTR, regno); - HAL_READ_UINT16(base+CS8900A_PDATA, val); + CS_OUT(base, CS8900A_PPTR, regno); + CS_IN(base, CS8900A_PDATA, val); #if DEBUG & 2 - diag_printf("get_reg(%p, %d) => 0x%04x\n", base, regno, val); + diag_printf("get_reg(%p, %d) => 0x%04x\n", (void *)base, regno, val); #endif return val; } static __inline__ void put_reg(cyg_addrword_t base, int regno, cyg_uint16 val) { #if DEBUG & 2 - diag_printf("put_reg(%p, %d, 0x%04x)\n", base, regno, val); + diag_printf("put_reg(%p, %d, 0x%04x)\n", (void *)base, regno, val); #endif - HAL_WRITE_UINT16(base+CS8900A_PPTR, regno); - HAL_WRITE_UINT16(base+CS8900A_PDATA, val); + CS_OUT(base, CS8900A_PPTR, regno); + CS_OUT(base, CS8900A_PDATA, val); } #endif // _CYGONCE_ETH_CL_CS8900_H_ diff -r -U 5 -N -x CVS -x '*~' -x '.#*' clean/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c devo/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c --- clean/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c 2007-09-11 20:37:23.000000000 +0300 +++ devo/ecos/packages/devs/eth/cl/cs8900a/current/src/if_cs8900a.c 2008-11-07 19:39:27.000000000 +0200 @@ -210,11 +210,11 @@ // MSB 8 bits. get_reg(base, PP_ChipID); chip_type = get_reg(base, PP_ChipID); chip_rev = get_reg(base, PP_ChipRev); #if DEBUG & 8 - diag_printf("CS8900A[%p] - type: 0x%04x, rev: 0x%04x\n", base, chip_type, chip_rev); + diag_printf("CS8900A[%p] - type: 0x%04x, rev: 0x%04x\n", (void *)base, chip_type, chip_rev); #endif if (chip_type != PP_ChipID_CL) { #if DEBUG & 8 diag_printf("CS8900 - invalid type (0x%04x), must be 0x630e\n", chip_type); #endif @@ -351,14 +351,16 @@ PP_BufCFG_TxCol | PP_BufCFG_Miss | PP_BufCFG_SWI); put_reg(base, PP_IntReg, PP_IntReg_IRQ0); // Only possibility put_reg(base, PP_LineCTL, PP_LineCTL_Rx | PP_LineCTL_Tx); // Clear Interrupt Status Queue before enabling interrupts do { - HAL_READ_UINT16(cpd->base+CS8900A_ISQ, stat); + CS_IN(cpd->base, CS8900A_ISQ, stat); } while (stat != 0) ; cpd->txbusy = false; +#ifndef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT put_reg(base, PP_BusCtl, PP_BusCtl_EnableIRQ); +#endif } // This routine is called to perform special "control" opertions static int cs8900a_control(struct eth_drv_sc *sc, unsigned long key, void *data, int data_length) @@ -471,10 +473,11 @@ int i; int len; cyg_uint8 *data; cyg_uint16 saved_data = 0, *sdata; cyg_uint16 stat; + bool force_coping_by_byte; bool odd_byte = false; // Mark xmitter busy cpd->txbusy = true; cpd->txkey = key; @@ -485,10 +488,16 @@ // Start the xmit sequence #ifdef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED total_len = CYG_SWAP16(total_len); #endif +#ifdef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT + force_coping_by_byte = true; +#else + force_coping_by_byte = false; +#endif + // The hardware indicates that there are options as to when the actual // packet transmission will start wrt moving of data into the transmit // buffer. However, impirical results seem to indicate that if the // packet is large and transmission is allowed to start before the // entire packet has been pushed into the buffer, the hardware gets @@ -496,16 +505,16 @@ // This may be a case of the copy loop below being interrupted, e.g. // a system timer interrupt, and the hardware getting unhappy that // not all of the data was provided before the transmission should // have completed (i.e. buffer underrun). // For now, the solution is to not allow this overlap. - //HAL_WRITE_UINT16(cpd->base+CS8900A_TxCMD, PP_TxCmd_TxStart_5) + //CS_OUT(cpd->base, CS8900A_TxCMD, PP_TxCmd_TxStart_5) // Start only when all data sent to chip - HAL_WRITE_UINT16(cpd->base+CS8900A_TxCMD, PP_TxCmd_TxStart_Full); + CS_OUT(cpd->base, CS8900A_TxCMD, PP_TxCmd_TxStart_Full); - HAL_WRITE_UINT16(cpd->base+CS8900A_TxLEN, total_len); + CS_OUT(cpd->base, CS8900A_TxLEN, total_len); // Wait for controller ready signal { // add timeout per cs8900a bugzilla report 1000281 */ int timeout = 1000; @@ -537,24 +546,24 @@ #ifdef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED saved_data |= *data++; #else saved_data |= ((cyg_uint16)*data++) << 8; #endif - HAL_WRITE_UINT16(cpd->base+CS8900A_RTDATA, saved_data); + CS_OUT(cpd->base, CS8900A_RTDATA, saved_data); len--; odd_byte = false; } - if (((CYG_ADDRESS)data & 0x1) == 0) { + if (!force_coping_by_byte && ((CYG_ADDRESS)data & 0x1) == 0) { /* Aligned on 16-bit boundary, so output contiguous words. */ sdata = (cyg_uint16 *)data; while (len > 1) { // Make sure data get on the bus in Big Endian format #if((CYG_BYTEORDER == CYG_MSBFIRST) && defined(CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED) || \ (CYG_BYTEORDER == CYG_LSBFIRST) && !defined(CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED )) - HAL_WRITE_UINT16(cpd->base+CS8900A_RTDATA, *sdata++); + CS_OUT(cpd->base, CS8900A_RTDATA, *sdata++); #else - HAL_WRITE_UINT16(cpd->base+CS8900A_RTDATA, CYG_SWAP16(*sdata++)); + CS_OUT(cpd->base, CS8900A_RTDATA, CYG_SWAP16(*sdata++)); #endif len -= sizeof(cyg_uint16); } data = (cyg_uint8 *)sdata; } else { @@ -566,11 +575,11 @@ #ifdef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED saved_data = ((cyg_uint16)*data++) | (saved_data << 8); #else saved_data |= ((cyg_uint16)*data++) << 8; #endif - HAL_WRITE_UINT16(cpd->base+CS8900A_RTDATA, saved_data); + CS_OUT(cpd->base, CS8900A_RTDATA, saved_data); len -= sizeof(cyg_uint16); } } /* Save last byte, if necessary. */ if (len == 1) { @@ -583,11 +592,11 @@ odd_byte = true; } } } if (odd_byte) { - HAL_WRITE_UINT16(cpd->base+CS8900A_RTDATA, saved_data); + CS_OUT(cpd->base, CS8900A_RTDATA, saved_data); } } // This function is called when a packet has been received. It's job is // to prepare to unload the packet from the hardware. Once the length of @@ -601,12 +610,22 @@ cyg_addrword_t base = cpd->base; cyg_uint16 len; if(stat & PP_RxCFG_RxOK) { // Only start reading a message if one has been received - HAL_READ_UINT16(base+CS8900A_RTDATA, stat); - HAL_READ_UINT16(base+CS8900A_RTDATA, len); +#ifndef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_8BIT + CS_IN(base, CS8900A_RTDATA, stat); + CS_IN(base, CS8900A_RTDATA, len); +#else + // From AN181 Using the Crystal CS8900A in 8-bit mode. + // Note: it is very important to read the RxStatus and RxLength high + // order byte first. + stat = *(volatile CYG_BYTE *)(base + CS8900A_RTDATA + 1) << 8; + stat |= *(volatile CYG_BYTE *)(base + CS8900A_RTDATA); + len = *(volatile CYG_BYTE *)(base + CS8900A_RTDATA + 1) << 8; + len |= *(volatile CYG_BYTE *)(base + CS8900A_RTDATA); +#endif #ifdef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED len = CYG_SWAP16(len); #endif @@ -637,11 +656,11 @@ for (i = 0; i < sg_len; i++) { data = (cyg_uint16 *)sg_list[i].buf; mlen = sg_list[i].len; while (mlen >= sizeof(*data)) { - HAL_READ_UINT16(base+CS8900A_RTDATA, val); + CS_IN(base, CS8900A_RTDATA, val); if (data) { #if((CYG_BYTEORDER == CYG_MSBFIRST) && defined(CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED) || \ (CYG_BYTEORDER == CYG_LSBFIRST) && !defined(CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED )) *data++ = val; #else @@ -649,11 +668,11 @@ #endif } mlen -= sizeof(*data); } if (mlen) { - HAL_READ_UINT16(base+CS8900A_RTDATA, val); + CS_IN(base, CS8900A_RTDATA, val); #ifndef CYGIMP_DEVS_ETH_CL_CS8900A_DATABUS_BYTE_SWAPPED // last odd byte will be in the LSB cval = (cyg_uint8)(val); #elif(CYG_BYTEORDER == CYG_MSBFIRST) // last odd byte will be in the MSB @@ -697,11 +716,11 @@ { cyg_uint16 event; cs8900a_priv_data_t *cpd = (cs8900a_priv_data_t *)sc->driver_private; cyg_addrword_t base = cpd->base; - HAL_READ_UINT16(base+CS8900A_ISQ, event); + CS_IN(base, CS8900A_ISQ, event); while (event != 0) { switch (event & ISQ_EventMask) { case ISQ_RxEvent: cs8900a_RxEvent(sc, event); break; @@ -721,11 +740,11 @@ #if DEBUG & 1 diag_printf("%s: Unknown event: %x\n", __FUNCTION__, event); #endif break; } - HAL_READ_UINT16(base+CS8900A_ISQ, event); + CS_IN(base, CS8900A_ISQ, event); } CYGHWR_CL_CS8900A_PLF_INT_CLEAR(cpd); } --9amGYk9869ThD9tj--