⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btusb_driver_dep.h

📁 牛人写的一个蓝牙驱动教学程序
💻 H
字号:
/* *  Wipro Bluetooth HCI USB Transport Layer.  *  This file is part of the "Wipro Bluetooth USB Driver for Linux". *  Copyright (C) 2001  Wipro Technologies. <www.wipro.com>  *   *  This library is free software; you can redistribute it and/or *  modify it under the terms of the GNU Library General Public *  License as published by the Free Software Foundation; either *  version 2 of the License, or (at your option) any later version. *   *  This library 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 *  Library General Public License for more details. * *  You should have received a copy of the GNU Library General Public *  License along with this library; if not, write to the Free *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * *  Please forward any queries regarding the driver to  *  Nitant Kulkarni - Nitant.Kulkarni@wipro.com *  Kamal K N - kamala.kodi@wipro.com *  Burgupalli Chaitanya - Chaitanya.Burgupalli@wipro.com *  Sadashivan Manicham  - Sadashivan.Manickam@wipro.com * */													/* * * NAME        : btusb_driver_dep.h * * DESCRIPTION : This is the header file of Bluetooth USB transport layer *               on Linux OS. It contains all the header file includes, *               module specific data structures definitions, static data *               declaration, type defines, constant defines, macros *               definitions for filling of URBs global data structure *               declarations and function prototypes of Bluetooth USB *               class driver. * */#ifndef BTUSB_DRIVER_H#define BTUSB_DRIVER_H#define LINUX_USB_DRIVER#ifdef  LINUX_USB_DRIVER#if 1 /* make this 1 if linux version is 2.4 or greater */#define LINUX_2_4#endif /* 1 */#include <linux/usb.h>/* Macros *//* Added by Sadashivan, 26 Jun, 2001, for Queueing of URB's (begin) */#define URB_QUEUEING_SUPPORT /* Added by Sadashivan, 26 Jun, 2001, for Queueing of URB's (end) *//* Macro to find the type of URB pipe */#define TYPE_OF_URB_PIPE usb_pipetype#define BTUSB_REGISTER_CLASS_DRIVER(x)\        usb_register(x)#define BTUSB_UNREGISTER_CLASS_DRIVER(x)\        usb_deregister(x)#define BTUSB_ALLOC_URB(x)\        usb_alloc_urb(x)#define BTUSB_SUBMIT_URB(x)\        usb_submit_urb(x)#define BTUSB_UNLINK_URB(x)\        usb_unlink_urb(x)#define BTUSB_FREE_URB(x)\        usb_free_urb(x)/* Macro to fill control URB */#define BT_FILL_CONTROL_OUT_URB(a,aa,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->setup_packet=aa;\    (a)->dev=b->devDesc;\    (a)->pipe=usb_sndctrlpipe(b->devDesc, 0);\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->complete=btusb_write_callback;\    (a)->context=b;\  } while (0)/* Macro to fill interrupt URB */#define BT_FILL_INT_IN_URB(a,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->dev=b->devDesc;\    (a)->pipe=usb_rcvintpipe(b->devDesc, b->interrupt_in_EPAddress);\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=b->interrupt_in_EPMaxPktSize;\    (a)->complete=btusb_read_callback;\    (a)->interval=b->interrupt_in_EPInterval;\    (a)->context=b;\    (a)->start_frame=-1;\  } while (0)/* Macro to fill bulk-OUT URB */#ifdef URB_QUEUEING_SUPPORT #define BT_FILL_BULK_OUT_URB(a,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->setup_packet=NULL;\    (a)->dev=b->devDesc;\    (a)->transfer_flags=USB_QUEUE_BULK;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->context=b;\    (a)->pipe=usb_sndbulkpipe(b->devDesc, b->bulk_out_EPAddress);\    (a)->complete=btusb_write_callback;\  } while (0)#else#define BT_FILL_BULK_OUT_URB(a,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->setup_packet=NULL;\    (a)->dev=b->devDesc;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->context=b;\    (a)->pipe=usb_sndbulkpipe(b->devDesc, b->bulk_out_EPAddress);\    (a)->complete=btusb_write_callback;\  } while (0)#endif /* URB_QUEUEING_SUPPORT *//* Macro to fill bulk-IN URB */#ifdef URB_QUEUEING_SUPPORT#define BT_FILL_BULK_IN_URB(a,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->setup_packet=NULL;\    (a)->dev=b->devDesc;\    (a)->transfer_flags=USB_QUEUE_BULK;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->context=b;\    (a)->pipe=usb_rcvbulkpipe(b->devDesc, b->bulk_in_EPAddress);\    (a)->complete=btusb_read_callback;\  } while (0)#else#define BT_FILL_BULK_IN_URB(a,b,c,d) \  do {\    spin_lock_init(&(a)->lock);\    (a)->setup_packet=NULL;\    (a)->dev=b->devDesc;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->context=b;\    (a)->pipe=usb_rcvbulkpipe(b->devDesc, b->bulk_in_EPAddress);\    (a)->complete=btusb_read_callback;\  } while (0)#endif /* URB_QUEUEING_SUPPORT */ /* Macro to fill ISO-OUT URB */#define BT_FILL_ISO_OUT_URB(a,b,c,d,e) \  do {\    spin_lock_init(&(a)->lock);\    (a)->dev=b->devDesc;\    (a)->transfer_flags=USB_ISO_ASAP;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->number_of_packets=e;\    (a)->context=b;\    (a)->pipe=usb_sndisocpipe(b->devDesc, b->iso_out_EPAddress);\    (a)->complete=btusb_write_callback;\  } while (0)/* Macro to fill ISO-IN URB */#define BT_FILL_ISO_IN_URB(a,b,c,d,e) \  do {\    spin_lock_init(&(a)->lock);\    (a)->dev=b->devDesc;\    (a)->transfer_flags=USB_ISO_ASAP;\    (a)->transfer_buffer=c;\    (a)->transfer_buffer_length=d;\    (a)->number_of_packets=e;\    (a)->context=b;\    (a)->pipe=usb_rcvisocpipe(b->devDesc, b->iso_in_EPAddress);\    (a)->complete=btusb_read_callback;\  } while (0)/* --- End of macros --- */#endif /* LINUX_USB_DRIVER */#endif /* BTUSB_DRIVER_H */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -