Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
whcd.h
Go to the documentation of this file.
1 /*
2  * Wireless Host Controller (WHC) private header.
3  *
4  * Copyright (C) 2007 Cambridge Silicon Radio Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  */
20 #ifndef __WHCD_H
21 #define __WHCD_H
22 
23 #include <linux/uwb/whci.h>
24 #include <linux/uwb/umc.h>
25 #include <linux/workqueue.h>
26 
27 #include "whci-hc.h"
28 
29 /* Generic command timeout. */
30 #define WHC_GENCMD_TIMEOUT_MS 100
31 
32 struct whc_dbg;
33 
34 struct whc {
35  struct wusbhc wusbhc;
36  struct umc_dev *umc;
37 
39  void __iomem *base;
40  int irq;
41 
45 
52 
54  struct mutex mutex;
55 
56  void * gen_cmd_buf;
59 
62 
64 
69 
74 
75  struct whc_dbg *dbg;
76 };
77 
78 #define wusbhc_to_whc(w) (container_of((w), struct whc, wusbhc))
79 
95 struct whc_std {
96  struct urb *urb;
97  size_t len;
99  struct whc_qtd *qtd;
100 
105 
106  void *bounce_buf;
108  unsigned bounce_offset;
109 };
110 
119 struct whc_urb {
120  struct urb *urb;
121  struct whc_qset *qset;
123  bool is_async;
124  int status;
125 };
126 
131 static inline bool whc_std_last(struct whc_std *std)
132 {
133  return std->ntds_remaining <= 1;
134 }
135 
140 };
141 
142 /* init.c */
143 int whc_init(struct whc *whc);
144 void whc_clean_up(struct whc *whc);
145 
146 /* hw.c */
147 void whc_write_wusbcmd(struct whc *whc, u32 mask, u32 val);
148 int whc_do_gencmd(struct whc *whc, u32 cmd, u32 params, void *addr, size_t len);
149 void whc_hw_error(struct whc *whc, const char *reason);
150 
151 /* wusb.c */
152 int whc_wusbhc_start(struct wusbhc *wusbhc);
153 void whc_wusbhc_stop(struct wusbhc *wusbhc, int delay);
154 int whc_mmcie_add(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt,
155  u8 handle, struct wuie_hdr *wuie);
156 int whc_mmcie_rm(struct wusbhc *wusbhc, u8 handle);
157 int whc_bwa_set(struct wusbhc *wusbhc, s8 stream_index, const struct uwb_mas_bm *mas_bm);
158 int whc_dev_info_set(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev);
160 int whc_set_ptk(struct wusbhc *wusbhc, u8 port_idx, u32 tkid,
161  const void *ptk, size_t key_size);
162 int whc_set_gtk(struct wusbhc *wusbhc, u32 tkid,
163  const void *gtk, size_t key_size);
164 int whc_set_cluster_id(struct whc *whc, u8 bcid);
165 
166 /* int.c */
167 irqreturn_t whc_int_handler(struct usb_hcd *hcd);
168 void whc_dn_work(struct work_struct *work);
169 
170 /* asl.c */
171 void asl_start(struct whc *whc);
172 void asl_stop(struct whc *whc);
173 int asl_init(struct whc *whc);
174 void asl_clean_up(struct whc *whc);
175 int asl_urb_enqueue(struct whc *whc, struct urb *urb, gfp_t mem_flags);
176 int asl_urb_dequeue(struct whc *whc, struct urb *urb, int status);
177 void asl_qset_delete(struct whc *whc, struct whc_qset *qset);
178 void scan_async_work(struct work_struct *work);
179 
180 /* pzl.c */
181 int pzl_init(struct whc *whc);
182 void pzl_clean_up(struct whc *whc);
183 void pzl_start(struct whc *whc);
184 void pzl_stop(struct whc *whc);
185 int pzl_urb_enqueue(struct whc *whc, struct urb *urb, gfp_t mem_flags);
186 int pzl_urb_dequeue(struct whc *whc, struct urb *urb, int status);
187 void pzl_qset_delete(struct whc *whc, struct whc_qset *qset);
188 void scan_periodic_work(struct work_struct *work);
189 
190 /* qset.c */
191 struct whc_qset *qset_alloc(struct whc *whc, gfp_t mem_flags);
192 void qset_free(struct whc *whc, struct whc_qset *qset);
193 struct whc_qset *get_qset(struct whc *whc, struct urb *urb, gfp_t mem_flags);
194 void qset_delete(struct whc *whc, struct whc_qset *qset);
195 void qset_clear(struct whc *whc, struct whc_qset *qset);
196 void qset_reset(struct whc *whc, struct whc_qset *qset);
197 int qset_add_urb(struct whc *whc, struct whc_qset *qset, struct urb *urb,
198  gfp_t mem_flags);
199 void qset_free_std(struct whc *whc, struct whc_std *std);
200 void qset_remove_urb(struct whc *whc, struct whc_qset *qset,
201  struct urb *urb, int status);
202 void process_halted_qtd(struct whc *whc, struct whc_qset *qset,
203  struct whc_qtd *qtd);
204 void process_inactive_qtd(struct whc *whc, struct whc_qset *qset,
205  struct whc_qtd *qtd);
206 enum whc_update qset_add_qtds(struct whc *whc, struct whc_qset *qset);
207 void qset_remove_complete(struct whc *whc, struct whc_qset *qset);
208 void pzl_update(struct whc *whc, uint32_t wusbcmd);
209 void asl_update(struct whc *whc, uint32_t wusbcmd);
210 
211 /* debug.c */
212 void whc_dbg_init(struct whc *whc);
213 void whc_dbg_clean_up(struct whc *whc);
214 
215 #endif /* #ifndef __WHCD_H */