]> Pileus Git - ~andy/linux/blob - drivers/staging/rtl8188eu/include/rtw_p2p.h
staging: r8188eu: Add files for new driver - part 29
[~andy/linux] / drivers / staging / rtl8188eu / include / rtw_p2p.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 __RTW_P2P_H_
21 #define __RTW_P2P_H_
22
23 #include <drv_types.h>
24
25 u32 build_beacon_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
26 u32 build_probe_resp_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
27 u32 build_prov_disc_request_p2p_ie(struct wifidirect_info *pwdinfo,
28                                    u8 *pbuf, u8 *pssid, u8 ussidlen,
29                                    u8 *pdev_raddr);
30 u32 build_assoc_resp_p2p_ie(struct wifidirect_info *pwdinfo,
31                             u8 *pbuf, u8 status_code);
32 u32 build_deauth_p2p_ie(struct wifidirect_info *pwdinfo, u8 *pbuf);
33 u32 process_probe_req_p2p_ie(struct wifidirect_info *pwdinfo,
34                              u8 *pframe, uint len);
35 u32 process_assoc_req_p2p_ie(struct wifidirect_info *pwdinfo,
36                              u8 *pframe, uint len, struct sta_info *psta);
37 u32 process_p2p_devdisc_req(struct wifidirect_info *pwdinfo,
38                             u8 *pframe, uint len);
39 u32 process_p2p_devdisc_resp(struct wifidirect_info *pwdinfo,
40                              u8 *pframe, uint len);
41 u8 process_p2p_provdisc_req(struct wifidirect_info *pwdinfo,
42                             u8 *pframe, uint len);
43 u8 process_p2p_provdisc_resp(struct wifidirect_info *pwdinfo,  u8 *pframe);
44 u8 process_p2p_group_negotation_req(struct wifidirect_info *pwdinfo,
45                                     u8 *pframe, uint len);
46 u8 process_p2p_group_negotation_resp(struct wifidirect_info *pwdinfo,
47                                      u8 *pframe, uint len);
48 u8 process_p2p_group_negotation_confirm(struct wifidirect_info *pwdinfo,
49                                         u8 *pframe, uint len);
50 u8 process_p2p_presence_req(struct wifidirect_info *pwdinfo, u8 *pframe,
51                             uint len);
52 void p2p_protocol_wk_hdl(struct adapter *padapter, int intcmdtype);
53 void process_p2p_ps_ie(struct adapter *padapter, u8 *ies, u32 ielength);
54 void p2p_ps_wk_hdl(struct adapter *padapter, u8 p2p_ps_state);
55 u8 p2p_ps_wk_cmd(struct adapter *padapter, u8 p2p_ps_state, u8 enqueue);
56 void reset_global_wifidirect_info(struct adapter *padapter);
57 int rtw_init_wifi_display_info(struct adapter *padapter);
58 void rtw_init_wifidirect_timers(struct adapter *padapter);
59 void rtw_init_wifidirect_addrs(struct adapter *padapter, u8 *dev_addr,
60                                u8 *iface_addr);
61 void init_wifidirect_info(struct adapter *padapter, enum P2P_ROLE role);
62 int rtw_p2p_enable(struct adapter *padapter, enum P2P_ROLE role);
63
64 static inline void _rtw_p2p_set_state(struct wifidirect_info *wdinfo,
65                                       enum P2P_STATE state)
66 {
67         if (wdinfo->p2p_state != state)
68                 wdinfo->p2p_state = state;
69 }
70
71 static inline void _rtw_p2p_set_pre_state(struct wifidirect_info *wdinfo,
72                                           enum P2P_STATE state)
73 {
74         if (wdinfo->pre_p2p_state != state)
75                 wdinfo->pre_p2p_state = state;
76 }
77
78 static inline void _rtw_p2p_set_role(struct wifidirect_info *wdinfo,
79                                      enum P2P_ROLE role)
80 {
81         if (wdinfo->role != role)
82                 wdinfo->role = role;
83 }
84
85 static inline int _rtw_p2p_state(struct wifidirect_info *wdinfo)
86 {
87         return wdinfo->p2p_state;
88 }
89
90 static inline int _rtw_p2p_pre_state(struct wifidirect_info *wdinfo)
91 {
92         return wdinfo->pre_p2p_state;
93 }
94
95 static inline int _rtw_p2p_role(struct wifidirect_info *wdinfo)
96 {
97         return wdinfo->role;
98 }
99
100 static inline bool _rtw_p2p_chk_state(struct wifidirect_info *wdinfo,
101                                       enum P2P_STATE state)
102 {
103         return wdinfo->p2p_state == state;
104 }
105
106 static inline bool _rtw_p2p_chk_role(struct wifidirect_info *wdinfo,
107                                      enum P2P_ROLE role)
108 {
109         return wdinfo->role == role;
110 }
111
112 #define rtw_p2p_set_state(wdinfo, state) _rtw_p2p_set_state(wdinfo, state)
113 #define rtw_p2p_set_pre_state(wdinfo, state)                            \
114          _rtw_p2p_set_pre_state(wdinfo, state)
115 #define rtw_p2p_set_role(wdinfo, role) _rtw_p2p_set_role(wdinfo, role)
116
117 #define rtw_p2p_state(wdinfo) _rtw_p2p_state(wdinfo)
118 #define rtw_p2p_pre_state(wdinfo) _rtw_p2p_pre_state(wdinfo)
119 #define rtw_p2p_role(wdinfo) _rtw_p2p_role(wdinfo)
120 #define rtw_p2p_chk_state(wdinfo, state) _rtw_p2p_chk_state(wdinfo, state)
121 #define rtw_p2p_chk_role(wdinfo, role) _rtw_p2p_chk_role(wdinfo, role)
122
123 #define rtw_p2p_findphase_ex_set(wdinfo, value) \
124         ((wdinfo)->find_phase_state_exchange_cnt = (value))
125
126 /* is this find phase exchange for social channel scan? */
127 #define rtw_p2p_findphase_ex_is_social(wdinfo)   \
128 ((wdinfo)->find_phase_state_exchange_cnt >= P2P_FINDPHASE_EX_SOCIAL_FIRST)
129
130 /* should we need find phase exchange anymore? */
131 #define rtw_p2p_findphase_ex_is_needed(wdinfo) \
132         ((wdinfo)->find_phase_state_exchange_cnt < P2P_FINDPHASE_EX_MAX && \
133         (wdinfo)->find_phase_state_exchange_cnt != P2P_FINDPHASE_EX_NONE)
134
135 #endif