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] - Blame information for rev 565

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

Line No. Rev Author Line
1 27 unneback
/*
2
 * Copyright (c) 2001 Greg Haerr <greg@censoft.com>
3
 *
4
 * Byte and word swapping header file for big/little endian mapping
5
 */
6
 
7
#ifdef __ECOS
8
// FIXME!
9
#define wswap(x)        (x)
10
#define dwswap(x)       (x)
11
#define dwread(addr)    (*(unsigned long *)(addr))
12
#else
13
#include <endian.h>
14
#include <byteswap.h>
15
#if __BYTE_ORDER == __BIG_ENDIAN
16
#define wswap(x)        bswap_16(x)
17
#define dwswap(x)       bswap_32(x)
18
/* read little endian format from buffer*/
19
#define dwread(addr)    ((*(unsigned char *)(addr)) | \
20
                         (*(unsigned char *)(addr+1) << 8) | \
21
                         (*(unsigned char *)(addr+2) << 16) | \
22
                         (*(unsigned char *)(addr+3) << 24))
23
#else
24
/* little endian - no action required*/
25
#define wswap(x)        (x)
26
#define dwswap(x)       (x)
27
#define dwread(addr)    (*(unsigned long *)(addr))
28
#endif
29
#endif
30
 

powered by: WebSVN 2.1.0

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