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::SystemAgentInterface3
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 void *module_bss,
32 size_t module_bss_size);
33
36 intel_adsp::ModuleHandle & module_handle,
37 intel_adsp::LogHandle * &log_handle) /*override*/;
38
40 virtual void CheckInDetector(
41 DetectorModuleInterface & processing_module,
42 ModuleHandle & module_handle,
43 LogHandle * &log_handle) /*override*/;
44
46 virtual void *GetBssBase(void) /*override*/;
47
49 virtual int CheckIn(intel_adsp::ProcessingModuleFactoryInterface & module_factory,
50 intel_adsp::ModulePlaceholder * module_placeholder,
51 size_t processing_module_size,
52 uint32_t core_id,
53 const void *obfuscated_mod_cfg,
54 void *obfuscated_parent_ppl,
55 void **obfuscated_modinst_p) /*override*/;
56
57 virtual intel_adsp::SystemService const &GetSystemService() /*override*/
58 {
59 return
60 reinterpret_cast<intel_adsp::SystemService const &>(system_service_);
61 }
62
63 virtual intel_adsp::LogHandle const &GetLogHandle() /*override*/
64 {
65 return *reinterpret_cast<intel_adsp::LogHandle const *>(&log_handle_);
66 }
67
68 private:
69 static const AdspSystemService system_service_;
70 uint32_t log_handle_;
71 uint32_t const core_id_;
72 uint32_t module_id_;
73 uint32_t instance_id_;
74 void * const module_bss_;
75 size_t const module_bss_size_;
76 uint32_t module_size_;
77 intel_adsp::ModuleHandle * module_handle_;
78
79 }; /* class SystemAgent */
80} /* namespace system */
81} /* namespace intel_adsp */
82
83#endif /* #ifdef __cplusplus */
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88/*
89 * The process of loading a IADK module is quite complicated. The function call stack is as follows:
90 *
91 * 1. IADK module adapter initialization function (modules_init) pass module entry point to the
92 * system_agent_start function.
93 *
94 * 2. system_agent_start: This function creates an instance of the SystemAgent class on the stack
95 * and then calls the module entry point function (ModuleEntryPoint) passing a pointer to the
96 * SystemAgent object as a parameter.
97 *
98 * 3. ModuleEntryPoint(system_agent): Creates a ModuleFactory object of the module on the stack
99 * (inheriting from ProcessingModuleFactoryInterface) and then calls the
100 * LoadableModuleMain(system_agent, module_factory, placeholder) function, which is the default
101 * entry point for all IADK modules. Placeholder is part of the .bss section intended for
102 * a given module instance, with its address is determined based on the instance ID.
103 *
104 * 4. LoadableModuleMain(system_agent, module_factory, placeholder): Calls the CheckIn method
105 * (variant with 7 parameters) of the SystemAgent class.
106 *
107 * 5. SystemAgent.CheckIn(7): Calls the Create method from the ModuleFactory object.
108 *
109 * 6. ModuleFactory.Create(system_agent, placeholder): Creates an instance of the module class
110 * (inheriting from ProcessingModule) at the address pointed to by placeholder.
111 * The ProcessingModule class contains a module_handle field, which reserves an area in memory
112 * of size IADK_MODULE_PASS_BUFFER_SIZE bytes. The constructor of this class calls the CheckIn
113 * method (the variant with 3 parameters) from the SystemAgent class, passing a pointer to self
114 * and a pointer to module_handle.
115 *
116 * 7. SystemAgent.CheckIn(3): Stores the address of module_handle in a private variable and
117 * creates an instance of the IadkModuleAdapter class in this location.
118 *
119 * The saved address of the module_handle (the adapter's IADK instance) is returned in the CheckIn
120 * method (the variant with 7 parameters) via a parameter that initially contained the address to
121 * the agent system. The system_agent_start function returns it in the variable adapter.
122 */
124
125int system_agent_start(const struct system_agent_params *params, const void **adapter);
126#ifdef __cplusplus
127}
128#endif
129
130#endif /* _SYSTEM_AGENT_H */
The ProcessingModuleFactoryInterface class defines requirements for creating a processing module cont...
Definition processing_module_factory_interface.h:74
The ProcessingModuleInterface class defines the interface that user-defined module shall comply with ...
Definition processing_module_interface.h:165
Definition system_agent_interface.h:138
uint16_t module_id
Module ID of the originator of the notification.
Definition header.h:1
uint16_t instance_id
Instance ID of the originator module of the notification.
Definition header.h:0
Definition fixed_array.h:13
Definition base.h:103
Definition native_system_agent.h:14
int system_agent_start(const struct system_agent_params *params, const void **adapter)