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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [arm/] [at91/] [eb40a/] [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, 2009 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):   gthomas
46
// Contributors:gthomas, tdrury, nickg
47
// Date:        2001-07-12
48
// Purpose:     AT91/EB40A platform specific support routines
49
// Description:
50
// Usage:       #include <cyg/hal/hal_platform_setup.h>
51
//
52
//####DESCRIPTIONEND####
53
//
54
//===========================================================================*/
55
 
56
#include <cyg/hal/var_io.h>
57
 
58
        .macro  _led_init
59
        ldr     r0,=AT91_PIO
60
        ldr     r1,=0x000F0000
61
        str     r1,[r0,#AT91_PIO_PER]
62
        str     r1,[r0,#AT91_PIO_OER]
63
        _led    0
64
        _led    15
65
        .endm
66
 
67
        .macro _led y
68
        ldr     r0,=AT91_PIO
69
        ldr     r1,=0x000F0000
70
        str     r1,[r0,#AT91_PIO_SODR]
71
        ldr     r1,=(\y<<16)
72
        str     r1,[r0,#AT91_PIO_CODR]
73
#if 0                        
74
        mov     r0,#0x00100000        
75
1:      sub     r0,r0,#1
76
        cmp     r0,#0
77
        bne     1b
78
#endif
79
        .endm
80
 
81
#define CYGHWR_LED_MACRO _led \x
82
 
83
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
84
 
85
 
86
        .macro  _setup
87
        _led_init
88
        ldr     r10,=_InitMemory        // Initialize memory controller
89
        movs    r0,pc,lsr #20           // If ROM startup, PC < 0x100000
90
        moveq   r10,r10,lsl #12         //   mask address to low 20 bits
91
        moveq   r10,r10,lsr #12
92
        ldmia   r10!,{r0-r9,r11-r12}    // Table of initialization constants
93
#if defined(CYG_HAL_STARTUP_ROMRAM)
94
        ldr     r10,=0x0000FFFF
95
        and     r12,r12,r10
96
        ldr     r10,=0x01000000
97
        orr     r12,r12,r10
98
#endif
99
        stmia   r11!,{r0-r9}            // Write to controller
100
        mov     pc,r12                  // Change address space, break pipeline
101
_InitMemory:
102
        .long   0x01002535  // 0x01000000, 16MB,  2 cycles after transfer, 16-bit, 6 wait states
103
        .long   0x02002121  // 0x02000000, 16MB,  0 cycles after transfer, 16-bit, 1 wait state
104
        .long   0x20003E3E  // 0x20000000, 1MB,   7 cycles after transfer, 8-bit, 8 wait states
105
        .long   0x30000000  // unused
106
        .long   0x40000000  // unused
107
        .long   0x50000000  // unused
108
        .long   0x60000000  // unused
109
        .long   0x70000000  // unused
110
        .long   0x00000001  // REMAP commande
111
        .long   0x00000006  // 7 memory regions, standard read
112
        .long   AT91_EBI    // External Bus Interface address
113
        .long   10f         // address where to jump
114
10:
115
#if defined(CYG_HAL_STARTUP_ROMRAM)
116
        ldr     r0,=0x01000000          // Relocate FLASH/ROM to on-chip RAM
117
        ldr     r1,=0x02000000          // RAM base & length
118
        ldr     r2,=0x02010000
119
20:     ldr     r3,[r0],#4
120
        str     r3,[r1],#4
121
        cmp     r1,r2
122
        bne     20b
123
        ldr     r0,=30f
124
        mov     pc,r0
125
30:
126
#endif
127
        ldr     r0,=AT91_PS             // Power saving interface
128
        ldr     r1,=0xFFFFFFFF          // Enable all peripheral [clocks]
129
        str     r1,[r0,#AT91_PS_PCER]
130
        ldr     r0,=AT91_PIO            // Disable PIO (so peripherals can use bits)
131
        ldr     r1,=0x0070FE49          // UART, FIQ, EINT, Timer clocks
132
        str     r1,[r0,#AT91_PIO_PDR]
133
        ldr     r1,=0x000001B6          // LEDs
134
        str     r1,[r0,#AT91_PIO_OER]
135
        str     r1,[r0,#AT91_PIO_SODR]
136
        .endm
137
 
138
#define CYGSEM_HAL_ROM_RESET_USES_JUMP
139
#define PLATFORM_SETUP1     _setup
140
#else
141
#define PLATFORM_SETUP1     _led_init
142
#endif
143
 
144
//-----------------------------------------------------------------------------
145
// end of hal_platform_setup.h
146
#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.