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): msalter
|
46 |
|
|
// Contributors: hmt, jskov, msalter
|
47 |
|
|
// Date: 2000-10-10
|
48 |
|
|
// Purpose: Intel IOP310 PCI IO support macros
|
49 |
|
|
// Description:
|
50 |
|
|
// Usage: #include <cyg/hal/plf_io.h>
|
51 |
|
|
//
|
52 |
|
|
//####DESCRIPTIONEND####
|
53 |
|
|
//
|
54 |
|
|
//=============================================================================
|
55 |
|
|
|
56 |
|
|
// Translate the PCI interrupt requested by the device (INTA#, INTB#,
|
57 |
|
|
// INTC# or INTD#) to the associated CPU interrupt (i.e., HAL vector).
|
58 |
|
|
#define HAL_PCI_TRANSLATE_INTERRUPT( __bus, __devfn, __vec, __valid) \
|
59 |
|
|
CYG_MACRO_START \
|
60 |
|
|
cyg_uint32 __dev = CYG_PCI_DEV_GET_DEV(__devfn); \
|
61 |
|
|
cyg_uint32 __fn = CYG_PCI_DEV_GET_FN(__devfn); \
|
62 |
|
|
__valid = false; \
|
63 |
|
|
if (__bus == (*SBNR_REG + 1) && __dev == 0 && __fn == 0) { \
|
64 |
|
|
__vec = CYGNUM_HAL_INTERRUPT_ETHERNET; \
|
65 |
|
|
__valid = true; \
|
66 |
|
|
} else { \
|
67 |
|
|
cyg_uint8 __req; \
|
68 |
|
|
HAL_PCI_CFG_READ_UINT8(__bus, __devfn, CYG_PCI_CFG_INT_PIN, __req); \
|
69 |
|
|
switch (__dev % 4) { \
|
70 |
|
|
case 0: \
|
71 |
|
|
switch(__req) { \
|
72 |
|
|
case 1: /* INTA */ \
|
73 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTA; __valid=true; break; \
|
74 |
|
|
case 2: /* INTB */ \
|
75 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTB; __valid=true; break; \
|
76 |
|
|
case 3: /* INTC */ \
|
77 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTC; __valid=true; break; \
|
78 |
|
|
case 4: /* INTD */ \
|
79 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTD; __valid=true; break; \
|
80 |
|
|
} \
|
81 |
|
|
break; \
|
82 |
|
|
case 1: \
|
83 |
|
|
switch(__req) { \
|
84 |
|
|
case 1: /* INTA */ \
|
85 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTB; __valid=true; break; \
|
86 |
|
|
case 2: /* INTB */ \
|
87 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTC; __valid=true; break; \
|
88 |
|
|
case 3: /* INTC */ \
|
89 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTD; __valid=true; break; \
|
90 |
|
|
case 4: /* INTD */ \
|
91 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTA; __valid=true; break; \
|
92 |
|
|
} \
|
93 |
|
|
break; \
|
94 |
|
|
case 2: \
|
95 |
|
|
switch(__req) { \
|
96 |
|
|
case 1: /* INTA */ \
|
97 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTC; __valid=true; break; \
|
98 |
|
|
case 2: /* INTB */ \
|
99 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTD; __valid=true; break; \
|
100 |
|
|
case 3: /* INTC */ \
|
101 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTA; __valid=true; break; \
|
102 |
|
|
case 4: /* INTD */ \
|
103 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTB; __valid=true; break; \
|
104 |
|
|
} \
|
105 |
|
|
break; \
|
106 |
|
|
case 3: \
|
107 |
|
|
switch(__req) { \
|
108 |
|
|
case 1: /* INTA */ \
|
109 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTD; __valid=true; break; \
|
110 |
|
|
case 2: /* INTB */ \
|
111 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTA; __valid=true; break; \
|
112 |
|
|
case 3: /* INTC */ \
|
113 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTB; __valid=true; break; \
|
114 |
|
|
case 4: /* INTD */ \
|
115 |
|
|
__vec=CYGNUM_HAL_INTERRUPT_PCI_S_INTC; __valid=true; break; \
|
116 |
|
|
} \
|
117 |
|
|
break; \
|
118 |
|
|
} \
|
119 |
|
|
} \
|
120 |
|
|
CYG_MACRO_END
|
121 |
|
|
|
122 |
|
|
//-----------------------------------------------------------------------------
|
123 |
|
|
// end of plf_io.h
|
124 |
|
|
#endif // CYGONCE_PLF_IO_H
|