Skip to content

Commit

Permalink
tests: nrf_auraconfig: Create tester
Browse files Browse the repository at this point in the history
- Use generic broadcast_sink sample from Zephyr as base
- Add a struct to contain all values to compare
- Store adv_name and broadcast_name
- Parse BASEs and populate struct
- Add shell interface for setting expected values
- Create function for comparing dut with expected
- Compare all values and print success or fail
- Add BSIM related files
- OCT-3162

tests: nrf_auraconfig: Integrate with BSIM

- Create a tester main for the nrf_auraconfig sample
- Parse arguments and send to correct device
- Add log level to le_audio_tx to suppress warnings
- OCT-3193

Signed-off-by: Alexander Svensen <[email protected]>
  • Loading branch information
alexsven committed Nov 19, 2024
1 parent 12a253c commit 0e7d1e9
Show file tree
Hide file tree
Showing 33 changed files with 4,972 additions and 2,807 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@
/tests/benchmarks/multicore/idle/ @adamkondraciuk @nrfconnect/ncs-low-level-test
/tests/benchmarks/multicore/idle_gpio/ @adamkondraciuk @nrfconnect/ncs-low-level-test
/tests/bluetooth/iso/ @nrfconnect/ncs-audio @Frodevan
/tests/bluetooth/bsim/nrf_auraconfig/ @nrfconnect/ncs-audio
/tests/bluetooth/tester/ @carlescufi @nrfconnect/ncs-paladin
/tests/crypto/ @stephen-nordic @magnev
/tests/drivers/gpio/egpio_basic_api/ @nrfconnect/ncs-ll-ursus
Expand Down
5 changes: 5 additions & 0 deletions applications/nrf5340_audio/src/audio/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ config SW_CODEC_LC3
help
LC3 is the mandatory codec for LE Audio.

config SW_CODEC_NONE
bool "None"
help
Choose this if no software (SW) codec is needed.

# Leave room for other codecs
endchoice

Expand Down
4 changes: 4 additions & 0 deletions applications/nrf5340_audio/src/bluetooth/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ module = BLE
module-str = ble
source "subsys/logging/Kconfig.template.log_config"

module = BT_LE_AUDIO_TX
module-str = bt_le_audio_tx
source "subsys/logging/Kconfig.template.log_config"

endmenu # Log levels

#----------------------------------------------------------------------------#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <zephyr/bluetooth/hci.h>
#include <zephyr/settings/settings.h>
#include <zephyr/sys/byteorder.h>
#include <nrfx.h>

#include "macros_common.h"
#include "zbus_common.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "audio_sync_timer.h"

#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(bt_le_audio_tx, CONFIG_BLE_LOG_LEVEL);
LOG_MODULE_REGISTER(bt_le_audio_tx, CONFIG_BT_LE_AUDIO_TX_LOG_LEVEL);

ZBUS_CHAN_DEFINE(sdu_ref_chan, struct sdu_ref_msg, NULL, NULL, ZBUS_OBSERVERS_EMPTY,
ZBUS_MSG_INIT(0));
Expand Down
2 changes: 1 addition & 1 deletion applications/nrf5340_audio/src/modules/audio_sync_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static int audio_sync_timer_init(void)
return -ENODEV;
}

IRQ_CONNECT(RTC0_IRQn, IRQ_PRIO_LOWEST, nrfx_rtc_0_irq_handler, NULL, 0);
IRQ_CONNECT(RTC0_IRQn, IRQ_PRIO_LOWEST, nrfx_isr, nrfx_rtc_0_irq_handler, 0);
nrfx_rtc_overflow_enable(&audio_sync_lf_timer_instance, true);

/* Initialize capturing of I2S frame start event timestamps */
Expand Down
167 changes: 2 additions & 165 deletions samples/bluetooth/nrf_auraconfig/include/nrf_auraconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,170 +7,7 @@
#ifndef _NRF_AURACONFIG_H_
#define _NRF_AURACONFIG_H_

#include <zephyr/bluetooth/audio/audio.h>
#include <zephyr/bluetooth/audio/bap_lc3_preset.h>

#define PRESET_NAME_MAX 8
#define LANGUAGE_LEN 3

