Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142 Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
/*
|
||||
BlueZ - Bluetooth protocol stack for Linux
|
||||
Copyright (C) 2000-2001 Qualcomm Incorporated
|
||||
Copyright (c) 2000-2001, 2010-2011 Code Aurora Forum. All rights reserved.
|
||||
|
||||
Written 2000,2001 by Maxim Krasnyansky <maxk@qualcomm.com>
|
||||
|
||||
@@ -12,20 +12,20 @@
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
|
||||
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
|
||||
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
|
||||
ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
|
||||
COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
|
||||
SOFTWARE IS DISCLAIMED.
|
||||
*/
|
||||
|
||||
#ifndef __BLUETOOTH_H
|
||||
#define __BLUETOOTH_H
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/poll.h>
|
||||
@@ -38,6 +38,7 @@
|
||||
|
||||
/* Reserv for core and drivers use */
|
||||
#define BT_SKB_RESERVE 8
|
||||
#define BT_SKB_RESERVE_80211 32
|
||||
|
||||
#define BTPROTO_L2CAP 0
|
||||
#define BTPROTO_HCI 1
|
||||
@@ -65,24 +66,41 @@ struct bt_security {
|
||||
|
||||
#define BT_DEFER_SETUP 7
|
||||
|
||||
#define BT_FLUSHABLE 8
|
||||
|
||||
#define BT_FLUSHABLE_OFF 0
|
||||
#define BT_FLUSHABLE_ON 1
|
||||
|
||||
#define BT_POWER 9
|
||||
#define BT_POWER 8
|
||||
struct bt_power {
|
||||
__u8 force_active;
|
||||
};
|
||||
#define BT_POWER_FORCE_ACTIVE_OFF 0
|
||||
#define BT_POWER_FORCE_ACTIVE_ON 1
|
||||
|
||||
__attribute__((format (printf, 2, 3)))
|
||||
int bt_printk(const char *level, const char *fmt, ...);
|
||||
#define BT_AMP_POLICY 9
|
||||
|
||||
#define BT_INFO(fmt, arg...) bt_printk(KERN_INFO, pr_fmt(fmt), ##arg)
|
||||
#define BT_ERR(fmt, arg...) bt_printk(KERN_ERR, pr_fmt(fmt), ##arg)
|
||||
#define BT_DBG(fmt, arg...) pr_debug(fmt "\n", ##arg)
|
||||
/* Require BR/EDR (default policy)
|
||||
* AMP controllers cannot be used
|
||||
* Channel move requests from the remote device are denied
|
||||
* If the L2CAP channel is currently using AMP, move the channel to BR/EDR
|
||||
*/
|
||||
#define BT_AMP_POLICY_REQUIRE_BR_EDR 0
|
||||
|
||||
/* Prefer AMP
|
||||
* Allow use of AMP controllers
|
||||
* If the L2CAP channel is currently on BR/EDR and AMP controller
|
||||
* resources are available, initiate a channel move to AMP
|
||||
* Channel move requests from the remote device are allowed
|
||||
* If the L2CAP socket has not been connected yet, try to create
|
||||
* and configure the channel directly on an AMP controller rather
|
||||
* than BR/EDR
|
||||
*/
|
||||
#define BT_AMP_POLICY_PREFER_AMP 1
|
||||
|
||||
/* Prefer BR/EDR
|
||||
* Allow use of AMP controllers
|
||||
* If the L2CAP channel is currently on AMP, move it to BR/EDR
|
||||
* Channel move requests from the remote device are allowed
|
||||
*/
|
||||
#define BT_AMP_POLICY_PREFER_BR_EDR 2
|
||||
|
||||
#define BT_INFO(fmt, arg...) printk(KERN_INFO "Bluetooth: " fmt "\n" , ## arg)
|
||||
#define BT_ERR(fmt, arg...) printk(KERN_ERR "%s: " fmt "\n" , __func__ , ## arg)
|
||||
#define BT_DBG(fmt, arg...) pr_debug("%s: " fmt "\n" , __func__ , ## arg)
|
||||
|
||||
/* Connection and socket states */
|
||||
enum {
|
||||
@@ -102,8 +120,8 @@ typedef struct {
|
||||
__u8 b[6];
|
||||
} __packed bdaddr_t;
|
||||
|
||||
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0}})
|
||||
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff}})
|
||||
#define BDADDR_ANY (&(bdaddr_t) {{0, 0, 0, 0, 0, 0} })
|
||||
#define BDADDR_LOCAL (&(bdaddr_t) {{0, 0, 0, 0xff, 0xff, 0xff} })
|
||||
|
||||
/* Copy, swap, convert BD Address */
|
||||
static inline int bacmp(bdaddr_t *ba1, bdaddr_t *ba2)
|
||||
@@ -145,7 +163,7 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||
struct msghdr *msg, size_t len, int flags);
|
||||
int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
|
||||
struct msghdr *msg, size_t len, int flags);
|
||||
uint bt_sock_poll(struct file * file, struct socket *sock, poll_table *wait);
|
||||
uint bt_sock_poll(struct file *file, struct socket *sock, poll_table *wait);
|
||||
int bt_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
|
||||
int bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
|
||||
|
||||
@@ -154,15 +172,25 @@ void bt_accept_unlink(struct sock *sk);
|
||||
struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
|
||||
|
||||
/* Skb helpers */
|
||||
struct bt_l2cap_control {
|
||||
__u8 frame_type;
|
||||
__u8 final;
|
||||
__u8 sar;
|
||||
__u8 super;
|
||||
__u16 reqseq;
|
||||
__u16 txseq;
|
||||
__u8 poll;
|
||||
__u8 fcs;
|
||||
};
|
||||
|
||||
struct bt_skb_cb {
|
||||
__u8 pkt_type;
|
||||
__u8 incoming;
|
||||
__u16 expect;
|
||||
__u8 tx_seq;
|
||||
__u8 retries;
|
||||
__u8 sar;
|
||||
unsigned short channel;
|
||||
__u8 force_active;
|
||||
unsigned short channel;
|
||||
struct bt_l2cap_control control;
|
||||
};
|
||||
#define bt_cb(skb) ((struct bt_skb_cb *)((skb)->cb))
|
||||
|
||||
@@ -170,7 +198,8 @@ static inline struct sk_buff *bt_skb_alloc(unsigned int len, gfp_t how)
|
||||
{
|
||||
struct sk_buff *skb;
|
||||
|
||||
if ((skb = alloc_skb(len + BT_SKB_RESERVE, how))) {
|
||||
skb = alloc_skb(len + BT_SKB_RESERVE, how);
|
||||
if (skb) {
|
||||
skb_reserve(skb, BT_SKB_RESERVE);
|
||||
bt_cb(skb)->incoming = 0;
|
||||
}
|
||||
@@ -183,7 +212,8 @@ static inline struct sk_buff *bt_skb_send_alloc(struct sock *sk,
|
||||
struct sk_buff *skb;
|
||||
|
||||
release_sock(sk);
|
||||
if ((skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err))) {
|
||||
skb = sock_alloc_send_skb(sk, len + BT_SKB_RESERVE, nb, err);
|
||||
if (skb) {
|
||||
skb_reserve(skb, BT_SKB_RESERVE);
|
||||
bt_cb(skb)->incoming = 0;
|
||||
}
|
||||
@@ -208,7 +238,7 @@ out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int bt_to_errno(__u16 code);
|
||||
int bt_err(__u16 code);
|
||||
|
||||
extern int hci_sock_init(void);
|
||||
extern void hci_sock_cleanup(void);
|
||||
|
||||
Reference in New Issue
Block a user