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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [rc203soc/] [sw/] [uClinux/] [include/] [asm-or32/] [byteorder.h] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1633 jcastillo
#ifndef _OR32_BYTEORDER_H
2
#define _OR32_BYTEORDER_H
3
 
4
#ifndef __BIG_ENDIAN
5
#define __BIG_ENDIAN 4321
6
#endif
7
 
8
#ifndef __BIG_ENDIAN_BITFIELD
9
#define __BIG_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
26
__ntohl(unsigned long int x)
27
{
28
        return x;
29
}
30
 
31
extern __inline__ unsigned short int
32
__ntohs(unsigned short int x)
33
{
34
        return x;
35
}
36
 
37
#define __htonl(x) __ntohl(x)
38
#define __htons(x) __ntohs(x)
39
 
40
#define ntohl(x) __ntohl(x)
41
#define ntohs(x) __ntohs(x)
42
#define htonl(x) __htonl(x)
43
#define htons(x) __htons(x)
44
 
45
#define le16_to_cpu(x) \
46
        ((__u16)((((__u16)(x) & 0x00FFU) << 8) | \
47
                 (((__u16)(x) & 0xFF00U) >> 8)))
48
 
49
#define le32_to_cpu(x) \
50
        ((__u32)((((__u32)(x) & 0x000000FFU) << 24) | \
51
                 (((__u32)(x) & 0x0000FF00U) <<  8) | \
52
                 (((__u32)(x) & 0x00FF0000U) >>  8) | \
53
                 (((__u32)(x) & 0xFF000000U) >> 24)))
54
 
55
#define le64_to_cpu(x) \
56
        ((__u64)((((__u64)(x) & 0x00000000000000FFULL) << 56) | \
57
                 (((__u64)(x) & 0x000000000000FF00ULL) << 40) | \
58
                 (((__u64)(x) & 0x0000000000FF0000ULL) << 24) | \
59
                 (((__u64)(x) & 0x00000000FF000000ULL) <<  8) | \
60
                 (((__u64)(x) & 0x000000FF00000000ULL) >>  8) | \
61
                 (((__u64)(x) & 0x0000FF0000000000ULL) >> 24) | \
62
                 (((__u64)(x) & 0x00FF000000000000ULL) >> 40) | \
63
                 (((__u64)(x) & 0xFF00000000000000ULL) >> 56)))
64
 
65
#define cpu_to_le16(x) (le16_to_cpu(x))
66
#define cpu_to_le32(x) (le32_to_cpu(x))
67
#define cpu_to_le64(x) (le64_to_cpu(x))
68
 
69
#endif

powered by: WebSVN 2.1.0

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