Bluetooth: Audio: Add ISO test parameters to the BAP API
Add support for the ISO test parameters in the BAP API. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
0521ffd5a3
commit
84c01bb527
8 changed files with 153 additions and 5 deletions
|
@ -479,6 +479,31 @@ struct bt_audio_codec_qos {
|
|||
* Value range 0 to @ref BT_AUDIO_PD_MAX.
|
||||
*/
|
||||
uint32_t pd;
|
||||
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
/** @brief Maximum PDU size
|
||||
*
|
||||
* Maximum size, in octets, of the payload from link layer to link
|
||||
* layer.
|
||||
*
|
||||
* Value range @ref BT_ISO_PDU_MIN to @ref BT_ISO_PDU_MAX.
|
||||
*/
|
||||
uint16_t max_pdu;
|
||||
|
||||
/** @brief Burst number
|
||||
*
|
||||
* Value range @ref BT_ISO_BN_MIN to @ref BT_ISO_BN_MAX.
|
||||
*/
|
||||
uint8_t burst_number;
|
||||
|
||||
/** @brief Number of subevents
|
||||
*
|
||||
* Maximum number of subevents in each CIS or BIS event.
|
||||
*
|
||||
* Value range @ref BT_ISO_NSE_MIN to @ref BT_ISO_NSE_MAX.
|
||||
*/
|
||||
uint8_t num_subevents;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -1049,6 +1049,35 @@ struct bt_bap_unicast_group_param {
|
|||
* @note This is a recommendation to the controller, which the controller may ignore.
|
||||
*/
|
||||
uint8_t packing;
|
||||
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
/** @brief Central to Peripheral flush timeout
|
||||
*
|
||||
* The flush timeout in multiples of ISO_Interval for each payload sent
|
||||
* from the Central to Peripheral.
|
||||
*
|
||||
* Value range from @ref BT_ISO_FT_MIN to @ref BT_ISO_FT_MAX
|
||||
*/
|
||||
uint8_t c_to_p_ft;
|
||||
|
||||
/** @brief Peripheral to Central flush timeout
|
||||
*
|
||||
* The flush timeout in multiples of ISO_Interval for each payload sent
|
||||
* from the Peripheral to Central.
|
||||
*
|
||||
* Value range from @ref BT_ISO_FT_MIN to @ref BT_ISO_FT_MAX.
|
||||
*/
|
||||
uint8_t p_to_c_ft;
|
||||
|
||||
/** @brief ISO interval
|
||||
*
|
||||
* Time between consecutive CIS anchor points.
|
||||
*
|
||||
* Value range from @ref BT_ISO_ISO_INTERVAL_MIN to
|
||||
* @ref BT_ISO_ISO_INTERVAL_MAX.
|
||||
*/
|
||||
uint16_t iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1439,6 +1468,34 @@ struct bt_bap_broadcast_source_param {
|
|||
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
|
||||
*/
|
||||
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
|
||||
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
/** @brief Immediate Repetition Count
|
||||
*
|
||||
* The number of times the scheduled payloads are transmitted in a
|
||||
* given event.
|
||||
*
|
||||
* Value range from @ref BT_ISO_MIN_IRC to @ref BT_ISO_MAX_IRC.
|
||||
*/
|
||||
uint8_t irc;
|
||||
|
||||
/** @brief Pre-transmission offset
|
||||
*
|
||||
* Offset used for pre-transmissions.
|
||||
*
|
||||
* Value range from @ref BT_ISO_MIN_PTO to @ref BT_ISO_MAX_PTO.
|
||||
*/
|
||||
uint8_t pto;
|
||||
|
||||
/** @brief ISO interval
|
||||
*
|
||||
* Time between consecutive BIS anchor points.
|
||||
*
|
||||
* Value range from @ref BT_ISO_ISO_INTERVAL_MIN to
|
||||
* @ref BT_ISO_ISO_INTERVAL_MAX.
|
||||
*/
|
||||
uint16_t iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -393,6 +393,34 @@ struct bt_cap_initiator_broadcast_create_param {
|
|||
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
|
||||
*/
|
||||
uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE];
|
||||
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
/** @brief Immediate Repetition Count
|
||||
*
|
||||
* The number of times the scheduled payloads are transmitted in a
|
||||
* given event.
|
||||
*
|
||||
* Value range from @ref BT_ISO_MIN_IRC to @ref BT_ISO_MAX_IRC.
|
||||
*/
|
||||
uint8_t irc;
|
||||
|
||||
/** @brief Pre-transmission offset
|
||||
*
|
||||
* Offset used for pre-transmissions.
|
||||
*
|
||||
* Value range from @ref BT_ISO_MIN_PTO to @ref BT_ISO_MAX_PTO.
|
||||
*/
|
||||
uint8_t pto;
|
||||
|
||||
/** @brief ISO interval
|
||||
*
|
||||
* Time between consecutive BIS anchor points.
|
||||
*
|
||||
* Value range from @ref BT_ISO_ISO_INTERVAL_MIN to
|
||||
* @ref BT_ISO_ISO_INTERVAL_MAX.
|
||||
*/
|
||||
uint16_t iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -289,6 +289,9 @@ static int broadcast_source_setup_stream(uint8_t index, struct bt_bap_stream *st
|
|||
|
||||
bt_audio_codec_qos_to_iso_qos(iso->chan.qos->tx, qos);
|
||||
bt_audio_codec_cfg_to_iso_path(iso->chan.qos->tx->path, codec_cfg);
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
iso->chan.qos->num_subevents = qos->num_subevents;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
bt_bap_iso_unref(iso);
|
||||
|
||||
|
@ -725,6 +728,11 @@ int bt_bap_broadcast_source_create(struct bt_bap_broadcast_source_param *param,
|
|||
broadcast_source_set_state(source, BT_BAP_EP_STATE_QOS_CONFIGURED);
|
||||
source->qos = qos;
|
||||
source->packing = param->packing;
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
source->irc = param->irc;
|
||||
source->pto = param->pto;
|
||||
source->iso_interval = param->iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
source->encryption = param->encryption;
|
||||
if (source->encryption) {
|
||||
|
@ -980,6 +988,11 @@ int bt_bap_broadcast_source_start(struct bt_bap_broadcast_source *source, struct
|
|||
(void)memcpy(param.bcode, source->broadcast_code,
|
||||
sizeof(param.bcode));
|
||||
}
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
param.irc = source->irc;
|
||||
param.pto = source->pto;
|
||||
param.iso_interval = source->iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
/* Set the enabling state early in case that the BIS is connected before we can manage to
|
||||
* set it afterwards
|
||||
|
|
|
@ -83,6 +83,12 @@ struct bt_bap_broadcast_source {
|
|||
|
||||
struct bt_iso_big *big;
|
||||
struct bt_audio_codec_qos *qos;
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
/* Stored advanced parameters */
|
||||
uint8_t irc;
|
||||
uint8_t pto;
|
||||
uint16_t iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
#if CONFIG_BT_AUDIO_CODEC_CFG_MAX_DATA_SIZE > 0
|
||||
/* The codec specific configured data for each stream in the subgroup */
|
||||
|
|
|
@ -51,6 +51,10 @@ void bt_audio_codec_qos_to_iso_qos(struct bt_iso_chan_io_qos *io,
|
|||
io->sdu = codec_qos->sdu;
|
||||
io->phy = codec_qos->phy;
|
||||
io->rtn = codec_qos->rtn;
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
io->burst_number = codec_qos->burst_number;
|
||||
io->max_pdu = codec_qos->max_pdu;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
}
|
||||
#endif /* CONFIG_BT_BAP_UNICAST_CLIENT || \
|
||||
* CONFIG_BT_BAP_BROADCAST_SOURCE || \
|
||||
|
|
|
@ -2085,13 +2085,23 @@ static void unicast_client_ep_reset(struct bt_conn *conn, uint8_t reason)
|
|||
}
|
||||
|
||||
static void bt_audio_codec_qos_to_cig_param(struct bt_iso_cig_param *cig_param,
|
||||
const struct bt_audio_codec_qos *qos)
|
||||
const struct bt_audio_codec_qos *qos,
|
||||
const struct bt_bap_unicast_group_param *group_param)
|
||||
{
|
||||
cig_param->framing = qos->framing;
|
||||
cig_param->packing = BT_ISO_PACKING_SEQUENTIAL; /* TODO: Add to QoS struct */
|
||||
cig_param->interval = qos->interval;
|
||||
cig_param->latency = qos->latency;
|
||||
cig_param->sca = BT_GAP_SCA_UNKNOWN;
|
||||
|
||||
if (group_param != NULL) {
|
||||
cig_param->packing = group_param->packing;
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
cig_param->c_to_p_ft = group_param->c_to_p_ft;
|
||||
cig_param->p_to_c_ft = group_param->p_to_c_ft;
|
||||
cig_param->iso_interval = group_param->iso_interval;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
}
|
||||
}
|
||||
|
||||
/* FIXME: Remove `qos` parameter. Some of the QoS related CIG can be different
|
||||
|
@ -2099,7 +2109,8 @@ static void bt_audio_codec_qos_to_cig_param(struct bt_iso_cig_param *cig_param,
|
|||
* unicast_group instead.
|
||||
*/
|
||||
static int bt_audio_cig_create(struct bt_bap_unicast_group *group,
|
||||
const struct bt_audio_codec_qos *qos)
|
||||
const struct bt_audio_codec_qos *qos,
|
||||
const struct bt_bap_unicast_group_param *group_param)
|
||||
{
|
||||
struct bt_iso_cig_param param;
|
||||
uint8_t cis_count;
|
||||
|
@ -2119,7 +2130,7 @@ static int bt_audio_cig_create(struct bt_bap_unicast_group *group,
|
|||
|
||||
param.num_cis = cis_count;
|
||||
param.cis_channels = group->cis;
|
||||
bt_audio_codec_qos_to_cig_param(¶m, qos);
|
||||
bt_audio_codec_qos_to_cig_param(¶m, qos, group_param);
|
||||
|
||||
err = bt_iso_cig_create(¶m, &group->cig);
|
||||
if (err != 0) {
|
||||
|
@ -2153,7 +2164,7 @@ static int bt_audio_cig_reconfigure(struct bt_bap_unicast_group *group,
|
|||
|
||||
param.num_cis = cis_count;
|
||||
param.cis_channels = group->cis;
|
||||
bt_audio_codec_qos_to_cig_param(¶m, qos);
|
||||
bt_audio_codec_qos_to_cig_param(¶m, qos, NULL);
|
||||
|
||||
err = bt_iso_cig_reconfigure(group->cig, ¶m);
|
||||
if (err != 0) {
|
||||
|
@ -2301,6 +2312,9 @@ static void unicast_client_codec_qos_to_iso_qos(struct bt_bap_iso *iso,
|
|||
}
|
||||
|
||||
bt_audio_codec_qos_to_iso_qos(io_qos, qos);
|
||||
#if defined(CONFIG_BT_ISO_TEST_PARAMS)
|
||||
iso->chan.qos->num_subevents = qos->num_subevents;
|
||||
#endif /* CONFIG_BT_ISO_TEST_PARAMS */
|
||||
|
||||
if (other_io_qos != NULL) {
|
||||
/* If the opposing ASE of the CIS is not yet configured, we
|
||||
|
@ -2591,7 +2605,7 @@ int bt_bap_unicast_group_create(struct bt_bap_unicast_group_param *param,
|
|||
}
|
||||
}
|
||||
|
||||
err = bt_audio_cig_create(unicast_group, group_qos);
|
||||
err = bt_audio_cig_create(unicast_group, group_qos, param);
|
||||
if (err != 0) {
|
||||
LOG_DBG("bt_audio_cig_create failed: %d", err);
|
||||
unicast_group_free(unicast_group);
|
||||
|
|
|
@ -46,6 +46,7 @@ CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y
|
|||
|
||||
# Support an ISO channel per ASE
|
||||
CONFIG_BT_ISO_MAX_CHAN=4
|
||||
CONFIG_BT_ISO_TEST_PARAMS=y
|
||||
CONFIG_BT_ISO_TX_BUF_COUNT=10
|
||||
CONFIG_BT_ISO_RX_BUF_COUNT=20
|
||||
CONFIG_BT_ISO_TX_MTU=310
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue