LCOV - code coverage report
Current view: top level - legacy/ascend950/framework/communicator/aicpu - hdc_lite.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2026-08-18 17:47:01 Functions: 100.0 % 1 1

            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 HCCLV2_HDC_LITE_H
      12              : #define HCCLV2_HDC_LITE_H
      13              : 
      14              : #include <mutex>
      15              : #include <memory>
      16              : #include "hdc_param.h"
      17              : #include "buffer.h"
      18              : #include "types.h"
      19              : 
      20              : namespace Hccl {
      21              : // HDCommunicateLite为device侧提供host和device之间的单向通道;如接收端未及时读取buffer中的数据,可能会导致数据丢失,需要使用者自行确保收发两端的应答确认机制。
      22              : 
      23              : class HDCommunicateLite {
      24              : public:
      25          168 :     HDCommunicateLite() = default;
      26              : 
      27              :     HcclResult Init(const struct HDCommunicateParams& params);
      28              : 
      29              :     HcclResult Put(u32 offset, u32 length, u8* value);
      30              : 
      31              :     HcclResult Get(u32 offset, u32 length, u8* value);
      32              : 
      33              : private:
      34              :     HcclResult Write(u32 offset, u32 length, u8* value);
      35              :     HcclResult Read(u32 offset, u32 length, u8* value);
      36              :     HcclResult UpdateCache(u32 timeoutSec);
      37              : 
      38              :     std::unique_ptr<Buffer> devMem;
      39              :     u32 deviceLogicId{0xFFFFFFFF};
      40              :     u32 flag{HCCLV2_HDC_TYPE_D2H};
      41              :     u32 buffLen{0};
      42              : 
      43              :     void* readCacheAddr{nullptr};
      44              :     u32* headCntAddr{nullptr};
      45              :     u32* tailCntAddr{nullptr};
      46              :     u32* devHeadCntAddr{nullptr};
      47              :     u32* devTailCntAddr{nullptr};
      48              :     std::mutex shmLock;
      49              : };
      50              : } // namespace Hccl
      51              : #endif // HCCLV2_HDC_LITE_H
        

Generated by: LCOV version 2.0-1