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配置命令:
--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\
<