Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 : #include "adx_component_api_c.h"
11 : #include "server_register.h"
12 : #include "adx_common_component.h"
13 : #include "log/adx_log.h"
14 : #include "extra_config.h"
15 : #include "ascend_hal.h"
16 : using namespace Adx;
17 5 : int32_t AdxRegisterService(int32_t serverType, ComponentType componentType, AdxComponentInit init,
18 : AdxComponentProcess process, AdxComponentUnInit uninit)
19 : {
20 10 : std::unique_ptr<AdxComponent> commonComponent(new (std::nothrow)
21 15 : AdxCommonComponent(init, process, uninit, componentType));
22 5 : IDE_CTRL_VALUE_FAILED(commonComponent != nullptr, return IDE_DAEMON_ERROR, "create common component error");
23 5 : return AdxRegisterComponentFunc(static_cast<drvHdcServiceType>(serverType), commonComponent);
24 5 : }
25 :
26 3 : int32_t AdxUnRegisterService(int32_t serverType, ComponentType componentType)
27 : {
28 3 : return AdxComponentServerCleanup(static_cast<drvHdcServiceType>(serverType), componentType);
29 : }
30 :
31 1 : int32_t AdxServiceStartup(ServerInitInfo info)
32 : {
33 1 : return AdxComponentServerStartup(info);
34 : }
35 :
36 2 : int32_t AdxServiceCleanup(int32_t serverType)
37 : {
38 2 : return AdxComponentServerCleanup(static_cast<drvHdcServiceType>(serverType));
39 : }
|