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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [hal/] [powerpc/] [moab/] [current/] [include/] [plf_io.h] - Blame information for rev 790

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

Line No. Rev Author Line
1 786 skrzyp
#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, 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):    hmt, jskov 
46
// Contributors: hmt, jskov, gthomas
47
// Date:         2002-07-23
48
// Purpose:      TAMS MOAB (PowerPC 405GPr) PCI IO support macros
49
// Description: 
50
// Usage:        #include <cyg/hal/plf_io.h>
51
//
52
//####DESCRIPTIONEND####
53
//
54
//=============================================================================
55
 
56
//-----------------------------------------------------------------------------
57
//
58
// PCI support
59
//
60
#define CYGARC_PHYSICAL_ADDRESS(x) ((unsigned long)(x) & 0x7FFFFFFF)
61
#define CYGARC_VIRTUAL_ADDRESS(x) ((unsigned long)(x) & 0x7FFFFFFF)
62
 
63
// Restrict device [slot] space
64
#define CYG_PCI_MAX_BUS                       1  // Only one BUS
65
#define CYG_PCI_MIN_DEV                       1  // Slots start at 11
66
#define CYG_PCI_MAX_DEV                      22  // ... and end at 31
67
#define _IRQ1 CYGNUM_HAL_INTERRUPT_IRQ1
68
#define _IRQ2 CYGNUM_HAL_INTERRUPT_IRQ2
69
#define _IRQ3 CYGNUM_HAL_INTERRUPT_IRQ3
70
#define _IRQ4 CYGNUM_HAL_INTERRUPT_IRQ4
71
#define CYG_PCI_IRQ_MAP                                                         \
72
/*                                                                              \
73
 * This mapping comes from this table, based on how the backplane is wired      \
74
 * IRQ assignments (Acrosser):                                                  \
75
 *                                                                              \
76
 *               CPU        Slot1      Slot2    Slot3    Slot4                  \
77
 * IRQ1     PCI INTD        INTB       INTA     INTD      na                    \
78
 * IRQ2     PCI INTC        INTA       INTD     INTC      na                    \
79
 * IRQ3     PCI INTB        INTD       INTC     INTB      na                    \
80
 * IRQ4     PCI INTA        INTC       INTB     INTA      na                    \
81
 *                                                                              \
82
 *      PCI IDSEL/INTPIN->INTLINE                                               \
83
 *      A       B       C       D                                               \
84
 */                                                                             \
85
{                                                                               \
86
    {_IRQ1, _IRQ4, _IRQ3, _IRQ2},   /* IDSEL 1 - 2nd LAN */                     \
87
    {_IRQ3, _IRQ3, _IRQ3, _IRQ3},   /* IDSEL 2 - USB */                         \
88
    {   -1,    -1,    -1,    -1},   /* IDSEL 3 - unavailable */                 \
89
    {   -1,    -1,    -1,    -1},   /* IDSEL 4 - unavailable */                 \
90
    {   -1,    -1,    -1,    -1},   /* IDSEL 5 - unavailable */                 \
91
    {   -1,    -1,    -1,    -1},   /* IDSEL 6 - unavailable */                 \
92
    {   -1,    -1,    -1,    -1},   /* IDSEL 7 - unavailable */                 \
93
    {   -1,    -1,    -1,    -1},   /* IDSEL 8 - unavailable */                 \
94
    {   -1,    -1,    -1,    -1},   /* IDSEL 9 - unavailable */                 \
95
    {   -1,    -1,    -1,    -1},   /* IDSEL 10 - unavailable */                \
96
    {   -1,    -1,    -1,    -1},   /* IDSEL 11 - unavailable */                \
97
    {   -1,    -1,    -1,    -1},   /* IDSEL 12 - unavailable */                \
98
    {   -1,    -1,    -1,    -1},   /* IDSEL 13 - unavailable */                \
99
    {   -1,    -1,    -1,    -1},   /* IDSEL 14 - unavailable */                \
100
    {   -1,    -1,    -1,    -1},   /* IDSEL 15 - unavailable */                \
101
    {   -1,    -1,    -1,    -1},   /* IDSEL 16 - unavailable */                \
102
    {_IRQ1, _IRQ4, _IRQ3, _IRQ2},   /* IDSEL 17 - PCI slot 2 */                 \
103
    {_IRQ4, _IRQ3, _IRQ2, _IRQ1},   /* IDSEL 18 - PCI slot 3 */                 \
104
    {_IRQ1, _IRQ4, _IRQ3, _IRQ2},   /* IDSEL 19 - PCI slot 2 */                 \
105
    {_IRQ2, _IRQ1, _IRQ4, _IRQ3},   /* IDSEL 20 - PCI slot 1 */                 \
106
}
107
 
108
//-----------------------------------------------------------------------------
109
// Resources
110
 
111
// Map PCI device resources starting from these addresses in PCI space.
112
#define HAL_PCI_ALLOC_BASE_MEMORY                 0x00000000
113
#define HAL_PCI_ALLOC_BASE_IO                     0x00800000
114
 
115
// This is where the PCI spaces are mapped in the CPU's address space.
116
#define HAL_PCI_PHYSICAL_MEMORY_BASE              0xA0000000
117
#define HAL_PCI_PHYSICAL_IO_BASE                  0xE8000000
118
 
119
#if 1 // This is an old-school idea about how to handle PCI devices
120
// These seem to be defined multiple ways?
121
#define CYGMEM_SECTION_pci_window                 0x03F00000
122
#define CYGMEM_SECTION_pci_window_SIZE            0x00100000
123
#endif
124
 
125
// IDE support
126
#define HAL_IDE_NUM_CONTROLLERS 2  // One card, two controllers
127
 
128
externC cyg_uint8 cyg_hal_plf_ide_read_uint8(int ctlr, cyg_uint32 reg);
129
externC void cyg_hal_plf_ide_write_uint8(int ctlr, cyg_uint32 reg, cyg_uint8 val);
130
externC cyg_uint16 cyg_hal_plf_ide_read_uint16(int ctlr, cyg_uint32 reg);
131
externC void cyg_hal_plf_ide_write_uint16(int ctlr, cyg_uint32 reg, cyg_uint16 val);
132
externC void cyg_hal_plf_ide_write_control(int ctlr, cyg_uint8 val);
133
externC int cyg_hal_plf_ide_init(void);
134
 
135
#define HAL_IDE_READ_UINT8( __ctlr, __reg, __val) \
136
    __val = cyg_hal_plf_ide_read_uint8((__ctlr),  (__reg))
137
 
138
#define HAL_IDE_READ_UINT16( __ctlr, __reg, __val) \
139
    __val = cyg_hal_plf_ide_read_uint16((__ctlr),  (__reg))
140
 
141
#define HAL_IDE_WRITE_UINT8( __ctlr, __reg, __val) \
142
    cyg_hal_plf_ide_write_uint8((__ctlr),  (__reg), (__val))
143
 
144
#define HAL_IDE_WRITE_UINT16( __ctlr, __reg, __val) \
145
    cyg_hal_plf_ide_write_uint16((__ctlr),  (__reg), (__val))
146
 
147
#define HAL_IDE_WRITE_CONTROL( __ctlr, __val) \
148
    cyg_hal_plf_ide_write_control((__ctlr),  (__val))
149
 
150
#define HAL_IDE_INIT() cyg_hal_plf_ide_init()
151
 
152
 
153
//-----------------------------------------------------------------------------
154
// end of plf_io.h
155
#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.