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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [mips/] [atlas/] [v2_0/] [include/] [plf_io.h] - Blame information for rev 379

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
#ifndef CYGONCE_PLF_IO_H
2
#define CYGONCE_PLF_IO_H
3
 
4
//=============================================================================
5
//
6
//      plf_io.h
7
//
8
//      Platform specific IO support
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 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):    dmoseley
47
// Contributors: dmoseley
48
// Date:         2000-06-06
49
// Purpose:      Atlas platform IO support
50
// Description: 
51
// Usage:        #include <cyg/hal/plf_io.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//=============================================================================
56
 
57
#include <pkgconf/hal.h>
58
#include <cyg/hal/hal_misc.h>
59
 
60
#ifdef __ASSEMBLER__
61
#define HAL_REG(x)              x
62
#else
63
#define HAL_REG(x)              (volatile CYG_WORD *)(x)
64
#endif
65
 
66
//-----------------------------------------------------------------------------
67
 
68
/* Atlas Memory Definitions */
69
#define HAL_ATLAS_RAM_BASE                      0x00000000
70
#define HAL_ATLAS_PCI_MEM0_BASE                 0x08000000
71
#define HAL_ATLAS_PCI_MEM0_SIZE                 0x08000000  // 128 MB
72
#define HAL_ATLAS_PCI_MEM1_BASE                 0x10000000
73
#define HAL_ATLAS_PCI_MEM1_SIZE                 0x08000000  // 128 MB
74
#define HAL_ATLAS_PCI_IO_BASE                   0x18000000
75
#define HAL_ATLAS_PCI_IO_SIZE                   0x03E00000  //  62 MB
76
#define HAL_ATLAS_CONTROLLER_BASE               0x1BE00000
77
#define HAL_ATLAS_CONTROLLER_BASE_ISD_CONFIG    (HAL_ATLAS_CONTROLLER_BASE >> 21)
78
#define HAL_ATLAS_FLASH_BASE                    0x1C000000
79
#define HAL_ATLAS_FLASH_SIZE                    SZ_32M
80
#define HAL_ATLAS_MAX_BANKSIZE                  SZ_512M
81
 
82
#define HAL_ATLAS_NULL_DEVNUM                   0x0
83
#define HAL_ATLAS_SAA9730_DEVNUM                0x9800
84
#define HAL_ATLAS_MEMERROR                      1
85
 
86
/* Atlas Registers */
87
#define HAL_ATLAS_REGISTER_BASE                 0xBF000000
88
 
89
#define HAL_ATLAS_INTBASE                       HAL_ATLAS_REGISTER_BASE
90
 
91
#define HAL_ATLAS_INTRAW_OFFSET                 0x00000000
92
#define HAL_ATLAS_INTSETEN_OFFSET               0x00000008
93
#define HAL_ATLAS_INTRSTEN_OFFSET               0x00000010
94
#define HAL_ATLAS_INTENABLE_OFFSET              0x00000018
95
#define HAL_ATLAS_INTSTATUS_OFFSET              0x00000020
96
 
97
#define HAL_ATLAS_INTRAW                        HAL_REG(HAL_ATLAS_INTBASE + HAL_ATLAS_INTRAW_OFFSET)
98
#define HAL_ATLAS_INTSETEN                      HAL_REG(HAL_ATLAS_INTBASE + HAL_ATLAS_INTSETEN_OFFSET)
99
#define HAL_ATLAS_INTRSTEN                      HAL_REG(HAL_ATLAS_INTBASE + HAL_ATLAS_INTRSTEN_OFFSET)
100
#define HAL_ATLAS_INTENABLE                     HAL_REG(HAL_ATLAS_INTBASE + HAL_ATLAS_INTENABLE_OFFSET)
101
#define HAL_ATLAS_INTSTATUS                     HAL_REG(HAL_ATLAS_INTBASE + HAL_ATLAS_INTSTATUS_OFFSET)
102
 
103
 
