• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ LE32TOH函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中LE32TOH函数的典型用法代码示例。如果您正苦于以下问题:C++ LE32TOH函数的具体用法?C++ LE32TOH怎么用?C++ LE32TOH使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: pibchain2

static signed pibchain2 (void const * memory, char const * filename, flag_t flags) 

{
	struct nvm_header2 * nvm_header;
	size_t origin = ~0;
	size_t offset = 0;
	signed module = 0;
	do 
	{
		nvm_header = (struct nvm_header2 *)((char *)(memory) + offset);
		if (LE16TOH (nvm_header->MajorVersion) != 1) 
		{
			if (_allclr (flags, NVM_SILENCE)) 
			{
				error (0, errno, NVM_HDR_VERSION, filename, module);
			}
			return (-1);
		}
		if (LE16TOH (nvm_header->MinorVersion) != 1) 
		{
			if (_allclr (flags, NVM_SILENCE)) 
			{
				error (0, errno, NVM_HDR_VERSION, filename, module);
			}
			return (-1);
		}
		if (LE32TOH (nvm_header->PrevHeader) != origin) 
		{
			if (_allclr (flags, NVM_SILENCE)) 
			{
				error (0, errno, NVM_HDR_LINK, filename, module);
			}
			return (-1);
		}
		if (checksum32 (nvm_header, sizeof (* nvm_header), 0)) 
		{
			error (0, 0, NVM_HDR_CHECKSUM, filename, module);
			return (-1);
		}
		origin = offset;
		offset += sizeof (* nvm_header);
		if (LE32TOH (nvm_header->ImageType) == NVM_IMAGE_PIB) 
		{
			pibpeek2 ((char *)(memory) + offset);
			break;
		}
		if (checksum32 ((char *)(memory) + offset, LE32TOH (nvm_header->ImageLength), nvm_header->ImageChecksum)) 
		{
			if (_allclr (flags, NVM_SILENCE)) 
			{
				error (0, errno, NVM_IMG_CHECKSUM, filename, module);
			}
			return (-1);
		}
		offset += LE32TOH (nvm_header->ImageLength);
		module++;
	}
	while (~nvm_header->NextHeader);
	return (0);
}
开发者ID:tcdog001,项目名称:apv5sdk-v15,代码行数:60,代码来源:Identity2.c


示例2: pibfile2

signed pibfile2 (struct _file_ const * file)

{
	struct nvm_header2 nvm_header;
	uint32_t origin = ~0;
	uint32_t offset = 0;
	unsigned module = 0;
	if (lseek (file->file, 0, SEEK_SET))
	{
		error (1, errno, FILE_CANTHOME, file->name);
	}
	do
	{
		if (read (file->file, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header))
		{
			error (1, errno, NVM_HDR_CANTREAD, file->name, module);
		}
		if (LE16TOH (nvm_header.MajorVersion) != 1)
		{
			error (1, errno, NVM_HDR_VERSION, file->name, module);
		}
		if (LE16TOH (nvm_header.MinorVersion) != 1)
		{
			error (1, errno, NVM_HDR_VERSION, file->name, module);
		}
		if (checksum32 (&nvm_header, sizeof (nvm_header), 0))
		{
			error (1, errno, NVM_HDR_CHECKSUM, file->name, module);
		}
		if (LE32TOH (nvm_header.PrevHeader) != origin)
		{
			error (1, errno, NVM_HDR_LINK, file->name, module);
		}
		if (LE32TOH (nvm_header.ImageType) == NVM_IMAGE_PIB)
		{
			if (fdchecksum32 (file->file, LE32TOH (nvm_header.ImageLength), nvm_header.ImageChecksum))
			{
				error (1, errno, NVM_IMG_CHECKSUM, file->name, module);
			}
			if (lseek (file->file, 0, SEEK_SET))
			{
				error (1, errno, FILE_CANTHOME, file->name);
			}
			return (0);
		}
		if (fdchecksum32 (file->file, LE32TOH (nvm_header.ImageLength), nvm_header.ImageChecksum))
		{
			error (1, errno, NVM_IMG_CHECKSUM, file->name, module);
		}
		origin = offset;
		offset = LE32TOH (nvm_header.NextHeader);
		module++;
	}
	while (~nvm_header.NextHeader);
	if (lseek (file->file, 0, SEEK_SET))
	{
		error (1, errno, FILE_CANTHOME, file->name);
	}
	return (-1);
}
开发者ID:GSLyons,项目名称:open-plc-utils,代码行数:60,代码来源:pibfile2.c


