BOOLEAN btsnd_hcic_send_keypress_notif (BD_ADDR bd_addr, UINT8 notif) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF; p->offset = 0; UINT16_TO_STREAM (pp, HCI_SEND_KEYPRESS_NOTIF); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SEND_KEYPRESS_NOTIF); BDADDR_TO_STREAM (pp, bd_addr); UINT8_TO_STREAM (pp, notif); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_rmt_ext_features (UINT16 handle, UINT8 page_num) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_RMT_EXT_FEATURES)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_RMT_EXT_FEATURES; p->offset = 0; UINT16_TO_STREAM (pp, HCI_READ_RMT_EXT_FEATURES); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_RMT_EXT_FEATURES); UINT16_TO_STREAM (pp, handle); UINT8_TO_STREAM (pp, page_num); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_io_cap_req_neg_reply (BD_ADDR bd_addr, UINT8 err_code) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY; p->offset = 0; UINT16_TO_STREAM (pp, HCI_IO_CAP_REQ_NEG_REPLY); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_IO_CAP_NEG_REPLY); BDADDR_TO_STREAM (pp, bd_addr); UINT8_TO_STREAM (pp, err_code); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_delete_stored_key (BD_ADDR bd_addr, BOOLEAN delete_all_flag) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_DELETE_STORED_KEY)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_DELETE_STORED_KEY; p->offset = 0; UINT16_TO_STREAM (pp, HCI_DELETE_STORED_LINK_KEY); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_DELETE_STORED_KEY); BDADDR_TO_STREAM (pp, bd_addr); UINT8_TO_STREAM (pp, delete_all_flag); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_read_tx_power (UINT16 handle, UINT8 type) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_READ_TX_POWER)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_READ_TX_POWER; p->offset = 0; UINT16_TO_STREAM (pp, HCI_READ_TRANSMIT_POWER_LEVEL); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_READ_TX_POWER); UINT16_TO_STREAM (pp, handle); UINT8_TO_STREAM (pp, type); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
/******************************************************************************* ** ** Function nci_snd_nfcee_mode_set ** ** Description compose and send NFCEE Management NFCEE MODE SET command ** to command queue ** ** Returns status ** *******************************************************************************/ UINT8 nci_snd_nfcee_mode_set (UINT8 nfcee_id, UINT8 nfcee_mode) { BT_HDR *p; UINT8 *pp; if ((p = NCI_GET_CMD_BUF (NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET)) == NULL) return (NCI_STATUS_FAILED); p->event = BT_EVT_TO_NFC_NCI; p->len = NCI_MSG_HDR_SIZE + NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET; p->offset = NCI_MSG_OFFSET_SIZE; p->layer_specific = 0; pp = (UINT8 *) (p + 1) + p->offset; NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_EE_MANAGE); NCI_MSG_BLD_HDR1 (pp, NCI_MSG_NFCEE_MODE_SET); UINT8_TO_STREAM (pp, NCI_CORE_PARAM_SIZE_NFCEE_MODE_SET); UINT8_TO_STREAM (pp, nfcee_id); UINT8_TO_STREAM (pp, nfcee_mode); nfc_ncif_send_cmd (p); return (NCI_STATUS_OK); }
BOOLEAN btsnd_hcic_reject_esco_conn (BD_ADDR bd_addr, UINT8 reason) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REJECT_ESCO)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_ESCO; p->offset = 0; UINT16_TO_STREAM (pp, HCI_REJECT_ESCO_CONNECTION); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_ESCO); BDADDR_TO_STREAM (pp, bd_addr); UINT8_TO_STREAM (pp, reason); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_set_conn_encrypt (UINT16 handle, BOOLEAN enable) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_SET_CONN_ENCRYPT)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_SET_CONN_ENCRYPT; p->offset = 0; UINT16_TO_STREAM (pp, HCI_SET_CONN_ENCRYPTION); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_SET_CONN_ENCRYPT); UINT16_TO_STREAM (pp, handle); UINT8_TO_STREAM (pp, enable); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_ble_transmitter_test(UINT8 tx_freq, UINT8 test_data_len, UINT8 payload) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_WRITE_PARAM3)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_WRITE_PARAM3; p->offset = 0; UINT16_TO_STREAM (pp, HCI_BLE_TRANSMITTER_TEST); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_WRITE_PARAM3); UINT8_TO_STREAM (pp, tx_freq); UINT8_TO_STREAM (pp, test_data_len); UINT8_TO_STREAM (pp, payload); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
/******************************************************************************* ** ** Function nci_snd_t3t_polling ** ** Description compose and send RF Management T3T POLLING command ** to command queue ** ** Returns status ** *******************************************************************************/ UINT8 nci_snd_t3t_polling (UINT16 system_code, UINT8 rc, UINT8 tsn) { BT_HDR *p; UINT8 *pp; if ((p = NCI_GET_CMD_BUF (NCI_RF_PARAM_SIZE_T3T_POLLING)) == NULL) return (NCI_STATUS_FAILED); p->event = BT_EVT_TO_NFC_NCI; p->len = NCI_MSG_HDR_SIZE + NCI_RF_PARAM_SIZE_T3T_POLLING; p->offset = NCI_MSG_OFFSET_SIZE; p->layer_specific = 0; pp = (UINT8 *) (p + 1) + p->offset; NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_T3T_POLLING); UINT8_TO_STREAM (pp, NCI_RF_PARAM_SIZE_T3T_POLLING); UINT16_TO_BE_STREAM (pp, system_code); UINT8_TO_STREAM (pp, rc); UINT8_TO_STREAM (pp, tsn); nfc_ncif_send_cmd (p); return (NCI_STATUS_OK); }
/******************************************************************************* ** ** Function nci_snd_deactivate_cmd ** ** Description compose and send RF Management DEACTIVATE command ** to command queue ** ** Returns status ** *******************************************************************************/ UINT8 nci_snd_deactivate_cmd (UINT8 de_act_type ) { BT_HDR *p; UINT8 *pp; nfc_cb.reassembly = TRUE; if ((p = NCI_GET_CMD_BUF (NCI_DISCOVER_PARAM_SIZE_DEACT)) == NULL) return (NCI_STATUS_FAILED); p->event = BT_EVT_TO_NFC_NCI; p->len = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_DEACT; p->offset = NCI_MSG_OFFSET_SIZE; p->layer_specific = 0; pp = (UINT8 *) (p + 1) + p->offset; NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DEACTIVATE); UINT8_TO_STREAM (pp, NCI_DISCOVER_PARAM_SIZE_DEACT); UINT8_TO_STREAM (pp, de_act_type); nfc_ncif_send_cmd (p); return (NCI_STATUS_OK); }
/******************************************************************************* ** ** Function nci_snd_discover_select_cmd ** ** Description compose and send RF Management DISCOVER SELECT command ** to command queue ** ** Returns status ** *******************************************************************************/ UINT8 nci_snd_discover_select_cmd (UINT8 rf_disc_id, UINT8 protocol, UINT8 rf_interface) { BT_HDR *p; UINT8 *pp; if ((p = NCI_GET_CMD_BUF (NCI_DISCOVER_PARAM_SIZE_SELECT)) == NULL) return (NCI_STATUS_FAILED); p->event = BT_EVT_TO_NFC_NCI; p->len = NCI_MSG_HDR_SIZE + NCI_DISCOVER_PARAM_SIZE_SELECT; p->offset = NCI_MSG_OFFSET_SIZE; p->layer_specific = 0; pp = (UINT8 *) (p + 1) + p->offset; NCI_MSG_BLD_HDR0 (pp, NCI_MT_CMD, NCI_GID_RF_MANAGE); NCI_MSG_BLD_HDR1 (pp, NCI_MSG_RF_DISCOVER_SELECT); UINT8_TO_STREAM (pp, NCI_DISCOVER_PARAM_SIZE_SELECT); UINT8_TO_STREAM (pp, rf_disc_id); UINT8_TO_STREAM (pp, protocol); UINT8_TO_STREAM (pp, rf_interface); nfc_ncif_send_cmd (p); return (NCI_STATUS_OK); }
BOOLEAN btsnd_hcic_inquiry(const LAP inq_lap, UINT8 duration, UINT8 response_cnt) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_INQUIRY)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQUIRY; p->offset = 0; UINT16_TO_STREAM (pp, HCI_INQUIRY); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQUIRY); LAP_TO_STREAM (pp, inq_lap); UINT8_TO_STREAM (pp, duration); UINT8_TO_STREAM (pp, response_cnt); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_ble_set_adv_data (UINT8 data_len, UINT8 *p_data) { BT_HDR *p; UINT8 *pp; for (int i = 0; i < data_len; i++) { HCI_TRACE_DEBUG("p_data[%d] = %x\n", i, p_data[i]); } if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1)) == NULL) { return (FALSE); } pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1; p->offset = 0; UINT16_TO_STREAM (pp, HCI_BLE_WRITE_ADV_DATA); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA + 1); memset(pp, 0, HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA); if (p_data != NULL && data_len > 0) { if (data_len > HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA) { data_len = HCIC_PARAM_SIZE_BLE_WRITE_ADV_DATA; } UINT8_TO_STREAM (pp, data_len); ARRAY_TO_STREAM (pp, p_data, data_len); } btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
BOOLEAN btsnd_hcic_reject_conn (BD_ADDR dest, UINT8 reason) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_REJECT_CONN)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_REJECT_CONN; p->offset = 0; UINT16_TO_STREAM (pp, HCI_REJECT_CONNECTION_REQUEST); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_REJECT_CONN); BDADDR_TO_STREAM (pp, dest); UINT8_TO_STREAM (pp, reason); counter_add("hci.conn.reject", 1); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
//***************************************************************************** // //! SimpleLink_Init_Start //! //! @param usPatchesAvailableAtHost flag to indicate if patches available //! from host or from EEPROM. Due to the //! fact the patches are burn to the EEPROM //! using the patch programmer utility, the //! patches will be available from the EEPROM //! and not from the host. //! //! @return none //! //! @brief Send HCI_CMND_SIMPLE_LINK_START to CC3000 // //***************************************************************************** static void SimpleLink_Init_Start(UINT16 usPatchesAvailableAtHost) { UINT8 *ptr; UINT8 *args; ptr = tSLInformation.pucTxCommandBuffer; args = (UINT8 *)(ptr + HEADERS_SIZE_CMD); UINT8_TO_STREAM(args, ((usPatchesAvailableAtHost) ? SL_PATCHES_REQUEST_FORCE_NONE : SL_PATCHES_REQUEST_DEFAULT)); // IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000 hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); }
//***************************************************************************** // //! hci_data_send //! //! @param usOpcode command operation code //! @param ucArgs pointer to the command's arguments buffer //! @param usArgsLength length of the arguments //! @param ucTail pointer to the data buffer //! @param usTailLength buffer length //! //! @return none //! //! @brief Initiate an HCI data write operation // //***************************************************************************** long hci_data_send(unsigned char ucOpcode, unsigned char *ucArgs, unsigned short usArgsLength, unsigned short usDataLength, const unsigned char *ucTail, unsigned short usTailLength) { (void) ucTail; unsigned char *stream; stream = ((ucArgs) + SPI_HEADER_SIZE); UINT8_TO_STREAM(stream, HCI_TYPE_DATA); UINT8_TO_STREAM(stream, ucOpcode); UINT8_TO_STREAM(stream, usArgsLength); stream = UINT16_TO_STREAM(stream, usArgsLength + usDataLength + usTailLength); // Send the packet over the SPI SpiWrite(ucArgs, SIMPLE_LINK_HCI_DATA_HEADER_SIZE + usArgsLength + usDataLength + usTailLength); return(ESUCCESS); }
//***************************************************************************** // //! SimpleLink_Init_Start //! //! \param scan_timeout ... //! \param num_of_entries ... //! //! \return status of operation: ESUCCESS or EFAIL //! //! \brief Gets the WLAN scan operation result // //***************************************************************************** static void SimpleLink_Init_Start(unsigned short usPatchesAvailableAtHost) { unsigned char *ptr; unsigned char *args; ptr = tSLInformation.pucTxCommandBuffer; args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); UINT8_TO_STREAM(args, ((usPatchesAvailableAtHost) ? SL_PATCHES_REQUEST_FORCE_HOST : SL_PATCHES_REQUEST_DEFAULT)); // IRQ Line asserted - start the read buffer size command hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); }
static void btif_mp_rx_data_ind(uint8_t evtcode, uint8_t *buf, uint8_t len) { int i; uint8_t *pEvtBuf = BaseInterfaceModuleMemory.evtBuffer; BaseInterfaceModuleMemory.evtLen = sizeof(evtcode) + sizeof(len) + len; bt_mp_LogMsg("<-- HCI EVENT event code: 0x%x %d", evtcode, len); for( i = 0 ; i < len; i++ ) { bt_mp_LogMsg(" 0x%x",buf[i]); } UINT8_TO_STREAM(pEvtBuf, evtcode); UINT8_TO_STREAM(pEvtBuf, len); memcpy(pEvtBuf, buf, len); bt_transport_signal_event(&BaseInterfaceModuleMemory, MP_TRANSPORT_EVENT_RX_HCIEVT); }
BOOLEAN btsnd_hcic_create_conn(BD_ADDR dest, UINT16 packet_types, UINT8 page_scan_rep_mode, UINT8 page_scan_mode, UINT16 clock_offset, UINT8 allow_switch) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_CREATE_CONN)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); #ifndef BT_10A p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN; #else p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_CREATE_CONN - 1; #endif p->offset = 0; UINT16_TO_STREAM (pp, HCI_CREATE_CONNECTION); #ifndef BT_10A UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_CREATE_CONN); #else UINT8_TO_STREAM (pp, (HCIC_PARAM_SIZE_CREATE_CONN - 1)); #endif BDADDR_TO_STREAM (pp, dest); UINT16_TO_STREAM (pp, packet_types); UINT8_TO_STREAM (pp, page_scan_rep_mode); UINT8_TO_STREAM (pp, page_scan_mode); UINT16_TO_STREAM (pp, clock_offset); #if !defined (BT_10A) UINT8_TO_STREAM (pp, allow_switch); #endif btm_acl_paging (p, dest); return (TRUE); }
//***************************************************************************** // //! SimpleLink_Init_Start //! //! @param usPatchesAvailableAtHost flag to indicate if patches available //! from host or from EEPROM. Due to the //! fact the patches are burn to the EEPROM //! using the patch programmer utility, the //! patches will be available from the EEPROM //! and not from the host. //! //! @return none //! //! @brief Send HCI_CMND_SIMPLE_LINK_START to CC3000 // //***************************************************************************** static void SimpleLink_Init_Start(unsigned short usPatchesAvailableAtHost) { unsigned char *ptr; unsigned char *args; ptr = tSLInformation.pucTxCommandBuffer; args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); if (usPatchesAvailableAtHost > 2) usPatchesAvailableAtHost = 2; UINT8_TO_STREAM(args, usPatchesAvailableAtHost); // IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000 hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); }
/******************************************************************************* ** ** Function attp_build_opcode_cmd ** ** Description Build a request/response with opcode only. ** ** Returns None. ** *******************************************************************************/ BT_HDR *attp_build_opcode_cmd(UINT8 op_code) { BT_HDR *p_buf = NULL; UINT8 *p; if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + 1 + L2CAP_MIN_OFFSET)) != NULL) { p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET; p_buf->offset = L2CAP_MIN_OFFSET; UINT8_TO_STREAM (p, op_code); p_buf->len = 1; } return p_buf; }
/******************************************************************************* ** ** Function attp_build_mtu_exec_cmd ** ** Description Build a exchange MTU request ** ** Returns None. ** *******************************************************************************/ BT_HDR *attp_build_mtu_cmd(UINT8 op_code, UINT16 rx_mtu) { BT_HDR *p_buf = NULL; UINT8 *p; if ((p_buf = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + GATT_HDR_SIZE + L2CAP_MIN_OFFSET)) != NULL) { p = (UINT8 *)(p_buf + 1) + L2CAP_MIN_OFFSET; UINT8_TO_STREAM (p, op_code); UINT16_TO_STREAM (p, rx_mtu); p_buf->offset = L2CAP_MIN_OFFSET; p_buf->len = GATT_HDR_SIZE; /* opcode + 2 bytes mtu */ } return p_buf; }
/******************************************************************************* ** Function smp_concatenate_peer ** add pairing command received from peer device into p1. *******************************************************************************/ void smp_concatenate_peer( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code) { UINT8 *p = *p_data; SMP_TRACE_DEBUG0 ("smp_concatenate_peer "); UINT8_TO_STREAM(p, op_code); UINT8_TO_STREAM(p, p_cb->peer_io_caps); UINT8_TO_STREAM(p, p_cb->peer_oob_flag); UINT8_TO_STREAM(p, p_cb->peer_auth_req); UINT8_TO_STREAM(p, p_cb->peer_enc_size); UINT8_TO_STREAM(p, p_cb->peer_i_key); UINT8_TO_STREAM(p, p_cb->peer_r_key); *p_data = p; }
/******************************************************************************* ** Function smp_concatenate_peer ** add pairing command sent from local device into p1. *******************************************************************************/ void smp_concatenate_local( tSMP_CB *p_cb, UINT8 **p_data, UINT8 op_code) { UINT8 *p = *p_data; SMP_TRACE_DEBUG ("smp_concatenate_local "); UINT8_TO_STREAM(p, op_code); UINT8_TO_STREAM(p, p_cb->loc_io_caps); UINT8_TO_STREAM(p, p_cb->loc_oob_flag); UINT8_TO_STREAM(p, p_cb->loc_auth_req); UINT8_TO_STREAM(p, p_cb->loc_enc_size); UINT8_TO_STREAM(p, p_cb->loc_i_key); UINT8_TO_STREAM(p, p_cb->loc_r_key); *p_data = p; }
/******************************************************************************* ** ** Function btusb_lite_hci_cmd_cplt_evt_send ** ** Description Send an HCI VSC Cmd Complete. ** ** Returns Void ** *******************************************************************************/ static void btusb_lite_hci_cmd_cplt_evt_send(struct btusb *p_dev, UINT16 opcode, UINT8 *p_param, UINT8 param_len) { BT_HDR *p_msg; UINT16 size = param_len + 5; UINT8 *p; /* Get a buffer from the pool */ p_msg = (BT_HDR *)GKI_getbuf(sizeof(BT_HDR) + size); if(unlikely(!p_msg)) { BTUSB_ERR("Unable to get GKI buffer\n"); return; } if (unlikely(dbgflags & BTUSB_GKI_CHK_MSG) && unlikely(GKI_buffer_status(p_msg) != BUF_STATUS_UNLINKED)) { BTUSB_ERR("buffer != BUF_STATUS_UNLINKED 0x%p\n", p_msg); return; } p_msg->offset = 0; p_msg->event = HCIT_TYPE_EVENT; p_msg->len = size; p_msg->layer_specific = BTUSB_LS_GKI_BUFFER; p = (UINT8 *)(p_msg + 1) + p_msg->offset; p = btusb_lite_hci_write_evt_header(p, HCI_COMMAND_COMPLETE_EVT, size - 2); UINT8_TO_STREAM(p, BTUSB_LITE_HCI_NUM_CMD); /* HCI Num Command */ UINT16_TO_STREAM(p, opcode); /* HCI OpCode */ if (p_param) { ARRAY_TO_STREAM(p, p_param, param_len) } /* InQ for user-space to read */ GKI_enqueue(&p_dev->rx_queue, p_msg); /* if the process is polling, indicate RX event */ wake_up_interruptible(&p_dev->rx_wait_q); }
BOOLEAN btsnd_hcic_inq_cancel(void) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_INQ_CANCEL)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_INQ_CANCEL; p->offset = 0; UINT16_TO_STREAM (pp, HCI_INQUIRY_CANCEL); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_INQ_CANCEL); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }
//***************************************************************************** // //! SimpleLink_Init_Start //! //! @param usPatchesAvailableAtHost flag to indicate if patches available //! from host or from EEPROM. Due to the //! fact the patches are burn to the EEPROM //! using the patch programmer utility, the //! patches will be available from the EEPROM //! and not from the host. //! //! @return none //! //! @brief Send HCI_CMND_SIMPLE_LINK_START to CC3000 // //***************************************************************************** static void SimpleLink_Init_Start(unsigned short usPatchesAvailableAtHost) { unsigned char *ptr; unsigned char *args; // TM_COMMAND('w', "Starting up SimpleLink..."); ptr = tSLInformation.pucTxCommandBuffer; args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); UINT8_TO_STREAM(args, ((usPatchesAvailableAtHost) ? SL_PATCHES_REQUEST_FORCE_NONE : SL_PATCHES_REQUEST_DEFAULT)); // IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000 hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); renableIRQ(); }
void btsnd_hcic_vendor_spec_cmd (void *buffer, UINT16 opcode, UINT8 len, UINT8 *p_data, void *p_cmd_cplt_cback) { BT_HDR *p = (BT_HDR *)buffer; UINT8 *pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + len; p->offset = sizeof(void *); *((void **)pp) = p_cmd_cplt_cback; /* Store command complete callback in buffer */ pp += sizeof(void *); /* Skip over callback pointer */ UINT16_TO_STREAM (pp, HCI_GRP_VENDOR_SPECIFIC | opcode); UINT8_TO_STREAM (pp, len); ARRAY_TO_STREAM (pp, p_data, len); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); }
BOOLEAN btsnd_hcic_exit_per_inq (void) { BT_HDR *p; UINT8 *pp; if ((p = HCI_GET_CMD_BUF(HCIC_PARAM_SIZE_EXIT_PER_INQ)) == NULL) return (FALSE); pp = (UINT8 *)(p + 1); p->len = HCIC_PREAMBLE_SIZE + HCIC_PARAM_SIZE_EXIT_PER_INQ; p->offset = 0; UINT16_TO_STREAM (pp, HCI_EXIT_PERIODIC_INQUIRY_MODE); UINT8_TO_STREAM (pp, HCIC_PARAM_SIZE_EXIT_PER_INQ); btu_hcif_send_cmd (LOCAL_BR_EDR_CONTROLLER_ID, p); return (TRUE); }