• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 dmac public interface.
15  * Author:
16  * Create: 2021-07-01
17  */
18 
19 #ifndef __FRW_HMAC_H__
20 #define __FRW_HMAC_H__
21 
22 #include "osal_types.h"
23 #include "oal_netbuf_ext.h"
24 #include "mac_vap_ext.h"
25 #include "frw_msg_rom.h"
26 #include "frw_common.h"
27 #ifdef __cplusplus
28 #if __cplusplus
29 extern "C" {
30 #endif
31 #endif
32 
33 #define TIME_OUT_MS 2000
34 
35 typedef struct {
36     osal_u32 data;  /* 配置消息的输入数据buffer指针,内存由调用者分配, 由frw释放 */
37     osal_u32 rsp;     /* 配置消息的同步调用,返回数据的buffer指针,返回数据buffer由接口分配,但需要调用者释放;
38                          同步调用时,接口通过此参数向调用者回传rsp地址,异步调用时,接口会将此参数置为NULL。
39                       */
40     osal_u16 data_len; /* 配置消息的输入数据buffer长度 */
41     osal_u16 rsp_buf_len; /* hmac下发到dmac时填写;同步调用,返回的数据长度,异步调用时,此参数会被接口置为0 */
42     osal_u16 rsp_len;   /* 实际rsp长度,由dmac返回 */
43     osal_u16 sync : 1;   /* 同步标志 */
44     osal_u16 type : 7;   /* 消息类型 */
45     osal_u16 rsv  : 8;   /* 保留字段 */
46 } frw_msg_host;
47 
48 typedef struct {
49     osal_u16    msg_id;
50     osal_u8     vap_id;
51     osal_u8     sync : 1;
52     osal_u8     type : 3;
53     osal_u8     rsv : 4;
54     osal_s32    cb_ret;
55     osal_u32    msg_seq;
56     frw_msg_host     cfg;
57 } frw_msg_adapt_comm;
58 
59 typedef osal_s32 (*frw_msg_callback)(hmac_vap_stru *hmac_vap, frw_msg *msg);
60 /*
61      约定:对于hmac侧而言:
62            send: wal/hmac -> dmac
63            post: wal/hmac -> wal/hmac
64            rcv : dmac -> wal/hmac
65 */
66 
67 /*  msg_id:配置消息ID;
68     sync: 同步消息标志,true,表示同步消息,此时pri参数被忽略;false,表示异步消息,此时pri参数指定消息优先级
69     pri: 消息/配置的优先级;
70     用于从wal/hmac发起的异步消息/配置,但消息/配置不会被发往device侧
71 */
72 /* 用于wal->hmac的同步配置 */
73 
74 osal_s32 frw_msg_hook_register(osal_u16 msg_id, frw_msg_callback msg_cb);
75 osal_void frw_msg_hook_unregister(osal_u16 msg_id);
76 osal_s32 frw_netbuf_hook_register(osal_u16 netbuf_type, frw_msg_callback msg_cb);
77 osal_void frw_netbuf_hook_unregister(osal_u16 netbuf_type);
78 
79 osal_s32 frw_netbuf_exec_callback(osal_u16 netbuf_type, osal_u8 vap_id, frw_msg *msg);
80 osal_s32 frw_msg_host_init(osal_u16 d2d_msgid_begin, osal_u16 w2d_msgid_end, osal_u16 msg_id_max);
81 
82 osal_s32 frw_sync_host_post_msg(osal_u16 msg_id, osal_u8 vap_id, osal_u16 time_out, frw_msg *msg);
83 osal_s32 frw_asyn_host_post_msg(osal_u16 msg_id, frw_post_pri_enum_uint8 pri, osal_u8 vap_id, frw_msg *msg);
84 osal_s32 frw_send_cfg_to_device(osal_u16 msg_id, osal_u8 vap_id, osal_bool sync, osal_u16 time_out, frw_msg *msg);
85 
86 typedef osal_s32 (*frw_host_rcv_callback)(osal_u16 msg_id, osal_u8 vap_id, osal_u32 seq,
87     osal_s32 dev_cb_ret, frw_msg *msg);
88 osal_void frw_host_register_rcv_hook(frw_host_rcv_callback rcv_cb);
89 
90 typedef osal_s32 (*frw_d2h_netbuf_callback)(oal_netbuf_stru *netbuf, osal_u32 payload_len, osal_u8 vap_id,
91     osal_u16 netbuf_type, osal_u8 data_type);
92 osal_void frw_event_flush_event_queue(osal_u16 msg_id);
93 osal_s32 frw_msg_exec_callback(osal_u16 msg_id, osal_u8 vap_id, frw_msg *msg);
94 
95 osal_u32 frw_rx_wifi_cfg_function(hcc_queue_type queue_id, osal_u8 stype,
96     osal_u8 *buf, osal_u32 len, osal_u8 *user_param);
97 osal_u32 frw_rx_wifi_post_action_function(hcc_queue_type queue_id, osal_u8 stype,
98     osal_u8 *buf, osal_u32 len, osal_u8 *user_param);
99 
100 #ifdef _PRE_WLAN_FEATURE_CENTRALIZE
101 extern osal_s32 is_msgid_in_device_range(osal_u16 msg_id);
102 extern osal_s32 dmac_frw_post_async_msg(osal_u16 msg_id, osal_u8 pri, osal_u8 vap_id, frw_msg *msg, osal_u32 seq);
103 osal_u32 frw_dmac_rcv_mgnt_data(oal_dmac_netbuf_stru *netbuf);
104 oal_dmac_netbuf_stru *oal_mem_netbuf_alloc(osal_u8 netbuf_id, osal_u16 len, oal_netbuf_priority_enum_uint8 flag);
105 osal_u8 *oal_dmac_netbuf_payload(const oal_dmac_netbuf_stru *netbuf);
106 osal_void oal_mem_netbuf_free(oal_dmac_netbuf_stru *netbuf);
107 extern osal_s32 dmac_frw_msg_exec_callback(osal_u16 msg_id, osal_u8 vap_id, frw_msg *msg);
108 extern long frw_get_wifi_frw_task_id(osal_void);
109 #endif
110 osal_u32 frw_hcc_tx_adjust_header(oal_netbuf_stru *netbuf, osal_u8 data_type);
111 osal_u32 frw_hmac_rcv_netbuf(oal_netbuf_stru *rx_netbuf);
112 osal_u32 frw_alloc_netbuf(osal_u32 len, oal_netbuf_stru **ret_buf);
113 osal_u32 frw_alloc_pbuf(osal_u32 len, oal_netbuf_stru **ret_buf);
114 osal_s32 frw_msg_host_exit(osal_void);
115 osal_u8 frw_get_devmsg_inqueue_state(osal_void);
116 #ifdef __cplusplus
117 #if __cplusplus
118 }
119 #endif
120 #endif
121 #endif // __FRW_HMAC_H__
122