|
From: Peter K. <pk...@us...> - 2001-05-18 15:42:13
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_datagram.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Use get_unaligned() instead of CHAR2INT32().
* Rewrote send_sync() & co to not use kmalloc(), and only implement
the functionality once. Should now also be correct for big endian
machines.
The diff of the modified file(s):
--- bcsp_datagram.c 2001/05/17 15:25:15 1.2
+++ bcsp_datagram.c 2001/05/18 15:42:13 1.3
@@ -42,18 +42,21 @@
=20
/****************** INCLUDE FILES SECTION ********************************=
***/
=20
-#include <stdio.h>
#include <linux/malloc.h>
+#include <asm/byteorder.h>
+#include <asm/unaligned.h>
+
+#include <linux/bluetooth/sysdep-2.1.h>
#include <linux/bluetooth/bcsp.h>
#include <linux/bluetooth/bcsp_debug.h>
#include <linux/bluetooth/btcommon.h>
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
-#define SYNC 0xededdcda
-#define SYNC_RSP 0xeeefafac
-#define CONF 0xedacefad
-#define CONF_RSP 0xd0d0adde
+#define SYNC 0xEDEDDCDA
+#define SYNC_RSP 0xEEEFAFAC
+#define CONF 0xEDACEFAD
+#define CONF_RSP 0xD0D0ADDE
=20
#if DATAGRAM_DEBUG
#define D(fmt...) printk("DATAGRAM: " fmt)
@@ -70,6 +73,7 @@
static s32 handle_sync_pkt(struct bcsp *bcsp);
static s32 send_sync_rsp(void);
static s32 send_conf_rsp(void);
+static s32 send_sync_pkt(u32 type);
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
@@ -85,7 +89,7 @@
return 0;
}
=20
- D(__FUNCTION__ ": Datagram packet received\n");
+ D(__FUNCTION__ ": Datagram packet received:\n");
PRINTPKT(bcsp->payload, bcsp->payload_length);
=20=09
return 0;
@@ -109,12 +113,14 @@
s32
handle_sync_pkt(struct bcsp *bcsp)
{
-
u32 sync_string;
=20
- sync_string =3D CHAR2INT32(bcsp->payload[3],bcsp->payload[2],
- bcsp->payload[1],bcsp->payload[0]);
+ if (bcsp->payload_length < sizeof(u32)) {
+ return FALSE;
+ }
=20
+ sync_string =3D le32_to_cpu(get_unaligned((u32 *)bcsp->payload));
+
if (sync_string =3D=3D SYNC) {
D(__FUNCTION__ ": Found SYNC\n");
send_sync_rsp();=09=09
@@ -126,83 +132,41 @@
} else {
return FALSE;
}
-=09
}
=20
s32
send_sync(void)
{
- struct bcsp bcsp;
- u32 sync =3D SYNC;
- s32 tmp;
-=09
- D(__FUNCTION__ "\n");
-
- init_bcsp_packet(&bcsp);
-=09
- bcsp.identifier =3D 1;=20=20
- bcsp.payload_length =3D 4;
-
- if (!(bcsp.payload =3D kmalloc(bcsp.payload_length, GFP_ATOMIC))) {
- return -ENOMEM;
- }
- memcpy(bcsp.payload, &sync, bcsp.payload_length);
-
- PRINTPKT(bcsp.payload, bcsp.payload_length);
-
- tmp =3D mux_send(&bcsp);
- kfree(bcsp.payload);
- return tmp;
+ return send_sync_pkt(SYNC);
}
=20
s32
send_sync_rsp(void)
{
- struct bcsp bcsp;
- s32 tmp;
- u32 sync_rsp =3D SYNC_RSP;
-
- D(__FUNCTION__ "\n");
-
- init_bcsp_packet(&bcsp);
-
- bcsp.identifier =3D 1;=20=20
- bcsp.payload_length =3D 4;
-
- if (!(bcsp.payload =3D kmalloc(bcsp.payload_length, GFP_ATOMIC))) {
- return -ENOMEM;
+ return send_sync_pkt(SYNC_RSP);
}
- memcpy(bcsp.payload, &sync_rsp, bcsp.payload_length);
-
- PRINTPKT(bcsp.payload, bcsp.payload_length);
=20
- tmp =3D mux_send(&bcsp);
- kfree(bcsp.payload);
- return tmp;
+s32
+send_conf_rsp(void)
+{
+ return send_sync_pkt(CONF_RSP);
}
=20
s32
-send_conf_rsp(void)
+send_sync_pkt(u32 type)
{
struct bcsp bcsp;
- s32 tmp;
- u32 conf_rsp =3D CONF_RSP;
+ u32 payload =3D cpu_to_le32(type);
=20=09
D(__FUNCTION__ "\n");
=20
init_bcsp_packet(&bcsp);
=20=09
bcsp.identifier =3D 1;=20
- bcsp.payload_length =3D 4;
-
- if (!(bcsp.payload =3D kmalloc(bcsp.payload_length, GFP_ATOMIC))) {
- return -ENOMEM;
- }
- memcpy(bcsp.payload, &conf_rsp, bcsp.payload_length);
+ bcsp.payload =3D (u8 *)&payload;
+ bcsp.payload_length =3D sizeof(u32);
=20
- tmp =3D mux_send(&bcsp);
- kfree(bcsp.payload);
- return tmp;
+ return mux_send(&bcsp);
}
=20
/****************** END OF FILE sequence.c *******************************=
***/
|
|
From: Mats F. <ma...@us...> - 2001-05-25 14:09:18
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_datagram.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Use one function for all sync-msg
The diff of the modified file(s):
--- bcsp_datagram.c 2001/05/18 16:03:51 1.4
+++ bcsp_datagram.c 2001/05/25 14:09:17 1.5
@@ -53,11 +53,6 @@
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
-#define SYNC 0xEDEDDCDA
-#define SYNC_RSP 0xEEEFAFAC
-#define CONF 0xEDACEFAD
-#define CONF_RSP 0xD0D0ADDE
-
#if DATAGRAM_DEBUG
#define D(fmt...) printk("DATAGRAM: " fmt)
#define PRINTPKT(data, len) print_data(NULL, data, len)
@@ -121,39 +116,29 @@
=20=09
sync_string =3D le32_to_cpu(get_unaligned((u32 *)bcsp->payload));
=20
- if (sync_string =3D=3D SYNC) {
+ switch (sync_string) {
+ case SYNC:=09
D(__FUNCTION__ ": Found SYNC\n");
- send_sync_rsp();=09=09
+ bcsp_send_sync(SYNC_RSP);=09=09
return TRUE;
- } else if (sync_string =3D=3D CONF) {
+ case SYNC_RSP:
+ D(__FUNCTION__": Found SYNC_RSP\n");
+ bcsp_send_sync(CONF);
+ break;
+ case CONF:
D(__FUNCTION__ ": Found CONF\n");
- send_conf_rsp();
+ bcsp_send_sync(CONF_RSP);
return TRUE;
- } else {
+ case CONF_RSP:
+ D(__FUNCTION__": Found CONF_RSP\n");
+ break;
+ default:
return FALSE;
}
}
=20
s32
-bcsp_send_sync(void)
-{
- return send_sync_pkt(SYNC);
-}
-
-s32
-send_sync_rsp(void)
-{
- return send_sync_pkt(SYNC_RSP);
-}
-
-s32
-send_conf_rsp(void)
-{
- return send_sync_pkt(CONF_RSP);
-}
-
-s32
-send_sync_pkt(u32 type)
+bcsp_send_sync(u32 type)
{
struct bcsp bcsp;
u32 payload =3D cpu_to_le32(type);
|
|
From: Mattias A. <mat...@us...> - 2001-06-06 14:55:54
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_datagram.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added init function to unchoke datastream
* Silent discard on CONF messages (used to detect restart option)
* Always reply on SYNC
* Call bcsp_syncronized only when receiving SYNC_RSP
The diff of the modified file(s):
--- bcsp_datagram.c 2001/05/30 09:47:00 1.6
+++ bcsp_datagram.c 2001/06/06 14:55:53 1.7
@@ -48,6 +48,7 @@
#include <asm/byteorder.h>
#include <asm/unaligned.h>
=20
+
#include <linux/bluetooth/sysdep-2.1.h>
#include <linux/bluetooth/bcsp.h>
#include <linux/bluetooth/bcsp_debug.h>
@@ -72,17 +73,33 @@
static s32 send_conf_rsp(void);
static s32 send_sync_pkt(u32 type);
=20
+static s32 bcsp_datagram_initiated =3D 0;
+
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
+void=20
+bcsp_datagram_init(void)
+{
+ bcsp_datagram_initiated =3D 1;
+}
+
+void=20
+bcsp_datagram_shutdown(void)
+{
+ bcsp_datagram_initiated =3D 0;
+}
+
s32
bcsp_datagram_receive(struct bcsp *bcsp)
{
+ if (!bcsp_datagram_initiated)
+ return;
+
if (handle_sync_pkt(bcsp)) {
- D(__FUNCTION__ ": Sync packet received, sending respose\n");
return 0;
}
=20
@@ -119,21 +136,25 @@
sync_string =3D le32_to_cpu(get_unaligned((u32 *)bcsp->payload));
=20
switch (sync_string) {
+
case SYNC:=09
D(__FUNCTION__ ": Found SYNC\n");
+ D(__FUNCTION__ ": Send SYNC_RSP\n");
bcsp_send_sync(SYNC_RSP);=09=09
return TRUE;
+
case SYNC_RSP:
D(__FUNCTION__": Found SYNC_RSP\n");
- bcsp_send_sync(CONF);
- break;
- case CONF:
- D(__FUNCTION__ ": Found CONF\n");
- bcsp_send_sync(CONF_RSP);
+ bcsp_syncronized();
return TRUE;
+
+ case CONF: /* this should always be done */
+ D(__FUNCTION__ ": Found CONF, silent discard\n");
+ return TRUE;
+
case CONF_RSP:
D(__FUNCTION__": Found CONF_RSP\n");
- break;
+ return TRUE;
default:
return FALSE;
}
@@ -145,8 +166,6 @@
struct bcsp bcsp;
u32 payload =3D cpu_to_le32(type);
=20=09
- D(__FUNCTION__ "\n");
-
bcsp_init_packet(&bcsp);
=20=09
bcsp.identifier =3D 1;=20
|
|
From: Peter K. <pk...@us...> - 2001-07-31 18:06:42
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_datagram.c 1.7 1.8=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Fixed a couple of compiler warnings.
The diff of the modified file(s):
--- bcsp_datagram.c 2001/06/06 14:55:53 1.7
+++ bcsp_datagram.c 2001/07/31 18:06:40 1.8
@@ -69,16 +69,13 @@
/****************** LOCAL FUNCTION DECLARATION SECTION *******************=
***/
=20
static s32 handle_sync_pkt(struct bcsp *bcsp);
-static s32 send_sync_rsp(void);
-static s32 send_conf_rsp(void);
-static s32 send_sync_pkt(u32 type);
-
-static s32 bcsp_datagram_initiated =3D 0;
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
+static s32 bcsp_datagram_initiated =3D 0;
+
/****************** FUNCTION DEFINITION SECTION **************************=
***/
=20
void=20
@@ -97,7 +94,7 @@
bcsp_datagram_receive(struct bcsp *bcsp)
{
if (!bcsp_datagram_initiated)
- return;
+ return 0; /* FIXME: Should this be an error code? */
=20
if (handle_sync_pkt(bcsp)) {
return 0;
|
|
From: Willy S. <sag...@us...> - 2002-04-11 08:33:24
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bcsp_datagram.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 The accompanying log: Added linux version ifdef for malloc.h/slab.h The diff of the modified file(s): --- bcsp_datagram.c 18 Sep 2001 13:04:27 -0000 1.10 +++ bcsp_datagram.c 11 Apr 2002 08:33:23 -0000 1.11 @@ -45,7 +45,11 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#if LINUX_VERSION_CODE >=3D 0x20200 +#include <linux/slab.h> +#else #include <linux/malloc.h> +#endif =20 #include <asm/byteorder.h> #include <asm/unaligned.h> |
|
From: Peter K. <pk...@us...> - 2003-05-15 13:27:46
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Tag Comment
---- ----------- ----------- --- -------
bcsp_datagram.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20
The accompanying log:
* Send a CONF_RSP packet when a CONF packet is received.
* Do not use concatenation with __FUNCTION__ (it is deprecated).
The diff of the modified file(s):
--- bcsp_datagram.c 2002/08/01 16:19:28 1.12
+++ bcsp_datagram.c 2003/05/15 13:27:45 1.13
@@ -2,7 +2,7 @@
* bcsp_datagram.c -- Implementation of the Datagram layer in the BCSP
* protocol stack
*
- * Copyright (C) 2001 Axis Communications AB
+ * Copyright (C) 2001, 2002, 2003 Axis Communications AB
*
* Author: Mats Friden <Mat...@ax...>
*
@@ -109,13 +109,13 @@ bcsp_datagram_receive(struct bcsp *bcsp)
if (!bcsp_datagram_initiated)
return 0; /* FIXME: Should this be an error code? */
=20
+ D("%s: Datagram packet received:\n", __FUNCTION__);
+ PRINTPKT(bcsp->payload, bcsp->payload_length);
+
if (handle_sync_pkt(bcsp)) {
return 0;
}
=20
- D(__FUNCTION__ ": Datagram packet received:\n");
- PRINTPKT(bcsp->payload, bcsp->payload_length);
-=09
return 0;
}
=20
@@ -146,25 +146,27 @@ handle_sync_pkt(struct bcsp *bcsp)
sync_string =3D le32_to_cpu(get_unaligned((u32 *)bcsp->payload));
=20
switch (sync_string) {
-
case SYNC:=09
- D(__FUNCTION__ ": Found SYNC\n");
- D(__FUNCTION__ ": Send SYNC_RSP\n");
+ D("%s: Found SYNC\n", __FUNCTION__);
+ D("%s: Send SYNC_RSP\n", __FUNCTION__);
bcsp_send_sync(SYNC_RSP);
return TRUE;
=20
case SYNC_RSP:
- D(__FUNCTION__": Found SYNC_RSP\n");
+ D("%s: Found SYNC_RSP\n", __FUNCTION__);
bcsp_syncronized();
return TRUE;
=20
case CONF: /* this should always be done */
- D(__FUNCTION__ ": Found CONF, silent discard\n");
+ D("%s: Found CONF\n", __FUNCTION__);
+ D("%s: Send CONF_RSP\n", __FUNCTION__);
+ bcsp_send_sync(CONF_RSP);
return TRUE;
=20
case CONF_RSP:
- D(__FUNCTION__": Found CONF_RSP\n");
+ D("%s: Found CONF_RSP\n", __FUNCTION__);
return TRUE;
+
default:
return FALSE;
}
|