|
From: Mattias A. <mat...@us...> - 2001-03-30 12:44:13
|
The following file was modified in apps/bluetooth/experimental:
Name Old version New version Comment
---- ----------- ----------- -------
bt_vendor.c 1.4 1.5=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
updated according to changes
replace redundant code with functions
fixed communication with usermode stack
minor changes & cleanup
The diff of the modified file(s):
--- bt_vendor.c 2001/03/21 18:27:23 1.4
+++ bt_vendor.c 2001/03/30 12:44:11 1.5
@@ -68,7 +68,6 @@
=20
#include "bt_misc.h"
#include "bt_vendor.h"
-#include "bt_conf.h"
#include "bt_if.h"
=20
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
@@ -86,7 +85,7 @@
void
init_hw(int bt_cfd, int phys_fd, int spd)
{
- bt_set_writescanenable(bt_cfd, 0 /* not used */);
+ bt_write_scan_enable(bt_cfd, 0 /* not used */);
=20
sleep(1);
=20
@@ -148,25 +147,14 @@
printf("Poll_Period : 0x%x\n", ecs_test_msg[11]);
printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[12]);
printf("Length_Of_Test_Data : 0x%x\n", tmp[8]);
-
-#ifndef BT_USERSTACK
- test_msg[0] =3D 16;
- memcpy(test_msg + 1, ecs_test_msg, 16);
=20
- if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0)
- {
- perror("ecs_testctrl");
- }
-#else
- hci_send_raw_data(test_msg, 16);
-#endif
+ bt_send_raw_data(test_msg, 16);
}
=20
void
ericsson_enter_test_mode(int bt_cfd, int* tmp)
{
unsigned char ecs_test_msg[7];
- unsigned char test_msg[16];
=20=20=20=20=20
ecs_test_msg[0] =3D CMD_PKT;
ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_ENTER_TEST_MODE, MANUFACTURER_=
SPEC);
@@ -177,17 +165,7 @@
=20=20=20=20=20
printf("*** Sending enter test mode (handle : 0x%x)***\n", tmp[0]);
=20
- test_msg[0] =3D 7;
- memcpy(test_msg + 1, ecs_test_msg, 7);
-=20=20=20=20
-#ifndef BT_USERSTACK
- if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0)
- {
- perror("ecs_entertest");
- }
-#else
- hci_send_raw_data(test_msg, 7);
-#endif
+ bt_send_raw_data(ecs_test_msg, 7);
}
=20
void
@@ -216,7 +194,6 @@
printf("Returned handle : %d\n", hdl);
}
=20
-
void
ericsson_tx_test(int bt_cfd, int* tmp)
{
@@ -224,7 +201,6 @@
unsigned char test_msg[17];
int i;
=20
-=20=20
ecs_test_msg[0] =3D CMD_PKT;
ecs_test_msg[1] =3D OPCODE_LSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC);
ecs_test_msg[2] =3D OPCODE_MSB(ERICSSON_TX_TEST, MANUFACTURER_SPEC);
@@ -254,23 +230,15 @@
printf("Test_Packet_Type : 0x%x\n", ecs_test_msg[13]);
printf("Length_Of_Test_Data : 0x%x\n", tmp[10]);
=20=20=20
-#ifndef BT_USERSTACK
-
- test_msg[0] =3D 17;
- memcpy(test_msg + 1, ecs_test_msg, 17);
+ bt_send_raw_data(bt_cfd, test_msg, 17);
=20=20=20
- if (ioctl(bt_cfd, HCISENDRAWDATA, test_msg) < 0)
- {
- perror("ecs_txtest");
- }
-#else
- hci_send_raw_data(test_msg, 17);
-#endif
printf("TX test starting.\n");
}
-#endif
=20
+#endif /* ECS_TEST_FUNCTIONS */
+
#elif HW_USED(HW_DIGIANSWER)
+
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
/* Digianswer specific commands */
/* =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
@@ -284,19 +252,8 @@
init_hw(int bt_cfd, int phys_fd, int spd)
{
printf("Setting baudrate in Digianswer PC card\n");
-#ifndef BT_USERSTACK
- if (ioctl(bt_cfd, HCISETBAUDRATE, &spd) < 0)
- {
- perror("HCISETBAUDRATE");
- exit(1);
- }
-#else
- hci_set_baudrate(spd);
-#if DIGI_DONGLE_SUPPORT
- hci_set_baudrate(115200);
-#endif
=20
-#endif
+ bt_set_baudrate(spd);
=20=20=20
if (spd > 115200)
{
@@ -322,49 +279,32 @@
fd_setup(fd, 115200, USE_FLOW_CTRL);
}
=20
+/* fixme -- remove hardcoded values */
void
init_hw(int bt_cfd, int phys_fd, int spd)
{=20=20
-#ifndef BT_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
- unsigned int tmp[2];
- tmp[0]=3D0x50;
- tmp[1]=3D0x20;
=20=20=20
- sleep(1);
printf("Setting write_scan_enable in CSR module!\n");
=20=20=20
- if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0)
- {=20
- perror("HCIWRITESCANENABLE");
- exit(1);
- }
+ bt_write_scan_enable(bt_cfd, wrscan);
=20=20=20
/* improves reliability when doing a connect */
printf("Setting write_pagescan_activity in CSR module!\n");
- if (ioctl(bt_cfd, HCIWRITEPAGESCANACTIVITY, &tmp) < 0)
- {=20
- perror("HCIWRITESCANENABLE");
- exit(1);
- }
=20
+ bt_write_pagescan_activity(bt_cfd, 0x50, 0x20);
+
sleep(1);
=20
syslog(LOG_INFO, "Setting baudrate in CSR module!\n");=20=20
=20
bt_set_baudrate(bt_cfd, spd);
=20=20=20
+ syslog(LOG_INFO, "Baudrate set\n");
+=20=20
/* Now set phys device speed to whatever HW was set to use */
fd_setup(phys_fd, spd, USE_FLOW_CTRL);
tcflush(phys_fd, TCIOFLUSH);
-
-#else
- printf("Setting write_scan_enable in CSR module!\n");
- hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);
- printf("Setting write_pagescan_activity in CSR module!\n");
- hci_write_pagescan_activity(0x50, 0x20); /* more reliable connection pro=
cess */
- sleep(1); /* wait for HW */
-#endif
}
=20
#elif HW_USED(HW_GENERIC)
@@ -382,18 +322,10 @@
{
#ifndef BT_USERSTACK
unsigned int wrscan =3D (PAGE_SCAN_ENABLE | INQUIRY_SCAN_ENABLE);
- sleep(1);
+
printf("Setting write_scan_enable in USB module!\n");
=20=20=20
- if (ioctl(bt_cfd, HCIWRITESCANENABLE, &wrscan) < 0)
- {=20
- perror("HCIWRITESCANENABLE");
- exit(1);
- }
-#else
- hci_write_scan_enable(PAGE_SCAN_ENABLE|INQUIRY_SCAN_ENABLE);
- sleep(1); /* wait for HW */
-#endif
+ bt_write_scan_enable(bt_cfd, wrscan);
}
=20
#elif HW_USED(HW_NOINIT)
@@ -429,6 +361,11 @@
=20
=20
#endif /* HW_USED() */
+
+
+
+
+#endif /* TEST */
=20
/*********************************************************************/
=20
|