Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame^] | 1 | /* |
| 2 | BlueZ - Bluetooth protocol stack for Linux |
| 3 | Copyright (C) 2000-2001 Qualcomm Incorporated |
| 4 | |
| 5 | Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com> |
| 6 | |
| 7 | This program is free software; you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License version 2 as |
| 9 | published by the Free Software Foundation; |
| 10 | |
| 11 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 12 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. |
| 14 | IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY |
| 15 | CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES |
| 16 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 17 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 19 | |
| 20 | ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS, |
| 21 | COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS |
| 22 | SOFTWARE IS DISCLAIMED. |
| 23 | */ |
| 24 | |
| 25 | /* |
| 26 | * $Id: hci_uart.h,v 1.2 2002/09/09 01:17:32 maxk Exp $ |
| 27 | */ |
| 28 | |
| 29 | #ifndef N_HCI |
| 30 | #define N_HCI 15 |
| 31 | #endif |
| 32 | |
| 33 | /* Ioctls */ |
| 34 | #define HCIUARTSETPROTO _IOW('U', 200, int) |
| 35 | #define HCIUARTGETPROTO _IOR('U', 201, int) |
| 36 | |
| 37 | /* UART protocols */ |
| 38 | #define HCI_UART_MAX_PROTO 4 |
| 39 | |
| 40 | #define HCI_UART_H4 0 |
| 41 | #define HCI_UART_BCSP 1 |
| 42 | #define HCI_UART_3WIRE 2 |
| 43 | #define HCI_UART_H4DS 3 |
| 44 | |
| 45 | #ifdef __KERNEL__ |
| 46 | struct hci_uart; |
| 47 | |
| 48 | struct hci_uart_proto { |
| 49 | unsigned int id; |
| 50 | int (*open)(struct hci_uart *hu); |
| 51 | int (*close)(struct hci_uart *hu); |
| 52 | int (*flush)(struct hci_uart *hu); |
| 53 | int (*recv)(struct hci_uart *hu, void *data, int len); |
| 54 | int (*enqueue)(struct hci_uart *hu, struct sk_buff *skb); |
| 55 | struct sk_buff *(*dequeue)(struct hci_uart *hu); |
| 56 | }; |
| 57 | |
| 58 | struct hci_uart { |
| 59 | struct tty_struct *tty; |
| 60 | struct hci_dev *hdev; |
| 61 | unsigned long flags; |
| 62 | |
| 63 | struct hci_uart_proto *proto; |
| 64 | void *priv; |
| 65 | |
| 66 | struct sk_buff *tx_skb; |
| 67 | unsigned long tx_state; |
| 68 | spinlock_t rx_lock; |
| 69 | }; |
| 70 | |
| 71 | /* HCI_UART flag bits */ |
| 72 | #define HCI_UART_PROTO_SET 0 |
| 73 | |
| 74 | /* TX states */ |
| 75 | #define HCI_UART_SENDING 1 |
| 76 | #define HCI_UART_TX_WAKEUP 2 |
| 77 | |
| 78 | int hci_uart_register_proto(struct hci_uart_proto *p); |
| 79 | int hci_uart_unregister_proto(struct hci_uart_proto *p); |
| 80 | int hci_uart_tx_wakeup(struct hci_uart *hu); |
| 81 | |
| 82 | #endif /* __KERNEL__ */ |