Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 10523
b: refs/heads/master
c: 20dd6f5
h: refs/heads/master
i:
  10521: f62d310
  10519: 7c612c7
v: v3
  • Loading branch information
Marcel Holtmann committed Oct 28, 2005
1 parent 48661fc commit 324acdc
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 408c1ce2716c7a004851c93f9f9dcf3d763bc240
refs/heads/master: 20dd6f59d6ea5fe47397c5254606c76b1d047727
8 changes: 0 additions & 8 deletions trunk/drivers/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,6 @@ config BT_HCIUART_BCSP

Say Y here to compile support for HCI BCSP protocol.

config BT_HCIUART_BCSP_TXCRC
bool "Transmit CRC with every BCSP packet"
depends on BT_HCIUART_BCSP
help
If you say Y here, a 16-bit CRC checksum will be transmitted along with
every BCSP (BlueCore Serial Protocol) packet sent to the Bluetooth chip.
This increases reliability, but slightly reduces efficiency.

config BT_HCIBCM203X
tristate "HCI BCM203x USB driver"
depends on USB
Expand Down
42 changes: 23 additions & 19 deletions trunk/drivers/bluetooth/hci_bcsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* $Id: hci_bcsp.c,v 1.2 2002/09/26 05:05:14 maxk Exp $
*/

#define VERSION "0.2"
#define VERSION "0.3"

#include <linux/config.h>
#include <linux/module.h>
Expand Down Expand Up @@ -60,6 +60,7 @@
#define BT_DBG( A... )
#endif

static int txcrc = 1;
static int hciextn = 1;

/* ---- BCSP CRC calculation ---- */
Expand Down Expand Up @@ -173,11 +174,8 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
{
struct sk_buff *nskb;
u8 hdr[4], chan;
int rel, i;

#ifdef CONFIG_BT_HCIUART_BCSP_TXCRC
u16 BCSP_CRC_INIT(bcsp_txmsg_crc);
#endif
int rel, i;

switch (pkt_type) {
case HCI_ACLDATA_PKT:
Expand Down Expand Up @@ -240,9 +238,9 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
BT_DBG("Sending packet with seqno %u", bcsp->msgq_txseq);
bcsp->msgq_txseq = ++(bcsp->msgq_txseq) & 0x07;
}
#ifdef CONFIG_BT_HCIUART_BCSP_TXCRC
hdr[0] |= 0x40;
#endif

if (bcsp->use_crc)
hdr[0] |= 0x40;

hdr[1] = ((len << 4) & 0xff) | chan;
hdr[2] = len >> 4;
Expand All @@ -251,25 +249,25 @@ static struct sk_buff *bcsp_prepare_pkt(struct bcsp_struct *bcsp, u8 *data,
/* Put BCSP header */
for (i = 0; i < 4; i++) {
bcsp_slip_one_byte(nskb, hdr[i]);
#ifdef CONFIG_BT_HCIUART_BCSP_TXCRC
bcsp_crc_update(&bcsp_txmsg_crc, hdr[i]);
#endif

if (bcsp->use_crc)
bcsp_crc_update(&bcsp_txmsg_crc, hdr[i]);
}

/* Put payload */
for (i = 0; i < len; i++) {
bcsp_slip_one_byte(nskb, data[i]);
#ifdef CONFIG_BT_HCIUART_BCSP_TXCRC
bcsp_crc_update(&bcsp_txmsg_crc, data[i]);
#endif

if (bcsp->use_crc)
bcsp_crc_update(&bcsp_txmsg_crc, data[i]);
}

#ifdef CONFIG_BT_HCIUART_BCSP_TXCRC
/* Put CRC */
bcsp_txmsg_crc = bcsp_crc_reverse(bcsp_txmsg_crc);
bcsp_slip_one_byte(nskb, (u8) ((bcsp_txmsg_crc >> 8) & 0x00ff));
bcsp_slip_one_byte(nskb, (u8) (bcsp_txmsg_crc & 0x00ff));
#endif
if (bcsp->use_crc) {
bcsp_txmsg_crc = bcsp_crc_reverse(bcsp_txmsg_crc);
bcsp_slip_one_byte(nskb, (u8) ((bcsp_txmsg_crc >> 8) & 0x00ff));
bcsp_slip_one_byte(nskb, (u8) (bcsp_txmsg_crc & 0x00ff));
}

bcsp_slip_msgdelim(nskb);
return nskb;
Expand Down Expand Up @@ -698,6 +696,9 @@ static int bcsp_open(struct hci_uart *hu)

bcsp->rx_state = BCSP_W4_PKT_DELIMITER;

if (txcrc)
bcsp->use_crc = 1;

return 0;
}

Expand Down Expand Up @@ -743,5 +744,8 @@ int bcsp_deinit(void)
return hci_uart_unregister_proto(&bcsp);
}

module_param(txcrc, bool, 0644);
MODULE_PARM_DESC(txcrc, "Transmit CRC with every BCSP packet");

module_param(hciextn, bool, 0644);
MODULE_PARM_DESC(hciextn, "Convert HCI Extensions into BCSP packets");
1 change: 1 addition & 0 deletions trunk/drivers/bluetooth/hci_bcsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct bcsp_struct {
BCSP_ESCSTATE_ESC
} rx_esc_state;

u8 use_crc;
u16 message_crc;
u8 txack_req; /* Do we need to send ack's to the peer? */

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/bluetooth/hci_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*
* $Id: hci_ldisc.c,v 1.5 2002/10/02 18:37:20 maxk Exp $
*/
#define VERSION "2.1"
#define VERSION "2.2"

#include <linux/config.h>
#include <linux/module.h>
Expand Down

0 comments on commit 324acdc

Please sign in to comment.