LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_device/ccu_comp/ccu_channel/ccu_channel_ctx_v1 - ccu_channel_ctx_mgr_v1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 21 21
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 4 4

            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_V1_H
      12              : #define CCU_CHANNEL_CTX_MGR_V1_H
      13              : 
      14              : #include "ccu_channel_ctx_mgr.h"
      15              : #include "ccu_jetty_ctx_mgr_v1.h"
      16              : 
      17              : namespace hcomm {
      18              : 
      19              : constexpr uint16_t TOKEN_VALUE_VALID = 1;
      20              : constexpr uint16_t REMOTE_CCU_VA_RIGHT_SHIFT_NUM = 23;
      21              : 
      22              : constexpr uint16_t MASK_START_JETTY_ID_LOW = 0x000F;
      23              : constexpr uint16_t MASK_START_JETTY_ID_HIGH = 0x0FFF;
      24              : 
      25              : constexpr uint8_t MASK_JETTY_NUM_LOW = 0x000F;
      26              : constexpr uint8_t MASK_JETTY_NUM_HIGH = 0x0007;
      27              : 
      28              : constexpr uint32_t MASK_TOKEN_ID_LOW = 0x00000FFF;
      29              : constexpr uint32_t MASK_TOKEN_ID_HIGH = 0x000000FF;
      30              : 
      31              : constexpr uint32_t MASK_TOKEN_VALUE_LOW = 0x000000FF;
      32              : constexpr uint32_t MASK_TOKEN_VALUE_MID = 0x0000FFFF;
      33              : constexpr uint32_t MASK_TOKEN_VALUE_HIGH = 0x000000FF;
      34              : 
      35              : constexpr uint64_t MASK_VA_LOW = 0x00000000000000FF;
      36              : constexpr uint64_t MASK_VA_MID = 0x000000000000FFFF;
      37              : constexpr uint64_t MASK_VA_HIGH = 0x000000000000FFFF;
      38              : constexpr uint64_t MASK_VA_HIGHER = 0x0000000000000001;
      39              : 
      40              : #pragma pack(push, 1)
      41              : struct ChannelCtxDataV1 {
      42              :     uint8_t eidRaw[URMA_EID_LEN] = {0};
      43              :     /********16 Bytes**********/
      44              : 
      45              :     uint16_t vtpLow{0};
      46              :     /********18 Bytes**********/
      47              : 
      48              :     uint16_t vtpHigh : 8;
      49              :     uint16_t srcPfeId : 4;
      50              :     uint16_t startJettyIdLow : 4;
      51              :     /********20 Bytes**********/
      52              : 
      53              :     uint16_t startJettyIdHigh : 12;
      54              :     uint16_t jettyNumLow : 4;
      55              :     /********22 Bytes**********/
      56              : 
      57              :     uint16_t jettyNumHigh : 3;
      58              :     uint16_t ioDieId : 1;
      59              :     uint16_t dstTokenIdLow : 12;
      60              :     /********24 Bytes**********/
      61              : 
      62              :     uint16_t dstTokenIdHigh : 8;
      63              :     uint16_t dstTokenValueLow : 8;
      64              :     /********26 Bytes**********/
      65              : 
      66              :     uint16_t dstTokenValueMiddle{0};
      67              :     /********28 Bytes**********/
      68              : 
      69              :     uint16_t dstTokenValueHigh : 8;
      70              :     uint16_t dstVaLow : 8;
      71              :     /********30 Bytes**********/
      72              : 
      73              :     uint16_t dstVaMiddle{0};
      74              :     /********32 Bytes**********/
      75              : 
      76              :     uint16_t dstVaHigh{0};
      77              :     /********34 Bytes**********/
      78              : 
      79              :     uint16_t dstVaHigher : 1;
      80              :     uint16_t dstTokenValueValid : 1;
      81              :     uint16_t rsv14Bits : 14;
      82              :     /********36 Bytes**********/
      83              : 
      84              :     uint16_t rsvs[14] = {0};
      85              :     /********64 Bytes**********/
      86              : 
      87          183 :     ChannelCtxDataV1()
      88          183 :         : vtpHigh(0),
      89          183 :           srcPfeId{0},
      90          183 :           startJettyIdLow{0},
      91          183 :           startJettyIdHigh{0},
      92          183 :           jettyNumLow{0},
      93          183 :           jettyNumHigh{0},
      94          183 :           ioDieId{0},
      95          183 :           dstTokenIdLow(0),
      96          183 :           dstTokenIdHigh{0},
      97          183 :           dstTokenValueLow{0},
      98          183 :           dstTokenValueHigh{0},
      99          183 :           dstVaLow{0},
     100          183 :           dstVaHigher{0},
     101          183 :           dstTokenValueValid{0},
     102          183 :           rsv14Bits{0}
     103          183 :     {}
     104              : };
     105              : #pragma pack(pop)
     106              : 
     107              : class CcuChannelCtxMgrV1 : public CcuChannelCtxMgr {
     108              : public:
     109          170 :     CcuChannelCtxMgrV1(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId)
     110          170 :         : CcuChannelCtxMgr(devLogicId, dieId, devPhyId),
     111          170 :           jettyCtxMgr_(devLogicId, dieId, devPhyId) {};
     112              : 
     113              :     CcuChannelCtxMgrV1() = default;
     114          340 :     ~CcuChannelCtxMgrV1() override final = default;
     115              : 
     116              :     HcclResult Init() override final;
     117              : 
     118              :     HcclResult Alloc(const ChannelPara& channelPara, std::vector<ChannelInfo>& channelInfos) override final;
     119              :     HcclResult Config(const ChannelCfg& channelCfg) override final;
     120              :     HcclResult Release(const uint32_t channelId) override final;
     121              : 
     122              : private:
     123              :     CcuJettyCtxMgrV1 jettyCtxMgr_{};
     124              : };
     125              : 
     126              : }; // namespace hcomm
     127              : 
     128              : #endif
        

Generated by: LCOV version 2.0-1