1 #ifndef CYGONCE_HAL_PLATFORM_SETUP_H
2 #define CYGONCE_HAL_PLATFORM_SETUP_H
4 /*=============================================================================
6 // hal_platform_setup.h
8 // Platform specific support for HAL (assembly code)
10 //=============================================================================
11 //####ECOSGPLCOPYRIGHTBEGIN####
12 // -------------------------------------------
13 // This file is part of eCos, the Embedded Configurable Operating System.
14 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
15 // Copyright (C) 2003 Nick Garnett <nickg@calivar.com>
16 // Copyright (C) 2004 eCosCentric Limited
18 // eCos is free software; you can redistribute it and/or modify it under
19 // the terms of the GNU General Public License as published by the Free
20 // Software Foundation; either version 2 or (at your option) any later version.
22 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
23 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
24 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 // You should have received a copy of the GNU General Public License along
28 // with eCos; if not, write to the Free Software Foundation, Inc.,
29 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
31 // As a special exception, if other files instantiate templates or use macros
32 // or inline functions from this file, or you compile this file and link it
33 // with other works to produce a work based on this file, this file does not
34 // by itself cause the resulting work to be covered by the GNU General Public
35 // License. However the source code for this file must still be made available
36 // in accordance with section (3) of the GNU General Public License.
38 // This exception does not invalidate any other reasons why a work based on
39 // this file might be covered by the GNU General Public License.
40 // -------------------------------------------
41 //####ECOSGPLCOPYRIGHTEND####
42 //=============================================================================
43 //#####DESCRIPTIONBEGIN####
48 // Purpose: LPC2XXX/LPCMT platform specific support routines
50 // Usage: #include <cyg/hal/hal_platform_setup.h>
52 //####DESCRIPTIONEND####
54 //===========================================================================*/
56 #include <pkgconf/system.h>
57 #include <cyg/hal/var_io.h>
59 //===========================================================================*/
62 ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE
63 ldr r1,=(1<<12) // GPIO0 pin 12 is LED output
64 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IODIR]
68 ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE
70 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IOCLR]
71 ldr r1,=((\x & 1)<<12)
72 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IOSET]
76 ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE
81 mov r1,#1 // enable PLL
82 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON]
84 mov r1,#(0x20 | (CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL - 1))
85 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCFG]
87 str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] // update PLL registers
88 str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]
91 ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLSTAT] // wait for it to lock
95 mov r1,#3 // connect PLL
96 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON]
98 str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED] // update PLL registers
99 str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]
104 mov r0,#0 // copy first 64 bytes of flash to RAM
113 ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE
115 str r1, [r0,#CYGARC_HAL_LPC2XXX_REG_MEMMAP] // int vectors mapped to RAM
117 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMTIM] // flash timings
119 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMCR] // enable full MAM
123 ldr r0,=CYGARC_HAL_LPC2XXX_REG_PIN_BASE // enable RX and TX on UART0
125 str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL0]
128 #define CYGHWR_LED_MACRO _led \x
130 //===========================================================================*/
132 #if defined(CYG_HAL_STARTUP_ROM)
146 #define CYGSEM_HAL_ROM_RESET_USES_JUMP
155 #define PLATFORM_SETUP1 _setup
158 //-----------------------------------------------------------------------------
159 // end of hal_platform_setup.h
160 #endif // CYGONCE_HAL_PLATFORM_SETUP_H