1#!/usr/bin/env bash
2# Copyright 2024 Nordic Semiconductor ASA
3# SPDX-License-Identifier: Apache-2.0
4
5source ${ZEPHYR_BASE}/tests/bsim/sh_common.source
6
7# Basic connection test: a central connects to a peripheral and expects a
8# notification, using the split controller (ULL LLL)
9# Both central and peripheral hosts have their controllers in a separate device
10# connected over UART. The controller is the HCI UART sample.
11simulation_id="basic_conn_split_hci_uart"
12verbosity_level=2
13
14cd ${BSIM_OUT_PATH}/bin
15
16UART_DIR=/tmp/bs_${USER}/${simulation_id}/
17UART_PER=${UART_DIR}/peripheral
18UART_CEN=${UART_DIR}/central
19
20# Note the host+app devices are NOT connected to the phy, only the controllers are.
21
22# Peripheral app + host :
23Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_hci_uart_conf \
24  -v=${verbosity_level} -s=${simulation_id} -d=10 -nosim -RealEncryption=0 \
25  -testid=peripheral -rs=23 -uart1_fifob_rxfile=${UART_PER}.rx -uart1_fifob_txfile=${UART_PER}.tx
26
27# Peripheral controller:
28Execute ./bs_${BOARD_TS}_samples_bluetooth_hci_uart_prj_conf \
29  -v=${verbosity_level} -s=${simulation_id} -d=0 -RealEncryption=0 \
30  -rs=23 -uart1_fifob_rxfile=${UART_PER}.tx -uart1_fifob_txfile=${UART_PER}.rx \
31
32# Central app + host
33Execute ./bs_${BOARD_TS}_tests_bsim_bluetooth_ll_conn_prj_split_hci_uart_conf\
34  -v=${verbosity_level} -s=${simulation_id} -d=11 -nosim -RealEncryption=0 \
35  -testid=central -rs=6 -uart1_fifob_rxfile=${UART_CEN}.rx -uart1_fifob_txfile=${UART_CEN}.tx
36
37# Central controller:
38Execute ./bs_${BOARD_TS}_samples_bluetooth_hci_uart_prj_conf \
39  -v=${verbosity_level} -s=${simulation_id} -d=1 -RealEncryption=0 \
40  -rs=23 -uart1_fifob_rxfile=${UART_CEN}.tx -uart1_fifob_txfile=${UART_CEN}.rx
41
42Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} \
43  -D=2 -sim_length=20e6 $@
44
45wait_for_background_jobs
46