Sound Open Firmware
Loading...
Searching...
No Matches
system_agent.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause
2 *
3 * Copyright(c) 2022 Intel Corporation. All rights reserved.
4 */
5
6#ifndef _SYSTEM_AGENT_H
7#define _SYSTEM_AGENT_H
8
9#ifdef __cplusplus
10
12#include <system_service.h>
13
14namespace intel_adsp
15{
16namespace system
17{
24 class SystemAgent : public intel_adsp::SystemAgentInterface
25 {
26 public:
27 SystemAgent(uint32_t module_id,
28 uint32_t instance_id,
29 uint32_t core_id,
30 uint32_t log_handle);
31
33 virtual void CheckIn(intel_adsp::ProcessingModuleInterface & processing_module,
34 intel_adsp::ModuleHandle & module_handle,
35 intel_adsp::LogHandle * &log_handle) /*override*/;
36
38 virtual int CheckIn(intel_adsp::ProcessingModuleFactoryInterface & module_factory,
39 intel_adsp::ModulePlaceholder * module_placeholder,
40 size_t processing_module_size,
41 uint32_t core_id,
42 const void *obfuscated_mod_cfg,
43 void *obfuscated_parent_ppl,
44 void **obfuscated_modinst_p) /*override*/;
45
46 virtual intel_adsp::SystemService const &GetSystemService() /*override*/
47 {
48 return
49 reinterpret_cast<intel_adsp::SystemService const &>(system_service_);
50 }
51
52 virtual intel_adsp::LogHandle const &GetLogHandle() /*override*/
53 {
54 return *reinterpret_cast<intel_adsp::LogHandle const *>(&log_handle_);
55 }
56
57 private:
58 static const AdspSystemService system_service_;
59 uint32_t log_handle_;
60 uint32_t const core_id_;
61 uint32_t module_id_;
62 uint32_t instance_id_;
63 uint32_t module_size_;
64 intel_adsp::ModuleHandle * module_handle_;
65
66 }; /* class SystemAgent */
67} /* namespace system */
68} /* namespace intel_adsp */
69
70#endif /* #ifdef __cplusplus */
71
72#ifdef __cplusplus
73extern "C" {
74#endif
75/*
76 * The process of loading a IADK module is quite complicated. The function call stack is as follows:
77 *
78 * 1. IADK module adapter initialization function (modules_init) pass module entry point to the
79 * system_agent_start function.
80 *
81 * 2. system_agent_start: This function creates an instance of the SystemAgent class on the stack
82 * and then calls the module entry point function (ModuleEntryPoint) passing a pointer to the
83 * SystemAgent object as a parameter.
84 *
85 * 3. ModuleEntryPoint(system_agent): Creates a ModuleFactory object of the module on the stack
86 * (inheriting from ProcessingModuleFactoryInterface) and then calls the
87 * LoadableModuleMain(system_agent, module_factory, placeholder) function, which is the default
88 * entry point for all IADK modules. Placeholder is part of the .bss section intended for
89 * a given module instance, with its address is determined based on the instance ID.
90 *
91 * 4. LoadableModuleMain(system_agent, module_factory, placeholder): Calls the CheckIn method
92 * (variant with 7 parameters) of the SystemAgent class.
93 *
94 * 5. SystemAgent.CheckIn(7): Calls the Create method from the ModuleFactory object.
95 *
96 * 6. ModuleFactory.Create(system_agent, placeholder): Creates an instance of the module class
97 * (inheriting from ProcessingModule) at the address pointed to by placeholder.
98 * The ProcessingModule class contains a module_handle field, which reserves an area in memory
99 * of size IADK_MODULE_PASS_BUFFER_SIZE bytes. The constructor of this class calls the CheckIn
100 * method (the variant with 3 parameters) from the SystemAgent class, passing a pointer to self
101 * and a pointer to module_handle.
102 *
103 * 7. SystemAgent.CheckIn(3): Stores the address of module_handle in a private variable and
104 * creates an instance of the IadkModuleAdapter class in this location.
105 *
106 * The saved address of the module_handle (the adapter's IADK instance) is returned in the CheckIn
107 * method (the variant with 7 parameters) via a parameter that initially contained the address to
108 * the agent system. The system_agent_start function returns it in the variable adapter.
109 */
111
112int system_agent_start(const struct system_agent_params *params, const void **adapter);
113#ifdef __cplusplus
114}
115#endif
116
117#endif /* _SYSTEM_AGENT_H */
Definition module_initial_settings.h:66
Definition fixed_array.h:13
Definition native_system_agent.h:14
int system_agent_start(const struct system_agent_params *params, const void **adapter)