hci_uart.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:2k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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