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#include <linux/minmax.h>
9#include <linux/spinlock.h>
10#include <linux/gfp.h>
11#include <linux/atomic.h>
12#include <linux/printk.h>
13#include <linux/bits.h>
14#include <linux/limits.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20#ifndef __packed
21# define __packed VSF_CAL_PACKED
22#endif
23#ifndef __aligned
24# define __aligned(n) VSF_CAL_ALIGN(n)
25#endif
26#ifndef __user
27# define __user
28#endif
29#ifndef __bitwise
30# define __bitwise
31#endif
32
33#define EXPORT_SYMBOL_GPL(__SYMBOL)
34
35#define MSEC_PER_SEC 1000L
36#define USEC_PER_MSEC 1000L
37#define NSEC_PER_USEC 1000L
38#define NSEC_PER_MSEC 1000000L
39#define USEC_PER_SEC 1000000L
40#define NSEC_PER_SEC 1000000000L
41
42#define __struct_group(TAG, NAME, ATTRS, MEMBERS...) \
43 union { \
44 struct { MEMBERS } ATTRS; \
45 struct TAG { MEMBERS } ATTRS NAME; \
46 }
47#define struct_group(NAME, MEMBERS...) \
48 __struct_group(/* no tag */, NAME, /* no attrs */, MEMBERS)
49
50typedef int8_t __s8;
51typedef uint8_t __u8;
52typedef int16_t __s16;
54typedef int32_t __s32;
56typedef int64_t __s64;
58
59typedef __u16 __le16;
60typedef __u16 __be16;
61typedef __u32 __le32;
62typedef __u32 __be32;
63typedef __u64 __le64;
64typedef __u64 __be64;
65
66typedef __u16 __sum16;
67typedef __u32 __wsum;
68
69typedef __u8 u8;
70typedef __s8 s8;
71typedef __u16 u16;
72typedef __s16 s16;
73typedef __u32 u32;
74typedef __s32 s32;
75typedef __u64 u64;
76typedef __s64 s64;
77
80
81typedef unsigned int slab_flags_t;
82typedef unsigned int fmode_t;
83
84#ifndef VSF_ARCH_PHYS_ADDR_T
86#else
87typedef VSF_ARCH_PHYS_ADDR_T phys_addr_t;
88#endif
89#ifndef VSF_ARCH_DMA_ADDR_T
91#else
92typedef VSF_ARCH_DMA_ADDR_T dma_addr_t;
93#endif
94
95struct hlist_head {
97};
98
99struct hlist_node {
101};
102
103#define ARRAY_SIZE(__ARR) dimof(__ARR)
104
105// some compiler does not support typeof
106#define roundup(__x, __y) ({ \
107 (((__x) + ((__y) - 1)) / (__y)) * (__y); \
108})
109
110#define rounddown(__x, __y) ({ \
111 (__x) - ((__x) % (__y)); \
112})
113
114#define round_up(__x, __y) ((((__x) - 1) | ((__y) - 1)) + 1)
115
116#ifdef __cplusplus
117}
118#endif
119
120#endif
uint_fast8_t uintalu_t
Definition type.h:88
off_t __kernel_off_t
Definition types.h:78
int8_t __s8
Definition types.h:50
__u8 u8
Definition types.h:69
__s32 s32
Definition types.h:74
__s16 s16
Definition types.h:72
__u64 u64
Definition types.h:75
uintalu_t dma_addr_t
Definition types.h:90
__u64 __le64
Definition types.h:63
__u16 __be16
Definition types.h:60
__u16 __le16
Definition types.h:59
int32_t __s32
Definition types.h:54
uint32_t __u32
Definition types.h:55
__u32 u32
Definition types.h:73
int64_t __s64
Definition types.h:56
__u16 u16
Definition types.h:71
__u32 __be32
Definition types.h:62
__s64 s64
Definition types.h:76
__u16 __sum16
Definition types.h:66
uint8_t __u8
Definition types.h:51
int16_t __s16
Definition types.h:52
uintalu_t phys_addr_t
Definition types.h:85
uint16_t __u16
Definition types.h:53
uint64_t __u64
Definition types.h:57
unsigned int slab_flags_t
Definition types.h:81
__u32 __wsum
Definition types.h:67
pid_t __kernel_pid_t
Definition types.h:79
__u32 __le32
Definition types.h:61
__u64 __be64
Definition types.h:64
__s8 s8
Definition types.h:70
unsigned int fmode_t
Definition types.h:82
int pid_t
Definition types.h:85
long off_t
Definition types.h:95
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:95
struct hlist_node * first
Definition types.h:96
Definition types.h:99
struct hlist_node ** pprev
Definition types.h:100
struct hlist_node * next
Definition types.h:100