1 /* 2 * Copyright (C) 2021 HiSilicon (Shanghai) Technologies CO., LIMITED. 3 * 4 * This program is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU General Public License 6 * as published by the Free Software Foundation; either version 2 7 * of the License, or (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 */ 18 19 #ifndef __OAL_LINUX_WAIT_H__ 20 #define __OAL_LINUX_WAIT_H__ 21 22 /* **************************************************************************** 23 1 其他头文件包含 24 **************************************************************************** */ 25 #include <linux/wait.h> 26 27 #ifdef __cplusplus 28 #if __cplusplus 29 extern "C" { 30 #endif 31 #endif 32 33 /* **************************************************************************** 34 2 STRUCT定义 35 **************************************************************************** */ 36 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) 37 #ifdef _PRE_HDF_LINUX 38 typedef wait_queue_entry_t oal_wait_queue_stru; 39 #else 40 typedef wait_queue_t oal_wait_queue_stru; 41 #endif 42 #endif 43 typedef wait_queue_head_t oal_wait_queue_head_stru; 44 45 /* **************************************************************************** 46 3 宏定义 47 **************************************************************************** */ 48 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) 49 #define hi_wait_queue_wake_up_interrupt(_pst_wq) wake_up_interruptible(_pst_wq) 50 #elif (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 51 extern void __wake_up_interruptible(wait_queue_head_t *wait); 52 #define hi_wait_queue_wake_up_interrupt(p_wait) __wake_up_interruptible(p_wait) 53 #endif 54 55 #define hi_wait_queue_wake_up(_pst_wq) wake_up(_pst_wq) 56 57 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) 58 #define hi_interruptible_sleep_on(_pst_wq) interruptible_sleep_on(_pst_wq) 59 #endif 60 61 #if (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 62 extern void __init_waitqueue_head(wait_queue_head_t *wait); 63 #endif 64 #define hi_wait_queue_init_head(_pst_wq) init_waitqueue_head(_pst_wq) 65 66 #define hi_wait_event_interruptible_timeout(_st_wq, _condition, _timeout) \ 67 wait_event_interruptible_timeout(_st_wq, _condition, _timeout) 68 69 #if (_PRE_OS_VERSION_LINUX == _PRE_OS_VERSION) 70 #define hi_wait_event_timeout(_st_wq, _condition, _timeout) wait_event_timeout(_st_wq, _condition, _timeout) 71 #elif (_PRE_OS_VERSION_LITEOS == _PRE_OS_VERSION) 72 #define hi_wait_event_timeout(_st_wq, _condition, _timeout) \ 73 wait_event_interruptible_timeout(_st_wq, _condition, _timeout) 74 #endif 75 76 #define hi_wait_event_interruptible(_st_wq, _condition) wait_event_interruptible(_st_wq, _condition) 77 78 #ifdef __cplusplus 79 #if __cplusplus 80 } 81 #endif 82 #endif 83 84 #endif /* end of oal_wait.h */ 85