• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *   Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
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  * Description: OS Abstract Layer.
15  */
16 
17 #ifndef OSAL_INNER_H
18 #define OSAL_INNER_H
19 
20 #ifndef FALSE
21 #define FALSE 0
22 #endif
23 
24 #ifndef TRUE
25 #define TRUE 1
26 #endif
27 
28 #ifndef NULL
29 #define NULL ((void *)0)
30 #endif
31 
32 #define va_num_args_impl(_1, _2, _3, _4, _5, N, ...) N
33 #define va_num_args(...) va_num_args_impl(__VA_ARGS__, 5, 4, 3, 2, 1)
34 #define all_unused_impl_(nargs) osal_unused##nargs
35 #define all_unused_impl(nargs) all_unused_impl_(nargs)
36 
37 #define osal_unused1(var) (void)(var)
38 #define osal_unused2(y, z) osal_unused1(y), osal_unused1(z)
39 #define osal_unused3(x, y, z) osal_unused1(x), osal_unused2(y, z)
40 #define osal_unused4(a, b, x, y) osal_unused2(a, b), osal_unused2(x, y)
41 #define osal_unused5(a, b, x, y, z) osal_unused2(a, b), osal_unused3(x, y, z)
42 #define osal_unused(...) all_unused_impl(va_num_args(__VA_ARGS__))(__VA_ARGS__)
43 
44 #define osal_log(fmt, ...) osal_printk("[%s:%d]:" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__)
45 
46 #endif