1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_PLATFORM_INC
|
2 |
|
|
#define CYGONCE_HAL_PLATFORM_INC
|
3 |
|
|
##=============================================================================
|
4 |
|
|
##
|
5 |
|
|
## platform.inc
|
6 |
|
|
##
|
7 |
|
|
## Fujitsu Starterkit MB91302 board assembler header file
|
8 |
|
|
##
|
9 |
|
|
##=============================================================================
|
10 |
|
|
## ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
## -------------------------------------------
|
12 |
|
|
## This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
## Copyright (C) 1998, 1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
|
14 |
|
|
##
|
15 |
|
|
## eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
## the terms of the GNU General Public License as published by the Free
|
17 |
|
|
## Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
## version.
|
19 |
|
|
##
|
20 |
|
|
## eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
## for more details.
|
24 |
|
|
##
|
25 |
|
|
## You should have received a copy of the GNU General Public License
|
26 |
|
|
## along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
##
|
29 |
|
|
## As a special exception, if other files instantiate templates or use
|
30 |
|
|
## macros or inline functions from this file, or you compile this file
|
31 |
|
|
## and link it with other works to produce a work based on this file,
|
32 |
|
|
## this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
## the GNU General Public License. However the source code for this file
|
34 |
|
|
## must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
## General Public License v2.
|
36 |
|
|
##
|
37 |
|
|
## This exception does not invalidate any other reasons why a work based
|
38 |
|
|
## on this file might be covered by the GNU General Public License.
|
39 |
|
|
## -------------------------------------------
|
40 |
|
|
## ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
##=============================================================================
|
42 |
|
|
#######DESCRIPTIONBEGIN####
|
43 |
|
|
##
|
44 |
|
|
## Author(s): larsi
|
45 |
|
|
## Contributors:
|
46 |
|
|
## Date: 2007-07-09
|
47 |
|
|
## Purpose: Fujitsu Starterkit MB91302 board definitions.
|
48 |
|
|
## Description: This file contains various definitions and macros that are
|
49 |
|
|
## useful for writing assembly code for the skmb91302 board.
|
50 |
|
|
## Usage:
|
51 |
|
|
## #include
|
52 |
|
|
##
|
53 |
|
|
##
|
54 |
|
|
##
|
55 |
|
|
######DESCRIPTIONEND####
|
56 |
|
|
##
|
57 |
|
|
##=============================================================================
|
58 |
|
|
|
59 |
|
|
#include
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
##------------------------------------------------------------------------------
|
63 |
|
|
## ext Bus (memory controller) initialisation macros
|
64 |
|
|
##
|
65 |
|
|
## flash part
|
66 |
|
|
|
67 |
|
|
|
68 |
|
|
#define CYGPKG_HAL_FR30_FLASH_INIT_DEFINED
|
69 |
|
|
## flash init is empty for this platform because it is initialized in the
|
70 |
|
|
## special hal_fr30_ram_startup_trampoline to map flash to 0x1000000
|
71 |
|
|
.macro hal_flash_init
|
72 |
|
|
.endm
|
73 |
|
|
|
74 |
|
|
## and the following macro is used in the special
|
75 |
|
|
## hal_fr30_ram_startup_trampoline for flash initialisation
|
76 |
|
|
.macro hal_flash_init_from_ram
|
77 |
|
|
|
78 |
|
|
ldi:20 #FR30_MB91301_ASR0, r10 ; CS0 area starts at
|
79 |
|
|
ldi:20 0x100, r0 ; 0x01000000
|
80 |
|
|
sth r0, @r10 ;
|
81 |
|
|
|
82 |
|
|
ldi:20 #FR30_MB91301_ACR0, r11 ; configuration parameters for CS0
|
83 |
|
|
ldi:20 #0x7422, r1 ; 8MB(0x0-0x7FFFFF),16bit data bus,
|
84 |
|
|
sth r1, @r11 ; pre-fetch off, single access,
|
85 |
|
|
; write enable, big endian,
|
86 |
|
|
; normal access(asynchronous),
|
87 |
|
|
; WR pin enabled for write,
|
88 |
|
|
; wait by RDY pin disabled
|
89 |
|
|
|
90 |
|
|
ldi:20 #FR30_MB91301_AWR0, r12 ; first access auto-wait 3cyc
|
91 |
|
|
ldi:20 #0x3378, r2 ; inpage access auto-wait 3cyc
|
92 |
|
|
sth r2, @r12 ; read/write idle 1cyc
|
93 |
|
|
; write recover 3cyc
|
94 |
|
|
; async write strobe outp enabled
|
95 |
|
|
; CS delay enabled
|
96 |
|
|
; CS read/write setup delay 0
|
97 |
|
|
; RD/WR -> CS hold extension 0 cyc
|
98 |
|
|
|
99 |
|
|
ldi:20 #FR30_MB91301_PFR9, r13 ; WRn, BAAE, ASXE enable
|
100 |
|
|
ldi:8 #0x7e, r3 ;
|
101 |
|
|
stb r3, @r13 ;
|
102 |
|
|
|
103 |
|
|
## following would chip select enable
|
104 |
|
|
## we only use cs0 until here, which is already set by reset
|
105 |
|
|
|
106 |
|
|
.endm
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
## sdram part
|
110 |
|
|
|
111 |
|
|
|
112 |
|
|
#define CYGPKG_HAL_FR30_MEMC_INIT_DEFINED
|
113 |
|
|
|
114 |
|
|
.macro hal_memc_init
|
115 |
|
|
|
116 |
|
|
## The following instruction is without function. It is only to reference
|
117 |
|
|
## hal_fr30_rom_startup_trampoline, because when not referenced the linker
|
118 |
|
|
## does not include the file platform.S in the link. If somewhen some other
|
119 |
|
|
## referenced code appears in platform.S the instruction here can be deleted
|
120 |
|
|
## (including the surrounding macro)!
|
121 |
|
|
|
122 |
|
|
#if defined(CYG_HAL_STARTUP_ROM) || defined(CYG_HAL_STARTUP_ROMRAM)
|
123 |
|
|
ldi:32 #hal_fr30_rom_startup_trampoline, r10
|
124 |
|
|
#endif
|
125 |
|
|
|
126 |
|
|
ldi:20 #FR30_MB91301_ASR6, r10 ; CS6 area starts at
|
127 |
|
|
ldi:20 0x200, r0 ; 0x02000000
|
128 |
|
|
sth r0, @r10 ;
|
129 |
|
|
|
130 |
|
|
ldi:20 #FR30_MB91301_ACR6, r11 ; configuration parameters for CS6
|
131 |
|
|
ldi:20 #0x7868, r1 ; 64MB(0x2000000-0x27FFFFF),32bit data bus,
|
132 |
|
|
sth r1, @r11 ; pre-fetch on, single access(no burst),
|
133 |
|
|
; write enable, big endian,
|
134 |
|
|
; FCRAM setting
|
135 |
|
|
|
136 |
|
|
ldi:20 #FR30_MB91301_AWR6, r12 ; first access auto-wait 1cyc ??
|
137 |
|
|
ldi:20 #0x1159, r2 ; inpage access auto-wait 1cyc ??
|
138 |
|
|
sth r2, @r12 ; read/write idle 1cyc ??
|
139 |
|
|
; write recover 1cyc ??
|
140 |
|
|
; async write strobe outp enabled ??
|
141 |
|
|
; CS delay disabled ??
|
142 |
|
|
; CS read/write setup delay 0 ??
|
143 |
|
|
; RD/WR -> CS hold extension 1 cyc ??
|
144 |
|
|
; see Hardware Manual page 156ff
|
145 |
|
|
|
146 |
|
|
ldi:20 #FR30_MB91301_MCRA, r13 ; 8 columns, single write,
|
147 |
|
|
ldi:8 #0x07, r3 ; 4 banks for burst write,
|
148 |
|
|
stb r3, @r13 ; 4 active banks
|
149 |
|
|
|
150 |
|
|
ldi:20 #FR30_MB91301_PFR9, r10 ; enable WRn, BAAE, ASXE,
|
151 |
|
|
ldi:8 #0x7e, r0 ; sysclk, MCKE, MCKEE
|
152 |
|
|
stb r0, @r10
|
153 |
|
|
|
154 |
|
|
ldi:20 #FR30_MB91301_PFR8, r11 ; enable WR3XE, WR2XE, WR1XE
|
155 |
|
|
ldi:8 #0xe0, r1
|
156 |
|
|
stb r1, @r11
|
157 |
|
|
|
158 |
|
|
ldi:20 #FR30_MB91301_CSER, r12 ; switch on CS6 & CS0
|
159 |
|
|
ldi:8 #0x41, r2
|
160 |
|
|
stb r2, @r12
|
161 |
|
|
|
162 |
|
|
ldi:20 #FR30_MB91301_RCR, r13 ; power on SDRAM I/F
|
163 |
|
|
ldi:20 #0xe247, r3 ; 0xe247 -> 0xe24f
|
164 |
|
|
sth r3, @r13
|
165 |
|
|
ldi:20 #0xe24f, r3
|
166 |
|
|
sth r3, @r13
|
167 |
|
|
|
168 |
|
|
.endm
|
169 |
|
|
|
170 |
|
|
#------------------------------------------------------------------------------
|
171 |
|
|
## Vector table for storage. platform.S defines a vector table and wants to
|
172 |
|
|
## override the one from variant.S with this define
|
173 |
|
|
|
174 |
|
|
#define CYGPKG_HAL_FR30_ROM_VECTORS_DEFINED
|
175 |
|
|
|
176 |
|
|
#------------------------------------------------------------------------------
|
177 |
|
|
# Difference of the flash memory from the linkers LMA (loadmemoryaddress) after
|
178 |
|
|
# the new mapping in (mapping is done in hal_fr30_ram_startup_trampoline).
|
179 |
|
|
|
180 |
|
|
#define CYGPKG_HAL_FR30_LMA_OFFSET 0x1000000
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
|
184 |
|
|
#------------------------------------------------------------------------------
|
185 |
|
|
#endif // ifndef CYGONCE_HAL_PLATFORM_INC
|
186 |
|
|
# end of platform.inc
|