104
#define HAL_ATLAS_NMISTATUS_OFFSET              0x00000024
105
#define HAL_ATLAS_NMIACK_OFFSET                 0x00000104
106
#define HAL_ATLAS_SOFTRES_OFFSET                0x00000500
107
#define HAL_ATLAS_BRKRES_OFFSET                 0x00000508
108
#define HAL_ATLAS_REVISION_OFFSET               0x00C00010
109
 
110
#define HAL_ATLAS_NMISTATUS                     HAL_REG(HAL_ATLAS_REGISTER_BASE + HAL_ATLAS_NMISTATUS_OFFSET)
111
#define HAL_ATLAS_NMIACK                        HAL_REG(HAL_ATLAS_REGISTER_BASE + HAL_ATLAS_NMIACK_OFFSET)
112
#define HAL_ATLAS_SOFTRES                       HAL_REG(HAL_ATLAS_REGISTER_BASE + HAL_ATLAS_SOFTRES_OFFSET)
113
#define HAL_ATLAS_BRKRES                        HAL_REG(HAL_ATLAS_REGISTER_BASE + HAL_ATLAS_BRKRES_OFFSET)
114
#define HAL_ATLAS_REVISION                      HAL_REG(HAL_ATLAS_REGISTER_BASE + HAL_ATLAS_REVISION_OFFSET)
115
 
116
/* Atlas NMI controller fields */
117
#define HAL_ATLAS_NMISTATUS_FLAG                0x00000001
118
#define HAL_ATLAS_NMIACK_FLAG                   0x00000001
119
 
120
/* Atlas softreset fields */
121
#define HAL_ATLAS_GORESET                       0x42
122
 
123
/* Atlas brkreset fields */
124
#define HAL_ATLAS_BRKRES_DEFAULT_VALUE          0xA
125
 
126
/* Galileo Registers */
127
#define HAL_GALILEO_REGISTER_BASE               0xB4000000
128
#define HAL_GALILEO_PCI0_MEM0_BASE              0xB2000000
129
 
130
#define HAL_GALILEO_CPU_INTERFACE_CONFIG_OFFSET 0x0
131
#define HAL_GALILEO_INT_SPACE_DECODE_OFFSET     0x68
132
#define HAL_GALILEO_CS3_HIGH_DECODE_OFFSET      0x43c
133
#define HAL_GALILEO_CSBOOT_LOW_DECODE_OFFSET    0x440
134
#define HAL_GALILEO_CSBOOT_HIGH_DECODE_OFFSET   0x444
135
 
136
/* Galileo CPU Interface config fields */
137
#define HAL_GALILEO_BYTE_SWAP                   (BIT16 | BIT0)
138
 
139
#define HAL_GALILEO_CACHEOPMAP_MASK             0x000001FF
140
#define HAL_GALILEO_CACHEPRES_MASK              0x00000200
141
#define HAL_GALILEO_WRITEMODE_MASK              0x00000800
142
#define HAL_GALILEO_ENDIAN_MASK                 0x00001000
143
#define HAL_GALILEO_R5KL2_MASK                  0x00004000
144
#define HAL_GALILEO_EXT_HIT_DELAY_MASK          0x00008000
145
#define HAL_GALILEO_CPU_WRITERATE_MASK          0x00010000
146
#define HAL_GALILEO_STOP_RETRY_MASK             0x00020000
147
#define HAL_GALILEO_MULTI_GT_MASK               0x00040000
148
#define HAL_GALILEO_SYSADCVALID_MASK            0x00080000
149
 
