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 % 9 9
Test Date: 2026-07-28 12:11:00 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           72 :     ChannelCtxDataV1()
      88           72 :         : vtpHigh(0), srcPfeId{0}, startJettyIdLow{0}, startJettyIdHigh{0}, jettyNumLow{0},
      89           72 :           jettyNumHigh{0}, ioDieId{0}, dstTokenIdLow(0), dstTokenIdHigh{0}, dstTokenValueLow{0},
      90           72 :           dstTokenValueHigh{0}, dstVaLow{0}, dstVaHigher{0}, dstTokenValueValid{0}, rsv14Bits{0}
      91              :     {
      92           72 :     }
      93              : };
      94              : #pragma pack(pop)
      95              : 
      96              : class CcuChannelCtxMgrV1 : public CcuChannelCtxMgr {
      97              : public:
      98           60 :     CcuChannelCtxMgrV1(const int32_t devLogicId, const uint8_t dieId, const uint32_t devPhyId)
      99           60 :         : CcuChannelCtxMgr(devLogicId, dieId, devPhyId),
     100           60 :           jettyCtxMgr_(devLogicId, dieId, devPhyId) {};
     101              : 
     102              :     CcuChannelCtxMgrV1() = default;
     103          120 :     ~CcuChannelCtxMgrV1() override final = default;
     104              : 
     105              :     HcclResult Init() override final;
     106              : 
     107              :     HcclResult Alloc(const ChannelPara &channelPara, std::vector<ChannelInfo> &channelInfos) override final;
     108              :     HcclResult Config(const ChannelCfg &channelCfg) override final;
     109              :     HcclResult Release(const uint32_t channelId) override final;
     110              : 
     111              : private:
     112              :     CcuJettyCtxMgrV1 jettyCtxMgr_{};
     113              : };
     114              : 
     115              : }; // namespace hcomm
     116              : 
     117              : #endif
        

Generated by: LCOV version 2.0-1