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: osal inner 15 * 16 * Create: 2021-12-16 17 */ 18 19 #ifndef OSAL_INNER_H 20 #define OSAL_INNER_H 21 22 #ifndef FALSE 23 #define FALSE 0 24 #endif 25 26 #ifndef TRUE 27 #define TRUE 1 28 #endif 29 30 #ifndef NULL 31 #define NULL ((void *)0) 32 #endif 33 34 #define va_num_args_impl(_1, _2, _3, _4, _5, N, ...) N 35 #define va_num_args(...) va_num_args_impl(__VA_ARGS__, 5, 4, 3, 2, 1) 36 #define all_unused_impl_(nargs) osal_unused##nargs 37 #define all_unused_impl(nargs) all_unused_impl_(nargs) 38 39 #define osal_unused1(var) (void)(var) 40 #define osal_unused2(y, z) osal_unused1(y), osal_unused1(z) 41 #define osal_unused3(x, y, z) osal_unused1(x), osal_unused2(y, z) 42 #define osal_unused4(a, b, x, y) osal_unused2(a, b), osal_unused2(x, y) 43 #define osal_unused5(a, b, x, y, z) osal_unused2(a, b), osal_unused3(x, y, z) 44 #define osal_unused(...) all_unused_impl(va_num_args(__VA_ARGS__))(__VA_ARGS__) 45 46 #if !defined(OSALLOG_DISABLE) && !defined(CONFIG_DRIVER_DISABLE_OSAL_LOG) 47 #define osal_log(fmt, ...) osal_printk("[%s:%d]:" fmt, __FUNCTION__, __LINE__, ##__VA_ARGS__) 48 #else 49 #define osal_log(fmt, ...) 50 #endif 51 52 #endif 53