Skip to content

Commit

Permalink
Bluetooth: Controller: Fix ISOAL sink create role for ISO Receiver
Browse files Browse the repository at this point in the history
Fix ISOAL sink create role for ISO Receiver.

Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
  • Loading branch information
cvinayak authored and carlescufi committed Jun 8, 2023
1 parent 242c8f1 commit 54aa6f1
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 95 deletions.
6 changes: 3 additions & 3 deletions subsys/bluetooth/controller/ll_sw/isoal.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,23 +315,23 @@ isoal_status_t isoal_sink_create(
* BIG reference anchor point +
* BIG_Sync_Delay + SDU_interval + ISO_Interval - Time_Offset.
*/
if (role == BT_CONN_ROLE_PERIPHERAL) {
if (role == ISOAL_ROLE_PERIPHERAL) {
if (framed) {
session->sdu_sync_const = stream_sync_delay + sdu_interval +
(flush_timeout * iso_interval_us);
} else {
session->sdu_sync_const = stream_sync_delay +
((flush_timeout - 1UL) * iso_interval_us);
}
} else if (role == BT_CONN_ROLE_CENTRAL) {
} else if (role == ISOAL_ROLE_CENTRAL) {
if (framed) {
session->sdu_sync_const = stream_sync_delay - group_sync_delay;
} else {
session->sdu_sync_const = stream_sync_delay - group_sync_delay -
(((iso_interval_us / sdu_interval) - 1UL) *
iso_interval_us);
}
} else if (role == BT_ROLE_BROADCAST) {
} else if (role == ISOAL_ROLE_BROADCAST_SINK) {
if (framed) {
session->sdu_sync_const = group_sync_delay + sdu_interval + iso_interval_us;
} else {
Expand Down
5 changes: 4 additions & 1 deletion subsys/bluetooth/controller/ll_sw/isoal.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ typedef uint8_t isoal_status_t;
#define ISOAL_STATUS_ERR_PDU_EMIT ((isoal_status_t) 0x20) /* PDU emission */
#define ISOAL_STATUS_ERR_UNSPECIFIED ((isoal_status_t) 0x80) /* Unspecified error */

#define BT_ROLE_BROADCAST (BT_CONN_ROLE_PERIPHERAL + 1)
#define ISOAL_ROLE_CENTRAL (BT_CONN_ROLE_CENTRAL)
#define ISOAL_ROLE_PERIPHERAL (BT_CONN_ROLE_PERIPHERAL)
#define ISOAL_ROLE_BROADCAST_SOURCE (BT_CONN_ROLE_PERIPHERAL + 1U)
#define ISOAL_ROLE_BROADCAST_SINK (BT_CONN_ROLE_PERIPHERAL + 2U)

/** Handle to a registered ISO Sub-System sink */
typedef uint8_t isoal_sink_handle_t;
Expand Down
4 changes: 2 additions & 2 deletions subsys/bluetooth/controller/ll_sw/ull_iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
adv_iso = ull_adv_iso_by_stream_get(stream_handle);
lll_iso = &adv_iso->lll;

role = 0U; /* FIXME: Set role from LLL struct */
role = ISOAL_ROLE_BROADCAST_SOURCE;
iso_interval = lll_iso->iso_interval;
sdu_interval = lll_iso->sdu_interval;
burst_number = lll_iso->bn;
Expand All @@ -329,7 +329,7 @@ uint8_t ll_setup_iso_path(uint16_t handle, uint8_t path_dir, uint8_t path_id,
sync_iso = ull_sync_iso_by_stream_get(stream_handle);
lll_iso = &sync_iso->lll;

role = 1U; /* FIXME: Is this correct role value? */
role = ISOAL_ROLE_BROADCAST_SINK;
iso_interval = lll_iso->iso_interval;
sdu_interval = lll_iso->sdu_interval;
burst_number = lll_iso->bn;
Expand Down
8 changes: 5 additions & 3 deletions tests/bluetooth/ctrl_isoal/src/isoal_test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
(s == BT_ISO_CONT ? "CONT" : \
(s == BT_ISO_END ? "END" : "???"))))

#define ROLE_TO_STR(s) (s == BT_ROLE_BROADCAST ? "Broadcast" : \
(role == BT_CONN_ROLE_PERIPHERAL ? "Peripheral" : \
(role == BT_CONN_ROLE_CENTRAL ? "Central" : "Undefined")))
#define ROLE_TO_STR(s) \
((s) == ISOAL_ROLE_BROADCAST_SOURCE ? "Broadcast Source" : \
((s) == ISOAL_ROLE_BROADCAST_SINK ? "Broadcast Sink" : \
((s) == ISOAL_ROLE_PERIPHERAL ? "Peripheral" : \
((s) == ISOAL_ROLE_CENTRAL ? "Central" : "Undefined"))))

#define FSM_TO_STR(s) (s == ISOAL_START ? "START" : \
(s == ISOAL_CONTINUE ? "CONTINUE" : \
Expand Down
Loading

0 comments on commit 54aa6f1

Please sign in to comment.