150
/* Galileo Memory Controller registers */
151
#define HAL_GALILEO_SDRAM_DUPLICATE_BANK_ADDR   BIT20
152
#define HAL_GALILEO_SDRAM_BANK_INTERLEAVE_DIS   BIT14
153
#define HAL_GALILEO_CPU_DECODE_SHIFT            21
154
#define HAL_GALILEO_DEV_DECODE_SHIFT            20
155
#define HAL_GALILEO_SDRAM_SRAS_TO_SCAS_DELAY_3C BIT10
156
#define HAL_GALILEO_SDRAM_WIDTH_64BIT           BIT6
157
#define HAL_GALILEO_SDRAM_SRAS_PRECHARGE_3C     BIT3
158
#define HAL_GALILEO_SDRAM_BANK0_CASLAT_2        BIT0
159
#define HAL_GALILEO_SDRAM_BANK0_SZ_64M          BIT11
160
#define HAL_GALILEO_SDRAM_NUM_BANKS_4           BIT5
161
#define HAL_GALILEO_SDRAM_BANK0_PARITY          BIT8
162
#define HAL_GALILEO_SDRAM_CFG_RAM_WIDTH         BIT15
163
#define HAL_GALILEO_PCI0_CONFIG_ADDR_ConfigEn   BIT31
164
#define HAL_GALILEO_PCI0_STATUS_COMMAND_REGNUM  0x04
165
#define HAL_GALILEO_PCI0_BIST_REGNUM            0x0C
166
#define HAL_GALILEO_PCI0_SCS32_BASE_REGNUM      0x14
167
#define HAL_GALILEO_PCI0_CONFIG_MEMEn           0x2
168
#define HAL_GALILEO_PCI0_CONFIG_MasEn           0x4
169
#define HAL_GALILEO_PCI0_CONFIG_SErrEn          0x100
170
#define HAL_GALILEO_PCI0_LAT_TIMER_VAL          0x800
171
#define HAL_GALILEO_PCI0_TIMEOUT_RETRY_VALUE    0x00ffffff
172
 
173
#define HAL_GALILEO_SDRAM_BANK0_OFFSET          0x44c
174
#define HAL_GALILEO_SDRAM_BANK2_OFFSET          0x454
175
#define HAL_GALILEO_SDRAM_CONFIG_OFFSET         0x448
176
 
177
#define HAL_GALILEO_SCS10_LD_OFFSET             0x008
178
#define HAL_GALILEO_SCS10_HD_OFFSET             0x010
179
#define HAL_GALILEO_SCS32_LD_OFFSET             0x018
180
#define HAL_GALILEO_SCS32_HD_OFFSET             0x020
181
#define HAL_GALILEO_CS20_LD_OFFSET              0x028
182
#define HAL_GALILEO_CS20_HD_OFFSET              0x030
183
#define HAL_GALILEO_PCIIO_LD_OFFSET             0x048
184
#define HAL_GALILEO_PCIIO_HD_OFFSET             0x050
185
#define HAL_GALILEO_PCIMEM0_LD_OFFSET           0x058
186
#define HAL_GALILEO_PCIMEM0_HD_OFFSET           0x060
187
#define HAL_GALILEO_PCIMEM1_LD_OFFSET           0x080
188
#define HAL_GALILEO_PCIMEM1_HD_OFFSET           0x088
189
#define HAL_GALILEO_PCI1IO_LD_OFFSET            0x090
190
#define HAL_GALILEO_PCI1IO_HD_OFFSET            0x098
191
#define HAL_GALILEO_PCI1MEM0_LD_OFFSET          0x0a0
192
#define HAL_GALILEO_PCI1MEM0_HD_OFFSET          0x0a8
193
#define HAL_GALILEO_PCI1MEM1_LD_OFFSET          0x0b0
194
#define HAL_GALILEO_PCI1MEM1_HD_OFFSET          0x0b8
195
#define HAL_GALILEO_SCS0_LD_OFFSET              0x400
196
#define HAL_GALILEO_SCS0_HD_OFFSET              0x404
197
#define HAL_GALILEO_SCS1_LD_OFFSET              0x408
198
#define HAL_GALILEO_SCS1_HD_OFFSET              0x40c
199
#define HAL_GALILEO_SCS2_LD_OFFSET              0x410
200
#define HAL_GALILEO_SCS2_HD_OFFSET              0x414
201
#define HAL_GALILEO_SCS3_LD_OFFSET              0x418
202
#define HAL_GALILEO_SCS3_HD_OFFSET              0x41c
203
#define HAL_GALILEO_CS0_LD_OFFSET               0x420
204
#define HAL_GALILEO_CS0_HD_OFFSET               0x424
205
#define HAL_GALILEO_CS1_LD_OFFSET               0x428
206
#define HAL_GALILEO_CS1_HD_OFFSET               0x42c
207
#define HAL_GALILEO_CS2_LD_OFFSET               0x430
208
#define HAL_GALILEO_CS2_HD_OFFSET               0x434
209
 