示例3: nvmimage2

static signed nvmimage2 (void const * memory, size_t extent, char const * filename, flag_t flags)

{
	struct nvm_header1 * nvm_header;
	unsigned module = 0;
	uint32_t offset = 0;
	do
	{
		nvm_header = (struct nvm_header1 *)((char *)(memory) + offset);
		if (LE32TOH (nvm_header->HEADERVERSION) != 0x60000000)
		{
			if (_allclr (flags, NVM_SILENCE))
			{
				error (0, errno, NVM_HDR_VERSION, filename, module);
			}
			return (-1);
		}
		if (checksum32 (nvm_header, sizeof (* nvm_header), 0))
		{
			if (_allclr (flags, NVM_SILENCE))
			{
				error (0, errno, NVM_HDR_CHECKSUM, filename, module);
			}
			return (-1);
		}
		offset += sizeof (* nvm_header);
		extent -= sizeof (* nvm_header);
		if (_anyset (flags, NVM_VERBOSE))
		{
			printf ("------- %s (%d) -------\n", filename, module);
			nvmpeek1 (nvm_header);
		}
		if (LE32TOH (nvm_header->IMAGETYPE) == NVM_IMAGE_FIRMWARE)
		{
			firmware (filename, module, (char *)(memory) + offset, 0x70, flags);
		}
		if (checksum32 ((char *)(memory) + offset, LE32TOH (nvm_header->IMAGELENGTH), nvm_header->IMAGECHECKSUM))
		{
			if (_allclr (flags, NVM_SILENCE))
			{
				error (0, errno, NVM_IMG_CHECKSUM, filename, module);
			}
			return (-1);
		}
		offset += LE32TOH (nvm_header->IMAGELENGTH);
		extent -= LE32TOH (nvm_header->IMAGELENGTH);
		module++;
	}
	while (nvm_header->NEXTHEADER);
	if (extent)
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, NVM_HDR_LINK, filename, module);
		}
	}
	return ((signed)(extent));
}
开发者ID:LucaBongiorni,项目名称:open-plc-utils,代码行数:58,代码来源:chknvm2.c


示例4: BootParameters2

signed BootParameters2 (struct plc * plc)

{
	unsigned module = 0;
	struct nvm_header2 nvm_header;
	if (lseek (plc->PIB.file, 0, SEEK_SET))
	{
		error (1, errno, FILE_CANTHOME, plc->PIB.name);
	}
	do
	{
		if (read (plc->PIB.file, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header))
		{
			error (1, errno, NVM_HDR_CANTREAD, plc->PIB.name, module);
		}
		if (LE16TOH (nvm_header.MajorVersion) != 1)
		{
			error (1, ECANCELED, NVM_HDR_VERSION, plc->PIB.name, module);
		}
		if (LE16TOH (nvm_header.MinorVersion) != 1)
		{
			error (1, ECANCELED, NVM_HDR_VERSION, plc->PIB.name, module);
		}
		if (checksum32 (&nvm_header, sizeof (nvm_header), 0))
		{
			error (1, ECANCELED, NVM_HDR_CHECKSUM, plc->PIB.name, module);
		}

#if 0

		if (_allclr (LE16TOH (nvm_header.ExecuteMask), (1 << (plc->hardwareID - 1))))
		{
			if (lseek (plc->PIB.file, LE32TOH (nvm_header.NextHeader), SEEK_SET) == -1)
			{
				error (1, errno, "Can't skip module: %s (%d)", plc->PIB.name, module);
			}
		}
		else

#endif

		if (LE32TOH (nvm_header.ImageType) == NVM_IMAGE_PIB)
		{
			if (WriteExecuteParameters2 (plc, module, &nvm_header))
			{
				return (-1);
			}
			break;
		}
		if (lseek (plc->PIB.file, LE32TOH (nvm_header.NextHeader), SEEK_SET) == -1)
		{
			error (1, errno, "Can't skip module: %s (%d)", plc->PIB.name, module);
		}
		module++;
	}
	while (~nvm_header.NextHeader);
	return (0);
}
开发者ID:GSLyons,项目名称:open-plc-utils,代码行数:58,代码来源:BootParameters2.c


