summaryrefslogtreecommitdiff
path: root/HisiPkg/Include/Library/Std.h
blob: 60648477c02cdd168dcb3652a56aefc68b004d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
/*******************************************************************
#
#  
#  Copyright (c) Huawei Technologies Co., Ltd. 2013. All rights reserved.
#  This program and the accompanying materials
#  are licensed and made available under the terms and conditions of the BSD License
#  which accompanies this distribution.  The full text of the license may be found at
#  http://opensource.org/licenses/bsd-license.php
#  
#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#  
#**/





#ifndef __std_H
#define __std_H


#ifndef _ASMLANGUAGE

typedef int STATUS;
typedef int INT;
typedef unsigned int size_t;

typedef signed char     S8;
typedef signed short    S16;
typedef signed int      S32;

#ifndef VC_DEBUG_MODE
typedef long long       S64;
#else
typedef __int64         S64;
#endif

#ifndef U8 
typedef unsigned char   U8;
#endif

#ifndef U16
typedef unsigned short  U16;
#endif

#ifndef U32
typedef unsigned int    U32;
#endif

#ifndef VC_DEBUG_MODE
typedef unsigned long long  U64;
#else
typedef unsigned __int64 U64;
#endif

#ifndef LONG
typedef long    LONG;
#endif
#ifndef CHAR
typedef char    CHAR;
#endif

typedef volatile unsigned char  V8;
typedef volatile unsigned short V16;
typedef volatile unsigned int   V32;

#ifndef VC_DEBUG_MODE
typedef volatile unsigned long long  V64;
#else
typedef volatile unsigned __int64 V64;
#endif

#ifndef VC_DEBUG_MODE
typedef  char           BYTE;
#endif

typedef  unsigned char  UBYTE;    
typedef  short          HWORD;    
typedef  unsigned short UHWORD;    

#ifndef VC_DEBUG_MODE
/*typedef  long           WORD;*/    
typedef  unsigned long  UWORD;
#endif




typedef  volatile char           VBYTE;
typedef  volatile unsigned char  VUBYTE;    
typedef  volatile short          VHWORD;    
typedef  volatile unsigned short VUHWORD;    
typedef  volatile long           VWORD;    
typedef  volatile unsigned long  VUWORD;    

#ifndef ERROR
#define ERROR   -1
#endif

#ifndef OK
#define OK      0
#endif
#ifndef BOOL
#define BOOL  int
#endif
#ifndef BYTE_SWAP32
#define BYTE_SWAP32(x)        ((((unsigned)(x) & 0x000000ff) << 24) | \
			                             (((x) & 0x0000ff00) <<  8) | \
			                             (((x) & 0x00ff0000) >>  8) | \
			                             (((x) & 0xff000000) >> 24))
#endif

#ifndef BYTE_SWAP16
#define BYTE_SWAP16(x)     ((((x) & 0x00ff) <<8) | \
                            (((x) & 0xff00) >> 8))
#endif
#define CPU_RAM_HDF_BAK_VERSION_FLAG            (0)
#define CPU_RAM_HDF_MAIN_VERSION_FLAG           (1)
#define REG_WRITE(addr,data)            (*(volatile UINT32 *)(addr) = (data))
#define REG_READ(addr,data)             ((data) = *(volatile UINT32 *)(addr))

#define SYS_CTRL_REG_WRITE(offset,data)  (REG_WRITE((offset), (data)))
#define SYS_CTRL_REG_READ(offset,data)   do \
                                         { \
                                            (REG_READ((offset), (data))); \
                                         }while(0)
#ifndef MEM_MMU_OFFSET
//#define MEM_MMU_OFFSET   0x80000000
#define MEM_MMU_OFFSET   0x00
#endif
#define NELEMENTS(array)	(sizeof (array) / sizeof ((array) [0]))


#define REG64(Addr) (*(volatile unsigned long long *)(Addr))
#define REG32(Addr) (*(volatile unsigned int *)(Addr))
#define REG16(Addr) (*(volatile unsigned short *)(Addr))
#define REG8(Addr)  (*(volatile unsigned char *)(Addr))

U32 vxImmrGet (void);

#endif

#define SIZE_1        1
#define SIZE_4        4
#define SIZE_59      59
#endif /* __std_H */