linux/drivers/staging/rtl8723au/include/drv_types.h
<<
>>
Prefs
   1/******************************************************************************
   2 *
   3 * Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or modify it
   6 * under the terms of version 2 of the GNU General Public License as
   7 * published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope that it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12 * more details.
  13 *
  14 ******************************************************************************/
  15/*-----------------------------------------------------------------------------
  16
  17        For type defines and data structure defines
  18
  19------------------------------------------------------------------------------*/
  20
  21
  22#ifndef __DRV_TYPES_H__
  23#define __DRV_TYPES_H__
  24
  25#include <osdep_service.h>
  26#include <wlan_bssdef.h>
  27
  28
  29enum _NIC_VERSION {
  30        RTL8711_NIC,
  31        RTL8712_NIC,
  32        RTL8713_NIC,
  33        RTL8716_NIC
  34
  35};
  36
  37
  38#include <rtw_ht.h>
  39
  40#include <rtw_cmd.h>
  41#include <rtw_xmit.h>
  42#include <rtw_recv.h>
  43#include <hal_intf.h>
  44#include <hal_com.h>
  45#include <rtw_security.h>
  46#include <rtw_pwrctrl.h>
  47#include <rtw_io.h>
  48#include <rtw_eeprom.h>
  49#include <sta_info.h>
  50#include <rtw_mlme.h>
  51#include <rtw_debug.h>
  52#include <rtw_rf.h>
  53#include <rtw_event.h>
  54#include <rtw_mlme_ext.h>
  55#include <rtw_ap.h>
  56
  57#include "ioctl_cfg80211.h"
  58
  59struct registry_priv {
  60        u8      chip_version;
  61        u8      rfintfs;
  62        struct  cfg80211_ssid ssid;
  63        u8      channel;/* ad-hoc support requirement */
  64        u8      wireless_mode;/* A, B, G, auto */
  65        u8      scan_mode;/* active, passive */
  66        u8      preamble;/* long, short, auto */
  67        u8      vrtl_carrier_sense;/* Enable, Disable, Auto */
  68        u8      vcs_type;/* RTS/CTS, CTS-to-self */
  69        u16     rts_thresh;
  70        u16  frag_thresh;
  71        u8      adhoc_tx_pwr;
  72        u8      soft_ap;
  73        u8      power_mgnt;
  74        u8      ips_mode;
  75        u8      smart_ps;
  76        u8      long_retry_lmt;
  77        u8      short_retry_lmt;
  78        u16     busy_thresh;
  79        u8      ack_policy;
  80        u8      software_encrypt;
  81        u8      software_decrypt;
  82        u8      acm_method;
  83          /* UAPSD */
  84        u8      wmm_enable;
  85        u8      uapsd_enable;
  86
  87        struct wlan_bssid_ex    dev_network;
  88
  89        u8      ht_enable;
  90        u8      cbw40_enable;
  91        u8      ampdu_enable;/* for tx */
  92        u8      rx_stbc;
  93        u8      ampdu_amsdu;/* A-MPDU Supports A-MSDU is permitted */
  94        u8      lowrate_two_xmit;
  95
  96        u8      rf_config;
  97        u8      low_power;
  98
  99        u8      wifi_spec;/*  !turbo_mode */
 100
 101        u8      channel_plan;
 102#ifdef CONFIG_8723AU_BT_COEXIST
 103        u8      btcoex;
 104        u8      bt_iso;
 105        u8      bt_sco;
 106        u8      bt_ampdu;
 107#endif
 108        bool    bAcceptAddbaReq;
 109
 110        u8      antdiv_cfg;
 111        u8      antdiv_type;
 112
 113        u8      hwpdn_mode;/* 0:disable,1:enable,2:decide by EFUSE config */
 114        u8      hwpwrp_detect;/* 0:disable,1:enable */
 115
 116        u8      hw_wps_pbc;/* 0:disable,1:enable */
 117
 118        u8      max_roaming_times; /* max number driver will try to roaming */
 119
 120        u8 enable80211d;
 121
 122        u8 ifname[16];
 123        u8 if2name[16];
 124
 125        u8 notch_filter;
 126
 127        u8 regulatory_tid;
 128};
 129
 130
 131#define MAX_CONTINUAL_URB_ERR 4
 132
 133#define GET_PRIMARY_ADAPTER(padapter)                                   \
 134        (((struct rtw_adapter *)padapter)->dvobj->if1)
 135
 136enum _IFACE_ID {
 137        IFACE_ID0, /* maping to PRIMARY_ADAPTER */
 138        IFACE_ID1, /* maping to SECONDARY_ADAPTER */
 139        IFACE_ID2,
 140        IFACE_ID3,
 141        IFACE_ID_MAX,
 142};
 143
 144struct dvobj_priv {
 145        struct rtw_adapter *if1; /* PRIMARY_ADAPTER */
 146        struct rtw_adapter *if2; /* SECONDARY_ADAPTER */
 147
 148        /* for local/global synchronization */
 149        struct mutex hw_init_mutex;
 150        struct mutex h2c_fwcmd_mutex;
 151        struct mutex setch_mutex;
 152        struct mutex setbw_mutex;
 153
 154        unsigned char   oper_channel; /* saved chan info when set chan bw */
 155        unsigned char   oper_bwmode;
 156        unsigned char   oper_ch_offset;/* PRIME_CHNL_OFFSET */
 157
 158        struct rtw_adapter *padapters[IFACE_ID_MAX];
 159        u8 iface_nums; /*  total number of ifaces used runtime */
 160
 161        /* For 92D, DMDP have 2 interface. */
 162        u8      InterfaceNumber;
 163        u8      NumInterfaces;
 164
 165        /* In /Out Pipe information */
 166        int     RtInPipe[2];
 167        int     RtOutPipe[3];
 168        u8      Queue2Pipe[HW_QUEUE_ENTRY];/* for out pipe mapping */
 169
 170/*-------- below is for USB INTERFACE --------*/
 171
 172        u8      nr_endpoint;
 173        u8      ishighspeed;
 174        u8      RtNumInPipes;
 175        u8      RtNumOutPipes;
 176        int     ep_num[5]; /* endpoint number */
 177
 178        struct mutex usb_vendor_req_mutex;
 179
 180        union {
 181                __le32 val32;
 182                __le16 val16;
 183                u8 val8;
 184        } usb_buf;
 185
 186        struct usb_interface *pusbintf;
 187        struct usb_device *pusbdev;
 188        atomic_t continual_urb_error;
 189
 190/*-------- below is for PCIE INTERFACE --------*/
 191
 192};
 193
 194static inline struct device *dvobj_to_dev(struct dvobj_priv *dvobj)
 195{
 196        /* todo: get interface type from dvobj and the return the dev accordingly */
 197        return &dvobj->pusbintf->dev;
 198}
 199
 200enum _IFACE_TYPE {
 201        IFACE_PORT0, /* mapping to port0 for C/D series chips */
 202        IFACE_PORT1, /* mapping to port1 for C/D series chip */
 203        MAX_IFACE_PORT,
 204};
 205
 206enum _ADAPTER_TYPE {
 207        PRIMARY_ADAPTER,
 208        SECONDARY_ADAPTER,
 209        MAX_ADAPTER,
 210};
 211
 212struct rtw_adapter {
 213        int     pid[3];/* process id from UI, 0:wps, 1:hostapd, 2:dhcpcd */
 214        int     bDongle;/* build-in module or external dongle */
 215        u16     chip_type;
 216        u16     HardwareType;
 217
 218        struct dvobj_priv *dvobj;
 219        struct  mlme_priv mlmepriv;
 220        struct  mlme_ext_priv mlmeextpriv;
 221        struct  cmd_priv        cmdpriv;
 222        struct  evt_priv        evtpriv;
 223        struct  xmit_priv       xmitpriv;
 224        struct  recv_priv       recvpriv;
 225        struct  sta_priv        stapriv;
 226        struct  security_priv   securitypriv;
 227        struct  registry_priv   registrypriv;
 228        struct  pwrctrl_priv    pwrctrlpriv;
 229        struct  eeprom_priv eeprompriv;
 230
 231        u32     setband;
 232
 233        void *HalData;
 234
 235        s32     bDriverStopped;
 236        s32     bSurpriseRemoved;
 237        s32  bCardDisableWOHSM;
 238
 239        u32     IsrContent;
 240        u32     ImrContent;
 241
 242        u8      EepromAddressSize;
 243        u8      hw_init_completed;
 244        u8      bDriverIsGoingToUnload;
 245        u8      init_adpt_in_progress;
 246        u8      bHaltInProgress;
 247
 248        struct net_device *pnetdev;
 249
 250        /*  used by rtw_rereg_nd_name related function */
 251        int bup;
 252        struct net_device_stats stats;
 253
 254        struct wireless_dev *rtw_wdev;
 255        int net_closed;
 256
 257        u8 bFWReady;
 258        u8 bReadPortCancel;
 259        u8 bWritePortCancel;
 260
 261        /* extend to support multi interface */
 262        /* IFACE_ID0 is equals to PRIMARY_ADAPTER */
 263        /* IFACE_ID1 is equals to SECONDARY_ADAPTER */
 264        u8 iface_id;
 265};
 266
 267#define adapter_to_dvobj(adapter) (adapter->dvobj)
 268
 269static inline u8 *myid(struct eeprom_priv *peepriv)
 270{
 271        return peepriv->mac_addr;
 272}
 273
 274#endif /* __DRV_TYPES_H__ */
 275