OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [lpc2xxx/] [lpcmt/] [current/] [include/] [hal_platform_setup.h] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
#ifndef CYGONCE_HAL_PLATFORM_SETUP_H
2
#define CYGONCE_HAL_PLATFORM_SETUP_H
3
 
4
/*=============================================================================
5
//
6
//      hal_platform_setup.h
7
//
8
//      Platform specific support for HAL (assembly code)
9
//
10
//=============================================================================
11
// ####ECOSGPLCOPYRIGHTBEGIN####
12
// -------------------------------------------
13
// This file is part of eCos, the Embedded Configurable Operating System.
14
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
15
//
16
// eCos is free software; you can redistribute it and/or modify it under
17
// the terms of the GNU General Public License as published by the Free
18
// Software Foundation; either version 2 or (at your option) any later
19
// version.
20
//
21
// eCos is distributed in the hope that it will be useful, but WITHOUT
22
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
23
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
24
// for more details.
25
//
26
// You should have received a copy of the GNU General Public License
27
// along with eCos; if not, write to the Free Software Foundation, Inc.,
28
// 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
29
//
30
// As a special exception, if other files instantiate templates or use
31
// macros or inline functions from this file, or you compile this file
32
// and link it with other works to produce a work based on this file,
33
// this file does not by itself cause the resulting work to be covered by
34
// the GNU General Public License. However the source code for this file
35
// must still be made available in accordance with section (3) of the GNU
36
// General Public License v2.
37
//
38
// This exception does not invalidate any other reasons why a work based
39
// on this file might be covered by the GNU General Public License.
40
// -------------------------------------------
41
// ####ECOSGPLCOPYRIGHTEND####
42
//=============================================================================
43
//#####DESCRIPTIONBEGIN####
44
//
45
// Author(s):   jani
46
// Contributors:
47
// Date:        2004-09-12
48
// Purpose:     LPC2XXX/LPCMT platform specific support routines
49
// Description:
50
// Usage:       #include <cyg/hal/hal_platform_setup.h>
51
//
52
//####DESCRIPTIONEND####
53
//
54
//===========================================================================*/
55
 
56
#include <pkgconf/system.h>
57
#include <cyg/hal/var_io.h>
58
 
59
//===========================================================================*/
60
 
61
        .macro  _led_init
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]
65
        .endm
66
 
67
        .macro _led x
68
        ldr r0,=CYGARC_HAL_LPC2XXX_REG_IO_BASE
69
        ldr r1,=(1<<12)
70
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IOCLR]
71
        ldr r1,=((\x & 1)<<12)
72
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_IOSET]
73
        .endm
74
 
75
        .macro _pll_init
76
        ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE
77
 
78
        mov r2,#0xAA
79
        mov r3,#0x55
80
 
81
        mov r1,#1                       // enable PLL   
82
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON]
83
 
84
        mov r1,#(0x20 | (CYGNUM_HAL_ARM_LPC2XXX_PLL_MUL - 1))
85
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCFG]      
86
 
87
        str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]     // update PLL registers
88
        str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]
89
 
90
1:
91
        ldr r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLSTAT]     // wait for it to lock
92
        ands r1,r1,#(1<<10)
93
        beq 1b
94
 
95
        mov r1,#3                       // connect PLL
96
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLCON]
97
 
98
        str r2,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]     // update PLL registers
99
        str r3,[r0,#CYGARC_HAL_LPC2XXX_REG_PLLFEED]
100
 
101
        .endm
102
 
103
        .macro _mem_init
104
        mov r0,#0                       // copy first 64 bytes of flash to RAM
105
        mov r1,#0x40000000
106
        mov r2,#0x40
107
1:
108
        ldr r3,[r0,#4]!
109
        str r3,[r1,#4]!
110
        cmps r0,r2
111
        bne 1b
112
 
113
        ldr r0,=CYGARC_HAL_LPC2XXX_REG_SCB_BASE
114
        mov r1,#2
115
        str r1, [r0,#CYGARC_HAL_LPC2XXX_REG_MEMMAP]     // int vectors mapped to RAM
116
        mov r1,#4
117
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMTIM]      // flash timings
118
        mov r1,#2
119
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_MAMCR]       // enable full MAM
120
        .endm
121
 
122
        .macro _gpio_init
123
        ldr r0,=CYGARC_HAL_LPC2XXX_REG_PIN_BASE // enable  RX and TX on UART0
124
        ldr r1,=0x00000005
125
        str r1,[r0,#CYGARC_HAL_LPC2XXX_REG_PINSEL0]
126
        .endm
127
 
128
#define CYGHWR_LED_MACRO _led \x 
129
 
130
//===========================================================================*/
131
 
132
#if defined(CYG_HAL_STARTUP_ROM)
133
 
134
        .macro  _setup
135
 
136
        _pll_init
137
 
138
        _mem_init
139
 
140
        _gpio_init
141
 
142
        _led_init
143
 
144
        .endm
145
 
146
#define CYGSEM_HAL_ROM_RESET_USES_JUMP
147
 
148
#else
149
 
150
        .macro  _setup
151
        .endm
152
 
153
#endif
154
 
155
#define PLATFORM_SETUP1     _setup
156
 
157
 
158
//-----------------------------------------------------------------------------
159
// end of hal_platform_setup.h
160
#endif // CYGONCE_HAL_PLATFORM_SETUP_H

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.