Lines Matching +full:rx +full:- +full:wake +full:- +full:timeout
1 /* ipm_stm32wb.c - HCI driver for stm32wb shared ram */
4 * Copyright (c) 2019-2022 Linaro Ltd.
6 * SPDX-License-Identifier: Apache-2.0
33 /* Private variables ---------------------------------------------------------*/
80 /* Rx thread definitions */
128 * https://github.com/zephyrproject-rtos/zephyr/issues/19509
139 struct bt_hci_evt_le_meta_event *mev = (void *)&tev->payload; in tryfix_event()
141 if (tev->evtcode != BT_HCI_EVT_LE_META_EVENT || in tryfix_event()
142 mev->subevent != BT_HCI_EVT_LE_ENH_CONN_COMPLETE) { in tryfix_event()
149 if (bt_addr_eq(&evt->peer_addr.a, BT_ADDR_NONE)) { in tryfix_event()
150 LOG_WRN("Invalid peer addr %s", bt_addr_le_str(&evt->peer_addr)); in tryfix_event()
151 bt_addr_copy(&evt->peer_addr.a, &evt->peer_rpa); in tryfix_event()
152 evt->peer_addr.type = BT_ADDR_LE_RANDOM; in tryfix_event()
164 struct hci_data *hci = dev->data; in bt_ipm_rx_thread()
171 k_timeout_t timeout = K_FOREVER; in bt_ipm_rx_thread() local
184 switch (hcievt->evtserial.type) { in bt_ipm_rx_thread()
186 LOG_DBG("EVT: hcievt->evtserial.evt.evtcode: 0x%02x", in bt_ipm_rx_thread()
187 hcievt->evtserial.evt.evtcode); in bt_ipm_rx_thread()
188 switch (hcievt->evtserial.evt.evtcode) { in bt_ipm_rx_thread()
192 hcievt->evtserial.evt.evtcode); in bt_ipm_rx_thread()
196 mev = (void *)&hcievt->evtserial.evt.payload; in bt_ipm_rx_thread()
197 if (hcievt->evtserial.evt.evtcode == BT_HCI_EVT_LE_META_EVENT && in bt_ipm_rx_thread()
198 (mev->subevent == BT_HCI_EVT_LE_ADVERTISING_REPORT)) { in bt_ipm_rx_thread()
200 timeout = K_NO_WAIT; in bt_ipm_rx_thread()
204 hcievt->evtserial.evt.evtcode, in bt_ipm_rx_thread()
205 discardable, timeout); in bt_ipm_rx_thread()
212 tryfix_event(&hcievt->evtserial.evt); in bt_ipm_rx_thread()
215 buf_add_len = hcievt->evtserial.evt.plen + 2; in bt_ipm_rx_thread()
223 net_buf_add_mem(buf, &hcievt->evtserial.evt, in bt_ipm_rx_thread()
227 acl = &(((TL_AclDataPacket_t *)hcievt)->AclDataSerial); in bt_ipm_rx_thread()
229 acl_hdr.handle = acl->handle; in bt_ipm_rx_thread()
230 acl_hdr.len = acl->length; in bt_ipm_rx_thread()
243 net_buf_add_mem(buf, (uint8_t *)&acl->acl_data, in bt_ipm_rx_thread()
247 LOG_ERR("Unknown BT buf type %d", hcievt->evtserial.type); in bt_ipm_rx_thread()
254 hci->recv(dev, buf); in bt_ipm_rx_thread()
276 void shci_cmd_resp_wait(uint32_t timeout) in shci_cmd_resp_wait() argument
278 k_sem_take(&ble_sys_wait_cmd_rsp, K_MSEC(timeout)); in shci_cmd_resp_wait()
366 LOG_DBG("ACL: buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); in bt_ipm_send()
370 &((TL_AclDataPacket_t *)HciAclDataBuffer)->AclDataSerial, in bt_ipm_send()
371 buf->data, buf->len); in bt_ipm_send()
375 LOG_DBG("CMD: buf %p type %u len %u", buf, bt_buf_get_type(buf), buf->len); in bt_ipm_send()
376 ble_cmd_buff->cmdserial.type = BT_HCI_H4_CMD; in bt_ipm_send()
377 ble_cmd_buff->cmdserial.cmd.plen = buf->len; in bt_ipm_send()
378 memcpy((void *)&ble_cmd_buff->cmdserial.cmd, buf->data, in bt_ipm_send()
379 buf->len); in bt_ipm_send()
385 return -EINVAL; in bt_ipm_send()
405 /* 48-bit Device Address EUI-48 */ in bt_get_ble_addr()
436 return -ENOMSG; in bt_ipm_set_addr()
442 return -ENOBUFS; in bt_ipm_set_addr()
446 param->config_offset = HCI_CONFIG_DATA_PUBADDR_OFFSET; in bt_ipm_set_addr()
447 param->length = 6; in bt_ipm_set_addr()
448 param->value[0] = uid_addr->val[0]; in bt_ipm_set_addr()
449 param->value[1] = uid_addr->val[1]; in bt_ipm_set_addr()
450 param->value[2] = uid_addr->val[2]; in bt_ipm_set_addr()
451 param->value[3] = uid_addr->val[3]; in bt_ipm_set_addr()
452 param->value[4] = uid_addr->val[4]; in bt_ipm_set_addr()
453 param->value[5] = uid_addr->val[5]; in bt_ipm_set_addr()
476 return -ENOBUFS; in bt_ipm_ble_init()
479 param->cmd = 0x0F; in bt_ipm_ble_init()
480 param->value[0] = 0x18; in bt_ipm_ble_init()
481 param->value[1] = 0x01; in bt_ipm_ble_init()
499 return -ENODEV; in c2_reset()
505 LOG_ERR("Could not configure RF Wake up clock"); in c2_reset()
533 return -ETIMEDOUT; in c2_reset()
546 struct hci_data *hci = dev->data; in bt_ipm_open()
561 /* Start RX thread */ in bt_ipm_open()
568 hci->recv = recv; in bt_ipm_open()
596 struct hci_data *hci = dev->data; in bt_ipm_close()
613 hci->recv = NULL; in bt_ipm_close()