示例5: function

static signed function (char const * filename, struct node const * node)

{
	char * memory = 0;
	signed extent = 0;
	signed fd;
	if ((fd = open (filename, O_BINARY | O_RDWR)) == -1)
	{
		error (1, errno, FILE_CANTOPEN, filename);
	}
	if ((extent = lseek (fd, 0, SEEK_END)) == -1)
	{
		error (1, errno, FILE_CANTSIZE, filename);
	}
	if (!(memory = (char *)(malloc (extent))))
	{
		error (1, errno, FILE_CANTLOAD, filename);
	}
	if (lseek (fd, 0, SEEK_SET))
	{
		error (1, errno, FILE_CANTHOME, filename);
	}
	if (read (fd, memory, extent) != extent)
	{
		error (1, errno, FILE_CANTREAD, filename);
	}
	if (LE32TOH (* (uint32_t *)(memory)) == 0x60000000)
	{
		error (1, 0, FILE_WONTREAD, filename);
	}
	if (LE32TOH (* (uint32_t *)(memory)) == 0x00010001)
	{
		pibedit2 (filename, node, memory, extent);
	}
	else
	{
		pibedit1 (node, memory, extent);
	}
	if (lseek (fd, 0, SEEK_SET))
	{
		error (1, errno, FILE_CANTHOME, filename);
	}
	if (write (fd, memory, extent) != extent)
	{
		error (1, errno, FILE_CANTSAVE, filename);
	}
	close (fd);
	return (0);
}
开发者ID:GSLyons,项目名称:open-plc-utils,代码行数:49,代码来源:xml2pib.c


示例6: pibedit2

static signed pibedit2 (char const * filename, struct node const * node, char * memory, size_t extent)

{
	struct nvm_header2 * nvm_header;
	uint32_t origin = ~0;
	uint32_t offset = 0;
	unsigned length = 0;
	unsigned module = 0;
	do
	{
		nvm_header = (struct nvm_header2 *)(memory + offset);
		if (LE16TOH (nvm_header->MajorVersion) != 1)
		{
			error (1, 0, NVM_HDR_VERSION, filename, module);
		}
		if (LE16TOH (nvm_header->MinorVersion) != 1)
		{
			error (1, 0, NVM_HDR_VERSION, filename, module);
		}
		if (LE32TOH (nvm_header->PrevHeader) != origin)
		{
			error (1, 0, NVM_HDR_LINK, filename, module);
		}
		if (checksum32 (nvm_header, sizeof (* nvm_header), 0))
		{
			error (1, 0, NVM_HDR_CHECKSUM, filename, module);
		}
		origin = offset;
		offset += sizeof (* nvm_header);
		extent -= sizeof (* nvm_header);
		length = LE32TOH (nvm_header->ImageLength);
		if (checksum32 (memory + offset, length, nvm_header->ImageChecksum))
		{
			error (1, 0, NVM_IMG_CHECKSUM, filename, module);
		}
		if (LE32TOH (nvm_header->ImageType) == NVM_IMAGE_PIB)
		{
			xmledit (node, memory + offset, length);
			nvm_header->ImageChecksum = checksum32 (memory + offset, length, 0);
			nvm_header->HeaderChecksum = checksum32 (nvm_header, sizeof (* nvm_header), nvm_header->HeaderChecksum);
			return (0);
		}
		offset += length;
		extent -= length;
		module++;
	}
	while (~nvm_header->NextHeader);
	return (-1);
}
开发者ID:GSLyons,项目名称:open-plc-utils,代码行数:49,代码来源:xml2pib.c


