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: WOW hmac function. 15 * Create: 2021-04-15 16 */ 17 18 #ifndef __HMAC_WOW_H__ 19 #define __HMAC_WOW_H__ 20 21 /***************************************************************************** 22 1 其他头文件包含 23 *****************************************************************************/ 24 #include "oal_types.h" 25 #include "wlan_types_common.h" 26 #include "mac_vap_ext.h" 27 #include "frw_hmac.h" 28 #ifdef _PRE_WLAN_FEATURE_DYNAMIC_OFFLOAD 29 #include "hmac_arp_offload.h" 30 #include "hmac_dhcp_offload.h" 31 #include "hmac_rekey_offload.h" 32 #endif 33 #include "msg_wow_rom.h" 34 35 #ifdef __cplusplus 36 #if __cplusplus 37 extern "C" { 38 #endif 39 #endif 40 41 #undef THIS_FILE_ID 42 #define THIS_FILE_ID OAM_FILE_ID_HMAC_WOW_H 43 /***************************************************************************** 44 2 宏定义 45 *****************************************************************************/ 46 #define WOW_MAX_SIZE (32 * 1024) 47 #define WOW_MAX_BLOCK_NUM 32 48 #define WOW_BLOCK_SIZE 1024 49 #define WOW_SEND_RETRY 3 50 51 /***************************************************************************** 52 3 枚举定义 53 *****************************************************************************/ 54 typedef enum { 55 HMAC_HOST_STATE_INVALID, 56 HMAC_HOST_STATE_WAKEUP, 57 HMAC_HOST_STATE_SLEPT, 58 HMAC_HOST_STATE_BUTT 59 } hmac_host_sleep_state_enum; 60 typedef osal_u8 hmac_host_sleep_state_enum_uint8; 61 62 typedef enum { 63 MAC_WOW_PATTERN_PARAM_OPTION_ADD, 64 MAC_WOW_PATTERN_PARAM_OPTION_DEL, 65 MAC_WOW_PATTERN_PARAM_OPTION_CLR, 66 MAC_WOW_PATTERN_PARAM_OPTION_BUTT 67 } mac_wow_pattern_param_option_enum; 68 69 typedef enum { 70 MAC_WOW_NOTIFY_MEM_RSV, 71 MAC_WOW_NOTIFY_MEM_RESTORE, 72 MAC_WOW_NOTIFY_LOAD, 73 MAC_WOW_NOTIFY_BUTT 74 } mac_wow_autoload_msg_enum; 75 76 /***************************************************************************** 77 7 STRUCT定义 78 *****************************************************************************/ 79 typedef struct { 80 osal_u16 pattern_option; 81 osal_u16 pattern_index; 82 osal_u32 pattern_len; 83 osal_u8 pattern_value[WOW_NETPATTERN_MAX_LEN]; 84 } hmac_cfg_wow_pattern_param_stru; 85 86 typedef struct { 87 hmac_host_sleep_state_enum_uint8 host_sleep_state; 88 osal_u8 wakeup_reason; 89 osal_u8 resv[2]; 90 mac_wow_cfg_stu wow_cfg; 91 } hmac_wow_info_stru; 92 93 typedef void (*pm_wow_wkup_cb)(void); 94 95 /***************************************************************************** 96 10 函数声明 97 *****************************************************************************/ 98 99 static osal_u32 hmac_wow_init_weakref(osal_void) __attribute__ ((weakref("hmac_wow_init"), used)); 100 static osal_void hmac_wow_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_wow_deinit"), used)); 101 #ifdef _PRE_WLAN_FEATURE_DYNAMIC_OFFLOAD 102 extern osal_void pm_wifi_wkup_cb_host_register(pm_wow_wkup_cb cb); 103 #endif 104 osal_s32 hmac_config_wow_activate_switch(hmac_vap_stru *hmac_vap, osal_u32 wow_en); 105 #ifdef __cplusplus 106 #if __cplusplus 107 } 108 #endif 109 #endif 110 111 #endif /* __HMAC_WOW_H__ */