210
// GALILEO PCI Internal
211
#define HAL_GALILEO_PCI_INTERNAL_COMMAND_OFFSET 0xC00
212
#define HAL_GALILEO_PCI0_TIMEOUT_RETRY_OFFSET   0xc04
213
#define HAL_GALILEO_PCI0_SCS10_SIZE_OFFSET      0xc08
214
#define HAL_GALILEO_PCI0_SCS32_SIZE_OFFSET      0xc0c
215
#define HAL_GALILEO_PCI0_SCS20_SIZE_OFFSET      0xc10
216
#define HAL_GALILEO_PCI0_CS3_SIZE_OFFSET        0xc14
217
#define HAL_GALILEO_BAR_ENA_OFFSET              0xc3c
218
#  define HAL_GALILEO_BAR_ENA_SWCS3  (1 << 0)
219
#  define HAL_GALILEO_BAR_ENA_SWCS32 (1 << 1)
220
#  define HAL_GALILEO_BAR_ENA_SWCS10 (1 << 2)
221
#  define HAL_GALILEO_BAR_ENA_IO     (1 << 3)
222
#  define HAL_GALILEO_BAR_ENA_MEM    (1 << 4)
223
#  define HAL_GALILEO_BAR_ENA_CS3    (1 << 5)
224
#  define HAL_GALILEO_BAR_ENA_CS20   (1 << 6)
225
#  define HAL_GALILEO_BAR_ENA_SCS32  (1 << 7)
226
#  define HAL_GALILEO_BAR_ENA_SCS10  (1 << 8)
227
#define HAL_GALILEO_PCI0_CONFIG_ADDR_OFFSET     0xcf8
228
#  define HAL_GALILEO_PCI0_CONFIG_ADDR_ENABLE (1 << 31)
229
#define HAL_GALILEO_PCI0_CONFIG_DATA_OFFSET     0xcfc
230
 
231
// GALILEO Interrupts
232
#define HAL_GALILEO_IRQ_CAUSE_OFFSET            0xc18
233
#  define HAL_GALILEO_IRQCAUSE_INTSUM   (1 << 0)
234
#  define HAL_GALILEO_IRQCAUSE_MEMOUT   (1 << 1)
235
#  define HAL_GALILEO_IRQCAUSE_DMAOUT   (1 << 2)
236
#  define HAL_GALILEO_IRQCAUSE_CPUOUT   (1 << 3)
237
#  define HAL_GALILEO_IRQCAUSE_DMA0     (1 << 4)
238
#  define HAL_GALILEO_IRQCAUSE_DMA1     (1 << 5)
239
#  define HAL_GALILEO_IRQCAUSE_DMA2     (1 << 6)
240
#  define HAL_GALILEO_IRQCAUSE_DMA3     (1 << 7)
241
#  define HAL_GALILEO_IRQCAUSE_T0       (1 << 8)
242
#  define HAL_GALILEO_IRQCAUSE_T1       (1 << 9)
243
#  define HAL_GALILEO_IRQCAUSE_T2       (1 << 10)
244
#  define HAL_GALILEO_IRQCAUSE_T3       (1 << 11)
245
#  define HAL_GALILEO_IRQCAUSE_MASRD    (1 << 12)
246
#  define HAL_GALILEO_IRQCAUSE_SLVWR    (1 << 13)
247
#  define HAL_GALILEO_IRQCAUSE_MASWR    (1 << 14)
248
#  define HAL_GALILEO_IRQCAUSE_SLVRD    (1 << 15)
249
#  define HAL_GALILEO_IRQCAUSE_AERR     (1 << 16)
250
#  define HAL_GALILEO_IRQCAUSE_MERR     (1 << 17)
251
#  define HAL_GALILEO_IRQCAUSE_MASABT   (1 << 18)
252
#  define HAL_GALILEO_IRQCAUSE_TARABT   (1 << 19)
253
#  define HAL_GALILEO_IRQCAUSE_RETRY    (1 << 20)
254
#  define HAL_GALILEO_IRQCAUSE_CPUSUM   (1 << 30)
255
#  define HAL_GALILEO_IRQCAUSE_PCISUM   (1 << 31)
256
#define HAL_GALILEO_HIRQ_CAUSE_OFFSET           0xc98
257
#define HAL_GALILEO_CPUIRQ_MASK_OFFSET          0xc1c
258
#define HAL_GALILEO_CPUHIRQ_MASK_OFFSET         0xc9c
259
 
