v2.0.0
cybt_shared_bus_driver.h
1/*
2 * Copyright (c) 2023 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef CYBT_SHARE_BUS_DRIVER_H
8#define CYBT_SHARE_BUS_DRIVER_H
9
10#define BTSDIO_FWBUF_SIZE (0x1000)
11#define BTFW_MAX_STR_LEN (600)
12#define BTFW_SD_ALIGN (32)
13#define BTFW_DOWNLOAD_BLK_SIZE (((BTFW_MAX_STR_LEN) / 2) + 8)
14
15typedef enum {
16 CYBT_SUCCESS = 0,
17 CYBT_ERR_BADARG = 0xB1,
18 CYBT_ERR_OUT_OF_MEMORY,
19 CYBT_ERR_TIMEOUT,
20 CYBT_ERR_HCI_INIT_FAILED,
21 CYBT_ERR_HCI_UNSUPPORTED_IF,
22 CYBT_ERR_HCI_UNSUPPORTED_BAUDRATE,
23 CYBT_ERR_HCI_NOT_INITIALIZE,
24 CYBT_ERR_HCI_WRITE_FAILED,
25 CYBT_ERR_HCI_READ_FAILED,
26 CYBT_ERR_HCI_GET_TX_MUTEX_FAILED,
27 CYBT_ERR_HCI_GET_RX_MUTEX_FAILED,
28 CYBT_ERR_HCI_SET_BAUDRATE_FAILED,
29 CYBT_ERR_HCI_SET_FLOW_CTRL_FAILED,
30 CYBT_ERR_INIT_MEMPOOL_FAILED,
31 CYBT_ERR_INIT_QUEUE_FAILED,
32 CYBT_ERR_CREATE_TASK_FAILED,
33 CYBT_ERR_SEND_QUEUE_FAILED,
34 CYBT_ERR_MEMPOOL_NOT_INITIALIZE,
35 CYBT_ERR_QUEUE_ALMOST_FULL,
36 CYBT_ERR_QUEUE_FULL,
37 CYBT_ERR_GPIO_POWER_INIT_FAILED,
38 CYBT_ERR_GPIO_DEV_WAKE_INIT_FAILED,
39 CYBT_ERR_GPIO_HOST_WAKE_INIT_FAILED,
40 CYBT_ERR_GENERIC
41} cybt_result_t;
42
43typedef enum {
44 H2B_BUF_ADDR_IDX = 0x10,
45 H2B_BUF_IN_ADDR_IDX,
46 H2B_BUF_OUT_ADDR_IDX,
47 B2H_BUF_ADDR_IDX,
48 B2H_BUF_IN_ADDR_IDX,
49 B2H_BUF_OUT_ADDR_IDX,
50} cybt_addr_idx_t;
51
52 typedef struct {
53 uint32_t host2bt_in_val;
54 uint32_t host2bt_out_val;
55 uint32_t bt2host_in_val;
56 uint32_t bt2host_out_val;
57} cybt_fw_membuf_index_t;
58
59struct _cyw43_ll_t;
60void cybt_sharedbus_driver_init(struct _cyw43_ll_t *driver);
61
62cybt_result_t cybt_init_buffer(void);
63
64cybt_result_t cybt_reg_write_idx(cybt_addr_idx_t reg_idx, uint32_t value);
65cybt_result_t cybt_mem_write_idx(cybt_addr_idx_t mem_idx, uint32_t offset, const uint8_t *p_data, uint32_t data_len);
66cybt_result_t cybt_mem_read_idx(cybt_addr_idx_t mem_idx, uint32_t offset, uint8_t *p_data, uint32_t data_len);
67
68cybt_result_t cybt_fw_download(const uint8_t *p_bt_firmware, uint32_t bt_firmware_len, uint8_t *p_write_buf, uint8_t *p_hex_buf);
69
70int cybt_ready(void);
71int cybt_awake(void);
72
73cybt_result_t cybt_set_bt_awake(int value);
74cybt_result_t cybt_set_host_ready(void);
75cybt_result_t cybt_set_bt_intr(int value);
76cybt_result_t cybt_toggle_bt_intr(void);
77cybt_result_t cybt_get_bt_buf_index(cybt_fw_membuf_index_t *p_buf_index);
78
79void cybt_debug_dump(void);
80
81#endif
_cyw43_ll_t
Definition: cyw43_ll.h:265
cybt_fw_membuf_index_t
Definition: cybt_shared_bus_driver.h:52