当前位置: 首页>>代码示例>>C++>>正文


C++ MemoryArea::getStart方法代码示例

本文整理汇总了C++中MemoryArea::getStart方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryArea::getStart方法的具体用法?C++ MemoryArea::getStart怎么用?C++ MemoryArea::getStart使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MemoryArea的用法示例。


在下文中一共展示了MemoryArea::getStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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;
}
开发者ID:AlessonDavid,项目名称:libMSP430,代码行数:74,代码来源:FramMemoryAccessBaseFR57.cpp


注:本文中的MemoryArea::getStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。