diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index f98dcec769f..4842a9be7dd 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -2354,7 +2354,7 @@ West: labels: - manifest-libmetal -"West project: liblc3codec": +"West project: liblc3": status: maintained maintainers: - Casper-Bonde-Bose @@ -2363,9 +2363,9 @@ West: - thalley - asbjornsabo files: - - modules/liblc3codec/ + - modules/liblc3/ labels: - - manifest-liblc3codec + - manifest-liblc3 "West project: littlefs": status: odd fixes diff --git a/modules/Kconfig b/modules/Kconfig index 35ff70daa09..220f2d657ad 100644 --- a/modules/Kconfig +++ b/modules/Kconfig @@ -54,8 +54,8 @@ comment "hal_gigadevice module not available." comment "hal_nordic module not available." depends on !ZEPHYR_HAL_NORDIC_MODULE -comment "liblc3codec module not available." - depends on !ZEPHYR_LIBLC3CODEC_MODULE +comment "liblc3 module not available." + depends on !ZEPHYR_LIBLC3_MODULE comment "LittleFS module not available." depends on !ZEPHYR_LITTLEFS_MODULE diff --git a/modules/liblc3/CMakeLists.txt b/modules/liblc3/CMakeLists.txt new file mode 100644 index 00000000000..1a662866d12 --- /dev/null +++ b/modules/liblc3/CMakeLists.txt @@ -0,0 +1,22 @@ +if(CONFIG_LIBLC3) + +zephyr_library_named(liblc3) +zephyr_library_compile_options(-O3 -std=c11 -ffast-math -Wno-array-bounds) + +zephyr_include_directories(${ZEPHYR_LIBLC3_MODULE_DIR}/include) +zephyr_include_directories(${ZEPHYR_LIBLC3_MODULE_DIR}/src) + +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/attdet.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/bits.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/bwdet.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/energy.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/lc3.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/ltpf.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/mdct.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/plc.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/sns.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/spec.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/tables.c) +zephyr_library_sources(${ZEPHYR_LIBLC3_MODULE_DIR}/src/tns.c) + +endif() diff --git a/modules/liblc3/Kconfig b/modules/liblc3/Kconfig new file mode 100644 index 00000000000..4123d12c6e7 --- /dev/null +++ b/modules/liblc3/Kconfig @@ -0,0 +1,8 @@ +# Copyright (c) 2022 Bose Corporation +# SPDX-License-Identifier: Apache-2.0 + +config LIBLC3 + bool "liblc3 Support" + depends on FPU + help + This option enables the Android liblc3 library for Bluetooth LE Audio diff --git a/modules/liblc3codec/CMakeLists.txt b/modules/liblc3codec/CMakeLists.txt deleted file mode 100644 index a0c5d88102b..00000000000 --- a/modules/liblc3codec/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -if(CONFIG_LIBLC3CODEC) - -zephyr_library_named(liblc3codec) -zephyr_library_compile_options(-O3 -std=c11 -ffast-math -Wno-array-bounds) - -zephyr_include_directories(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/include) -zephyr_include_directories(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src) - -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/attdet.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/bits.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/bwdet.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/energy.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/lc3.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/ltpf.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/mdct.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/plc.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/sns.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/spec.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/tables.c) -zephyr_library_sources(${ZEPHYR_LIBLC3CODEC_MODULE_DIR}/src/tns.c) - -endif() diff --git a/modules/liblc3codec/Kconfig b/modules/liblc3codec/Kconfig deleted file mode 100644 index ff611dba169..00000000000 --- a/modules/liblc3codec/Kconfig +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2022 Bose Corporation -# SPDX-License-Identifier: Apache-2.0 - -config LIBLC3CODEC - bool "liblc3codec Support" - depends on FPU - help - This option enables the Android liblc3codec library for Bluetooth LE Audio diff --git a/samples/bluetooth/unicast_audio_client/boards/native_posix.conf b/samples/bluetooth/unicast_audio_client/boards/native_posix.conf index a3327360031..3d06b9f321f 100644 --- a/samples/bluetooth/unicast_audio_client/boards/native_posix.conf +++ b/samples/bluetooth/unicast_audio_client/boards/native_posix.conf @@ -1,7 +1,7 @@ CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_BT_TINYCRYPT_ECC=y -CONFIG_LIBLC3CODEC=y +CONFIG_LIBLC3=y CONFIG_FPU=y # For LE-audio at 10ms intervals we need the tick counter to occur more frequently diff --git a/samples/bluetooth/unicast_audio_client/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/bluetooth/unicast_audio_client/boards/nrf5340dk_nrf5340_cpuapp.conf index 603c9d9fb92..f7c6bbfd3db 100644 --- a/samples/bluetooth/unicast_audio_client/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/samples/bluetooth/unicast_audio_client/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -1,6 +1,6 @@ # For LC3 the following configs are needed CONFIG_FPU=y -CONFIG_LIBLC3CODEC=y +CONFIG_LIBLC3=y # The LC3 codec uses a large amount of stack. This app runs the codec in the work-queue, hence # inctease stack size for that thread. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 diff --git a/samples/bluetooth/unicast_audio_client/src/main.c b/samples/bluetooth/unicast_audio_client/src/main.c index 008f89c450f..d6d89ec09be 100644 --- a/samples/bluetooth/unicast_audio_client/src/main.c +++ b/samples/bluetooth/unicast_audio_client/src/main.c @@ -68,7 +68,7 @@ static uint32_t get_and_incr_seq_num(const struct bt_audio_stream *stream) return 0; } -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) #include "lc3.h" #include "math.h" @@ -752,7 +752,7 @@ static int init(void) bt_gatt_cb_register(&gatt_callbacks); -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) k_work_init_delayable(&audio_send_work, lc3_audio_timer_timeout); #else k_work_init_delayable(&audio_send_work, audio_timer_timeout); @@ -961,7 +961,7 @@ static int set_stream_qos(void) static int enable_streams(void) { - if (IS_ENABLED(CONFIG_LIBLC3CODEC)) { + if (IS_ENABLED(CONFIG_LIBLC3)) { init_lc3(); } diff --git a/samples/bluetooth/unicast_audio_server/boards/native_posix.conf b/samples/bluetooth/unicast_audio_server/boards/native_posix.conf index a3327360031..3d06b9f321f 100644 --- a/samples/bluetooth/unicast_audio_server/boards/native_posix.conf +++ b/samples/bluetooth/unicast_audio_server/boards/native_posix.conf @@ -1,7 +1,7 @@ CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_BT_TINYCRYPT_ECC=y -CONFIG_LIBLC3CODEC=y +CONFIG_LIBLC3=y CONFIG_FPU=y # For LE-audio at 10ms intervals we need the tick counter to occur more frequently diff --git a/samples/bluetooth/unicast_audio_server/boards/nrf5340dk_nrf5340_cpuapp.conf b/samples/bluetooth/unicast_audio_server/boards/nrf5340dk_nrf5340_cpuapp.conf index 603c9d9fb92..f7c6bbfd3db 100644 --- a/samples/bluetooth/unicast_audio_server/boards/nrf5340dk_nrf5340_cpuapp.conf +++ b/samples/bluetooth/unicast_audio_server/boards/nrf5340dk_nrf5340_cpuapp.conf @@ -1,6 +1,6 @@ # For LC3 the following configs are needed CONFIG_FPU=y -CONFIG_LIBLC3CODEC=y +CONFIG_LIBLC3=y # The LC3 codec uses a large amount of stack. This app runs the codec in the work-queue, hence # inctease stack size for that thread. CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 diff --git a/samples/bluetooth/unicast_audio_server/src/main.c b/samples/bluetooth/unicast_audio_server/src/main.c index 605f23adce4..4e151395743 100644 --- a/samples/bluetooth/unicast_audio_server/src/main.c +++ b/samples/bluetooth/unicast_audio_server/src/main.c @@ -79,7 +79,7 @@ static uint32_t get_and_incr_seq_num(const struct bt_audio_stream *stream) return 0; } -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) #include "lc3.h" @@ -240,7 +240,7 @@ static struct bt_audio_stream *lc3_config(struct bt_conn *conn, printk("No streams available\n"); -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) /* Nothing to free as static memory is used */ lc3_decoder = NULL; #endif @@ -256,7 +256,7 @@ static int lc3_reconfig(struct bt_audio_stream *stream, print_codec(codec); -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) /* Nothing to free as static memory is used */ lc3_decoder = NULL; #endif @@ -287,7 +287,7 @@ static int lc3_enable(struct bt_audio_stream *stream, { printk("Enable: stream %p meta_count %u\n", stream, meta_count); -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) { const int freq = bt_codec_cfg_get_freq(stream->codec); const int frame_duration_us = bt_codec_cfg_get_frame_duration_us(stream->codec); @@ -434,7 +434,7 @@ static struct bt_audio_capability_ops lc3_ops = { }; -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) static void stream_recv_lc3_codec(struct bt_audio_stream *stream, const struct bt_iso_recv_info *info, @@ -497,7 +497,7 @@ static void stream_recv(struct bt_audio_stream *stream, #endif static struct bt_audio_stream_ops stream_ops = { -#if defined(CONFIG_LIBLC3CODEC) +#if defined(CONFIG_LIBLC3) .recv = stream_recv_lc3_codec #else .recv = stream_recv diff --git a/west.yml b/west.yml index bc722834b9a..9374e041f26 100644 --- a/west.yml +++ b/west.yml @@ -150,8 +150,8 @@ manifest: groups: - hal - name: liblc3 - revision: 54c047249bc6b8089e85c1433b5aa6001bbc1ba9 - path: modules/lib/liblc3codec + revision: 448f3de31f49a838988a162ef1e23a89ddf2d2ed + path: modules/lib/liblc3 - name: littlefs path: modules/fs/littlefs groups: