Bluetooth: Controller: Add LL_CIS_HANDLE_LAST, IDX_FROM_HANDLE define

Rename LAST_VALID_CIS_HANDLE to LL_CIS_HANDLE_LAST, to be
consistent naming with LL_CIS_HANDLE_BASE.
Add IDX_FROM_HANDLE defines.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2022-11-02 12:49:09 +05:30 committed by Stephanos Ioannidis
parent 8e48de8f58
commit 5398ae0710
3 changed files with 10 additions and 14 deletions

View File

@ -227,7 +227,7 @@ struct ll_conn_iso_stream *ll_conn_iso_stream_get_by_group(struct ll_conn_iso_gr
handle_start = (handle_iter == NULL) || ((*handle_iter) == UINT16_MAX) ?
LL_CIS_HANDLE_BASE : (*handle_iter) + 1;
for (handle = handle_start; handle <= LAST_VALID_CIS_HANDLE; handle++) {
for (handle = handle_start; handle <= LL_CIS_HANDLE_LAST; handle++) {
cis = ll_conn_iso_stream_get(handle);
if (cis->group == cig) {
if (handle_iter) {
@ -557,7 +557,8 @@ static int init_reset(void)
cig->lll.num_cis = 0;
}
for (handle = LL_CIS_HANDLE_BASE; handle <= LAST_VALID_CIS_HANDLE; handle++) {
for (handle = LL_CIS_HANDLE_BASE; handle <= LL_CIS_HANDLE_LAST;
handle++) {
cis = ll_conn_iso_stream_get(handle);
cis->cis_id = 0;
cis->group = NULL;

View File

@ -28,26 +28,20 @@
((conn_handle) <= ((LL_BIS_SYNC_HANDLE_BASE) + \
(BT_CTLR_SYNC_ISO_STREAM_MAX) - 1U)))
#else
#define LL_BIS_SYNC_IDX_FROM_HANDLE(conn_handle) 0U
#define IS_SYNC_ISO_HANDLE(conn_handle) 0U
#endif /* CONFIG_BT_CTLR_SYNC_ISO */
/* CIS */
#if defined(CONFIG_BT_CTLR_CONN_ISO)
#define LL_CIS_HANDLE_BASE (BT_CTLR_CONN_ISO_STREAM_HANDLE_BASE)
#if defined(CONFIG_BT_CTLR_CONN_ISO_STREAMS)
#define LAST_VALID_CIS_HANDLE \
(CONFIG_BT_CTLR_CONN_ISO_STREAMS + LL_CIS_HANDLE_BASE - 1)
#else
#define LAST_VALID_CIS_HANDLE (LL_CIS_HANDLE_BASE - 1)
#endif /* CONFIG_BT_CTLR_CONN_ISO_STREAMS */
#define LL_CIS_IDX_FROM_HANDLE(_handle) \
((_handle) - LL_CIS_HANDLE_BASE)
#if defined(CONFIG_BT_CTLR_CONN_ISO)
#define LL_CIS_HANDLE_LAST \
(CONFIG_BT_CTLR_CONN_ISO_STREAMS + LL_CIS_HANDLE_BASE - 1)
#define IS_CIS_HANDLE(_handle) \
(((_handle) >= LL_CIS_HANDLE_BASE) && \
((_handle) <= LAST_VALID_CIS_HANDLE))
((_handle) <= LL_CIS_HANDLE_LAST))
#else
#define IS_CIS_HANDLE(_handle) 0
#endif /* CONFIG_BT_CTLR_CONN_ISO */

View File

@ -218,7 +218,8 @@ uint8_t ull_peripheral_iso_acquire(struct ll_conn *acl,
return BT_HCI_ERR_INSUFFICIENT_RESOURCES;
}
for (handle = LL_CIS_HANDLE_BASE; handle <= LAST_VALID_CIS_HANDLE; handle++) {
for (handle = LL_CIS_HANDLE_BASE; handle <= LL_CIS_HANDLE_LAST;
handle++) {
cis = ll_iso_stream_connected_get(handle);
if (cis && cis->group && cis->cis_id == req->cis_id) {
/* CIS ID already in use */