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: hmac_slp.h 15 * Date: 2020-07-07 16 */ 17 18 #ifndef __HMAC_SLP_H__ 19 #define __HMAC_SLP_H__ 20 21 #include "mac_vap_ext.h" 22 #include "mac_frame.h" 23 24 #ifdef __cplusplus 25 #if __cplusplus 26 extern "C" { 27 #endif 28 #endif 29 30 /* 1 其他头文件包含 */ 31 #undef THIS_FILE_ID 32 #define THIS_FILE_ID OAM_FILE_ID_HMAC_SLP_H 33 #define MAC_SLP_SESSION_TIME 50 /* 每个SLP会话总时长不超过50ms */ 34 #define MAC_SLP_CTS_RTS_TIME 8 /* SLP抢占空口时间8ms */ 35 36 typedef enum { 37 UNICAST = 0, // 单播,1对1 38 BROADCAST, // 广播,1对多、多对多 39 } slp_communication_mode; 40 41 typedef struct { 42 slp_communication_mode communication_mode; // 数据通信方式,单播/广播 43 osal_u8 addr[WLAN_MAC_ADDR_LEN]; // 单播时,对端设备的地址; 广播时,广播地址(全f) 44 } slp_device_para; // 测距设备参数 45 46 typedef struct { 47 osal_u8 *payload; 48 osal_u16 payload_len; 49 } slp_nb_payload_req; 50 51 typedef struct { 52 osal_s32 cfo; 53 } slp_nb_cfo_req; /* 从窄带系统处获取的CFO信息 */ 54 55 // RM->WI-FI 56 typedef struct { 57 slp_nb_payload_req payload_req; 58 slp_device_para device_para; 59 } slp_nb_payload_and_device_req; /* 与窄带系统交互的Payload内容, 包含PCN或PRN信息 */ 60 61 // WI-FI->RM 62 typedef struct { 63 slp_nb_payload_req payload_req; 64 slp_nb_cfo_req cfo_req; 65 } slp_nb_payload_and_cfo_req; /* 与窄带系统交互的Payload内容, 包含PCN或PRN信息 */ 66 67 #define WLAN_MAX_CTS_LEN 10 /* RTS帧 mac头长度和总长度一致 */ 68 #define WLAN_MAX_RTS_LEN 16 /* CTS帧 mac头长度和总长度一致 */ 69 #define WLAN_SLP_GTK_IDX_INVAILD 0xFF /* CTS帧 mac头长度和总长度一致 */ 70 /* Type of Tx Descriptor status */ 71 typedef enum { 72 MAC_SLP_REPORT_ACTION_FRAME = 0, 73 MAC_SLP_RM_ACTION_FRAME = 1, 74 MAC_SLP_CTS_FRAME = 2, 75 MAC_SLP_GPIO_FRAME = 3, 76 MAC_SLP_FRAME_BUTT 77 } mac_slp_frame_id_enum; 78 typedef osal_u8 mac_slp_frame_id_enum_uint8; 79 80 typedef enum { 81 SLP_RM_REQUEST = 0, 82 SLP_RM_RESULT_REPORT = 1, 83 SLP_RM_FRAME_SUBTYPE_BUTT 84 } mac_slp_rm_frame_subtype_enum; 85 typedef osal_u8 mac_slp_rm_frame_subtype_enum_uint8; 86 87 typedef struct { 88 osal_u8 category; 89 osal_u8 oui[3]; /* 3字节存放OUI信息 */ 90 osal_u8 oui_type; 91 osal_u8 oui_sub_type; 92 osal_u16 len; 93 } mac_slp_action_hdr_stru; 94 95 typedef osal_bool (*hmac_slp_tx_disable_cb)(osal_void); 96 97 static osal_u32 hmac_slp_init_weakref(osal_void) __attribute__ ((weakref("hmac_slp_init"), used)); 98 static osal_void hmac_slp_deinit_weakref(osal_void) __attribute__ ((weakref("hmac_slp_deinit"), used)); 99 #ifdef __cplusplus 100 #if __cplusplus 101 } 102 #endif 103 #endif 104 105 #endif /* end of hmac_slp.h */ 106