LCOV - code coverage report
Current view: top level - base_comm/resources/ccu/ccu_dfx - ccu_error_info_v2.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 16 16
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 7 7

            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_ERROR_INFO_V2_H
      12              : #define CCU_ERROR_INFO_V2_H
      13              : #include <cstdint>
      14              : 
      15              : namespace hcomm {
      16              : 
      17              : struct CcuLoopContextV2 {
      18              :     union {
      19              :         uint16_t value;
      20              :         uint16_t xnOffset;
      21              :     } part0;
      22              : 
      23              :     union {
      24              :         uint16_t value;
      25              :         struct {
      26              :             uint16_t ckeOffset : 12;
      27              :             uint16_t msOffset : 4;
      28              :         };
      29              :     } part1;
      30              : 
      31              :     union {
      32              :         uint16_t value;
      33              :         struct {
      34              :             uint16_t msOffset : 7;
      35              :             uint16_t addrOffset : 9;
      36              :         };
      37              :     } part2;
      38              : 
      39              :     union {
      40              :         uint16_t value;
      41              :         uint16_t addrOffset;
      42              :     } part3;
      43              : 
      44              :     union {
      45              :         uint16_t value;
      46              :         struct {
      47              :             uint16_t addrOffset : 7;
      48              :             uint16_t currentIns : 9;
      49              :         };
      50              :     } part4;
      51              : 
      52              :     union {
      53              :         uint16_t value;
      54              :         struct {
      55              :             uint16_t currentIns : 7;
      56              :             uint16_t addrStride : 9;
      57              :         };
      58              :     } part5;
      59              : 
      60              :     union {
      61              :         uint16_t value;
      62              :         uint16_t addrStride;
      63              :     } part6;
      64              : 
      65              :     union {
      66              :         uint16_t value;
      67              :         struct {
      68              :             uint16_t addrStride : 7;
      69              :             uint16_t loopWishCheckBit : 9;
      70              :         };
      71              :     } part7;
      72              : 
      73              :     union {
      74              :         uint16_t value;
      75              :         struct {
      76              :             uint16_t loopWishCheckBit : 7;
      77              :             uint16_t waitLoopCheckBit : 9;
      78              :         };
      79              :     } part8;
      80              : 
      81              :     union {
      82              :         uint16_t value;
      83              :         struct {
      84              :             uint16_t waitLoopCheckBit : 7;
      85              :             uint16_t waitLoopCheckBitVld : 1;
      86              :             uint16_t loopMode : 1;
      87              :             uint16_t denyCnt : 7;
      88              :         };
      89              :     } part9;
      90              : 
      91              :     union {
      92              :         uint16_t value;
      93              :         struct {
      94              :             uint16_t denyCnt : 3;
      95              :             uint16_t currentCnt : 13;
      96              :         };
      97              :     } part10;
      98              : 
      99              :     union {
     100              :         uint16_t value;
     101              :         struct {
     102              :             uint16_t totalCnt : 13;
     103              :             uint16_t endIns : 3;
     104              :         };
     105              :     } part11;
     106              : 
     107              :     union {
     108              :         uint16_t value;
     109              :         struct {
     110              :             uint16_t endIns : 13;
     111              :             uint16_t startIns : 3;
     112              :         };
     113              :     } part12;
     114              : 
     115              :     union {
     116              :         uint16_t value;
     117              :         struct {
     118              :             uint16_t startIns : 13;
     119              :             uint16_t missionId : 3;
     120              :         };
     121              :     } part13;
     122              : 
     123              :     union {
     124              :         uint16_t value;
     125              :         struct {
     126              :             uint16_t missionId : 1;
     127              :             uint16_t loopVld : 1;
     128              :             uint16_t mprofileen : 1;
     129              :             uint16_t reserved : 13;
     130              :         };
     131              :     } part14;
     132              :     uint16_t reserved[17];
     133              : 
     134            1 :     uint16_t GetCurrentIns() const
     135              :     {
     136            1 :         return (part5.currentIns << 9) | (part4.currentIns); // 偏移9位
     137              :     }
     138              : 
     139            2 :     uint16_t GetCurrentCnt() const { return part10.currentCnt; }
     140              : 
     141            2 :     uint32_t GetAddrStride() const
     142              :     {
     143            2 :         const uint32_t low = static_cast<uint32_t>(part5.addrStride);
     144            2 :         const uint32_t mid = static_cast<uint32_t>(part6.addrStride) << 9;   // 偏移9位
     145            2 :         const uint32_t high = static_cast<uint32_t>(part7.addrStride) << 25; // 偏移25位
     146            2 :         return high | mid | low;
     147              :     }
     148              : };
     149              : 
     150              : struct CcuMissionContextV2 {
     151              :     union {
     152              :         uint16_t value;
     153              :         uint16_t taskIdRaw; // same hw register as V1::taskId
     154              :     } part0;
     155              : 
     156              :     union {
     157              :         uint16_t value;
     158              :         uint16_t streamIdRaw; // same hw register as V1::streamId
     159              :     } part1;
     160              : 
     161              :     union {
     162              :         uint16_t value;
     163              :         struct {
     164              :             uint16_t taskKillRaw : 1;
     165              :             uint16_t dieIdRaw : 2;
     166              :             uint16_t statusLo : 13;
     167              :         };
     168              :     } part2;
     169              : 
     170              :     union {
     171              :         uint16_t value;
     172              :         struct {
     173              :             uint16_t statusHi : 3;
     174              :             uint16_t counter : 10;
     175              :             uint16_t denyCnt : 3;
     176              :         };
     177              :     } part3;
     178              : 
     179              :     union {
     180              :         uint16_t value;
     181              :         struct {
     182              :             uint16_t denyCnt : 7;
     183              :             uint16_t currentIns : 9;
     184              :         };
     185              :     } part4;
     186              : 
     187              :     union {
     188              :         uint16_t value;
     189              :         struct {
     190              :             uint16_t currentIns : 7;
     191              :             uint16_t endIns : 9;
     192              :         };
     193              :     } part5;
     194              : 
     195              :     union {
     196              :         uint16_t value;
     197              :         struct {
     198              :             uint16_t endIns : 7;
     199              :             uint16_t startIns : 9;
     200              :         };
     201              :     } part6;
     202              : 
     203              :     union {
     204              :         uint16_t value;
     205              :         struct {
     206              :             uint16_t startIns : 7;
     207              :             uint16_t profileEn : 1;
     208              :             uint16_t missionVld : 1;
     209              :             uint16_t cqeInfoPart1 : 7;
     210              :         };
     211              :     } part7;
     212              : 
     213              :     union {
     214              :         uint16_t value;
     215              :         uint16_t cqeInfoPart2;
     216              :     } part8;
     217              : 
     218              :     union {
     219              :         uint16_t value;
     220              :         uint16_t cqeInfoPart3;
     221              :     } part9;
     222              : 
     223              :     union {
     224              :         uint16_t value;
     225              :         uint16_t cqeInfoPart4;
     226              :     } part10;
     227              : 
     228              :     union {
     229              :         uint16_t value;
     230              :         uint16_t cqeInfoPart5;
     231              :     } part11;
     232              : 
     233              :     union {
     234              :         uint16_t value;
     235              :         uint16_t cqeInfoPart6;
     236              :     } part12;
     237              : 
     238              :     union {
     239              :         uint16_t value;
     240              :         struct {
     241              :             uint16_t cqeInfoPart7 : 9;
     242              :             uint16_t reserved : 7;
     243              :         };
     244              :     } part13;
     245              : 
     246              :     uint16_t reserved[18];
     247              : 
     248            1 :     uint16_t GetStatus() const
     249              :     {
     250            1 :         return (part3.statusHi << 13) | (part2.statusLo); // 偏移13位
     251              :     }
     252              : 
     253            2 :     uint16_t GetCurrentIns() const
     254              :     {
     255            2 :         return (part5.currentIns << 9) | (part4.currentIns); // 偏移9位
     256              :     }
     257              : 
     258            2 :     uint16_t GetStartIns() const
     259              :     {
     260            2 :         return (part7.startIns << 9) | (part6.startIns); // 偏移9位
     261              :     }
     262              : 
     263            2 :     uint16_t GetEndIns() const
     264              :     {
     265            2 :         return (part6.endIns << 9) | (part5.endIns); // 偏移9位
     266              :     }
     267              : };
     268              : 
     269              : } // namespace hcomm
     270              : 
     271              : #endif // CCU_ERROR_INFO_V2_H
        

Generated by: LCOV version 2.0-1