1 /*==========================================================================
5 // HAL misc board support code for Phytec phyCORE-LPC2292/94
7 //==========================================================================
8 //####ECOSGPLCOPYRIGHTBEGIN####
9 // -------------------------------------------
10 // This file is part of eCos, the Embedded Configurable Operating System.
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12 // Copyright (C) 2008 eCosCentric Limited
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
36 // -------------------------------------------
37 //####ECOSGPLCOPYRIGHTEND####
38 //==========================================================================
39 //#####DESCRIPTIONBEGIN####
41 // Author(s): Uwe Kindler
42 // Contributors: Uwe Kindler
44 // Purpose: HAL board support
45 // Description: Implementations of HAL board interfaces
47 //####DESCRIPTIONEND####
49 //========================================================================*/
50 #include <pkgconf/hal.h>
51 #include <pkgconf/hal_arm_lpc2xxx_phycore229x.h>
52 #include <cyg/hal/hal_io.h> // IO macros
54 #include <cyg/infra/cyg_type.h> // base types
55 #include <cyg/hal/var_io.h>
56 #include <cyg/hal/plf_io.h>
57 #include <pkgconf/hal.h>
59 #include <cyg/hal/hal_arch.h>
60 #include <cyg/hal/hal_intr.h>
66 extern void cyg_hal_plf_serial_init(void);
68 void cyg_hal_plf_comms_init(void)
70 static int initialized = 0;
76 cyg_hal_plf_serial_init();
79 //--------------------------------------------------------------------------
80 // hal_plf_hardware_init
82 void hal_plf_hardware_init(void)
84 #if defined(CYG_HAL_STARTUP_ROM) && defined(CYGPKG_DEVS_ETH_ARM_PHYCORE229X)
88 // Configures the LAN IRQ
89 // The interrupt is being used as active high edge triggered.
90 // IMPORTANT: We execute this step only for ROM startup. If this is done
91 // for RAM startup then wrong values are stored in EXTMODE and EXTPOLAR
92 // register because of a bug in LPC229x hardware.
94 HAL_INTERRUPT_CONFIGURE(CYGHWR_HAL_ARM_PHYCORE229X_ETH_EINT + // the configured external interrupt
95 CYGNUM_HAL_INTERRUPT_EINT0, // the first external interrupt
96 0, // level = 0 - edge triggered
97 1); // up = 1 - rising edge
100 // Set pin function of P0.16 to EINT0 or P0.14 to EINT1 for ethernet interrupt
102 #if CYGHWR_HAL_ARM_PHYCORE229X_ETH_EINT == 0
103 HAL_READ_UINT32(CYGARC_HAL_LPC2XXX_REG_PIN_BASE +
104 CYGARC_HAL_LPC2XXX_REG_PINSEL1, regval);
106 HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_PIN_BASE +
107 CYGARC_HAL_LPC2XXX_REG_PINSEL1, regval);
108 #elif CYGHWR_HAL_ARM_PHYCORE229X_ETH_EINT == 1
109 HAL_READ_UINT32(CYGARC_HAL_LPC2XXX_REG_PIN_BASE +
110 CYGARC_HAL_LPC2XXX_REG_PINSEL0, regval);
111 regval |= (0x10 << 28);
112 HAL_WRITE_UINT32(CYGARC_HAL_LPC2XXX_REG_PIN_BASE +
113 CYGARC_HAL_LPC2XXX_REG_PINSEL0, regval);
115 #error "Invalid CYGHWR_HAL_ARM_PHYCORE229X_ETH_EINT value"
117 #endif // #if defined(CYG_HAL_STARTUP_ROM) && defined(CYGPKG_DEVS_ETH_ARM_PHYCORE229X)
120 //--------------------------------------------------------------------------
121 // hal_lpc2xxx_set_leds
123 void hal_lpc2xxx_set_leds (int mask)
126 // implement function for setting diagnostic leds
130 //--------------------------------------------------------------------------
131 // EOF phycore_misc.c