Setting up repository
[linux-libre-firmware.git] / ath9k_htc / target_firmware / magpie_fw_dev / target / adf / adf_os_types_pvt.h
1 /*
2  * Copyright (c) 2013 Qualcomm Atheros, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted (subject to the limitations in the
7  * disclaimer below) provided that the following conditions are met:
8  *
9  *  * Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  *
12  *  * Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the
15  *    distribution.
16  *
17  *  * Neither the name of Qualcomm Atheros nor the names of its
18  *    contributors may be used to endorse or promote products derived
19  *    from this software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
22  * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
23  * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
24  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
30  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
31  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
32  * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33  * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35 #ifndef __ADF_OS_TYPES_PVT_H
36 #define __ADF_OS_TYPES_PVT_H
37
38 #include <stddef.h>
39 #include <osapi.h>
40 //#include "cmnos_api.h"
41 //#include "Magpie_api.h"
42 #include <vbuf_api.h>
43
44 #define __ADF_OS_MAX_SCATTER    1
45 #define __adf_os_packed         __attribute__((__packed__))
46 #define __ADF_OS_NAME_SIZE      10
47
48 /*
49  * Private definitions of general data types
50  */
51 /**
52  * Endian-ness
53  */
54 #undef ADF_LITTLE_ENDIAN_MACHINE
55 #undef ADF_BIG_ENDIAN_MACHINE
56
57 //#if (_BYTE_ORDER == _LITTLE_ENDIAN)
58 #ifdef LITTLE_ENDIAN
59 #define ADF_LITTLE_ENDIAN_MACHINE
60 //#elif (_BYTE_ORDER == _BIG_ENDIAN)
61 #elif BIG_ENDIAN
62 #define ADF_BIG_ENDIAN_MACHINE
63 #endif
64
65 /**
66  * CACHE-SYNC (DMA)
67  */
68 #define __ADF_SYNC_PREREAD         0 
69 #define __ADF_SYNC_POSTREAD                1
70 #define __ADF_SYNC_PREWRITE                2
71 #define __ADF_SYNC_POSTWRITE       3
72
73 #define __ADF_OS_DMA_TO_DEVICE     0
74 #define __ADF_OS_DMA_FROM_DEVICE   1 
75       
76
77 struct __adf_softc;
78
79
80 enum __adf_net_wireless_evcode{
81     __ADF_IEEE80211_ASSOC = 100,
82     __ADF_IEEE80211_REASSOC = 101,
83     __ADF_IEEE80211_DISASSOC = 102,
84     __ADF_IEEE80211_JOIN = 103,
85     __ADF_IEEE80211_LEAVE = 104,
86     __ADF_IEEE80211_SCAN = 105,
87     __ADF_IEEE80211_REPLAY = 106,
88     __ADF_IEEE80211_MICHAEL = 107,
89     __ADF_IEEE80211_REJOIN = 108, 
90     __ADF_CUSTOM_PUSH_BUTTON = 109,
91 };
92
93 /* generic data types */
94 struct __adf_device  {
95 int dummy;    
96 }; 
97
98 typedef struct __adf_device *__adf_os_device_t;
99
100
101 struct __adf_dma_map {
102     VBUF *buf;
103     
104     A_UINT32 *ds_addr;
105     A_UINT16 ds_len;
106 }; 
107
108 typedef struct __adf_dma_map *__adf_os_dma_map_t;
109
110 typedef A_UINT32      __adf_os_dma_addr_t;
111 typedef A_UINT32      __adf_os_dma_size_t;
112
113 typedef unsigned int            __adf_os_size_t;
114 typedef int             __adf_os_off_t;
115
116 #define __adf_os_iomem_t
117
118 #if 0
119 typedef int           __a_uint8_t;    
120 typedef int            __a_int8_t;     
121 typedef int          __a_uint16_t;   
122 typedef int           __a_int16_t;    
123 typedef int          __a_uint32_t;   
124 typedef int           __a_int32_t;    
125 typedef int          __a_uint64_t;   
126 typedef int           __a_int64_t; 
127 #else
128 typedef A_UINT8           __a_uint8_t;
129 typedef A_INT8            __a_int8_t;     
130 typedef A_UINT16          __a_uint16_t;   
131 typedef A_INT16          __a_int16_t;    
132 typedef A_UINT32          __a_uint32_t;   
133 typedef A_INT32          __a_int32_t;    
134 typedef A_UINT64          __a_uint64_t;   
135 typedef A_INT64           __a_int64_t;    
136
137 typedef A_UINT32            u_int32_t;
138 typedef A_UINT16            u_int16_t;
139 typedef A_UINT8             u_int8_t;
140 typedef unsigned int        u_int;
141 typedef unsigned long        u_long;
142 //typedef __adf_os_size_t        size_t;
143
144 typedef A_UINT64            u_int64_t;
145
146 #endif
147
148 //extern void my_printf(struct ath_hal *ah, const char* fmt, ...);
149
150 //#define __adf_os_print        my_printf
151 #define __adf_os_print          A_PRINTF
152
153 #if 1  
154 #if defined(__XCC__)
155 #include "stdarg.h"
156 #define __va_list __gnuc_va_list
157 #endif
158 #endif
159
160 /* For compiling WLAN drivers */
161 #define IFNAMSIZ                                10
162 #define ENXIO                                           -1
163 #define ENOMEM                                          -1
164 #define EIO                                             -1
165 #define caddr_t                                         int
166 #define ENODEV                                          -1
167 #define EOPNOTSUPP                                      -1
168 #define KASSERT(exp, msg)
169
170 #if 0
171 #ifndef __packed
172 #define __packed    __attribute__((__packed__))
173 #endif
174
175 #ifndef roundup
176 #define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))  /* to any y */
177 #endif
178 #endif
179
180 #endif