/* The location and context type will be set by further down */
/* Low latency settings */
static struct bt_bap_lc3_preset lc3_preset_8_1_1 =
BT_BAP_LC3_BROADCAST_PRESET_8_1_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_8_2_1 =
BT_BAP_LC3_BROADCAST_PRESET_8_2_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_16_1_1 =
BT_BAP_LC3_BROADCAST_PRESET_16_1_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_16_2_1 =
BT_BAP_LC3_BROADCAST_PRESET_16_2_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_24_1_1 =
BT_BAP_LC3_BROADCAST_PRESET_24_1_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_24_2_1 =
BT_BAP_LC3_BROADCAST_PRESET_24_2_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_32_1_1 =
BT_BAP_LC3_BROADCAST_PRESET_32_1_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_32_2_1 =
BT_BAP_LC3_BROADCAST_PRESET_32_2_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_1_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_1_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_2_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_2_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_3_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_3_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_4_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_4_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_5_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_5_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_6_1 =
BT_BAP_LC3_BROADCAST_PRESET_48_6_1(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
/* High reliability settings */
static struct bt_bap_lc3_preset lc3_preset_8_1_2 =
BT_BAP_LC3_BROADCAST_PRESET_8_1_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_8_2_2 =
BT_BAP_LC3_BROADCAST_PRESET_8_2_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_16_1_2 =
BT_BAP_LC3_BROADCAST_PRESET_16_1_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_16_2_2 =
BT_BAP_LC3_BROADCAST_PRESET_16_2_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_24_1_2 =
BT_BAP_LC3_BROADCAST_PRESET_24_1_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_24_2_2 =
BT_BAP_LC3_BROADCAST_PRESET_24_2_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_32_1_2 =
BT_BAP_LC3_BROADCAST_PRESET_32_1_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_32_2_2 =
BT_BAP_LC3_BROADCAST_PRESET_32_2_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_1_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_1_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_2_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_2_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_3_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_3_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_4_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_4_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_5_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_5_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);
static struct bt_bap_lc3_preset lc3_preset_48_6_2 =
BT_BAP_LC3_BROADCAST_PRESET_48_6_2(BT_AUDIO_LOCATION_MONO_AUDIO, BT_AUDIO_CONTEXT_TYPE_ANY);

struct bap_preset {
struct bt_bap_lc3_preset *preset;
char name[PRESET_NAME_MAX];
};

static struct bap_preset bap_presets[] = {
{.preset = &lc3_preset_8_1_1, .name = "8_1_1"},
{.preset = &lc3_preset_8_2_1, .name = "8_2_1"},
{.preset = &lc3_preset_16_1_1, .name = "16_1_1"},
{.preset = &lc3_preset_16_2_1, .name = "16_2_1"},
{.preset = &lc3_preset_24_1_1, .name = "24_1_1"},
{.preset = &lc3_preset_24_2_1, .name = "24_2_1"},
{.preset = &lc3_preset_32_1_1, .name = "32_1_1"},
{.preset = &lc3_preset_32_2_1, .name = "32_2_1"},
{.preset = &lc3_preset_48_1_1, .name = "48_1_1"},
{.preset = &lc3_preset_48_2_1, .name = "48_2_1"},
{.preset = &lc3_preset_48_3_1, .name = "48_3_1"},
{.preset = &lc3_preset_48_4_1, .name = "48_4_1"},
{.preset = &lc3_preset_48_5_1, .name = "48_5_1"},
{.preset = &lc3_preset_48_6_1, .name = "48_6_1"},
{.preset = &lc3_preset_8_1_2, .name = "8_1_2"},
{.preset = &lc3_preset_8_2_2, .name = "8_2_2"},
{.preset = &lc3_preset_16_1_2, .name = "16_1_2"},
{.preset = &lc3_preset_16_2_2, .name = "16_2_2"},
{.preset = &lc3_preset_24_1_2, .name = "24_1_2"},
{.preset = &lc3_preset_24_2_2, .name = "24_2_2"},
{.preset = &lc3_preset_32_1_2, .name = "32_1_2"},
{.preset = &lc3_preset_32_2_2, .name = "32_2_2"},
{.preset = &lc3_preset_48_1_2, .name = "48_1_2"},
{.preset = &lc3_preset_48_2_2, .name = "48_2_2"},
{.preset = &lc3_preset_48_3_2, .name = "48_3_2"},
{.preset = &lc3_preset_48_4_2, .name = "48_4_2"},
{.preset = &lc3_preset_48_5_2, .name = "48_5_2"},
{.preset = &lc3_preset_48_6_2, .name = "48_6_2"},
};

