Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / adf / adf_os_io_pvt.h
1 #ifndef _ADF_OS_IO_PVT_H
2 #define _ADF_OS_IO_PVT_H
3
4 #include <reg_defs.h>
5
6 #define __bswap16(x)                                \
7                                                         ((((x) & 0xff00) >> 8) | \
8                                                          (((x) & 0x00ff) << 8))
9
10 #define __bswap32(x)                                \
11                                                         ((((x) & 0xff000000) >> 24) | \
12                                                          (((x) & 0x00ff0000) >>  8) | \
13                                                          (((x) & 0x0000ff00) <<  8) | \
14                                                          (((x) & 0x000000ff) << 24))
15
16 #if 0
17 static __inline __uint64_t
18 __bswap64(__uint64_t _x)
19 {
20
21         return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
22             ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
23             ((_x << 24) & ((__uint64_t)0xff << 40)) |
24             ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
25 }
26 #endif
27                                      
28 #define __adf_os_reg_read8(_dev, _addr)                 oops no implementation...     
29
30 #define __adf_os_reg_read16(_dev, _addr)            oops no implementation...
31
32 #define __adf_os_reg_read32(_dev, _addr)            *((a_uint32_t *)(WLAN_BASE_ADDRESS + _addr))
33
34 #define __adf_os_reg_read64(_dev, _addr)            oops no implementation...
35
36 #define __adf_os_reg_write8(_dev, _addr, _val)      oops no implementation...
37
38 #define __adf_os_reg_write16(_dev, _addr, _val)     oops no implementation...
39
40 // RAY: The delay is required. But needs to know why??
41 //#define __adf_os_reg_write32(_dev, _addr, _val)     *((a_uint32_t *)(0x10ff0000 + _addr)) = _val; A_DELAY_USECS(100);
42 //RAY 0806: Move the delay (100us) to the host side because of throughput issue
43 #define __adf_os_reg_write32(_dev, _addr, _val)     *((a_uint32_t *)(WLAN_BASE_ADDRESS + _addr)) = _val;
44
45 #define __adf_os_reg_write64(_dev, _addr, _val)     oops no implementation...
46
47 #define __adf_os_ntohs(x)                           x
48 #define __adf_os_ntohl(x)                           x
49
50 #define __adf_os_htons(x)                           x
51 #define __adf_os_htonl(x)                           x
52
53 #define __adf_os_cpu_to_le16(x)                         __bswap16(x)                    
54 #define __adf_os_cpu_to_le32(x)                             __bswap32(x)
55 #define __adf_os_cpu_to_le64(x)                     x           
56
57 #define __adf_os_cpu_to_be16(x)                     x           
58 #define __adf_os_cpu_to_be32(x)                     x           
59 #define __adf_os_cpu_to_be64(x)                     x           
60
61 #define __adf_os_le16_to_cpu(x)                     __bswap16(x)
62 #define __adf_os_le32_to_cpu(x)                     __bswap32(x)        
63 #define __adf_os_le64_to_cpu(x)                     x           
64
65 #define __adf_os_be16_to_cpu(x)                     x           
66 #define __adf_os_be32_to_cpu(x)                     x           
67 #define __adf_os_be64_to_cpu(x)                     x           
68
69 #endif