Lines Matching +full:controller +full:- +full:data +full:- +full:delay +full:- +full:us

1 /* spi.c - SPI based Bluetooth driver */
8 * SPDX-License-Identifier: Apache-2.0
54 #define SPI_MAX_MSG_LEN 255 /* As defined by X-NUCLEO-IDB04A1 BSP */
62 #define MAX_MTU (SPI_MAX_MSG_LEN - H4_HDR_SIZE - BT_L2CAP_HDR_SIZE - BT_HCI_ACL_HDR_SIZE)
156 return -EINVAL; in bt_spi_get_header()
168 /* When reading, keep looping if there is not yet any data */ in bt_spi_get_header()
244 struct bt_spi_data *hci = dev->data; in bt_spi_rx_thread()
265 /* Delay here is rounded up to next tick */ in bt_spi_rx_thread()
267 /* Read data */ in bt_spi_rx_thread()
273 /* Consider increasing controller-data-delay-us in bt_spi_rx_thread()
276 LOG_DBG("Controller not ready for SPI transaction " in bt_spi_rx_thread()
293 /* Construct net_buf from SPI data */ in bt_spi_rx_thread()
296 /* Handle the received HCI data */ in bt_spi_rx_thread()
297 hci->recv(dev, buf); in bt_spi_rx_thread()
313 if (buf->len >= SPI_MAX_MSG_LEN) { in bt_spi_send()
314 LOG_ERR("Message too long (%d)", buf->len); in bt_spi_send()
315 return -EINVAL; in bt_spi_send()
331 return -EINVAL; in bt_spi_send()
335 size = MIN(buf->len, size); in bt_spi_send()
337 if (size < buf->len) { in bt_spi_send()
338 LOG_WRN("Unable to write full data, skipping"); in bt_spi_send()
340 ret = -ECANCELED; in bt_spi_send()
344 /* Delay here is rounded up to next tick */ in bt_spi_send()
348 ret = bt_spi_transceive(buf->data, size, in bt_spi_send()
353 /* Consider increasing controller-data-delay-us in bt_spi_send()
356 LOG_DBG("Controller not ready for SPI transaction of %d bytes", size); in bt_spi_send()
367 LOG_HEXDUMP_DBG(buf->data, buf->len, "SPI TX"); in bt_spi_send()
377 struct bt_spi_data *hci = dev->data; in bt_spi_open()
386 /* Configure IRQ pin and the IRQ call-back/handler */ in bt_spi_open()
404 hci->recv = recv; in bt_spi_open()
418 /* Device will let us know when it's ready */ in bt_spi_open()
435 return -ENODEV; in bt_spi_init()
440 return -ENODEV; in bt_spi_init()
445 return -ENODEV; in bt_spi_init()