hci_uart.h 3.4 KB
Newer Older
L
Linus Torvalds 已提交
1
/*
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
 *
L
Linus Torvalds 已提交
24 25
 */

26
#ifndef N_HCI
L
Linus Torvalds 已提交
27 28 29 30
#define N_HCI	15
#endif

/* Ioctls */
31 32 33
#define HCIUARTSETPROTO		_IOW('U', 200, int)
#define HCIUARTGETPROTO		_IOR('U', 201, int)
#define HCIUARTGETDEVICE	_IOR('U', 202, int)
34 35
#define HCIUARTSETFLAGS		_IOW('U', 203, int)
#define HCIUARTGETFLAGS		_IOR('U', 204, int)
L
Linus Torvalds 已提交
36 37

/* UART protocols */
38
#define HCI_UART_MAX_PROTO	8
L
Linus Torvalds 已提交
39 40 41 42 43

#define HCI_UART_H4	0
#define HCI_UART_BCSP	1
#define HCI_UART_3WIRE	2
#define HCI_UART_H4DS	3
44
#define HCI_UART_LL	4
45
#define HCI_UART_ATH3K	5
46
#define HCI_UART_INTEL	6
47
#define HCI_UART_BCM	7
L
Linus Torvalds 已提交
48

49
#define HCI_UART_RAW_DEVICE	0
50
#define HCI_UART_RESET_ON_INIT	1
51
#define HCI_UART_CREATE_AMP	2
52
#define HCI_UART_INIT_PENDING	3
53
#define HCI_UART_EXT_CONFIG	4
54
#define HCI_UART_VND_DETECT	5
55

L
Linus Torvalds 已提交
56 57 58 59 60 61 62
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);
63
	int (*recv)(struct hci_uart *hu, const void *data, int len);
L
Linus Torvalds 已提交
64
	int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb);
65
	int (*setup)(struct hci_uart *hu);
L
Linus Torvalds 已提交
66 67 68 69
	struct sk_buff *(*dequeue)(struct hci_uart *hu);
};

struct hci_uart {
70 71 72
	struct tty_struct	*tty;
	struct hci_dev		*hdev;
	unsigned long		flags;
73
	unsigned long		hdev_flags;
L
Linus Torvalds 已提交
74

75
	struct work_struct	init_ready;
76
	struct work_struct	write_work;
77

78 79 80 81 82 83
	struct hci_uart_proto	*proto;
	void			*priv;

	struct sk_buff		*tx_skb;
	unsigned long		tx_state;
	spinlock_t		rx_lock;
L
Linus Torvalds 已提交
84 85
};

86
/* HCI_UART proto flag bits */
87
#define HCI_UART_PROTO_SET	0
88
#define HCI_UART_REGISTERED	1
L
Linus Torvalds 已提交
89 90

/* TX states  */
91 92
#define HCI_UART_SENDING	1
#define HCI_UART_TX_WAKEUP	2
L
Linus Torvalds 已提交
93 94 95 96

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);
97
int hci_uart_init_ready(struct hci_uart *hu);
L
Linus Torvalds 已提交
98

99 100 101
#ifdef CONFIG_BT_HCIUART_H4
int h4_init(void);
int h4_deinit(void);
102 103 104

struct sk_buff *h4_recv_buf(struct hci_dev *hdev, struct sk_buff *skb,
			    const unsigned char *buffer, int count);
105 106 107 108 109 110
#endif

#ifdef CONFIG_BT_HCIUART_BCSP
int bcsp_init(void);
int bcsp_deinit(void);
#endif
111 112 113 114 115

#ifdef CONFIG_BT_HCIUART_LL
int ll_init(void);
int ll_deinit(void);
#endif
116 117 118 119 120

#ifdef CONFIG_BT_HCIUART_ATH3K
int ath_init(void);
int ath_deinit(void);
#endif
121 122 123 124 125

#ifdef CONFIG_BT_HCIUART_3WIRE
int h5_init(void);
int h5_deinit(void);
#endif
126 127 128 129

#ifdef CONFIG_BT_HCIUART_INTEL
int intel_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
#endif
130 131 132 133

#ifdef CONFIG_BT_HCIUART_BCM
int bcm_set_bdaddr(struct hci_dev *hdev, const bdaddr_t *bdaddr);
#endif