include: replace linux/module.h with "struct module" wherever possible
[linux-2.6/next.git] / drivers / staging / rtl8192e / dot11d.h
blob8e644614f21d86320424be2deef112e5b0e00849
1 #ifndef INC_DOT11D_H
2 #define INC_DOT11D_H
4 #ifdef ENABLE_DOT11D
5 #include "ieee80211.h"
7 struct _CHNL_TXPOWER_TRIPLE {
8 u8 FirstChnl;
9 u8 NumChnls;
10 u8 MaxTxPowerInDbm;
13 enum _DOT11D_STATE {
14 DOT11D_STATE_NONE = 0,
15 DOT11D_STATE_LEARNED,
16 DOT11D_STATE_DONE,
19 /**
20 * struct _RT_DOT11D_INFO
21 * @CountryIeLen: value greater than 0 if @CountryIeBuf contains
22 * valid country information element.
23 * @chanell_map: holds channel values
24 * 0 - invalid,
25 * 1 - valid (active scan),
26 * 2 - valid (passive scan)
27 * @CountryIeSrcAddr - Source AP of the country IE
30 struct _RT_DOT11D_INFO {
31 bool bEnabled;
33 u16 CountryIeLen;
34 u8 CountryIeBuf[MAX_IE_LEN];
35 u8 CountryIeSrcAddr[6];
36 u8 CountryIeWatchdog;
38 u8 channel_map[MAX_CHANNEL_NUMBER+1];
39 u8 MaxTxPwrDbmList[MAX_CHANNEL_NUMBER+1];
41 DOT11D_STATE State;
44 static inline void cpMacAddr(unsigned char *des, unsigned char *src)
46 memcpy(des, src, 6);
49 #define GET_DOT11D_INFO(__pIeeeDev) ((PRT_DOT11D_INFO) \
50 ((__pIeeeDev)->pDot11dInfo))
52 #define IS_DOT11D_ENABLE(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)->bEnabled)
53 #define IS_COUNTRY_IE_VALID(__pIeeeDev) \
54 (GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen > 0)
56 #define IS_EQUAL_CIE_SRC(__pIeeeDev, __pTa) \
57 eqMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
59 #define UPDATE_CIE_SRC(__pIeeeDev, __pTa) \
60 cpMacAddr(GET_DOT11D_INFO(__pIeeeDev)->CountryIeSrcAddr, __pTa)
62 #define IS_COUNTRY_IE_CHANGED(__pIeeeDev, __Ie) \
63 (((__Ie).Length == 0 || (__Ie).Length != \
64 GET_DOT11D_INFO(__pIeeeDev)->CountryIeLen) ? FALSE : \
65 (!memcmp(GET_DOT11D_INFO(__pIeeeDev)->CountryIeBuf, \
66 (__Ie).Octet, (__Ie).Length)))
68 #define CIE_WATCHDOG_TH 1
69 #define GET_CIE_WATCHDOG(__pIeeeDev) (GET_DOT11D_INFO(__pIeeeDev)-> \
70 CountryIeWatchdog)
71 #define RESET_CIE_WATCHDOG(__pIeeeDev) GET_CIE_WATCHDOG(__pIeeeDev) = 0
72 #define UPDATE_CIE_WATCHDOG(__pIeeeDev) (++GET_CIE_WATCHDOG(__pIeeeDev))
74 #define IS_DOT11D_STATE_DONE(__pIeeeDev) \
75 (GET_DOT11D_INFO(__pIeeeDev)->State == DOT11D_STATE_DONE)
78 void Dot11d_Init(struct ieee80211_device *dev);
80 void Dot11d_Reset(struct ieee80211_device *dev);
82 void Dot11d_UpdateCountryIe(struct ieee80211_device *dev, u8 *pTaddr,
83 u16 CoutryIeLen, u8 *pCoutryIe);
85 u8 DOT11D_GetMaxTxPwrInDbm(struct ieee80211_device *dev, u8 channel);
87 void DOT11D_ScanComplete(struct ieee80211_device *dev);
89 int IsLegalChannel(struct ieee80211_device *dev, u8 channel);
91 int ToLegalChannel(struct ieee80211_device *dev, u8 channel);
93 #endif /* ENABLE_DOT11D */
94 #endif /* INC_DOT11D_H */