summaryrefslogtreecommitdiffstats
path: root/hci
diff options
context:
space:
mode:
authorYK Jeffrey Chao <jechao@broadcom.com>2012-07-12 23:18:33 -0700
committerMatthew Xie <mattx@google.com>2012-07-26 23:06:33 -0700
commit166d2bcf4138febaa33407b11a4a3e02333a012c (patch)
treefff4636f333bae71465f89533028d3314e0a6f9a /hci
parent0604d2d72ff493bfe710f95c20f6a3bbc2a2cb38 (diff)
downloadexternal_bluetooth_bluedroid-166d2bcf4138febaa33407b11a4a3e02333a012c.zip
external_bluetooth_bluedroid-166d2bcf4138febaa33407b11a4a3e02333a012c.tar.gz
external_bluetooth_bluedroid-166d2bcf4138febaa33407b11a4a3e02333a012c.tar.bz2
HCI/Vendor lib: revise the way of making baud rate change (1/2)
The original baud rate change was done through closing the existing UART port then reopening UART port at new baud rate. It was reported that this approach would cause trouble on some platforms which spits out false start-bit signal on UART bus during port close and open process. Revise the way of doing baud rate change to use terminal I/O (termios) control functions. Change-Id: I18ab5a234576147dd9185eafd1e57d3b4e3fa2bd Conflicts: hci/src/userial.c
Diffstat (limited to 'hci')
-rw-r--r--hci/include/bt_vendor_lib.h12
-rw-r--r--hci/src/bt_hci_bdroid.c4
-rw-r--r--hci/src/bt_hw.c24
-rw-r--r--hci/src/userial.c43
4 files changed, 14 insertions, 69 deletions
diff --git a/hci/include/bt_vendor_lib.h b/hci/include/bt_vendor_lib.h
index 202acce..867ca68 100644
--- a/hci/include/bt_vendor_lib.h
+++ b/hci/include/bt_vendor_lib.h
@@ -64,6 +64,7 @@ typedef enum {
BT_VND_OP_SCO_CFG,
BT_VND_OP_USERIAL_OPEN,
BT_VND_OP_USERIAL_CLOSE,
+ BT_VND_OP_USERIAL_SET_BAUD,
BT_VND_OP_GET_LPM_IDLE_TIMEOUT,
BT_VND_OP_LPM_SET_MODE,
BT_VND_OP_LPM_WAKE_SET_STATE,
@@ -87,11 +88,6 @@ typedef enum {
BT_VND_OP_RESULT_FAIL,
} bt_vendor_op_result_t;
-/** Userial control ID */
-typedef enum {
- BT_VND_USERIAL_SET_BAUD,
-} bt_vendor_userial_cid_t;
-
/*
* Bluetooth Host/Controller Vendor callback structure.
*/
@@ -111,9 +107,6 @@ typedef void (*tINT_CMD_CBACK)(void *p_mem);
/* hci command packet transmit callback (callout) */
typedef uint8_t (*cmd_xmit_cb)(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback);
-/* userial control callback (callout) */
-typedef void (*userial_ctrl_cb)(bt_vendor_userial_cid_t cid, void *param);
-
typedef struct {
/** set to sizeof(bt_vendor_callbacks_t) */
size_t size;
@@ -135,9 +128,6 @@ typedef struct {
/* hci command packet transmit request */
cmd_xmit_cb xmit_cb;
-
- /* userial control request */
- userial_ctrl_cb usrl_ctrl_cb;
} bt_vendor_callbacks_t;
/*
diff --git a/hci/src/bt_hci_bdroid.c b/hci/src/bt_hci_bdroid.c
index 2450ed5..85199ec 100644
--- a/hci/src/bt_hci_bdroid.c
+++ b/hci/src/bt_hci_bdroid.c
@@ -368,7 +368,7 @@ static void *bt_hc_worker_thread(void *arg)
uint16_t events;
HC_BT_HDR *p_msg, *p_next_msg;
- BTHCDBG("bt_hc_worker_thread started");
+ ALOGI("bt_hc_worker_thread started");
tx_cmd_pkts_pending = FALSE;
while (lib_running)
@@ -497,7 +497,7 @@ static void *bt_hc_worker_thread(void *arg)
break;
}
- BTHCDBG("bt_hc_worker_thread exiting");
+ ALOGI("bt_hc_worker_thread exiting");
pthread_exit(NULL);
diff --git a/hci/src/bt_hw.c b/hci/src/bt_hw.c
index 414ee60..1705213 100644
--- a/hci/src/bt_hw.c
+++ b/hci/src/bt_hw.c
@@ -192,27 +192,6 @@ static uint8_t xmit_cb(uint16_t opcode, void *p_buf, tINT_CMD_CBACK p_cback)
return hci_h4_send_int_cmd(opcode, (HC_BT_HDR *)p_buf, p_cback);
}
-/******************************************************************************
-**
-** Function usrl_ctrl_cb
-**
-** Description HOST/CONTROLLER VEDNOR LIB CALLOUT API - This function is
-** called from the libbt-vendor in order to configure userial
-** attributes.
-**
-** Returns None
-**
-******************************************************************************/
-static void usrl_ctrl_cb(bt_vendor_userial_cid_t cid, void *param)
-{
- if (cid == BT_VND_USERIAL_SET_BAUD)
- {
- uint8_t *baud = (uint8_t *) param;
-
- userial_change_baud(*baud);
- }
-}
-
/*****************************************************************************
** The libbt-vendor Callback Functions Table
*****************************************************************************/
@@ -223,8 +202,7 @@ static const bt_vendor_callbacks_t vnd_callbacks = {
lpm_vnd_cb,
alloc,
dealloc,
- xmit_cb,
- usrl_ctrl_cb
+ xmit_cb
};
/******************************************************************************
diff --git a/hci/src/userial.c b/hci/src/userial.c
index 988f2f8..92540c9 100644
--- a/hci/src/userial.c
+++ b/hci/src/userial.c
@@ -116,27 +116,6 @@ typedef struct
static tUSERIAL_CB userial_cb;
static volatile uint8_t userial_running = 0;
-/* for friendly debugging outpout string */
-static uint32_t userial_baud_tbl[] =
-{
- 300, /* USERIAL_BAUD_300 0 */
- 600, /* USERIAL_BAUD_600 1 */
- 1200, /* USERIAL_BAUD_1200 2 */
- 2400, /* USERIAL_BAUD_2400 3 */
- 9600, /* USERIAL_BAUD_9600 4 */
- 19200, /* USERIAL_BAUD_19200 5 */
- 57600, /* USERIAL_BAUD_57600 6 */
- 115200, /* USERIAL_BAUD_115200 7 */
- 230400, /* USERIAL_BAUD_230400 8 */
- 460800, /* USERIAL_BAUD_460800 9 */
- 921600, /* USERIAL_BAUD_921600 10 */
- 1000000, /* USERIAL_BAUD_1M 11 */
- 1500000, /* USERIAL_BAUD_1_5M 12 */
- 2000000, /* USERIAL_BAUD_2M 13 */
- 3000000, /* USERIAL_BAUD_3M 14 */
- 4000000 /* USERIAL_BAUD_4M 15 */
-};
-
/******************************************************************************
** Static functions
******************************************************************************/
@@ -551,18 +530,16 @@ void userial_close(void)
*******************************************************************************/
void userial_change_baud(uint8_t baud)
{
- USERIALDBG("userial_change_baud: Closing UART Port");
- userial_close();
-
- utils_delay(100);
-
- /* change baud rate in settings - leave everything else the same */
- userial_cb.cfg.baud = baud;
-
- ALOGI("userial_change_rate: Attempting to reopen the UART Port at %i", \
- (unsigned int)userial_baud_tbl[baud]);
-
- userial_open(userial_cb.port, &userial_cb.cfg);
+ /* Calling vendor-specific part */
+ if (bt_vnd_if)
+ {
+ bt_vnd_if->op(BT_VND_OP_USERIAL_SET_BAUD, &baud);
+ }
+ else
+ {
+ ALOGE("userial_change_baud: missing vendor lib interface !!!");
+ ALOGE("userial_change_baud: unable to change UART baud rate");
+ }
}
/*******************************************************************************