OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [linux-2.4/] [drivers/] [bluetooth/] [hci_usb.h] - Blame information for rev 1275

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1275 phoenix
/*
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
/*
27
 * $Id: hci_usb.h,v 1.1.1.1 2004-04-15 02:29:46 phoenix Exp $
28
 */
29
 
30
#ifdef __KERNEL__
31
 
32
/* Class, SubClass, and Protocol codes that describe a Bluetooth device */
33
#define HCI_DEV_CLASS        0xe0       /* Wireless class */
34
#define HCI_DEV_SUBCLASS     0x01       /* RF subclass */
35
#define HCI_DEV_PROTOCOL     0x01       /* Bluetooth programming protocol */
36
 
37
#define HCI_CTRL_REQ         0x20
38
#define HCI_DIGI_REQ         0x40
39
 
40
#define HCI_IGNORE           0x01
41
#define HCI_RESET            0x02
42
#define HCI_DIGIANSWER       0x04
43
 
44
#define HCI_MAX_IFACE_NUM       3 
45
 
46
#define HCI_MAX_BULK_TX         4
47
#define HCI_MAX_BULK_RX         1
48
 
49
#define HCI_MAX_ISOC_RX         2
50
#define HCI_MAX_ISOC_TX         2
51
 
52
#define HCI_MAX_ISOC_FRAMES     10
53
 
54
struct _urb_queue {
55
        struct list_head head;
56
        spinlock_t       lock;
57
};
58
 
59
struct _urb {
60
        struct list_head  list;
61
        struct _urb_queue *queue;
62
        int               type;
63
        void              *priv;
64
        struct urb        urb;
65
};
66
 
67
struct _urb *_urb_alloc(int isoc, int gfp);
68
 
69
static inline void _urb_free(struct _urb *_urb)
70
{
71
        kfree(_urb);
72
}
73
 
74
static inline void _urb_queue_init(struct _urb_queue *q)
75
{
76
        INIT_LIST_HEAD(&q->head);
77
        spin_lock_init(&q->lock);
78
}
79
 
80
static inline void _urb_queue_head(struct _urb_queue *q, struct _urb *_urb)
81
{
82
        unsigned long flags;
83
        spin_lock_irqsave(&q->lock, flags);
84
        list_add(&_urb->list, &q->head); _urb->queue = q;
85
        spin_unlock_irqrestore(&q->lock, flags);
86
}
87
 
88
static inline void _urb_queue_tail(struct _urb_queue *q, struct _urb *_urb)
89
{
90
        unsigned long flags;
91
        spin_lock_irqsave(&q->lock, flags);
92
        list_add_tail(&_urb->list, &q->head); _urb->queue = q;
93
        spin_unlock_irqrestore(&q->lock, flags);
94
}
95
 
96
static inline void _urb_unlink(struct _urb *_urb)
97
{
98
        struct _urb_queue *q = _urb->queue;
99
        unsigned long flags;
100
        if (q) {
101
                spin_lock_irqsave(&q->lock, flags);
102
                list_del(&_urb->list); _urb->queue = NULL;
103
                spin_unlock_irqrestore(&q->lock, flags);
104
        }
105
}
106
 
107
struct _urb *_urb_dequeue(struct _urb_queue *q);
108
 
109
#ifndef container_of
110
#define container_of(ptr, type, member) ({                      \
111
                        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
112
                                (type *)( (char *)__mptr - offsetof(type,member) );})
113
#endif
114
 
115
struct hci_usb {
116
        struct hci_dev          hdev;
117
 
118
        unsigned long           state;
119
 
120
        struct usb_device       *udev;
121
 
122
        struct usb_endpoint_descriptor  *bulk_in_ep;
123
        struct usb_endpoint_descriptor  *bulk_out_ep;
124
        struct usb_endpoint_descriptor  *intr_in_ep;
125
 
126
        struct usb_interface            *isoc_iface;
127
        struct usb_endpoint_descriptor  *isoc_out_ep;
128
        struct usb_endpoint_descriptor  *isoc_in_ep;
129
 
130
        __u8                    ctrl_req;
131
 
132
        struct sk_buff_head     transmit_q[4];
133
        struct sk_buff          *reassembly[4]; // Reassembly buffers
134
 
135
        rwlock_t                completion_lock;
136
 
137
        atomic_t                pending_tx[4];  // Number of pending requests 
138
        struct _urb_queue       pending_q[4];   // Pending requests
139
        struct _urb_queue       completed_q[4]; // Completed requests
140
};
141
 
142
/* States  */
143
#define HCI_USB_TX_PROCESS      1
144
#define HCI_USB_TX_WAKEUP       2
145
 
146
#endif /* __KERNEL__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.