mbgtools-lx  4.2.8
pci.h
Go to the documentation of this file.
1 
2 /**************************************************************************
3  *
4  * $Id: pci.h 1.10 2017/05/10 15:24:21 martin REL_M $
5  *
6  * Copyright (c) Meinberg Funkuhren, Bad Pyrmont, Germany
7  *
8  * Description:
9  * Definitions used to access the PC PCI BIOS.
10  *
11  * -----------------------------------------------------------------------
12  * $Log: pci.h $
13  * Revision 1.10 2017/05/10 15:24:21 martin
14  * Tiny cleanup.
15  * Revision 1.9 2008/01/30 13:42:29 martin
16  * Code cleanup to support different build environments properly.
17  * Revision 1.8 2006/07/11 08:59:00Z martin
18  * Account for PCI functions having been renamed in the library.
19  * Revision 1.7 2003/02/19 16:51:21Z martin
20  * Include pci_nt.h for Win32 non-pnp.
21  * Revision 1.6 2002/02/19 09:28:00Z MARTIN
22  * Use new header mbg_tgt.h to check the target environment.
23  * Revision 1.5 2002/01/15 15:47:30 Udo
24  * Don't include pci_nt.h under Win32.
25  * Revision 1.4 2001/03/15 13:01:40Z MARTIN
26  * Redefined preprocessor control for Win32.
27  * Revision 1.3 2001/03/01 09:23:36 MARTIN
28  * Added QNX support.
29  * Modified preprocessor syntax.
30  * Revision 1.2 2000/07/21 12:18:16 MARTIN
31  * Initial revision
32  *
33  **************************************************************************/
34 
35 #ifndef _PCI_H
36 #define _PCI_H
37 
38 
39 /* Other headers to be included */
40 
41 #include <mbg_tgt.h>
42 
43 #if defined( MBG_TGT_NETWARE )
44 
45  #include <pci_nw.h> // PCI functions for NetWare
46 
47 #elif defined( MBG_TGT_OS2 )
48 
49  #include <pci_os2.h> // PCI functions for OS/2
50 
51 #elif defined( MBG_TGT_WIN32 )
52 
53  #if !defined( MBG_TGT_WIN32_PNP )
54  #include <pci_nt.h> // PCI functions for Win32/non-pnp
55  #endif
56 
57 #elif defined( MBG_TGT_LINUX )
58 
59  #include <pci_lx.h> // PCI functions for Linux
60 
61 #elif defined( MBG_TGT_QNX )
62 
63  #include <pci_qnx.h> // PCI functions for QNX
64 
65 #elif defined( MBG_TGT_DOS )
66 
67  #include <pci_dos.h> // PCI functions for DOS
68 
69 #endif
70 
71 
72 #ifdef _PCI
73  #define _ext
74 #else
75  #define _ext extern
76 #endif
77 
78 
79 /* Start of header body */
80 
81 #ifdef __cplusplus
82 extern "C" {
83 #endif
84 
85 #if !defined( pci_fnc_init )
86  #define pci_fnc_init() 0
87 #endif
88 
89 #if !defined( pci_fnc_deinit )
90  #define pci_fnc_deinit()
91 #endif
92 
93 
94 #if !defined( _mbg_pci_find_bios )
95  #define _mbg_pci_find_bios mbg_pci_find_bios
96 #endif
97 
98 #if !defined( _mbg_pci_find_device )
99  #define _mbg_pci_find_device mbg_pci_find_device
100 #endif
101 
102 
103 #if defined( MBG_PCI_MACROS_MAP_DIRECT )
104 
105  #define _mbg_pci_find_device mbg_pci_find_device
106  #define _mbg_pci_read_cfg_byte mbg_pci_read_cfg_byte
107  #define _mbg_pci_read_cfg_word mbg_pci_read_cfg_word
108  #define _mbg_pci_read_cfg_dword mbg_pci_read_cfg_dword
109  #define _mbg_pci_write_cfg_byte mbg_pci_write_cfg_byte
110  #define _mbg_pci_write_cfg_word mbg_pci_write_cfg_word
111  #define _mbg_pci_write_cfg_dword mbg_pci_write_cfg_dword
112 
113 #endif // defined( MBG_PCI_MACROS_MAP_DIRECT )
114 
115 
116 #if defined( MBG_PCI_MACROS_MAP_GENERIC )
117 
118  #define _mbg_pci_read_cfg_byte( bus, dev_fnc, reg, addr ) \
119  mbg_pci_read_cfg_reg( bus, dev_fnc, reg, sizeof( uint8_t ), addr )
120 
121  #define _mbg_pci_read_cfg_word( bus, dev_fnc, reg, addr ) \
122  mbg_pci_read_cfg_reg( bus, dev_fnc, reg, sizeof( uint16_t ), addr )
123 
124  #define _mbg_pci_read_cfg_dword( bus, dev_fnc, reg, addr ) \
125  mbg_pci_read_cfg_reg( bus, dev_fnc, reg, sizeof( uint32_t ), addr )
126 
127 
128  #define _mbg_pci_write_cfg_byte( bus, dev_fnc, reg, addr ) \
129  mbg_pci_write_cfg_reg( bus, dev_fnc, reg, sizeof( uint8_t ), addr )
130 
131  #define _mbg_pci_write_cfg_word( bus, dev_fnc, reg, addr ) \
132  mbg_pci_write_cfg_reg( bus, dev_fnc, reg, sizeof( uint16_t ), addr )
133 
134  #define _mbg_pci_write_cfg_dword( bus, dev_fnc, reg, addr ) \
135  mbg_pci_write_cfg_reg( bus, dev_fnc, reg, sizeof( uint32_t ), addr )
136 
137 #endif // defined( MBG_PCI_MACROS_MAP_GENERIC )
138 
139 
140 
141 /* ----- function prototypes begin ----- */
142 
143 /* This section was generated automatically */
144 /* by MAKEHDR, do not remove the comments. */
145 
146 /* (no header definitions found) */
147 
148 /* ----- function prototypes end ----- */
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 
155 /* End of header body */
156 
157 #undef _ext
158 
159 #endif /* _PCI_H */
160 
161