first commit

This commit is contained in:
pvvx 2016-11-09 03:56:41 +03:00
parent 2ee525362e
commit d108756e9b
792 changed files with 336059 additions and 0 deletions

View file

@ -0,0 +1,478 @@
#ifndef WLANCONFIG_H
#define WLANCONFIG_H
/*
* Include user defined options first. Anything not defined in these files
* will be set to standard values. Override anything you dont like!
*/
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B) || defined(CONFIG_HARDWARE_8188F)
#include "platform_opts.h"
#endif
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
#define CONFIG_PLATFORM_AMEBA_X
#endif
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#define PLATFORM_FREERTOS 1
#define CONFIG_GSPI_HCI
#else
#define CONFIG_LX_HCI
#endif
#ifndef CONFIG_INIC_EN
#define CONFIG_INIC_EN 0//For iNIC project
#if CONFIG_INIC_EN
#define CONFIG_LWIP_LAYER 0
#endif
#endif
#define CONFIG_LITTLE_ENDIAN
#define CONFIG_80211N_HT
//#define CONFIG_RECV_REORDERING_CTRL
#define RTW_NOTCH_FILTER 0
#define CONFIG_EMBEDDED_FWIMG
#define CONFIG_PHY_SETTING_WITH_ODM
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#define CONFIG_ODM_REFRESH_RAMASK
#define HAL_MAC_ENABLE 1
#define HAL_BB_ENABLE 1
#define HAL_RF_ENABLE 1
#endif
#if defined(CONFIG_PLATFORM_AMEBA_X)
/* Patch when dynamic mechanism is not ready */
//#define CONFIG_DM_PATCH
#endif
//#define CONFIG_DEBUG
//#define CONFIG_DEBUG_RTL871X
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define CONFIG_MEM_MONITOR MEM_MONITOR_SIMPLE
#define WLAN_INTF_DBG 0
//#define CONFIG_DEBUG_DYNAMIC
//#define DBG_TX 1
//#define DBG_XMIT_BUF 1
//#define DBG_XMIT_BUF_EXT 1
#define DBG_TX_DROP_FRAME
#else
#define CONFIG_MEM_MONITOR MEM_MONITOR_LEAK
//#define CONFIG_TRACE_SKB
//#define WLAN_INTF_DBG
#endif // CONFIG_PLATFORM_AMEBA_X
//#define CONFIG_DONT_CARE_TP
//#define CONFIG_MEMORY_ACCESS_ALIGNED
#define CONFIG_POWER_SAVING
#ifdef CONFIG_POWER_SAVING
#define CONFIG_IPS
#define CONFIG_LPS
//#define CONFIG_LPS_LCLK
#define CONFIG_LPS_32K
#define TDMA_POWER_SAVING
#define CONFIG_WAIT_PS_ACK
#endif
#define BAD_MIC_COUNTERMEASURE 1
#define DEFRAGMENTATION 1
#define WIFI_LOGO_CERTIFICATION 0
#if WIFI_LOGO_CERTIFICATION
#define RX_AGGREGATION 1
#define RX_AMSDU 1
#else
#define RX_AGGREGATION 0
#define RX_AMSDU 0
#endif
#if defined(CONFIG_PLATFORM_AMEBA_X)
#if !defined(CONFIG_PLATFORM_8711B)
#define CONFIG_USE_TCM_HEAP 1 /* USE TCM HEAP */
#endif
#define CONFIG_RECV_TASKLET_THREAD
#define CONFIG_XMIT_TASKLET_THREAD
#else
#define CONFIG_XMIT_THREAD_MODE
#endif // CONFIG_PLATFORM_AMEBA_X
//#define CONFIG_RECV_THREAD_MODE /* Wlan IRQ Polling Mode*/
//#define CONFIG_ISR_THREAD_MODE_POLLING /* Wlan IRQ Polling Mode*/
//1 Chris
#ifndef CONFIG_SDIO_HCI
#define CONFIG_ISR_THREAD_MODE_INTERRUPT /* Wlan IRQ Interrupt Mode*/
#endif
#if defined(CONFIG_ISR_THREAD_MODE_POLLING) && defined(CONFIG_ISR_THREAD_MODE_INTERRUPT)
#error "CONFIG_ISR_THREAD_MODE_POLLING and CONFIG_ISR_THREAD_MODE_INTERRUPT are mutually exclusive. "
#endif
#if defined(CONFIG_PLATFORM_AMEBA_X)
/* CRC DMEM optimized mode consume 1k less SRM memory consumption */
#define CRC_IMPLEMENTATION_MODE CRC_IMPLEMENTATION_DMEM_OPTIMIZED
#endif
/* AES DMEM optimized mode comsume 10k less memory compare to
IMEM optimized mode AES_IMPLEMENTATION_IMEM_OPTIMIZED */
#define AES_IMPLEMENTATION_MODE AES_IMPLEMENTATION_DMEM_OPTIMIZED
#define USE_SKB_AS_XMITBUF 1
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define USE_XMIT_EXTBUFF 1
#else
#define USE_XMIT_EXTBUFF 0
#endif
#define USE_MUTEX_FOR_SPINLOCK 1
// remove function to reduce code
#define NOT_SUPPORT_5G
#define NOT_SUPPORT_RF_MULTIPATH
#define NOT_SUPPORT_VHT
#define NOT_SUPPORT_40M
#define NOT_SUPPORT_80M
#define NOT_SUPPORT_BBSWING
#define NOT_SUPPORT_OLD_CHANNEL_PLAN
#define NOT_SUPPORT_BT
#define CONFIG_WIFI_SPEC 0
#define CONFIG_FAKE_EFUSE 0
#if CONFIG_FAKE_EFUSE
#define FAKE_CHIPID CHIPID_8711AN
#endif
#define CONFIG_AUTO_RECONNECT 1
#define ENABLE_HWPDN_PIN
#define SUPPORT_SCAN_BUF 1
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#define BE_I_CUT 1
#endif
/* For WPA2 */
#define CONFIG_INCLUDE_WPA_PSK
#ifdef CONFIG_INCLUDE_WPA_PSK
#define CONFIG_MULTIPLE_WPA_STA
//#define CONFIG_WPA2_PREAUTH
#define PSK_SUPPORT_TKIP 1
#endif
//#define AP_PSK_SUPPORT_TKIP
/* For promiscuous mode */
#define CONFIG_PROMISC
#ifdef CONFIG_PROMISC
//#define CONFIG_PROMISC_SCAN_CONCURENT
#endif
#define PROMISC_DENY_PAIRWISE 0
/* For Simple Link */
#ifndef CONFIG_INCLUDE_SIMPLE_CONFIG
//#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
#endif
// for probe request with custom vendor specific IE
#define CONFIG_CUSTOM_IE
#if !defined(CONFIG_PLATFORM_AMEBA_X)
/* For multicast */
#define CONFIG_MULTICAST
#endif
/* For STA+AP Concurrent MODE */
#if !defined(CONFIG_PLATFORM_8711B)
#define CONFIG_CONCURRENT_MODE
#endif
#ifdef CONFIG_CONCURRENT_MODE
#if defined(CONFIG_PLATFORM_8195A)
#define CONFIG_RUNTIME_PORT_SWITCH
#endif
#if defined(CONFIG_HARDWARE_8188F)
#define NET_IF_NUM 2
#else
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
#endif
#else
#if defined(CONFIG_HARDWARE_8188F)
#define NET_IF_NUM 1
#else
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
#endif
#endif
/****************** For EAP auth configurations *******************/
#define CONFIG_TLS 0
#define CONFIG_PEAP 0
#define CONFIG_TTLS 0
// DO NOT change the below config of EAP
#ifdef PRE_CONFIG_EAP
#define CONFIG_TLS 1
#define CONFIG_PEAP 1
#define CONFIG_TTLS 1
#endif
// enable 1X code in lib_wlan as default (increase 380 bytes)
#define CONFIG_EAP
#if CONFIG_TLS || CONFIG_PEAP || CONFIG_TTLS
#define EAP_REMOVE_UNUSED_CODE 1
#endif
#define EAP_SSL_VERIFY_SERVER
#if CONFIG_TLS
#define EAP_SSL_VERIFY_CLIENT
#endif
#if CONFIG_TTLS
#define EAP_MSCHAPv2
#define EAP_TTLS_MSCHAPv2
//#define EAP_TTLS_EAP
//#define EAP_TTLS_MSCHAP
//#define EAP_TTLS_PAP
//#define EAP_TTLS_CHAP
#endif
/****************** End of EAP configurations *******************/
/* For WPS and P2P */
// #define CONFIG_WPS
#if 0
#define CONFIG_WPS_AP
#define CONFIG_P2P_NEW
#if (!defined(SUPPORT_SCAN_BUF)||!defined(CONFIG_WPS_AP)) && defined(CONFIG_P2P_NEW)
#error "If CONFIG_P2P_NEW, need to SUPPORT_SCAN_BUF"
#endif
#endif
#define CONFIG_NEW_SIGNAL_STAT_PROCESS
/* For AP_MODE */
#define CONFIG_AP_MODE
extern unsigned char g_user_ap_sta_num;
#define USER_AP_STA_NUM g_user_ap_sta_num
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define AP_STA_NUM 3 //2014/10/27 modify to 3
#define USE_DEDICATED_BCN_TX 0
#if USE_DEDICATED_BCN_TX
#error "WLAN driver for Ameba should not enable USE_DEDICATED_BCN_TX"
#endif
#else
extern unsigned int g_ap_sta_num;
#define AP_STA_NUM 3//g_ap_sta_num
#endif
#ifdef CONFIG_AP_MODE
#define CONFIG_NATIVEAP_MLME
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define CONFIG_INTERRUPT_BASED_TXBCN
#endif
#ifdef CONFIG_INTERRUPT_BASED_TXBCN
//#define CONFIG_INTERRUPT_BASED_TXBCN_EARLY_INT
#define CONFIG_INTERRUPT_BASED_TXBCN_BCN_OK_ERR
#endif
// #define CONFIG_GK_REKEY
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#define USE_DEDICATED_BCN_TX 1
#endif
#if CONFIG_INIC_EN
// #define REPORT_STA_EVENT //useless
#endif
#else
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#define USE_DEDICATED_BCN_TX 0
#endif
#endif
#if defined(CONFIG_AP_MODE) && defined(CONFIG_GK_REKEY) && !defined(CONFIG_MULTIPLE_WPA_STA)
#error "If CONFIG_GK_REKEY when CONFIG_AP_MODE, need to CONFIG_MULTIPLE_WPA_STA"
#endif
#if !defined(CONFIG_PLATFORM_AMEBA_X)
#if !defined(CONFIG_AP_MODE) && defined(CONFIG_CONCURRENT_MODE)
#error "If CONFIG_CONCURRENT_MODEE, need to CONFIG_AP_MODE"
#endif
#endif
/* For efuse or flash config */
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define CONFIG_RW_PHYSICAL_EFUSE 0 // Mask efuse user blocks
#define CONFIG_HIDE_PROTECT_EFUSE 1
#define CONFIG_ADAPTOR_INFO_CACHING_FLASH 1
#define CHECK_FLASH_VALID_MASK 1
#define CHECK_EFUSE_VALID_MASK 1
/* For K-free */
// #if !defined(CONFIG_PLATFORM_8711B)
#define CONFIG_RF_GAIN_OFFSET
// #endif
#endif // CONFIG_PLATFORM_AMEBA_X
/* For MP_MODE */
//#define CONFIG_MP_INCLUDED
#ifdef CONFIG_MP_INCLUDED
#define MP_DRIVER 1
#define CONFIG_MP_IWPRIV_SUPPORT
// #define HAL_EFUSE_MEMORY
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define MP_REG_TEST
#endif
#else
#define MP_DRIVER 0
#if defined(CONFIG_PLATFORM_8195A)
//Control wifi mcu function
#define CONFIG_LITTLE_WIFI_MCU_FUNCTION_THREAD
#define CONFIG_ODM_REFRESH_RAMASK
#define CONFIG_ANTENNA_DIVERSITY
#endif
#endif // #ifdef CONFIG_MP_INCLUDED
#if defined(CONFIG_PLATFORM_AMEBA_X)
#if defined(CONFIG_PLATFORM_8195A)
#ifndef CONFIG_RTL8195A
#define CONFIG_RTL8195A
#endif
#endif
#if defined(CONFIG_PLATFORM_8711B)
#ifndef CONFIG_RTL8711B
#define CONFIG_RTL8711B
#endif
#endif
#elif defined(CONFIG_HARDWARE_8188F)
#define CONFIG_RTL8188F
#else
#define CONFIG_RTL8188E
#endif
#define RTL8192C_SUPPORT 0
#define RTL8192CE_SUPPORT 0
#define RTL8192CU_SUPPORT 0
#define RTL8192D_SUPPORT 0
#define RTL8192DE_SUPPORT 0
#define RTL8192DU_SUPPORT 0
#define RTL8723A_SUPPORT 0
#define RTL8723AU_SUPPORT 0
#define RTL8723AS_SUPPORT 0
#define RTL8192E_SUPPORT 0
#define RTL8812A_SUPPORT 0
#define RTL8821A_SUPPORT 0
#define RTL8723B_SUPPORT 0
#define RTL8195A_SUPPORT 0
#define RTL8188E_SUPPORT 0
#define RTL8188F_SUPPORT 0
#define RTL8711B_SUPPORT 0
#if defined(CONFIG_PLATFORM_8195A)
#undef RTL8195A_SUPPORT
#define RTL8195A_SUPPORT 1
#elif defined(CONFIG_PLATFORM_8711B)
#undef RTL8711B_SUPPORT
#define RTL8711B_SUPPORT 1
#elif defined(CONFIG_HARDWARE_8188F)
#undef RTL8188F_SUPPORT
#define RTL8188F_SUPPORT 1
#else
#undef RTL8188E_SUPPORT
#define RTL8188E_SUPPORT 1
#endif
#define TEST_CHIP_SUPPORT 0
#define RTL8188E_FOR_TEST_CHIP 0
#define RTL8188E_FPGA_TRUE_PHY_VERIFICATION 0
// for Debug message
#define DBG 0
#if defined(CONFIG_PLATFORM_AMEBA_X)
#if(DBG == 0)
#define ROM_E_RTW_MSG 1
/* For DM debug*/
// BB
#define DBG_RX_INFO 1
#define DBG_TX_RATE 1 // DebugComponents: bit9
#define DBG_DM_RA 1 // DebugComponents: bit9
#define DBG_DM_DIG 1 // DebugComponents: bit0
#define DBG_DM_ANT_DIV 1 // DebugComponents: bit6
#define DBG_DM_ADAPTIVITY 1 // DebugComponents: bit17
// RF
#define DBG_PWR_TRACKING 1 // DebugComponents: bit24
#define DBG_RF_IQK 1 // DebugComponents: bit26
// Common
#define DBG_PWR_INDEX 1 // DebugComponents: bit30
#endif
#endif
/* For DM support */
#if defined(CONFIG_RTL8188F)
#define RATE_ADAPTIVE_SUPPORT 0
#else
#define RATE_ADAPTIVE_SUPPORT 1
#endif
// adaptivity
#define RTW_ADAPTIVITY_EN_DISABLE 0
#define RTW_ADAPTIVITY_EN_ENABLE 1
#define CONFIG_RTW_ADAPTIVITY_EN RTW_ADAPTIVITY_EN_DISABLE
#define RTW_ADAPTIVITY_MODE_NORMAL 0
#define RTW_ADAPTIVITY_MODE_CARRIER_SENSE 1
#define CONFIG_RTW_ADAPTIVITY_MODE RTW_ADAPTIVITY_MODE_CARRIER_SENSE
#define CONFIG_RTW_ADAPTIVITY_DML 0
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define CONFIG_POWER_TRAINING_WIL 0 // in RA
#else
#define POWER_BY_RATE_SUPPORT 0
#endif
#if defined(CONFIG_PLATFORM_AMEBA_X)
#define RTL8195A_FOR_TEST_CHIP 0
//#define CONFIG_WIFI_TEST 1
//#define CONFIG_MAC_LOOPBACK_DRIVER 1
//#define CONFIG_WLAN_HAL_TEST 1
//#define SKB_PRE_ALLOCATE_TX 1
#define SKB_PRE_ALLOCATE_RX 0
#define TX_CHECK_DSEC_ALWAYS 1
#define CONFIG_DBG_DISABLE_RDU_INTERRUPT
//#define CONFIG_WLAN_HAL_RX_TASK
#if (SKB_PRE_ALLOCATE_RX == 1)
#define EXCHANGE_LXBUS_RX_SKB 0
#endif
#if defined(CONFIG_PLATFORM_8711B)
//Enable mac loopback for test mode (Ameba)
#define CONFIG_TWO_MAC_DRIVER // for test mode
#endif
#ifdef ENABLE_MAC_LB_FOR_TEST_MODE
#define CONFIG_SUDO_PHY_SETTING
#define INT_HANDLE_IN_ISR 1
#define CONFIG_LWIP_LAYER 0
#define CONFIG_WLAN_HAL_TEST
#define CONFIG_WLAN_HAL_RX_TASK
#define CONFIG_MAC_LOOPBACK_DRIVER_RTL8711B 1
#define HAL_MAC_ENABLE 1
#define CONFIG_TWO_MAC_TEST_MODE
#define DISABLE_BB_RF 1
#else
//#define CONFIG_TWO_MAC_DRIVER //for mornal driver; two mac
#ifdef CONFIG_TWO_MAC_DRIVER
#define CONFIG_SUDO_PHY_SETTING
#define HAL_MAC_ENABLE 1
#define DISABLE_BB_RF 1
#else
#define HAL_MAC_ENABLE 1
#define HAL_BB_ENABLE 1
#define HAL_RF_ENABLE 1
#define DISABLE_BB_RF 0
#endif
//#define INT_HANDLE_IN_ISR 1
#endif
#endif // CONFIG_PLATFORM_AMEBA_X
#ifndef CONFIG_LWIP_LAYER
#define CONFIG_LWIP_LAYER 1
#endif
#define CONFIG_MAC_ADDRESS 0
//fast reconnection
//#define CONFIG_FAST_RECONNECTION 1
#if defined(CONFIG_INIC_EN)&&(CONFIG_INIC_EN==1)
#define CONFIG_RECV_REORDERING_CTRL //enable reordering for iNIC high throughput
#undef RX_AGGREGATION
#define RX_AGGREGATION 1
#undef NOT_SUPPORT_40M
#undef CONFIG_CONCURRENT_MODE
#endif
#endif //WLANCONFIG_H