#define LOCATION_NAME_LEN_MAX 4
struct audio_location {
enum bt_audio_location location;
char name[LOCATION_NAME_LEN_MAX + 1];
};

/* Note: If there is any change to the specification of audio
* locations then this structure must be checked for conformance.
*/
static struct audio_location locations[] = {
{.location = BT_AUDIO_LOCATION_MONO_AUDIO, .name = "MA"},
{.location = BT_AUDIO_LOCATION_FRONT_LEFT, .name = "FL"},
{.location = BT_AUDIO_LOCATION_FRONT_RIGHT, .name = "FR"},
{.location = BT_AUDIO_LOCATION_FRONT_CENTER, .name = "FC"},
{.location = BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_1, .name = "LFE1"},
{.location = BT_AUDIO_LOCATION_BACK_LEFT, .name = "BL"},
{.location = BT_AUDIO_LOCATION_BACK_RIGHT, .name = "BR"},
{.location = BT_AUDIO_LOCATION_FRONT_LEFT_OF_CENTER, .name = "FLC"},
{.location = BT_AUDIO_LOCATION_FRONT_RIGHT_OF_CENTER, .name = "FRC"},
{.location = BT_AUDIO_LOCATION_BACK_CENTER, .name = "BC"},
{.location = BT_AUDIO_LOCATION_LOW_FREQ_EFFECTS_2, .name = "LFE2"},
{.location = BT_AUDIO_LOCATION_SIDE_LEFT, .name = "SL"},
{.location = BT_AUDIO_LOCATION_SIDE_RIGHT, .name = "SR"},
{.location = BT_AUDIO_LOCATION_TOP_FRONT_LEFT, .name = "TFL"},
{.location = BT_AUDIO_LOCATION_TOP_FRONT_RIGHT, .name = "TFR"},
{.location = BT_AUDIO_LOCATION_TOP_FRONT_CENTER, .name = "TFC"},
{.location = BT_AUDIO_LOCATION_TOP_CENTER, .name = "TC"},
{.location = BT_AUDIO_LOCATION_TOP_BACK_LEFT, .name = "TBL"},
{.location = BT_AUDIO_LOCATION_TOP_BACK_RIGHT, .name = "TBR"},
{.location = BT_AUDIO_LOCATION_TOP_SIDE_LEFT, .name = "TSL"},
{.location = BT_AUDIO_LOCATION_TOP_SIDE_RIGHT, .name = "TSR"},
{.location = BT_AUDIO_LOCATION_TOP_BACK_CENTER, .name = "TBC"},
{.location = BT_AUDIO_LOCATION_BOTTOM_FRONT_CENTER, .name = "BFC"},
{.location = BT_AUDIO_LOCATION_BOTTOM_FRONT_LEFT, .name = "BFL"},
{.location = BT_AUDIO_LOCATION_BOTTOM_FRONT_RIGHT, .name = "BFR"},
{.location = BT_AUDIO_LOCATION_FRONT_LEFT_WIDE, .name = "FLW"},
{.location = BT_AUDIO_LOCATION_FRONT_RIGHT_WIDE, .name = "FRW"},
{.location = BT_AUDIO_LOCATION_LEFT_SURROUND, .name = "LS"},
{.location = BT_AUDIO_LOCATION_RIGHT_SURROUND, .name = "RS"},
};

enum usecase_type {
LECTURE,
SILENT_TV_1,
SILENT_TV_2,
MULTI_LANGUAGE,
PERSONAL_SHARING,
PERSONAL_MULTI_LANGUAGE,
};

struct usecase_info {
enum usecase_type use_case;
char name[40];
};

static struct usecase_info pre_defined_use_cases[] = {
{.use_case = LECTURE, .name = "Lecture"},
{.use_case = SILENT_TV_1, .name = "Silent TV 1"},
{.use_case = SILENT_TV_2, .name = "Silent TV 2"},
{.use_case = MULTI_LANGUAGE, .name = "Multi-language"},
{.use_case = PERSONAL_SHARING, .name = "Personal sharing"},
{.use_case = PERSONAL_MULTI_LANGUAGE, .name = "Personal multi-language"},
};
/* Main function */
void nrf_auraconfig_main(void);

#endif /* _NRF_AURACONFIG_H_ */
Loading

0 comments on commit 0e7d1e9

Please sign in to comment.