Blame view

drivers/bluetooth/hci_uart.h 2.59 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
   *
   *  Bluetooth HCI UART driver
   *
   *  Copyright (C) 2000-2001  Qualcomm Incorporated
   *  Copyright (C) 2002-2003  Maxim Krasnyansky <maxk@qualcomm.com>
   *  Copyright (C) 2004-2005  Marcel Holtmann <marcel@holtmann.org>
   *
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License as published by
   *  the Free Software Foundation; either version 2 of the License, or
   *  (at your option) any later version.
   *
   *  This program is distributed in the hope that it will be useful,
   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, write to the Free Software
   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   *
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24
   */
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
25
  #ifndef N_HCI
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
29
  #define N_HCI	15
  #endif
  
  /* Ioctls */
d21587446   Marcel Holtmann   [Bluetooth] Add H...
30
31
32
  #define HCIUARTSETPROTO		_IOW('U', 200, int)
  #define HCIUARTGETPROTO		_IOR('U', 201, int)
  #define HCIUARTGETDEVICE	_IOR('U', 202, int)
63c7d09cd   Johan Hedberg   Bluetooth: Add HC...
33
34
  #define HCIUARTSETFLAGS		_IOW('U', 203, int)
  #define HCIUARTGETFLAGS		_IOR('U', 204, int)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
35
36
  
  /* UART protocols */
b3190df62   Suraj Sumangala   Bluetooth: Suppor...
37
  #define HCI_UART_MAX_PROTO	6
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
38
39
40
41
42
  
  #define HCI_UART_H4	0
  #define HCI_UART_BCSP	1
  #define HCI_UART_3WIRE	2
  #define HCI_UART_H4DS	3
166d2f6a4   Ohad Ben-Cohen   [Bluetooth] Add U...
43
  #define HCI_UART_LL	4
b3190df62   Suraj Sumangala   Bluetooth: Suppor...
44
  #define HCI_UART_ATH3K	5
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
45

63c7d09cd   Johan Hedberg   Bluetooth: Add HC...
46
  #define HCI_UART_RAW_DEVICE	0
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
48
49
50
51
52
53
54
55
56
57
58
59
  struct hci_uart;
  
  struct hci_uart_proto {
  	unsigned int id;
  	int (*open)(struct hci_uart *hu);
  	int (*close)(struct hci_uart *hu);
  	int (*flush)(struct hci_uart *hu);
  	int (*recv)(struct hci_uart *hu, void *data, int len);
  	int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
  	struct sk_buff *(*dequeue)(struct hci_uart *hu);
  };
  
  struct hci_uart {
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
60
61
62
  	struct tty_struct	*tty;
  	struct hci_dev		*hdev;
  	unsigned long		flags;
63c7d09cd   Johan Hedberg   Bluetooth: Add HC...
63
  	unsigned long		hdev_flags;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
64

0372a6627   Marcel Holtmann   [Bluetooth] Clean...
65
66
67
68
69
70
  	struct hci_uart_proto	*proto;
  	void			*priv;
  
  	struct sk_buff		*tx_skb;
  	unsigned long		tx_state;
  	spinlock_t		rx_lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
71
  };
63c7d09cd   Johan Hedberg   Bluetooth: Add HC...
72
  /* HCI_UART proto flag bits */
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
73
  #define HCI_UART_PROTO_SET	0
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
74
75
  
  /* TX states  */
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
76
77
  #define HCI_UART_SENDING	1
  #define HCI_UART_TX_WAKEUP	2
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
78
79
80
81
  
  int hci_uart_register_proto(struct hci_uart_proto *p);
  int hci_uart_unregister_proto(struct hci_uart_proto *p);
  int hci_uart_tx_wakeup(struct hci_uart *hu);
0372a6627   Marcel Holtmann   [Bluetooth] Clean...
82
83
84
85
86
87
88
89
90
  #ifdef CONFIG_BT_HCIUART_H4
  int h4_init(void);
  int h4_deinit(void);
  #endif
  
  #ifdef CONFIG_BT_HCIUART_BCSP
  int bcsp_init(void);
  int bcsp_deinit(void);
  #endif
166d2f6a4   Ohad Ben-Cohen   [Bluetooth] Add U...
91
92
93
94
95
  
  #ifdef CONFIG_BT_HCIUART_LL
  int ll_init(void);
  int ll_deinit(void);
  #endif
b3190df62   Suraj Sumangala   Bluetooth: Suppor...
96
97
98
99
100
  
  #ifdef CONFIG_BT_HCIUART_ATH3K
  int ath_init(void);
  int ath_deinit(void);
  #endif