Initial commit
[kernel/linux-3.0.git] / drivers / staging / ath6kl / wmi / wmi_host.h
1 //------------------------------------------------------------------------------
2 // <copyright file="wmi_host.h" company="Atheros">
3 //    Copyright (c) 2004-2010 Atheros Corporation.  All rights reserved.
4 // 
5 //
6 // Permission to use, copy, modify, and/or distribute this software for any
7 // purpose with or without fee is hereby granted, provided that the above
8 // copyright notice and this permission notice appear in all copies.
9 //
10 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 //
18 //
19 //------------------------------------------------------------------------------
20 //==============================================================================
21 // This file contains local definitios for the wmi host module.
22 //
23 // Author(s): ="Atheros"
24 //==============================================================================
25 #ifndef _WMI_HOST_H_
26 #define _WMI_HOST_H_
27
28 #include "roaming.h"
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32
33 struct wmi_stats {
34     u32 cmd_len_err;
35     u32 cmd_id_err;
36 };
37
38 #define SSID_IE_LEN_INDEX 13
39
40 /* Host side link management data structures */
41 #define SIGNAL_QUALITY_THRESHOLD_LEVELS 6
42 #define SIGNAL_QUALITY_UPPER_THRESHOLD_LEVELS SIGNAL_QUALITY_THRESHOLD_LEVELS
43 #define SIGNAL_QUALITY_LOWER_THRESHOLD_LEVELS SIGNAL_QUALITY_THRESHOLD_LEVELS
44 typedef struct sq_threshold_params_s {
45     s16 upper_threshold[SIGNAL_QUALITY_UPPER_THRESHOLD_LEVELS];
46     s16 lower_threshold[SIGNAL_QUALITY_LOWER_THRESHOLD_LEVELS];
47     u32 upper_threshold_valid_count;
48     u32 lower_threshold_valid_count;
49     u32 polling_interval;
50     u8 weight;
51     u8 last_rssi; //normally you would expect this to be bss specific but we keep only one instance because its only valid when the device is in a connected state. Not sure if it belongs to host or target.
52     u8 last_rssi_poll_event; //Not sure if it belongs to host or target
53 } SQ_THRESHOLD_PARAMS;
54
55 /*
56  * These constants are used with A_WLAN_BAND_SET.
57  */ 
58 #define A_BAND_24GHZ           0
59 #define A_BAND_5GHZ            1
60 #define A_NUM_BANDS            2
61
62 struct wmi_t {
63     bool                          wmi_ready;
64     bool                          wmi_numQoSStream;
65     u16 wmi_streamExistsForAC[WMM_NUM_AC];
66     u8 wmi_fatPipeExists;
67     void                           *wmi_devt;
68     struct wmi_stats                wmi_stats;
69     struct ieee80211_node_table     wmi_scan_table;
70     u8 wmi_bssid[ATH_MAC_LEN];
71     u8 wmi_powerMode;
72     u8 wmi_phyMode;
73     u8 wmi_keepaliveInterval;
74 #ifdef THREAD_X
75     A_CSECT_T                       wmi_lock;
76 #else 
77     A_MUTEX_T                       wmi_lock;
78 #endif
79     HTC_ENDPOINT_ID                 wmi_endpoint_id;
80     SQ_THRESHOLD_PARAMS             wmi_SqThresholdParams[SIGNAL_QUALITY_METRICS_NUM_MAX];
81     CRYPTO_TYPE                     wmi_pair_crypto_type;
82     CRYPTO_TYPE                     wmi_grp_crypto_type;
83     bool                          wmi_is_wmm_enabled;
84     u8 wmi_ht_allowed[A_NUM_BANDS];
85     u8 wmi_traffic_class;
86 };
87
88 #ifdef THREAD_X
89 #define INIT_WMI_LOCK(w)    A_CSECT_INIT(&(w)->wmi_lock)
90 #define LOCK_WMI(w)         A_CSECT_ENTER(&(w)->wmi_lock);
91 #define UNLOCK_WMI(w)       A_CSECT_LEAVE(&(w)->wmi_lock);
92 #define DELETE_WMI_LOCK(w)  A_CSECT_DELETE(&(w)->wmi_lock);
93 #else
94 #define LOCK_WMI(w)     A_MUTEX_LOCK(&(w)->wmi_lock);
95 #define UNLOCK_WMI(w)   A_MUTEX_UNLOCK(&(w)->wmi_lock);
96 #endif
97
98 #ifdef __cplusplus
99 }
100 #endif
101
102 #endif /* _WMI_HOST_H_ */