1 /* 2 * Copyright (c) 2024 Nordic Semiconductor ASA 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * This file provides a synchronization mechanism between devices, for the 7 * simple use-case when there are only two devices in the simulation. 8 */ 9 10 11 /* 12 * @brief Initialize the sync library 13 * 14 * This initializes a simple synchronization library based on bsim backchannels. 15 * 16 * Calling `bk_sync_wait()` on device A will make it block until 17 * `bk_sync_send()` is called on device B. 18 * 19 * @note Only works between two devices in a simulation, with IDs 0 and 1. 20 * 21 * @retval 0 Sync channel operational 22 * @retval -1 Failed to open sync channel 23 * 24 */ 25 int bk_sync_init(void); 26 27 /* 28 * @brief Send a synchronization packet 29 * 30 * @note Only works between two devices in a simulation, with IDs 0 and 1. 31 * 32 */ 33 void bk_sync_send(void); 34 35 /* 36 * @brief Wait for a synchronization packet 37 * 38 * This blocks until the other device has called `bk_sync_send()`. 39 * 40 * @note Only works between two devices in a simulation, with IDs 0 and 1. 41 * 42 */ 43 void bk_sync_wait(void); 44