1 |
27 |
unneback |
#ifndef CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H
|
2 |
|
|
#define CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H
|
3 |
|
|
|
4 |
|
|
/*=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// iq80321.h
|
7 |
|
|
//
|
8 |
|
|
// Platform specific support (register layout, etc)
|
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 Red Hat, 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 version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// 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 along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
//=============================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): msalter
|
47 |
|
|
// Contributors: msalter
|
48 |
|
|
// Date: 2001-12-03
|
49 |
|
|
// Purpose: Intel IQ80321 platform specific support routines
|
50 |
|
|
// Description:
|
51 |
|
|
// Usage: #include <cyg/hal/iq80321.h>
|
52 |
|
|
//
|
53 |
|
|
//####DESCRIPTIONEND####
|
54 |
|
|
//
|
55 |
|
|
//===========================================================================*/
|
56 |
|
|
|
57 |
|
|
#include <pkgconf/system.h>
|
58 |
|
|
#include CYGHWR_MEMORY_LAYOUT_H
|
59 |
|
|
#include <pkgconf/hal_arm_xscale_iq80321.h>
|
60 |
|
|
#include <cyg/hal/hal_verde.h> // IO Processor defines
|
61 |
|
|
|
62 |
|
|
#define IQ80321_FLASH_ADDR 0xf0000000 // Verde PBIU CS0
|
63 |
|
|
#define IQ80321_UART_ADDR 0xfe800000 // Verde PBIU CS1
|
64 |
|
|
#define IQ80321_DISPLAY_RIGHT_ADDR 0xfe850000 // Verde PBIU CS2
|
65 |
|
|
#define IQ80321_DISPLAY_LEFT_ADDR 0xfe840000 // Verde PBIU CS3
|
66 |
|
|
#define IQ80321_ROTARY_SWITCH_ADDR 0xfe8d0000 // Verde PBIU CS4
|
67 |
|
|
#define IQ80321_BATTERY_STATUS_ADDR 0xfe8f0000 // Verde PBIU CS5
|
68 |
|
|
|
69 |
|
|
#define SDRAM_PHYS_BASE 0xa0000000
|
70 |
|
|
#ifdef CYG_HAL_MEMORY_MAP_NORMAL
|
71 |
|
|
#define SDRAM_BASE 0x00000000
|
72 |
|
|
#else
|
73 |
|
|
#define SDRAM_BASE 0xa0000000
|
74 |
|
|
#endif
|
75 |
|
|
#define SDRAM_SIZE 0x08000000 // 128MB
|
76 |
|
|
#define SDRAM_MAX 0x20000000 // 512MB
|
77 |
|
|
|
78 |
|
|
// These must match setup in the page table in hal_platform_extras.h
|
79 |
|
|
#define SDRAM_UNCACHED_BASE 0xc0000000
|
80 |
|
|
#define DCACHE_FLUSH_AREA 0xe0000000
|
81 |
|
|
|
82 |
|
|
// Pin used to enable Gigabit Ethernet NIC
|
83 |
|
|
// The GPIO pin only has effect when switch S7E1-5 is closed (ON).
|
84 |
|
|
#define IQ80321_GBE_GPIO_PIN 4
|
85 |
|
|
|
86 |
|
|
// ------------------------------------------------------------------------
|
87 |
|
|
// SDRAM configuration
|
88 |
|
|
|
89 |
|
|
// I2C slave address to which the unit responds when in slave-receive mode
|
90 |
|
|
#define I2C_DEVID 0x02
|
91 |
|
|
#define SDRAM_DEVID 0xAE
|
92 |
|
|
|
93 |
|
|
// Timeout limit for SDRAM EEPROM to respond
|
94 |
|
|
#define I2C_TIMOUT 0x1000000
|
95 |
|
|
|
96 |
|
|
// ------------------------------------------------------------------------
|
97 |
|
|
// Battery Status
|
98 |
|
|
//
|
99 |
|
|
#define IQ80321_BATTERY_NOT_PRESENT 0x01
|
100 |
|
|
#define IQ80321_BATTERY_CHARGE 0x02
|
101 |
|
|
#define IQ80321_BATTERY_ENABLE 0x04
|
102 |
|
|
#define IQ80321_BATTERY_DISCHARGE 0x08
|
103 |
|
|
|
104 |
|
|
#define IQ80321_BATTERY_STATUS ((volatile unsigned short *)IQ80321_BATTERY_STATUS_ADDR)
|
105 |
|
|
|
106 |
|
|
// Address used for battery backup test
|
107 |
|
|
#define SDRAM_BATTERY_TEST_ADDR (SDRAM_UNCACHED_BASE + 0x100000)
|
108 |
|
|
|
109 |
|
|
|
110 |
|
|
// ------------------------------------------------------------------------
|
111 |
|
|
// 7 Segment Display
|
112 |
|
|
#define DISPLAY_LEFT IQ80321_DISPLAY_LEFT_ADDR
|
113 |
|
|
#define DISPLAY_RIGHT IQ80321_DISPLAY_RIGHT_ADDR
|
114 |
|
|
|
115 |
|
|
#define DISPLAY_0 0x03
|
116 |
|
|
#define DISPLAY_1 0x9f
|
117 |
|
|
#define DISPLAY_2 0x25
|
118 |
|
|
#define DISPLAY_3 0x0d
|
119 |
|
|
#define DISPLAY_4 0x99
|
120 |
|
|
#define DISPLAY_5 0x49
|
121 |
|
|
#define DISPLAY_6 0x41
|
122 |
|
|
#define DISPLAY_7 0x1f
|
123 |
|
|
#define DISPLAY_8 0x01
|
124 |
|
|
#define DISPLAY_9 0x19
|
125 |
|
|
#define DISPLAY_A 0x11
|
126 |
|
|
#define DISPLAY_B 0xc1
|
127 |
|
|
#define DISPLAY_C 0x63
|
128 |
|
|
#define DISPLAY_D 0x85
|
129 |
|
|
#define DISPLAY_E 0x61
|
130 |
|
|
#define DISPLAY_F 0x71
|
131 |
|
|
#define DISPLAY_G 0x43 /* 0100001-1 */
|
132 |
|
|
#define DISPLAY_H 0x91 /* 1001000-1 */
|
133 |
|
|
#define DISPLAY_I 0xf3 /* 1111001-1 */
|
134 |
|
|
#define DISPLAY_J 0x8f /* 1000111-1 */
|
135 |
|
|
#define DISPLAY_K 0x90 /* 1001000-0 *//* cannot do a K, H with a decimal point */
|
136 |
|
|
#define DISPLAY_L 0xe3 /* 1110001-1 */
|
137 |
|
|
#define DISPLAY_M 0x7e /* 0111111-0 *//* Cannot do an M, overscore with the decimal point */
|
138 |
|
|
#define DISPLAY_N 0x13 /* 0001001-1 */
|
139 |
|
|
#define DISPLAY_O 0x03 /* 0000001-1 */
|
140 |
|
|
#define DISPLAY_P 0x31 /* 0011000-1 */
|
141 |
|
|
#define DISPLAY_Q 0x02 /* 0000001-0 */
|
142 |
|
|
#define DISPLAY_R 0x10 /* 0001000-0 *//* same as an "A", except with the decimal point */
|
143 |
|
|
#define DISPLAY_S 0x48 /* 0100100-0 *//* same as a "5", except with the decimal point */
|
144 |
|
|
#define DISPLAY_T 0x1e /* 0001111-0 *//* same as a "7", except with the decimal point */
|
145 |
|
|
#define DISPLAY_U 0x13 /* 1000001-1 */
|
146 |
|
|
#define DISPLAY_V 0x82 /* 1000001-0 *//* same as a "U", except with the decimal point */
|
147 |
|
|
#define DISPLAY_W 0xee /* 1110111-0 *//* Cannot do an W, underscore with the decimal point */
|
148 |
|
|
#define DISPLAY_X 0xb0 /* 1011000-0 *//* cannot do an X, upside-down h, with decimal point */
|
149 |
|
|
#define DISPLAY_Y 0x8b /* 1000101-1 */
|
150 |
|
|
#define DISPLAY_Z 0x6c /* 0110110-0 *//* cannot do a Z, dash/dash/dash with decimal point */
|
151 |
|
|
|
152 |
|
|
#define DISPLAY_OFF 0xff /* 1111111-1 */
|
153 |
|
|
#define DISPLAY_ON 0x00 /* 0000000-0 */
|
154 |
|
|
|
155 |
|
|
#define DISPLAY_SPACE 0xff /* 1111111-1 */
|
156 |
|
|
#define DISPLAY_ERROR 0x60 /* 0110000-0 */
|
157 |
|
|
#define DISPLAY_UNDERSCORE 0xef /* 1110111-1 */
|
158 |
|
|
#define DISPLAY_DASH 0xfd /* 1111110-1 */
|
159 |
|
|
#define DISPLAY_PERIOD 0xfe /* 1111111-0 */
|
160 |
|
|
#define DISPLAY_EXCLAMATION 0x9e /* 1001111-0 */
|
161 |
|
|
|
162 |
|
|
#ifdef __ASSEMBLER__
|
163 |
|
|
// Display 'lvalue:rvalue' on the hex display
|
164 |
|
|
// lvalue and rvalue must be of the form 'DISPLAY_x'
|
165 |
|
|
// where 'x' is a hex digit from 0-F.
|
166 |
|
|
.macro HEX_DISPLAY reg0, reg1, lvalue, rvalue
|
167 |
|
|
ldr \reg0, =DISPLAY_LEFT // display left digit
|
168 |
|
|
ldr \reg1, =\lvalue
|
169 |
|
|
strb \reg1, [\reg0]
|
170 |
|
|
ldr \reg0, =DISPLAY_RIGHT
|
171 |
|
|
ldr \reg1, =\rvalue // display right digit
|
172 |
|
|
strb \reg1, [\reg0]
|
173 |
|
|
#if 0
|
174 |
|
|
// delay
|
175 |
|
|
ldr \reg0, =0x7800000
|
176 |
|
|
mov \reg1, #0
|
177 |
|
|
0:
|
178 |
|
|
add \reg1, \reg1, #1
|
179 |
|
|
cmp \reg1, \reg0
|
180 |
|
|
ble 0b
|
181 |
|
|
#endif
|
182 |
|
|
.endm
|
183 |
|
|
|
184 |
|
|
.macro REG_DISPLAY reg0, reg1, reg2
|
185 |
|
|
b 667f
|
186 |
|
|
666:
|
187 |
|
|
.byte DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3
|
188 |
|
|
.byte DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7
|
189 |
|
|
.byte DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B
|
190 |
|
|
.byte DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F
|
191 |
|
|
667:
|
192 |
|
|
ldr \reg0, =666b
|
193 |
|
|
add \reg0, \reg0, \reg2, lsr #4
|
194 |
|
|
ldrb \reg1, [\reg0]
|
195 |
|
|
ldr \reg0, =DISPLAY_LEFT
|
196 |
|
|
str \reg1, [\reg0]
|
197 |
|
|
ldr \reg0, =666b
|
198 |
|
|
and \reg2, \reg2, #0xf
|
199 |
|
|
add \reg0, \reg0, \reg2
|
200 |
|
|
ldrb \reg1, [\reg0]
|
201 |
|
|
ldr \reg0, =DISPLAY_RIGHT
|
202 |
|
|
str \reg1, [\reg0]
|
203 |
|
|
|
204 |
|
|
// delay
|
205 |
|
|
ldr \reg0, =0x7800000
|
206 |
|
|
mov \reg1, #0
|
207 |
|
|
0:
|
208 |
|
|
add \reg1, \reg1, #1
|
209 |
|
|
cmp \reg1, \reg0
|
210 |
|
|
ble 0b
|
211 |
|
|
.endm
|
212 |
|
|
#else
|
213 |
|
|
static inline void HEX_DISPLAY(int lval, int rval)
|
214 |
|
|
{
|
215 |
|
|
int i;
|
216 |
|
|
static unsigned char hchars[] = {
|
217 |
|
|
DISPLAY_0, DISPLAY_1, DISPLAY_2, DISPLAY_3,
|
218 |
|
|
DISPLAY_4, DISPLAY_5, DISPLAY_6, DISPLAY_7,
|
219 |
|
|
DISPLAY_8, DISPLAY_9, DISPLAY_A, DISPLAY_B,
|
220 |
|
|
DISPLAY_C, DISPLAY_D, DISPLAY_E, DISPLAY_F
|
221 |
|
|
};
|
222 |
|
|
volatile unsigned int *ldisp = (volatile unsigned int *)DISPLAY_LEFT;
|
223 |
|
|
volatile unsigned int *rdisp = (volatile unsigned int *)DISPLAY_RIGHT;
|
224 |
|
|
|
225 |
|
|
*ldisp = hchars[lval & 0xf];
|
226 |
|
|
*rdisp = hchars[rval & 0xf];
|
227 |
|
|
|
228 |
|
|
for (i = 0; i < 0x10000000; i++);
|
229 |
|
|
}
|
230 |
|
|
#endif // __ASSEMBLER__
|
231 |
|
|
|
232 |
|
|
// ------------------------------------------------------------------------
|
233 |
|
|
|
234 |
|
|
#endif // CYGONCE_HAL_ARM_XSCALE_IQ80321_IQ80321_H
|
235 |
|
|
// EOF iq80321.h
|