1 |
786 |
skrzyp |
#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 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): jskov
|
46 |
|
|
// Contributors: jskov, gthomas
|
47 |
|
|
// Date: 2002-01-28
|
48 |
|
|
// Purpose: Platform specific support routines
|
49 |
|
|
// Description:
|
50 |
|
|
// Usage: #include <cyg/hal/hal_io.h>
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//===========================================================================*/
|
55 |
|
|
|
56 |
|
|
#include <pkgconf/hal_arm_xscale_iop310.h>
|
57 |
|
|
|
58 |
|
|
#include <cyg/hal/hal_iop310.h>
|
59 |
|
|
|
60 |
|
|
#include <cyg/hal/hal_io.h> // IO macros
|
61 |
|
|
#include <cyg/hal/hal_intr.h> // Interrupt vectors
|
62 |
|
|
|
63 |
|
|
#include <cyg/hal/plf_io.h>
|
64 |
|
|
|
65 |
|
|
extern cyg_uint32 cyg_hal_plf_pci_cfg_read_dword (cyg_uint32 bus,
|
66 |
|
|
cyg_uint32 devfn,
|
67 |
|
|
cyg_uint32 offset);
|
68 |
|
|
extern cyg_uint16 cyg_hal_plf_pci_cfg_read_word (cyg_uint32 bus,
|
69 |
|
|
cyg_uint32 devfn,
|
70 |
|
|
cyg_uint32 offset);
|
71 |
|
|
extern cyg_uint8 cyg_hal_plf_pci_cfg_read_byte (cyg_uint32 bus,
|
72 |
|
|
cyg_uint32 devfn,
|
73 |
|
|
cyg_uint32 offset);
|
74 |
|
|
extern void cyg_hal_plf_pci_cfg_write_dword (cyg_uint32 bus,
|
75 |
|
|
cyg_uint32 devfn,
|
76 |
|
|
cyg_uint32 offset,
|
77 |
|
|
cyg_uint32 val);
|
78 |
|
|
extern void cyg_hal_plf_pci_cfg_write_word (cyg_uint32 bus,
|
79 |
|
|
cyg_uint32 devfn,
|
80 |
|
|
cyg_uint32 offset,
|
81 |
|
|
cyg_uint16 val);
|
82 |
|
|
extern void cyg_hal_plf_pci_cfg_write_byte (cyg_uint32 bus,
|
83 |
|
|
cyg_uint32 devfn,
|
84 |
|
|
cyg_uint32 offset,
|
85 |
|
|
cyg_uint8 val);
|
86 |
|
|
|
87 |
|
|
/* primary PCI bus definitions */
|
88 |
|
|
#ifndef PRIMARY_MEM_BASE
|
89 |
|
|
#define PRIMARY_BUS_NUM 0
|
90 |
|
|
#define PRIMARY_MEM_BASE 0x80000000
|
91 |
|
|
#define PRIMARY_DAC_BASE 0x84000000
|
92 |
|
|
#define PRIMARY_IO_BASE 0x90000000
|
93 |
|
|
#define PRIMARY_MEM_LIMIT 0x83ffffff
|
94 |
|
|
#define PRIMARY_DAC_LIMIT 0x87ffffff
|
95 |
|
|
#define PRIMARY_IO_LIMIT 0x9000ffff
|
96 |
|
|
#endif
|
97 |
|
|
|
98 |
|
|
/* secondary PCI bus definitions */
|
99 |
|
|
#ifndef SECONDARY_MEM_BASE
|
100 |
|
|
#define SECONDARY_BUS_NUM 1
|
101 |
|
|
#define SECONDARY_MEM_BASE 0x88000000
|
102 |
|
|
#define SECONDARY_DAC_BASE 0x8c000000
|
103 |
|
|
#define SECONDARY_IO_BASE 0x90010000
|
104 |
|
|
#define SECONDARY_MEM_LIMIT 0x8bffffff
|
105 |
|
|
#define SECONDARY_DAC_LIMIT 0x8fffffff
|
106 |
|
|
#define SECONDARY_IO_LIMIT 0x9001ffff
|
107 |
|
|
#endif
|
108 |
|
|
|
109 |
|
|
// Initialize the PCI bus.
|
110 |
|
|
externC void cyg_hal_plf_pci_init(void);
|
111 |
|
|
#define HAL_PCI_INIT() cyg_hal_plf_pci_init()
|
112 |
|
|
|
113 |
|
|
// Read a value from the PCI configuration space of the appropriate
|
114 |
|
|
// size at an address composed from the bus, devfn and offset.
|
115 |
|
|
#define HAL_PCI_CFG_READ_UINT8( __bus, __devfn, __offset, __val ) \
|
116 |
|
|
__val = cyg_hal_plf_pci_cfg_read_byte((__bus), (__devfn), (__offset))
|
117 |
|
|
|
118 |
|
|
#define HAL_PCI_CFG_READ_UINT16( __bus, __devfn, __offset, __val ) \
|
119 |
|
|
__val = cyg_hal_plf_pci_cfg_read_word((__bus), (__devfn), (__offset))
|
120 |
|
|
|
121 |
|
|
#define HAL_PCI_CFG_READ_UINT32( __bus, __devfn, __offset, __val ) \
|
122 |
|
|
__val = cyg_hal_plf_pci_cfg_read_dword((__bus), (__devfn), (__offset))
|
123 |
|
|
|
124 |
|
|
// Write a value to the PCI configuration space of the appropriate
|
125 |
|
|
// size at an address composed from the bus, devfn and offset.
|
126 |
|
|
#define HAL_PCI_CFG_WRITE_UINT8( __bus, __devfn, __offset, __val ) \
|
127 |
|
|
cyg_hal_plf_pci_cfg_write_byte((__bus), (__devfn), (__offset), (__val))
|
128 |
|
|
|
129 |
|
|
#define HAL_PCI_CFG_WRITE_UINT16( __bus, __devfn, __offset, __val ) \
|
130 |
|
|
cyg_hal_plf_pci_cfg_write_word((__bus), (__devfn), (__offset), (__val))
|
131 |
|
|
|
132 |
|
|
#define HAL_PCI_CFG_WRITE_UINT32( __bus, __devfn, __offset, __val ) \
|
133 |
|
|
cyg_hal_plf_pci_cfg_write_dword((__bus), (__devfn), (__offset), (__val))
|
134 |
|
|
|
135 |
|
|
//-----------------------------------------------------------------------------
|
136 |
|
|
// Resources
|
137 |
|
|
|
138 |
|
|
// Map PCI device resources starting from these addresses in PCI space.
|
139 |
|
|
#ifndef HAL_PCI_ALLOC_BASE_MEMORY
|
140 |
|
|
#define HAL_PCI_ALLOC_BASE_MEMORY (SECONDARY_MEM_BASE)
|
141 |
|
|
#define HAL_PCI_ALLOC_BASE_IO (SECONDARY_IO_BASE)
|
142 |
|
|
#endif
|
143 |
|
|
|
144 |
|
|
// This is where the PCI spaces are mapped in the CPU's address space.
|
145 |
|
|
#ifndef HAL_PCI_PHYSICAL_MEMORY_BASE
|
146 |
|
|
#define HAL_PCI_PHYSICAL_MEMORY_BASE 0x00000000
|
147 |
|
|
#define HAL_PCI_PHYSICAL_IO_BASE 0x00000000
|
148 |
|
|
#endif
|
149 |
|
|
|
150 |
|
|
|
151 |
|
|
// Some of SDRAM is aliased as uncached memory for drivers.
|
152 |
|
|
#ifndef CYGARC_UNCACHED_ADDRESS
|
153 |
|
|
#define CYGARC_UNCACHED_ADDRESS(_x_) \
|
154 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (unsigned long)(_x_))
|
155 |
|
|
#endif
|
156 |
|
|
#ifndef CYGARC_VIRT_TO_BUS
|
157 |
|
|
#define CYGARC_VIRT_TO_BUS(_x_) \
|
158 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (unsigned long)(_x_) : (((unsigned long)(_x_))&~0x40000000))
|
159 |
|
|
#endif
|
160 |
|
|
#ifndef CYGARC_BUS_TO_VIRT
|
161 |
|
|
#define CYGARC_BUS_TO_VIRT(_x_) \
|
162 |
|
|
(((((unsigned long)(_x_)) >> 28)==0xA) ? (((unsigned long)(_x_))|0x40000000) : (_x_))
|
163 |
|
|
#endif
|
164 |
|
|
|
165 |
|
|
#ifndef CYGARC_PHYSICAL_ADDRESS
|
166 |
|
|
#define CYGARC_PHYSICAL_ADDRESS(x) (x)
|
167 |
|
|
#endif
|
168 |
|
|
|
169 |
|
|
#endif // CYGONCE_HAL_ARM_VAR_IO_H
|
170 |
|
|
// EOF var_io.h
|