• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Winner Microelectronics Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @file    wm_type_def.h
18  *
19  * @brief   WM type redefine
20  *
21  * @author  winnermicro
22  *
23  * Copyright (c) 2015 Winner Microelectronics Co., Ltd.
24  */
25 #ifndef __WM_TYPE_DEF_H__
26 #define __WM_TYPE_DEF_H__
27 
28 #define __NEED_uint32_t
29 #define __NEED_uint64_t
30 
31 #include <stdbool.h>
32 #include <bits/alltypes.h>
33 
34 #ifdef u8
35 #undef u8
36 #endif
37 #ifdef s8
38 #undef s8
39 #endif
40 #ifdef u16
41 #undef u16
42 #endif
43 #ifdef s16
44 #undef s16
45 #endif
46 #ifdef u32
47 #undef u32
48 #endif
49 #ifdef s32
50 #undef s32
51 #endif
52 #ifdef u64
53 #undef u64
54 #endif
55 #ifdef s64
56 #undef s64
57 #endif
58 
59 #ifdef u_char
60 #undef u_char
61 #endif
62 typedef unsigned char u_char;
63 
64 #ifdef INT8U
65 #undef INT8U
66 #endif
67 typedef unsigned char INT8U;
68 
69 #ifdef INT8S
70 #undef INT8S
71 #endif
72 typedef signed char INT8S;
73 
74 typedef unsigned char        u8;
75 typedef signed char          s8;
76 typedef unsigned short       u16;
77 typedef signed short         s16;
78 typedef unsigned int         u32;
79 typedef signed int           s32;
80 typedef unsigned long long   u64;
81 typedef long long                    s64;
82 
83 #if defined(_NEWLIB_VERSION_H__)
84 #ifdef int32_t
85 #undef int32_t
86 typedef int int32_t;
87 #endif
88 
89 #ifdef uint32_t
90 #undef uint32_t
91 typedef unsigned int uint32_t;
92 #endif
93 #endif
94 
95 #if defined(__MINILIBC__)
96 typedef int int32_t;
97 typedef unsigned int uint32_t;
98 #endif
99 
100 #ifdef int32
101 #undef int32
102 #endif
103 typedef int int32;
104 
105 #ifdef uint32
106 #undef uint32
107 #endif
108 typedef unsigned int uint32;
109 
110 #ifdef int16
111 #undef int16
112 #endif
113 typedef short  int16;
114 
115 #ifdef uint16
116 #undef uint16
117 #endif
118 typedef unsigned short  uint16;
119 
120 #ifdef u8_t
121 #undef u8_t
122 #endif
123 typedef unsigned char u8_t;
124 
125 #ifdef uint8_t
126 #undef uint8_t
127 #endif
128 typedef unsigned char uint8_t;
129 
130 #ifdef u16_t
131 #undef u16_t
132 #endif
133 typedef unsigned short u16_t;
134 
135 #ifdef uint16_t
136 #undef uint16_t
137 #endif
138 typedef unsigned short uint16_t;
139 
140 #ifdef u32_t
141 #undef u32_t
142 #endif
143 typedef unsigned int u32_t;
144 
145 #ifdef s8_t
146 #undef s8_t
147 #endif
148 typedef signed char s8_t;
149 
150 #ifdef s16_t
151 #undef s16_t
152 #endif
153 typedef signed short s16_t;
154 
155 #ifdef s32_t
156 #undef s32_t
157 #endif
158 typedef signed int s32_t;
159 #if (GCC_COMPILE==0)
160 #ifdef size_t
161 #undef size_t
162 #endif
163 typedef unsigned int size_t;
164 #endif
165 
166 #ifdef err_t
167 #undef err_t
168 #endif
169 typedef signed char err_t;
170 
171 #ifdef mem_ptr_t
172 #undef mem_ptr_t
173 #endif
174 typedef unsigned int mem_ptr_t;
175 
176 #ifdef  TRUE
177 #undef  TRUE
178 #endif
179 #define TRUE                     1
180 
181 #ifdef  FALSE
182 #undef  FALSE
183 #endif
184 #define FALSE                    0
185 
186 #ifdef __cplusplus
187 #ifndef NULL
188 #define NULL 0
189 #else
190 #define NULL ((void *)0)
191 #endif
192 #endif
193 
194 #define WM_SUCCESS               0
195 #define WM_FAILED               (-1)
196 
197 #ifndef IGNORE_PARAMETER
198 #define IGNORE_PARAMETER(x)     ((x) = (x))
199 #endif
200 
201 /*
202  * In OHOS, Standard function sleep and sendmsg
203  * are used. But w800 doesn't provide
204  * these functions.(complie with option -nostdlib)
205  * Define macros to implement these function.
206  */
207 
208 #ifdef OHOS_WITH_W800
209 #define sleep(x) osDelay((x) * 100)
210 
211 /* Refer to w800 sdk file include/lwip/sockets.h
212  * sendmsg definition is commentted.
213  */
214 #ifndef sendmsg
215 #define sendmsg lwip_sendmsg
216 #endif
217 #endif /* OHOS_WITH_W800 */
218 
219 #endif
220