diff --git a/scripts/README.docker b/scripts/README.docker deleted file mode 100644 index 902c1e1eafdf..000000000000 --- a/scripts/README.docker +++ /dev/null @@ -1,34 +0,0 @@ -The docker container provided in docker_build sets up a build environment for -building Sound Open Firmware. A working docker installation is needed to run -the docker build container. - -Note: In order to run docker as non sudo/root user please run. - -sudo usermod -aG docker your-user-name - -Then logout and login again. - -Quick Start: - -First, build the docker container. This step needs to be done initially and -when the toolchain or alsa dependencies are updated. - -cd scripts/docker_build - -./docker-build.sh - -After the container is built, it can be used to run the scripts. - -To build for tigerlake: -./scripts/docker-run.sh ./scripts/xtensa-build-all.sh -l tgl -or (may need password test0000 for rimage install) -./scripts/docker-run.sh ./scripts/xtensa-build-all.sh tgl - -To rebuild the topology and logger: -./scripts/docker-run.sh ./scripts/build-tools.sh - -An incremental sof.git build: -./scripts/docker-run.sh make - -Or enter a shell: -./scripts/docker-run.sh bash diff --git a/scripts/Readme.md b/scripts/Readme.md new file mode 100644 index 000000000000..df5c2587653c --- /dev/null +++ b/scripts/Readme.md @@ -0,0 +1,107 @@ +# SOF Helper Scripts + +This folder contains a lot of useful scripts that can speed up development for routine tasks or simplify execution of complex tasks. + +## Build Scripts + +SOF has several build targets depending on whether you are building firmware, tooling, documentation or topologies. This directory has a helper for each. + +### Firmware + +Firmware can either be built using west command directly or by the xtensa-build-zephyr.py script. This script wraps up the west commands and can build using either the Zephyr SDK compiler or the Cadence xtensa compiler for xtensa targets. + +Please run the script with --help to see all options. + +E.g to build SOF for Intel Pantherlake: + +1) Enable the python virtual environment for west. This should be in your SOF workspace installation direction. Default is ```~/work/sof``` (only needs run once). +```bash +source ~/work/sof/.venv/bin/activate +``` +2) Now run the build script. *Note: most build errors are a result of ingredients being out of sync with the west manifest. Please run ```west update``` and rebuild before fixing/reporting build errors.* +```bash +./scripts/xtensa-build-zephyr.py -p ptl +``` + +### Testbench + +Testbench is a host application that is used to run SOF processing modules on developers PC. This allows for module development using regular host based tooling. + +Please run +```bash +./rebuild-testbench.sh --help +``` +for full options. + +Testbench can be also be built for Cadence simulator targets. + +### Tools and Topologies + +Tooling and topology can be built together using one script. To build all topologies please run: + +```bash +./scripts/build-tools.sh +``` + +This script can build: +1) sof-ctl +2) sof-logger +3) probes +4) all topology 1 & 2 and test topologies. +5) Local ALSA git version for alsa-lib and alsa-utils that have features not yet in distro version of ALSA packages. + +## SDK Support + +There is some SDK support in this directory for speeding up or simplifying tasks with multiple steps. + +### New Modules + +A new module can be created by running the sdk-create-module script. This script will copy the template module and rename all strings, Cmakefiles, Kconfigs to match the new module. It will also create a UUID for the new module and a TOML manifest entry (for targets that need this). + +Please run +```bash +./sdk-create-module.py new_module_name +``` + +## Docker + +The docker container provided in docker_build sets up a build environment for +building Sound Open Firmware. A working docker installation is needed to run +the docker build container. + +Note: In order to run docker as non sudo/root user please run. +```bash +sudo usermod -aG docker your-user-name +``` +Then logout and login again. + +Quick Start: + +First, build the docker container. This step needs to be done initially and +when the toolchain or alsa dependencies are updated. +```bash +cd scripts/docker_build +./docker-build.sh +``` +After the container is built, it can be used to run the scripts. + +To build for tigerlake: +```bash +./scripts/docker-run.sh ./scripts/xtensa-build-all.sh -l tgl +``` +or (may need password test0000 for rimage install) +```bash +./scripts/docker-run.sh ./scripts/xtensa-build-all.sh tgl +``` +To rebuild the topology and logger: +```bash +./scripts/docker-run.sh ./scripts/build-tools.sh +``` +An incremental sof.git build: +```bash +./scripts/docker-run.sh make +``` +Or enter a shell: +```bash +./scripts/docker-run.sh bash +``` diff --git a/scripts/gen-uuid-reg.py b/scripts/gen-uuid-reg.py index ddd7f06658ea..316f35315544 100755 --- a/scripts/gen-uuid-reg.py +++ b/scripts/gen-uuid-reg.py @@ -53,6 +53,7 @@ def main(): all_uuids.add(uu) all_syms.add(sym) emit_uuid_rec(uu, sym) + print(f"Added UUID {uu} with symbol {sym}") with open(sys.argv[2], "w") as f: f.write(header) diff --git a/scripts/sdk-create-module.py b/scripts/sdk-create-module.py new file mode 100755 index 000000000000..b9193a57f942 --- /dev/null +++ b/scripts/sdk-create-module.py @@ -0,0 +1,434 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: BSD-3-Clause +# +# Creates new module based on template module. + +import os +import sys +import shutil +import uuid +import re + +def process_directory(directory_path, old_text, new_text): + """ + Recursively walks through a directory to rename files and replace content. + This function processes files first, then directories, to allow for renaming + of the directories themselves after their contents are handled. + """ + # Walk through the directory tree + for dirpath, dirnames, filenames in os.walk(directory_path, topdown=False): + # --- Process Files --- + for filename in filenames: + original_filepath = os.path.join(dirpath, filename) + + # a) Replace content within files + # Only process C/H files for content replacement + if filename.endswith(('.c', '.h', '.cpp', '.hpp', '.txt', '.toml', 'Kconfig')): + replace_text_in_file(original_filepath, old_text, new_text) + if filename.endswith(('.c', '.h', '.cpp', '.hpp', '.txt', '.toml', 'Kconfig')): + replace_text_in_file(original_filepath, old_text.upper(), new_text.upper()) + if filename.endswith(('.c', '.h', '.cpp', '.hpp', '.txt', '.toml', 'Kconfig')): + replace_text_in_file(original_filepath, "template", new_text) + if filename.endswith(('.c', '.h', '.cpp', '.hpp', '.txt', '.toml', 'Kconfig')): + replace_text_in_file(original_filepath, "TEMPLATE", new_text.upper()) + + # b) Rename the file if its name contains the template text + if "template" in filename: + new_filename = filename.replace("template", new_text) + new_filepath = os.path.join(dirpath, new_filename) + print(f" -> Renaming file: '{original_filepath}' to '{new_filepath}'") + os.rename(original_filepath, new_filepath) + +def replace_text_in_file(filepath, old_text, new_text): + """ + Replaces all occurrences of old_text with new_text in a given file. + """ + try: + # Read the file content + with open(filepath, 'r', encoding='utf-8') as file: + content = file.read() + + # Perform the replacement + new_content = content.replace(old_text, new_text) + + # If content has changed, write it back + if new_content != content: + print(f" -> Updating content in: '{filepath}'") + with open(filepath, 'w', encoding='utf-8') as file: + file.write(new_content) + + except Exception as e: + print(f" -> [WARNING] Could not process file '{filepath}'. Reason: {e}") + +def insert_uuid_name(filepath: str, new_name: str): + """ + Inserts a newly generated UUID and a given name into a file, maintaining + alphabetical order by name. Ignores and preserves lines starting with '#'. + + Args: + filepath (str): The path to the file to be updated. + new_name (str): The name to associate with the new UUID. + """ + data_entries = [] + other_lines = [] # To store comments and blank lines + + # --- 1. Read existing entries and comments from the file --- + try: + with open(filepath, 'r', encoding='utf-8') as f: + for line in f: + stripped_line = line.strip() + # Check for comments or blank lines + if not stripped_line or stripped_line.startswith('#'): + other_lines.append(line) # Preserve the original line with newline + continue + + # It's a data line, so process it + # Split only on the first space to handle names that might contain spaces + parts = stripped_line.split(' ', 1) + if len(parts) == 2: + data_entries.append((parts[0], parts[1])) + except FileNotFoundError: + print(f"File '{filepath}' not found. A new file will be created.") + except Exception as e: + print(f"An error occurred while reading the file: {e}") + return + + # --- 2. Check if the name already exists in data entries --- + if any(name == new_name for _, name in data_entries): + print(f"Name '{new_name}' already exists in the file. No changes made.") + return + + # --- 3. Add the new entry to the data list --- + new_uuid = str(uuid.uuid4()) + + # We split the string from the right at the last hyphen and then join the parts. + parts = new_uuid.rsplit('-', 1) + custom_format_uuid = ''.join(parts) + + data_entries.append((custom_format_uuid, new_name)) + print(f"Generated new entry: {new_uuid} {new_name}") + + # --- 4. Sort the list of data entries by name (the second element of the tuple) --- + data_entries.sort(key=lambda item: item[1]) + + # --- 5. Write the comments and then the sorted data back to the file --- + try: + with open(filepath, 'w', encoding='utf-8') as f: + # Write all the comments and other non-data lines first + for line in other_lines: + f.write(line) + + # Write the sorted data entries + for entry_uuid, entry_name in data_entries: + f.write(f"{entry_uuid} {entry_name}\n") + print(f"Successfully updated '{filepath}'.") + except Exception as e: + print(f"An error occurred while writing to the file: {e}") + +# Define the markers for the managed block in the CMakeLists.txt file. +CMAKE_START_MARKER = " # directories and files included conditionally (alphabetical order)" +CMAKE_END_MARKER = " # end of directories and files included conditionally (alphabetical order)" + +def insert_cmake_rule(filepath: str, kconfig_option: str, subdir_name: str): + """ + Reads a CMakeLists.txt file, adds a new rule, and writes it back. + + Args: + filepath (str): Path to the CMakeLists.txt file. + kconfig_option (str): The Kconfig flag to check. + subdir_name (str): The subdirectory to add. + """ + if not os.path.exists(filepath): + print(f"[ERROR] File not found at: '{filepath}'") + return + + # --- 1. Read the entire file content --- + with open(filepath, 'r', encoding='utf-8') as f: + lines = f.readlines() + + # --- 2. Find the start and end of the managed block --- + try: + start_index = lines.index(CMAKE_START_MARKER + '\n') + end_index = lines.index(CMAKE_END_MARKER + '\n') + except ValueError: + print(f"[ERROR] Could not find the required marker blocks in '{filepath}'.") + print(f"Please ensure the file contains both '{CMAKE_START_MARKER}' and '{CMAKE_END_MARKER}'.") + return + + # --- 3. Extract the lines before, during, and after the block --- + lines_before = lines[:start_index + 1] + block_lines = lines[start_index + 1 : end_index] + lines_after = lines[end_index:] + + # --- 4. Parse the existing rules within the block --- + rules = [] + # Regex to find: if(CONFIG_NAME) ... add_subdirectory(subdir) ... endif() + # This is robust against extra whitespace and blank lines. + block_content = "".join(block_lines) + pattern = re.compile( + r"if\s*\((?PCONFIG_[A-Z0-9_]+)\)\s*" + r"add_subdirectory\s*\((?P[a-zA-Z0-9_]+)\)\s*" + r"endif\(\)", + re.DOTALL + ) + + for match in pattern.finditer(block_content): + rules.append(match.groupdict()) + + # --- 5. Check if the rule already exists --- + if any(rule['kconfig'] == kconfig_option for rule in rules): + print(f"[INFO] Rule for '{kconfig_option}' already exists. No changes made.") + return + + # --- 6. Add the new rule and sort alphabetically --- + rules.append({'kconfig': kconfig_option, 'subdir': subdir_name}) + rules.sort(key=lambda r: r['kconfig']) + print(f"Adding rule for '{kconfig_option}' -> '{subdir_name}' and re-sorting.") + + # --- 7. Rebuild the block content from the sorted rules --- + new_block_lines = [] + for i, rule in enumerate(rules): + new_block_lines.append(f"\tif({rule['kconfig']})\n") + new_block_lines.append(f"\t\tadd_subdirectory({rule['subdir']})\n") + new_block_lines.append("\tendif()\n") + + # --- 8. Assemble the new file content and write it back --- + new_content = "".join(lines_before + new_block_lines + lines_after) + with open(filepath, 'w', encoding='utf-8') as f: + f.write(new_content) + + print(f"Successfully updated '{filepath}'.") + +# Define the markers for the managed block in the Kconfig file. +KCONFIG_START_MARKER = "# --- Kconfig Sources (alphabetical order) ---" +KCONFIG_END_MARKER = "# --- End Kconfig Sources (alphabetical order) ---" + +def insert_kconfig_source(filepath: str, source_path: str): + """ + Reads a Kconfig file, adds a new rsource rule, and writes it back. + + Args: + filepath (str): Path to the Kconfig file. + source_path (str): The path to the Kconfig file to be sourced. + """ + if not os.path.exists(filepath): + print(f"[ERROR] File not found at: '{filepath}'") + return + + # --- 1. Read the entire file content --- + try: + with open(filepath, 'r', encoding='utf-8') as f: + lines = f.readlines() + except Exception as e: + print(f"[ERROR] Could not read file: {e}") + return + + # --- 2. Find the start and end of the managed block --- + try: + start_index = lines.index(KCONFIG_START_MARKER + '\n') + end_index = lines.index(KCONFIG_END_MARKER + '\n') + except ValueError: + print(f"[ERROR] Could not find the required marker blocks in '{filepath}'.") + print(f"Please ensure the file contains both '{KCONFIG_START_MARKER}' and '{KCONFIG_END_MARKER}'.") + return + + # --- 3. Extract the lines before, during, and after the block --- + lines_before = lines[:start_index + 1] + block_lines = lines[start_index + 1 : end_index] + lines_after = lines[end_index:] + + # --- 4. Parse the existing rsource rules within the block --- + source_paths = [] + # Regex to find: rsource "path/to/file" + pattern = re.compile(r'rsource\s+"(?P.*?)"') + + for line in block_lines: + match = pattern.search(line) + if match: + source_paths.append(match.group('path')) + + # --- 5. Check if the source path already exists --- + if source_path in source_paths: + print(f"[INFO] Source path '{source_path}' already exists. No changes made.") + return + + # --- 6. Add the new path and sort alphabetically --- + source_paths.append(source_path) + source_paths.sort() + print(f"Adding source '{source_path}' and re-sorting.") + + # --- 7. Rebuild the block content from the sorted paths --- + new_block_lines = [] + for path in source_paths: + new_block_lines.append(f'rsource "{path}"\n') + + # --- 8. Assemble the new file content and write it back --- + new_content = "".join(lines_before + new_block_lines + lines_after) + with open(filepath, 'w', encoding='utf-8') as f: + f.write(new_content) + + print(f"Successfully updated '{filepath}'.") + +SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) + +# Define the markers for the managed block in the header file. +HEADER_START_MARKER = "/* Start of modules in alphabetical order */" +HEADER_END_MARKER = "/* End of modules in alphabetical order */" + +def insert_c_declaration(header_path: str, name: str) -> bool: + """ + Inserts a C function declaration alphabetically into a header file between + start and end markers. + + The function declaration format is: + "void sys_comp_module_${name}_interface_init(void);" + + Args: + header_path (str): The full path to the C header file. + name (str): The component name to be inserted into the function declaration. + HEADER_START_MARKER (str): The string marking the beginning of the declaration block. + HEADER_END_MARKER (str): The string marking the end of the declaration block. + + Returns: + bool: True if the file was modified or already up-to-date, False on error. + """ + new_declaration = f"void sys_comp_module_{name}_interface_init(void);" + line_to_insert = new_declaration + "\n" + + # --- 1. Read existing lines from the header file --- + try: + with open(header_path, 'r') as f: + lines = f.readlines() + except FileNotFoundError: + print(f"Error: Header file not found at '{header_path}'", file=sys.stderr) + return False + except IOError as e: + print(f"Error: Could not read file '{header_path}': {e}", file=sys.stderr) + return False + + # --- 2. Find start and end markers --- + start_index = -1 + end_index = -1 + for i, line in enumerate(lines): + if HEADER_START_MARKER in line: + start_index = i + elif HEADER_END_MARKER in line: + end_index = i + break # Assume end marker always comes after the start marker + + if start_index == -1 or end_index == -1: + print(f"Error: Start ('{HEADER_START_MARKER}') or end ('{HEADER_END_MARKER}') marker not found.", file=sys.stderr) + return False + if end_index <= start_index: + print(f"Error: End marker appears before start marker.", file=sys.stderr) + return False + + # --- 3. Check if the declaration already exists within the block --- + # Isolate the block of lines where declarations are allowed + declaration_block = lines[start_index + 1 : end_index] + if line_to_insert in declaration_block: + print(f"Declaration for '{name}' already exists within the block. No changes made.") + return True + + # --- 4. Find the correct alphabetical insertion point within the block --- + relative_insert_index = len(declaration_block) + for i, line in enumerate(declaration_block): + # Compare with the stripped content of each line in the block + if line.strip() > new_declaration: + relative_insert_index = i + break + + # Calculate the final insertion index relative to the whole file + final_insert_index = start_index + 1 + relative_insert_index + + # --- 5. Insert the new line into the main list of lines --- + lines.insert(final_insert_index, line_to_insert) + print(f"Inserting declaration for '{name}' at line {final_insert_index + 1}.") + + # --- 6. Write the modified list back to the file --- + try: + with open(header_path, 'w') as f: + f.writelines(lines) + except IOError as e: + print(f"Error: Could not write to file '{header_path}': {e}", file=sys.stderr) + return False + + return True + +def main(): + """ + Main function to drive the script logic. + """ + print("--- SOF SDK New Module Creator ---") + + # Argument Validation --- + if len(sys.argv) != 2: + print("\n[ERROR] Invalid number of arguments.") + print("Usage: sdk_create_module.py ") + sys.exit(1) + + # Configuration --- paths are with respect to script dir + modules_root = SCRIPT_DIR + "/../src/audio" + template_name = "template" + new_module_name = sys.argv[1] + uuid_file = SCRIPT_DIR + "/../uuid-registry.txt" + cmake_file = SCRIPT_DIR + "/../src/audio/CMakeLists.txt" + kconfig_file = SCRIPT_DIR + "/../src/audio/Kconfig" + component_file = SCRIPT_DIR + "/../src/include/sof/audio/component.h" + + template_dir = os.path.join(modules_root, template_name) + new_module_dir = os.path.join(modules_root, new_module_name) + + print(f"\nConfiguration:") + print(f" - Modules Root: '{modules_root}'") + print(f" - Template Name: '{template_name}'") + print(f" - New Module Name:'{new_module_name}'") + print(f" - UUID file: '{uuid_file}'") + print(f" - Cmake file: '{cmake_file}'") + print(f" - Kconfig file: '{kconfig_file}'") + print(f" - Component file: '{component_file}'") + + # Check for Pre-existing Directories --- + if not os.path.isdir(template_dir): + print(f"\n[ERROR] Template directory not found at: '{template_dir}'") + sys.exit(1) + + if os.path.exists(new_module_dir): + print(f"\n[ERROR] A directory with the new module name already exists: '{new_module_dir}'") + sys.exit(1) + + # Copy Template Directory --- + try: + print(f"\n[1/6] Copying template directory...") + shutil.copytree(template_dir, new_module_dir) + print(f" -> Successfully copied to '{new_module_dir}'") + except OSError as e: + print(f"\n[ERROR] Could not copy directory. Reason: {e}") + sys.exit(1) + + # Rename Files and Replace Content --- + # We walk through the newly created directory. + print(f"\n[2/6] Renaming files and replacing content...") + process_directory(new_module_dir, template_name, new_module_name) + insert_c_declaration(component_file, new_module_name) + + # Generate UUID for the new module --- + print("\n[3/6] Generating UUID for module...") + insert_uuid_name(uuid_file, new_module_name) + + # Add CMake rule for new module --- + print("\n[4/6] Module creation process finished successfully!") + kconfig_option = f"CONFIG_COMP_{new_module_name.upper()}" + print(f" -> Adding CMake rule for '{kconfig_option}'") + insert_cmake_rule(cmake_file, kconfig_option, new_module_name) + + # Add Kconfig rsource for new module + print("\n[5/6] Module creation process finished successfully!") + insert_kconfig_source(kconfig_file, f"{new_module_name}/Kconfig") + + print("\n[6/6] Module creation process finished successfully!") + print("--- Done ---") + +if __name__ == "__main__": + main() + diff --git a/scripts/xtensa-build-zephyr.py b/scripts/xtensa-build-zephyr.py index ae9e4267d64e..40931ba6623a 100755 --- a/scripts/xtensa-build-zephyr.py +++ b/scripts/xtensa-build-zephyr.py @@ -398,6 +398,8 @@ def parse_args(): help="Prints version of this script.") parser.add_argument("-m", "--menuconfig", required=False, action="store_true", help="Build menuconfig for target") + parser.add_argument("-z", "--zephyrsdk", required=False, action="store_true", + help="Force Build using Zephyr SDK for target") args = parser.parse_args() @@ -836,7 +838,12 @@ def build_platforms(): _dict = dataclasses.asdict(platform_configs[platform]) platform_dict = { k:v for (k,v) in _dict.items() if _dict[k] is not None } - xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT") + if args.zephyrsdk: + print("Using Zephyr SDK for building") + xtensa_tools_root_dir = None + else: + print("Using Xtensa tools for building") + xtensa_tools_root_dir = os.getenv("XTENSA_TOOLS_ROOT") # when XTENSA_TOOLS_ROOT environmental variable is set, # use user installed Xtensa tools not Zephyr SDK if "XTENSA_TOOLS_VERSION" in platform_dict and xtensa_tools_root_dir: diff --git a/src/audio/CMakeLists.txt b/src/audio/CMakeLists.txt index 76625e9796b8..c098b9267c61 100644 --- a/src/audio/CMakeLists.txt +++ b/src/audio/CMakeLists.txt @@ -17,6 +17,11 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) add_subdirectory(pcm_converter) add_subdirectory(pipeline) + if(CONFIG_COMP_BASEFW_IPC4 AND NOT CONFIG_LIBRARY) + add_local_sources(sof base_fw.c) + endif() + add_local_sources_ifdef(CONFIG_IPC4_BASE_FW_INTEL sof base_fw_intel.c) + # directories and files included conditionally (alphabetical order) if(CONFIG_COMP_ARIA) add_subdirectory(aria) @@ -24,13 +29,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_ASRC) add_subdirectory(asrc) endif() - if(CONFIG_COMP_BASEFW_IPC4 AND NOT CONFIG_LIBRARY) - add_local_sources(sof base_fw.c) - endif() - add_local_sources_ifdef(CONFIG_IPC4_BASE_FW_INTEL sof base_fw_intel.c) - if(CONFIG_COMP_CHAIN_DMA) - add_local_sources(sof chain_dma.c) - endif() if(CONFIG_COMP_COPIER) add_subdirectory(copier) endif() @@ -52,19 +50,17 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_IIR) add_subdirectory(eq_iir) endif() - if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) - add_local_sources(sof - kpb.c - ) + if(CONFIG_COMP_LEVEL_MULTIPLIER) + add_subdirectory(level_multiplier) endif() if(CONFIG_COMP_MFCC) add_subdirectory(mfcc) endif() if(CONFIG_COMP_MIXER) - add_subdirectory(mixer) + add_subdirectory(mixer) endif() if(CONFIG_COMP_MIXIN_MIXOUT) - add_subdirectory(mixin_mixout) + add_subdirectory(mixin_mixout) endif() if(CONFIG_COMP_MODULE_ADAPTER) add_subdirectory(module_adapter) @@ -90,10 +86,11 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_TDFB) add_subdirectory(tdfb) endif() - if(CONFIG_COMP_TONE) - add_local_sources(sof - tone.c - ) + if(CONFIG_COMP_TEMPLATE) + add_subdirectory(template) + endif() + if(CONFIG_COMP_TENSORFLOW) + add_subdirectory(tensorflow) endif() if(CONFIG_COMP_UP_DOWN_MIXER) add_subdirectory(up_down_mixer) @@ -101,18 +98,30 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) if(CONFIG_COMP_VOLUME) add_subdirectory(volume) endif() - if(CONFIG_COMP_TENSORFLOW) - add_subdirectory(tensorflow) - endif() if(CONFIG_DTS_CODEC) add_subdirectory(codec) endif() + # end of directories and files included conditionally (alphabetical order) + add_subdirectory(google) add_subdirectory(nxp) + if(CONFIG_COMP_CHAIN_DMA) + add_local_sources(sof chain_dma.c) + endif() + if(CONFIG_COMP_KPB AND NOT CONFIG_LIBRARY_STATIC) + add_local_sources(sof + kpb.c + ) + endif() if(CONFIG_INTEL_ADSP_MIC_PRIVACY) add_subdirectory(mic_privacy_manager) endif() + if(CONFIG_COMP_TONE) + add_local_sources(sof + tone.c + ) + endif() if(CONFIG_ZEPHYR_NATIVE_DRIVERS) list(APPEND base_files host-zephyr.c) sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-zephyr.c) @@ -120,12 +129,6 @@ if(NOT CONFIG_COMP_MODULE_SHARED_LIBRARY_BUILD) list(APPEND base_files host-legacy.c) sof_list_append_ifdef(CONFIG_COMP_DAI base_files dai-legacy.c) endif() - if(CONFIG_COMP_TEMPLATE_COMP) - add_subdirectory(template_comp) - endif() - if(CONFIG_COMP_LEVEL_MULTIPLIER) - add_subdirectory(level_multiplier) - endif() endif() ### Common files (also used in shared library build) diff --git a/src/audio/Kconfig b/src/audio/Kconfig index 5b6d5b061198..ce3ba346b1e5 100644 --- a/src/audio/Kconfig +++ b/src/audio/Kconfig @@ -2,9 +2,6 @@ menu "Audio components" -rsource "volume/Kconfig" -rsource "aria/Kconfig" - config COMP_BASEFW_IPC4 bool "BASEFW component" default y @@ -20,8 +17,6 @@ config IPC4_BASE_FW_INTEL This implements a set of additional IPC4 properties that extend the base spec. -rsource "copier/Kconfig" - config HOST_DMA_RELOAD_DELAY_ENABLE bool "Delay reloading DMA for host interfaces" default y @@ -77,8 +72,6 @@ config MODULE_MAX_CONNECTIONS Specifies the maximum number of sink and source connections a module may have to other modules. -rsource "up_down_mixer/Kconfig" - config COMP_BLOB bool "Large IPC data as compound message blobs" default y @@ -94,18 +87,12 @@ config MODULE_MAX_BLOB_SIZE Specify the maximum size of IPC4 module blob data that can be appended to each message. -rsource "src/Kconfig" - config COMP_STUBS bool "Build all selected third-party (3P) components with stubs" help Select to force all 3P blocks to link against stubs rather than their libraries. This should only be used in testing environments like fuzzers or CI. -rsource "eq_fir/Kconfig" - -rsource "eq_iir/Kconfig" - config COMP_TONE bool "Tone component" select CORDIC_FIXED @@ -113,12 +100,6 @@ config COMP_TONE Select for Tone component. Warning: This component is deprecated and will be removed from SOF v2.8. -rsource "mixer/Kconfig" - -rsource "mixin_mixout/Kconfig" - -rsource "mux/Kconfig" - config COMP_KPB bool "KPB component" default y @@ -135,28 +116,6 @@ config KPB_FORCE_COPY_TYPE_NORMAL endif # COMP_KPB -rsource "google/Kconfig" - -rsource "nxp/Kconfig" - -rsource "selector/Kconfig" - -rsource "crossover/Kconfig" - -rsource "drc/Kconfig" - -rsource "multiband_drc/Kconfig" - -rsource "dcblock/Kconfig" - -rsource "smart_amp/Kconfig" - -rsource "asrc/Kconfig" - -rsource "tdfb/Kconfig" - -rsource "tensorflow/Kconfig" - config COMP_MODULE_ADAPTER bool "Module adapter" default y @@ -168,17 +127,35 @@ config COMP_MODULE_ADAPTER "src\include\sof\audio\module_adapter\interfaces.h". It is possible to link several different codecs and use them in parallel. -rsource "module_adapter/Kconfig" - +# --- Kconfig Sources (alphabetical order) --- +rsource "aria/Kconfig" +rsource "asrc/Kconfig" +rsource "codec/Kconfig" +rsource "copier/Kconfig" +rsource "crossover/Kconfig" +rsource "dcblock/Kconfig" +rsource "drc/Kconfig" +rsource "eq_fir/Kconfig" +rsource "eq_iir/Kconfig" +rsource "google/Kconfig" rsource "igo_nr/Kconfig" - -rsource "rtnr/Kconfig" - rsource "mfcc/Kconfig" - -rsource "codec/Kconfig" - -rsource "template_comp/Kconfig" +rsource "mixer/Kconfig" +rsource "mixin_mixout/Kconfig" +rsource "module_adapter/Kconfig" +rsource "multiband_drc/Kconfig" +rsource "mux/Kconfig" +rsource "nxp/Kconfig" +rsource "rtnr/Kconfig" +rsource "selector/Kconfig" +rsource "smart_amp/Kconfig" +rsource "src/Kconfig" +rsource "tdfb/Kconfig" +rsource "template/Kconfig" +rsource "tensorflow/Kconfig" +rsource "up_down_mixer/Kconfig" +rsource "volume/Kconfig" +# --- End Kconfig Sources (alphabetical order) --- rsource "level_multiplier/Kconfig" diff --git a/src/audio/template_comp/CMakeLists.txt b/src/audio/template/CMakeLists.txt similarity index 65% rename from src/audio/template_comp/CMakeLists.txt rename to src/audio/template/CMakeLists.txt index d21be2f9ab88..5dded00e733c 100644 --- a/src/audio/template_comp/CMakeLists.txt +++ b/src/audio/template/CMakeLists.txt @@ -1,8 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause -if(CONFIG_COMP_TEMPLATE_COMP STREQUAL "m") - add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_comp_llext) - add_dependencies(app template_comp) +if(CONFIG_COMP_TEMPLATE STREQUAL "m") + add_subdirectory(llext ${PROJECT_BINARY_DIR}/template_llext) + add_dependencies(app template) else() add_local_sources(sof template.c) add_local_sources(sof template-generic.c) diff --git a/src/audio/template_comp/Kconfig b/src/audio/template/Kconfig similarity index 65% rename from src/audio/template_comp/Kconfig rename to src/audio/template/Kconfig index 29d385cbbe98..907749c5fa8e 100644 --- a/src/audio/template_comp/Kconfig +++ b/src/audio/template/Kconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause -config COMP_TEMPLATE_COMP - tristate "Template_comp example component" +config COMP_TEMPLATE + tristate "Template example component" default y help - Select for template_comp component. Reason for existence + Select for template component. Reason for existence is to provide a minimal component example and use as placeholder in processing pipelines. As example processing it swaps or reverses the channels when the switch control diff --git a/src/audio/template_comp/llext/CMakeLists.txt b/src/audio/template/llext/CMakeLists.txt similarity index 100% rename from src/audio/template_comp/llext/CMakeLists.txt rename to src/audio/template/llext/CMakeLists.txt diff --git a/src/audio/template_comp/llext/llext.toml.h b/src/audio/template/llext/llext.toml.h similarity index 100% rename from src/audio/template_comp/llext/llext.toml.h rename to src/audio/template/llext/llext.toml.h diff --git a/src/audio/template_comp/template-generic.c b/src/audio/template/template-generic.c similarity index 84% rename from src/audio/template_comp/template-generic.c rename to src/audio/template/template-generic.c index d5f58139d201..14b68c31d9c5 100644 --- a/src/audio/template_comp/template-generic.c +++ b/src/audio/template/template-generic.c @@ -12,7 +12,7 @@ #if CONFIG_FORMAT_S16LE /** - * template_comp_s16() - Process S16_LE format. + * template_s16() - Process S16_LE format. * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. @@ -24,12 +24,12 @@ * * Return: Value zero for success, otherwise an error code. */ -static int template_comp_s16(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames) +static int template_s16(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); int16_t const *x, *x_start, *x_end; int16_t *y, *y_start, *y_end; int x_size, y_size; @@ -98,7 +98,7 @@ static int template_comp_s16(const struct processing_module *mod, #if CONFIG_FORMAT_S32LE || CONFIG_FORMAT_S24LE /** - * template_comp_s32() - Process S32_LE or S24_4LE format. + * template_s32() - Process S32_LE or S24_4LE format. * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. @@ -111,12 +111,12 @@ static int template_comp_s16(const struct processing_module *mod, * * Return: Value zero for success, otherwise an error code. */ -static int template_comp_s32(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames) +static int template_s32(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); int32_t const *x, *x_start, *x_end; int32_t *y, *y_start, *y_end; int x_size, y_size; @@ -186,20 +186,20 @@ static int template_comp_s32(const struct processing_module *mod, /* This struct array defines the used processing functions for * the PCM formats */ -const struct template_comp_proc_fnmap template_comp_proc_fnmap[] = { +const struct template_proc_fnmap template_proc_fnmap[] = { #if CONFIG_FORMAT_S16LE - { SOF_IPC_FRAME_S16_LE, template_comp_s16 }, + { SOF_IPC_FRAME_S16_LE, template_s16 }, #endif #if CONFIG_FORMAT_S24LE - { SOF_IPC_FRAME_S24_4LE, template_comp_s32 }, + { SOF_IPC_FRAME_S24_4LE, template_s32 }, #endif #if CONFIG_FORMAT_S32LE - { SOF_IPC_FRAME_S32_LE, template_comp_s32 }, + { SOF_IPC_FRAME_S32_LE, template_s32 }, #endif }; /** - * template_comp_find_proc_func() - Find suitable processing function. + * template_find_proc_func() - Find suitable processing function. * @src_fmt: Enum value for PCM format. * * This function finds the suitable processing function to use for @@ -207,14 +207,14 @@ const struct template_comp_proc_fnmap template_comp_proc_fnmap[] = { * * Return: Pointer to processing function for the requested PCM format. */ -template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt) +template_func template_find_proc_func(enum sof_ipc_frame src_fmt) { int i; /* Find suitable processing function from map */ - for (i = 0; i < ARRAY_SIZE(template_comp_proc_fnmap); i++) - if (src_fmt == template_comp_proc_fnmap[i].frame_fmt) - return template_comp_proc_fnmap[i].template_comp_proc_func; + for (i = 0; i < ARRAY_SIZE(template_proc_fnmap); i++) + if (src_fmt == template_proc_fnmap[i].frame_fmt) + return template_proc_fnmap[i].template_proc_func; return NULL; } diff --git a/src/audio/template_comp/template-ipc3.c b/src/audio/template/template-ipc3.c similarity index 74% rename from src/audio/template_comp/template-ipc3.c rename to src/audio/template/template-ipc3.c index 757afb8bf923..30398b841bcf 100644 --- a/src/audio/template_comp/template-ipc3.c +++ b/src/audio/template/template-ipc3.c @@ -6,26 +6,26 @@ #include #include "template.h" -LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL); /* This function handles the real-time controls. The ALSA controls have the * param_id set to indicate the control type. The control ID, from topology, * is used to separate the controls instances of same type. In control payload * the num_elems defines to how many channels the control is applied to. */ -__cold int template_comp_set_config(struct processing_module *mod, uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, const uint8_t *fragment, - size_t fragment_size, uint8_t *response, - size_t response_size) +__cold int template_set_config(struct processing_module *mod, uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, const uint8_t *fragment, + size_t fragment_size, uint8_t *response, + size_t response_size) { struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); - comp_dbg(dev, "template_comp_set_config()"); + comp_dbg(dev, "template_set_config()"); switch (cdata->cmd) { case SOF_CTRL_CMD_SWITCH: @@ -55,17 +55,17 @@ __cold int template_comp_set_config(struct processing_module *mod, uint32_t para return -EINVAL; } -__cold int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size) +__cold int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size) { struct sof_ipc_ctrl_data *cdata = (struct sof_ipc_ctrl_data *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); - comp_info(dev, "template_comp_get_config()"); + comp_info(dev, "template_get_config()"); switch (cdata->cmd) { case SOF_CTRL_CMD_SWITCH: diff --git a/src/audio/template_comp/template-ipc4.c b/src/audio/template/template-ipc4.c similarity index 67% rename from src/audio/template_comp/template-ipc4.c rename to src/audio/template/template-ipc4.c index e11a6695ef9d..f66015d9041c 100644 --- a/src/audio/template_comp/template-ipc4.c +++ b/src/audio/template/template-ipc4.c @@ -6,20 +6,20 @@ #include #include "template.h" -LOG_MODULE_DECLARE(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_DECLARE(template, CONFIG_SOF_LOG_LEVEL); /* IPC4 controls handler */ -__cold int template_comp_set_config(struct processing_module *mod, - uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, - const uint8_t *fragment, - size_t fragment_size, - uint8_t *response, - size_t response_size) +__cold int template_set_config(struct processing_module *mod, + uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, + const uint8_t *fragment, + size_t fragment_size, + uint8_t *response, + size_t response_size) { struct sof_ipc4_control_msg_payload *ctl = (struct sof_ipc4_control_msg_payload *)fragment; - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; assert_can_be_cold(); @@ -51,9 +51,9 @@ __cold int template_comp_set_config(struct processing_module *mod, } /* Not used in IPC4 systems, if IPC4 only component, omit .get_configuration set */ -__cold int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size) +__cold int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size) { assert_can_be_cold(); return 0; diff --git a/src/audio/template_comp/template.c b/src/audio/template/template.c similarity index 65% rename from src/audio/template_comp/template.c rename to src/audio/template/template.c index fcd3fa294d03..20911df27bb2 100644 --- a/src/audio/template_comp/template.c +++ b/src/audio/template/template.c @@ -12,18 +12,18 @@ /* UUID identifies the components. Use e.g. command uuidgen from package * uuid-runtime, add it to uuid-registry.txt in SOF top level. */ -SOF_DEFINE_REG_UUID(template_comp); +SOF_DEFINE_REG_UUID(template); /* Creates logging data for the component */ -LOG_MODULE_REGISTER(template_comp, CONFIG_SOF_LOG_LEVEL); +LOG_MODULE_REGISTER(template, CONFIG_SOF_LOG_LEVEL); /* Creates the compont trace. Traces show in trace console the component * info, warning, and error messages. */ -DECLARE_TR_CTX(template_comp_tr, SOF_UUID(template_comp_uuid), LOG_LEVEL_INFO); +DECLARE_TR_CTX(template_tr, SOF_UUID(template_uuid), LOG_LEVEL_INFO); /** - * template_comp_init() - Initialize the template component. + * template_init() - Initialize the template component. * @mod: Pointer to module data. * * This function is called when the instance is created. The @@ -32,13 +32,13 @@ DECLARE_TR_CTX(template_comp_tr, SOF_UUID(template_comp_uuid), LOG_LEVEL_INFO); * * Return: Zero if success, otherwise error code. */ -__cold static int template_comp_init(struct processing_module *mod) +__cold static int template_init(struct processing_module *mod) { struct module_data *md = &mod->priv; struct comp_dev *dev = mod->dev; - struct template_comp_comp_data *cd; + struct template_comp_data *cd; - comp_info(dev, "template_comp_init()"); + comp_info(dev, "template_init()"); cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(*cd)); if (!cd) @@ -49,7 +49,7 @@ __cold static int template_comp_init(struct processing_module *mod) } /** - * template_comp_process() - The audio data processing function. + * template_process() - The audio data processing function. * @mod: Pointer to module data. * @sources: Pointer to audio samples data sources array. * @num_of_sources: Number of sources in the array. @@ -61,25 +61,25 @@ __cold static int template_comp_init(struct processing_module *mod) * * Return: Zero if success, otherwise error code. */ -static int template_comp_process(struct processing_module *mod, - struct sof_source **sources, - int num_of_sources, - struct sof_sink **sinks, - int num_of_sinks) +static int template_process(struct processing_module *mod, + struct sof_source **sources, + int num_of_sources, + struct sof_sink **sinks, + int num_of_sinks) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; struct sof_source *source = sources[0]; /* One input in this example */ struct sof_sink *sink = sinks[0]; /* One output in this example */ int frames = source_get_data_frames_available(source); int sink_frames = sink_get_free_frames(sink); - comp_dbg(dev, "template_comp_process()"); + comp_dbg(dev, "template_process()"); frames = MIN(frames, sink_frames); if (cd->enable) /* Process the data with the channels swap example function. */ - return cd->template_comp_func(mod, source, sink, frames); + return cd->template_func(mod, source, sink, frames); /* Just copy from source to sink. */ source_to_sink_copy(source, sink, true, frames * cd->frame_bytes); @@ -87,7 +87,7 @@ static int template_comp_process(struct processing_module *mod, } /** - * template_comp_prepare() - Prepare the component for processing. + * template_prepare() - Prepare the component for processing. * @mod: Pointer to module data. * @sources: Pointer to audio samples data sources array. * @num_of_sources: Number of sources in the array. @@ -101,16 +101,16 @@ static int template_comp_process(struct processing_module *mod, * * Return: Value zero if success, otherwise error code. */ -static int template_comp_prepare(struct processing_module *mod, - struct sof_source **sources, int num_of_sources, - struct sof_sink **sinks, int num_of_sinks) +static int template_prepare(struct processing_module *mod, + struct sof_source **sources, int num_of_sources, + struct sof_sink **sinks, int num_of_sinks) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); struct comp_dev *dev = mod->dev; enum sof_ipc_frame source_format; int i; - comp_dbg(dev, "template_comp_prepare()"); + comp_dbg(dev, "template_prepare()"); /* The processing example in this component supports one input and one * output. Generally there can be more. @@ -127,8 +127,8 @@ static int template_comp_prepare(struct processing_module *mod, for (i = 0; i < cd->channels; i++) cd->channel_map[i] = cd->channels - i - 1; - cd->template_comp_func = template_comp_find_proc_func(source_format); - if (!cd->template_comp_func) { + cd->template_func = template_find_proc_func(source_format); + if (!cd->template_func) { comp_err(dev, "No processing function found for format %d.", source_format); return -EINVAL; @@ -138,7 +138,7 @@ static int template_comp_prepare(struct processing_module *mod, } /** - * template_comp_reset() - Reset the component. + * template_reset() - Reset the component. * @mod: Pointer to module data. * * The component reset is called when pipeline is stopped. The reset @@ -146,17 +146,17 @@ static int template_comp_prepare(struct processing_module *mod, * * Return: Value zero, always success. */ -static int template_comp_reset(struct processing_module *mod) +static int template_reset(struct processing_module *mod) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); - comp_dbg(mod->dev, "template_comp_reset()"); + comp_dbg(mod->dev, "template_reset()"); memset(cd, 0, sizeof(*cd)); return 0; } /** - * template_comp_free() - Free dynamic allocations. + * template_free() - Free dynamic allocations. * @mod: Pointer to module data. * * Component free is called when the pipelines are deleted. All @@ -166,46 +166,46 @@ static int template_comp_reset(struct processing_module *mod) * * Return: Value zero, always success. */ -__cold static int template_comp_free(struct processing_module *mod) +__cold static int template_free(struct processing_module *mod) { - struct template_comp_comp_data *cd = module_get_private_data(mod); + struct template_comp_data *cd = module_get_private_data(mod); assert_can_be_cold(); - comp_dbg(mod->dev, "template_comp_free()"); + comp_dbg(mod->dev, "template_free()"); rfree(cd); return 0; } /* This defines the module operations */ -static const struct module_interface template_comp_interface = { - .init = template_comp_init, - .prepare = template_comp_prepare, - .process = template_comp_process, - .set_configuration = template_comp_set_config, - .get_configuration = template_comp_get_config, - .reset = template_comp_reset, - .free = template_comp_free +static const struct module_interface template_interface = { + .init = template_init, + .prepare = template_prepare, + .process = template_process, + .set_configuration = template_set_config, + .get_configuration = template_get_config, + .reset = template_reset, + .free = template_free }; /* This controls build of the module. If COMP_MODULE is selected in kconfig * this is build as dynamically loadable module. */ -#if CONFIG_COMP_TEMPLATE_COMP_MODULE +#if CONFIG_COMP_TEMPLATE_MODULE #include #include #include static const struct sof_man_module_manifest mod_manifest __section(".module") __used = - SOF_LLEXT_MODULE_MANIFEST("TEMPLATE", &template_comp_interface, 1, - SOF_REG_UUID(template_comp), 40); + SOF_LLEXT_MODULE_MANIFEST("TEMPLATE", &template_interface, 1, + SOF_REG_UUID(template), 40); SOF_LLEXT_BUILDINFO; #else -DECLARE_MODULE_ADAPTER(template_comp_interface, template_comp_uuid, template_comp_tr); -SOF_MODULE_INIT(template_comp, sys_comp_module_template_comp_interface_init); +DECLARE_MODULE_ADAPTER(template_interface, template_uuid, template_tr); +SOF_MODULE_INIT(template, sys_comp_module_template_interface_init); #endif diff --git a/src/audio/template_comp/template.h b/src/audio/template/template.h similarity index 59% rename from src/audio/template_comp/template.h rename to src/audio/template/template.h index 667d95702c10..c139a492e6c0 100644 --- a/src/audio/template_comp/template.h +++ b/src/audio/template/template.h @@ -3,38 +3,38 @@ * Copyright(c) 2025 Intel Corporation. * */ -#ifndef __SOF_AUDIO_TEMPLATE_COMP_H__ -#define __SOF_AUDIO_TEMPLATE_COMP_H__ +#ifndef __SOF_AUDIO_TEMPLATE_H__ +#define __SOF_AUDIO_TEMPLATE_H__ #include #include #include /** - * struct template_comp_func - Function call pointer for process function + * struct template_func - Function call pointer for process function * @mod: Pointer to module data. * @source: Source for PCM samples data. * @sink: Sink for PCM samples data. * @frames: Number of audio data frames to process. */ -typedef int (*template_comp_func)(const struct processing_module *mod, - struct sof_source *source, - struct sof_sink *sink, - uint32_t frames); +typedef int (*template_func)(const struct processing_module *mod, + struct sof_source *source, + struct sof_sink *sink, + uint32_t frames); -/* Template_Comp component private data */ +/* Template component private data */ /** - * struct template_comp_comp_data - * @template_comp_func: Pointer to used processing function. + * struct template_comp_data + * @template_func: Pointer to used processing function. * @channels_order[]: Vector with desired sink channels order. * @source_format: Source samples format. * @frame_bytes: Number of bytes in an audio frame. * @channels: Channels count. * @enable: Control processing on/off, on - reorder channels */ -struct template_comp_comp_data { - template_comp_func template_comp_func; +struct template_comp_data { + template_func template_func; int channel_map[PLATFORM_MAX_CHANNELS]; int source_format; int frame_bytes; @@ -43,17 +43,17 @@ struct template_comp_comp_data { }; /** - * struct template_comp_proc_fnmap - processing functions for frame formats + * struct template_proc_fnmap - processing functions for frame formats * @frame_fmt: Current frame format - * @template_comp_proc_func: Function pointer for the suitable processing function + * @template_proc_func: Function pointer for the suitable processing function */ -struct template_comp_proc_fnmap { +struct template_proc_fnmap { enum sof_ipc_frame frame_fmt; - template_comp_func template_comp_proc_func; + template_func template_proc_func; }; /** - * template_comp_find_proc_func() - Find suitable processing function. + * template_find_proc_func() - Find suitable processing function. * @src_fmt: Enum value for PCM format. * * This function finds the suitable processing function to use for @@ -61,10 +61,10 @@ struct template_comp_proc_fnmap { * * Return: Pointer to processing function for the requested PCM format. */ -template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt); +template_func template_find_proc_func(enum sof_ipc_frame src_fmt); /** - * template_comp_set_config() - Handle controls set + * template_set_config() - Handle controls set * @mod: Pointer to module data. * @param_id: Id to know control type, used to know ALSA control type. * @pos: Position of the fragment in the large message. @@ -81,17 +81,17 @@ template_comp_func template_comp_find_proc_func(enum sof_ipc_frame src_fmt); * * Return: Zero if success, otherwise error code. */ -int template_comp_set_config(struct processing_module *mod, - uint32_t param_id, - enum module_cfg_fragment_position pos, - uint32_t data_offset_size, - const uint8_t *fragment, - size_t fragment_size, - uint8_t *response, - size_t response_size); +int template_set_config(struct processing_module *mod, + uint32_t param_id, + enum module_cfg_fragment_position pos, + uint32_t data_offset_size, + const uint8_t *fragment, + size_t fragment_size, + uint8_t *response, + size_t response_size); /** - * template_comp_set_config() - Handle controls get + * template_set_config() - Handle controls get * @mod: Pointer to module data. * @config_id: Configuration ID. * @data_offset_size: Size of the whole configuration if it is the first or only @@ -103,8 +103,8 @@ int template_comp_set_config(struct processing_module *mod, * * Return: Zero if success, otherwise error code. */ -int template_comp_get_config(struct processing_module *mod, - uint32_t config_id, uint32_t *data_offset_size, - uint8_t *fragment, size_t fragment_size); +int template_get_config(struct processing_module *mod, + uint32_t config_id, uint32_t *data_offset_size, + uint8_t *fragment, size_t fragment_size); -#endif // __SOF_AUDIO_TEMPLATE_COMP_H__ +#endif // __SOF_AUDIO_TEMPLATE_H__ diff --git a/src/audio/template_comp/template_comp.toml b/src/audio/template/template.toml similarity index 94% rename from src/audio/template_comp/template_comp.toml rename to src/audio/template/template.toml index c4d28b125fe3..6d41f3a599f5 100644 --- a/src/audio/template_comp/template_comp.toml +++ b/src/audio/template/template.toml @@ -5,7 +5,7 @@ REM # Template component module config [[module.entry]] name = "TEMPLATE" - uuid = UUIDREG_STR_TEMPLATE_COMP + uuid = UUIDREG_STR_TEMPLATE affinity_mask = "0x1" instance_count = "40" domain_types = "0" diff --git a/src/include/sof/audio/component.h b/src/include/sof/audio/component.h index 37515576e32c..4b360ab4eabe 100644 --- a/src/include/sof/audio/component.h +++ b/src/include/sof/audio/component.h @@ -912,8 +912,9 @@ void sys_comp_host_init(void); void sys_comp_kpb_init(void); void sys_comp_selector_init(void); -void sys_comp_module_nxp_eap_interface_init(void); +/* Start of modules in alphabetical order */ void sys_comp_module_aria_interface_init(void); +void sys_comp_module_asrc_interface_init(void); void sys_comp_module_copier_interface_init(void); void sys_comp_module_crossover_interface_init(void); void sys_comp_module_dcblock_interface_init(void); @@ -933,15 +934,16 @@ void sys_comp_module_mixin_interface_init(void); void sys_comp_module_mixout_interface_init(void); void sys_comp_module_multiband_drc_interface_init(void); void sys_comp_module_mux_interface_init(void); -void sys_comp_module_asrc_interface_init(void); +void sys_comp_module_nxp_eap_interface_init(void); void sys_comp_module_rtnr_interface_init(void); void sys_comp_module_selector_interface_init(void); void sys_comp_module_src_interface_init(void); void sys_comp_module_src_lite_interface_init(void); void sys_comp_module_tdfb_interface_init(void); -void sys_comp_module_template_comp_interface_init(void); -void sys_comp_module_volume_interface_init(void); +void sys_comp_module_template_interface_init(void); void sys_comp_module_tester_interface_init(void); +void sys_comp_module_volume_interface_init(void); +/* End of modules in alphabetical order */ #elif CONFIG_LIBRARY /* In case of shared libs components are initialised in dlopen */ diff --git a/tools/rimage/config/lnl.toml.h b/tools/rimage/config/lnl.toml.h index 030683b6ef77..0667548e1773 100644 --- a/tools/rimage/config/lnl.toml.h +++ b/tools/rimage/config/lnl.toml.h @@ -138,8 +138,8 @@ #include