OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [services/] [gfx/] [mw/] [v2_0/] [include/] [microwin/] [swap.h] - Rev 565

Go to most recent revision | Compare with Previous | Blame | View Log

/*
 * Copyright (c) 2001 Greg Haerr <greg@censoft.com>
 *
 * Byte and word swapping header file for big/little endian mapping
 */
 
#ifdef __ECOS
// FIXME!
#define wswap(x)	(x)
#define dwswap(x)	(x)
#define dwread(addr)	(*(unsigned long *)(addr))
#else
#include <endian.h>
#include <byteswap.h>
#if __BYTE_ORDER == __BIG_ENDIAN
#define wswap(x)	bswap_16(x)
#define dwswap(x)	bswap_32(x)
/* read little endian format from buffer*/
#define dwread(addr)	((*(unsigned char *)(addr)) | \
			 (*(unsigned char *)(addr+1) << 8) | \
			 (*(unsigned char *)(addr+2) << 16) | \
			 (*(unsigned char *)(addr+3) << 24))
#else
/* little endian - no action required*/
#define wswap(x)	(x)
#define dwswap(x)	(x)
#define dwread(addr)	(*(unsigned long *)(addr))
#endif
#endif
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.