Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / adf_os_pci.h
1 /**
2  * @ingroup adf_os_public
3  * @file adf_os_pci.h
4  * This file abstracts the PCI subsystem.
5  */
6 #ifndef __ADF_OS_PCI_H
7 #define __ADF_OS_PCI_H
8
9 #include <adf_os_pci_pvt.h>
10
11 /**
12  * @brief Define the entry point for the PCI module.
13  */ 
14 #define adf_os_pci_module_init(_fn)     __adf_os_pci_module_init(_fn)
15
16 /**
17  * @brief Define the exit point for the PCI module.
18  */ 
19 #define adf_os_pci_module_exit(_fn)     __adf_os_pci_module_exit(_fn)
20
21 /**
22  * @brief Setup the following driver information: name, PCI IDs of devices
23  * supported and some device handlers.
24  */ 
25 #define adf_os_pci_set_drv_info(_name, _pci_ids, _attach, _detach, _suspend, _resume) \
26     __adf_os_pci_set_drv_info(_name, _pci_ids, _attach, _detach, _suspend, _resume)
27
28 /**
29  * @brief Read a byte of PCI config space.
30  *
31  * @param[in]  osdev    platform device instance
32  * @param[in]  offset   offset to read
33  * @param[out] val      value read
34  *
35  * @return status of operation
36  */ 
37 static inline int 
38 adf_os_pci_config_read8(adf_os_device_t osdev, int offset, a_uint8_t *val)
39 {
40     return __adf_os_pci_config_read8(osdev, offset, val);
41 }
42
43 /**
44  * @brief Write a byte to PCI config space.
45  *
46  * @param[in] osdev    platform device instance
47  * @param[in] offset   offset to write
48  * @param[in] val      value to write
49  *
50  * @return status of operation
51  */ 
52 static inline int 
53 adf_os_pci_config_write8(adf_os_device_t osdev, int offset, a_uint8_t val)
54 {
55     return __adf_os_pci_config_write8(osdev, offset, val);
56 }
57
58 /**
59  * @brief Read 2 bytes of PCI config space.
60  *
61  * @param[in]  osdev    platform device instance
62  * @param[in]  offset   offset to read
63  * @param[out] val      value read
64  *
65  * @return status of operation
66  */ 
67 static inline int 
68 adf_os_pci_config_read16(adf_os_device_t osdev, int offset, a_uint16_t *val)
69 {
70     return __adf_os_pci_config_read16(osdev, offset, val);
71 }
72
73 /**
74  * @brief Write 2 bytes to PCI config space.
75  *
76  * @param[in] osdev    platform device instance
77  * @param[in] offset   offset to write
78  * @param[in] val      value to write
79  *
80  * @return status of operation
81  */ 
82 static inline int 
83 adf_os_pci_config_write16(adf_os_device_t osdev, int offset, a_uint16_t val)
84 {
85     return __adf_os_pci_config_write16(osdev, offset, val);
86 }
87
88 /**
89  * @brief Read 4 bytes of PCI config space.
90  *
91  * @param[in]  osdev    platform device instance
92  * @param[in]  offset   offset to read
93  * @param[out] val      value read
94  *
95  * @return status of operation
96  */ 
97 static inline int 
98 adf_os_pci_config_read32(adf_os_device_t osdev, int offset, a_uint32_t *val)
99 {
100     return __adf_os_pci_config_read32(osdev, offset, val);
101 }
102
103 /**
104  * @brief Write 4 bytes to PCI config space.
105  *
106  * @param[in] osdev    platform device instance
107  * @param[in] offset   offset to write
108  * @param[in] val      value to write
109  *
110  * @return status of operation
111  */ 
112 static inline int 
113 adf_os_pci_config_write32(adf_os_device_t osdev, int offset, a_uint32_t val)
114 {
115     return __adf_os_pci_config_write32(osdev, offset, val);
116 }
117 #endif
118