data: publish complete Calculet NPU research archive
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <CLI11.hpp>
|
||||
|
||||
#include "calrt.hpp"
|
||||
#include "protocol.hpp"
|
||||
|
||||
namespace calrt
|
||||
{
|
||||
namespace calrtcli
|
||||
{
|
||||
class CalrtCLICommand
|
||||
{
|
||||
public:
|
||||
CalrtCLICommand(CLI::App *app);
|
||||
void parse_calbin();
|
||||
void check_job_queue();
|
||||
void reset();
|
||||
void show_devices();
|
||||
void refresh();
|
||||
void check_used_mem();
|
||||
void check_total_mem();
|
||||
void check_ccu_status();
|
||||
void check_d2d_status();
|
||||
|
||||
#ifdef SUPEROWNER
|
||||
void resetCCU();
|
||||
void read_mem();
|
||||
void write_mem();
|
||||
void read_reg();
|
||||
void write_reg();
|
||||
void read_reg_bar4();
|
||||
void write_reg_bar4();
|
||||
|
||||
/**
|
||||
* @brief read remote chip data
|
||||
*
|
||||
* @details 1. pre-check d2d registry
|
||||
* 1.1 check chip0 d2d registry
|
||||
* 1.2 check chipx d2d registry
|
||||
* 2. gen cmd to broadcast chipx to chip 0
|
||||
* 2.1 gen cmd to let chip0 to broadcast chipx cmd
|
||||
*/
|
||||
void config_d2d_data();
|
||||
// void config_d2d_cmd();
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
void GetChipMaskFromId(uint32_t id, std::vector<uint32_t> &chipMask);
|
||||
|
||||
void StartJob(calrt::CalrtDevice *pDevice, uint64_t jobAddr, uint64_t jobSize);
|
||||
|
||||
void WaitJobDone(calrt::CalrtDevice *pDevice);
|
||||
|
||||
int d2d_transfer_impl();
|
||||
|
||||
struct D2dPack
|
||||
{
|
||||
uint32_t lowMask = 0;
|
||||
uint32_t midMask = 0;
|
||||
uint32_t highMask = 0;
|
||||
uint64_t srcAddr = 0;
|
||||
uint64_t dstAddr = 0;
|
||||
uint64_t size = 0;
|
||||
};
|
||||
|
||||
CLI::App *mApp;
|
||||
uint64_t mAddr = 0;
|
||||
uint64_t mSize = 0;
|
||||
uint64_t mOffset = 0;
|
||||
uint64_t mData64 = 0;
|
||||
uint32_t mData = 0;
|
||||
uint32_t mChipId = 0;
|
||||
D2dPack mD2dpkg;
|
||||
uint8_t mId = 0;
|
||||
std::string mPath;
|
||||
|
||||
|
||||
};
|
||||
} // namespace calrtcli
|
||||
} // namespace calrt
|
||||
Reference in New Issue
Block a user