Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
wmi.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2011 Atheros Communications Inc.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 #ifndef WMI_H
18 #define WMI_H
19 
22  struct {
25  } rc_stats;
26 } __packed;
27 
28 struct wmi_cmd_hdr {
31 } __packed;
32 
36 
37 } __packed;
38 
42 };
43 
44 /*
45  * 64 - HTC header - WMI header - 1 / txstatus
46  * And some other hdr. space is also accounted for.
47  * 12 seems to be the magic number.
48  */
49 #define HTC_MAX_TX_STATUS 12
50 
51 #define ATH9K_HTC_TXSTAT_ACK BIT(0)
52 #define ATH9K_HTC_TXSTAT_FILT BIT(1)
53 #define ATH9K_HTC_TXSTAT_RTC_CTS BIT(2)
54 #define ATH9K_HTC_TXSTAT_MCS BIT(3)
55 #define ATH9K_HTC_TXSTAT_CW40 BIT(4)
56 #define ATH9K_HTC_TXSTAT_SGI BIT(5)
57 
58 /*
59  * Legacy rates are indicated as indices.
60  * HT rates are indicated as dot11 numbers.
61  * This allows us to resrict the rate field
62  * to 4 bits.
63  */
64 #define ATH9K_HTC_TXSTAT_RATE 0x0f
65 #define ATH9K_HTC_TXSTAT_RATE_S 0
66 
67 #define ATH9K_HTC_TXSTAT_EPID 0xf0
68 #define ATH9K_HTC_TXSTAT_EPID_S 4
69 
72  u8 ts_rate; /* Also holds EP ID */
74 };
75 
79 } __packed;
80 
81 enum wmi_cmd_id {
82  WMI_ECHO_CMDID = 0x0001,
84 
85  /* Commands to Target */
115 };
116 
125 };
126 
127 #define MAX_CMD_NUMBER 62
128 
132 };
133 
135  int count;
137  struct list_head list;
138 };
139 
140 struct wmi {
142  struct htc_target *htc;
144  struct mutex op_mutex;
152  bool stopped;
153 
156 
158 
163 };
164 
165 struct wmi *ath9k_init_wmi(struct ath9k_htc_priv *priv);
166 void ath9k_deinit_wmi(struct ath9k_htc_priv *priv);
167 int ath9k_wmi_connect(struct htc_target *htc, struct wmi *wmi,
168  enum htc_endpoint_id *wmi_ctrl_epid);
169 int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id,
170  u8 *cmd_buf, u32 cmd_len,
171  u8 *rsp_buf, u32 rsp_len,
172  u32 timeout);
173 void ath9k_wmi_event_tasklet(unsigned long data);
174 void ath9k_fatal_work(struct work_struct *work);
176 
177 #define WMI_CMD(_wmi_cmd) \
178  do { \
179  ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, NULL, 0, \
180  (u8 *) &cmd_rsp, \
181  sizeof(cmd_rsp), HZ*2); \
182  } while (0)
183 
184 #define WMI_CMD_BUF(_wmi_cmd, _buf) \
185  do { \
186  ret = ath9k_wmi_cmd(priv->wmi, _wmi_cmd, \
187  (u8 *) _buf, sizeof(*_buf), \
188  &cmd_rsp, sizeof(cmd_rsp), HZ*2); \
189  } while (0)
190 
191 #endif /* WMI_H */