summaryrefslogtreecommitdiff
path: root/src/shared/ascs.h
blob: a409bad61681cfe5face88386353828f1f8f537a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2022  Intel Corporation. All rights reserved.
 *
 */

/* Response Status Code */
#define BT_ASCS_RSP_SUCCESS		0x00
#define BT_ASCS_RSP_NOT_SUPPORTED	0x01
#define BT_ASCS_RSP_TRUNCATED		0x02
#define BT_ASCS_RSP_INVALID_ASE		0x03
#define BT_ASCS_RSP_INVALID_ASE_STATE	0x04
#define BT_ASCS_RSP_INVALID_DIR		0x05
#define BT_ASCS_RSP_CAP_UNSUPPORTED	0x06
#define BT_ASCS_RSP_CONF_UNSUPPORTED	0x07
#define BT_ASCS_RSP_CONF_REJECTED	0x08
#define BT_ASCS_RSP_CONF_INVALID	0x09
#define BT_ASCS_RSP_METADATA_UNSUPPORTED 0x0a
#define BT_ASCS_RSP_METADATA_REJECTED	0x0b
#define BT_ASCS_RSP_METADATA_INVALID	0x0c
#define BT_ASCS_RSP_NO_MEM		0x0d
#define BT_ASCS_RSP_UNSPECIFIED		0x0e

/* Response Reasons */
#define BT_ASCS_REASON_NONE		0x00
#define BT_ASCS_REASON_CODEC		0x01
#define BT_ASCS_REASON_CODEC_DATA	0x02
#define BT_ASCS_REASON_INTERVAL		0x03
#define BT_ASCS_REASON_FRAMING		0x04
#define BT_ASCS_REASON_PHY		0x05
#define BT_ASCS_REASON_SDU		0x06
#define BT_ASCS_REASON_RTN		0x07
#define BT_ASCS_REASON_LATENCY		0x08
#define BT_ASCS_REASON_PD		0x09
#define BT_ASCS_REASON_CIS		0x0a

/* Transport QoS Packing */
#define BT_ASCS_QOS_PACKING_SEQ		0x00
#define BT_ASCS_QOS_PACKING_INT		0x01

/* Transport QoS Framing */
#define BT_ASCS_QOS_FRAMING_UNFRAMED	0x00
#define BT_ASCS_QOS_FRAMING_FRAMED	0x01

/* ASE characteristic states */
#define BT_ASCS_ASE_STATE_IDLE		0x00
#define BT_ASCS_ASE_STATE_CONFIG	0x01
#define BT_ASCS_ASE_STATE_QOS		0x02
#define BT_ASCS_ASE_STATE_ENABLING	0x03
#define BT_ASCS_ASE_STATE_STREAMING	0x04
#define BT_ASCS_ASE_STATE_DISABLING	0x05
#define BT_ASCS_ASE_STATE_RELEASING	0x06

struct bt_ascs_ase_rsp {
	uint8_t  ase;
	uint8_t  code;
	uint8_t  reason;
} __packed;

struct bt_ascs_cp_rsp {
	uint8_t  op;
	uint8_t  num_ase;
	struct bt_ascs_ase_rsp rsp[0];
} __packed;

struct bt_ascs_ase_status {
	uint8_t  id;
	uint8_t  state;
	uint8_t  params[0];
} __packed;

/* ASE_State = 0x01 (Codec Configured), defined in Table 4.7. */
struct bt_ascs_ase_status_config {
	uint8_t  framing;
	uint8_t  phy;
	uint8_t  rtn;
	uint16_t latency;
	uint8_t  pd_min[3];
	uint8_t  pd_max[3];
	uint8_t  ppd_min[3];
	uint8_t  ppd_max[3];
	struct bt_bap_codec codec;
	uint8_t  cc_len;
	/* LTV-formatted Codec-Specific Configuration */
	struct bt_ltv cc[0];
} __packed;

/* ASE_State = 0x02 (QoS Configured), defined in Table 4.8. */
struct bt_ascs_ase_status_qos {
	uint8_t  cig_id;
	uint8_t  cis_id;
	uint8_t  interval[3];
	uint8_t  framing;
	uint8_t  phy;
	uint16_t sdu;
	uint8_t  rtn;
	uint16_t latency;
	uint8_t  pd[3];
} __packed;

/* ASE_Status = 0x03 (Enabling), 0x04 (Streaming), or 0x05 (Disabling)
 * defined in Table 4.9.
 */
struct bt_ascs_ase_status_metadata {
	uint8_t  cig_id;
	uint8_t  cis_id;
	uint8_t  len;
	uint8_t  data[0];
} __packed;

struct bt_ascs_ase_hdr {
	uint8_t  op;
	uint8_t  num;
} __packed;

#define BT_ASCS_CONFIG			0x01

#define BT_ASCS_CONFIG_LATENCY_LOW	0x01
#define BT_ASCS_CONFIG_LATENCY_MEDIUM	0x02
#define BT_ASCS_CONFIG_LATENCY_HIGH	0x03

#define BT_ASCS_CONFIG_PHY_LE_1M	0x01
#define BT_ASCS_CONFIG_PHY_LE_2M	0x02
#define BT_ASCS_CONFIG_PHY_LE_CODED	0x03

struct bt_ascs_codec_config {
	uint8_t len;
	uint8_t type;
	uint8_t data[0];
} __packed;

struct bt_ascs_config {
	uint8_t  ase;			/* ASE ID */
	uint8_t  latency;		/* Target Latency */
	uint8_t  phy;			/* Target PHY */
	struct bt_bap_codec codec;	/* Codec ID */
	uint8_t  cc_len;		/* Codec Specific Config Length */
	/* LTV-formatted Codec-Specific Configuration */
	struct bt_ascs_codec_config cc[0];
} __packed;

#define BT_ASCS_QOS			0x02

struct bt_ascs_qos {
	uint8_t  ase;			/* ASE ID */
	uint8_t  cig;			/* CIG ID*/
	uint8_t  cis;			/* CIG ID*/
	uint8_t  interval[3];		/* Frame interval */
	uint8_t  framing;		/* Frame framing */
	uint8_t  phy;			/* PHY */
	uint16_t sdu;			/* Maximum SDU Size */
	uint8_t  rtn;			/* Retransmission Effort */
	uint16_t latency;		/* Transport Latency */
	uint8_t  pd[3];			/* Presentation Delay */
} __packed;

#define BT_ASCS_ENABLE			0x03

struct bt_ascs_metadata {
	uint8_t  ase;			/* ASE ID */
	uint8_t  len;			/* Metadata length */
	uint8_t  data[0];		/* LTV-formatted Metadata */
} __packed;

struct bt_ascs_enable {
	struct bt_ascs_metadata meta;	/* Metadata */
} __packed;

#define BT_ASCS_START			0x04

struct bt_ascs_start {
	uint8_t  ase;			/* ASE ID */
} __packed;

#define BT_ASCS_DISABLE			0x05

struct bt_ascs_disable {
	uint8_t  ase;			/* ASE ID */
} __packed;

#define BT_ASCS_STOP			0x06

struct bt_ascs_stop {
	uint8_t  ase;			/* ASE ID */
} __packed;

#define BT_ASCS_METADATA		0x07

#define BT_ASCS_RELEASE			0x08

struct bt_ascs_release {
	uint8_t  ase;			/* ASE ID */
} __packed;