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: Header file of frw public interface.
15 * Author:
16 * Create: 2020-01-01
17 */
18
19 #ifndef __FRW_EXT_IF_H__
20 #define __FRW_EXT_IF_H__
21
22 /*****************************************************************************
23 其他头文件包含
24 *****************************************************************************/
25 #include "oal_types.h"
26 #include "oal_list.h"
27 #include "oam_ext_if.h"
28 #include "frw_msg_rom.h"
29 #include "oal_list.h"
30 #include "frw_ext_common_rom.h"
31
32 #ifdef __cplusplus
33 #if __cplusplus
34 extern "C" {
35 #endif
36 #endif
37
38 typedef enum {
39 OAM_MODULE_ID_ALL,
40 OAM_MODULE_ID_WAL,
41 OAM_MODULE_ID_HMAC,
42 OAM_MODULE_ID_DMAC,
43
44 OAM_MODULE_ID_HAL,
45 OAM_MODULE_ID_OAM,
46 OAM_MODULE_ID_OAL,
47 OAM_MODULE_ID_FRW,
48 OAM_MODULE_ID_ALG,
49 OAM_MODULE_ID_PLAT,
50 OAM_MODULE_ID_SDT,
51
52 OAM_MODULE_ID_BUTT
53 } oam_module_id_enum;
54
55 #undef THIS_FILE_ID
56 #define THIS_FILE_ID OAM_FILE_ID_FRW_EXT_IF_H
57
58 typedef osal_u16 oam_module_id_enum_uint16;
59
60 #define FRW_TIMER_DEFAULT_TIME 10
61 #define frw_timer_restart_timer(timeout, timeout_val, is_periodic) \
62 frw_timer_restart_timer_inner(timeout, timeout_val, is_periodic, THIS_FILE_ID, __LINE__)
63 #define frw_destroy_timer_entry(timeout) frw_timer_destroy_timer(THIS_FILE_ID, __LINE__, timeout)
64 #define frw_create_timer_entry(timeout, timeout_func, timeout_val, timeout_arg, is_periodic) \
65 do { \
66 frw_init_timer(timeout, timeout_func, timeout_arg, is_periodic); \
67 frw_timer_create_timer(THIS_FILE_ID, __LINE__, timeout, timeout_val); \
68 } while (0)
69 /*****************************************************************************
70 全局变量声明
71 *****************************************************************************/
72 /*****************************************************************************
73 函数声明
74 *****************************************************************************/
75 /* host frw_main */
76 extern osal_s32 frw_main_init_etc(osal_void);
77 extern osal_void frw_main_exit_etc(osal_void);
78 extern osal_void frw_main_destroy(osal_void);
79 extern osal_void frw_set_init_state_etc(frw_init_enum_uint16 init_state);
80 extern frw_init_enum_uint16 frw_get_init_state_etc(osal_void);
81
82 extern osal_void frw_event_process_all_event_etc(osal_ulong data);
83 extern osal_void frw_timer_restart_timer_inner(frw_timeout_stru *timeout, osal_u32 timeout_val,
84 oal_bool_enum_uint8 is_periodic, osal_u32 file_id, osal_u32 line);
85 extern osal_void frw_timer_add_timer(frw_timeout_stru *timeout);
86 extern osal_void frw_timer_create_timer_inner(osal_u32 file_id, osal_u32 line_num,
87 frw_timeout_stru *timeout, osal_u32 time_val);
88 extern osal_void frw_timer_stop_timer(frw_timeout_stru *timeout);
89 extern osal_void frw_timer_delete_all_timer(osal_void);
90 extern osal_void frw_timer_clean_timer(oam_module_id_enum_uint16 module_id);
91
92 /*****************************************************************************
93 函 数 名 : frw_init_timer
94 功能描述 : 定时器初始化
95 *****************************************************************************/
frw_init_timer(frw_timeout_stru * timer,const frw_timeout_func func,osal_void * arg,oal_bool_enum_uint8 periodic)96 static INLINE__ osal_void frw_init_timer(frw_timeout_stru *timer,
97 const frw_timeout_func func, osal_void *arg, oal_bool_enum_uint8 periodic)
98 {
99 timer->func = func;
100 timer->timeout_arg = arg;
101 timer->is_periodic = periodic;
102 }
103
104 osal_void frw_timer_create_timer(osal_u32 file_id, osal_u32 line_num, frw_timeout_stru *timeout, osal_u32 time_val);
105 osal_void frw_timer_destroy_timer(osal_u32 file_id, osal_u32 line_num, frw_timeout_stru *timeout);
106
107 #ifdef __cplusplus
108 #if __cplusplus
109 }
110 #endif
111 #endif
112
113 #endif /* end of frw_ext_if.h */
114