Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
htc_hst.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 HTC_HST_H
18 #define HTC_HST_H
19 
20 struct ath9k_htc_priv;
21 struct htc_target;
22 struct ath9k_htc_tx_ctl;
23 
26 };
27 
28 struct ath9k_htc_hif {
29  struct list_head list;
31  const char *name;
32 
35 
36  void (*start) (void *hif_handle);
37  void (*stop) (void *hif_handle);
38  void (*sta_drain) (void *hif_handle, u8 idx);
39  int (*send) (void *hif_handle, u8 pipe, struct sk_buff *buf);
40 };
41 
44  ENDPOINT0 = 0,
45  ENDPOINT1 = 1,
46  ENDPOINT2 = 2,
47  ENDPOINT3 = 3,
48  ENDPOINT4 = 4,
49  ENDPOINT5 = 5,
50  ENDPOINT6 = 6,
51  ENDPOINT7 = 7,
52  ENDPOINT8 = 8,
54 };
55 
56 /* Htc frame hdr flags */
57 #define HTC_FLAGS_RECV_TRAILER (1 << 1)
58 
59 struct htc_frame_hdr {
61  u8 flags;
63  u8 control[4];
64 } __packed;
65 
66 struct htc_ready_msg {
71  u8 pad;
72 } __packed;
73 
78 } __packed;
79 
80 struct htc_ep_callbacks {
81  void *priv;
82  void (*tx) (void *, struct sk_buff *, enum htc_endpoint_id, bool txok);
83  void (*rx) (void *, struct sk_buff *, enum htc_endpoint_id);
84 };
85 
86 struct htc_endpoint {
88 
92 
95 };
96 
97 #define HTC_MAX_CONTROL_MESSAGE_LENGTH 255
98 #define HTC_CONTROL_BUFFER_SIZE \
99  (HTC_MAX_CONTROL_MESSAGE_LENGTH + sizeof(struct htc_frame_hdr))
100 
101 #define HTC_OP_START_WAIT BIT(0)
102 #define HTC_OP_CONFIG_PIPE_CREDITS BIT(1)
103 
104 struct htc_target {
105  void *hif_dev;
107  struct device *dev;
112  struct list_head list;
118 };
119 
127 };
128 
134 };
135 
136 /* Current service IDs */
137 
141 
143 };
144 
145 #define MAKE_SERVICE_ID(group, index) \
146  (int)(((int)group << 8) | (int)(index))
147 
148 /* NOTE: service ID of 0x0000 is reserved and should never be used */
149 #define HTC_CTRL_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 1)
150 #define HTC_LOOPBACK_RSVD_SVC MAKE_SERVICE_ID(RSVD_SERVICE_GROUP, 2)
151 
152 #define WMI_CONTROL_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 0)
153 #define WMI_BEACON_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 1)
154 #define WMI_CAB_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 2)
155 #define WMI_UAPSD_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 3)
156 #define WMI_MGMT_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 4)
157 #define WMI_DATA_VO_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 5)
158 #define WMI_DATA_VI_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 6)
159 #define WMI_DATA_BE_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 7)
160 #define WMI_DATA_BK_SVC MAKE_SERVICE_ID(WMI_SERVICE_GROUP, 8)
161 
170 } __packed;
171 
172 /* connect response status codes */
173 #define HTC_SERVICE_SUCCESS 0
174 #define HTC_SERVICE_NOT_FOUND 1
175 #define HTC_SERVICE_FAILED 2
176 #define HTC_SERVICE_NO_RESOURCES 3
177 #define HTC_SERVICE_NO_MORE_EP 4
178 
187 } __packed;
188 
189 struct htc_comp_msg {
191 } __packed;
192 
193 int htc_init(struct htc_target *target);
195  struct htc_service_connreq *service_connreq,
196  enum htc_endpoint_id *conn_rsp_eid);
197 int htc_send(struct htc_target *target, struct sk_buff *skb);
198 int htc_send_epid(struct htc_target *target, struct sk_buff *skb,
199  enum htc_endpoint_id epid);
200 void htc_stop(struct htc_target *target);
201 void htc_start(struct htc_target *target);
202 void htc_sta_drain(struct htc_target *target, u8 idx);
203 
204 void ath9k_htc_rx_msg(struct htc_target *htc_handle,
205  struct sk_buff *skb, u32 len, u8 pipe_id);
206 void ath9k_htc_txcompletion_cb(struct htc_target *htc_handle,
207  struct sk_buff *skb, bool txok);
208 
209 struct htc_target *ath9k_htc_hw_alloc(void *hif_handle,
210  struct ath9k_htc_hif *hif,
211  struct device *dev);
212 void ath9k_htc_hw_free(struct htc_target *htc);
214  struct device *dev, u16 devid, char *product,
215  u32 drv_info);
216 void ath9k_htc_hw_deinit(struct htc_target *target, bool hot_unplug);
217 
218 #endif /* HTC_HST_H */