• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_COMPLETION_H__
20 #define __OAL_COMPLETION_H__
21 
22 /* ****************************************************************************
23   1 其他头文件包含
24 **************************************************************************** */
25 #include <linux/completion.h>
26 
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif
31 #endif
32 
33 /* ****************************************************************************
34   2 STRUCT定义
35 **************************************************************************** */
36 typedef struct completion oal_completion;
37 
38 /* ****************************************************************************
39   3 枚举定义
40 **************************************************************************** */
41 /* ****************************************************************************
42   4 全局变量声明
43 **************************************************************************** */
44 /* ****************************************************************************
45   5 消息头定义
46 **************************************************************************** */
47 /* ****************************************************************************
48   6 消息定义
49 **************************************************************************** */
50 /* ****************************************************************************
51   7 宏定义
52 **************************************************************************** */
53 #define OAL_INIT_COMPLETION(_my_completion) init_completion(_my_completion)
54 #define OAL_COMPLETE(_my_completion) complete(_my_completion)
55 #define OAL_WAIT_FOR_COMPLETION(_my_completion) wait_for_completion(_my_completion)
56 #define OAL_COMPLETE_ALL(_my_completion) complete_all(_my_completion)
57 
58 /* ****************************************************************************
59   8 UNION定义
60 **************************************************************************** */
61 /* ****************************************************************************
62   9 OTHERS定义
63 **************************************************************************** */
64 /* ****************************************************************************
65   10 函数声明
66 **************************************************************************** */
67 /* ****************************************************************************
68  功能描述  : 同步:等待超时检查
69  输入参数  : 无
70  输出参数  : 无
71  返 回 值  : Return: 0 if timed out, and positive (at least 1, or number of jiffies left till timeout) if completed.
72 **************************************************************************** */
oal_wait_for_completion_timeout(oal_completion * pst_completion,hi_u32 ul_timeout)73 static inline hi_u32 oal_wait_for_completion_timeout(oal_completion *pst_completion, hi_u32 ul_timeout)
74 {
75     return wait_for_completion_timeout(pst_completion, ul_timeout);
76 }
77 
78 #ifdef __cplusplus
79 #if __cplusplus
80 }
81 #endif
82 #endif
83 
84 #endif /* end of oal_completion.h */
85