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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-i960/] [byteorder.h] - Blame information for rev 1633

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

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _I960_BYTEORDER_H
2
#define _I960_BYTEORDER_H
3
 
4
#ifndef __LITTLE_ENDIAN
5
#define __LITTLE_ENDIAN 1234
6
#endif
7
 
8
#ifndef __LITTLE_ENDIAN_BITFIELD
9
#define __LITTLE_ENDIAN_BITFIELD
10
#endif
11
 
12
#undef ntohl
13
#undef ntohs
14
#undef htonl
15
#undef htons
16
 
17
extern unsigned long int        ntohl(unsigned long int);
18
extern unsigned short int       ntohs(unsigned short int);
19
extern unsigned long int        htonl(unsigned long int);
20
extern unsigned short int       htons(unsigned short int);
21
 
22
extern __inline__ unsigned long int     __ntohl(unsigned long int);
23
extern __inline__ unsigned short int    __ntohs(unsigned short int);
24
 
25
extern __inline__ unsigned long int __ntohl(unsigned long int x)
26
{
27
        __asm__("bswap  %1, %0"
28
                :"=r"(x)
29
                :"0"(x));
30
        return x;
31
}
32
 
33
extern __inline__ unsigned short int __ntohs(unsigned short int x)
34
{
35
        register unsigned long lx = x << 16;
36
        __asm__("bswap %0, %0"
37
                :"=r"(lx)
38
                : "0"(lx));
39
        return (short) lx&0xffff;
40
}
41
 
42
#define __htonl(x) __ntohl(x)
43
#define __htons(x) __ntohs(x)
44
 
45
#define ntohl(x) __ntohl(x)
46
#define ntohs(x) __ntohs(x)
47
#define htonl(x) __htonl(x)
48
#define htons(x) __htons(x)
49
 
50
#endif /* _I960_BYTEORDER_H */

powered by: WebSVN 2.1.0

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