| 1 |
/* |
| 2 |
* This program is free software; you can redistribute it and/or modify |
| 3 |
* it under the terms of the GNU General Public License as published by |
| 4 |
* the Free Software Foundation; either version 2 of the License, or |
| 5 |
* (at your option) any later version. |
| 6 |
* |
| 7 |
* This program is distributed in the hope that it will be useful, |
| 8 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 |
* GNU General Public License for more details. |
| 11 |
* |
| 12 |
* You should have received a copy of the GNU General Public License along |
| 13 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 14 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef __LINUX_TYPES_H |
| 18 |
#define __LINUX_TYPES_H |
| 19 |
|
| 20 |
#include <stdint.h> |
| 21 |
#include <stdbool.h> |
| 22 |
#include <stdlib.h> |
| 23 |
#include <sys/cdefs.h> |
| 24 |
|
| 25 |
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ |
| 26 |
#error "big endian is not supported by target" |
| 27 |
#endif |
| 28 |
|
| 29 |
typedef uint16_t __le16; |
| 30 |
typedef uint32_t __le32; |
| 31 |
typedef uint64_t __le64; |
| 32 |
|
| 33 |
typedef uint8_t u8; |
| 34 |
typedef uint8_t __u8; |
| 35 |
typedef uint16_t u16; |
| 36 |
typedef uint16_t __u16; |
| 37 |
typedef uint32_t u32; |
| 38 |
typedef uint32_t __u32; |
| 39 |
typedef uint64_t u64; |
| 40 |
typedef uint64_t __u64; |
| 41 |
typedef int8_t s8; |
| 42 |
typedef int8_t __s8; |
| 43 |
typedef int16_t s16; |
| 44 |
typedef int16_t __s16; |
| 45 |
typedef int32_t s32; |
| 46 |
typedef int32_t __s32; |
| 47 |
typedef int64_t s64; |
| 48 |
typedef int64_t __s64; |
| 49 |
|
| 50 |
#define cpu_to_le16(x) ((__le16)(uint16_t)(x)) |
| 51 |
#define le16_to_cpu(x) ((uint16_t)(__le16)(x)) |
| 52 |
#define cpu_to_le32(x) ((__le32)(uint32_t)(x)) |
| 53 |
#define le32_to_cpu(x) ((uint32_t)(__le32)(x)) |
| 54 |
#define cpu_to_le64(x) ((__le64)(uint64_t)(x)) |
| 55 |
#define le64_to_cpu(x) ((uint64_t)(__le64)(x)) |
| 56 |
|
| 57 |
typedef uint16_t __be16; |
| 58 |
typedef uint32_t __be32; |
| 59 |
typedef uint64_t __be64; |
| 60 |
|
| 61 |
#define cpu_to_be64 __cpu_to_be64 |
| 62 |
#define be64_to_cpu __be64_to_cpu |
| 63 |
#define cpu_to_be32 __cpu_to_be32 |
| 64 |
#define be32_to_cpu __be32_to_cpu |
| 65 |
#define cpu_to_be16 __cpu_to_be16 |
| 66 |
#define be16_to_cpu __be16_to_cpu |
| 67 |
#define cpu_to_be64p __cpu_to_be64p |
| 68 |
#define be64_to_cpup __be64_to_cpup |
| 69 |
#define cpu_to_be32p __cpu_to_be32p |
| 70 |
#define be32_to_cpup __be32_to_cpup |
| 71 |
#define cpu_to_be16p __cpu_to_be16p |
| 72 |
#define cpu_to_be64s __cpu_to_be64s |
| 73 |
#define be64_to_cpus __be64_to_cpus |
| 74 |
#define cpu_to_be32s __cpu_to_be32s |
| 75 |
#define be32_to_cpus __be32_to_cpus |
| 76 |
#define cpu_to_be16s __cpu_to_be16s |
| 77 |
#define be16_to_cpus __be16_to_cpus |
| 78 |
#define be16_to_cpup __be16_to_cpup |
| 79 |
|
| 80 |
#endif /* __LINUX_TYPES_H */ |