meta-digi-dey: bluez5-5.41: ccim6ul: Modify hciattach

This commits adds patches to hciattach for the following:

* Strict flow control setting

  The hciattach application has a flow | noflow command line argument that is
  currently only applied on the first configuration of the uart port. The
  hciattach_rome plugin ignores this setting and assumes hardware flow
  control is always supported. This commits makes hciattach obey the user flow
  control indication.

* Modify hciattach_rome to set MAC address. The MAC address setting
  feature in the rome plugin now works with the command line specified
  MAC.

* Reduce verbosity. hciattach now accepts a "-v" verbose flag. By
  default verbose output it omitted.

https://jira.digi.com/browse/DEL-3711
https://jira.digi.com/browse/DEL-3436
https://jira.digi.com/browse/DEL-3636
https://jira.digi.com/browse/DEL-3955

Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
This commit is contained in:
Alex Gonzalez 2017-04-06 09:31:23 +02:00
parent 3ab6c6caa5
commit ae8e695cf7
4 changed files with 1089 additions and 0 deletions

View File

@ -0,0 +1,186 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Thu, 6 Apr 2017 09:27:09 +0200
Subject: [PATCH] hciattach_rome: Respect the user indication for noflow
When hciattach is called with noflow, it should not assume the hardware
supports hardware flow control.
Basically, use 'flow' or 'noflow' on the hciattach command line arguments
to indicate whether to use or not hardware flow control.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
tools/hciattach.c | 2 +-
tools/hciattach.h | 2 +-
tools/hciattach_rome.c | 50 +++++++++++++++++++++++++++++++++++---------------
tools/hciattach_rome.h | 1 +
4 files changed, 38 insertions(+), 17 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index dda639cabca3..81d78ab3f69a 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -286,7 +286,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
static int qca(int fd, struct uart_t *u, struct termios *ti)
{
fprintf(stderr,"qca\n");
- return qca_soc_init(fd, u->speed, u->bdaddr);
+ return qca_soc_init(fd, u->speed, u->bdaddr, ti);
}
static int qualcomm(int fd, struct uart_t *u, struct termios *ti)
diff --git a/tools/hciattach.h b/tools/hciattach.h
index 49e59321fcac..3524e716c847 100644
--- a/tools/hciattach.h
+++ b/tools/hciattach.h
@@ -64,7 +64,7 @@ int ath3k_init(int fd, int speed, int init_speed, char *bdaddr,
struct termios *ti);
int ath3k_post(int fd, int pm);
int qualcomm_init(int fd, int speed, struct termios *ti, const char *bdaddr);
-int qca_soc_init(int fd, int speed, char *bdaddr);
+int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti);
int intel_init(int fd, int init_speed, int *speed, struct termios *ti);
int bcm43xx_init(int fd, int def_speed, int speed, struct termios *ti,
const char *bdaddr);
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 59bdc16e4e8f..ee67bb068c09 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -1565,7 +1565,8 @@ static void flow_control(int fd, int opt)
}
-int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate)
+int rome_set_baudrate_req(int fd, int local_baud_rate,
+ int controller_baud_rate, int hwfc)
{
int size, err = 0;
unsigned char cmd[HCI_MAX_CMD_SIZE];
@@ -1575,6 +1576,12 @@ int rome_set_baudrate_req(int fd, int local_baud_rate, int controller_baud_rate)
memset(cmd, 0x0, HCI_MAX_CMD_SIZE);
+ /* If not using hardware flow control limit baud rate to 115200 */
+ if (!hwfc) {
+ local_baud_rate = USERIAL_BAUD_115200;
+ controller_baud_rate = BAUDRATE_115200;
+ }
+
cmd_hdr = (void *) (cmd + 1);
cmd[0] = HCI_COMMAND_PKT;
cmd_hdr->opcode = cmd_opcode_pack(HCI_VENDOR_CMD_OGF, EDL_SET_BAUDRATE_CMD_OCF);
@@ -1621,7 +1628,7 @@ error:
}
-int rome_hci_reset_req(int fd, char baud)
+int rome_hci_reset_req(int fd, char baud, int hwfc)
{
int size, err = 0;
unsigned char cmd[HCI_MAX_CMD_SIZE];
@@ -1641,8 +1648,9 @@ int rome_hci_reset_req(int fd, char baud)
/* Total length of the packet to be sent to the Controller */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE);
- /* Flow off during baudrate change */
- flow_control(fd, MSM_DISABLE_FLOW_CTRL);
+ /* If using hardware flow control, turn off during baudrate change */
+ if (hwfc)
+ flow_control(fd, MSM_DISABLE_FLOW_CTRL);
/* Send the HCI command packet to UART for transmission */
fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
@@ -1655,8 +1663,9 @@ int rome_hci_reset_req(int fd, char baud)
/* Change Local UART baudrate to high speed UART */
userial_vendor_set_baud(baud);
- /* Flow on after changing local uart baudrate */
- flow_control(fd, MSM_ENABLE_FLOW_CTRL);
+ /* If using hardware flow control, turn on after changing local uart baudrate */
+ if (hwfc)
+ flow_control(fd, MSM_ENABLE_FLOW_CTRL);
/* Wait for command complete event */
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
@@ -1778,7 +1787,7 @@ int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate)
return -1;
}
-int qca_soc_init(int fd, int speed, char *bdaddr)
+int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
{
int err = -1;
int size, local_baud_rate = 0, controller_baud_rate = 0;
@@ -1793,6 +1802,12 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
return -1;
}
#endif
+
+ /* Assume we don't use hardware flow control unless user requested 'flow' */
+ vnd_userial.hwfc = 0;
+ if (ti->c_cflag & ~CRTSCTS)
+ vnd_userial.hwfc = 1;
+
/* Get Rome version information */
if((err = rome_patch_ver_req(fd)) <0){
fprintf(stderr, "%s: Fail to get Rome Version (0x%x)\n", __FUNCTION__, err);
@@ -1838,11 +1853,14 @@ int qca_soc_init(int fd, int speed, char *bdaddr)
goto error;
}
- /* Change baud rate 115.2 kbps to 3Mbps*/
- err = rome_hci_reset_req(fd, local_baud_rate);
- if ( err <0 ) {
- fprintf(stderr, "HCI Reset Failed !!\n");
- goto error;
+ /* If using hw flow control, change baud rate 115.2 kbps to 3Mbps*/
+ if (vnd_userial.hwfc) {
+ err = rome_hci_reset_req(fd, local_baud_rate,
+ vnd_userial.hwfc);
+ if ( err <0 ) {
+ fprintf(stderr, "HCI Reset Failed !!\n");
+ goto error;
+ }
}
fprintf(stderr, "HCI Reset is done\n");
@@ -1888,7 +1906,8 @@ download:
if (local_baud_rate < 0 || controller_baud_rate < 0)
goto error;
- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
+ err = rome_set_baudrate_req(fd, local_baud_rate,
+ controller_baud_rate, vnd_userial.hwfc);
if (err < 0) {
fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
goto error;
@@ -1907,14 +1926,15 @@ download:
* Overriding the baud rate value in NVM file with the user
* requested baud rate, since default baud rate in NVM file is 3M.
*/
- err = rome_set_baudrate_req(fd, local_baud_rate, controller_baud_rate);
+ err = rome_set_baudrate_req(fd, local_baud_rate,
+ controller_baud_rate, vnd_userial.hwfc);
if (err < 0) {
fprintf(stderr, "%s: Baud rate change failed!\n", __FUNCTION__);
goto error;
}
/* Perform HCI reset here*/
- err = rome_hci_reset_req(fd, local_baud_rate);
+ err = rome_hci_reset_req(fd, local_baud_rate, vnd_userial.hwfc);
if ( err <0 ) {
fprintf(stderr, "HCI Reset Failed !!!\n");
goto error;
diff --git a/tools/hciattach_rome.h b/tools/hciattach_rome.h
index 89f7db3bef86..760685ad7915 100644
--- a/tools/hciattach_rome.h
+++ b/tools/hciattach_rome.h
@@ -62,6 +62,7 @@ typedef struct
int fd; /* fd to Bluetooth device */
struct termios termios; /* serial terminal of BT port */
char port_name[256];
+ int hwfc;
} vnd_userial_cb_t;
/**** baud rates ****/

View File

@ -0,0 +1,177 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Thu, 6 Apr 2017 14:37:57 +0200
Subject: [PATCH] hciattach: If the user supplies a bdaddr, use it
The QCA6564 has no non-volatile configuration file for the bluetooth
MAC, so use the one supplied on the command line.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
tools/hciattach.c | 4 +--
tools/hciattach_rome.c | 76 ++++++++++----------------------------------------
2 files changed, 17 insertions(+), 63 deletions(-)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 81d78ab3f69a..022bbe5fa6d5 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
static int qca(int fd, struct uart_t *u, struct termios *ti)
{
- fprintf(stderr,"qca\n");
+ fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default");
return qca_soc_init(fd, u->speed, u->bdaddr, ti);
}
@@ -1363,7 +1363,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "Unknown device type or id\n");
exit(1);
}
-
+ u->bdaddr = NULL;
break;
case 2:
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index ee67bb068c09..854cfff707aa 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -45,6 +45,7 @@
#include <stdlib.h>
#include <string.h>
#include <termios.h>
+#include <endian.h>
#include <bluetooth/bluetooth.h>
#include "hciattach_rome.h"
#include "hciattach.h"
@@ -911,7 +912,7 @@ int get_value_from_config(char *file_path,char *param)
return ret;
}
-int rome_get_tlv_file(char *file_path)
+int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
{
FILE * pFile;
long fileSize;
@@ -921,7 +922,6 @@ int rome_get_tlv_file(char *file_path)
tlv_nvm_hdr *nvm_ptr;
unsigned char data_buf[PRINT_BUF_SIZE]={0,};
unsigned char *nvm_byte_ptr;
- unsigned char bdaddr[6];
unsigned short pcm_value, ibs_value;
fprintf(stderr, "File Open (%s)\n", file_path);
@@ -1008,12 +1008,15 @@ int rome_get_tlv_file(char *file_path)
nvm_byte_ptr+=sizeof(tlv_nvm_hdr);
/* Write BD Address */
- if(nvm_ptr->tag_id == TAG_NUM_2 && read_bd_address(&bdaddr) == 0) {
- memcpy(nvm_byte_ptr, bdaddr, 6);
- fprintf(stderr, "Overriding default BD ADDR with user"
- " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
- *nvm_byte_ptr, *(nvm_byte_ptr+1), *(nvm_byte_ptr+2),
- *(nvm_byte_ptr+3), *(nvm_byte_ptr+4), *(nvm_byte_ptr+5));
+ if(nvm_ptr->tag_id == TAG_NUM_2 && bdaddr) {
+ bdaddr_t ba;
+ if (!str2ba(bdaddr, &ba)) {
+ memcpy(nvm_byte_ptr, &ba, 6);
+ fprintf(stderr, "Overriding default BD ADDR with user"
+ " programmed BD Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
+ *(nvm_byte_ptr+5), *(nvm_byte_ptr+4), *(nvm_byte_ptr+3),
+ *(nvm_byte_ptr+2), *(nvm_byte_ptr+1), *nvm_byte_ptr);
+ }
}
if (nvm_ptr->tag_id == TAG_NUM_17) {
@@ -1209,14 +1212,14 @@ error:
return err;
}
-int rome_download_tlv_file(int fd)
+int rome_download_tlv_file(int fd, char * bdaddr)
{
int tlv_size, err = -1;
/* Rampatch TLV file Downloading */
pdata_buffer = NULL;
- if((tlv_size = rome_get_tlv_file(rampatch_file_path)) < 0)
+ if((tlv_size = rome_get_tlv_file(rampatch_file_path, bdaddr)) < 0)
goto error;
if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 )
@@ -1228,7 +1231,7 @@ int rome_download_tlv_file(int fd)
}
/* NVM TLV file Downloading */
- if((tlv_size = rome_get_tlv_file(nvm_file_path)) < 0)
+ if((tlv_size = rome_get_tlv_file(nvm_file_path, bdaddr)) < 0)
goto error;
if((err =rome_tlv_dnld_req(fd, tlv_size)) <0 )
@@ -1679,55 +1682,6 @@ error:
}
-int read_bd_address(unsigned char *bdaddr)
-{
- int fd = -1;
- int readPtr = 0;
- unsigned char data[BD_ADDR_LEN];
-
- /* Open the persist file for reading device address*/
- fd = open("/etc/bluetooth/.bt_nv.bin", O_RDONLY);
- if(fd < 0)
- {
- fprintf(stderr, "%s: Open failed: Programming default BD ADDR\n", __func__);
- return -1;
- }
-
- /* Read the NVM Header : fp will be advanced by readPtr number of bytes */
- readPtr = read(fd, data, PERSIST_HEADER_LEN);
- if (readPtr > 0)
- fprintf(stderr, "%s: Persist header data: %02x \t %02x \t %02x\n", __func__,
- data[NVITEM], data[RDWR_PROT], data[NVITEM_SIZE]);
- else {
- fprintf(stderr, "%s: Read from persist memory failed : Programming default"
- " BD ADDR\n");
- close(fd);
- return -1;
- }
-
- /* Check for BD ADDR length before programming */
- if(data[NVITEM_SIZE] != BD_ADDR_LEN) {
- fprintf(stderr, "Invalid BD ADDR: Programming default BD ADDR!\n");
- close(fd);
- return -1;
- }
-
- /* Read the BD ADDR info */
- readPtr = read(fd, data, BD_ADDR_LEN);
- if (readPtr > 0)
- fprintf(stderr, "BD-ADDR: ==> %02x:%02x:%02x:%02x:%02x:%02x\n", data[0],
- data[1], data[2], data[3], data[4], data[5]);
- else {
- fprintf(stderr, "%s: Read from persist memory failed : Programming default"
- " BD ADDR\n");
- close(fd);
- return -1;
- }
- memcpy(bdaddr, data, BD_ADDR_LEN);
- close(fd);
- return 0;
-}
-
int isSpeedValid(int speed, int *local_baud_rate, int *controller_baud_rate)
{
switch(speed) {
@@ -1915,7 +1869,7 @@ download:
}
/* Donwload TLV files (rampatch, NVM) */
- err = rome_download_tlv_file(fd);
+ err = rome_download_tlv_file(fd, bdaddr);
if (err < 0) {
fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
goto error;

View File

@ -0,0 +1,723 @@
From: Alex Gonzalez <alex.gonzalez@digi.com>
Date: Mon, 10 Apr 2017 12:44:00 +0200
Subject: [PATCH] hciattach: Add verbosity option
And reduce the verbosity of the hciattach_rome plugin.
Signed-off-by: Alex Gonzalez <alex.gonzalez@digi.com>
---
lib/bluetooth.h | 3 +
tools/hciattach.c | 13 ++-
tools/hciattach_rome.c | 244 ++++++++++++++++++++++++-------------------------
3 files changed, 132 insertions(+), 128 deletions(-)
diff --git a/lib/bluetooth.h b/lib/bluetooth.h
index eb279260e009..38e3e6900744 100644
--- a/lib/bluetooth.h
+++ b/lib/bluetooth.h
@@ -136,6 +136,9 @@ enum {
BT_CLOSED
};
+extern int verbose_on;
+#define hciprintf(fd, arg...) if (verbose_on) { fprintf(fd, ##arg);} else { do {} while (0);}
+
/* Byte order conversions */
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htobs(d) (d)
diff --git a/tools/hciattach.c b/tools/hciattach.c
index 022bbe5fa6d5..4aacdafeda7d 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -50,6 +50,8 @@
#include "hciattach.h"
+int verbose_on = 0;
+
struct uart_t {
char *type;
int m_id;
@@ -125,8 +127,6 @@ int read_hci_event(int fd, unsigned char* buf, int size)
fprintf(stderr, "%s: Timing out on select for 3 secs.\n", __FUNCTION__);
return -1;
}
- else
- fprintf(stderr, "%s: Data(HCI-CMD-COMP-EVENT) available in TTY Serial buffer\n", __FUNCTION__);
/* The first byte identifies the packet type. For HCI event packets, it
* should be 0x04, so we read until we get to the 0x04. */
@@ -285,7 +285,7 @@ static int ath3k_pm(int fd, struct uart_t *u, struct termios *ti)
static int qca(int fd, struct uart_t *u, struct termios *ti)
{
- fprintf(stderr,"qca, bdaddr %s\n", u->bdaddr ? u->bdaddr : "Default");
+ fprintf(stderr,"qca, bdaddr %s, verbose %d\n", u->bdaddr ? u->bdaddr : "Default", verbose_on);
return qca_soc_init(fd, u->speed, u->bdaddr, ti);
}
@@ -1258,7 +1258,7 @@ static void usage(void)
{
printf("hciattach - HCI UART driver initialization utility\n");
printf("Usage:\n");
- printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed]"
+ printf("\thciattach [-n] [-p] [-b] [-r] [-v] [-t timeout] [-s initial_speed]"
" <tty> <type | id> [speed] [flow|noflow]"
" [sleep|nosleep] [bdaddr]\n");
printf("\thciattach -l\n");
@@ -1281,7 +1281,7 @@ int main(int argc, char *argv[])
printpid = 0;
raw = 0;
- while ((opt=getopt(argc, argv, "bnpt:s:lrf:")) != EOF) {
+ while ((opt=getopt(argc, argv, "bnpt:s:lrf:v")) != EOF) {
switch(opt) {
case 'b':
send_break = 1;
@@ -1319,6 +1319,9 @@ int main(int argc, char *argv[])
fprintf(stderr, "Line_disp val : %d\n", line_disp);
break;
+ case 'v':
+ verbose_on = 1;
+ break;
default:
usage();
exit(1);
diff --git a/tools/hciattach_rome.c b/tools/hciattach_rome.c
index 854cfff707aa..40983fc087c0 100644
--- a/tools/hciattach_rome.c
+++ b/tools/hciattach_rome.c
@@ -139,7 +139,7 @@ unsigned char userial_to_tcio_baud(unsigned char cfg_baud, unsigned int *baud)
void userial_vendor_set_baud(unsigned char userial_baud)
{
unsigned int tcio_baud;
- fprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud);
+ hciprintf(stderr, "## userial_vendor_set_baud: %d\n", userial_baud);
if (tcgetattr(vnd_userial.fd, &vnd_userial.termios) < 0) {
perror("Can't get port settings");
@@ -201,7 +201,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
break;
#endif // (BT_WAKE_VIA_USERIAL_IOCTL==TRUE)
case USERIAL_OP_FLOW_ON:
- fprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n ");
+ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow On\n ");
ti.c_cflag |= CRTSCTS;
if (err = tcsetattr(fd, TCSANOW, &ti) < 0) {
@@ -212,7 +212,7 @@ int userial_vendor_ioctl(int fd, userial_vendor_ioctl_op_t op, int *p_data)
break;
case USERIAL_OP_FLOW_OFF:
- fprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n ");
+ hciprintf(stderr, "## userial_vendor_ioctl: UART Flow Off\n ");
ti.c_cflag &= ~CRTSCTS;
if (err = tcsetattr(fd, TCSANOW, &ti) < 0) {
fprintf(stderr, "Can't set port settings");
@@ -233,51 +233,51 @@ int get_vs_hci_event(unsigned char *rsp)
int err = 0, soc_id =0;
unsigned char paramlen = 0;
- if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE))
- fprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__);
- else {
+ if( (rsp[EVENTCODE_OFFSET] == VSEVENT_CODE) || (rsp[EVENTCODE_OFFSET] == EVT_CMD_COMPLETE)) {
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific event\n", __FUNCTION__);
+ } else {
fprintf(stderr, "%s: Failed to receive HCI-Vendor Specific event\n", __FUNCTION__);
err = -EIO;
goto failed;
}
- fprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen = rsp[EVT_PLEN]);
- fprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]);
- fprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]);
+ paramlen = rsp[EVT_PLEN];
+ hciprintf(stderr, "%s: Parameter Length: 0x%x\n", __FUNCTION__, paramlen);
+ hciprintf(stderr, "%s: Command response: 0x%x\n", __FUNCTION__, rsp[CMD_RSP_OFFSET]);
+ hciprintf(stderr, "%s: Response type : 0x%x\n", __FUNCTION__, rsp[RSP_TYPE_OFFSET]);
/* Check the status of the operation */
switch ( rsp[CMD_RSP_OFFSET] )
{
case EDL_CMD_REQ_RES_EVT:
- fprintf(stderr, "%s: Command Request Response\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Command Request Response\n", __FUNCTION__);
switch(rsp[RSP_TYPE_OFFSET])
{
case EDL_PATCH_VER_RES_EVT:
case EDL_APP_VER_RES_EVT:
- fprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n",
- (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 |
+ hciprintf(stderr, "\t Current Product ID\t\t: 0x%08x\n",
+ (unsigned int)(rsp[PATCH_PROD_ID_OFFSET +3] << 24 |
rsp[PATCH_PROD_ID_OFFSET+2] << 16 |
rsp[PATCH_PROD_ID_OFFSET+1] << 8 |
rsp[PATCH_PROD_ID_OFFSET] ));
/* Patch Version indicates FW patch version */
- fprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n",
- (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 |
+ hciprintf(stderr, "\t Current Patch Version\t\t: 0x%04x\n",
+ (unsigned short)(rsp[PATCH_PATCH_VER_OFFSET + 1] << 8 |
rsp[PATCH_PATCH_VER_OFFSET] ));
/* ROM Build Version indicates ROM build version like 1.0/1.1/2.0 */
- fprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver =
- (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 |
- rsp[PATCH_ROM_BUILD_VER_OFFSET] ));
+ rome_ver = (int)(rsp[PATCH_ROM_BUILD_VER_OFFSET + 1] << 8 |
+ rsp[PATCH_ROM_BUILD_VER_OFFSET] );
+ hciprintf(stderr, "\t Current ROM Build Version\t: 0x%04x\n", rome_ver);
/* In case rome 1.0/1.1, there is no SOC ID version available */
- if (paramlen - 10)
- {
- fprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id =
- (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 |
- rsp[PATCH_SOC_VER_OFFSET+2] << 16 |
- rsp[PATCH_SOC_VER_OFFSET+1] << 8 |
- rsp[PATCH_SOC_VER_OFFSET] ));
+ if (paramlen - 10) {
+ soc_id = (unsigned int)(rsp[PATCH_SOC_VER_OFFSET +3] << 24 |
+ rsp[PATCH_SOC_VER_OFFSET+2] << 16 |
+ rsp[PATCH_SOC_VER_OFFSET+1] << 8 |
+ rsp[PATCH_SOC_VER_OFFSET]);
+ hciprintf(stderr, "\t Current SOC Version\t\t: 0x%08x\n", soc_id);
}
/* Rome Chipset Version can be decided by Patch version and SOC version,
@@ -290,7 +290,7 @@ int get_vs_hci_event(unsigned char *rsp)
switch (err = rsp[CMD_STATUS_OFFSET])
{
case HCI_CMD_SUCCESS:
- fprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Download Packet successfully!\n", __FUNCTION__);
break;
case PATCH_LEN_ERROR:
fprintf(stderr, "%s: Invalid patch length argument passed for EDL PATCH "
@@ -318,7 +318,7 @@ int get_vs_hci_event(unsigned char *rsp)
break;
case NVM_ACCESS_CODE:
- fprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__);
+ hciprintf(stderr, "%s: NVM Access Code!!!\n", __FUNCTION__);
err = HCI_CMD_SUCCESS;
break;
case EDL_SET_BAUDRATE_RSP_EVT:
@@ -362,7 +362,7 @@ int wait_for_data(int fd, int maxTimeOut)
return -1;
}
else
- fprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n",
+ hciprintf(stderr, "%s: HCI-VS-EVENT available in TTY Serial buffer\n",
__FUNCTION__);
return 1;
@@ -381,7 +381,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
return -1;
}
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n",
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC\n",
__FUNCTION__);
/* Check whether data is available in TTY buffer before calling read() */
@@ -425,7 +425,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
}
count++;
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]);
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[0] - 0x%x\n", __FUNCTION__, buf[0]);
/* The next two bytes are the event code and parameter total length. */
while (count < 3) {
r = read(fd, buf + count, 3 - count);
@@ -436,7 +436,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
count += r;
}
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]);
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, buf[1] - 0x%x\n", __FUNCTION__, buf[1]);
/* Now we read the parameters. */
if (buf[2] < (size - 3))
remain = buf[2];
@@ -454,7 +454,7 @@ int read_vs_hci_event(int fd, unsigned char* buf, int size)
if(get_vs_hci_event(buf) != HCI_CMD_SUCCESS)
return -1;
- fprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count);
+ hciprintf(stderr, "%s: Wait for HCI-Vendor Specfic Event from SOC, count - 0x%x\n", __FUNCTION__, count);
return count;
}
@@ -477,7 +477,7 @@ int hci_send_vs_cmd(int fd, unsigned char *cmd, unsigned char *rsp, int size)
fprintf(stderr, "%s: Failed to get HCI-VS Event from SOC\n", __FUNCTION__);
goto failed;
}
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
}
failed:
@@ -507,8 +507,8 @@ void frame_hci_cmd_pkt(
case EDL_PATCH_SET_REQ_CMD:
/* Copy the patch header info as CMD params */
memcpy(&cmd[5], phdr_buffer, PATCH_HDR_LEN);
- fprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__);
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
+ hciprintf(stderr, "%s: Sending EDL_PATCH_SET_REQ_CMD\n", __FUNCTION__);
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
break;
case EDL_PATCH_DLD_REQ_CMD:
@@ -522,36 +522,36 @@ void frame_hci_cmd_pkt(
cmd[9] = EXTRACT_BYTE(p_base_addr, 3);
memcpy(&cmd[10], (pdata_buffer + offset), size);
- fprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n",
+ hciprintf(stderr, "%s: Sending EDL_PATCH_DLD_REQ_CMD: size: %d bytes\n",
__FUNCTION__, size);
- fprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t0x%x\t"
"0x%x\t0x%x\t0x%x\t\n", segtNo, cmd[0], cmd[1], cmd[2],
cmd[3], cmd[4], cmd[5], cmd[6], cmd[7], cmd[8], cmd[9]);
break;
case EDL_PATCH_ATCH_REQ_CMD:
- fprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__);
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
+ hciprintf(stderr, "%s: Sending EDL_PATCH_ATTACH_REQ_CMD\n", __FUNCTION__);
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
break;
case EDL_PATCH_RST_REQ_CMD:
- fprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__);
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
+ hciprintf(stderr, "%s: Sending EDL_PATCH_RESET_REQ_CMD\n", __FUNCTION__);
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
break;
case EDL_PATCH_VER_REQ_CMD:
- fprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__);
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
- break;
+ hciprintf(stderr, "%s: Sending EDL_PATCH_VER_REQ_CMD\n", __FUNCTION__);
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4]);
+ break;
case EDL_PATCH_TLV_REQ_CMD:
- fprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Sending EDL_PATCH_TLV_REQ_CMD\n", __FUNCTION__);
/* Parameter Total Length */
cmd[3] = size +2;
/* TLV Segment Length */
cmd[5] = size;
- fprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
- segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]);
+ hciprintf(stderr, "HCI-CMD %d:\t0x%x \t0x%x \t0x%x \t0x%x \t0x%x \t0x%x\n",
+ segtNo, cmd[0], cmd[1], cmd[2], cmd[3], cmd[4], cmd[5]);
offset = (segtNo * MAX_SIZE_PER_TLV_SEGMENT);
memcpy(&cmd[6], (pdata_buffer + offset), size);
break;
@@ -601,14 +601,13 @@ void rome_extract_patch_header_info(unsigned char *buf)
rampatch_patch_info.patch_ctrl |=
(LSH(buf[index + P_CONTROL_OFFSET], (index * 8)));
- fprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id);
- fprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version);
- fprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version);
- fprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length);
- fprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc);
- fprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl);
- fprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr);
-
+ hciprintf(stderr, "PATCH_ID\t : 0x%x\n", rampatch_patch_info.patch_id);
+ hciprintf(stderr, "ROM_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.rom_version);
+ hciprintf(stderr, "BUILD_VERSION\t : 0x%x\n", rampatch_patch_info.patch_ver.build_version);
+ hciprintf(stderr, "PATCH_LENGTH\t : 0x%x\n", rampatch_patch_info.patch_length);
+ hciprintf(stderr, "PATCH_CRC\t : 0x%x\n", rampatch_patch_info.patch_crc);
+ hciprintf(stderr, "PATCH_CONTROL\t : 0x%x\n", rampatch_patch_info.patch_ctrl);
+ hciprintf(stderr, "PATCH_BASE_ADDR\t : 0x%x\n", rampatch_patch_info.patch_base_addr);
}
int rome_edl_set_patch_request(int fd)
@@ -636,7 +635,7 @@ int rome_edl_set_patch_request(int fd)
fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Successfully set patch info on the Controller\n", __FUNCTION__);
error:
return err;
}
@@ -651,7 +650,7 @@ int rome_edl_patch_download_request(int fd)
no_of_patch_segment = (rampatch_patch_info.patch_length /
MAX_DATA_PER_SEGMENT);
- fprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n",
+ hciprintf(stderr, "%s: %d patch segments to be d'loaded from patch base addr: 0x%x\n",
__FUNCTION__, no_of_patch_segment,
rampatch_patch_info.patch_base_addr);
@@ -663,8 +662,7 @@ int rome_edl_patch_download_request(int fd)
* segments with a max. size of 239 bytes
*/
for (index = 1; index <= no_of_patch_segment; index++) {
-
- fprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index);
+ hciprintf(stderr, "%s: Downloading patch segment: %d\n", __FUNCTION__, index);
/* Frame the HCI CMD PKT to be sent to Controller*/
frame_hci_cmd_pkt(cmd, EDL_PATCH_DLD_REQ_CMD, p_base_addr,
@@ -690,8 +688,9 @@ int rome_edl_patch_download_request(int fd)
__FUNCTION__, index);
goto error;
}
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
- __FUNCTION__, index);
+
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
+ __FUNCTION__, index);
}
/* Check if any pending patch data to be sent */
@@ -725,8 +724,8 @@ int rome_edl_patch_download_request(int fd)
goto error;
}
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
- __FUNCTION__, index);
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n",
+ __FUNCTION__, index);
}
error:
@@ -740,7 +739,7 @@ static int rome_download_rampatch(int fd)
fprintf(stderr, "%s:\n", __FUNCTION__);
/* Get handle to the RAMPATCH binary file */
- fprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH);
+ hciprintf(stderr, "%s: Getting handle to the RAMPATCH binary file from %s\n", __FUNCTION__, ROME_FW_PATH);
file = fopen(ROME_FW_PATH, "r");
if (file == NULL) {
fprintf(stderr, "%s: Failed to get handle to the RAMPATCH bin file!\n",
@@ -749,7 +748,7 @@ static int rome_download_rampatch(int fd)
}
/* Allocate memory for the patch headder info */
- fprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Allocating memory for the patch header\n", __FUNCTION__);
phdr_buffer = (unsigned char *) malloc(PATCH_HDR_LEN + 1);
if (phdr_buffer == NULL) {
fprintf(stderr, "%s: Failed to allocate memory for patch header\n",
@@ -760,7 +759,7 @@ static int rome_download_rampatch(int fd)
phdr_buffer[index] = 0x0;
/* Read 28 bytes of patch header information */
- fprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Reading patch header info\n", __FUNCTION__);
index = 0;
do {
c = fgetc (file);
@@ -768,7 +767,7 @@ static int rome_download_rampatch(int fd)
} while (index != PATCH_HDR_LEN);
/* Save the patch header info into local structure */
- fprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Saving patch hdr. info\n", __FUNCTION__);
rome_extract_patch_header_info((unsigned char *)phdr_buffer);
/* Set the patch header info onto the Controller */
@@ -779,7 +778,7 @@ static int rome_download_rampatch(int fd)
}
/* Allocate memory for the patch payload */
- fprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Allocating memory for patch payload\n", __FUNCTION__);
size = rampatch_patch_info.patch_length;
pdata_buffer = (unsigned char *) malloc(size+1);
if (pdata_buffer == NULL) {
@@ -791,7 +790,7 @@ static int rome_download_rampatch(int fd)
pdata_buffer[index] = 0x0;
/* Read the patch data from Rampatch binary image */
- fprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Reading patch payload from RAMPATCH file\n", __FUNCTION__);
index = 0;
do {
c = fgetc (file);
@@ -924,7 +923,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
unsigned char *nvm_byte_ptr;
unsigned short pcm_value, ibs_value;
- fprintf(stderr, "File Open (%s)\n", file_path);
+ hciprintf(stderr, "File Open (%s)\n", file_path);
pFile = fopen ( file_path , "r" );
if (pFile==NULL) {;
fprintf(stderr, "%s File Open Fail\n", file_path);
@@ -967,30 +966,30 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
gtlv_dwndcfg = ptlv_header->tlv.patch.dwnd_cfg;
if(ptlv_header->tlv_type == TLV_TYPE_PATCH){
- fprintf(stderr, "====================================================\n");
- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
- fprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) |
- (ptlv_header->tlv_length2 << 8) |
- (ptlv_header->tlv_length3 << 16));
- fprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len);
- fprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
- fprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
- fprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
- fprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
- fprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
- fprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
- fprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver);
- fprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2);
- fprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr));
- fprintf(stderr, "====================================================\n");
-
+ hciprintf(stderr, "====================================================\n");
+ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
+ hciprintf(stderr, "Length\t\t\t : %d bytes\n", (ptlv_header->tlv_length1) |
+ (ptlv_header->tlv_length2 << 8) |
+ (ptlv_header->tlv_length3 << 16));
+ hciprintf(stderr, "Total Length\t\t\t : %d bytes\n", ptlv_header->tlv.patch.tlv_data_len);
+ hciprintf(stderr, "Patch Data Length\t\t\t : %d bytes\n",ptlv_header->tlv.patch.tlv_patch_data_len);
+ hciprintf(stderr, "Signing Format Version\t : 0x%x\n", ptlv_header->tlv.patch.sign_ver);
+ hciprintf(stderr, "Signature Algorithm\t\t : 0x%x\n", ptlv_header->tlv.patch.sign_algorithm);
+ hciprintf(stderr, "Event Handling\t\t\t : 0x%x", ptlv_header->tlv.patch.dwnd_cfg);
+ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved1);
+ hciprintf(stderr, "Product ID\t\t\t : 0x%04x\n", ptlv_header->tlv.patch.prod_id);
+ hciprintf(stderr, "Rom Build Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.build_ver);
+ hciprintf(stderr, "Patch Version\t\t : 0x%04x\n", ptlv_header->tlv.patch.patch_ver);
+ hciprintf(stderr, "Reserved\t\t\t : 0x%x\n", ptlv_header->tlv.patch.reserved2);
+ hciprintf(stderr, "Patch Entry Address\t\t : 0x%x\n", (ptlv_header->tlv.patch.patch_entry_addr));
+ hciprintf(stderr, "====================================================\n");
} else if(ptlv_header->tlv_type == TLV_TYPE_NVM) {
- fprintf(stderr, "====================================================\n");
- fprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
- fprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length = (ptlv_header->tlv_length1) |
- (ptlv_header->tlv_length2 << 8) |
- (ptlv_header->tlv_length3 << 16));
+ nvm_length = (ptlv_header->tlv_length1) |
+ (ptlv_header->tlv_length2 << 8) |
+ (ptlv_header->tlv_length3 << 16);
+ hciprintf(stderr, "====================================================\n");
+ hciprintf(stderr, "TLV Type\t\t\t : 0x%x\n", ptlv_header->tlv_type);
+ hciprintf(stderr, "Length\t\t\t : %d bytes\n", nvm_length);
if(nvm_length <= 0)
return readSize;
@@ -998,11 +997,11 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
for(nvm_byte_ptr=(unsigned char *)(nvm_ptr = &(ptlv_header->tlv.nvm)), nvm_index=0;
nvm_index < nvm_length ; nvm_ptr = (tlv_nvm_hdr *) nvm_byte_ptr)
{
- fprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id);
- fprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len = nvm_ptr->tag_len);
- fprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr);
- fprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag);
-
+ nvm_tag_len = nvm_ptr->tag_len;
+ hciprintf(stderr, "TAG ID\t\t\t : %d\n", nvm_ptr->tag_id);
+ hciprintf(stderr, "TAG Length\t\t\t : %d\n", nvm_tag_len);
+ hciprintf(stderr, "TAG Pointer\t\t\t : %d\n", nvm_ptr->tag_ptr);
+ hciprintf(stderr, "TAG Extended Flag\t\t : %d\n", nvm_ptr->tag_ex_flag);
/* Increase nvm_index to NVM data */
nvm_index+=sizeof(tlv_nvm_hdr);
nvm_byte_ptr+=sizeof(tlv_nvm_hdr);
@@ -1058,7 +1057,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
snprintf((char *) data_buf, PRINT_BUF_SIZE, "%s%.02x ",
(char *)data_buf, *(nvm_byte_ptr + i));
- fprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf);
+ hciprintf(stderr, "TAG Data\t\t\t : %s\n", data_buf);
/* Clear buffer */
memset(data_buf, 0x0, PRINT_BUF_SIZE);
@@ -1068,7 +1067,7 @@ int rome_get_tlv_file(char *file_path, unsigned char * bdaddr)
nvm_byte_ptr +=nvm_ptr->tag_len;
}
- fprintf(stderr, "====================================================\n");
+ hciprintf(stderr, "====================================================\n");
} else {
fprintf(stderr, "TLV Header type is unknown (%d) \n", ptlv_header->tlv_type);
@@ -1083,7 +1082,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
unsigned char cmd[HCI_MAX_CMD_SIZE];
unsigned char rsp[HCI_MAX_EVENT_SIZE];
- fprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
+ hciprintf(stderr, "%s: Downloading TLV Patch segment no.%d, size:%d wait_cc_evt = 0x%x\n", __FUNCTION__, index, seg_size, wait_cc_evt);
/* Frame the HCI CMD PKT to be sent to Controller*/
frame_hci_cmd_pkt(cmd, EDL_PATCH_TLV_REQ_CMD, 0, index, seg_size);
@@ -1109,7 +1108,7 @@ int rome_tlv_dnld_segment(int fd, int index, int seg_size, unsigned char wait_cc
}
}
- fprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index);
+ hciprintf(stderr, "%s: Successfully downloaded patch segment: %d\n", __FUNCTION__, index);
return err;
}
@@ -1123,7 +1122,7 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
remain_size = (tlv_size < MAX_SIZE_PER_TLV_SEGMENT)?\
tlv_size: (tlv_size%MAX_SIZE_PER_TLV_SEGMENT);
- fprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n",
+ hciprintf(stderr, "%s: TLV size: %d, Total Seg num: %d, remain size: %d\n",
__FUNCTION__,tlv_size, total_segment, remain_size);
if (gTlv_type == TLV_TYPE_PATCH) {
@@ -1137,12 +1136,12 @@ int rome_tlv_dnld_req(int fd, int tlv_size)
case ROME_SKIP_EVT_NONE:
wait_vsc_evt = TRUE;
wait_cc_evt = TRUE;
- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__);
+ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_NONE", __func__);
break;
case ROME_SKIP_EVT_VSE_CC:
wait_vsc_evt = FALSE;
wait_cc_evt = FALSE;
- fprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__);
+ hciprintf(stderr, "%s: Event handling type: ROME_SKIP_EVT_VSE_CC", __func__);
break;
/* Not handled for now */
case ROME_SKIP_EVT_VSE:
@@ -1479,14 +1478,14 @@ int rome_1_0_nvm_tag_dnld(int fd)
};
#endif
- fprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION);
+ hciprintf(stderr, "%s: Start sending NVM Tags (ver: 0x%x)\n", __FUNCTION__, (unsigned int) NVM_VERSION);
for (i=0; (i < MAX_TAG_CMD) && (cmds[i][0] != TAG_END); i++)
{
/* Write BD Address */
if(cmds[i][TAG_NUM_OFFSET] == TAG_NUM_2){
memcpy(&cmds[i][TAG_BDADDR_OFFSET], vnd_local_bd_addr, 6);
- fprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ hciprintf(stderr, "BD Address: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
cmds[i][TAG_BDADDR_OFFSET ], cmds[i][TAG_BDADDR_OFFSET + 1],
cmds[i][TAG_BDADDR_OFFSET + 2], cmds[i][TAG_BDADDR_OFFSET + 3],
cmds[i][TAG_BDADDR_OFFSET + 4], cmds[i][TAG_BDADDR_OFFSET + 5]);
@@ -1598,7 +1597,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
flow_control(fd, MSM_DISABLE_FLOW_CTRL);
/* Send the HCI command packet to UART for transmission */
- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
+ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3],cmd[4]) ;
err = write(fd, cmd, size);
if (err != size) {
fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
@@ -1616,7 +1615,7 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
goto error;
}
- fprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Received HCI-Vendor Specific Event from SOC\n", __FUNCTION__);
/* Wait for command complete event */
err = read_hci_event(fd, rsp, HCI_MAX_EVENT_SIZE);
@@ -1624,7 +1623,6 @@ int rome_set_baudrate_req(int fd, int local_baud_rate,
fprintf(stderr, "%s: Failed to set patch info on Controller\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s\n", __FUNCTION__);
error:
return err;
@@ -1639,7 +1637,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc)
hci_command_hdr *cmd_hdr;
int flags;
- fprintf(stderr, "%s: HCI RESET \n", __FUNCTION__);
+ hciprintf(stderr, "%s: HCI RESET \n", __FUNCTION__);
memset(cmd, 0x0, HCI_MAX_CMD_SIZE);
@@ -1656,7 +1654,7 @@ int rome_hci_reset_req(int fd, char baud, int hwfc)
flow_control(fd, MSM_DISABLE_FLOW_CTRL);
/* Send the HCI command packet to UART for transmission */
- fprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
+ hciprintf(stderr, "%s: HCI CMD: 0x%x 0x%x 0x%x 0x%x\n", __FUNCTION__, cmd[0], cmd[1], cmd[2], cmd[3]);
err = write(fd, cmd, size);
if (err != size) {
fprintf(stderr, "%s: Send failed with ret value: %d\n", __FUNCTION__, err);
@@ -1768,28 +1766,28 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
goto error;
}
- fprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver);
+ hciprintf(stderr, "%s: Rome Version (0x%08x)\n", __FUNCTION__, rome_ver);
switch (rome_ver){
case ROME_VER_1_0:
{
/* Set and Download the RAMPATCH */
- fprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Setting Patch Header & Downloading Patches\n", __FUNCTION__);
err = rome_download_rampatch(fd);
if (err < 0) {
fprintf(stderr, "%s: DOWNLOAD RAMPATCH failed!\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__);
+ hciprintf(stderr, "%s: DOWNLOAD RAMPTACH complete\n", __FUNCTION__);
/* Attach the RAMPATCH */
- fprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Attaching the patches\n", __FUNCTION__);
err = rome_attach_rampatch(fd);
if (err < 0) {
fprintf(stderr, "%s: ATTACH RAMPATCH failed!\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__);
+ hciprintf(stderr, "%s: ATTACH RAMPTACH complete\n", __FUNCTION__);
/* Send Reset */
size = (HCI_CMD_IND + HCI_COMMAND_HDR_SIZE + EDL_PATCH_CMD_LEN);
@@ -1800,7 +1798,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
}
/* NVM download */
- fprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__);
+ hciprintf(stderr, "%s: Downloading NVM\n", __FUNCTION__);
err = rome_1_0_nvm_tag_dnld(fd);
if ( err <0 ) {
fprintf(stderr, "Downloading NVM Failed !!\n");
@@ -1817,7 +1815,7 @@ int qca_soc_init(int fd, int speed, char *bdaddr , struct termios * ti)
}
}
- fprintf(stderr, "HCI Reset is done\n");
+ hciprintf(stderr, "HCI Reset is done\n");
}
break;
case ROME_VER_1_1:
@@ -1874,7 +1872,7 @@ download:
fprintf(stderr, "%s: Download TLV file failed!\n", __FUNCTION__);
goto error;
}
- fprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
+ hciprintf(stderr, "%s: Download TLV file successfully \n", __FUNCTION__);
/*
* Overriding the baud rate value in NVM file with the user
@@ -1893,7 +1891,7 @@ download:
fprintf(stderr, "HCI Reset Failed !!!\n");
goto error;
}
- fprintf(stderr, "HCI Reset is done\n");
+ hciprintf(stderr, "HCI Reset is done\n");
break;
case ROME_VER_UNKNOWN:

View File

@ -29,6 +29,9 @@ SRC_URI_append_ccimx6ul = " \
file://0019-bluetooth-Fix-flow-control-operation.patch \
file://0020-Adding-MDM-specific-code-under-_PLATFORM_MDM_.patch \
file://0021-Bluetooth-Fix-static-analysis-issues.patch \
file://0022-hciattach_rome-Respect-the-user-indication-for-noflo.patch \
file://0023-hciattach-If-the-user-supplies-a-bdaddr-use-it.patch \
file://0024-hciattach-Add-verbosity-option.patch \
"
inherit update-rc.d