VSF Documented
types.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_TYPES_H__
2#define __VSF_LINUX_TYPES_H__
3
4// for endian APIs
5#include "hal/arch/vsf_arch.h"
6#include <sys/types.h>
7#include <linux/err.h>
8
9// TODO: linux/types.h includes TOO much, should be minimized for compatibility
10//#include <linux/minmax.h>
11//#include <linux/atomic.h>
12#include <linux/spinlock.h>
13#include <linux/gfp.h>
14#include <linux/printk.h>
15#include <linux/bits.h>
16#include <linux/limits.h>
17
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#ifndef __packed
23# define __packed VSF_CAL_PACKED
24#endif
25#ifndef __aligned
26# define __aligned(n) VSF_CAL_ALIGN(n)
27#endif
28#ifndef __user
29# define __user
30#endif
31#ifndef __bitwise
32# define __bitwise
33#endif
34
35#define EXPORT_SYMBOL_GPL(__SYMBOL)
36
37#define MSEC_PER_SEC 1000L
38#define USEC_PER_MSEC 1000L
39#define NSEC_PER_USEC 1000L
40#define NSEC_PER_MSEC 1000000L
41#define USEC_PER_SEC 1000000L
42#define NSEC_PER_SEC 1000000000L
43
44#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
45 union { \
46 struct { MEMBERS } ATTRS; \
47 struct TAG { MEMBERS } ATTRS NAME; \
48 }
49#define struct_group(NAME, MEMBERS...) \
50 __struct_group(/* no tag */, NAME, /* no attrs */, MEMBERS)
51
52typedef int8_t __s8;
53typedef uint8_t __u8;
54typedef int16_t __s16;
56typedef int32_t __s32;
58typedef int64_t __s64;
60
61typedef __u16 __le16;
62typedef __u16 __be16;
63typedef __u32 __le32;
64typedef __u32 __be32;
65typedef __u64 __le64;
66typedef __u64 __be64;
67
68typedef __u16 __sum16;
69typedef __u32 __wsum;
70
71typedef __u8 u8;
72typedef __s8 s8;
73typedef __u16 u16;
74typedef __s16 s16;
75typedef __u32 u32;
76typedef __s32 s32;
77typedef __u64 u64;
78typedef __s64 s64;
79
82
83typedef unsigned int slab_flags_t;
84typedef unsigned int fmode_t;
85
86#ifndef VSF_ARCH_PHYS_ADDR_T
88#else
89typedef VSF_ARCH_PHYS_ADDR_T phys_addr_t;
90#endif
91#ifndef VSF_ARCH_DMA_ADDR_T
93#else
94typedef VSF_ARCH_DMA_ADDR_T dma_addr_t;
95#endif
96
97struct hlist_head {
99};
100
103};
104
105#define ARRAY_SIZE(__ARR) dimof(__ARR)
106
107#if VSF_COMPATIBILITY != ENABLED && !defined(container_of)
108// linux need container_of
109# define container_of vsf_container_of
110#endif
111
112// some compiler does not support typeof
113#define roundup(__x, __y) ({ \
114 (((__x) + ((__y) - 1)) / (__y)) * (__y); \
115})
116
117#define rounddown(__x, __y) ({ \
118 (__x) - ((__x) % (__y)); \
119})
120
121#define round_up(__x, __y) ((((__x) - 1) | ((__y) - 1)) + 1)
122
123// include kstrtox here for types
124#include <linux/kstrtox.h>
125
126#ifdef __cplusplus
127}
128#endif
129
130#endif
uint_fast8_t uintalu_t
Definition type.h:88
off_t __kernel_off_t
Definition types.h:80
int8_t __s8
Definition types.h:52
__u8 u8
Definition types.h:71
__s32 s32
Definition types.h:76
__s16 s16
Definition types.h:74
__u64 u64
Definition types.h:77
uintalu_t dma_addr_t
Definition types.h:92
__u64 __le64
Definition types.h:65
__u16 __be16
Definition types.h:62
__u16 __le16
Definition types.h:61
int32_t __s32
Definition types.h:56
uint32_t __u32
Definition types.h:57
__u32 u32
Definition types.h:75
int64_t __s64
Definition types.h:58
__u16 u16
Definition types.h:73
__u32 __be32
Definition types.h:64
__s64 s64
Definition types.h:78
__u16 __sum16
Definition types.h:68
uint8_t __u8
Definition types.h:53
int16_t __s16
Definition types.h:54
uintalu_t phys_addr_t
Definition types.h:87
uint16_t __u16
Definition types.h:55
uint64_t __u64
Definition types.h:59
unsigned int slab_flags_t
Definition types.h:83
__u32 __wsum
Definition types.h:69
pid_t __kernel_pid_t
Definition types.h:81
__u32 __le32
Definition types.h:63
__u64 __be64
Definition types.h:66
__s8 s8
Definition types.h:72
unsigned int fmode_t
Definition types.h:84
int pid_t
Definition types.h:113
long off_t
Definition types.h:123
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
int int32_t
Definition stdint.h:8
long long int64_t
Definition stdint.h:10
short int16_t
Definition stdint.h:6
unsigned long long uint64_t
Definition stdint.h:11
unsigned char uint8_t
Definition stdint.h:5
signed char int8_t
Definition stdint.h:4
Definition types.h:97
struct hlist_node * first
Definition types.h:98
Definition types.h:101
struct hlist_node ** pprev
Definition types.h:102
struct hlist_node * next
Definition types.h:102
Generated from commit: vsfteam/vsf@85be636