高通AR6003 wifi软件分析说明

1.    文档介绍

    本文档主要介绍wifi适配层(wmi)代码框架结构和wifisoftap功能的设计框架。总结softap设计中用到的主要的wifi配置命令,可以作为后续softap功能设计参考文档。

2.    文档内容概述

本文档主要主要介绍以下知识点

一、wifi 适配层代码框架结构分析

二、wifi主要配置项总结

三、Softap设计基本框架简介

3.    文档主要内容介绍

3.1 wifi 适配层代码框架结构分析

Wifi 配置整体框架图如下:

 
 
 

                        APP

               

 
 
 

      

      无线接口层(WMI

 
 
 

        SDIO DRIVER

 
 
 

        AR6003 devices

 

wlan无线接口层(wmi)向上给APP提供接口与wifiAR6003驱动通信,使得上层应用程序可以对wifi芯片进行适配,满足应用需求,向下通过sdio驱动向wifi芯片下发配置命令,配置wifi各项参数。

具体配置命令是通过sdio驱动来实现的,sdio驱动通过ioctl系统调用直接控制wifi AR6003芯片,向上层提供一堆的ioctl调用接口。为了管理这些接口

高通写了一个应用程序wmiconfig进程来管理这些系统调用命令。上层其他APP只需要调用wmiconfig进程通过传入不同的参数来实现对wifi的配置。Wmiconfig进程中会去解析其他APP传入的命令行参数,然后调用相应的ioctl系统调用。

Wmiconfig进程的代码框架结构如下:

 
 
 

 ――――――main():函数入口

         

         ――getopt_long():解析命令行参数 通过switch case结构处理所有命令分支,因为命令非常多,所以caase分支非常庞大。

         --ioctl():命令解析完成后,执行相应的系统命令调用,调用过程同样通过switch case来区分不同的调用分支。

  图1

如图1所示,wmiconfig代码结构非常简单,解析参数,执行ioctl系统调用,调用完成函数退出。主要难点是理清各种不同的ioctl命令作用,只有充分了解这些系统调用的作用才能正确使用这些系统调用实现softAP的功能。

下面贴出AR6003芯片所有的ioctl配置命令:

--version\n\

--power <mode> where <mode> isrec or maxperf\n\

--getpower is used to get the power mode(recor maxperf)\n\

--pmparams--it=<msec> --np=<number of PS POLL> --dp=<DTIM policy: ignore/normal/stick>--twp=<Tx wakeup policy: wakeup/sleep> --nt=<number of tx towakeup>\n\

--psparams--psPollTimer=<psPollTimeout> --triggerTimer=<triggerTimeout>--apsdTimPolicy=<ignore/adhere>--simulatedAPSDTimPolicy=<ignore/adhere>\n\

--forceAssert \n\

--ibsspmcaps--ps=<disable/atheros/ieee> --aw=<ATIM Windows in millisecond>--to=<TIMEOUT in millisecond> --ttl=<Time to live in number of beaconperiods>\n\

--appsparams--pstype=<disable/atheros> --psit=<millisecond> --psperiod=<inmicrosecond> --sleepperiod=<in psperiods>\n\

--scan--fgstart=<sec> --fgend=<sec> --bg=<sec>--minact=<msec> maxact=<msec> --pas=<msec> --sr=<shortscan ratio> --maxact2pas=<msec> --scanctrlflags <connScan><scanConnected> <activeScan> <roamScan> <reportBSSINFO><EnableAutoScan> --maxactscan_ssid=<Max no of active scan per probedssid>\n\

  where: \n\\n\

  <connScan>           is 0 to not scan when Connect andReconnect command, \n\

                          1 to scan whenConnect and Reconnect command, \n\

  <scanConnected>      is0 to skip the ssid it is already connected to, \n\

                          1 to scan the ssid itis already connected to, \n\

  <activeScan>         is 0 to disable active scan, \n\

                          1 to enable activescan, \n\

  <roamScan>           is 0 to disable roam scan whenbeacom miss and low rssi.(It's only valible when connScan is 0.\n\

                          1 to enable roamscan.\n\

  <reportBSSINFO>      is 0 to disable specified BSSINFOreporting rule.\n\

                          1 to enable specified BSSINFOreporting rule.\n\

 <EnableAutoScan>      is 0 to disable autonomous scan. No scanafter a disconnect event\n\

                          1 Enable autonomousscan.\n\

--listen=<#ofTUs, can  range from 15 to 5000>\n\

--listenbeacons=<#ofbeacons, can  range from 1 to 50>\n\

--setbmisstime<#of TUs, can range from 1000 to 5000>\n\

--setbmissbeacons<#of beacons, can range from 5 to 50>\n\

--filter=<filter>--ieMask 0x<mask> where <filter> is none, all, profile, not_profile,bss, not_bss, or ssid and <mask> is a combination of the following\n\

{\n\

    BSS_ELEMID_CHANSWITCH = 0x01 \n\

    BSS_ELEMID_ATHEROS = 0x02\n\

}\n\

--wmode <mode> <list> sc <scan> where \n\

        <mode> is a, g, b,ag, gonly (usemode alone in AP mode) \n\

        <list> is a list of channels(frequencies in mhz or ieee channel numbers)\n\

        <scan> is 0 to disable scan aftersetting channel list.\n\

                  1 to enable scan aftersetting channel list.\n\

--getwmode \n\

--ssid=<ssid>[--num=<index>] where <ssid> is the wireless network string and<index> is 0 or 1 (set to 0 if not specified). Set ssid to 'off' to clearthe entry\n\

--badAP=<macaddr>[--num=<index>] where macaddr is macaddr of AP to be avoided inxx:xx:xx:xx:xx:xx format, and num is index from 0-1.\n\

--clrAP[--num=<index>] is used to clear a badAP entry.  num is index from 0-1\n\

--createqos<user priority> <direction> <traffic class><trafficType> <voice PS capability> \n\

    <min service interval> <maxservice interval> <inactivity interval> <suspension interval>\n\

    <service start time> <tsid><nominal MSDU> <max MSDU> <min data rate> <mean datarate> \n\

    <peak data rate> <max burstsize> <delay bound> <min phy rate> <sba> <mediumtime>where:\n\

        <user priority>         802.1D user priority range : 0-7        \n\

        <direction>             is 0 for Tx(uplink) traffic,            \n\

                                   1 forRx(downlink) traffic,          \n\

                                   2 for bi-directionaltraffic;        \n\

        <traffic class>         is 0 for BE,                            \n\

                                   1 forBK,                            \n\

                                   2 forVI,                            \n\

                                   3 forVO;                            \n\

        <trafficType>           1-periodic, 0-aperiodic                 \n\

        <voice PS capability>   specifies whether the voice power savemechanism \n\

                                (APSD if AP supports it orlegacy/simulated APSD \n\

                                    [usingPS-Poll] ) should be used             \n\

                                = 0 to disablevoice power save for this traffic class,\n\

                                = 1 to enable APSDvoice power save for this traffic class,\n\

                                = 2 to enablevoice power save for ALL traffic classes,\n\

        <min service interval>  in milliseconds                     \n\

        <max service interval>  in milliseconds                     \n\

        <inactivity interval>   in milliseconds;=0 means infinite inactivityinterval\n\

        <suspension interval>   in milliseconds \n\

        <service start time>    service start time \n\

        <tsid>                  TSID range: 0-15                    \n\

        <nominal MSDU>          nominal MAC SDU size                \n\

        <max MSDU>              maximum MAC SDU size                \n\

        <min data rate>         min data rate in bps                \n\

        <mean data rate>        mean data rate in bps               \n\

        <peak data rate>        peak data rate in bps               \n\

        <max burst size>        max burst size in bps               \n\

       <delay bound>          delay bound                        \n\

        <min phy rate>          min phy rate in bps                 \n\

        <sba>                   surplus bandwidthallowance         \n\

        <medium time>           medium time in TU of 32-us periodsper sec    \n\

--deleteqos<trafficClass> <tsid> where:\n\

  <traffic class>         is 0 for BE,                            \n\

                             1 for BK,                            \n\

                             2 for VI,                            \n\

                             3 for VO;                            \n\

  <tsid> is the TspecID, use --qosqueueoption to get the active tsids\n\

--qosqueue<traffic class>, where:\n\

  <traffic class>         is 0 for BE,                            \n\

                             1 for BK,                            \n\

                             2 for VI,                            \n\

                             3 for VO;                            \n\

--getTargetStats--clearStats\n\

   tx_unicast_rate, rx_unicast_rate values willbe 0Kbps when no tx/rx \n\

   unicast data frame is received.\n\

--setErrorReportingBitmask\n\

--acparams --acval<0-3> --txop <limit> --cwmin <0-15> --cwmax <0-15>--aifsn<0-15>\n\

--disc=<timeout>to set the disconnect timeout in seconds\n\

--mode<mode> set the optional mode, where mode is special or off \n\

--sendframe<frmType> <dstaddr> <bssid> <optIEDatalen><optIEData> where:\n\

  <frmType>   is 1 for probe request frame,\n\

                 2 for probe response frame,\n\

                 3 for CPPP start,\n\

                 4 for CPPP stop, \n\

  <dstaddr>   is the destination mac address, inxx:xx:xx:xx:xx:xx format, \n\

  <bssid>     is the bssid, in xx:xx:xx:xx:xx:xx format,\n\

  <optIEDatalen> optional IE datalength,\n\

  <optIEData> is the pointer to optionalIE data arrary \n\

--adhocbssid<macaddr> where macaddr is the BSSID for IBSS to be created inxx:xx:xx:xx:xx:xx format\n\

--beaconintvl   <beacon_interval in milliseonds> \n\

--getbeaconintvl\n\

--setretrylimits  <frameType> <trafficClass><maxRetries> <enableNotify>\n\

  <frameType>      is 0 for management frame, \n\

                      1 for control frame,\n\

                      2,for data frame;\n\

  <trafficClass>   is 0 for BE, 1 for BK, 2 for VI, 3 for VO,only applies to data frame type\n\

  <maxRetries>     is # in [2 - 13];      \n\

  <enableNotify>   is \"on\" to enable thenotification of max retries exceed \n\

                      \"off\" todisable the notification of max retries excedd \n\

--rssiThreshold<weight> <pollTimer> <above_threshold_tag_1><above_threshold_val_1> ... \n\

                <above_threshold_tag_6><above_threshold_val_6> \n\

                <below_threshold_tag_1><below_threshold_val_1> ... \n\

                <below_threshold_tag_6><below_threshold_val_6> \n\

  <weight>        share with snrThreshold\n\

  <threshold_x>   will be converted to negatvie valueautomatically, \n\

                   i.e. input 90, actually -90will be set into HW\n\

  <pollTimer>     is timer to poll rssi value(factor of LI),set to 0 will disable all thresholds\n\

                 \n\

--snrThreshold<weight> <upper_threshold_1> ... <upper_threshold_4> \n\

               <lower_threshold_1> ...<lower_threshold_4> <pollTimer>\n\

  <weight>        share with rssiThreshold\n\

  <threshold_x>  is positive value, in ascending order\n\

  <pollTimer>     is timer to poll snr value(factor of LI),set to 0 will disable all thresholds\n\

                 \n\

--cleanRssiSnr \n\

--lqThreshold<enable> <upper_threshold_1> ... <upper_threshold_4>\n\

              <lower_threshold_1> ...<lower_threshold_4>\n\

   <enable>       is 0 for disable,\n\

                     1 for enablelqThreshold\n\

   <threshold_x>  is in ascending order            \n\

--setlongpreamble<enable>\n\

    <enable>      is 0 for diable,\n\

                     1 for enable.\n\

--setRTS  <pkt length threshold>\n\

--getRTS \n\

--startscan   --homeDwellTime=<msec>--forceScanInt<ms> --forceScanFlags <scan type> <forcefgscan><isLegacyCisco> --scanlist <list> where:\n\

  <homeDwellTime>     Maximum duration in the homechannel(milliseconds),\n\

  <forceScanInt>      Time interval between scans(milliseconds),\n\

    <scan type>     is 0 for long scan,\n\

                     1 for short scan,\n\

  <forcefgscan>   is 0 for disable force fgscan,\n\

                     1 for enable forcefgscan,\n\

  <isLegacyCisco> is 0 for disable legacyCisco AP compatible,\n\

                     1 for enable legacy CiscoAP compatible,\n\

  <list> is a list of channels(frequencies in mhz or ieee channel numbers)\n\

--setfixrates<rate index> where: \n\

  <rate index> is {01M},{1 2M},{2 5.5M},{3 11M},{4 6M},{5 9M},{6 12M},{7 18M},{8 24M},{9 36M},{1048M},{11 54M},\n\

  ifwant to config more rare index, can use blank to space out, such as:--setfixrates 0 1 2 \n\

--getfixrates :Get the fix rate index from target\n\

--setauthmode<mode> where:\n\

  <mode>        is 0 to do authentication whenreconnect, \n\

                   1 to not do authenticationwhen reconnect.(not clean key). \n\

--setreassocmode<mode> where:\n\

  <mode>        is 0 do send disassoc whenreassociation, \n\

                   1 do not send disassoc whenreassociation. \n\

--setVoicePktSize  is maximum size of voice packet \n\

--setMaxSPLength   is the maximum service period in packets, asapplicable in APSD \n\

                   0 - deliver all packets \n\

                   1 - deliver up to 2 packets\n\

                   2 - deliver up to 4 packets\n\

                   3 - deliver up to 6 packets\n\

--setAssocIe<IE String>\n\

--roam<roamctrl> <info>\n\

       where <roamctrl> is   1 force a roam to specified bssid\n\

                             2  set the roam mode \n\

                             3  set the host bias of the specified BSSID\n\

                             4 set the lowrssiscan parameters \n\

      where <info> isBSSID<aa:bb:cc:dd:ee:ff> for roamctrl of 1\n\

                      DEFAULT ,BSSBIAS or LOCKfor roamctrl of 2\n\

                     BSSID<aa:bb:cc:dd:ee:ff> <bias> for  roamctrl of 3\n\

                             where <bias>is  a value between -256 and 255\n\

                      <scan period><scan threshold> <roam threshold> \n\

                      <roam rssi floor> forroamctrl of 4\n\

--getroamtable\n\

--getroamdata\n\

--wlan<enable/disable/query>\n\

--bt<on/off/query>\n\

--setBTstatus<streamType> <status>\n\

      where <streamType> is    1 - Bluetooth SCO stream\n\

                               2 - Bluetooth A2DP stream\n\

                               3 - BluetoothInquiry/low priority stream\n\

                               4 - BluetoothE-SCO stream\n\

      \n\

      where <status> is        1 - stream started\n\

                               2 - stream stopped\n\

                               3 - streamresumed\n\

                               4 - streamsuspended\n\

--setBTparams<paramType> <params>\n\

      where <paramType> is     1 - Bluetooth SCO stream parameters\n\

                               2 - BluetoothA2DP stream parameters \n\

                               3 - Front endantenna configuration \n\

                               4 - Co-locatedBluetooth configuration\n\

                               5 - BluetoothACL coex (non-a2dp) parameters\n\

                               6 - 11a is usinga separate antenna\n\

      \n\

      where <params> for Bluetooth SCOare:\n\

              <numScoCyclesForceTrigger>- number of Sco cyles, to force a trigger\n\

               <dataResponseTimeout> -timeout for receiving downlink packet per PS-poll\n\

               <stompScoRules> -Applicable for dual/splitter front end\n\

                           1, Never stomp BT toreceive downlink pkt\n\

                           2, Always stomp BT to receive downlinkpkt\n\

                           3, Stomp BT onlyduring low rssi conditions\n\

               <stompDutyCyleVal> If Scois stomped while waiting for downlink pkt, number sco cyles to not queueps-poll-(Applicable only for switch FE)\n\

              <psPollLatencyFraction>Fraction of idle SCO idle time.\n\

                           1, if more than 3/4idle duration is left, retrieve downlink pkt\n\

                           2, if more than 1/2idle duration is left, retrieve downlink pkt\n\

                           3, if more 1/4 idleduration is left, retrieve dwnlink pkt\n\

               <SCO slots> - number ofTx+Rx SCO slots : 2 for single-slot SCO, 6 for 3-slot SCO\n\

          <Idle SCO slots> - number ofidle slots between two SCO Tx+Rx instances\n\

      \n\

      where <params> for A2DPconfiguration are\n\

      <a2dpWlanUsageLimit> Max durationwlan can use the medium ,whenever firmware detects medium for wlan (in msecs)\n\

     <a2dpBurstCntMin> Mininum number ofbluetooth data frames to replenish wlan usage time\n\

     <a2dpDataRespTimeout> Time to waitfor downlink data, after queuing pspoll\n\

      where <params> for front endantenna configuration are\n\

      1 - Dual antenna configuration (BT andwlan have seperate antenna) \n\

      2 - Single antenna splitter configuration\n\

      3 - Single antenna switch  configuration \n\

      \n\

      where <params> for co-locatedBluetooth configuration are\n\

      0 - Qualcomm BTS402x (default)\n\

      1 - CSR Bluetooth\n\

      2 - Atheros Bluetooth\n\

      \n\

      where <params> for Bluetooth ACLcoex(bt ftp or bt OPP or other data based ACL profile (non a2dp)  parameter are \n\

      <aclWlanMediumUsageTime> Usage timefor Wlan.(default 30 msecs)\n\

      <aclBtMediumUsageTime> Usage timefor bluetooth (default 30 msecs)\n\

      <aclDataRespTimeout> - timeout forreceiving downlink packet per PS-poll\n\

--setbtcoexfeant<antType> \n\

       <antType> - Front end antennatype\n\

       1 - Single antenna\n\

       2 - Dual antenna\n\

       3 - Dual antenna high isolation\n\

       4 - bypass mode\n\

       5 - combine mode\n\

--setbtcoexcolocatedbt<btdevType >\n\

        <btdevType> Co-located bluetoothdevice\n\

        1 - Qualcomm BTS402X \n\

        2 - CSR BC06 bluetooth \n\

        3 - Atheros 3001 bluetooth\n\

        4 - ST-ericssion CG2900 \n\

        5 - Atheros 3002/MCI \n\

--setbtcoexscoconfig<noscoSlots> <noidleslots> <scoflags> <linkid><scoCyclesForceTrigger> <scoDataResponseTimeout><scoStompDutyCyleVal> <scoStompDutyCyleMaxVal><scoPsPollLatencyFraction> <scoStompCntIn100ms><scoContStompMax> <scoMinlowRateMbps> <scoLowRateCnt><scoHighPktRatio> <scoMaxAggrSize>\n\

--setbtcoexa2dpconfig<a2dpFlags> <linkid> <a2dpWlanMaxDur> <a2dpMinBurstCnt><a2dpDataRespTimeout> <a2dpMinlowRateMbps> <a2dpLowRateCnt><a2dpHighPktRatio> <a2dpMaxAggrSize> <a2dpPktStompCnt>\n\

--setbtcoexaclcoexconfig<aclWlanMediumDur> <aclBtMediumDur> <aclDetectTimeout><aclPktCntLowerLimit> <aclIterForEnDis> <aclPktCntUpperLimit><aclCoexFlags> <linkId> <aclDataRespTimeout><aclCoexMinlowRateMbps> <aclCoexLowRateCnt><aclCoexHighPktRatio> <aclCoexMaxAggrSize> <aclPktStompCnt>  \n\

--setbtcoexbtinquirypageconfig<btInquiryDataFetchFrequency> <protectBmissDurPostBtInquiry><btInquiryPageFlag>\n\

--setbtcoexbtoperatingstatus<btprofiletype> <btoperatingstatus> <btlinkid>\n\

        <btprofiletype> - Bluetoothprofile\n\

        1 - Bluetooth SCO profile \n\

        2 - Bluetooth A2DP profile \n\

        3 - Bluetooth Inquiry Page profile \n\

        4 - Bluetooth ACL (non-a2dp) profile\n\

        \n\

        <btoperatingstatus>  profile operating status \n\

        1 - start \n\

        2 - stop \n\

        \n\

        <btlinkid> bluetooth link id-Applicable only for STE Bluetooth\n\

        \n\

--setbtcoexdebug<params1> <params2> <params3> <params4> <params5>\n\

--getbtcoexconfig<btprofile> <linkid>\n\

        <btprofile> - bluetooth profile\n\

        1 - Bluetooth SCO profile \n\

        2 - Bluetooth A2DP profile \n\

        3 - Bluetooth Inquiry Page profile \n\

        4 - Bluetooth ACL (non-a2dp) profile\n\

        \n\

    <btlinkid> bluetooth link id-Applicable only for STE Bluetooth\n\

    \n\

\n\

--getbtcoexstats\n\

--detecterror--frequency=<sec> --threshold=<count> where:\n\

  <frequency>   is the periodicity of the challenge messagesin seconds, \n\

  <threshold>   is the number of challenge misses afterwhich the error detection module in the driver will report an error, \n\

--getheartbeat --cookie=<cookie>\n\

  <cookie>  is used to identify the responsecorresponding to a challenge sent\n\

--usersetkeys--initrsc=<on/off>\n\

  initrsc=on(off> initialises(doesnotinitialise) the RSC in the firmware\n\

--getRD\n\

--setcountry <countryCode> (Use --countrycodes for list ofcodes)\n\

--countrycodes (Lists all the valid countrycodes)\n\

--getcountry \n\

--disableregulatory\n\

--txopbursting<burstEnable>\n\

        where <burstEnable> is  0 disallow TxOp bursting\n\

                                1 allow TxOp bursting\n\

--diagread\n\

--diagwrite\n\

--setkeepalive<keepalive interval>\n\

  <keepalive interval> is the time withinwhich if there is no transmission/reception activity, the station sends a nullpacket to AP.\n\

--getkeepalive\n\

--setappie<frame> <IE>\n\

         where frame is one of beacon, probe,respon, assoc\n\

               IE is a hex string starting withdd\n\

               if IE is 0 then no IE is sent inthe management frame\n\

--setmgmtfilter<op> <frametype>\n\

                op is one of set, clear\n\

                frametype is one of beaconproberesp\n\

--setdbglogconfig--mmask=<mask> --rep=<0/1> --tsr=<tsr codes>--size=<num>\n\

         where <mask> is a 16 bit widemask to selectively enable logging for different modules. Example: 0xFFFDenables logging for all modules except WMI. The mask is derived from the moduleids defined in etna/include/dbglog.h header file.\n\

               <rep> is whether thetarget should generate log events to the host whenever the log buffer isfull.\n\

               <tsr> resolution of thedebug timestamp (less than 16)\n\

                     0: 31.25 us\n\

                     1: 62.50 us\n\

                     2: 125.0 us\n\

                     3: 250.0 us\n\

                     4: 500.0 us\n\

                     5: 1.0 ms and so on.\n\

               <size> size of the reportin number of debug logs.\n\

--getdbglogs\n\

--sethostmode<mode>\n\

  where <mode> is awake\n\

                  asleep\n\

--setwowmode<mode> --wowfilter <filter> --hostreqdelay <hostreqdelay> \n\

  where <mode> is enable \n\

                  disable\n\

  where <filter> is ssid -to enable ssidfiltering when asleep\n\

                    none \n\

--getwowlist<listid> \n\

--addwowpattern<list-id> <pattern-size> <pattern-offset> <pattern><pattern-mask \n\

--delwowpattern<list-id> <pattern-id>\n\

--dumpchipmem \n\

--dumpchipmem_venus\n\

--setconnectctrl<ctrl flags bitmask> \n\

  where <flags> could take the followingvalues:\n\

      0x0001(CONNECT_ASSOC_POLICY_USER): Assocframes are sent using the policy specified by the flag below.\n\

      0x0002(CONNECT_SEND_REASSOC): SendReassoc frame while connecting otherwise send assoc frames.\n\

      0x0004(CONNECT_IGNORE_WPAx_GROUP_CIPHER):Ignore WPAx group cipher for WPA/WPA2.\n\

      0x0008(CONNECT_PROFILE_MATCH_DONE):Ignore any profile check.\n\

      0x0010(CONNECT_IGNORE_AAC_BEACON): Ignorethe admission control beacon.\n\

      0x0020(CONNECT_CSA_FOLLOW_BSS):Set toFollow BSS to the new channel and connect \n\

                                 and reset todisconnect from BSS and change channel \n\

--dumpcreditstates\n\

      Triggers the HTC layer to dump creditstate information to the debugger \n\

--setakmp--multipmkid=<on/off>\n\

  multipmkid=on(off> enables(doesnot enable)Multi PMKID Caching in firmware\n\

--setpmkidlist--numpmkid=<n> --pmkid=<pmkid_1> ... --pmkid=<pmkid_n>\n\

   where n is the number of pmkids (max 8)\n\

   and pmkid_i is the ith pmkid (16 bytes inhex format)\n\

--setbsspmkid--bssid=<aabbccddeeff> --bsspmkid=<pmkid>\n\

   bssid is 6 bytes in hex format\n\

   bsspmkid is 16 bytes in hex format\n\

--getpmkidlist \n\

--abortscan \n\

--settgtevt<event value>\n\

      where <event value> is  0 send WMI_DISCONNECT_EVENT with disconnectReason= BSS_DISCONNECTED\n\

                                afterre-connection with AP\n\

                              1 NOT sendWMI_DISCONNECT_EVENT with disconnectReason = BSS_DISCONNECTED\n\

                                afterre-connection with AP\n\

--getsta \n\

--hiddenssid <value> \n\

    where value 1-Enable, 0-Disable. \n\

--gethiddenssid \n\

--numsta <num> \n\

--gnumsta<num> \n\

--getnumsta \n\

--getgnumsta \n\

--conninact<period> \n\

    where period is time in min (default 5min).\n\

    0 will disable STA inactivity check. \n\

--protectionscan<period> <dwell> \n\

    where period is in min (default 5min). 0will disable. \n\

    dwell is in ms. (default 200ms). \n\

--addacl <mac> \n\

    where mac is of the formatxx:xx:xx:xx:xx:xx \n\

--delacl <index> \n\

    use --getacl to get index\n\

--getacl \n\

--aclpolicy <policy> <retain list> \n\

    where <policy> \n\

        0 - Disable ACL \n\

        1 - Allow MAC \n\

        2 - Deny MAC \n\

          <retain list>\n\

        0 - Clear the currentACL list \n\

        1 - Retain the currentACL list \n\

--removesta<action> <reason> <mac> \n\

    where <action>  \n\

            2 - Disassoc    \n\

            3 - Deauth      \n\

          <reason> protocol reason code,use 1 when in doubt \n\

          <mac> mac addr of a connectedSTA            \n\

--dtim<period> \n\

--getdtim \n\

--intrabss<ctrl> \n\

    where <ctrl> 0 - Disable, 1 - Enable(default) \n\

--interbss<ctrl> \n\

    where <ctrl> 0 - Disable, 1 - Enable(default) \n\

--apgetstats\n\:获取ap状态,收发数据包的状态。

--apclearstats\n\

--acspolicy <0/1/2> \n\

    where 0 - ACS will choose 1, 6 or 11(default)\n\

          1 - ACS will choose 1 or 6 \n\

          2 - ACS will choose 1, 5, 9, 13 \n\

--commit \n\

--ip arg, arg maybe \n\

   none - resets ip \n\

   x.x.x.x - ip addr is dotted form\n\

--set_ht_cap <band> <enable> <supported channel widthset> <short GI 20MHz> <short GI 40MHz> <40MHz intolerant><max AMPDU len exponent> \n\

   where <band> : 'g' for 2.4 GHZ or 'a' for 5GHZ \n\

   <enable> : 0 to disable 11n in band, 1 to enable 11n in band  \n\

   <supported channel width set> : 0 if only 20MHz operationsupported \n\

                                          1 if20MHz and 40MHz operation supported \n\

   <short GI 20MHz> : 0 if not supported, 1 if supported \n\

   <short GI 40MHz> : 0 if not supported, 1 if supported \n\

   <40MHz intolerant> : 1 if prohibit a receing AP from operating asa 20/40 MHz BSS \n\

                         0 otherwise \n\

   <max AMPDU len exponent> : valid values from 0 to 3 \n\

--dump_recv_aggr_stats\n\

--setup_aggr<tid> <aid> \n\

        where <aid> = aid of a connectedSTA. Ignored in STA mode \n\

--allow_aggr<tx_tid_mask>  <rx_tid_mask>\n\

--dele_aggr<tid>  <direction><aid> \n\

        where <direction> =1 uplink; \n\

                          =0 dnlink  \n\

              <aid> = aid of a connectedSTA. Ignored in STA mode \n\

--set_ht_op <STA channel width> : 0 if only allow 20MHzchannel width\n\

                                  1 if allowany channel width in the supported channel width set \n\

--wlan_conn_prec<prec_val> \n\

        where 0: WLAN connection will haveprecedence;\n\

              1: PAL connection will haveprecedence;\n\

--settxselrates<11A ratemask> <11G ratemask> <11B ratemask> <11GOnlyratemask> <11A_HT20 ratemask> <11G_HT20 ratemask> \

<11A_HT40ratemask> <11G_HT40 ratemask> where all rate masks are hex integers.\n\

--aprateset <val> \n\

        where 1: RateSet#1 -1,2,5.5,11 basic rates (default)\n\

              2: RateSet#2 -1,2,5.5,11,6,12,24 basic rates\n\

--connect<ssid> \n\

--connect<ssid> --wpa <ver> <ucipher> <mcipher> <psk> \n\

--connect<ssid> --wep <mode> <def_keyix> <key1> <key2*><key3*> <key4*> \n\

        where  <ssid>     : SSID of network\n\

                <ver>      : 1 - WPA, 2 - RSN   \n\

                <ucipher>  : TKIP or CCMP for unicast \n\

                <mcipher>  : TKIP or CCMP for multicast \n\

                <psk>      : passphrase for WPA    \n\

                <mode>     : open or shared    \n\

                <def_keyix>: Default TXwep key index  [1-4] \n\

                <key>      : wep key   \n\

                *          : optional parameters  \n\

--set_tx_sgi--masksgi <mask> --persgi <value> \n\

         where <mask> is a 32 bithexadecimal value (eg: 0x0808000 or 08080000) to select desired MCS andht20/ht40 SGI implementation (refer spec for bit location of each MCS)\n\

             For disabling SGI enter 0x00000000or 0.\n\

             If mask is not entered, thedefault mask is 0x08080000 which enables MCS 7 to use SGI for both ht20 andht40, when set_tx_sgi command is issued \n\

         where <value> is the acceptable loss percentage for Packet Error Rate(PER) for SGI (default : 10)\n\

--set_dfs <enable> \n\

       where  <enable> : 1 to allowDFS \n\

                        : 0 to disable DFS \n\

--setdivparam<idleTime> <RSSIThresh> <Enable> <Threshold Rate> \n\

        where <idleTime> : time in mswhere the idle timer would start checking the other antenna (default: 10000)\n\

                  <RSSIThresh> : in db,where the firmware will check the other antenna if the RSSI drops below thisdelta (default: 10) \n\

                  <Enable> : 1 to enablediversity \n\

                  <Threshold Rate> : inMbps, where the firmware will block the idleTimer if the throughput is abovethis rate (default 48) \n\

--scanprobedssid<ssid> where <ssid> is the wireless network string to scan.Broadcast probe will not be sent .  Setssid to 'off' or 'any' to send broadcast probe requests \n\

--ap_apsd<value> \n\

    where value 1-Enable, 0-Disable \n\

--get_ht_cap <band> \n\

   where <band> : 'g' for 2.4 GHZ or 'a' for 5GHZ \n\

--lte_freq <freq> \n\

--mcastFilter<value> \n\

    where value 1-Enable, 0-Disable. This filteringis enabled/disabled for that interface \n\

--setMcastFilter<mac> \n\

    where mac - multicast mac address in theformat AA:BB:CC:DD:EE:FF \n\

    This filter will be applied for mcastpackets to that interface \n\

--delMcastFilter<mac> \n\

    where mac - multicast mac address in theformat AA:BB:CC:DD:EE:FF \n\

    This filter will no longer be applicablefor filtering mcast packets for that interface \n\

--idleclosetime<time value> \n\

    where time unit is in seconds \n\

    0 - Disable \n\

    1 to4294967( i.e (2^32-1)/1000 ) \n\

"

3.2 SoftAP用到的主要配置命令总结如下

--version\n\

--power<mode> where <mode> is rec or maxperf\n\

--getpoweris used to get the power mode(rec or maxperf)\n\

--wmode <mode> <list>sc <scan> where \n\

        <mode> is a, g, b,ag, gonly (usemode alone in AP mode) \n\

        <list> is a list of channels(frequencies in mhz or ieee channel numbers)\n\

        <scan> is 0 to disable scan aftersetting channel list.\n\

                  1 to enable scan aftersetting channel list.\n\

--getwmode\n\

 

--ssid=<ssid>[--num=<index>] where <ssid> is the wireless network string and<index> is 0 or 1 (set to 0 if not specified). Set ssid to 'off' to clearthe entry\n\

  <rate index> is {0 1M},{1 2M},{25.5M},{3 11M},{4 6M},{5 9M},{6 12M},{7 18M},{8 24M},{9 36M},{10 48M},{1154M},\n\

  if want to config more rare index, can useblank to space out, such as: --setfixrates 0 1 2 \n\

 

--wlan<enable/disable/query>\n\

 

--setcountry<countryCode> (Use --countrycodes for list of codes)\n\

--countrycodes(Lists all the valid country codes)\n\

--getcountry\n\

 

--setkeepalive<keepalive interval>\n\

  <keepalive interval> is the time withinwhich if there is no transmission/reception activity, the station sends a nullpacket to AP.\n\

 

--getsta\n\

--hiddenssid<value> \n\

 

--gethiddenssid \n\

--numsta<num> \n\

 

--addacl<mac> \n\

    where mac is of the formatxx:xx:xx:xx:xx:xx \n\

--delacl<index> \n\

    use --getacl to get index \n\

--getacl\n\

--aclpolicy<policy> <retain list> \n\

    where <policy> \n\

        0 - Disable ACL \n\

        1 - Allow MAC \n\

        2 - Deny MAC \n\

          <retain list> \n\

        0 - Clear the current ACL list \n\

        1 - Retain the current ACL list \n\

 

--commit\n\

 

--set_ht_cap<band> <enable> <supported channel width set> <short GI20MHz> <short GI 40MHz> <40MHz intolerant> <max AMPDU lenexponent> \n\

    where <band> : 'g' for 2.4 GHZ or 'a'for 5GHZ \n\

    <enable> : 0 to disable 11n in band,1 to enable 11n in band  \n\

    <supported channel width set> : 0 ifonly 20MHz operation supported \n\

                                          1 if20MHz and 40MHz operation supported \n\

    <short GI 20MHz> : 0 if notsupported, 1 if supported \n\

    <short GI 40MHz> : 0 if notsupported, 1 if supported \n\

    <40MHz intolerant> : 1 if prohibit areceing AP from operating as a 20/40 MHz BSS \n\

                         0 otherwise \n\

    <max AMPDU len exponent> : validvalues from 0 to 3 \n\

 

--get_ht_cap<band> \n\

    where <band> : 'g' for 2.4 GHZ or 'a'for 5GHZ \n\

 

--set_ht_op<STA channel width> : 0 if only allow 20MHz channel width\n\

                                  1 if allowany channel width in the

 

--aprateset<val> \n\

        where 1: RateSet#1 - 1,2,5.5,11 basicrates (default)\n\

              2: RateSet#2 - 1,2,5.5,11,6,12,24basic rates\n\

 

--set_dfs<enable> \n\

        where <enable> : 1 to allow DFS \n\

                        : 0 to disable DFS \n\

 

--lte_freq<freq> \n\

以上25条wmiconfig命令为softap设计可能会用到的。可以供后续SoftAp设计参考。

3.3 Softap基本框架结构设计简介

Softap基本框架结构设计主要步骤如下:

一、加载wifi驱动:

方法:

1,使能sdio驱动

echo 1 > /sys/devices/platform/msm_sdcc.2/polling

2,使能ip转发功能

echo 1 > /proc/sys/net/ipv4/ip_forward

3,加载ar6000驱动模块,并且设置wifi模式为单AP模式

modprobe ar6000 targetconf=\"router\" devmode=ap

4,等待wifi驱动加载成功。

查看/proc/sys/net/ipv4/conf/eth0是否生成。

二、启动hostapd进程和dhcpserver进程

Hostapd进程是用来管理wifi的,dhcpserver进程是用来给lan侧地址分配地址使用的。

三、配置wlan接口

方法:

1,设置ssid名

Wmiconfig eth0 –ssid “ssidname”

2,使能wlan接口,并且为接口设置ip地址

ifconfig eth0 192.168.1.1 netmask 255.255.255.0up

四、去使能sdio驱动

echo 0 >/sys/devices/platform/msm_sdcc.2/polling

3.4 总结

通过以上五个步骤后,可以实现wifi基本功能的设置,其他一些功能模块可以通过上述3.2小节中的wmiconfig命令进行适配。Wifi提供给上层的sdk接口主要就是对wmiconfig命令的封装。前提是这些命令是可以正确运行的。

Wifi设计的主要框架分成三部分:

一、wifi初始化过程

这个过程中主要做的事情是加载wifi驱动,读数据库,初始化wlan各项参

数,启动wifi。

二、为上层应用提供控制接口,供上层应用设置wifi各项功能。

这部分主要是为上层应用程序提供设置接口,上层其他应用程序将wlan各

项写入数据库中,然后重启wlan进程,wlan重启后读数据库重新进行初始化过程使用户的设置生效。

三、去使能wlan设置

用户关机时对wlan进行相应的去初始化操作。

猜你喜欢

转载自blog.csdn.net/h721510279812/article/details/39010415