-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
audio: module adapter: create ipc3 and ipc4 specific source file
create ipc3 and ipc4 specific source file, these files will only be used to store specific code accordingly. Signed-off-by: Baofeng Tian <[email protected]>
- Loading branch information
Showing
11 changed files
with
172 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// | ||
// Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
// | ||
// Author: Baofeng Tian <[email protected]> | ||
|
||
/** | ||
* \file | ||
* \brief Module Adapter ipc3: module adapter ipc3 specific code | ||
* \author Baofeng Tian <[email protected]> | ||
*/ | ||
|
||
#include <sof/audio/buffer.h> | ||
#include <sof/audio/component.h> | ||
#include <sof/audio/ipc-config.h> | ||
#include <sof/audio/module_adapter/module/generic.h> | ||
#include <sof/audio/pipeline.h> | ||
#include <sof/common.h> | ||
#include <sof/platform.h> | ||
#include <sof/ut.h> | ||
#include <rtos/interrupt.h> | ||
#include <limits.h> | ||
#include <stdint.h> | ||
|
||
LOG_MODULE_DECLARE(module_adapter, CONFIG_SOF_LOG_LEVEL); | ||
|
||
/* | ||
* \module adapter data initialize. | ||
* \param[in] dev - device. | ||
* \param[in] config - component ipc descriptor pointer. | ||
* \param[in] dst - module adatper config data. | ||
* \param[in] spec - passdowned data from driver. | ||
* | ||
* \return: 0 - no error; < 0, error happened. | ||
*/ | ||
int module_adapter_init_data(struct comp_dev *dev, | ||
struct module_config *dst, | ||
const struct comp_ipc_config *config, | ||
const void *spec) | ||
{ | ||
int ret; | ||
|
||
const unsigned char *data; | ||
uint32_t size; | ||
|
||
switch (config->type) { | ||
case SOF_COMP_VOLUME: | ||
{ | ||
const struct ipc_config_volume *ipc_volume = spec; | ||
|
||
size = sizeof(*ipc_volume); | ||
data = spec; | ||
break; | ||
} | ||
case SOF_COMP_SRC: | ||
{ | ||
const struct ipc_config_src *ipc_src = spec; | ||
|
||
size = sizeof(*ipc_src); | ||
data = spec; | ||
break; | ||
} | ||
default: | ||
{ | ||
const struct ipc_config_process *ipc_module_adapter = spec; | ||
|
||
size = ipc_module_adapter->size; | ||
data = ipc_module_adapter->data; | ||
break; | ||
} | ||
} | ||
|
||
/* Copy initial config */ | ||
if (size) { | ||
ret = module_load_config(dev, data, size); | ||
if (ret < 0) { | ||
comp_err(dev, "module_adapter_new() error %d: config loading has failed.", | ||
ret); | ||
return ret; | ||
} | ||
dst->init_data = dst->data; | ||
} else { | ||
return -EINVAL; | ||
} | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// SPDX-License-Identifier: BSD-3-Clause | ||
// | ||
// Copyright(c) 2023 Intel Corporation. All rights reserved. | ||
// | ||
// Author: Baofeng Tian <[email protected]> | ||
|
||
/** | ||
* \file | ||
* \brief Module Adapter ipc4: module adapter ipc4 specific code | ||
* \author Baofeng Tian <[email protected]> | ||
*/ | ||
|
||
#include <sof/audio/buffer.h> | ||
#include <sof/audio/component.h> | ||
#include <sof/audio/ipc-config.h> | ||
#include <sof/audio/module_adapter/module/generic.h> | ||
#include <sof/audio/pipeline.h> | ||
#include <sof/common.h> | ||
#include <sof/platform.h> | ||
#include <sof/ut.h> | ||
#include <rtos/interrupt.h> | ||
#include <limits.h> | ||
#include <stdint.h> | ||
|
||
LOG_MODULE_DECLARE(module_adapter, CONFIG_SOF_LOG_LEVEL); | ||
|
||
/* | ||
* \module adapter data initialize. | ||
* \param[in] dev - device. | ||
* \param[in] config - component ipc descriptor pointer. | ||
* \param[in] dst - module adatper config data. | ||
* \param[in] spec - passdowned data from driver. | ||
* | ||
* \return: 0 - no error; < 0, error happened. | ||
*/ | ||
int module_adapter_init_data(struct comp_dev *dev, | ||
struct module_config *dst, | ||
const struct comp_ipc_config *config, | ||
const void *spec) | ||
{ | ||
if (dev->drv->type == SOF_COMP_MODULE_ADAPTER) { | ||
const struct ipc_config_process *ipc_module_adapter = spec; | ||
|
||
dst->init_data = ipc_module_adapter->data; | ||
dst->size = ipc_module_adapter->size; | ||
dst->avail = true; | ||
|
||
memcpy_s(&dst->base_cfg, sizeof(dst->base_cfg), ipc_module_adapter->data, | ||
sizeof(dst->base_cfg)); | ||
} else { | ||
dst->init_data = spec; | ||
} | ||
|
||
return 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters