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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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