From: Gordon M. <gm...@us...> - 2001-04-27 15:38:34
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Comment ---- ----------- ----------- ------- hci_vendor.c 1.29 1.30=20=20=20=20=20=20=20=20=20=20=20=20 The accompanying log: --Added the Infineon BlueMoon Chipset support provided by Christian Kranz. The diff of the modified file(s): --- hci_vendor.c 2001/04/26 08:32:39 1.29 +++ hci_vendor.c 2001/04/27 15:38:04 1.30 @@ -859,7 +859,178 @@ { return "CSR"; } +#elif defined(CONFIG_BLUETOOTH_INFINEON_BMI) +/*************************************************************************= ****/ +/***************** Functions for Infineon BlueMoon I chips****************= ***/ +/*************************************************************************= ****/ + +s32 +hci_set_bd_addr(u8 bd[6]) +{ + D_ERR(__FUNCTION__" not supported.\n"); + return 0; +} + + +s32 +hci_read_firmware_rev_info(void) +{ + D_CMD(__FUNCTION__"\n"); + c_pkt.type =3D CMD_PKT; + c_pkt.opcode =3D hci_put_opcode(0x0005, 0x3f) ; + c_pkt.len =3D 0; + + return send_cmd_block((u8*) &c_pkt ,c_pkt.len + CMD_HDR_LEN + +HCI_HDR_LEN); +} =20 +s32 +hci_set_baudrate(u32 baudrate) +{ + u8 pkt[6]; + s32 tmp; + + D_CMD(__FUNCTION__"(%d baud)\n", baudrate); + pkt[0] =3D CMD_PKT; + pkt[1] =3D 0x06; + pkt[2] =3D 0xfc; + pkt[3] =3D 0x02; + switch (baudrate) { + case 9600: + pkt[4]=3D3; + pkt[5]=3D168; + break; + case 19200: + pkt[4]=3D2; + pkt[5]=3D168; + break; + case 38400: + pkt[4]=3D1; + pkt[5]=3D168; + break; + case 57600: + pkt[4]=3D0; + pkt[5]=3D225; + break; + case 115200: + pkt[4]=3D0; + pkt[5]=3D112; + break; + case 230400: + pkt[4]=3D0; + pkt[5]=3D55; + break; + case 460800: + pkt[4]=3D0; + pkt[5]=3D27; + break; + default: + D_ERR(__FUNCTION__ ": Baudrate not supported\n"); + } // end of switch + tmp =3D send_cmd(pkt,6); + + /* the chip answers with two command complete events, the first using=20 + the old baudrate, the second using the new baudrate. The second=20 + event is send at least 0.125seconds after the first to let the=20 + host change its baudrate too. */ + + start_cmd_timer(); + interruptible_sleep_on(&hci_wq); + + return tmp; +} + +void +process_vendor_event(u8 *buf, u32 len, u32 event_code) +{ + D_REC(__FUNCTION__" Infineon specific event\n"); + if (len>=3D1) { + switch (buf[0]) { + case 0x00: + printk("Infineon event: Hardware Startup complete.\n"); + break; + case 0x04: + printk("Infineon event: invalid packet length.\n"); + break; + case 0x05: + printk("Infineon event: BD-Data invalid (check EEPROM).\n"); + break; + case 0x07: + printk("Infineon event: invalid packet type.\n"); + break; + case 0x09: + printk("Infineon event: invalid ACL_BC_PB_Flag.\n"); + break; + case 0x0A: + printk("Infineon event: invalid ACL_CNC_Handle.\n"); + break; + case 0x0B: + printk("Infineon event: invalid SCO_CNC_Handle.\n"); + break; + case 0x0C: + printk("Infineon event: low power mode start.\n"); + break; + case 0x0D: + printk("Infineon event: low power mode end.\n"); + break; + + default: + D_ERR(__FUNCTION__" Infineon specific unknown event\n"); + } /* end of switch */ + } else { + D_ERR(__FUNCTION__" Infineon specific invalid event\n"); + } +} + + +void +process_vendor_return_param(u32 ocf, u8* r_val) +{ + static int second=3D0; + switch (ocf) { + case 0x0005: /* read software version */ + D_CMD(__FUNCTION__" Infineon software version\n"); + if (r_val[0]!=3D0) { + D_ERR(__FUNCTION__" Infineon software version read failure\n"); + } else { + printk("Infineon LM-FW version is: %x.%x%x\n", + r_val[2]&0x0F,r_val[1]>>4,r_val[1]&0x0F); + printk("Infineon BB-FW version is: %02x%02x\n",r_val[4],r_val[3]); + } + release_cmd_timer(); + wake_up_interruptible(&hci_wq); + break; + + case 0x0006: /* set baudrate */ + D_CMD(__FUNCTION__" Infineon baudrate set\n"); + if ( (r_val[0]=3D=3D0x00) && (second=3D=3D0) ) { + printk("Infineon baudrate changes after this message\n"); + second=3D1; + } else if ( (r_val[0]=3D=3D0x00) && second) { + printk("Infineon baudrate has changed to new value\n"); + second=3D0; + } else { + D_ERR(__FUNCTION__" Infineon baudrate set failure %x\n",r_val[0]); + } + release_cmd_timer(); + wake_up_interruptible(&hci_wq); + break; + + default: + release_cmd_timer(); + D_ERR(__FUNCTION__" Manufacturer specific : Invalid reply (0x%x)\n", +ocf); + wake_up_interruptible(&hci_wq); + break; + } /* end of switch */ +} + + +char* get_hw_name(void) +{ + return "Chipset: Infineon BlueMoon I"; +} + #else =20 /*************************************************************************= ****/ @@ -910,6 +1081,8 @@ return "Generic"; #elif defined(CONFIG_BLUETOOTH_NOINIT) return "No Init"; +#elif defined(CONFIG_BLUETOOTH_INFINEON_BMI) + return "Infineon"; #else return "Unknown"; #endif |