260
#define HAL_SAA9730_I2CSC_I2CCC_6400            0x500
261
#define HAL_SAA9730_I2CTFR_ATTR0_START          0xC
262
#define HAL_SAA9730_I2CTFR_ATTR2_START          0xC0
263
#define HAL_SAA9730_I2CTFR_ATTR2_STOP           0x40
264
#define HAL_SAA9730_I2CTFR_ATTR1_CONT           0x20
265
#define HAL_SAA9730_I2CTFR_OFFSET               0x2400
266
#define HAL_SAA9730_I2CSC_OFFSET                0x2404
267
#define HAL_SAA9730_SYSRESET_OFFSET             0x4020
268
#define   HAL_SAA9730_SYSRESET_ALL 0xdeae
269
 
270
#define HAL_SPD_GET_NUM_ROW_BITS                3
271
#define HAL_SPD_GET_NUM_COL_BITS                4
272
#define HAL_SPD_GET_NUM_MODULE_BANKS            5
273
#define HAL_SPD_GET_CONFIG_TYPE                 11
274
#define HAL_SPD_GET_REFRESH_RATE                12
275
#define HAL_SPD_GET_SDRAM_WIDTH                 13
276
#define HAL_SPD_GET_ERROR_CHECK_WIDTH           14
277
#define HAL_SPD_GET_BURST_LENGTH                16
278
#define HAL_SPD_GET_NUM_DEVICE_BANKS            17
279
#define HAL_SPD_GET_CAS_LAT                     18
280
#define HAL_SPD_GET_ROW_DENSITY                 31
281
#define HAL_SPD_CONFIG_TYPE_PARITY              BIT0
282
#define HAL_SPD_CONFIG_TYPE_ECC                 BIT1
283
#define HAL_SPD_REFRESH_RATE_125                5
284
#define HAL_SPD_REFRESH_RATE_62_5               4
285
#define HAL_SPD_REFRESH_RATE_31_3               3
286
#define HAL_SPD_REFRESH_RATE_15_625             0
287
#define HAL_SPD_REFRESH_RATE_7_8                2
288
#define HAL_SPD_REFRESH_RATE_3_9                1
289
 
290
#define HAL_SPD_REFRESH_COUNTER_125             (125*2)
291
#define HAL_SPD_REFRESH_COUNTER_62_5            (62*2)
292
#define HAL_SPD_REFRESH_COUNTER_31_3            (31*2)
293
#define HAL_SPD_REFRESH_COUNTER_15_625          (15*2)
294
#define HAL_SPD_REFRESH_COUNTER_7_8             (7*2)
295
#define HAL_SPD_REFRESH_COUNTER_3_9             (3*2)
296
 
297
/* Atlas Display Registers */
298
#define HAL_DISPLAY_BASE                        (HAL_ATLAS_REGISTER_BASE + 0x400)
299
 
300
#define HAL_DISPLAY_LEDGREEN_OFFSET             0x00
301
#define HAL_DISPLAY_LEDBAR_OFFSET               0x08
302
#define HAL_DISPLAY_ASCIIWORD_OFFSET            0x10
303
#define HAL_DISPLAY_ASCIIPOS0_OFFSET            0x18
304
#define HAL_DISPLAY_ASCIIPOS1_OFFSET            0x20
305
#define HAL_DISPLAY_ASCIIPOS2_OFFSET            0x28
306
#define HAL_DISPLAY_ASCIIPOS3_OFFSET            0x30
307
#define HAL_DISPLAY_ASCIIPOS4_OFFSET            0x38
308
#define HAL_DISPLAY_ASCIIPOS5_OFFSET            0x40
309
#define HAL_DISPLAY_ASCIIPOS6_OFFSET            0x48
310
#define HAL_DISPLAY_ASCIIPOS7_OFFSET            0x50
311
 