View file

@ -0,0 +1,106 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef __DRV_CONF_H__
#define __DRV_CONF_H__
#include "autoconf.h"
#if ((RTL8195A_SUPPORT==1) || (RTL8711B_SUPPORT==1))
#include "platform_autoconf.h"
#endif
#if defined (PLATFORM_LINUX) && defined (PLATFORM_WINDOWS)
#error "Shall be Linux or Windows, but not both!\n"
#endif
//Older Android kernel doesn't has CONFIG_ANDROID defined,
//add this to force CONFIG_ANDROID defined
#ifdef CONFIG_PLATFORM_ANDROID
#define CONFIG_ANDROID
#endif
#ifdef CONFIG_ANDROID
//Some Android build will restart the UI while non-printable ascii is passed
//between java and c/c++ layer (JNI). We force CONFIG_VALIDATE_SSID
//for Android here. If you are sure there is no risk on your system about this,
//mask this macro define to support non-printable ascii ssid.
//#define CONFIG_VALIDATE_SSID
#ifdef CONFIG_PLATFORM_ARM_SUNxI
#ifdef CONFIG_VALIDATE_SSID
#undef CONFIG_VALIDATE_SSID
#endif
#endif
//Android expect dbm as the rx signal strength unit
#define CONFIG_SIGNAL_DISPLAY_DBM
#endif
#if defined(CONFIG_HAS_EARLYSUSPEND) && defined (CONFIG_RESUME_IN_WORKQUEUE)
#warning "You have CONFIG_HAS_EARLYSUSPEND enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
#undef CONFIG_RESUME_IN_WORKQUEUE
#endif
#if defined(CONFIG_ANDROID_POWER) && defined (CONFIG_RESUME_IN_WORKQUEUE)
#warning "You have CONFIG_ANDROID_POWER enabled in your system, we disable CONFIG_RESUME_IN_WORKQUEUE automatically"
#undef CONFIG_RESUME_IN_WORKQUEUE
#endif
#ifdef CONFIG_RESUME_IN_WORKQUEUE //this can be removed, because there is no case for this...
#if !defined( CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
#error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
#error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
#endif
#endif
//About USB VENDOR REQ
#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
#warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically"
#define CONFIG_USB_VENDOR_REQ_MUTEX
#endif
#if defined(CONFIG_VENDOR_REQ_RETRY) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
#warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_VENDOR_REQ_RETRY automatically"
#define CONFIG_USB_VENDOR_REQ_MUTEX
#endif
#ifndef CONFIG_RTW_ADAPTIVITY_EN
#define CONFIG_RTW_ADAPTIVITY_EN 0
#endif
#ifndef CONFIG_RTW_ADAPTIVITY_MODE
#define CONFIG_RTW_ADAPTIVITY_MODE 0
#endif
#ifndef CONFIG_RTW_ADAPTIVITY_DML
#define CONFIG_RTW_ADAPTIVITY_DML 0
#endif
#ifndef CONFIG_RTW_ADAPTIVITY_DC_BACKOFF
#define CONFIG_RTW_ADAPTIVITY_DC_BACKOFF 4
#endif
#ifndef CONFIG_RTW_NHM_EN
#define CONFIG_RTW_NHM_EN 0
#endif
//#include <rtl871x_byteorder.h>
#endif // __DRV_CONF_H__

