Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / adf / adf_os_pci_pvt.h
1 #ifndef __ADF_OS_PCI_PVT_H
2 #define __ADF_OS_PCI_PVT_H
3
4 #include <wlan_pci.h>
5
6 //extern A_PCI_INIT_FUNC g_pci_init_func;
7
8 /**
9  * init module macro
10  */
11 #define __adf_os_pci_module_init(_fn)   A_PCI_INIT_FUNC g_pci_init_func = _fn;
12
13 /**
14  * exit module macro
15  */
16 #define __adf_os_pci_module_exit(_fn)   
17
18 /**
19  * initiallize the PCI driver structure
20  * Instance name will be <name>_pci_info
21  */
22 #define __adf_os_pci_set_drv_info(_name, _pci_ids, _attach, _detach, _suspend, _resume)  \
23 {   \
24     (_attach),  \
25     (_detach),  \
26     (_suspend),    \
27     (_resume),  \
28     ADF_OS_BUS_TYPE_PCI,    \
29     { (_pci_ids)},   \
30      #_name    \
31 };
32
33 /**
34  * XXX: pci functions undone
35  * @param osdev
36  * @param offset
37  * @param val
38  * 
39  * @return int
40  */
41 static inline int 
42 __adf_os_pci_config_read8(adf_os_device_t osdev, int offset, a_uint8_t *val)
43 {
44     (*val) = wlan_pci_config_read(offset, 1);
45         return 0;
46     /**
47      * XXX:how do we know the read succeded
48      */
49 }
50
51 static inline int 
52 __adf_os_pci_config_write8(adf_os_device_t osdev, int offset, a_uint8_t val)
53 {
54     wlan_pci_config_write(offset, val, 1);
55     return 0;    
56 }
57
58 static inline int 
59 __adf_os_pci_config_read16(adf_os_device_t osdev, int offset, a_uint16_t *val)
60 {
61     (*val) = wlan_pci_config_read(offset, 2);
62     return 0;
63 }
64
65 static inline int 
66 __adf_os_pci_config_write16(adf_os_device_t osdev, int offset, a_uint16_t val)
67 {
68     wlan_pci_config_write(offset, val, 2);
69     return 0;  
70 }
71
72 static inline int 
73 __adf_os_pci_config_read32(adf_os_device_t osdev, int offset, a_uint32_t *val)
74 {
75     (*val) = wlan_pci_config_read(offset, 4);
76     return 0;
77 }
78
79 static inline int 
80 __adf_os_pci_config_write32(adf_os_device_t osdev, int offset, a_uint32_t val)
81 {
82     wlan_pci_config_write(offset, val, 4);
83     return 0;  
84 }
85
86 #endif