LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_device/ccu_comp/ccu_channel - ccu_channel_ctx_mgr.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 3 3
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              : #ifndef CCU_CHANNEL_CTX_MGR_H
      12              : #define CCU_CHANNEL_CTX_MGR_H
      13              : 
      14              : #include <vector>
      15              : #include <mutex>
      16              : 
      17              : #include "hccl_types.h"
      18              : #include "ccu_dev_mgr_imp.h"
      19              : 
      20              : namespace hcomm {
      21              : 
      22              : constexpr uint32_t MASK_VTP      = 0xFFFF0000;
      23              : constexpr uint32_t MASK_VTP_LOW  = 0x0000FFFF;
      24              : constexpr uint32_t MASK_VTP_HIGH = 0x000000FF;
      25              : 
      26              : struct ChannelResInfo {
      27              :     bool allocated{false};
      28              :     uint32_t feId{0};
      29              :     ChannelInfo channelInfo{};
      30              : };
      31              : 
      32              : void DumpChannelResInfo(const uint32_t feId, const ChannelInfo &info);
      33              : bool IsEidEmpty(const uint8_t (&eidRaw)[URMA_EID_LEN]);
      34              : 
      35              : class CcuChannelCtxMgr {
      36              : public:
      37           75 :     CcuChannelCtxMgr(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId)
      38           75 :         : devLogicId_(devLogicId), dieId_(dieId), devPhyId_(devPhyId) {};
      39              :     CcuChannelCtxMgr() = default;
      40           75 :     virtual ~CcuChannelCtxMgr() = default;
      41              : 
      42              :     virtual HcclResult Init() = 0;
      43              : 
      44              :     virtual HcclResult Alloc(const ChannelPara &channelPara, std::vector<ChannelInfo> &channelInfos) = 0;
      45              :     virtual HcclResult Config(const ChannelCfg &channelCfg) = 0;
      46              :     virtual HcclResult Release(const uint32_t channelId) = 0;
      47              : 
      48              : protected:
      49              :     bool CheckIfChannelAllocated(const uint32_t channelId) const;
      50              : 
      51              : protected:
      52              :     std::mutex innerMutex_{};
      53              :     int32_t devLogicId_{0};
      54              :     uint8_t  dieId_{0};
      55              :     uint32_t devPhyId_{0};
      56              : 
      57              :     std::vector<ChannelResInfo> channelResInfos_;
      58              : };
      59              : 
      60              : } // namespace hcomm
      61              : 
      62              : #endif // CCU_CHANNEL_CTX_MGR_H
        

Generated by: LCOV version 2.0-1