1 |
27 |
unneback |
#ifndef CYGONCE_HAL_ARM_VAR_IO_H
|
2 |
|
|
#define CYGONCE_HAL_ARM_VAR_IO_H
|
3 |
|
|
|
4 |
|
|
/*=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// var_io.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 Red Hat, Inc.
|
15 |
|
|
// Copyright (C) 2002 Gary Thomas
|
16 |
|
|
//
|
17 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
18 |
|
|
// the terms of the GNU General Public License as published by the Free
|
19 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
22 |
|
|
// 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 along
|
27 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
31 |
|
|
// or inline functions from this file, or you compile this file and link it
|
32 |
|
|
// with other works to produce a work based on this file, this file does not
|
33 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
34 |
|
|
// License. However the source code for this file must still be made available
|
35 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
38 |
|
|
// this file might be covered by the GNU General Public License.
|
39 |
|
|
//
|
40 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
41 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
42 |
|
|
// -------------------------------------------
|
43 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
44 |
|
|
//=============================================================================
|
45 |
|
|
//#####DESCRIPTIONBEGIN####
|
46 |
|
|
//
|
47 |
|
|
// Author(s): jskov
|
48 |
|
|
// Contributors: jskov, gthomas
|
49 |
|
|
// Date: 2002-01-28
|
50 |
|
|
// Purpose: Platform specific support routines
|
51 |
|
|
// Description:
|
52 |
|
|
// Usage: #include <cyg/hal/hal_io.h>
|
53 |
|
|
//
|
54 |
|
|
//####DESCRIPTIONEND####
|
55 |
|
|
//
|
56 |
|
|
//===========================================================================*/
|
57 |
|
|
|
58 |
|
|
#include <pkgconf/hal_arm_xscale_iop310.h>
|
59 |
|
|
|
60 |
|
|
#include <cyg/hal/hal_iop310.h>
|
61 |
|
|
|
62 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
63 |
|
|
#include <cyg/hal/hal_intr.h> // Interrupt vectors
|
64 |
|
|
|
65 |
|
|
#include <cyg/hal/plf_io.h>
|
66 |
|
|
|
67 |
|
|
extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus,
|
68 |
|
|
cyg_uint32 devfn,
|
69 |
|
|
cyg_uint32 offset);
|
70 |
|
|
extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus,
|
71 |
|
|
cyg_uint32 devfn,
|
72 |
|
|
cyg_uint32 offset);
|
73 |
|
|
extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus,
|
74 |
|
|
cyg_uint32 devfn,
|
75 |
|
|
cyg_uint32 offset);
|
76 |
|
|
extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus,
|
77 |
|
|
cyg_uint32 devfn,
|
78 |
|
|
cyg_uint32 offset,
|
79 |
|
|
cyg_uint32 val);
|
80 |
|
|
extern void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus,
|
81 |
|
|
cyg_uint32 devfn,
|
82 |
|
|
cyg_uint32 offset,
|
83 |
|
|
cyg_uint16 val);
|
84 |
|
|
extern void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus,
|
85 |
|
|
cyg_uint32 devfn,
|
86 |
|
|
cyg_uint32 offset,
|
87 |
|
|
cyg_uint8 val);
|
88 |
|
|
|
89 |
|
|
/* primary PCI bus definitions */
|
90 |
|
|
#ifndef PRIMARY_MEM_BASE
|
91 |
|
|
#define PRIMARY_BUS_NUM 0
|
92 |
|
|
#define PRIMARY_MEM_BASE 0x80000000
|
93 |
|
|
#define PRIMARY_DAC_BASE 0x84000000
|
94 |
|
|
#define PRIMARY_IO_BASE 0x90000000
|
95 |
|
|
#define PRIMARY_MEM_LIMIT 0x83ffffff
|
96 |
|
|
#define PRIMARY_DAC_LIMIT 0x87ffffff
|
97 |
|
|
#define PRIMARY_IO_LIMIT 0x9000ffff
|
98 |
|
|
#endif
|
99 |
|
|
|
100 |
|
|
/* secondary PCI bus definitions */
|
101 |
|
|
#ifndef SECONDARY_MEM_BASE
|
102 |
|
|
#define SECONDARY_BUS_NUM 1
|
103 |
|
|
#define SECONDARY_MEM_BASE 0x88000000
|
104 |
|
|
#define SECONDARY_DAC_BASE 0x8c000000
|
105 |
|
|
#define SECONDARY_IO_BASE 0x90010000
|
106 |
|
|
#define SECONDARY_MEM_LIMIT 0x8bffffff
|
107 |
|
|
#define SECONDARY_DAC_LIMIT 0x8fffffff
|
108 |
|
|
#define SECONDARY_IO_LIMIT 0x9001ffff
|
109 |
|
|
#endif
|
110 |
|
|
|
111 |
|
|
// Initialize the PCI bus.
|
112 |
|
|
externC void cyg_hal_plf_pci_init(void);
|
113 |
|
|
#define HAL_PCI_INIT() cyg_hal_plf_pci_init()
|
114 |
|
|
|
115 |
|
|
// Read a value from the PCI configuration space of the appropriate
|
116 |
|
|
// size at an address composed from the bus, devfn and offset.
|
117 |
|
|
#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \
|
118 |
|
|
__val = cyg_hal_plf_pci_cfg_read_byte((__bus), (__devfn), (__offset))
|
119 |
|
|
|
120 |
|
|
#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \
|
121 |
|
|
__val = cyg_hal_plf_pci_cfg_read_word((__bus), (__devfn), (__offset))
|
122 |
|
|
|
123 |
|
|
#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \
|
124 |
|
|
__val = cyg_hal_plf_pci_cfg_read_dword((__bus), (__devfn), (__offset))
|
125 |
|
|
|
126 |
|
|
// Write a value to the PCI configuration space of the appropriate
|
127 |
|
|
// size at an address composed from the bus, devfn and offset.
|
128 |
|
|
#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \
|
129 |
|
|
cyg_hal_plf_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val))
|
130 |
|
|
|
131 |
|
|
#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \
|
132 |
|
|
cyg_hal_plf_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val))
|
133 |
|
|
|
134 |
|
|
#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \
|
135 |
|
|
cyg_hal_plf_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val))
|
136 |
|
|
|
137 |
|
|
//-----------------------------------------------------------------------------
|
138 |
|
|
// Resources
|
139 |
|
|
|
140 |
|
|
// Map PCI device resources starting from these addresses in PCI space.
|
141 |
|
|
#ifndef HAL_PCI_ALLOC_BASE_MEMORY
|
142 |
|
|
#define HAL_PCI_ALLOC_BASE_MEMORY (SECONDARY_MEM_BASE)
|
143 |
|
|
#define HAL_PCI_ALLOC_BASE_IO (SECONDARY_IO_BASE)
|
144 |
|
|
#endif
|
145 |
|
|
|
146 |
|
|
// This is where the PCI spaces are mapped in the CPU's address space.
|
147 |
|
|
#ifndef HAL_PCI_PHYSICAL_MEMORY_BASE
|
148 |
|
|
#define HAL_PCI_PHYSICAL_MEMORY_BASE 0x00000000
|
149 |
|
|
#define HAL_PCI_PHYSICAL_IO_BASE 0x00000000
|
150 |
|
|
#endif
|
151 |
|
|
|
152 |
|
|
|
153 |
|
|
// Some of SDRAM is aliased as uncached memory for drivers.
|
154 |
|
|
#ifndef CYGARC_UNCACHED_ADDRESS
|
155 |
|
|
#define CYGARC_UNCACHED_ADDRESS(_x_) \
|
156 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (unsigned long)(_x_))
|
157 |
|
|
#endif
|
158 |
|
|
#ifndef CYGARC_VIRT_TO_BUS
|
159 |
|
|
#define CYGARC_VIRT_TO_BUS(_x_) \
|
160 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (unsigned long)(_x_) : (((unsigned long)(_x_))&~0x40000000))
|
161 |
|
|
#endif
|
162 |
|
|
#ifndef CYGARC_BUS_TO_VIRT
|
163 |
|
|
#define CYGARC_BUS_TO_VIRT(_x_) \
|
164 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (_x_))
|
165 |
|
|
#endif
|
166 |
|
|
|
167 |
|
|
#ifndef CYGARC_PHYSICAL_ADDRESS
|
168 |
|
|
#define CYGARC_PHYSICAL_ADDRESS(x) (x)
|
169 |
|
|
#endif
|
170 |
|
|
|
171 |
|
|
#endif // CYGONCE_HAL_ARM_VAR_IO_H
|
172 |
|
|
// EOF var_io.h
|