312
#define HAL_DISPLAY_LEDGREEN                    HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_LEDGREEN_OFFSET)
313
#define HAL_DISPLAY_LEDBAR                      HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_LEDBAR_OFFSET)
314
#define HAL_DISPLAY_ASCIIWORD                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIWORD_OFFSET)
315
#define HAL_DISPLAY_ASCIIPOS0                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS0_OFFSET)
316
#define HAL_DISPLAY_ASCIIPOS1                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS1_OFFSET)
317
#define HAL_DISPLAY_ASCIIPOS2                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS2_OFFSET)
318
#define HAL_DISPLAY_ASCIIPOS3                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS3_OFFSET)
319
#define HAL_DISPLAY_ASCIIPOS4                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS4_OFFSET)
320
#define HAL_DISPLAY_ASCIIPOS5                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS5_OFFSET)
321
#define HAL_DISPLAY_ASCIIPOS6                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS6_OFFSET)
322
#define HAL_DISPLAY_ASCIIPOS7                   HAL_REG(HAL_DISPLAY_BASE + HAL_DISPLAY_ASCIIPOS7_OFFSET)
323
 
324
#ifdef __ASSEMBLER__
325
 
326
#  define DEBUG_ASCII_DISPLAY(register, character)             \
327
        li      k0, CYGARC_UNCACHED_ADDRESS(register);                 \
328
        li      k1, character;                                         \
329
        sw      k1, 0(k0);                                             \
330
    nop;                                                       \
331
    nop;                                                       \
332
    nop
333
 
334
#  define DEBUG_LED_IMM(val)                                   \
335
    li k0, HAL_DISPLAY_LEDBAR;                                 \
336
    li k1, val;                                                \
337
    sw k1, 0(k0)
338
 
339
#  define DEBUG_LED_REG(reg)                                   \
340
    li k0, HAL_DISPLAY_LEDBAR;                                 \
341
    sw reg, 0(k0)
342
 
343
#  define DEBUG_HEX_DISPLAY_IMM(val)                           \
344
    li k0, HAL_DISPLAY_ASCIIWORD;                              \
345
    li k1, val;                                                \
346
    sw k1, 0(k0)
347
 
348
#  define DEBUG_HEX_DISPLAY_REG(reg)                           \
349
    li k0, HAL_DISPLAY_ASCIIWORD;                              \
350
    sw reg, 0(k0)
351
 
352
#  define DEBUG_DELAY()                                        \
353
     li k0, 0x20000;                                           \
354
0:        sub k0, k0, 1;                                            \
355
     bnez k0, 0b;                                              \
356
     nop
357
 
358
#else
359
 
360
#  define DEBUG_ASCII_DISPLAY(register, character)             \
361
    *(register) = character
362
 
363
#  define DEBUG_LED_IMM(val)                                   \
364
    *HAL_DISPLAY_LEDBAR = val
365
 
366
#  define DEBUG_HEX_DISPLAY_IMM(val)                           \
367
    *HAL_DISPLAY_ASCIIWORD = val
368
 
369
#  define DEBUG_DELAY()                                        \
370
   {                                                           \
371
     volatile int i = 0x20000;                                 \
372
     while (--i) ;                                             \
373
   }
374
 
375
#  define DEBUG_DISPLAY(str)                                   \
376
   {                                                           \
377
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS0, str[0]);       \
378
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS1, str[1]);       \
379
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS2, str[2]);       \
380
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS3, str[3]);       \
381
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS4, str[4]);       \
382
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS5, str[5]);       \
383
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS6, str[6]);       \
384
     DEBUG_ASCII_DISPLAY(HAL_DISPLAY_ASCIIPOS7, str[7]);       \
385
   }
386
 
387
 
