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 11 #include <processing_module_factory_interface.h> 12 #include <system_service.h> 13 14 namespace intel_adsp 15 { 16 namespace system 17 { 18 /*! \brief The SystemAgent is a mediator to allow the custom module to interact 19 * with the base FW 20 * 21 * A SystemAgent can only be delivered by the ADSP System. 22 * Once registered, a ModuleHandle instance can be handled by the ADSP System. 23 */ 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 32 /*! \brief Initializes a new instance of ModuleAdapter in the ModuleHandle buffer*/ 33 virtual void CheckIn(intel_adsp::ProcessingModuleInterface & processing_module, 34 intel_adsp::ModuleHandle & module_handle, 35 intel_adsp::LogHandle * &log_handle) /*override*/; 36 37 /*! \return a value part of error code list defined within the adsp_error.h*/ 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 GetSystemService()46 virtual intel_adsp::SystemService const &GetSystemService() /*override*/ 47 { 48 return 49 reinterpret_cast<intel_adsp::SystemService const &>(system_service_); 50 } 51 GetLogHandle()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 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 73 extern "C" { 74 #endif 75 void *system_agent_start(uint32_t entry_point, uint32_t module_id, uint32_t instance_id, 76 uint32_t core_id, uint32_t log_handle, void *mod_cfg); 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif /* _SYSTEM_AGENT_H */ 82