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


C++ HeaderList::getHead方法代码示例

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


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

示例1:

void *khrn_hw_unaddr(uint32_t addr)
{
	ghw_error_e result;
#ifdef FILE_DUMP
	fprintf(fp_dump, "khrn_hw_unaddr %x\n", addr);
#endif
	void* virt;
	unsigned int phys = (unsigned int) addr;
	HeaderNode* head = mem_list.getHead();

	while (head != NULL) {
		MemHeader* header = head->get();
		unsigned int pa = (unsigned int)header->getPhys();
		if ( (pa <= phys) && (phys <= pa + header->getSize()) ) {
				return ((unsigned char*)header->getVirt()) + (phys-pa);
			}
		head = head->getNext();
	}

	result = mem_allocator->phys2virt(phys, (void*&)virt);
	if (result != GHW_ERROR_NONE) {
		mem_allocator1->phys2virt(phys, (void*&)virt);
	}	
	return virt;
}
开发者ID:kevleyski,项目名称:challenge,代码行数:25,代码来源:rtos_common_mem.cpp

示例2: khrn_hw_addr

unsigned int khrn_hw_addr(const void *addr)
{
	ghw_error_e result;
#ifdef FILE_DUMP
	fprintf(fp_dump, "khrn_hwaddr %x\n", addr);
#endif
	u32 phys;
	unsigned int virt = (unsigned int) addr;
	HeaderNode* head = mem_list.getHead();

	while (head != NULL) {
		MemHeader* header = head->get();
		unsigned int va = (unsigned int)header->getVirt();
		if ( (va <= virt) && (virt <= va + header->getSize()) ) {
				unsigned int out = header->getPhys() + (virt-va);

				if (out == 0)
					printf("input of %p out of ZERO!\n", addr);

				return out;
			}
		head = head->getNext();
	}

	result = mem_allocator->virt2phys(phys, (void*)virt);
	if (result != GHW_ERROR_NONE) {
		result = mem_allocator1->virt2phys(phys, (void*)virt);
	}	

	if (phys == 0)
		printf("input of %p out of ZERO!\n", addr);

	return phys;
}
开发者ID:kevleyski,项目名称:challenge,代码行数:34,代码来源:rtos_common_mem.cpp

示例3: mem_free_legacy

void mem_free_legacy(void *ptr)
{
#ifdef FILE_DUMP
	fprintf(fp_dump, "mem_free_legacy %x\n", ptr);
#endif
	u32 phys;
	unsigned int virt = (unsigned int) ptr;
	HeaderNode* head = mem_list.getHead();
	while (head != NULL) {
		MemHeader* header = head->get();
		unsigned int va = (unsigned int)header->getVirt();
		if ( (va <= virt) && (virt <= va + header->getSize()) ) {
				header->release();
				break;
			}
		head = head->getNext();
	}
}
开发者ID:kevleyski,项目名称:challenge,代码行数:18,代码来源:rtos_common_mem.cpp


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