Bluetooth: hci: Add definitions for codec and controller delay info
Add defines and structs for reading information about supported codes, codec capabilities and controller delays. Return parameter structs for commands that return multiple variable-length fields only model the fixed-length fields to minimize inconsistencies. Signed-off-by: Wolfgang Puffitsch <wopu@demant.com>
This commit is contained in:
parent
c08ef381c8
commit
9437a6a08d
2 changed files with 119 additions and 15 deletions
|
@ -642,6 +642,115 @@ struct bt_hci_rp_read_bd_addr {
|
|||
bt_addr_t bdaddr;
|
||||
} __packed;
|
||||
|
||||
/* logic transport type bits as returned when reading supported codecs */
|
||||
#define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_ACL BIT(0)
|
||||
#define BT_HCI_CODEC_TRANSPORT_MASK_BREDR_SCO BIT(1)
|
||||
#define BT_HCI_CODEC_TRANSPORT_MASK_LE_CIS BIT(2)
|
||||
#define BT_HCI_CODEC_TRANSPORT_MASK_LE_BIS BIT(3)
|
||||
|
||||
/* logic transport types for reading codec capabilities and controller delays */
|
||||
#define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_ACL 0x00
|
||||
#define BT_HCI_LOGICAL_TRANSPORT_TYPE_BREDR_SCO 0x01
|
||||
#define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_CIS 0x02
|
||||
#define BT_HCI_LOGICAL_TRANSPORT_TYPE_LE_BIS 0x03
|
||||
|
||||
/* audio datapath directions */
|
||||
#define BT_HCI_DATAPATH_DIR_HOST_TO_CTLR 0x00
|
||||
#define BT_HCI_DATAPATH_DIR_CTLR_TO_HOST 0x01
|
||||
|
||||
/* coding format assigned numbers, used for codec IDs */
|
||||
#define BT_HCI_CODING_FORMAT_ULAW_LOG 0x00
|
||||
#define BT_HCI_CODING_FORMAT_ALAW_LOG 0x01
|
||||
#define BT_HCI_CODING_FORMAT_CVSD 0x02
|
||||
#define BT_HCI_CODING_FORMAT_TRANSPARENT 0x03
|
||||
#define BT_HCI_CODING_FORMAT_LINEAR_PCM 0x04
|
||||
#define BT_HCI_CODING_FORMAT_MSBC 0x05
|
||||
#define BT_HCI_CODING_FORMAT_VS 0xFF
|
||||
|
||||
|
||||
#define BT_HCI_OP_READ_CODECS BT_OP(BT_OGF_INFO, 0x000b)
|
||||
struct bt_hci_std_codec_info {
|
||||
uint8_t codec_id;
|
||||
} __packed;
|
||||
struct bt_hci_std_codecs {
|
||||
uint8_t num_codecs;
|
||||
struct bt_hci_std_codec_info codec_info[0];
|
||||
} __packed;
|
||||
struct bt_hci_vs_codec_info {
|
||||
uint16_t company_id;
|
||||
uint16_t codec_id;
|
||||
} __packed;
|
||||
struct bt_hci_vs_codecs {
|
||||
uint8_t num_codecs;
|
||||
struct bt_hci_vs_codec_info codec_info[0];
|
||||
} __packed;
|
||||
struct bt_hci_rp_read_codecs {
|
||||
uint8_t status;
|
||||
/* other fields filled in dynamically */
|
||||
uint8_t codecs[0];
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_READ_CODECS_V2 BT_OP(BT_OGF_INFO, 0x000d)
|
||||
struct bt_hci_std_codec_info_v2 {
|
||||
uint8_t codec_id;
|
||||
uint8_t transports; /* bitmap */
|
||||
} __packed;
|
||||
struct bt_hci_std_codecs_v2 {
|
||||
uint8_t num_codecs;
|
||||
struct bt_hci_std_codec_info_v2 codec_info[0];
|
||||
} __packed;
|
||||
struct bt_hci_vs_codec_info_v2 {
|
||||
uint16_t company_id;
|
||||
uint16_t codec_id;
|
||||
uint8_t transports; /* bitmap */
|
||||
} __packed;
|
||||
struct bt_hci_vs_codecs_v2 {
|
||||
uint8_t num_codecs;
|
||||
struct bt_hci_vs_codec_info_v2 codec_info[0];
|
||||
} __packed;
|
||||
struct bt_hci_rp_read_codecs_v2 {
|
||||
uint8_t status;
|
||||
/* other fields filled in dynamically */
|
||||
uint8_t codecs[0];
|
||||
} __packed;
|
||||
|
||||
struct bt_hci_cp_codec_id {
|
||||
uint8_t coding_format;
|
||||
uint16_t company_id;
|
||||
uint16_t vs_codec_id;
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_READ_CODEC_CAPABILITIES BT_OP(BT_OGF_INFO, 0x000e)
|
||||
struct bt_hci_cp_read_codec_capabilities {
|
||||
struct bt_hci_cp_codec_id codec_id;
|
||||
uint8_t transport;
|
||||
uint8_t direction;
|
||||
} __packed;
|
||||
struct bt_hci_codec_capability_info {
|
||||
uint8_t length;
|
||||
uint8_t data[0];
|
||||
} __packed;
|
||||
struct bt_hci_rp_read_codec_capabilities {
|
||||
uint8_t status;
|
||||
uint8_t num_capabilities;
|
||||
/* other fields filled in dynamically */
|
||||
uint8_t capabilities[0];
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_READ_CTLR_DELAY BT_OP(BT_OGF_INFO, 0x000f)
|
||||
struct bt_hci_cp_read_ctlr_delay {
|
||||
struct bt_hci_cp_codec_id codec_id;
|
||||
uint8_t transport;
|
||||
uint8_t direction;
|
||||
uint8_t codec_config_len;
|
||||
uint8_t codec_config[0];
|
||||
} __packed;
|
||||
struct bt_hci_rp_read_ctlr_delay {
|
||||
uint8_t status;
|
||||
uint8_t min_ctlr_delay[3];
|
||||
uint8_t max_ctlr_delay[3];
|
||||
} __packed;
|
||||
|
||||
#define BT_HCI_OP_READ_RSSI BT_OP(BT_OGF_STATUS, 0x0005)
|
||||
struct bt_hci_cp_read_rssi {
|
||||
uint16_t handle;
|
||||
|
@ -1658,9 +1767,7 @@ struct bt_hci_cp_le_setup_iso_path {
|
|||
uint16_t handle;
|
||||
uint8_t path_dir;
|
||||
uint8_t path_id;
|
||||
uint8_t coding_format;
|
||||
uint16_t company_id;
|
||||
uint16_t vendor_id;
|
||||
struct bt_hci_cp_codec_id codec_id;
|
||||
uint8_t controller_delay[3];
|
||||
uint8_t codec_config_len;
|
||||
uint8_t codec_config[0];
|
||||
|
|
|
@ -36,11 +36,6 @@ NET_BUF_POOL_FIXED_DEFINE(iso_frag_pool, CONFIG_BT_ISO_TX_FRAG_COUNT,
|
|||
static struct bt_iso_server *iso_server;
|
||||
struct bt_conn iso_conns[CONFIG_BT_MAX_ISO_CONN];
|
||||
|
||||
/* Audio Data Path direction */
|
||||
enum {
|
||||
BT_ISO_CHAN_HOST_TO_CTRL,
|
||||
BT_ISO_CHAN_CTRL_TO_HOST,
|
||||
};
|
||||
|
||||
struct bt_iso_data_path {
|
||||
/* Data Path direction */
|
||||
|
@ -562,9 +557,9 @@ static int hci_le_setup_iso_data_path(struct bt_conn *conn,
|
|||
cp->handle = sys_cpu_to_le16(conn->handle);
|
||||
cp->path_dir = path->dir;
|
||||
cp->path_id = path->pid;
|
||||
cp->coding_format = path->path->format;
|
||||
cp->company_id = sys_cpu_to_le16(path->path->cid);
|
||||
cp->vendor_id = sys_cpu_to_le16(path->path->vid);
|
||||
cp->codec_id.coding_format = path->path->format;
|
||||
cp->codec_id.company_id = sys_cpu_to_le16(path->path->cid);
|
||||
cp->codec_id.vs_codec_id = sys_cpu_to_le16(path->path->vid);
|
||||
sys_put_le24(path->path->delay, cp->controller_delay);
|
||||
cp->codec_config_len = path->path->cc_len;
|
||||
cc = net_buf_add(buf, cp->codec_config_len);
|
||||
|
@ -655,8 +650,10 @@ static int bt_iso_setup_data_path(struct bt_conn *conn)
|
|||
int err;
|
||||
struct bt_iso_chan *chan;
|
||||
struct bt_iso_chan_path path = {};
|
||||
struct bt_iso_data_path out_path = { .dir = BT_ISO_CHAN_CTRL_TO_HOST };
|
||||
struct bt_iso_data_path in_path = { .dir = BT_ISO_CHAN_HOST_TO_CTRL };
|
||||
struct bt_iso_data_path out_path = {
|
||||
.dir = BT_HCI_DATAPATH_DIR_CTLR_TO_HOST };
|
||||
struct bt_iso_data_path in_path = {
|
||||
.dir = BT_HCI_DATAPATH_DIR_HOST_TO_CTLR };
|
||||
|
||||
chan = SYS_SLIST_PEEK_HEAD_CONTAINER(&conn->channels, chan, node);
|
||||
if (!chan) {
|
||||
|
@ -719,8 +716,8 @@ static void bt_iso_remove_data_path(struct bt_conn *conn)
|
|||
BT_DBG("%p", conn);
|
||||
|
||||
/* Remove both directions */
|
||||
hci_le_remove_iso_data_path(conn, BT_ISO_CHAN_CTRL_TO_HOST);
|
||||
hci_le_remove_iso_data_path(conn, BT_ISO_CHAN_HOST_TO_CTRL);
|
||||
hci_le_remove_iso_data_path(conn, BT_HCI_DATAPATH_DIR_CTLR_TO_HOST);
|
||||
hci_le_remove_iso_data_path(conn, BT_HCI_DATAPATH_DIR_HOST_TO_CTLR);
|
||||
}
|
||||
|
||||
void bt_iso_disconnected(struct bt_conn *conn)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue