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(
18 : int32_t serverType, ComponentType componentType, AdxComponentInit init, AdxComponentProcess process,
19 : AdxComponentUnInit uninit)
20 : {
21 10 : std::unique_ptr<AdxComponent> commonComponent(new (std::nothrow)
22 15 : AdxCommonComponent(init, process, uninit, componentType));
23 5 : IDE_CTRL_VALUE_FAILED(commonComponent != nullptr, return IDE_DAEMON_ERROR, "create common component error");
24 5 : return AdxRegisterComponentFunc(static_cast<drvHdcServiceType>(serverType), commonComponent);
25 5 : }
26 :
27 3 : int32_t AdxUnRegisterService(int32_t serverType, ComponentType componentType)
28 : {
29 3 : return AdxComponentServerCleanup(static_cast<drvHdcServiceType>(serverType), componentType);
30 : }
31 :
32 1 : int32_t AdxServiceStartup(ServerInitInfo info) { return AdxComponentServerStartup(info); }
33 :
34 2 : int32_t AdxServiceCleanup(int32_t serverType)
35 : {
36 2 : return AdxComponentServerCleanup(static_cast<drvHdcServiceType>(serverType));
37 : }
|