本文整理汇总了C++中MemoryArea::getSize方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryArea::getSize方法的具体用法?C++ MemoryArea::getSize怎么用?C++ MemoryArea::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryArea
的用法示例。
在下文中一共展示了MemoryArea::getSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
bool MemoryManagerV3::flushAll()
{
for (unsigned int i = 0; i < this->count(); ++i)
{
MemoryArea* area = this->getMemoryArea(i);
MemoryCacheCtrl* ctrl = area->getCacheCtrl();
if (ctrl)
{
if (!ctrl->flush(0, area->getSize()))
return false;
ctrl->clear(0, area->getSize());
}
}
return true;
}
示例2: restoreRamOnExit
bool FramMemoryAccessBaseFR57<MPU>::erase(uint32_t start, uint32_t end, uint32_t block_size, int type)
{
using boost::shared_ptr;
using boost::bind;
// check if valid erase type is used
if ((type != ERASE_SEGMENT) && (type != ERASE_MAIN))
{
return false;
}
if (block_size < 1)
{
return false;
}
// if the MPU is enabled, disable it to enable memory erase
if(!mpu.readMpuSettings() || !mpu.disableMpu())
{
return false;
}
// get Device RAM parameters for funclet upload
MemoryArea* ram = mm->getMemoryArea("system", 0);
if (!ram)
{
return false;
}
if ( !uploadFunclet(FuncletCode::ERASE) )
{
return false;
}
shared_ptr<void> restoreRamOnExit(static_cast<void*>(0),
bind(&FramMemoryAccessBaseFR57<MPU>::restoreRam, this));
//Note the erase on an FRAM device is just a dummy write with 0xFFFF to the device FRAm
int32_t erase_address = start;
const FuncletCode& funclet = devHandle->getFunclet(FuncletCode::ERASE);
const uint32_t eraseType = 0;
const uint32_t eraseLength = end - start + 1;
const uint16_t flags = 0x0;
const uint16_t programStartAddress = ram->getStart() + funclet.programStartOffset();
HalExecCommand cmd;
cmd.setTimeout(10000); // overwrite 3 sec default with 10 sec
HalExecElement* el = new HalExecElement(ID_SetDeviceChainInfo);
el->appendInputData16(static_cast<uint16_t>(this->devHandle->getDevChainInfo()->getBusId()));
cmd.elements.push_back(el);
el = new HalExecElement(this->devHandle->checkHalId(ID_ExecuteFunclet));
el->appendInputData16(static_cast<uint16_t>(ram->getStart() & 0xFFFF));
el->appendInputData16(static_cast<uint16_t>(ram->getSize() & 0xFFFF));
el->appendInputData16(programStartAddress);
el->appendInputData32(static_cast<uint32_t>(erase_address));
el->appendInputData32(eraseLength);
el->appendInputData16(eraseType);
el->appendInputData16(flags);
el->appendInputData16(devHandle->getClockCalibration()->getCal0());
el->appendInputData16(devHandle->getClockCalibration()->getCal1());
//Dummy data to trigger execution of erase funclet
el->appendInputData32(0xDEADBEEF);
// set value for return length
el->setOutputSize(2);
cmd.elements.push_back(el);
if (!this->devHandle->send(cmd))
{
return false;
}
return true;
}