本文整理汇总了C++中SharedMemBufferPtr::GetAt方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedMemBufferPtr::GetAt方法的具体用法?C++ SharedMemBufferPtr::GetAt怎么用?C++ SharedMemBufferPtr::GetAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedMemBufferPtr
的用法示例。
在下文中一共展示了SharedMemBufferPtr::GetAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FrmwkEx
bool
CompareGolden(Golden &golden)
{
string work;
try { // The objects to perform this work throw exceptions
FileSystem::SetBaseDumpDir(false); // Log into GrpPending
if (gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY) == false)
throw FrmwkEx(HERE);
LOG_NRM("Prepare the admin Q's to setup this request");
SharedACQPtr acq = SharedACQPtr(new ACQ(gDutFd));
acq->Init(2);
SharedASQPtr asq = SharedASQPtr(new ASQ(gDutFd));
asq->Init(2);
gCtrlrConfig->SetCSS(CtrlrConfig::CSS_NVM_CMDSET);
if (gCtrlrConfig->SetState(ST_ENABLE) == false)
throw FrmwkEx(HERE);
SharedIdentifyPtr idCmd = SharedIdentifyPtr(new Identify());
SharedMemBufferPtr idMem = SharedMemBufferPtr(new MemBuffer());
idMem->InitAlignment(Identify::IDEAL_DATA_SIZE, sizeof(uint64_t), true, 0);
send_64b_bitmask prpReq =
(send_64b_bitmask)(MASK_PRP1_PAGE | MASK_PRP2_PAGE);
idCmd->SetPrpBuffer(prpReq, idMem);
for (size_t i = 0; i < golden.cmds.size(); i++) {
LOG_NRM("Identify cmd #%ld", i);
LOG_NRM(" Identify:DW1.nsid = 0x%02x", golden.cmds[i].nsid);
LOG_NRM(" Identify.DW10.cns = %c", golden.cmds[i].cns ? 'T' : 'F');
LOG_NRM(" sizeof(Identify.raw) = %ld", golden.cmds[i].raw.size());
LOG_NRM(" sizeof(Identify.mask) = %ld",
golden.cmds[i].mask.size());
LOG_NRM("Formulate an identical identify cmd to issue");
idCmd->SetCNS(golden.cmds[i].cns);
idCmd->SetNSID(golden.cmds[i].nsid);
idMem->InitAlignment(Identify::IDEAL_DATA_SIZE, sizeof(uint64_t),
true, 0);
work = str(boost::format("IdCmd%d") % i);
IO::SendAndReapCmd("tnvme", "golden", SYSTEMWIDE_CMD_WAIT_ms, asq,
acq, idCmd, work, false);
uint8_t goldenData;
uint8_t dutData;
for (size_t j = 0; j < golden.cmds[i].raw.size(); j++ ) {
goldenData = (golden.cmds[i].raw[j] & golden.cmds[i].mask[j]);
dutData = (idMem->GetAt(j) & golden.cmds[i].mask[j]);
if (goldenData != dutData) {
idMem->Dump(FileSystem::PrepDumpFile("tnvme", "golden",
"identify", "dut.miscompare"), "DUT data miscompare");
SharedMemBufferPtr userMem = SharedMemBufferPtr(
new MemBuffer(golden.cmds[i].raw));
userMem->Dump(FileSystem::PrepDumpFile("tnvme", "golden",
"identify", "cmdline.miscompare"),
"Golden user data miscompare");
LOG_ERR("golden=0x%02X, mask=0x%02X, DUT=0x%02X",
golden.cmds[i].raw[j], golden.cmds[i].mask[j],
idMem->GetAt(j));
throw FrmwkEx(HERE,
"Golden ID data miscompare @ offset = %ld", j);
}
}
}
LOG_NRM("The operation succeeded to compare golden data");
} catch (...) {
LOG_ERR("Operation failed to compare golden data");
gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY);
return false;
}
gCtrlrConfig->SetState(ST_DISABLE_COMPLETELY);
return true;
}