audio: dsm: add stub for maxim dsm

Add a stub for the library so fuzzers and CI can compile the adapter

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
This commit is contained in:
Curtis Malainey 2023-07-18 13:26:11 -07:00 committed by Liam Girdwood
parent 266a8f82b7
commit c5f00bfde7
4 changed files with 69 additions and 0 deletions

View File

@ -4,6 +4,10 @@ add_local_sources(sof smart_amp.c smart_amp_generic.c)
if(CONFIG_MAXIM_DSM) if(CONFIG_MAXIM_DSM)
add_local_sources(sof smart_amp_maxim_dsm.c) add_local_sources(sof smart_amp_maxim_dsm.c)
if(CONFIG_MAXIM_DSM_STUB)
add_local_sources(sof maxim_dsm_stub.c)
else()
sof_add_static_library(dsm ${CMAKE_CURRENT_LIST_DIR}/lib/release/dsm_lib/libdsm.a) sof_add_static_library(dsm ${CMAKE_CURRENT_LIST_DIR}/lib/release/dsm_lib/libdsm.a)
endif()
target_include_directories(sof PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/dsm_api/inc) target_include_directories(sof PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/dsm_api/inc)
endif() endif()

View File

@ -5,6 +5,7 @@ menu "Smart amplifier solutions"
config MAXIM_DSM config MAXIM_DSM
bool "Maxim DSM solution" bool "Maxim DSM solution"
select MAXIM_DSM_STUB if COMP_STUBS
default n default n
help help
Select to apply Maxim DSM(Dynamic Speaker Management) solution Select to apply Maxim DSM(Dynamic Speaker Management) solution
@ -13,5 +14,13 @@ menu "Smart amplifier solutions"
building the FW binary with this option enabled. The library building the FW binary with this option enabled. The library
itself should be statically linked with the SoF FW binary image. itself should be statically linked with the SoF FW binary image.
config MAXIM_DSM_STUB
bool "Maxim DSM solution"
depends on MAXIM_DSM
default n
help
Select to build the Maxim DSM adapter with a stub library. This
should only be used for CI and testing.
endmenu endmenu

View File

@ -0,0 +1,52 @@
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright(c) 2023 Google LLC. All rights reserved.
//
// Author: Curtis Malainey <cujomalainey@chromium.org>
//
#include "dsm_api_public.h"
enum DSM_API_MESSAGE dsm_api_get_mem(struct dsm_api_memory_size_ext_t *iopmmemparam,
int iparamsize)
{
return DSM_API_OK;
}
enum DSM_API_MESSAGE dsm_api_init(void *ipmodulehandler,
struct dsm_api_init_ext_t *iopparamstruct,
int iparamsize)
{
return DSM_API_OK;
}
enum DSM_API_MESSAGE dsm_api_ff_process(void *ipmodulehandler,
int channelmask,
short *ibufferorg,
int *ipnrsamples,
short *obufferorg,
int *opnrsamples)
{
return DSM_API_OK;
}
enum DSM_API_MESSAGE dsm_api_fb_process(void *ipmodulehandler,
int ichannelmask,
short *icurrbuffer,
short *ivoltbuffer,
int *iopnrsamples)
{
return DSM_API_OK;
}
enum DSM_API_MESSAGE dsm_api_set_params(void *ipmodulehandler,
int icommandnumber, void *ipparamsbuffer)
{
return DSM_API_OK;
}
enum DSM_API_MESSAGE dsm_api_get_params(void *ipmodulehandler,
int icommandnumber, void *opparams)
{
return DSM_API_OK;
}

View File

@ -646,6 +646,10 @@ zephyr_include_directories_ifdef(CONFIG_MAXIM_DSM
${SOF_AUDIO_PATH}/smart_amp/include/dsm_api/inc/ ${SOF_AUDIO_PATH}/smart_amp/include/dsm_api/inc/
) )
zephyr_library_sources_ifdef(CONFIG_MAXIM_DSM_STUB
${SOF_AUDIO_PATH}/smart_amp/maxim_dsm_stub.c
)
zephyr_library_sources_ifdef(CONFIG_COMP_ARIA zephyr_library_sources_ifdef(CONFIG_COMP_ARIA
${SOF_AUDIO_PATH}/aria/aria.c ${SOF_AUDIO_PATH}/aria/aria.c
${SOF_AUDIO_PATH}/aria/aria_hifi3.c ${SOF_AUDIO_PATH}/aria/aria_hifi3.c