From patchwork Wed Aug 21 14:55:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Iulia Tanasescu X-Patchwork-Id: 13771712 Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11013045.outbound.protection.outlook.com [52.101.67.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DAF3C1B1D4E for ; Wed, 21 Aug 2024 14:56:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.67.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724252203; cv=fail; b=o8mDgUwYiRnRmBY9m4FIj99kE7XXaVwJ3dZevMurlwng+ritpBtCTeQ2rk3HCmSiEJa6Vg2tVYTQ1vVEkH0kUT6mbwHLmSvX+YVyjm2/wb8/EQWnm7jzM3fxo5EE/FN6kqNUJSrnleICn0tNSWtpWL4KZRABifoFe5tG9ChzE4Y= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724252203; c=relaxed/simple; bh=Xj0iuXMp4wmKPn2xSlhixHToEFcoUPboiEoVbnGWTnk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=ZPY1AN13uvR89/Emmb6wbTVKWY3t7v/WM3pP46be3PV9xSQrDHkJLaOLiR15HFmGL+HaZxpOOm41PighLSKYHGYsY58JERJ+ZKG35eb1bjdKayaJOTAv3910Izw8Y3YAZHu0piJSQmjxbtJi1EdNyFtNndeLQuY64iFZxw27zbE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=PplJo1o3; arc=fail smtp.client-ip=52.101.67.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="PplJo1o3" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=wJMF1rhf7ejAEm3gNNGH31DesdmSZPG2eGzCW/y0q0B1HToopDZ8KB/OXpJ/nDsgR8a0OmdYTGdPE9nNjaJrK73sETlbqp0Nusb9uQdfkIvRzdExxLu+0lg9dGm6mGqClpTpVpDrAb8KgiAvWQcJFUppT7tQTYn65G8Xh4yZiVuIb+uV1eq76Ulz9dCUeOIc2GTIs3Usl53F19oU0TNjQqlLyoWeb0JJYcUbEOOA8k5NB+VTGvJVZ6vUUM2pyuk7wNtdkk7slSxjqBncTEnWHDC5EP/mOzmW8P4NVa+ReaLRsdIbWDgv4i8NVeTSS1kU2RcHXjCr81fEG1Kr2GZKmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oTUifbOiXRLSvfccmIcxkAcS1tj32YAhduDe53d0QDA=; b=W5crR2O9iDw3gltDTlCm16x9Uo+DyovLl/uEnDiQjl7oGjZ5keKjTywqK/iZeLHETM0xxvezmg2ktnES7QsKRTcWWbMeLLOFyGMzWJh/QTZK/2vn7WSoHJxd/ZOm8Xs1ZM05EwWCzXYSi6aO34MOAJL2aZcKyFM+KMufTeVoWSc4l2QgKgI8jGGUCAA4gwKDcnLK6Q3YRkjww9zlrxgTYiuN6DoILXc27B6hNkEXI+DEqtZ7SdtTx8K/oKWXxlWSmqKElbABcSOwQPsgY1FFiLNJvmOdlRuGA8EwE5MKkQinMsqJH6O0m/vCbTGJii5db/pFKso5BvySexYbxRAR5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oTUifbOiXRLSvfccmIcxkAcS1tj32YAhduDe53d0QDA=; b=PplJo1o3w7EFu6/YA+sTEIm6FGlQnjOKzrC05qBlny4cXGBbE1nBiRG5pAd5hTpk4fsPrLxIuvrXzKH7EQ9ua02K4UEQOF2Rtok+4ED/n3YzGWNwJC1ub3cKjEulen9MsN1cUZec4ABaEHgOtxqqiPd4DK/Z+w8i2EP2pOxELAQo0b5sjOnDt7mKMAk9apLQNrRu1icn7Bz+CK4vyZlJnxYPXB49Byb87RYjdmwNVXhx2UKLunG4nC9QbD2jrg8YowRAJwz+dO2Dmg0kNjGmq8mf48RXRpogf75BEA27fTkeNZMYsj0g/i/mj/e83iGaSW5CIcMxYE7G3T6ZoKX/FA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) by AS8PR04MB8753.eurprd04.prod.outlook.com (2603:10a6:20b:42c::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Wed, 21 Aug 2024 14:56:39 +0000 Received: from AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654]) by AS8PR04MB8898.eurprd04.prod.outlook.com ([fe80::5e22:869c:33c:9654%5]) with mapi id 15.20.7875.019; Wed, 21 Aug 2024 14:56:39 +0000 From: Iulia Tanasescu To: linux-bluetooth@vger.kernel.org Cc: claudia.rosu@nxp.com, mihai-octavian.urzica@nxp.com, vlad.pruteanu@nxp.com, andrei.istodorescu@nxp.com, luiz.dentz@gmail.com, Iulia Tanasescu Subject: [PATCH BlueZ 10/14] shared/bass: Add APIs to set/clear BIS sync bits Date: Wed, 21 Aug 2024 17:55:58 +0300 Message-Id: <20240821145602.92083-11-iulia.tanasescu@nxp.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240821145602.92083-1-iulia.tanasescu@nxp.com> References: <20240821145602.92083-1-iulia.tanasescu@nxp.com> X-ClientProxiedBy: AM9P250CA0006.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:21c::11) To AS8PR04MB8898.eurprd04.prod.outlook.com (2603:10a6:20b:42d::15) Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8898:EE_|AS8PR04MB8753:EE_ X-MS-Office365-Filtering-Correlation-Id: 8a1b1cf3-9aa9-4e9c-f9f8-08dcc1f17624 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|366016|1800799024; X-Microsoft-Antispam-Message-Info: pI+qsal6ifBfaWlV+9jxQaG/zgpONePGlFNjpqMGDGR2vq62llKTYq38P8g6CyT7Cm18ST1+kxSpztOkB3282nOIhyMTFQniCcmfYu0WLsQ6LZPp+vJQJiI0F4bBCTMngoApxEp59fGjrANO1stst9GR8/RE/iFAoXud/TybnFsC54gSSxHZhv27BaoiAMZC8zwhcpPcr2+mXLzL1AOSzKrH9gRwlTNmbVa/74hnIhjAN948is3MtIaqCLdVyyYMA/Zw3pjS3nC8lSGivqbdSfH6nPACyJVtS4lATXvbXLPeHqOWiLhXfKAwi07C2pBVUhqG/G+9HlvtSGx+dTih2Ax4paJ4jsEqSCGULZFptE5rR9v7wcA11CE52DHilpon7QvKgWvyQFVtjFd0V71krtHAXi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SFS:(13230040)(376014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c7U/TpCsOsQ2sLgJQfn+BuMCGXRGXf5N2pheiuiXcjj3JQkoUtb3AGwrubHDiRZ9ukNyoM76fF06WEkf7uJGxiNGQxlB9a/KzGoQk+zHwrh+cx97XaV/CajcmdTJjnpb3zm9ZJ7tp9fWtcy12ZY/9gvvkTyMKEL4mAAx8+shd2/LuEOLx0NJnNp9iaNbUwv1wHIEBwKgTFog7mwQW35bmY0o3nRUz9MWoDRVjGriBzkatnrh4OYFgy4xyvpDbVNZxAGtFgC7zvP848LWZoQioF+AqK7/LtI/lkn41te0hcOcUjq33l3yf7a4z50pr4cPWhjDhZwhEwKvp6VGKCbLOqVKm8W/YODsUp+JLX62yVzRQG8EOrfdk0/hrOByavS+EAGXul3wQI/n93u9BOLlSx7G9qNBIeW8bMpZvrusinV2A+fFzNqIHlcKKBraR0H4B3nkoS9y6oC52mAFlmWknRePCphbWW81SBmaTf/G+TlqBKEGAIEpfdmWbZF9RVum+TjYDNVkSh5EQjPu58PTUD8giw9j0W2AFJGPOahMd0x30+GsG8LujYeavpvJIikP3aw3fpXar/7cAl6hPSL/MQFqHGVVaaUq79p1EvVh2z9hd16eKLafftkyunTahjZ3qY/0bGcqHeocPaV5gvXSG/oXLm7TNufkh7jBnuCW4gqErOIz40b2GZTW8HICBsmLyi4OparWLls4ywgxX1AiCxnQTjFOagUxmnKHgpyqJhVlTxfk8sMYRZZ9A+iTbb/y0Es9Y8dTeeoQV95RnaAAeeeEVHoc8hIdxapyX3O9cqCUzJOnIGTmii71WeejWkjuwA6ZyFRxitRuCBhfXq+f5Az7VZJKjvQYvVVXoBdeJaN+mx/RI6vNKSylRAEjcVrak54FNH7v+GBnMBLNUK8RA9L6iAR8orTxw4Ru2/kgGIktyZGkXZvqWo/ZBXAzh+8O1T4CR2uhq84BsCWu19NXaa9yRqBJ5bD8GYJQcckU2IV0ZPfeva1oJ6Rkj0GgoERgk+BITTduRColksVC4wcSJS+fSeibbft2I82ZOq1PYWFa3t3TNw5SUFdqobssCZ5gVJO7mc7iL2dhjZfHckE4MMU8pKp2OxJMM4fmx6169t4MCreuLfULK32CDCrcgl9ZZi3tCwQ7SsvKMb98GXFDKXsyGf8woVFEAkXocb9kpjnA0sl0FNDMQ0Q9ujg/3uhVKle8snivmpuy3hUsictz/BXnMkCXlQTHuspG8iurpfXBRSgspdV5I9hZSdqO7gCnVZq2ozhV2AVeRvkvSsleeHbzajjbnfuFQ2aE2yXLEwXYJuMr3GlIgmm9A+PC0Y/RORaYbO+0afyeSYCwvHYvNWFxUigfw4+KRYPjdze/700QTO3wNWlPxMTdU39PLB5FIg5gc4AqVzQ1Lv2RqmS0OHCAkQ4Oia/6GERYGuV/Ww4xVhUVtLZFrPzAClgtnQeguWvra3++nWJiM+5qqrDVKnbk8vfK6zk4y9MR4oKBrWPQBK9XBS3xIP4MbQwZuMSGs8z/v3AjGag1Cxgi8CpSQi/aUO95GI3UbtQDtvaWAnImasAfoHDVsXEY9m6p7qSymFxLeM6h3SXavXdsjyDjMA== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8a1b1cf3-9aa9-4e9c-f9f8-08dcc1f17624 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8898.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 14:56:39.4064 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: aM6DbV3hZUD6CGAYJ8t1Ur1fzXW4xszDlQbo/WEaYgRW5Snjhixx1D9MVSWdUUpklSlubUXtUaBv5R91n/kBfQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8753 This adds shared/bass APIs to set/clear bits inside the BIS sync bitmask of Broadcast Receive State characteristics. Notifications are sent to the peers each time the characteristic is updated. --- src/shared/bass.c | 52 +++++++++++++++++++++++++++++++++++++++++++++++ src/shared/bass.h | 2 ++ 2 files changed, 54 insertions(+) diff --git a/src/shared/bass.c b/src/shared/bass.c index 958b6f788..8f02086a1 100644 --- a/src/shared/bass.c +++ b/src/shared/bass.c @@ -1766,3 +1766,55 @@ int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state) return 0; } + +int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) +{ + struct iovec *iov; + + for (uint8_t i = 0; i < bcast_src->num_subgroups; i++) { + struct bt_bass_subgroup_data *sgrp = + &bcast_src->subgroup_data[i]; + uint32_t bitmask = 1 << (bis - 1); + + if (sgrp->pending_bis_sync & bitmask) { + sgrp->bis_sync |= bitmask; + + iov = bass_parse_bcast_src(bcast_src); + if (!iov) + return -ENOMEM; + + bt_bass_notify_all(bcast_src->attr, iov); + + free(iov->iov_base); + free(iov); + } + } + + return 0; +} + +int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis) +{ + struct iovec *iov; + + for (uint8_t i = 0; i < bcast_src->num_subgroups; i++) { + struct bt_bass_subgroup_data *sgrp = + &bcast_src->subgroup_data[i]; + uint32_t bitmask = 1 << (bis - 1); + + if (sgrp->pending_bis_sync & bitmask) { + sgrp->bis_sync &= ~bitmask; + + iov = bass_parse_bcast_src(bcast_src); + if (!iov) + return -ENOMEM; + + bt_bass_notify_all(bcast_src->attr, iov); + + free(iov->iov_base); + free(iov); + } + } + + return 0; +} diff --git a/src/shared/bass.h b/src/shared/bass.h index a82d8f573..f3f708246 100644 --- a/src/shared/bass.h +++ b/src/shared/bass.h @@ -130,3 +130,5 @@ unsigned int bt_bass_cp_handler_register(struct bt_bass *bass, bool bt_bass_cp_handler_unregister(struct bt_bass *bass, unsigned int id); int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state); +int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis); +int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis);