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 15 * Create: 2012年11月8日 16 */ 17 18 #ifndef __HMAC_TWT_H__ 19 #define __HMAC_TWT_H__ 20 21 #include "dmac_ext_if_hcm.h" 22 #include "hmac_fsm.h" 23 #include "msg_twt_rom.h" 24 25 #ifdef __cplusplus 26 #if __cplusplus 27 extern "C" { 28 #endif 29 #endif 30 31 #undef THIS_FILE_ID 32 #define THIS_FILE_ID OAM_FILE_ID_HMAC_TWT_H 33 34 /* 1 其他头文件包含 */ 35 /* 2 宏定义 */ 36 #define HMAC_TWT_P2P_RUNNING_VAP_NUM 3 37 #define HMAC_TWT_CATEGORY 0 38 #define HMAC_TWT_ACTION 1 39 #define HMAC_TWT_FLOW_ID 2 40 #define HMAC_TWT_BITS_OFFSET 32 41 #define TWT_RX_PARA_NUM 11 42 #define WAKE_DURATION_UNIT0 256 43 #define WAKE_DURATION_UNIT1 1024 44 #define MAC_XCAPS_EX_TWT_LEN 10 45 46 /* 3 枚举定义 */ 47 /* 4 全局变量声明 */ 48 /* 5 消息头定义 */ 49 /* 6 消息定义 */ 50 /* 7 STRUCT定义 */ 51 typedef struct { 52 osal_u8 twt_responder_support : 1, 53 twt_requester_support : 1, 54 resv : 6; 55 } mac_device_twt_custom_stru; 56 57 typedef struct { 58 osal_u8 mac_addr[WLAN_MAC_ADDR_LEN]; /* 用户的MAC ADDR */ 59 mac_twt_information_field_stru twt_information_filed; 60 osal_u8 resv[1]; /* 1 byte保留字段 */ 61 } mac_cfg_twt_information_req_param_stru; 62 63 typedef struct { 64 osal_u8 mac_addr[WLAN_MAC_ADDR_LEN]; /* 用户的MAC ADDR */ 65 osal_u8 resv[2]; /* 2 byte保留字段 */ 66 mac_cfg_twt_basic_param_stru twt_basic_param; 67 } mac_cfg_twt_setup_req_param_stru; 68 69 typedef struct { 70 osal_u8 mac_addr[WLAN_MAC_ADDR_LEN]; /* 用户的MAC ADDR */ 71 osal_u8 twt_flow_id; /* flow ID */ 72 osal_u8 resv; 73 } mac_cfg_twt_teardown_req_param_stru; 74 75 typedef struct { 76 mac_cfg_twt_stru sta_cfg_twt_para; 77 mac_device_twt_custom_stru sta_twt_custom_para; 78 osal_u8 resv[3]; 79 } sta_twt_para_stru; 80 81 /* 8 UNION定义 */ 82 83 /* 3 枚举定义 */ 84 typedef enum { 85 TWT_SESSION_OFF = 0, 86 TWT_SESSION_ON = 1, 87 TWT_SESSION_SUSPEND = 2, 88 } hmac_twt_status_enum; 89 90 typedef enum { 91 HMAC_NEXT_TWT_SUBFIELD_SIZE_BITS_0 = 0, 92 HMAC_NEXT_TWT_SUBFIELD_SIZE_BITS_32 = 1, 93 HMAC_NEXT_TWT_SUBFIELD_SIZE_BITS_48 = 2, 94 HMAC_NEXT_TWT_SUBFIELD_SIZE_BITS_64 = 3, 95 96 HMAC_NEXT_TWT_SUBFIELD_SIZE_MAX 97 } hmac_next_twt_subfield_size_enum; 98 99 typedef enum { 100 HMAC_TWT_START_EVENT = 0, 101 HMAC_TWT_END_EVENT = 1, 102 103 HMAC_TWT_EVENT_TYPE_MAX 104 } hmac_twt_event_type_enum; 105 106 /* need same as device define */ 107 typedef enum { 108 TWT_UPDATE_SESSION_CFG = 0, 109 TWT_UPDATE_PS_PAUSE_CFG = 1, 110 TWT_PS_HANDLE_CFG = 2, 111 } hmac_d2hd_twt_sync_type_enum; 112 typedef osal_u32 hmac_d2h_twt_sync_type_enum_u32; 113 114 /* 10 函数声明 */ 115 116 typedef osal_u8 (*hmac_twt_is_session_enable_cb)(const hmac_vap_stru *hmac_vap); 117 typedef osal_bool (*hmac_is_twt_processed_not_need_buff_cb)(const hmac_vap_stru *hmac_vap); 118 typedef osal_bool (*hmac_is_twt_need_buff_cb)(hmac_vap_stru *hmac_vap); 119 typedef osal_u32 (*hmac_twt_tx_action_cb)(hmac_vap_stru *hmac_vap, const hmac_user_stru *hmac_user, 120 const hmac_ctx_action_event_stru *ctx_action_event, oal_netbuf_stru *netbuf, const mac_tx_ctl_stru *tx_ctl); 121 typedef osal_u32 (*hmac_p2p_teardown_twt_session_cb)(hmac_device_stru *hmac_device); 122 typedef osal_void (*hmac_process_update_twt_cb)(hmac_vap_stru *hmac_vap, hmac_user_stru *hmac_user, osal_u8 *payload, 123 osal_u16 msg_len); 124 typedef osal_u8 (*hmac_twt_get_req_bit_cb)(osal_u8 vap_id); 125 typedef osal_void (*hmac_set_ext_cap_twt_req_cb)(hmac_vap_stru *hmac_vap, 126 mac_ext_cap_ie_stru *ext_cap_ie, osal_u8 *ie_len); 127 128 static osal_u32 hmac_twt_sta_init_weakref(osal_void) __attribute__ ((weakref("hmac_twt_sta_init"), used)); 129 static osal_void hmac_twt_sta_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_twt_sta_deinit"), used)); 130 131 #ifdef __cplusplus 132 #if __cplusplus 133 } 134 #endif 135 #endif 136 137 #endif /* end of hmac_twt.h */ 138 139