aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/hci_usb.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /drivers/bluetooth/hci_usb.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'drivers/bluetooth/hci_usb.h')
-rw-r--r--drivers/bluetooth/hci_usb.h128
1 files changed, 128 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_usb.h b/drivers/bluetooth/hci_usb.h
new file mode 100644
index 000000000000..29936b43d4f8
--- /dev/null
+++ b/drivers/bluetooth/hci_usb.h
@@ -0,0 +1,128 @@
1/*
2 HCI USB driver for Linux Bluetooth protocol stack (BlueZ)
3 Copyright (C) 2000-2001 Qualcomm Incorporated
4 Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
5
6 Copyright (C) 2003 Maxim Krasnyansky <maxk@qualcomm.com>
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License version 2 as
10 published by the Free Software Foundation;
11
12 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
13 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
15 IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
16 CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
17 WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20
21 ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
22 COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
23 SOFTWARE IS DISCLAIMED.
24*/
25
26/* Class, SubClass, and Protocol codes that describe a Bluetooth device */
27#define HCI_DEV_CLASS 0xe0 /* Wireless class */
28#define HCI_DEV_SUBCLASS 0x01 /* RF subclass */
29#define HCI_DEV_PROTOCOL 0x01 /* Bluetooth programming protocol */
30
31#define HCI_IGNORE 0x01
32#define HCI_RESET 0x02
33#define HCI_DIGIANSWER 0x04
34#define HCI_SNIFFER 0x08
35#define HCI_BROKEN_ISOC 0x10
36#define HCI_BCM92035 0x20
37
38#define HCI_MAX_IFACE_NUM 3
39
40#define HCI_MAX_BULK_TX 4
41#define HCI_MAX_BULK_RX 1
42
43#define HCI_MAX_ISOC_RX 2
44#define HCI_MAX_ISOC_TX 2
45
46#define HCI_MAX_ISOC_FRAMES 10
47
48struct _urb_queue {
49 struct list_head head;
50 spinlock_t lock;
51};
52
53struct _urb {
54 struct list_head list;
55 struct _urb_queue *queue;
56 int type;
57 void *priv;
58 struct urb urb;
59};
60
61static inline void _urb_free(struct _urb *_urb)
62{
63 kfree(_urb);
64}
65
66static inline void _urb_queue_init(struct _urb_queue *q)
67{
68 INIT_LIST_HEAD(&q->head);
69 spin_lock_init(&q->lock);
70}
71
72static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb)
73{
74 unsigned long flags;
75 spin_lock_irqsave(&q->lock, flags);
76 list_add(&_urb->list, &q->head); _urb->queue = q;
77 spin_unlock_irqrestore(&q->lock, flags);
78}
79
80static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb)
81{
82 unsigned long flags;
83 spin_lock_irqsave(&q->lock, flags);
84 list_add_tail(&_urb->list, &q->head); _urb->queue = q;
85 spin_unlock_irqrestore(&q->lock, flags);
86}
87
88static inline void _urb_unlink(struct _urb *_urb)
89{
90 struct _urb_queue *q = _urb->queue;
91 unsigned long flags;
92 if (q) {
93 spin_lock_irqsave(&q->lock, flags);
94 list_del(&_urb->list); _urb->queue = NULL;
95 spin_unlock_irqrestore(&q->lock, flags);
96 }
97}
98
99struct hci_usb {
100 struct hci_dev *hdev;
101
102 unsigned long state;
103
104 struct usb_device *udev;
105
106 struct usb_host_endpoint *bulk_in_ep;
107 struct usb_host_endpoint *bulk_out_ep;
108 struct usb_host_endpoint *intr_in_ep;
109
110 struct usb_interface *isoc_iface;
111 struct usb_host_endpoint *isoc_out_ep;
112 struct usb_host_endpoint *isoc_in_ep;
113
114 __u8 ctrl_req;
115
116 struct sk_buff_head transmit_q[4];
117 struct sk_buff *reassembly[4]; /* Reassembly buffers */
118
119 rwlock_t completion_lock;
120
121 atomic_t pending_tx[4]; /* Number of pending requests */
122 struct _urb_queue pending_q[4]; /* Pending requests */
123 struct _urb_queue completed_q[4]; /* Completed requests */
124};
125
126/* States */
127#define HCI_USB_TX_PROCESS 1
128#define HCI_USB_TX_WAKEUP 2