示例7: function2

static void function2 (struct _file_ * file, signed index, flag_t flags) 

{
	static signed image = 0;
	static signed origin = ~0;
	static signed offset = 0;
	struct nvm_header2 nvm_header;
	if (read (file->file, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header)) 
	{
		error (1, errno, NVM_HDR_CANTREAD, file->name, image);
	}
	if (LE16TOH (nvm_header.MajorVersion) != 1) 
	{
		error (1, 0, NVM_HDR_VERSION, file->name, image);
	}
	if (LE16TOH (nvm_header.MinorVersion) != 1) 
	{
		error (1, 0, NVM_HDR_VERSION, file->name, image);
	}
	if (checksum32 (&nvm_header, sizeof (nvm_header), 0)) 
	{
		error (1, 0, NVM_HDR_CHECKSUM, file->name, image);
	}
	if (~nvm_header.PrevHeader) 
	{
		error (1, 0, NVM_HDR_LINK, file->name, image);
	}
	if (~nvm_header.NextHeader) 
	{
		error (1, 0, NVM_HDR_LINK, file->name, image);
	}
	nvm_header.PrevHeader = HTOLE32 (origin);
	origin = offset;
	if (index) 
	{
		offset += sizeof (nvm_header);
		offset += LE32TOH (nvm_header.ImageLength);
		nvm_header.NextHeader = HTOLE32 (offset);
	}
	nvm_header.HeaderChecksum = 0;
	nvm_header.HeaderChecksum = checksum32 (&nvm_header, sizeof (nvm_header), 0);
	if (write (STDOUT_FILENO, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header)) 
	{
		error (1, errno, NVM_HDR_CANTSAVE, file->name, image);
	}
	copyimage (file, LE32TOH (nvm_header.ImageLength), image);
	image++;
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:49,代码来源:nvmmerge.c


示例8: RemoteHosts

signed RemoteHosts (struct plc * plc)

{
	struct channel * channel = (struct channel *)(plc->channel);
	struct message * message = (struct message *)(plc->message);

#ifndef __GNUC__
#pragma pack (push,1)
#endif

	struct __packed vs_sw_ver_request
	{
		struct ethernet_hdr ethernet;
		struct qualcomm_hdr qualcomm;
	}
	* request = (struct vs_sw_ver_request *) (message);
	struct __packed vs_sw_ver_confirm
	{
		struct ethernet_hdr ethernet;
		struct qualcomm_hdr qualcomm;
		uint8_t MSTATUS;
		uint32_t NUMDEVICES;
		struct __packed
		{
			uint8_t MACADDRESS [ETHER_ADDR_LEN];
			uint8_t ENUMID;
		}
		DEVICE [1];
	}
	* confirm = (struct vs_sw_ver_confirm *) (message);

#ifndef __GNUC__
#pragma pack (pop)
#endif

	Request (plc, "Request Enumeration ID Table");
	memset (message, 0, sizeof (* message));
	EthernetHeader (&request->ethernet, channel->peer, channel->host, channel->type);
	QualcommHeader (&request->qualcomm, 0, (VS_EM_ID_TABLE | MMTYPE_REQ));
	plc->packetsize = (ETHER_MIN_LEN - ETHER_CRC_LEN);
	if (SendMME (plc) <= 0)
	{
		error (PLC_EXIT (plc), errno, CHANNEL_CANTSEND);
		return (-1);
	}
	while (ReadMME (plc, 0, (VS_EM_ID_TABLE | MMTYPE_CNF)) > 0)
	{
		unsigned count = LE32TOH (confirm->NUMDEVICES);
		if (confirm->MSTATUS)
		{
			Failure (plc, PLC_WONTDOIT);
			continue;
		}
		while (count--)
		{
			hexout (confirm->DEVICE [count].MACADDRESS, ETHER_ADDR_LEN, ':', count? ' ': '\n', stdout);
		}
	}
	return (0);
}
开发者ID:dvlemplgk,项目名称:open-plc-utils,代码行数:60,代码来源:RemoteHosts.c


示例9: fdmanifest

signed fdmanifest (signed fd, char const * filename, struct nvm_header2 * nvm_header, unsigned module)

{
	off_t extent = LE32TOH (nvm_header->ImageLength);
	void * memory = malloc (extent);
	if (!memory)
	{
		error (1, 0, FILE_CANTLOAD, filename);
	}
	if (read (fd, memory, extent) != (signed)(extent))
	{
		error (1, errno, FILE_CANTREAD, filename);
	}
	if (lseek (fd, (off_t)(0) - extent, SEEK_CUR) == -1)
	{
		error (1, errno, FILE_CANTSEEK, filename);
	}
	printf ("------- %s (%d) -------\n", filename, module);
	if (manifest (memory, extent))
	{
		error (1, 0, "Bad manifest: %s", filename);
	}
	free (memory);
	return (0);
}
开发者ID:GSLyons,项目名称:open-plc-utils,代码行数:25,代码来源:fdmanifest.c


示例10: nvmlock2

void nvmlock2 (struct nvm_header2 * header) 

{
	header->ImageChecksum = checksum32 ((char *)(header) + sizeof (* header), LE32TOH (header->ImageLength), 0);
	header->HeaderChecksum = checksum32 (header, sizeof (* header), header->HeaderChecksum);
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:7,代码来源:nvmlock2.c


示例11: manifetch

void * manifetch (void const * memory, size_t extent, uint32_t type) 

{
	uint8_t * offset = (uint8_t *)(memory);
	while (extent) 
	{
		struct TLVNode * node = (struct TLVNode *)(offset);
		if (LE32TOH (node->type) == type) 
		{
			return ((void *)(&node->data));
		}
		extent -= sizeof (* node) - sizeof (node->size) + LE32TOH (node->size);
		offset += sizeof (* node) - sizeof (node->size) + LE32TOH (node->size);
	}
	return ((void *)(0));
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:16,代码来源:manifetch.c


示例12: return

bool CPLFirmware::IsValid () const 

{
	CPLFirmware::Header const * header;
	byte const * offset = (byte const *)(this->mbuffer);
	signed extent = this->mextent;
	signed image = 0;
	if ((!this->mbuffer) || (!this->mextent)) 
	{

// oerror::error (0, ECANCELED, "No Firmware Image Available");

		return (false);
	}
	do 
	{
	std::cout << "start " << image << std::endl;
		header = (CPLFirmware::Header const *)(offset);
#if 1
  		CPLFirmware::Peek (header);
#endif
		if (LE32TOH (header->HEADERVERSION) != NVM_HEADER_VERSION) 
		{
			oerror::error (1, 0, "Bad header version");
			return (false);
		}
		if (omemory::checksum32 (header, sizeof (CPLFirmware::Header), 0)) 
		{
			oerror::error (1, 0, "Bad header checksum");
			return (false);
		}
		offset += sizeof (CPLFirmware::Header);
		extent -= sizeof (CPLFirmware::Header);
		if (omemory::checksum32 (offset, LE32TOH (header->IMAGELENGTH), header->IMAGECHECKSUM)) 
		{
			oerror::error (1, 0, "Bad image checksum");
			return (false);
		}
		offset += header->IMAGELENGTH;
		extent -= header->IMAGELENGTH;
		image++;
		std::cout << "end " << image << std::endl;
	}
	while (header->NEXTHEADER);
	std::cout << "exit" << std::endl;
	return (!extent);
}
开发者ID:tcdog001,项目名称:apv5sdk-v15,代码行数:47,代码来源:CPLFirmware.cpp


示例13: chknvm

static signed chknvm (char const * filename, flag_t flags)

{
	void * memory = (void *)(0);
	signed extent = 0;
	signed status = 0;
	signed fd;
	if ((fd = open (filename, O_BINARY|O_RDONLY)) == -1)
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, FILE_CANTOPEN, filename);
		}
		return (-1);
	}
	if ((extent = lseek (fd, 0, SEEK_END)) == -1)
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, FILE_CANTSIZE, filename);
		}
		return (-1);
	}
	if (!(memory = malloc (extent)))
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, FILE_CANTLOAD, filename);
		}
		return (-1);
	}
	if (lseek (fd, 0, SEEK_SET))
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, FILE_CANTLOAD, filename);
		}
		return (-1);
	}
	if (read (fd, memory, extent) != extent)
	{
		if (_allclr (flags, NVM_SILENCE))
		{
			error (0, errno, FILE_CANTREAD, filename);
		}
		return (-1);
	}
	close (fd);
	if (LE32TOH (* (uint32_t *)(memory)) == 0x60000000)
	{
		status = nvmimage2 (memory, extent, filename, flags);
	}
	else
	{
		status = nvmchain2 (memory, extent, filename, flags);
	}
	free (memory);
	return (status);
}
开发者ID:LucaBongiorni,项目名称:open-plc-utils,代码行数:59,代码来源:chknvm2.c


