RTEMS
libpci.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011 Cobham Gaisler AB
3  *
4  * The license and distribution terms for this file may be
5  * found in the file LICENSE in this distribution or at
6  * http://www.rtems.org/license/LICENSE.
7  */
8 
17 #ifndef _RTEMS_CONFDEFS_LIBPCI_H
18 #define _RTEMS_CONFDEFS_LIBPCI_H
19 
20 #ifndef __CONFIGURATION_TEMPLATE_h
21 #error "Do not include this file directly, use <rtems/confdefs.h> instead"
22 #endif
23 
24 /*
25  * Select PCI Configuration Library
26  */
27 #ifdef RTEMS_PCI_CONFIG_LIB
28  #ifdef CONFIGURE_INIT
29  #define PCI_LIB_NONE 0
30  #define PCI_LIB_AUTO 1
31  #define PCI_LIB_STATIC 2
32  #define PCI_LIB_READ 3
33  #define PCI_LIB_PERIPHERAL 4
34  #if CONFIGURE_PCI_LIB == PCI_LIB_AUTO
35  #define PCI_CFG_AUTO_LIB
36  #include <pci/cfg.h>
37  struct pci_bus pci_hb;
38  #define PCI_LIB_INIT pci_config_auto
39  #define PCI_LIB_CONFIG pci_config_auto_register
40  #elif CONFIGURE_PCI_LIB == PCI_LIB_STATIC
41  #define PCI_CFG_STATIC_LIB
42  #include <pci/cfg.h>
43  #define PCI_LIB_INIT pci_config_static
44  #define PCI_LIB_CONFIG NULL
45  /* Let user define PCI configuration (struct pci_bus pci_hb) */
46  #elif CONFIGURE_PCI_LIB == PCI_LIB_READ
47  #define PCI_CFG_READ_LIB
48  #include <pci/cfg.h>
49  #define PCI_LIB_INIT pci_config_read
50  #define PCI_LIB_CONFIG NULL
51  struct pci_bus pci_hb;
52  #elif CONFIGURE_PCI_LIB == PCI_LIB_PERIPHERAL
53  #define PCI_LIB_INIT pci_config_peripheral
54  #define PCI_LIB_CONFIG NULL
55  /* Let user define PCI configuration (struct pci_bus pci_hb) */
56  #elif CONFIGURE_PCI_LIB == PCI_LIB_NONE
57  #define PCI_LIB_INIT NULL
58  #define PCI_LIB_CONFIG NULL
59  /* No PCI Configuration at all, user can use/debug access routines */
60  #else
61  #error NO PCI LIBRARY DEFINED
62  #endif
63 
64  const int pci_config_lib_type = CONFIGURE_PCI_LIB;
65  int (*pci_config_lib_init)(void) = PCI_LIB_INIT;
66  void (*pci_config_lib_register)(void *config) = PCI_LIB_CONFIG;
67  #endif
68 #endif
69 
70 #endif /* _RTEMS_CONFDEFS_LIBPCI_H */