summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-08-06 22:34:12 -0700
committerEthan Chen <intervigil@gmail.com>2013-08-07 11:43:21 -0700
commita37aa43aa596796f9d535f41092c14742761eb0d (patch)
treede8fa3b3be79f76ff9f7d5a905c2a65869b86670
parent94e39fa0c9a78d302e03461df5c31dee6dccf251 (diff)
downloaddevice_common-a37aa43aa596796f9d535f41092c14742761eb0d.zip
device_common-a37aa43aa596796f9d535f41092c14742761eb0d.tar.gz
device_common-a37aa43aa596796f9d535f41092c14742761eb0d.tar.bz2
libbt: Add support for using two stop bits
* This improves reliability on chips such as BCM4335. * Also externalize some configuration. Change-Id: I1271f0c1c3e602c8bfe9f816f57c9cb6add04b3a
-rw-r--r--libbt/include/bt_vendor_brcm.h5
-rw-r--r--libbt/src/conf.c5
-rw-r--r--libbt/src/hardware.c19
-rwxr-xr-xlibbt/src/userial_vendor.c26
4 files changed, 52 insertions, 3 deletions
diff --git a/libbt/include/bt_vendor_brcm.h b/libbt/include/bt_vendor_brcm.h
index 58feda0..9531df5 100644
--- a/libbt/include/bt_vendor_brcm.h
+++ b/libbt/include/bt_vendor_brcm.h
@@ -76,6 +76,11 @@
#define FW_PRE_PATCH ""
#endif
+/* Force use of two stop bits */
+#ifndef UART_FORCE_TWO_STOPBITS
+#define UART_FORCE_TWO_STOPBITS FALSE
+#endif
+
/* The millisecond delay pauses on HCI transport after firmware patches
* were downloaded. This gives some time for firmware to restart with
* patches before host attempts to send down any HCI commands.
diff --git a/libbt/src/conf.c b/libbt/src/conf.c
index 39ac12e..8800991 100644
--- a/libbt/src/conf.c
+++ b/libbt/src/conf.c
@@ -37,6 +37,8 @@
int userial_set_port(char *p_conf_name, char *p_conf_value, int param);
int hw_set_patch_file_path(char *p_conf_name, char *p_conf_value, int param);
int hw_set_patch_file_name(char *p_conf_name, char *p_conf_value, int param);
+int hw_set_pre_patch_file_name(char *p_conf_name, char *p_conf_value, int param);
+int userial_set_force_use_2_stop_bits(char *p_conf_name, char *p_conf_value, int param);
#if (VENDOR_LIB_RUNTIME_TUNING_ENABLED == TRUE)
int hw_set_patch_settlement_delay(char *p_conf_name, char *p_conf_value, int param);
#endif
@@ -70,6 +72,9 @@ static const conf_entry_t conf_table[] = {
{"UartPort", userial_set_port, 0},
{"FwPatchFilePath", hw_set_patch_file_path, 0},
{"FwPatchFileName", hw_set_patch_file_name, 0},
+ {"FwPrePatchFileName", hw_set_pre_patch_file_name, 0},
+ {"UartForceUse2StopBits", userial_set_force_use_2_stop_bits, 0},
+
#if (VENDOR_LIB_RUNTIME_TUNING_ENABLED == TRUE)
{"FwPatchSettlementDelay", hw_set_patch_settlement_delay, 0},
#endif
diff --git a/libbt/src/hardware.c b/libbt/src/hardware.c
index 392704e..df20c9f 100644
--- a/libbt/src/hardware.c
+++ b/libbt/src/hardware.c
@@ -1335,6 +1335,25 @@ int hw_set_patch_file_name(char *p_conf_name, char *p_conf_value, int param)
return 0;
}
+/*******************************************************************************
+**
+** Function hw_set_pre_patch_file_name
+**
+** Description Give the specific firmware pre-patch filename
+**
+** Returns 0 : Success
+** Otherwise : Fail
+**
+*******************************************************************************/
+int hw_set_pre_patch_file_name(char *p_conf_name, char *p_conf_value, int param)
+{
+
+ strcpy(fw_prepatch_name, p_conf_value);
+
+ return 0;
+}
+
+
#if (VENDOR_LIB_RUNTIME_TUNING_ENABLED == TRUE)
/*******************************************************************************
**
diff --git a/libbt/src/userial_vendor.c b/libbt/src/userial_vendor.c
index 1a745b5..5233d19 100755
--- a/libbt/src/userial_vendor.c
+++ b/libbt/src/userial_vendor.c
@@ -68,6 +68,7 @@ typedef struct
******************************************************************************/
static vnd_userial_cb_t vnd_userial;
+static int vnd_userial_force_2stopbits = UART_FORCE_TWO_STOPBITS;
/*****************************************************************************
** Helper Functions
@@ -215,10 +216,10 @@ int userial_vendor_open(tUSERIAL_CFG *p_cfg)
return -1;
}
- if(p_cfg->fmt & USERIAL_STOPBITS_1)
- stop_bits = 0;
- else if(p_cfg->fmt & USERIAL_STOPBITS_2)
+ if(vnd_userial_force_2stopbits || (p_cfg->fmt & USERIAL_STOPBITS_2))
stop_bits = CSTOPB;
+ else if(p_cfg->fmt & USERIAL_STOPBITS_1)
+ stop_bits = 0;
else
{
ALOGE("userial vendor open: unsupported stop bits");
@@ -359,3 +360,22 @@ int userial_set_port(char *p_conf_name, char *p_conf_value, int param)
return 0;
}
+/*******************************************************************************
+**
+** Function userial_set_force_use_2_stop_bits
+**
+** Description Configure UART port name
+**
+** Returns 0 : Success
+** Otherwise : Fail
+**
+*******************************************************************************/
+int userial_set_force_use_2_stop_bits(char *p_conf_name, char *p_conf_value, int param)
+{
+ if (strcmp(p_conf_value, "true") == 0)
+ vnd_userial_force_2stopbits = TRUE;
+ else
+ vnd_userial_force_2stopbits = FALSE;
+ return 0;
+}
+