LCOV - code coverage report
Current view: top level - legacy/ascend950/unified_platform/ccu/ccu_device - ccu_driver_handle.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 42.1 % 19 8
Test Date: 2026-07-28 12:11:00 Functions: 66.7 % 3 2

            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              : 
      11              : #include "ccu_driver_handle.h"
      12              : #include "hccp_tlv_hdc_manager.h"
      13              : #include "hccp_tlv.h"
      14              : 
      15              : #include "ccu_context_mgr_imp.h"
      16              : #include "ccu_res_batch_allocator.h"
      17              : #include "ccu_component.h"
      18              : #include "ccu_res_specs.h"
      19              : 
      20              : namespace Hccl {
      21              : 
      22            2 : CcuDriverHandle::CcuDriverHandle(s32 deviceLogicId) : devLogicId(deviceLogicId)
      23              : {
      24            2 : }                                                                                                                                   
      25              : 
      26            2 : CcuDriverHandle::~CcuDriverHandle()
      27              : {
      28            6 :     HCCL_RUN_INFO("Start destorying CCU, deviceLogicId: %d", devLogicId);
      29              : 
      30            6 :     HCCL_INFO("Start destorying CCU, deviceLogicId: %d", devLogicId);
      31              : 
      32            2 :     DECTOR_TRY_CATCH("CcuDriverHandle", {
      33              :         // 清理ccu平台层持有的资源与缓存信息
      34              :         CtxMgrImp::GetInstance(devLogicId).Deinit();
      35              :         CcuResBatchAllocator::GetInstance(devLogicId).Deinit();
      36              :         CcuComponent::GetInstance(devLogicId).Deinit();
      37              :         CcuResSpecifications::GetInstance(devLogicId).Deinit();
      38              :         // 关闭ccu驱动通道
      39              :         auto tlvHandle = HccpTlvHdcManager::GetInstance().GetTlvHandle(devLogicId);
      40              :         HrtRaTlvRequest(tlvHandle, TLV_MODULE_TYPE_CCU, MSG_TYPE_CCU_UNINIT);
      41              :     });
      42              : 
      43            6 :     HCCL_INFO("Destory CCU success, deviceLogicId: %d", devLogicId);
      44            2 : }
      45              : 
      46            0 : HcclResult CcuDriverHandle::Init() const
      47              : {
      48            0 :     HCCL_RUN_INFO("Start initiating CCU, deviceLogicId: %d", devLogicId);
      49              : 
      50            0 :     auto tlvHandle = HccpTlvHdcManager::GetInstance().GetTlvHandle(devLogicId);
      51            0 :     if (HrtRaTlvRequest(tlvHandle, TLV_MODULE_TYPE_CCU, MSG_TYPE_CCU_INIT) == HCCL_E_UNAVAIL) {
      52            0 :         return HCCL_E_UNAVAIL;
      53              :     }
      54              : 
      55            0 :     CcuResSpecifications::GetInstance(devLogicId).Init();
      56            0 :     CcuComponent::GetInstance(devLogicId).Init();
      57            0 :     CcuResBatchAllocator::GetInstance(devLogicId).Init();
      58            0 :     CtxMgrImp::GetInstance(devLogicId).Init();
      59              : 
      60            0 :     HCCL_INFO("Init CCU success, deviceLogicId: %d", devLogicId);
      61            0 :     return HcclResult::HCCL_SUCCESS;
      62              : }
      63              : 
      64              : } // namespace Hccl
        

Generated by: LCOV version 2.0-1