From b4b7ff4b08e691656c9d77c758fc355833128ac0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Wed, 20 Jan 2016 14:01:31 -0300 Subject: Linux-libre 4.4-gnu --- drivers/staging/wilc1000/host_interface.h | 594 +++++++++++------------------- 1 file changed, 222 insertions(+), 372 deletions(-) (limited to 'drivers/staging/wilc1000/host_interface.h') diff --git a/drivers/staging/wilc1000/host_interface.h b/drivers/staging/wilc1000/host_interface.h index e66dee9af..b854db5ac 100644 --- a/drivers/staging/wilc1000/host_interface.h +++ b/drivers/staging/wilc1000/host_interface.h @@ -11,121 +11,98 @@ #define HOST_INT_H #include "coreconfigurator.h" -/*****************************************************************************/ -/* Macros */ -/*****************************************************************************/ -#define FAIL 0x0000 -#define SUCCESS 0x0001 #define IP_ALEN 4 -#define BIT2 ((u32)(1 << 2)) -#define BIT1 ((u32)(1 << 1)) -#define BIT0 ((u32)(1 << 0)) - +#define IDLE_MODE 0x00 #define AP_MODE 0x01 #define STATION_MODE 0x02 -#define GO_MODE 0x03 +#define GO_MODE 0x03 #define CLIENT_MODE 0x04 -#define MAX_NUM_STA 9 +#define MAX_NUM_STA 9 #define ACTIVE_SCAN_TIME 10 #define PASSIVE_SCAN_TIME 1200 #define MIN_SCAN_TIME 10 #define MAX_SCAN_TIME 1200 #define DEFAULT_SCAN 0 -#define USER_SCAN BIT0 -#define OBSS_PERIODIC_SCAN BIT1 -#define OBSS_ONETIME_SCAN BIT2 +#define USER_SCAN BIT(0) +#define OBSS_PERIODIC_SCAN BIT(1) +#define OBSS_ONETIME_SCAN BIT(2) #define GTK_RX_KEY_BUFF_LEN 24 -#define ADDKEY 0x1 -#define REMOVEKEY 0x2 -#define DEFAULTKEY 0x4 -#define ADDKEY_AP 0x8 -#define MAX_NUM_SCANNED_NETWORKS 100 /* 30 // rachel */ -#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130 -#define MAX_NUM_PROBED_SSID 10 /*One more than the number of scanned ssids*/ -#define CHANNEL_SCAN_TIME 250 /* 250 */ +#define ADDKEY 0x1 +#define REMOVEKEY 0x2 +#define DEFAULTKEY 0x4 +#define ADDKEY_AP 0x8 +#define MAX_NUM_SCANNED_NETWORKS 100 +#define MAX_NUM_SCANNED_NETWORKS_SHADOW 130 +#define MAX_NUM_PROBED_SSID 10 +#define CHANNEL_SCAN_TIME 250 #define TX_MIC_KEY_LEN 8 #define RX_MIC_KEY_LEN 8 -#define PTK_KEY_LEN 16 +#define PTK_KEY_LEN 16 #define TX_MIC_KEY_MSG_LEN 26 #define RX_MIC_KEY_MSG_LEN 48 #define PTK_KEY_MSG_LEN 39 #define PMKSA_KEY_LEN 22 -#define ETH_ALEN 6 -#define PMKID_LEN 16 -#define WILC_MAX_NUM_PMKIDS 16 -#define WILC_SUPP_MCS_SET_SIZE 16 -#define WILC_ADD_STA_LENGTH 40 /* Not including the rates field cause it has variable length*/ +#define ETH_ALEN 6 +#define PMKID_LEN 16 +#define WILC_MAX_NUM_PMKIDS 16 +#define WILC_SUPP_MCS_SET_SIZE 16 +#define WILC_ADD_STA_LENGTH 40 #define SCAN_EVENT_DONE_ABORTED -/*****************************************************************************/ -/* Data Types */ -/*****************************************************************************/ -/* typedef unsigned char uint8; */ -/* typedef signed char int8; */ -/* typedef unsigned short uint16; */ -/* typedef unsigned long uint32; */ -/* typedef uint32 Bool; */ - -typedef struct { - u16 cfg_wid; - WID_TYPE_T cfg_type; - s8 *pu8Para; -} cfg_param_t; - -typedef struct _tstrStatistics { +#define NUM_CONCURRENT_IFC 2 + +struct rf_info { u8 u8LinkSpeed; s8 s8RSSI; u32 u32TxCount; u32 u32RxCount; u32 u32TxFailureCount; +}; -} tstrStatistics; - - -typedef enum { - HOST_IF_IDLE = 0, - HOST_IF_SCANNING = 1, - HOST_IF_CONNECTING = 2, - HOST_IF_WAITING_CONN_RESP = 3, - HOST_IF_CONNECTED = 4, - HOST_IF_P2P_LISTEN = 5, - HOST_IF_FORCE_32BIT = 0xFFFFFFFF -} tenuHostIFstate; +enum host_if_state { + HOST_IF_IDLE = 0, + HOST_IF_SCANNING = 1, + HOST_IF_CONNECTING = 2, + HOST_IF_WAITING_CONN_RESP = 3, + HOST_IF_CONNECTED = 4, + HOST_IF_P2P_LISTEN = 5, + HOST_IF_FORCE_32BIT = 0xFFFFFFFF +}; -typedef struct _tstrHostIFpmkid { +struct host_if_pmkid { u8 bssid[ETH_ALEN]; u8 pmkid[PMKID_LEN]; -} tstrHostIFpmkid; +}; -typedef struct _tstrHostIFpmkidAttr { +struct host_if_pmkid_attr { u8 numpmkid; - tstrHostIFpmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; -} tstrHostIFpmkidAttr; - -typedef enum { - AUTORATE = 0, - MBPS_1 = 1, - MBPS_2 = 2, - MBPS_5_5 = 5, - MBPS_11 = 11, - MBPS_6 = 6, - MBPS_9 = 9, - MBPS_12 = 12, - MBPS_18 = 18, - MBPS_24 = 24, - MBPS_36 = 36, - MBPS_48 = 48, - MBPS_54 = 54 -} CURRENT_TX_RATE_T; - -typedef struct { - u32 u32SetCfgFlag; + struct host_if_pmkid pmkidlist[WILC_MAX_NUM_PMKIDS]; +}; + +enum CURRENT_TXRATE { + AUTORATE = 0, + MBPS_1 = 1, + MBPS_2 = 2, + MBPS_5_5 = 5, + MBPS_11 = 11, + MBPS_6 = 6, + MBPS_9 = 9, + MBPS_12 = 12, + MBPS_18 = 18, + MBPS_24 = 24, + MBPS_36 = 36, + MBPS_48 = 48, + MBPS_54 = 54 +}; + +struct cfg_param_val { + u32 flag; u8 ht_enable; u8 bss_type; u8 auth_type; @@ -140,84 +117,79 @@ typedef struct { u8 txop_prot_disabled; u16 beacon_interval; u16 dtim_period; - SITE_SURVEY_T site_survey_enabled; + enum SITESURVEY site_survey_enabled; u16 site_survey_scan_time; u8 scan_source; u16 active_scan_time; u16 passive_scan_time; - CURRENT_TX_RATE_T curr_tx_rate; - -} tstrCfgParamVal; - -typedef enum { - RETRY_SHORT = 1 << 0, - RETRY_LONG = 1 << 1, - FRAG_THRESHOLD = 1 << 2, - RTS_THRESHOLD = 1 << 3, - BSS_TYPE = 1 << 4, - AUTH_TYPE = 1 << 5, - AUTHEN_TIMEOUT = 1 << 6, - POWER_MANAGEMENT = 1 << 7, - PREAMBLE = 1 << 8, - SHORT_SLOT_ALLOWED = 1 << 9, - TXOP_PROT_DISABLE = 1 << 10, - BEACON_INTERVAL = 1 << 11, - DTIM_PERIOD = 1 << 12, - SITE_SURVEY = 1 << 13, - SITE_SURVEY_SCAN_TIME = 1 << 14, - ACTIVE_SCANTIME = 1 << 15, - PASSIVE_SCANTIME = 1 << 16, - CURRENT_TX_RATE = 1 << 17, - HT_ENABLE = 1 << 18, -} tenuCfgParam; - -typedef struct { + enum CURRENT_TXRATE curr_tx_rate; + +}; + +enum cfg_param { + RETRY_SHORT = BIT(0), + RETRY_LONG = BIT(1), + FRAG_THRESHOLD = BIT(2), + RTS_THRESHOLD = BIT(3), + BSS_TYPE = BIT(4), + AUTH_TYPE = BIT(5), + AUTHEN_TIMEOUT = BIT(6), + POWER_MANAGEMENT = BIT(7), + PREAMBLE = BIT(8), + SHORT_SLOT_ALLOWED = BIT(9), + TXOP_PROT_DISABLE = BIT(10), + BEACON_INTERVAL = BIT(11), + DTIM_PERIOD = BIT(12), + SITE_SURVEY = BIT(13), + SITE_SURVEY_SCAN_TIME = BIT(14), + ACTIVE_SCANTIME = BIT(15), + PASSIVE_SCANTIME = BIT(16), + CURRENT_TX_RATE = BIT(17), + HT_ENABLE = BIT(18), +}; + +struct found_net_info { u8 au8bssid[6]; s8 s8rssi; -} tstrFoundNetworkInfo; +}; -typedef enum {SCAN_EVENT_NETWORK_FOUND = 0, - SCAN_EVENT_DONE = 1, - SCAN_EVENT_ABORTED = 2, - SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF} tenuScanEvent; +enum scan_event { + SCAN_EVENT_NETWORK_FOUND = 0, + SCAN_EVENT_DONE = 1, + SCAN_EVENT_ABORTED = 2, + SCAN_EVENT_FORCE_32BIT = 0xFFFFFFFF +}; -typedef enum { +enum conn_event { CONN_DISCONN_EVENT_CONN_RESP = 0, CONN_DISCONN_EVENT_DISCONN_NOTIF = 1, - CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF -} tenuConnDisconnEvent; + CONN_DISCONN_EVENT_FORCE_32BIT = 0xFFFFFFFF +}; -typedef enum { +enum KEY_TYPE { WEP, WPARxGtk, - /* WPATxGtk, */ WPAPtk, PMKSA, -} tenuKeyType; +}; /*Scan callBack function definition*/ -typedef void (*tWILCpfScanResult)(tenuScanEvent, tstrNetworkInfo *, void *, void *); +typedef void (*wilc_scan_result)(enum scan_event, tstrNetworkInfo *, + void *, void *); /*Connect callBack function definition*/ -typedef void (*tWILCpfConnectResult)(tenuConnDisconnEvent, +typedef void (*wilc_connect_result)(enum conn_event, tstrConnectInfo *, u8, tstrDisconnectNotifInfo *, void *); -#ifdef WILC_P2P -typedef void (*tWILCpfRemainOnChanExpired)(void *, u32); /*Remain on channel expiration callback function*/ -typedef void (*tWILCpfRemainOnChanReady)(void *); /*Remain on channel callback function*/ -#endif - -/* typedef u32 WILC_WFIDrvHandle; */ -typedef struct { - s32 s32Dummy; -} *WILC_WFIDrvHandle; +typedef void (*wilc_remain_on_chan_expired)(void *, u32); /*Remain on channel expiration callback function*/ +typedef void (*wilc_remain_on_chan_ready)(void *); /*Remain on channel callback function*/ /*! - * @struct tstrRcvdNetworkInfo + * @struct rcvd_net_info * @brief Structure to hold Received Asynchronous Network info * @details * @todo @@ -226,102 +198,91 @@ typedef struct { * @date 25 March 2012 * @version 1.0 */ -typedef struct _tstrRcvdNetworkInfo { - u8 *pu8Buffer; - u32 u32Length; -} tstrRcvdNetworkInfo; +struct rcvd_net_info { + u8 *buffer; + u32 len; +}; -/*BugID_4156*/ -typedef struct _tstrHiddenNetworkInfo { +struct hidden_net_info { u8 *pu8ssid; u8 u8ssidlen; +}; -} tstrHiddenNetworkInfo; - -typedef struct _tstrHiddenNetwork { - /* MAX_SSID_LEN */ - tstrHiddenNetworkInfo *pstrHiddenNetworkInfo; +struct hidden_network { + struct hidden_net_info *pstrHiddenNetworkInfo; u8 u8ssidnum; +}; -} tstrHiddenNetwork; - -typedef struct { +struct user_scan_req { /* Scan user call back function */ - tWILCpfScanResult pfUserScanResult; + wilc_scan_result pfUserScanResult; /* User specific parameter to be delivered through the Scan User Callback function */ void *u32UserScanPvoid; u32 u32RcvdChCount; - tstrFoundNetworkInfo astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS]; -} tstrWILC_UsrScanReq; + struct found_net_info astrFoundNetworkInfo[MAX_NUM_SCANNED_NETWORKS]; +}; -typedef struct { +struct user_conn_req { u8 *pu8bssid; u8 *pu8ssid; u8 u8security; - AUTHTYPE_T tenuAuth_type; + enum AUTHTYPE tenuAuth_type; size_t ssidLen; u8 *pu8ConnReqIEs; size_t ConnReqIEsLen; /* Connect user call back function */ - tWILCpfConnectResult pfUserConnectResult; + wilc_connect_result pfUserConnectResult; bool IsHTCapable; /* User specific parameter to be delivered through the Connect User Callback function */ void *u32UserConnectPvoid; -} tstrWILC_UsrConnReq; +}; -typedef struct { - u32 u32Address; -} tstrHostIfSetDrvHandler; +struct drv_handler { + u32 handler; +}; -typedef struct { - u32 u32Mode; -} tstrHostIfSetOperationMode; +struct op_mode { + u32 mode; +}; -/*BugID_5077*/ -typedef struct { - u8 u8MacAddress[ETH_ALEN]; -} tstrHostIfSetMacAddress; +struct set_mac_addr { + u8 mac_addr[ETH_ALEN]; +}; -/*BugID_5213*/ -typedef struct { - u8 *u8MacAddress; -} tstrHostIfGetMacAddress; +struct get_mac_addr { + u8 *mac_addr; +}; -/*BugID_5222*/ -typedef struct { +struct ba_session_info { u8 au8Bssid[ETH_ALEN]; u8 u8Ted; u16 u16BufferSize; u16 u16SessionTimeout; -} tstrHostIfBASessionInfo; +}; -#ifdef WILC_P2P -typedef struct { +struct remain_ch { u16 u16Channel; u32 u32duration; - tWILCpfRemainOnChanExpired pRemainOnChanExpired; - tWILCpfRemainOnChanReady pRemainOnChanReady; + wilc_remain_on_chan_expired pRemainOnChanExpired; + wilc_remain_on_chan_ready pRemainOnChanReady; void *pVoid; u32 u32ListenSessionID; -} tstrHostIfRemainOnChan; - -typedef struct { +}; +struct reg_frame { bool bReg; u16 u16FrameType; u8 u8Regid; +}; -} tstrHostIfRegisterFrame; - - -#define ACTION 0xD0 -#define PROBE_REQ 0x40 -#define PROBE_RESP 0x50 -#define ACTION_FRM_IDX 0 -#define PROBE_REQ_IDX 1 +#define ACTION 0xD0 +#define PROBE_REQ 0x40 +#define PROBE_RESP 0x50 +#define ACTION_FRM_IDX 0 +#define PROBE_REQ_IDX 1 enum p2p_listen_state { @@ -330,33 +291,18 @@ enum p2p_listen_state { P2P_GRP_FORMATION }; -#endif -typedef struct { - /* Scan user structure */ - tstrWILC_UsrScanReq strWILC_UsrScanReq; - - /* Connect User structure */ - tstrWILC_UsrConnReq strWILC_UsrConnReq; - - #ifdef WILC_P2P - /*Remain on channel struvture*/ - tstrHostIfRemainOnChan strHostIfRemainOnChan; - u8 u8RemainOnChan_pendingreq; +struct host_if_drv { + struct user_scan_req usr_scan_req; + struct user_conn_req usr_conn_req; + struct remain_ch remain_on_ch; + u8 remain_on_ch_pending; u64 u64P2p_MgmtTimeout; u8 u8P2PConnect; - #endif - tenuHostIFstate enuHostIFstate; - - /* bool bPendingConnRequest; */ - - #ifndef CONNECT_DIRECT - u32 u32SurveyResultsCount; - wid_site_survey_reslts_s astrSurveyResults[MAX_NUM_SCANNED_NETWORKS]; - #endif + enum host_if_state enuHostIFstate; u8 au8AssociatedBSSID[ETH_ALEN]; - tstrCfgParamVal strCfgValues; + struct cfg_param_val strCfgValues; /* semaphores */ struct semaphore gtOsCfgValuesSem; struct semaphore hSemTestKeyBlock; @@ -369,34 +315,12 @@ typedef struct { /* timer handlers */ struct timer_list hScanTimer; struct timer_list hConnectTimer; - #ifdef WILC_P2P struct timer_list hRemainOnChannel; - #endif bool IFC_UP; -} tstrWILC_WFIDrv; - -/*! - * @enum tenuWILC_StaFlag - * @brief Used to decode the station flag set and mask in tstrWILC_AddStaParam - * @details - * @todo - * @sa tstrWILC_AddStaParam, enum nl80211_sta_flags - * @author Enumeraion's creator - * @date 12 July 2012 - * @version 1.0 Description - */ - -typedef enum { - WILC_STA_FLAG_INVALID = 0, - WILC_STA_FLAG_AUTHORIZED, /*!< station is authorized (802.1X)*/ - WILC_STA_FLAG_SHORT_PREAMBLE, /*!< station is capable of receiving frames with short barker preamble*/ - WILC_STA_FLAG_WME, /*!< station is WME/QoS capable*/ - WILC_STA_FLAG_MFP, /*!< station uses management frame protection*/ - WILC_STA_FLAG_AUTHENTICATED /*!< station is authenticated*/ -} tenuWILC_StaFlag; +}; -typedef struct { +struct add_sta_param { u8 au8BSSID[ETH_ALEN]; u16 u16AssocID; u8 u8NumRates; @@ -410,9 +334,7 @@ typedef struct { u8 u8ASELCap; u16 u16FlagsMask; /**/ u16 u16FlagsSet; /*