4ebbe720b84f014383f681af548742c425783c78
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bs / hal / OUTSRC / odm_types.h
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
4  *                                        
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #ifndef __ODM_TYPES_H__
21 #define __ODM_TYPES_H__
22
23 //
24 // Define Different SW team support
25 //
26 #define ODM_AP                  0x01    //BIT0 
27 #define ODM_ADSL                0x02    //BIT1
28 #define ODM_CE                  0x04    //BIT2
29 #define ODM_WIN                 0x08    //BIT3
30
31 #define DM_ODM_SUPPORT_TYPE                     ODM_CE
32
33 // Deifne HW endian support
34 #define ODM_ENDIAN_BIG  0
35 #define ODM_ENDIAN_LITTLE       1
36
37 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
38 #define GET_ODM(__pAdapter)     ((PDM_ODM_T)(&((GET_HAL_DATA(__pAdapter))->DM_OutSrc)))
39 #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
40 #define GET_ODM(__pAdapter)     ((PDM_ODM_T)(&((GET_HAL_DATA(__pAdapter))->odmpriv)))
41 #endif
42
43 #if (DM_ODM_SUPPORT_TYPE != ODM_WIN)
44 #define         RT_PCI_INTERFACE                                1
45 #define         RT_USB_INTERFACE                                2
46 #define         RT_SDIO_INTERFACE                               3
47 #endif
48
49 typedef enum _HAL_STATUS{
50         HAL_STATUS_SUCCESS,
51         HAL_STATUS_FAILURE,
52         /*RT_STATUS_PENDING,
53         RT_STATUS_RESOURCE,
54         RT_STATUS_INVALID_CONTEXT,
55         RT_STATUS_INVALID_PARAMETER,
56         RT_STATUS_NOT_SUPPORT,
57         RT_STATUS_OS_API_FAILED,*/
58 }HAL_STATUS,*PHAL_STATUS;
59
60
61 #if( (DM_ODM_SUPPORT_TYPE == ODM_AP) ||(DM_ODM_SUPPORT_TYPE == ODM_ADSL) || (DM_ODM_SUPPORT_TYPE == ODM_CE))
62
63 #define         VISTA_USB_RX_REVISE                     0
64
65 //
66 // Declare for ODM spin lock defintion temporarily fro compile pass.
67 //
68 typedef enum _RT_SPINLOCK_TYPE{
69         RT_TX_SPINLOCK = 1,
70         RT_RX_SPINLOCK = 2,
71         RT_RM_SPINLOCK = 3,
72         RT_CAM_SPINLOCK = 4,
73         RT_SCAN_SPINLOCK = 5,
74         RT_LOG_SPINLOCK = 7, 
75         RT_BW_SPINLOCK = 8,
76         RT_CHNLOP_SPINLOCK = 9,
77         RT_RF_OPERATE_SPINLOCK = 10,
78         RT_INITIAL_SPINLOCK = 11,
79         RT_RF_STATE_SPINLOCK = 12, // For RF state. Added by Bruce, 2007-10-30.
80 #if VISTA_USB_RX_REVISE
81         RT_USBRX_CONTEXT_SPINLOCK = 13,
82         RT_USBRX_POSTPROC_SPINLOCK = 14, // protect data of Adapter->IndicateW/ IndicateR
83 #endif
84         //Shall we define Ndis 6.2 SpinLock Here ?
85         RT_PORT_SPINLOCK=16,
86         RT_H2C_SPINLOCK = 20, // For H2C cmd. Added by tynli. 2009.11.09.
87
88         RT_BTData_SPINLOCK=25,
89
90         RT_WAPI_OPTION_SPINLOCK=26,
91         RT_WAPI_RX_SPINLOCK=27,
92
93       // add for 92D CCK control issue  
94         RT_CCK_PAGEA_SPINLOCK = 28,
95         RT_BUFFER_SPINLOCK = 29,
96         RT_CHANNEL_AND_BANDWIDTH_SPINLOCK = 30,
97         RT_GEN_TEMP_BUF_SPINLOCK = 31,
98         RT_AWB_SPINLOCK = 32,
99         RT_FW_PS_SPINLOCK = 33,
100         RT_HW_TIMER_SPIN_LOCK = 34,
101         RT_MPT_WI_SPINLOCK = 35,
102         RT_P2P_SPIN_LOCK = 36,  // Protect P2P context
103         RT_DBG_SPIN_LOCK = 37,
104         RT_IQK_SPINLOCK = 38,
105         RT_PENDED_OID_SPINLOCK = 39,
106         RT_CHNLLIST_SPINLOCK = 40,      
107         RT_INDIC_SPINLOCK = 41, //protect indication    
108 }RT_SPINLOCK_TYPE;
109
110 #endif
111
112
113 #if (DM_ODM_SUPPORT_TYPE == ODM_WIN)
114         #define STA_INFO_T                      RT_WLAN_STA
115         #define PSTA_INFO_T                     PRT_WLAN_STA
116
117 //    typedef unsigned long             u4Byte,*pu4Byte;
118 #define CONFIG_HW_ANTENNA_DIVERSITY 
119 #define CONFIG_SW_ANTENNA_DIVERSITY 
120
121 #elif (DM_ODM_SUPPORT_TYPE == ODM_AP)
122
123         // To let ADSL/AP project compile ok; it should be removed after all conflict are solved. Added by Annie, 2011-10-07.
124         #define ADSL_AP_BUILD_WORKAROUND
125         #define AP_BUILD_WORKAROUND
126         //
127 #ifdef CONFIG_ANT_SWITCH
128         #define CONFIG_HW_ANTENNA_DIVERSITY 
129         #if ( defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY) )
130                 #define CONFIG_NOT_SUPPORT_ANTDIV 
131         #elif( !defined(CONFIG_NO_2G_DIVERSITY) && defined(CONFIG_NO_5G_DIVERSITY) )
132                 #define CONFIG_2G_SUPPORT_ANTDIV
133         #elif( defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY) )
134                 #define CONFIG_5G_SUPPORT_ANTDIV
135         #elif( !defined(CONFIG_NO_2G_DIVERSITY) && !defined(CONFIG_NO_5G_DIVERSITY) )
136                 #define CONFIG_2G5G_SUPPORT_ANTDIV 
137         #endif
138 #endif
139
140         #ifdef AP_BUILD_WORKAROUND
141         #include "../typedef.h"
142         #else
143         typedef void                                    VOID,*PVOID;
144         typedef unsigned char                   BOOLEAN,*PBOOLEAN;
145         typedef unsigned char                   u1Byte,*pu1Byte;
146         typedef unsigned short                  u2Byte,*pu2Byte;
147         typedef unsigned int                    u4Byte,*pu4Byte;
148         typedef unsigned long long              u8Byte,*pu8Byte;
149         typedef char                                    s1Byte,*ps1Byte;
150         typedef short                                   s2Byte,*ps2Byte;
151         typedef long                                    s4Byte,*ps4Byte;
152         typedef long long                               s8Byte,*ps8Byte;
153         #endif
154
155         typedef struct rtl8192cd_priv   *prtl8192cd_priv;
156         typedef struct stat_info                STA_INFO_T,*PSTA_INFO_T;
157         typedef struct timer_list               RT_TIMER, *PRT_TIMER;
158         typedef  void *                         RT_TIMER_CALL_BACK;
159
160         #define DEV_BUS_TYPE            RT_PCI_INTERFACE
161
162         #define _TRUE                           1
163         #define _FALSE                          0
164         
165 #elif (DM_ODM_SUPPORT_TYPE == ODM_ADSL)
166
167         // To let ADSL/AP project compile ok; it should be removed after all conflict are solved. Added by Annie, 2011-10-07.
168         #define ADSL_AP_BUILD_WORKAROUND
169         #define ADSL_BUILD_WORKAROUND
170         //
171
172         typedef unsigned char                   BOOLEAN,*PBOOLEAN;
173         typedef unsigned char                   u1Byte,*pu1Byte;
174         typedef unsigned short                  u2Byte,*pu2Byte;
175         typedef unsigned int                    u4Byte,*pu4Byte;
176         typedef unsigned long long              u8Byte,*pu8Byte;
177         typedef char                                    s1Byte,*ps1Byte;
178         typedef short                                   s2Byte,*ps2Byte;
179         typedef long                                    s4Byte,*ps4Byte;
180         typedef long long                               s8Byte,*ps8Byte;
181
182         typedef struct rtl8192cd_priv   *prtl8192cd_priv;
183         typedef struct stat_info                STA_INFO_T,*PSTA_INFO_T;
184         typedef struct timer_list               RT_TIMER, *PRT_TIMER;
185         typedef  void *                         RT_TIMER_CALL_BACK;
186         
187         #define DEV_BUS_TYPE            RT_PCI_INTERFACE
188
189         #define _TRUE                           1
190         #define _FALSE                          0
191
192 #elif (DM_ODM_SUPPORT_TYPE == ODM_CE)
193         #include <drv_types.h>
194
195 #if 0
196         typedef u8                                      u1Byte, *pu1Byte;
197         typedef u16                                     u2Byte,*pu2Byte;
198         typedef u32                                     u4Byte,*pu4Byte;
199         typedef u64                                     u8Byte,*pu8Byte;
200         typedef s8                                      s1Byte,*ps1Byte;
201         typedef s16                                     s2Byte,*ps2Byte;
202         typedef s32                                     s4Byte,*ps4Byte;
203         typedef s64                                     s8Byte,*ps8Byte;
204 #else
205         #define u1Byte          u8
206         #define pu1Byte         u8*     
207
208         #define u2Byte          u16
209         #define pu2Byte         u16*            
210
211         #define u4Byte          u32
212         #define pu4Byte         u32*    
213
214         #define u8Byte          u64
215         #define pu8Byte         u64*
216
217         #define s1Byte          s8
218         #define ps1Byte         s8*     
219
220         #define s2Byte          s16
221         #define ps2Byte         s16*    
222
223         #define s4Byte          s32
224         #define ps4Byte         s32*    
225
226         #define s8Byte          s64
227         #define ps8Byte         s64*    
228         
229 #endif
230         #ifdef CONFIG_USB_HCI
231                 #define DEV_BUS_TYPE    RT_USB_INTERFACE
232         #elif defined(CONFIG_PCI_HCI)
233                 #define DEV_BUS_TYPE    RT_PCI_INTERFACE
234         #elif defined(CONFIG_SDIO_HCI)
235                 #define DEV_BUS_TYPE    RT_SDIO_INTERFACE
236         #elif defined(CONFIG_GSPI_HCI)
237                 #define DEV_BUS_TYPE    RT_SDIO_INTERFACE
238         #endif
239         
240
241         #if defined(CONFIG_LITTLE_ENDIAN)       
242                 #define ODM_ENDIAN_TYPE                 ODM_ENDIAN_LITTLE
243         #elif defined (CONFIG_BIG_ENDIAN)
244                 #define ODM_ENDIAN_TYPE                 ODM_ENDIAN_BIG
245         #endif
246         
247         typedef struct timer_list               RT_TIMER, *PRT_TIMER;
248         typedef  void *                         RT_TIMER_CALL_BACK;
249         #define STA_INFO_T                      struct sta_info
250         #define PSTA_INFO_T             struct sta_info *
251                 
252
253
254         #define TRUE    _TRUE   
255         #define FALSE   _FALSE
256
257
258         #define SET_TX_DESC_ANTSEL_A_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 24, 1, __Value)
259         #define SET_TX_DESC_ANTSEL_B_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+8, 25, 1, __Value)
260         #define SET_TX_DESC_ANTSEL_C_88E(__pTxDesc, __Value) SET_BITS_TO_LE_4BYTE(__pTxDesc+28, 29, 1, __Value)
261
262         //define useless flag to avoid compile warning
263         #define USE_WORKITEM 0
264         #define         FOR_BRAZIL_PRETEST 0
265         #define   FPGA_TWO_MAC_VERIFICATION     0
266         #define RTL8881A_SUPPORT        0
267 #endif
268
269 #define READ_NEXT_PAIR(v1, v2, i) do { if (i+2 >= ArrayLen) break; i += 2; v1 = Array[i]; v2 = Array[i+1]; } while(0)
270 #define COND_ELSE  2
271 #define COND_ENDIF 3
272
273 #endif // __ODM_TYPES_H__
274