388
#define HAL_GALILEO_PUTREG(x,y) \
389
    (*((volatile unsigned *)(CYGARC_UNCACHED_ADDRESS(HAL_ATLAS_CONTROLLER_BASE) + (x))) = (y))
390
#define HAL_GALILEO_GETREG(x)   \
391
    (*((volatile unsigned *)(CYGARC_UNCACHED_ADDRESS(HAL_ATLAS_CONTROLLER_BASE) + (x))))
392
 
393
 
394
extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus,
395
                                                  cyg_uint32 devfn,
396
                                                  cyg_uint32 offset);
397
extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word  (cyg_uint32 bus,
398
                                                  cyg_uint32 devfn,
399
                                                  cyg_uint32 offset);
400
extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte   (cyg_uint32 bus,
401
                                                  cyg_uint32 devfn,
402
                                                  cyg_uint32 offset);
403
extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus,
404
                                             cyg_uint32 devfn,
405
                                             cyg_uint32 offset,
406
                                             cyg_uint32 val);
407
extern void cyg_hal_plf_pci_cfg_write_word  (cyg_uint32 bus,
408
                                             cyg_uint32 devfn,
409
                                             cyg_uint32 offset,
410
                                             cyg_uint16 val);
411
extern void cyg_hal_plf_pci_cfg_write_byte   (cyg_uint32 bus,
412
                                              cyg_uint32 devfn,
413
                                              cyg_uint32 offset,
414
                                              cyg_uint8 val);
415
 
416
// Initialize the PCI bus.
417
externC void cyg_hal_plf_pci_init(void);
418
#define HAL_PCI_INIT() cyg_hal_plf_pci_init()
419
 
420
// Map PCI device resources starting from these addresses in PCI space.
421
#define HAL_PCI_ALLOC_BASE_MEMORY 0x08000000
422
#define HAL_PCI_ALLOC_BASE_IO     0x18000000
423
 
424
// This is where the PCI spaces are mapped in the CPU's address space.
425
// 
426
#define HAL_PCI_PHYSICAL_MEMORY_BASE 0xA0000000
427
#define HAL_PCI_PHYSICAL_IO_BASE     0xA0000000
428
 
429
// Read a value from the PCI configuration space of the appropriate
430
// size at an address composed from the bus, devfn and offset.
431
#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val )  \
432
    __val = cyg_hal_plf_pci_cfg_read_byte((__bus),  (__devfn), (__offset))
433
 
434
#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \
435
    __val = cyg_hal_plf_pci_cfg_read_word((__bus),  (__devfn), (__offset))
436
 
437
#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \
438
    __val = cyg_hal_plf_pci_cfg_read_dword((__bus),  (__devfn), (__offset))
439
 
440
// Write a value to the PCI configuration space of the appropriate
441
// size at an address composed from the bus, devfn and offset.
442
#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val )  \
443
    cyg_hal_plf_pci_cfg_write_byte((__bus),  (__devfn), (__offset), (__val))
444
 
445
#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \
446
    cyg_hal_plf_pci_cfg_write_word((__bus),  (__devfn), (__offset), (__val))
447
 
448
#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \
449
    cyg_hal_plf_pci_cfg_write_dword((__bus),  (__devfn), (__offset), (__val))
450
 
451
 
452
// Translate the PCI interrupt requested by the device (INTA#, INTB#,
453
// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector).
454
#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid)          \
455
    CYG_MACRO_START                                                           \
456
    __valid = false;                                                          \
457
    CYG_MACRO_END
458
 
459
 
460
// Galileo GT64120 on MIPS ATLAS requires special processing.
461
// First, it will hang when accessing device 31 on the local bus.
462
// Second, we need to ignore the GT64120 so we can set it up
463
// outside the generic PCI library.
464
#define HAL_PCI_IGNORE_DEVICE(__bus, __dev, __fn) \
465
    ((__bus) == 0 && ((__dev) == 0 || (__dev) == 31))
466
 
467
#endif
468
 
469
 
470
//-----------------------------------------------------------------------------
471
// end of plf_io.h
472
#endif // CYGONCE_PLF_IO_H

powered by: WebSVN 2.1.0

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