Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bluetooth: ISO advanced qos #53945

Merged
merged 7 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
132 changes: 131 additions & 1 deletion include/zephyr/bluetooth/iso.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ extern "C" {
#define BT_ISO_SDU_INTERVAL_MIN 0x0000FFU
/** Maximum interval value in microseconds */
#define BT_ISO_SDU_INTERVAL_MAX 0x0FFFFFU
/** Minimum ISO interval (N * 1.25 ms) */
#define BT_ISO_ISO_INTERVAL_MIN 0x0004U
/** Maximum ISO interval (N * 1.25 ms) */
#define BT_ISO_ISO_INTERVAL_MAX 0x0C80U
/** Minimum latency value in milliseconds */
#define BT_ISO_LATENCY_MIN 0x0005
/** Maximum latency value in milliseconds */
Expand All @@ -63,8 +67,28 @@ extern "C" {
#define BT_ISO_FRAMING_FRAMED 0x01
/** Maximum number of isochronous channels in a single group */
#define BT_ISO_MAX_GROUP_ISO_COUNT 0x1F
/** Minimum SDU size */
#define BT_ISO_MIN_SDU 0x0001
/** Maximum SDU size */
#define BT_ISO_MAX_SDU 0x0FFF
/** Minimum PDU size */
#define BT_ISO_CONNECTED_PDU_MIN 0x0000U
/** Minimum PDU size */
#define BT_ISO_BROADCAST_PDU_MIN 0x0001U
/** Maximum PDU size */
#define BT_ISO_PDU_MAX 0x00FBU
/** Minimum burst number */
#define BT_ISO_BN_MIN 0x01U
/** Maximum burst number */
#define BT_ISO_BN_MAX 0x0FU
/** Minimum flush timeout */
#define BT_ISO_FT_MIN 0x01U
/** Maximum flush timeout */
#define BT_ISO_FT_MAX 0xFFU
/** Minimum number of subevents */
#define BT_ISO_NSE_MIN 0x01U
/** Maximum number of subevents */
#define BT_ISO_NSE_MAX 0x1FU
/** Minimum BIG sync timeout value (N * 10 ms) */
#define BT_ISO_SYNC_TIMEOUT_MIN 0x000A
/** Maximum BIG sync timeout value (N * 10 ms) */
Expand All @@ -85,6 +109,16 @@ extern "C" {
#define BT_ISO_BIS_INDEX_MIN 0x01
/** Highest BIS index */
#define BT_ISO_BIS_INDEX_MAX 0x1F
/** Minimum Immediate Repetition Count */
#define BT_ISO_IRC_MIN 0x01U
/** Maximum Immediate Repetition Count */
#define BT_ISO_IRC_MAX 0x0FU
/** Minimum pre-transmission offset */
#define BT_ISO_PTO_MIN 0x00U
/** Maximum pre-transmission offset */
#define BT_ISO_PTO_MAX 0x0FU


/** Omit time stamp when sending to controller
*
* Using this value will enqueue the ISO SDU in a FIFO manner, instead of
Expand Down Expand Up @@ -148,14 +182,38 @@ struct bt_iso_chan_io_qos {
* Setting BT_GAP_LE_PHY_NONE is invalid.
*/
uint8_t phy;
/** Channel Retransmission Number. */
/** @brief Channel Retransmission Number.
*
* This value is ignored if any advanced ISO parameters are set.
*/
uint8_t rtn;
/** @brief Channel data path reference
*
* Setting to NULL default to HCI data path (same as setting path.pid
* to BT_ISO_DATA_PATH_HCI).
*/
struct bt_iso_chan_path *path;

#if defined(CONFIG_BT_ISO_ADVANCED)
/** @brief Maximum PDU size
*
* Maximum size, in octets, of the payload from link layer to link
* layer.
*
* Value range @ref BT_ISO_CONNECTED_PDU_MIN to @ref BT_ISO_PDU_MAX for
* connected ISO.
*
* Value range @ref BT_ISO_BROADCAST_PDU_MIN to @ref BT_ISO_PDU_MAX for
* broadcast ISO.
*/
uint16_t max_pdu;

/** @brief Burst number
*
* Value range @ref BT_ISO_BN_MIN to @ref BT_ISO_BN_MAX.
*/
uint8_t burst_number;
#endif /* CONFIG_BT_ISO_ADVANCED */
};

/** @brief ISO Channel QoS structure. */
Expand All @@ -176,6 +234,16 @@ struct bt_iso_chan_qos {
* isochronous transmitter.
*/
struct bt_iso_chan_io_qos *tx;

#if defined(CONFIG_BT_ISO_ADVANCED)
/** @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_ADVANCED */
};

/** @brief ISO Channel Data Path structure. */
Expand Down Expand Up @@ -269,6 +337,8 @@ struct bt_iso_cig_param {
/** @brief Channel Latency in ms.
*
* Value range BT_ISO_LATENCY_MIN - BT_ISO_LATENCY_MAX.
*
* This value is ignored if any advanced ISO parameters are set.
*/
uint16_t latency;

Expand All @@ -293,6 +363,36 @@ struct bt_iso_cig_param {
* BT_ISO_FRAMING_FRAMED for framed.
*/
uint8_t framing;

#if defined(CONFIG_BT_ISO_ADVANCED)
/** @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_ADVANCED */

};

struct bt_iso_connect_param {
Expand Down Expand Up @@ -326,6 +426,8 @@ struct bt_iso_big_create_param {
/** @brief Channel Latency in ms.
*
* Value range BT_ISO_LATENCY_MIN - BT_ISO_LATENCY_MAX.
*
* This value is ignored if any advanced ISO parameters are set.
*/
uint16_t latency;

Expand Down Expand Up @@ -358,6 +460,34 @@ struct bt_iso_big_create_param {
* [42 72 6F 61 64 63 61 73 74 20 43 6F 64 65 00 00]
*/
uint8_t bcode[BT_ISO_BROADCAST_CODE_SIZE];

#if defined(CONFIG_BT_ISO_ADVANCED)
/** @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_ADVANCED */
};

struct bt_iso_big_sync_param {
Expand Down