|
From: Mats F. <ma...@us...> - 2001-05-15 15:19:59
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
hci_vendor.c 1.33 1.34=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Added functions for parsing BCSP and HQ packets
* Added function for setting the HW buffers in the CSR module
The diff of the modified file(s):
--- hci_vendor.c 2001/05/09 09:22:28 1.33
+++ hci_vendor.c 2001/05/15 15:19:58 1.34
@@ -407,6 +407,7 @@
#endif
=20
#elif defined(CONFIG_BLUETOOTH_CSR)
+
/*************************************************************************=
****/
/****************************** CSR functions ****************************=
****/
/*************************************************************************=
****/
@@ -438,6 +439,8 @@
#define CSR_CMD_PS 0x7003
=20
#define CSR_PS_BDADDR 0x0001
+#define CSR_PS_MAX_ACL_PKT_LEN 0x0011
+#define CSR_PS_MAX_ACL_PKTS 0x0013
#define CSR_PS_BAUD_RATE 0x0204
=20
#define CSR_UART_RATE_9K6 0x0027
@@ -460,7 +463,6 @@
#define CSR_VARID_PACKET_STAT_REPORT 0x1001
#define CSR_VARID_BITERR_REPORT 0x1006
=20
-
typedef struct payload_descr
{
u8 ch_id:6;
@@ -515,6 +517,119 @@
=20
static u16 csr_count =3D 0;
=20
+#ifdef CONFIG_BLUETOOTH_USE_BCSP
+void
+hci_receive_bcsp(u8 *data, u32 count)
+{
+ csr_bccmd *cmd;
+ csr_bccmd_ps *ps;
+=09
+ D_REC(__FUNCTION__ "\n");
+
+ /* FIXME -- is there only one cmd buffer available ? */
+ hci_ctrl.hc_buf.cmd_num =3D 1;=20=20
+
+ release_cmd_timer();
+
+ cmd =3D (struct csr_bccmd *)data;
+ ps =3D (struct csr_bccmd_ps *)cmd->payload;
+
+ if (cmd->status =3D=3D CSR_STATUS_OK) {
+ if (cmd->type =3D=3D CSR_MSGTYPE_GETRESP) {
+ switch (cmd->var_id) {
+=09=09=09=09
+ case CSR_CMD_CONFIG_UART:
+ break;
+=09=09=09=09
+ case CSR_CMD_BUILD_ID:
+ /* Store this for later retrieval */
+ sprintf(bt_hw_firmware_info,
+ "\n Firmware version: %d",
+ cmd->payload[0]);
+ break;
+=09=09=09=09
+ case CSR_CMD_CHIP_VER:
+ break;
+=09=09=09=09
+ case CSR_CMD_CHIP_REV:
+ break;
+=09=09=09=09
+ case CSR_CMD_PS:
+ break;
+=09=09=09=09
+ default:
+ break;
+ }
+ } else {
+ DSYS(__FUNCTION__", Not a GETRESP msg\n");
+ }
+ } else {
+ D_ERR(__FUNCTION__", BCSP status error 0x%x\n", cmd->status);
+ print_data(__FUNCTION__, data, count);
+ }
+
+ wake_up_interruptible(&hci_wq);=09
+}
+
+void
+hci_receive_hq(u8 *data, u32 count)
+{
+ csr_bccmd *cmd;
+ csr_bccmd_ps *ps;
+=09
+ D_REC(__FUNCTION__"\n");
+=09
+ /* FIXME -- is there only one cmd buffer available ? */
+ hci_ctrl.hc_buf.cmd_num =3D 1;=20=20
+
+ release_cmd_timer();
+
+ cmd =3D (struct csr_bccmd *)data;
+ ps =3D (struct csr_bccmd_ps *)cmd->payload;
+
+ if (cmd->status =3D=3D CSR_STATUS_OK) {
+ if (cmd->type =3D=3D CSR_MSGTYPE_GETRESP) {
+=09
+ switch (cmd->var_id) {
+ case CSR_VARID_RSSI_REPORT:
+ {
+ csr_rssi_rep *rep;
+ rep =3D (csr_rssi_rep *)cmd->payload;
+ DSYS("RSSI report, rssi : %d\n", rep->rssi);
+ break;
+ }
+=09=09=09
+ case CSR_VARID_PACKET_STAT_REPORT:
+ {
+ csr_packstat_rep *rep;
+ rep =3D (struct csr_packstat_rep*)cmd->payload;
+ DSYS("Packet status report : n_pkts %d, n_good %d, n_corr %d, rssi %d,=
rssi_valid %d\n", rep->n_pkts, rep->n_good, rep->n_corr, rep->rssi, rep->r=
ssi_valid);
+ break;
+ }
+=09=09=09
+ case CSR_VARID_BITERR_REPORT:
+ {
+ csr_biterr_rep *rep;
+ rep =3D (struct csr_biterr_rep*)cmd->payload;
+ DSYS("Biterror report : index %d, val_last %d, val_tot %d\n", rep->ind=
ex, rep->val_last, rep->val_tot);
+ break;
+ }
+ default:
+ D_ERR("Unknown varid [0x%x]!\n", cmd->var_id);
+ break;
+ }
+ } else {
+ DSYS(__FUNCTION__", Not a GETRESP msg\n");
+ }
+ } else {
+ D_ERR(__FUNCTION__", HQ status error 0x%x\n", cmd->status);
+ print_data(__FUNCTION__, data, count);
+ }
+=09
+ wake_up_interruptible(&hci_wq);=09
+}
+#endif
+
s32=20
hci_set_bd_addr(u8 bd[6])
{
@@ -522,7 +637,7 @@
csr_bccmd *cmd;
csr_bccmd_ps *ps;
=20
- D_CMD(__FUNCTION__ VENDOR "\n");
+ D_CMD(__FUNCTION__"\n");
=20
/* HCI Manufacturer specific header */
c_pkt.type =3D CMD_PKT;
@@ -559,6 +674,55 @@
}
=20
s32
+hci_set_buffer_sizes(u16 len, u16 num)
+{
+ csr_msg *msg;
+ csr_bccmd *cmd;
+ csr_bccmd_ps *ps;
+ int ret;
+
+ D_CMD(__FUNCTION__ VENDOR "\n");
+
+ /* HCI Manufacturer specific header */
+ c_pkt.type =3D CMD_PKT;
+ c_pkt.opcode =3D hci_put_opcode(0x00, 0x3f);
+ c_pkt.len =3D 1 + 5*sizeof(u16) + 3*sizeof(u16) + 1*sizeof(u16);
+
+ msg =3D (csr_msg *)c_pkt.data;
+ cmd =3D (csr_bccmd *)msg->msg;
+ ps =3D (csr_bccmd_ps *)cmd->payload;
+
+ /* General msg header */
+ msg->p_descr.last =3D 1; /* first and last segment */
+ msg->p_descr.first =3D 1;
+ msg->p_descr.ch_id =3D CSR_CH_ID_BCCMD;
+
+ /* BCCMD type */
+ cmd->type =3D CSR_MSGTYPE_SETREQ;
+ cmd->len =3D 5 + 3 + 1;
+ cmd->seq =3D csr_count++;
+ cmd->var_id =3D CSR_CMD_PS;
+ cmd->status =3D CSR_STATUS_OK; /* always OK in SETREQ */
+
+ /* Actual PS key request */
+ ps->ps_key =3D CSR_PS_MAX_ACL_PKTS;
+ ps->ps_len =3D 1; /* x 16 bits */
+ ps->unused =3D 0x0000;
+
+ ps->ps_val[0] =3D num;
+
+ ret =3D send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LE=
N);
+ if (ret < 0)
+ return ret;
+=09
+ cmd->seq =3D csr_count++;
+ ps->ps_key =3D CSR_PS_MAX_ACL_PKT_LEN;
+ ps->ps_val[0] =3D len;
+
+ return send_cmd_block((u8*) &c_pkt, c_pkt.len + CMD_HDR_LEN + HCI_HDR_LEN=
);
+}
+
+s32
hci_read_firmware_rev_info(void)
{
s32 tmp;
@@ -607,6 +771,7 @@
return tmp;
}
=20
+
//#define SET_BAUD_RATE_TEMPORARILY
s32
hci_set_baudrate(u32 baudrate)
|