示例14: ClassifierPriorityMap

signed ClassifierPriorityMap (struct classifier_priority_map * map)

{
	printf ("%s Any ", reword (LE32TOH (map->Priority), actions, SIZEOF (actions)));
	Classifier (&map->CLASSIFIER);
	printf (" add perm\n");
	return (0);
}
开发者ID:LucaBongiorni,项目名称:open-plc-utils,代码行数:8,代码来源:pibrump.c


示例15: nvmpeek

void nvmpeek (void const * memory) 

{
	if (LE32TOH (*(uint32_t *)(memory)) == 0x60000000) 
	{
		nvmpeek1 (memory);
		return;
	}
	nvmpeek2 (memory);
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:11,代码来源:nvmpeek.c


示例16: pio_get

static int pio_get(const char* buf, mmap_gpio* pio)
{
	uint32_t port = pio->port - 'A';
	if (port > PIO_NR_PORTS)
	{
		return -1;
	}

	uint32_t val;
	uint32_t port_num_func, port_num_pull;
	uint32_t offset_func, offset_pull;

	port_num_func = pio->pin >> 3;
	offset_func = ((pio->pin & 0x07) << 2);

	port_num_pull = pio->pin >> 4;
	offset_pull = ((pio->pin & 0x0f) << 1);

	/* func */
	val = LE32TOH(PIO_REG_CFG(buf, port, port_num_func));
	pio->cfg = (val>>offset_func) & 0x07;

	/* pull */
	val = LE32TOH(PIO_REG_PULL(buf, port, port_num_pull));
	pio->pull = (val>>offset_pull) & 0x03;

	/* dlevel */
	val = LE32TOH(PIO_REG_DLEVEL(buf, port, port_num_pull));
	pio->drv_level = (val>>offset_pull) & 0x03;

	/* i/o data */
	if (pio->cfg > 1)
		pio->data = -1;
	else {
		val = LE32TOH(PIO_REG_DATA(buf, port));
		pio->data = (val >> pio->pin) & 0x01;
	}

	return PIO_SUCCESS;
}
开发者ID:yevgeniy-logachev,项目名称:libsoc,代码行数:40,代码来源:mmap_gpio.c


示例17: function1

static void function1 (struct _file_ * file, signed index, flag_t flags) 

{
	static signed image = 0;
	static uint32_t offset = 0;
	struct nvm_header1 nvm_header;
	if (read (file->file, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header)) 
	{
		error (1, errno, NVM_HDR_CANTREAD, file->name, image);
	}
	if (LE32TOH (nvm_header.HEADERVERSION) != 0x60000000) 
	{
		error (1, 0, NVM_HDR_VERSION, file->name, image);
	}
	if (checksum32 (&nvm_header, sizeof (nvm_header), 0)) 
	{
		error (1, 0, NVM_HDR_CHECKSUM, file->name, image);
	}
	if (nvm_header.NEXTHEADER) 
	{
		error (1, 0, NVM_HDR_LINK, file->name, image);
	}
	if (index) 
	{
		offset += sizeof (nvm_header);
		offset += LE32TOH (nvm_header.IMAGELENGTH);
		nvm_header.NEXTHEADER = HTOLE32 (offset);
	}
	nvm_header.HEADERCHECKSUM = 0;
	nvm_header.HEADERCHECKSUM = checksum32 (&nvm_header, sizeof (nvm_header), 0);
	if (write (STDOUT_FILENO, &nvm_header, sizeof (nvm_header)) != sizeof (nvm_header)) 
	{
		error (1, errno, NVM_HDR_CANTSAVE, file->name, image);
	}
	copyimage (file, LE32TOH (nvm_header.IMAGELENGTH), image);
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:37,代码来源:nvmmerge.c


示例18: nvrampeek

void nvrampeek (struct config_nvram * config_nvram) 

{
	printf ("TYPE=0x%02X ", LE32TOH (config_nvram->NVRAMTYPE));
	printf ("(%s) ", NVRAMName (LE32TOH (config_nvram->NVRAMTYPE)));
	printf ("PAGE=0x%04X ", LE32TOH (config_nvram->NVRAMPAGE));
	printf ("BLOCK=0x%04X ", LE32TOH (config_nvram->NVRAMBLOCK));
	printf ("SIZE=0x%04X ", LE32TOH (config_nvram->NVRAMSIZE));
	printf ("(%d) ", LE32TOH (config_nvram->NVRAMSIZE));
	printf ("\n");
	return;
}
开发者ID:tcdog001,项目名称:apv5sdk-v15,代码行数:12,代码来源:nvrampeek.c


示例19: function

static void function (char const * filename, signed index, flag_t flags) 

{
	uint32_t version;
	struct _file_ file = 
	{
		-1,
		filename
	};
	if (_anyset (flags, NVM_VERBOSE)) 
	{
		error (0, 0, "%s", file.name);
	}
	if ((file.file = open (file.name, O_BINARY|O_RDONLY)) == -1) 
	{
		error (1, errno, FILE_CANTOPEN, file.name);
	}
	if (read (file.file, &version, sizeof (version)) != sizeof (version)) 
	{
		error (1, errno, FILE_CANTREAD, file.name);
	}
	if (lseek (file.file, 0, SEEK_SET)) 
	{
		error (1, errno, FILE_CANTHOME, file.name);
	}
	if (LE32TOH (version) == 0x60000000) 
	{
		function1 (&file, index, flags);
	}
	else 
	{
		function2 (&file, index, flags);
	}
	close (file.file);
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:36,代码来源:nvmmerge.c


示例20: function

static void function (char const * filename, flag_t flags) 

{
	uint32_t version;
	signed ifd;
	if ((ifd = open (filename, O_BINARY|O_RDONLY)) == -1) 
	{
		error (1, errno, FILE_CANTOPEN, filename);
	}
	if (read (ifd, &version, sizeof (version)) != sizeof (version)) 
	{
		error (1, errno, FILE_CANTREAD, filename);
	}
	close (ifd);
	if (LE32TOH (version) == 0x60000000) 
	{
		function1 (filename, flags);
	}
	else 
	{
		function2 (filename, flags);
	}
	return;
}
开发者ID:RozzieD,项目名称:open-plc-utils,代码行数:24,代码来源:nvmsplit.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ LEAD_CASE函数代码示例发布时间:2022-05-30
下一篇:
C++ LE32函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap