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 * Create: 2021-12-16 17 */ 18 19 #ifndef __OSAL_DEF_H__ 20 #define __OSAL_DEF_H__ 21 22 #ifdef __KERNEL__ 23 #include <linux/module.h> 24 #endif 25 26 #ifdef __cplusplus 27 #if __cplusplus 28 extern "C" { 29 #endif 30 #endif 31 32 #ifdef __KERNEL__ 33 #define OSAL_THIS_MODULE THIS_MODULE 34 #define osal_module_export(_symbol) EXPORT_SYMBOL(_symbol) 35 #define osal_module_param(name, type, perm) module_param(name, type, perm) 36 #define OSAL_MODULE_PARM_DESC(_parm, desc) MODULE_PARM_DESC(_perm, desc) 37 #define osal_module_init(x) module_init(x) 38 #define osal_module_exit(x) module_exit(x) 39 #define OSAL_MODULE_AUTHOR(_author) MODULE_AUTHOR(_author) 40 #define OSAL_MODULE_DESCRIPTION(_description) MODULE_DESCRIPTION(_description) 41 #define OSAL_MODULE_LICENSE(_license) MODULE_LICENSE(_license) 42 #define OSAL_MODULE_VERSION(_version) MODULE_VERSION(_version) 43 #else 44 #define OSAL_THIS_MODULE 45 #define osal_module_export(_symbol) 46 #define osal_module_param(name, type, perm) 47 #define OSAL_MODULE_PARM_DESC(_parm, desc) 48 #define osal_module_init(x) 49 #define osal_module_exit(x) 50 #define OSAL_MODULE_AUTHOR(_author) 51 #define OSAL_MODULE_DESCRIPTION(_description) 52 #define OSAL_MODULE_LICENSE(_license) 53 #define OSAL_MODULE_VERSION(_version) 54 #endif 55 56 #ifdef __cplusplus 57 #if __cplusplus 58 } 59 #endif 60 #endif 61 62 #endif // __OSAL_DEF_H__ 63