View file

@ -0,0 +1,38 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2014 Realtek Corporation. All rights reserved.
*
* This is ROM code section.
*
*
******************************************************************************/
#ifndef ROM_AES_H
#define ROM_AES_H
typedef struct
{
u32 erk[64]; /* encryption round keys */
u32 drk[64]; /* decryption round keys */
int nr; /* number of rounds */
}aes_context;
#define AES_BLOCKSIZE8 8
#define AES_BLK_SIZE 16 // # octets in an AES block
typedef union _aes_block // AES cipher block
{
unsigned long x[AES_BLK_SIZE/4]; // access as 8-bit octets or 32-bit words
unsigned char b[AES_BLK_SIZE];
}aes_block;
void AES_WRAP(unsigned char * plain, int plain_len,
unsigned char * iv, int iv_len,
unsigned char * kek, int kek_len,
unsigned char *cipher, unsigned short *cipher_len);
void AES_UnWRAP(unsigned char * cipher, int cipher_len,
unsigned char * kek, int kek_len,
unsigned char * plain);
#endif

View file

@ -0,0 +1,456 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#ifndef __RTW_DEBUG_H__
#define __RTW_DEBUG_H__
#define _drv_always_ 1
#define _drv_emerg_ 2
#define _drv_alert_ 3
#define _drv_crit_ 4
#define _drv_err_ 5
#define _drv_warning_ 6
#define _drv_notice_ 7
#define _drv_info_ 8
#define _drv_dump_ 9
#define _drv_debug_ 10
#define _module_rtl871x_xmit_c_ BIT(0)
#define _module_xmit_osdep_c_ BIT(1)
#define _module_rtl871x_recv_c_ BIT(2)
#define _module_recv_osdep_c_ BIT(3)
#define _module_rtl871x_mlme_c_ BIT(4)
#define _module_mlme_osdep_c_ BIT(5)
#define _module_rtl871x_sta_mgt_c_ BIT(6)
#define _module_rtl871x_cmd_c_ BIT(7)
#define _module_cmd_osdep_c_ BIT(8)
#define _module_rtl871x_io_c_ BIT(9)
#define _module_io_osdep_c_ BIT(10)
#define _module_os_intfs_c_ BIT(11)
#define _module_rtl871x_security_c_ BIT(12)
#define _module_rtl871x_eeprom_c_ BIT(13)
#define _module_hal_init_c_ BIT(14)
#define _module_hci_hal_init_c_ BIT(15)
#define _module_rtl871x_ioctl_c_ BIT(16)
#define _module_rtl871x_ioctl_set_c_ BIT(17)
#define _module_rtl871x_ioctl_query_c_ BIT(18)
#define _module_rtl871x_pwrctrl_c_ BIT(19)
#define _module_hci_intfs_c_ BIT(20)
#define _module_hci_ops_c_ BIT(21)
#define _module_osdep_service_c_ BIT(22)
#define _module_mp_ BIT(23)
#define _module_hci_ops_os_c_ BIT(24)
#define _module_rtl871x_ioctl_os_c BIT(25)
#define _module_rtl8712_cmd_c_ BIT(26)
#define _module_fwcmd_c_ BIT(27)
#define _module_rtl8192c_xmit_c_ BIT(28)
#define _module_hal_xmit_c_ BIT(28)
#define _module_efuse_ BIT(29)
#define _module_rtl8712_recv_c_ BIT(30)
#define _module_rtl8712_led_c_ BIT(31)
#undef _MODULE_DEFINE_
#if defined _RTW_XMIT_C_
#define _MODULE_DEFINE_ _module_rtl871x_xmit_c_
#elif defined _XMIT_OSDEP_C_
#define _MODULE_DEFINE_ _module_xmit_osdep_c_
#elif defined _RTW_RECV_C_
#define _MODULE_DEFINE_ _module_rtl871x_recv_c_
#elif defined _RECV_OSDEP_C_
#define _MODULE_DEFINE_ _module_recv_osdep_c_
#elif defined _RTW_MLME_C_
#define _MODULE_DEFINE_ _module_rtl871x_mlme_c_
#elif defined _MLME_OSDEP_C_
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
#elif defined _RTW_MLME_EXT_C_
#define _MODULE_DEFINE_ 1
#elif defined _RTW_STA_MGT_C_
#define _MODULE_DEFINE_ _module_rtl871x_sta_mgt_c_
#elif defined _RTW_CMD_C_
#define _MODULE_DEFINE_ _module_rtl871x_cmd_c_
#elif defined _CMD_OSDEP_C_
#define _MODULE_DEFINE_ _module_cmd_osdep_c_
#elif defined _RTW_IO_C_
#define _MODULE_DEFINE_ _module_rtl871x_io_c_
#elif defined _IO_OSDEP_C_
#define _MODULE_DEFINE_ _module_io_osdep_c_
#elif defined _OS_INTFS_C_
#define _MODULE_DEFINE_ _module_os_intfs_c_
#elif defined _RTW_SECURITY_C_
#define _MODULE_DEFINE_ _module_rtl871x_security_c_
#elif defined _RTW_EEPROM_C_
#define _MODULE_DEFINE_ _module_rtl871x_eeprom_c_
#elif defined _HAL_INTF_C_
#define _MODULE_DEFINE_ _module_hal_init_c_
#elif (defined _HCI_HAL_INIT_C_) || (defined _SDIO_HALINIT_C_)
#define _MODULE_DEFINE_ _module_hci_hal_init_c_
#elif defined _RTL871X_IOCTL_C_
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_c_
#elif defined _RTL871X_IOCTL_SET_C_
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_set_c_
#elif defined _RTL871X_IOCTL_QUERY_C_
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_query_c_
#elif defined _RTL871X_PWRCTRL_C_
#define _MODULE_DEFINE_ _module_rtl871x_pwrctrl_c_
#elif defined _RTW_PWRCTRL_C_
#define _MODULE_DEFINE_ 1
#elif defined _HCI_INTF_C_
#define _MODULE_DEFINE_ _module_hci_intfs_c_
#elif defined _HCI_OPS_C_
#define _MODULE_DEFINE_ _module_hci_ops_c_
#elif defined _SDIO_OPS_C_
#define _MODULE_DEFINE_ 1
#elif defined _OSDEP_HCI_INTF_C_
#define _MODULE_DEFINE_ _module_hci_intfs_c_
#elif defined _OSDEP_SERVICE_C_
#define _MODULE_DEFINE_ _module_osdep_service_c_
#elif defined _HCI_OPS_OS_C_
#define _MODULE_DEFINE_ _module_hci_ops_os_c_
#elif defined _RTL871X_IOCTL_LINUX_C_
#define _MODULE_DEFINE_ _module_rtl871x_ioctl_os_c
#elif defined _RTL8712_CMD_C_
#define _MODULE_DEFINE_ _module_rtl8712_cmd_c_
#elif defined _RTL8192C_XMIT_C_
#define _MODULE_DEFINE_ 1
#elif defined _RTL8723AS_XMIT_C_
#define _MODULE_DEFINE_ 1
#elif defined _RTL8712_RECV_C_
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
#elif defined _RTL8192CU_RECV_C_
#define _MODULE_DEFINE_ _module_rtl8712_recv_c_
#elif defined _RTL871X_MLME_EXT_C_
#define _MODULE_DEFINE_ _module_mlme_osdep_c_
#elif defined _RTW_MP_C_
#define _MODULE_DEFINE_ _module_mp_
#elif defined _RTW_MP_IOCTL_C_
#define _MODULE_DEFINE_ _module_mp_
#elif defined _RTW_EFUSE_C_
#define _MODULE_DEFINE_ _module_efuse_
#endif
#ifdef PLATFORM_OS_CE
extern void rtl871x_cedbg(const char *fmt, ...);
#endif
#define RT_TRACE(_Comp, _Level, Fmt) do{}while(0)
#define _func_enter_ do{}while(0)
#define _func_exit_ do{}while(0)
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) do{}while(0)
#ifdef PLATFORM_WINDOWS
#define DBG_871X do {} while(0)
#define MSG_8192C do {} while(0)
#define DBG_8192C do {} while(0)
#define DBG_871X_LEVEL do {} while(0)
#else
#define DBG_871X(x, ...) do {} while(0)
#define MSG_8192C(x, ...) do {} while(0)
#define DBG_8192C(x,...) do {} while(0)
#define DBG_871X_LEVEL(x,...) do {} while(0)
#endif
#undef _dbgdump
#ifdef PLATFORM_WINDOWS
#ifdef PLATFORM_OS_XP
#define _dbgdump DbgPrint
#elif defined PLATFORM_OS_CE
#define _dbgdump rtl871x_cedbg
#endif
#elif defined PLATFORM_LINUX
#define _dbgdump printk
#elif defined PLATFORM_ECOS
#define _dbgdump diag_printf
#elif defined PLATFORM_FREERTOS
#define _dbgdump printf("\n\r"); printf
#elif defined PLATFORM_FREEBSD
#define _dbgdump printf
#endif
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
#define DRIVER_PREFIX "RTL871X: "
#endif
#define DEBUG_LEVEL (_drv_err_)
#if defined (_dbgdump)
#undef DBG_871X_LEVEL
#if defined (__ICCARM__) || defined (__CC_ARM) || defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
#define DBG_871X_LEVEL(level, ...) \
do {\
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
}while(0)
#else
#define DBG_871X_LEVEL(level, fmt, arg...) \
do {\
if (level <= DEBUG_LEVEL) {\
if (level <= _drv_err_ && level > _drv_always_) {\
_dbgdump(DRIVER_PREFIX"ERROR " fmt, ##arg);\
} \
else {\
_dbgdump(DRIVER_PREFIX fmt, ##arg);\
} \
}\
}while(0)
#endif //#ifdef __CC_ARM
#endif
#ifdef CONFIG_DEBUG
#if defined (_dbgdump)
#undef DBG_871X
#define DBG_871X(...) do {\
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
}while(0)
#undef MSG_8192C
#define MSG_8192C(...) do {\
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
}while(0)
#undef DBG_8192C
#define DBG_8192C(...) do {\
_dbgdump(DRIVER_PREFIX __VA_ARGS__);\
}while(0)
#endif
#endif /* CONFIG_DEBUG */
#ifdef CONFIG_DEBUG_RTL871X
#ifndef _RTL871X_DEBUG_C_
extern u32 GlobalDebugLevel;
extern u64 GlobalDebugComponents;
#endif
#if defined (_dbgdump) && defined (_MODULE_DEFINE_)
#undef RT_TRACE
#define RT_TRACE(_Comp, _Level, Fmt)\
do {\
if((_Comp & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) {\
_dbgdump("%s [0x%08x,%d]", DRIVER_PREFIX, (unsigned int)_Comp, _Level);\
_dbgdump Fmt;\
}\
}while(0)
#endif
#if defined (_dbgdump)
#undef _func_enter_
#define _func_enter_ \
do { \
if (GlobalDebugLevel >= _drv_debug_) \
{ \
_dbgdump("\n %s : %s enters at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__);\
} \
} while(0)
#undef _func_exit_
#define _func_exit_ \
do { \
if (GlobalDebugLevel >= _drv_debug_) \
{ \
_dbgdump("\n %s : %s exits at %d\n", DRIVER_PREFIX, __FUNCTION__, __LINE__); \
} \
} while(0)
#undef RT_PRINT_DATA
#define RT_PRINT_DATA(_Comp, _Level, _TitleString, _HexData, _HexDataLen) \
if(((_Comp) & GlobalDebugComponents) && (_Level <= GlobalDebugLevel)) \
{ \
int __i; \
u8 *ptr = (u8 *)_HexData; \
printf("\r\n%s", DRIVER_PREFIX); \
printf(_TitleString "--------Len=%d\n\r", _HexDataLen); \
for( __i=0; __i<(int)_HexDataLen; __i++ ) \
{ \
printf("%02X%s", ptr[__i], (((__i + 1) % 4) == 0)?" ":" "); \
if (((__i + 1) % 16) == 0) printf("\n\r"); \
} \
printf("\n\r"); \
}
#endif
#endif /* CONFIG_DEBUG_RTL871X */
#ifdef CONFIG_PROC_DEBUG
int proc_get_drv_version(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_write_reg(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_write_reg(struct file *file, const char *buffer,
unsigned long count, void *data);
int proc_get_read_reg(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_read_reg(struct file *file, const char *buffer,
unsigned long count, void *data);
int proc_get_fwstate(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_sec_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_mlmext_state(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_qos_option(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_ht_option(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rf_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_ap_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_adapter_state(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_trx_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_mac_reg_dump1(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_mac_reg_dump2(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_mac_reg_dump3(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_bb_reg_dump1(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_bb_reg_dump2(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_bb_reg_dump3(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rf_reg_dump1(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rf_reg_dump2(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rf_reg_dump3(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rf_reg_dump4(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
#ifdef CONFIG_AP_MODE
int proc_get_all_sta_info(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
#endif
#ifdef DBG_MEMORY_LEAK
int proc_get_malloc_cnt(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
#endif
#ifdef CONFIG_FIND_BEST_CHANNEL
int proc_get_best_channel(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
#endif
int proc_get_rx_signal(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_rx_signal(struct file *file, const char *buffer,
unsigned long count, void *data);
#ifdef CONFIG_80211N_HT
int proc_get_cbw40_enable(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_cbw40_enable(struct file *file, const char *buffer,
unsigned long count, void *data);
int proc_get_ampdu_enable(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_ampdu_enable(struct file *file, const char *buffer,
unsigned long count, void *data);
int proc_get_rx_stbc(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_rx_stbc(struct file *file, const char *buffer,
unsigned long count, void *data);
#endif //CONFIG_80211N_HT
int proc_get_two_path_rssi(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_get_rssi_disp(char *page, char **start,
off_t offset, int count,
int *eof, void *data);
int proc_set_rssi_disp(struct file *file, const char *buffer,
unsigned long count, void *data);
#endif //CONFIG_PROC_DEBUG
#endif //__RTW_DEBUG_H__

View file

@ -0,0 +1,456 @@
#ifndef _WIFI_CONSTANTS_H
#define _WIFI_CONSTANTS_H
#ifdef __cplusplus
extern "C" {
#endif
#ifndef WLAN0_NAME
#define WLAN0_NAME "wlan0"
#endif
#ifndef WLAN1_NAME
#define WLAN1_NAME "wlan1"
#endif
#define WEP_ENABLED 0x0001
#define TKIP_ENABLED 0x0002
#define AES_ENABLED 0x0004
#define WSEC_SWFLAG 0x0008
#define SHARED_ENABLED 0x00008000
#define WPA_SECURITY 0x00200000
#define WPA2_SECURITY 0x00400000
#define WPS_ENABLED 0x10000000
#define RTW_MAX_PSK_LEN (64)
#define RTW_MIN_PSK_LEN (8)
#define MCSSET_LEN 16
typedef enum
{
RTW_SUCCESS = 0, /**< Success */
RTW_PENDING = 1, /**< Pending */
RTW_TIMEOUT = 2, /**< Timeout */
RTW_PARTIAL_RESULTS = 3, /**< Partial results */
RTW_INVALID_KEY = 4, /**< Invalid key */
RTW_DOES_NOT_EXIST = 5, /**< Does not exist */
RTW_NOT_AUTHENTICATED = 6, /**< Not authenticated */
RTW_NOT_KEYED = 7, /**< Not keyed */
RTW_IOCTL_FAIL = 8, /**< IOCTL fail */
RTW_BUFFER_UNAVAILABLE_TEMPORARY = 9, /**< Buffer unavailable temporarily */
RTW_BUFFER_UNAVAILABLE_PERMANENT = 10, /**< Buffer unavailable permanently */
RTW_WPS_PBC_OVERLAP = 11, /**< WPS PBC overlap */
RTW_CONNECTION_LOST = 12, /**< Connection lost */
RTW_ERROR = -1, /**< Generic Error */
RTW_BADARG = -2, /**< Bad Argument */
RTW_BADOPTION = -3, /**< Bad option */
RTW_NOTUP = -4, /**< Not up */
RTW_NOTDOWN = -5, /**< Not down */
RTW_NOTAP = -6, /**< Not AP */
RTW_NOTSTA = -7, /**< Not STA */
RTW_BADKEYIDX = -8, /**< BAD Key Index */
RTW_RADIOOFF = -9, /**< Radio Off */
RTW_NOTBANDLOCKED = -10, /**< Not band locked */
RTW_NOCLK = -11, /**< No Clock */
RTW_BADRATESET = -12, /**< BAD Rate valueset */
RTW_BADBAND = -13, /**< BAD Band */
RTW_BUFTOOSHORT = -14, /**< Buffer too short */
RTW_BUFTOOLONG = -15, /**< Buffer too long */
RTW_BUSY = -16, /**< Busy */
RTW_NOTASSOCIATED = -17, /**< Not Associated */
RTW_BADSSIDLEN = -18, /**< Bad SSID len */
RTW_OUTOFRANGECHAN = -19, /**< Out of Range Channel */
RTW_BADCHAN = -20, /**< Bad Channel */
RTW_BADADDR = -21, /**< Bad Address */
RTW_NORESOURCE = -22, /**< Not Enough Resources */
RTW_UNSUPPORTED = -23, /**< Unsupported */
RTW_BADLEN = -24, /**< Bad length */
RTW_NOTREADY = -25, /**< Not Ready */
RTW_EPERM = -26, /**< Not Permitted */
RTW_NOMEM = -27, /**< No Memory */
RTW_ASSOCIATED = -28, /**< Associated */
RTW_RANGE = -29, /**< Not In Range */
RTW_NOTFOUND = -30, /**< Not Found */
RTW_WME_NOT_ENABLED = -31, /**< WME Not Enabled */
RTW_TSPEC_NOTFOUND = -32, /**< TSPEC Not Found */
RTW_ACM_NOTSUPPORTED = -33, /**< ACM Not Supported */
RTW_NOT_WME_ASSOCIATION = -34, /**< Not WME Association */
RTW_SDIO_ERROR = -35, /**< SDIO Bus Error */
RTW_WLAN_DOWN = -36, /**< WLAN Not Accessible */
RTW_BAD_VERSION = -37, /**< Incorrect version */
RTW_TXFAIL = -38, /**< TX failure */
RTW_RXFAIL = -39, /**< RX failure */
RTW_NODEVICE = -40, /**< Device not present */
RTW_UNFINISHED = -41, /**< To be finished */
RTW_NONRESIDENT = -42, /**< access to nonresident overlay */
RTW_DISABLED = -43 /**< Disabled in this build */
} rtw_result_t;
typedef enum {
RTW_SECURITY_OPEN = 0, /**< Open security */
RTW_SECURITY_WEP_PSK = WEP_ENABLED, /**< WEP Security with open authentication */
RTW_SECURITY_WEP_SHARED = ( WEP_ENABLED | SHARED_ENABLED ), /**< WEP Security with shared authentication */
RTW_SECURITY_WPA_TKIP_PSK = ( WPA_SECURITY | TKIP_ENABLED ), /**< WPA Security with TKIP */
RTW_SECURITY_WPA_AES_PSK = ( WPA_SECURITY | AES_ENABLED ), /**< WPA Security with AES */
RTW_SECURITY_WPA2_AES_PSK = ( WPA2_SECURITY | AES_ENABLED ), /**< WPA2 Security with AES */
RTW_SECURITY_WPA2_TKIP_PSK = ( WPA2_SECURITY | TKIP_ENABLED ), /**< WPA2 Security with TKIP */
RTW_SECURITY_WPA2_MIXED_PSK = ( WPA2_SECURITY | AES_ENABLED | TKIP_ENABLED ), /**< WPA2 Security with AES & TKIP */
RTW_SECURITY_WPA_WPA2_MIXED = ( WPA_SECURITY | WPA2_SECURITY ), /**< WPA/WPA2 Security */
RTW_SECURITY_WPS_OPEN = WPS_ENABLED, /**< WPS with open security */
RTW_SECURITY_WPS_SECURE = (WPS_ENABLED | AES_ENABLED), /**< WPS with AES security */
RTW_SECURITY_UNKNOWN = -1, /**< May be returned by scan function if security is unknown. Do not pass this to the join function! */
RTW_SECURITY_FORCE_32_BIT = 0x7fffffff /**< Exists only to force rtw_security_t type to 32 bits */
} rtw_security_t;
typedef enum {
RTW_ENCRYPTION_UNKNOWN = 0,
RTW_ENCRYPTION_OPEN = 1,
RTW_ENCRYPTION_WEP40 = 2,
RTW_ENCRYPTION_WPA_TKIP = 3,
RTW_ENCRYPTION_WPA_AES = 4,
RTW_ENCRYPTION_WPA2_TKIP = 5,
RTW_ENCRYPTION_WPA2_AES = 6,
RTW_ENCRYPTION_WPA2_MIXED = 7,
RTW_ENCRYPTION_WEP104 = 9,
RTW_ENCRYPTION_UNDEF = 0xFF,
} rtw_encryption_t;
typedef enum {
RTW_FALSE = 0,
RTW_TRUE = 1
} rtw_bool_t;
typedef enum {
RTW_802_11_BAND_5GHZ = 0, /**< Denotes 5GHz radio band */
RTW_802_11_BAND_2_4GHZ = 1 /**< Denotes 2.4GHz radio band */
} rtw_802_11_band_t;
typedef enum {
/* CHANNEL PLAN */
RTW_COUNTRY_WORLD1, // 0x20
RTW_COUNTRY_ETSI1, // 0x21
RTW_COUNTRY_FCC1, // 0x22
RTW_COUNTRY_MKK1, // 0x23
RTW_COUNTRY_ETSI2, // 0x24
RTW_COUNTRY_FCC2, // 0x2A
RTW_COUNTRY_WORLD2, // 0x47
RTW_COUNTRY_MKK2, // 0x58
/* SPECIAL */
RTW_COUNTRY_WORLD, // WORLD1
RTW_COUNTRY_EU, // ETSI1
/* JAPANESE */
RTW_COUNTRY_JP, // MKK1
/* FCC , 19 countries*/
RTW_COUNTRY_AS, // FCC2
RTW_COUNTRY_BM,
RTW_COUNTRY_CA,
RTW_COUNTRY_DM,
RTW_COUNTRY_DO,
RTW_COUNTRY_FM,
RTW_COUNTRY_GD,
RTW_COUNTRY_GT,
RTW_COUNTRY_GU,
RTW_COUNTRY_HT,
RTW_COUNTRY_MH,
RTW_COUNTRY_MP,
RTW_COUNTRY_NI,
RTW_COUNTRY_PA,
RTW_COUNTRY_PR,
RTW_COUNTRY_PW,
RTW_COUNTRY_TW,
RTW_COUNTRY_US,
RTW_COUNTRY_VI,
/* others, ETSI */
RTW_COUNTRY_AD, // ETSI1
RTW_COUNTRY_AE,
RTW_COUNTRY_AF,
RTW_COUNTRY_AI,
RTW_COUNTRY_AL,
RTW_COUNTRY_AM,
RTW_COUNTRY_AN,
RTW_COUNTRY_AR,
RTW_COUNTRY_AT,
RTW_COUNTRY_AU,
RTW_COUNTRY_AW,
RTW_COUNTRY_AZ,
RTW_COUNTRY_BA,
RTW_COUNTRY_BB,
RTW_COUNTRY_BD,
RTW_COUNTRY_BE,
RTW_COUNTRY_BF,
RTW_COUNTRY_BG,
RTW_COUNTRY_BH,
RTW_COUNTRY_BL,
RTW_COUNTRY_BN,
RTW_COUNTRY_BO,
RTW_COUNTRY_BR,
RTW_COUNTRY_BS,
RTW_COUNTRY_BT,
RTW_COUNTRY_BY,
RTW_COUNTRY_BZ,
RTW_COUNTRY_CF,
RTW_COUNTRY_CH,
RTW_COUNTRY_CI,
RTW_COUNTRY_CL,
RTW_COUNTRY_CN,
RTW_COUNTRY_CO,
RTW_COUNTRY_CR,
RTW_COUNTRY_CX,
RTW_COUNTRY_CY,
RTW_COUNTRY_CZ,
RTW_COUNTRY_DE,
RTW_COUNTRY_DK,
RTW_COUNTRY_DZ,
RTW_COUNTRY_EC,
RTW_COUNTRY_EE,
RTW_COUNTRY_EG,
RTW_COUNTRY_ES,
RTW_COUNTRY_ET,
RTW_COUNTRY_FI,
RTW_COUNTRY_FR,
RTW_COUNTRY_GB,
RTW_COUNTRY_GE,
RTW_COUNTRY_GF,
RTW_COUNTRY_GH,
RTW_COUNTRY_GL,
RTW_COUNTRY_GP,
RTW_COUNTRY_GR,
RTW_COUNTRY_GY,
RTW_COUNTRY_HK,
RTW_COUNTRY_HN,
RTW_COUNTRY_HR,
RTW_COUNTRY_HU,
RTW_COUNTRY_ID,
RTW_COUNTRY_IE,
RTW_COUNTRY_IL,
RTW_COUNTRY_IN,
RTW_COUNTRY_IQ,
RTW_COUNTRY_IR,
RTW_COUNTRY_IS,
RTW_COUNTRY_IT,
RTW_COUNTRY_JM,
RTW_COUNTRY_JO,
RTW_COUNTRY_KE,
RTW_COUNTRY_KH,
RTW_COUNTRY_KN,
RTW_COUNTRY_KP,
RTW_COUNTRY_KR,
RTW_COUNTRY_KW,
RTW_COUNTRY_KY,
RTW_COUNTRY_KZ,
RTW_COUNTRY_LA,
RTW_COUNTRY_LB,
RTW_COUNTRY_LC,
RTW_COUNTRY_LI,
RTW_COUNTRY_LK,
RTW_COUNTRY_LR,
RTW_COUNTRY_LS,
RTW_COUNTRY_LT,
RTW_COUNTRY_LU,
RTW_COUNTRY_LV,
RTW_COUNTRY_MA,
RTW_COUNTRY_MC,
RTW_COUNTRY_MD,
RTW_COUNTRY_ME,
RTW_COUNTRY_MF,
RTW_COUNTRY_MK,
RTW_COUNTRY_MN,
RTW_COUNTRY_MO,
RTW_COUNTRY_MQ,
RTW_COUNTRY_MR,
RTW_COUNTRY_MT,
RTW_COUNTRY_MU,
RTW_COUNTRY_MV,
RTW_COUNTRY_MW,
RTW_COUNTRY_MX,
RTW_COUNTRY_MY,
RTW_COUNTRY_NG,
RTW_COUNTRY_NL,
RTW_COUNTRY_NO,
RTW_COUNTRY_NP,
RTW_COUNTRY_NZ,
RTW_COUNTRY_OM,
RTW_COUNTRY_PE,
RTW_COUNTRY_PF,
RTW_COUNTRY_PG,
RTW_COUNTRY_PH,
RTW_COUNTRY_PK,
RTW_COUNTRY_PL,
RTW_COUNTRY_PM,
RTW_COUNTRY_PT,
RTW_COUNTRY_PY,
RTW_COUNTRY_QA,
RTW_COUNTRY_RS,
RTW_COUNTRY_RU,
RTW_COUNTRY_RW,
RTW_COUNTRY_SA,
RTW_COUNTRY_SE,
RTW_COUNTRY_SG,
RTW_COUNTRY_SI,
RTW_COUNTRY_SK,
RTW_COUNTRY_SN,
RTW_COUNTRY_SR,
RTW_COUNTRY_SV,
RTW_COUNTRY_SY,
RTW_COUNTRY_TC,
RTW_COUNTRY_TD,
RTW_COUNTRY_TG,
RTW_COUNTRY_TH,
RTW_COUNTRY_TN,
RTW_COUNTRY_TR,
RTW_COUNTRY_TT,
RTW_COUNTRY_TZ,
RTW_COUNTRY_UA,
RTW_COUNTRY_UG,
RTW_COUNTRY_UY,
RTW_COUNTRY_UZ,
RTW_COUNTRY_VC,
RTW_COUNTRY_VE,
RTW_COUNTRY_VN,
RTW_COUNTRY_VU,
RTW_COUNTRY_WF,
RTW_COUNTRY_WS,
RTW_COUNTRY_YE,
RTW_COUNTRY_YT,
RTW_COUNTRY_ZA,
RTW_COUNTRY_ZW,
RTW_COUNTRY_MAX
}rtw_country_code_t;
typedef enum {
RTW_ADAPTIVITY_DISABLE = 0,
RTW_ADAPTIVITY_NORMAL, // CE
RTW_ADAPTIVITY_CARRIER_SENSE // MKK
} rtw_adaptivity_mode_t;
typedef enum {
RTW_MODE_NONE = 0,
RTW_MODE_STA,
RTW_MODE_AP,
RTW_MODE_STA_AP,
RTW_MODE_PROMISC,
RTW_MODE_P2P
}rtw_mode_t;
typedef enum {
RTW_SCAN_FULL = 0,
RTW_SCAN_SOCIAL,
RTW_SCAN_ONE
}rtw_scan_mode_t;
typedef enum {
RTW_LINK_DISCONNECTED = 0,
RTW_LINK_CONNECTED
} rtw_link_status_t;
typedef enum {
RTW_SCAN_TYPE_ACTIVE = 0x00, /**< Actively scan a network by sending 802.11 probe(s) */
RTW_SCAN_TYPE_PASSIVE = 0x01, /**< Passively scan a network by listening for beacons from APs */
RTW_SCAN_TYPE_PROHIBITED_CHANNELS = 0x04 /**< Passively scan on channels not enabled by the country code */
} rtw_scan_type_t;
typedef enum {
RTW_BSS_TYPE_INFRASTRUCTURE = 0, /**< Denotes infrastructure network */
RTW_BSS_TYPE_ADHOC = 1, /**< Denotes an 802.11 ad-hoc IBSS network */
RTW_BSS_TYPE_ANY = 2, /**< Denotes either infrastructure or ad-hoc network */
RTW_BSS_TYPE_UNKNOWN = -1 /**< May be returned by scan function if BSS type is unknown. Do not pass this to the Join function */
} rtw_bss_type_t;
typedef enum {
RTW_SCAN_COMMAMD = 0x01
} rtw_scan_command_t;
typedef enum{
COMMAND1 = 0x01
}rtw_command_type;
typedef enum {
RTW_WPS_TYPE_DEFAULT = 0x0000,
RTW_WPS_TYPE_USER_SPECIFIED = 0x0001,
RTW_WPS_TYPE_MACHINE_SPECIFIED = 0x0002,
RTW_WPS_TYPE_REKEY = 0x0003,
RTW_WPS_TYPE_PUSHBUTTON = 0x0004,
RTW_WPS_TYPE_REGISTRAR_SPECIFIED = 0x0005,
RTW_WPS_TYPE_NONE = 0x0006
} rtw_wps_type_t;
typedef enum {
RTW_NETWORK_B = 1,
RTW_NETWORK_BG = 3,
RTW_NETWORK_BGN = 11
} rtw_network_mode_t;
typedef enum {
RTW_STA_INTERFACE = 0, /**< STA or Client Interface */
RTW_AP_INTERFACE = 1, /**< softAP Interface */
} rtw_interface_t;
/**
* Enumeration of packet filter rules
*/
typedef enum {
RTW_POSITIVE_MATCHING = 0, /**< Specifies that a filter should match a given pattern */
RTW_NEGATIVE_MATCHING = 1 /**< Specifies that a filter should NOT match a given pattern */
} rtw_packet_filter_rule_e;
typedef enum {
RTW_PROMISC_DISABLE = 0, /**< disable the promisc */
RTW_PROMISC_ENABLE = 1, /**< fetch all ethernet packets */
RTW_PROMISC_ENABLE_1 = 2, /**< fetch only B/M packets */
RTW_PROMISC_ENABLE_2 = 3, /**< fetch all 802.11 packets*/
RTW_PROMISC_ENABLE_3 = 4, /**< fetch only B/M 802.11 packets*/
} rtw_rcr_level_t;
typedef enum{
RTW_NO_ERROR = 0,
RTW_NONE_NETWORK = 1,
RTW_CONNECT_FAIL = 2,
RTW_WRONG_PASSWORD = 3 ,
RTW_DHCP_FAIL = 4,
RTW_UNKNOWN,
}rtw_connect_error_flag_t;
typedef enum {
RTW_TX_PWR_PERCENTAGE_100 = 0, /* 100%, default target output power. */
RTW_TX_PWR_PERCENTAGE_75 = 1, /* 75% */
RTW_TX_PWR_PERCENTAGE_50 = 2, /* 50% */
RTW_TX_PWR_PERCENTAGE_25 = 3, /* 25% */
RTW_TX_PWR_PERCENTAGE_12_5 = 4, /* 12.5% */
}rtw_tx_pwr_percentage_t;
typedef enum _WIFI_EVENT_INDICATE{
WIFI_EVENT_CONNECT = 0,
WIFI_EVENT_DISCONNECT = 1,
WIFI_EVENT_FOURWAY_HANDSHAKE_DONE = 2,
WIFI_EVENT_SCAN_RESULT_REPORT = 3,
WIFI_EVENT_SCAN_DONE = 4,
WIFI_EVENT_RECONNECTION_FAIL = 5,
WIFI_EVENT_SEND_ACTION_DONE = 6,
WIFI_EVENT_RX_MGNT = 7,
WIFI_EVENT_STA_ASSOC = 8,
WIFI_EVENT_STA_DISASSOC = 9,
WIFI_EVENT_STA_WPS_START = 10,
WIFI_EVENT_WPS_FINISH = 11,
WIFI_EVENT_EAPOL_START = 12,
WIFI_EVENT_EAPOL_RECVD = 13,
WIFI_EVENT_NO_NETWORK = 14,
WIFI_EVENT_BEACON_AFTER_DHCP = 15,
WIFI_EVENT_MAX,
}WIFI_EVENT_INDICATE;
#ifdef __cplusplus
}
#endif
#endif /* _WIFI_CONSTANTS_H */

View file

@ -0,0 +1,167 @@
#ifndef _WIFI_STRUCTURES_H
#define _WIFI_STRUCTURES_H
//#include <freertos/freertos_service.h>
#include "wifi_constants.h"
#include "dlist.h"
#ifdef __cplusplus
extern "C" {
#endif
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1)
#endif
typedef struct rtw_ssid {
unsigned char len; /**< SSID length */
unsigned char val[33]; /**< SSID name (AP name) */
} rtw_ssid_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1)
#endif
typedef struct rtw_mac {
unsigned char octet[6]; /**< Unique 6-byte MAC address */
} rtw_mac_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
typedef struct rtw_ap_info {
rtw_ssid_t ssid;
rtw_security_t security_type;
unsigned char *password;
int password_len;
int channel;
}rtw_ap_info_t;
typedef struct rtw_network_info {
rtw_ssid_t ssid;
rtw_mac_t bssid;
rtw_security_t security_type;
unsigned char *password;
int password_len;
int key_id;
}rtw_network_info_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1)
#endif
typedef struct rtw_scan_result {
rtw_ssid_t SSID; /**< Service Set Identification (i.e. Name of Access Point) */
rtw_mac_t BSSID; /**< Basic Service Set Identification (i.e. MAC address of Access Point) */
signed short signal_strength; /**< Receive Signal Strength Indication in dBm. <-90=Very poor, >-30=Excellent */
rtw_bss_type_t bss_type; /**< Network type */
rtw_security_t security; /**< Security type */
rtw_wps_type_t wps_type; /**< WPS type */
unsigned int channel; /**< Radio channel that the AP beacon was received on */
rtw_802_11_band_t band; /**< Radio band */
} rtw_scan_result_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
typedef struct rtw_scan_handler_result {
rtw_scan_result_t ap_details;
rtw_bool_t scan_complete;
void* user_data;
} rtw_scan_handler_result_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack(1)
#endif
typedef struct rtw_wifi_setting {
rtw_mode_t mode;
unsigned char ssid[33];
unsigned char channel;
rtw_security_t security_type;
unsigned char password[65];
unsigned char key_idx;
}rtw_wifi_setting_t;
#if defined(__IAR_SYSTEMS_ICC__)
#pragma pack()
#endif
typedef struct rtw_wifi_config {
unsigned int boot_mode;
unsigned char ssid[32];
unsigned char ssid_len;
unsigned char security_type;
unsigned char password[65];
unsigned char password_len;
unsigned char channel;
} rtw_wifi_config_t;
typedef struct
{
unsigned int count; /**< Number of MAC addresses in the list */
rtw_mac_t mac_list[1]; /**< Variable length array of MAC addresses */
} rtw_maclist_t;
typedef struct {
unsigned int version; /* version field */
unsigned int length; /* byte length of data in this record, */
/* starting at version and including IEs */
rtw_mac_t BSSID;
unsigned short beacon_period; /* units are Kusec */
unsigned short capability; /* Capability information */
unsigned char SSID_len;
unsigned char SSID[32];
unsigned char channel;
// struct {
// uint32_t count; /* # rates in this set */
// uint8_t rates[16]; /* rates in 500kbps units w/hi bit set if basic */
// } rateset; /* supported rates */
// rtw_chanspec_t chanspec; /* chanspec for bss */
unsigned short atim_window; /* units are Kusec */
unsigned char dtim_period; /* DTIM period */
signed short RSSI; /* receive signal strength (in dBm) */
unsigned char n_cap; /* BSS is 802.11N Capable */
unsigned int nbss_cap; /* 802.11N BSS Capabilities (based on HT_CAP_*) */
unsigned char basic_mcs[MCSSET_LEN]; /* 802.11N BSS required MCS set */
unsigned short ie_offset; /* offset at which IEs start, from beginning */
unsigned int ie_length; /* byte length of Information Elements */
} rtw_bss_info_t;
typedef struct {
unsigned short offset; /**< Offset in bytes to start filtering (referenced to the start of the ethernet packet) */
unsigned short mask_size; /**< Size of the mask in bytes */
unsigned char* mask; /**< Pattern mask bytes to be ANDed with the pattern eg. "\xff00" (must be in network byte order) */
unsigned char* pattern; /**< Pattern bytes used to filter eg. "\x0800" (must be in network byte order) */
} rtw_packet_filter_pattern_t;
typedef struct ieee80211_frame_info{
unsigned short i_fc;
unsigned short i_dur;
unsigned char i_addr1[6];
unsigned char i_addr2[6];
unsigned char i_addr3[6];
unsigned short i_seq;
unsigned char bssid[6];
unsigned char encrypt;
signed char rssi;
}ieee80211_frame_info_t;
typedef struct {
char filter_id;
rtw_packet_filter_pattern_t patt;
rtw_packet_filter_rule_e rule;
unsigned char enable;
}rtw_packet_filter_info_t;
typedef struct rtw_mac_filter_list{
struct list_head node;
unsigned char mac_addr[6];
}rtw_mac_filter_list_t;
#ifdef __cplusplus
}
#endif
#endif /* _WIFI_STRUCTURES_H */

File diff suppressed because it is too large Load diff