hal_usb_led.c 118 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. *
  19. ******************************************************************************/
  20. #include <drv_types.h>
  21. #include <hal_data.h>
  22. //
  23. // Description:
  24. // Implementation of LED blinking behavior.
  25. // It toggle off LED and schedule corresponding timer if necessary.
  26. //
  27. void
  28. SwLedBlink(
  29. PLED_USB pLed
  30. )
  31. {
  32. _adapter *padapter = pLed->padapter;
  33. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  34. u8 bStopBlinking = _FALSE;
  35. // Change LED according to BlinkingLedState specified.
  36. if( pLed->BlinkingLedState == RTW_LED_ON )
  37. {
  38. SwLedOn(padapter, pLed);
  39. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  40. }
  41. else
  42. {
  43. SwLedOff(padapter, pLed);
  44. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  45. }
  46. // Determine if we shall change LED state again.
  47. pLed->BlinkTimes--;
  48. switch(pLed->CurrLedState)
  49. {
  50. case LED_BLINK_NORMAL:
  51. if(pLed->BlinkTimes == 0)
  52. {
  53. bStopBlinking = _TRUE;
  54. }
  55. break;
  56. case LED_BLINK_StartToBlink:
  57. if( check_fwstate(pmlmepriv, _FW_LINKED) && check_fwstate(pmlmepriv, WIFI_STATION_STATE) )
  58. {
  59. bStopBlinking = _TRUE;
  60. }
  61. if( check_fwstate(pmlmepriv, _FW_LINKED) &&
  62. (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) )
  63. {
  64. bStopBlinking = _TRUE;
  65. }
  66. else if(pLed->BlinkTimes == 0)
  67. {
  68. bStopBlinking = _TRUE;
  69. }
  70. break;
  71. case LED_BLINK_WPS:
  72. if( pLed->BlinkTimes == 0 )
  73. {
  74. bStopBlinking = _TRUE;
  75. }
  76. break;
  77. default:
  78. bStopBlinking = _TRUE;
  79. break;
  80. }
  81. if(bStopBlinking)
  82. {
  83. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  84. {
  85. SwLedOff(padapter, pLed);
  86. }
  87. else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE) && (pLed->bLedOn == _FALSE))
  88. {
  89. SwLedOn(padapter, pLed);
  90. }
  91. else if( (check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE) && pLed->bLedOn == _TRUE)
  92. {
  93. SwLedOff(padapter, pLed);
  94. }
  95. pLed->BlinkTimes = 0;
  96. pLed->bLedBlinkInProgress = _FALSE;
  97. }
  98. else
  99. {
  100. // Assign LED state to toggle.
  101. if( pLed->BlinkingLedState == RTW_LED_ON )
  102. pLed->BlinkingLedState = RTW_LED_OFF;
  103. else
  104. pLed->BlinkingLedState = RTW_LED_ON;
  105. // Schedule a timer to toggle LED state.
  106. switch( pLed->CurrLedState )
  107. {
  108. case LED_BLINK_NORMAL:
  109. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  110. break;
  111. case LED_BLINK_SLOWLY:
  112. case LED_BLINK_StartToBlink:
  113. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  114. break;
  115. case LED_BLINK_WPS:
  116. {
  117. if( pLed->BlinkingLedState == RTW_LED_ON )
  118. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
  119. else
  120. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
  121. }
  122. break;
  123. default:
  124. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  125. break;
  126. }
  127. }
  128. }
  129. void
  130. SwLedBlink1(
  131. PLED_USB pLed
  132. )
  133. {
  134. _adapter *padapter = pLed->padapter;
  135. EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
  136. struct led_priv *ledpriv = &(padapter->ledpriv);
  137. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  138. PLED_USB pLed1 = &(ledpriv->SwLed1);
  139. u8 bStopBlinking = _FALSE;
  140. u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
  141. if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
  142. uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
  143. if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
  144. pLed = &(ledpriv->SwLed1);
  145. // Change LED according to BlinkingLedState specified.
  146. if( pLed->BlinkingLedState == RTW_LED_ON )
  147. {
  148. SwLedOn(padapter, pLed);
  149. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,( "Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  150. }
  151. else
  152. {
  153. SwLedOff(padapter, pLed);
  154. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  155. }
  156. if(pEEPROM->CustomerID == RT_CID_DEFAULT)
  157. {
  158. if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  159. {
  160. if(!pLed1->bSWLedCtrl)
  161. {
  162. SwLedOn(padapter, pLed1);
  163. pLed1->bSWLedCtrl = _TRUE;
  164. }
  165. else if(!pLed1->bLedOn)
  166. SwLedOn(padapter, pLed1);
  167. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn on pLed1\n"));
  168. }
  169. else
  170. {
  171. if(!pLed1->bSWLedCtrl)
  172. {
  173. SwLedOff(padapter, pLed1);
  174. pLed1->bSWLedCtrl = _TRUE;
  175. }
  176. else if(pLed1->bLedOn)
  177. SwLedOff(padapter, pLed1);
  178. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (): turn off pLed1\n"));
  179. }
  180. }
  181. switch(pLed->CurrLedState)
  182. {
  183. case LED_BLINK_SLOWLY:
  184. if( pLed->bLedOn )
  185. pLed->BlinkingLedState = RTW_LED_OFF;
  186. else
  187. pLed->BlinkingLedState = RTW_LED_ON;
  188. _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
  189. break;
  190. case LED_BLINK_NORMAL:
  191. if( pLed->bLedOn )
  192. pLed->BlinkingLedState = RTW_LED_OFF;
  193. else
  194. pLed->BlinkingLedState = RTW_LED_ON;
  195. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  196. break;
  197. case LED_BLINK_SCAN:
  198. pLed->BlinkTimes--;
  199. if( pLed->BlinkTimes == 0 )
  200. {
  201. bStopBlinking = _TRUE;
  202. }
  203. if(bStopBlinking)
  204. {
  205. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  206. {
  207. SwLedOff(padapter, pLed);
  208. }
  209. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  210. {
  211. pLed->bLedLinkBlinkInProgress = _TRUE;
  212. pLed->CurrLedState = LED_BLINK_NORMAL;
  213. if( pLed->bLedOn )
  214. pLed->BlinkingLedState = RTW_LED_OFF;
  215. else
  216. pLed->BlinkingLedState = RTW_LED_ON;
  217. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  218. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  219. }
  220. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  221. {
  222. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  223. pLed->CurrLedState = LED_BLINK_SLOWLY;
  224. if( pLed->bLedOn )
  225. pLed->BlinkingLedState = RTW_LED_OFF;
  226. else
  227. pLed->BlinkingLedState = RTW_LED_ON;
  228. _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
  229. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  230. }
  231. pLed->bLedScanBlinkInProgress = _FALSE;
  232. }
  233. else
  234. {
  235. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  236. {
  237. SwLedOff(padapter, pLed);
  238. }
  239. else
  240. {
  241. if( pLed->bLedOn )
  242. pLed->BlinkingLedState = RTW_LED_OFF;
  243. else
  244. pLed->BlinkingLedState = RTW_LED_ON;
  245. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  246. }
  247. }
  248. break;
  249. case LED_BLINK_TXRX:
  250. pLed->BlinkTimes--;
  251. if( pLed->BlinkTimes == 0 )
  252. {
  253. bStopBlinking = _TRUE;
  254. }
  255. if(bStopBlinking)
  256. {
  257. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  258. {
  259. SwLedOff(padapter, pLed);
  260. }
  261. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  262. {
  263. pLed->bLedLinkBlinkInProgress = _TRUE;
  264. pLed->CurrLedState = LED_BLINK_NORMAL;
  265. if( pLed->bLedOn )
  266. pLed->BlinkingLedState = RTW_LED_OFF;
  267. else
  268. pLed->BlinkingLedState = RTW_LED_ON;
  269. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  270. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  271. }
  272. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  273. {
  274. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  275. pLed->CurrLedState = LED_BLINK_SLOWLY;
  276. if( pLed->bLedOn )
  277. pLed->BlinkingLedState = RTW_LED_OFF;
  278. else
  279. pLed->BlinkingLedState = RTW_LED_ON;
  280. _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);
  281. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  282. }
  283. pLed->BlinkTimes = 0;
  284. pLed->bLedBlinkInProgress = _FALSE;
  285. }
  286. else
  287. {
  288. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  289. {
  290. SwLedOff(padapter, pLed);
  291. }
  292. else
  293. {
  294. if( pLed->bLedOn )
  295. pLed->BlinkingLedState = RTW_LED_OFF;
  296. else
  297. pLed->BlinkingLedState = RTW_LED_ON;
  298. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  299. }
  300. }
  301. break;
  302. case LED_BLINK_WPS:
  303. if( pLed->bLedOn )
  304. pLed->BlinkingLedState = RTW_LED_OFF;
  305. else
  306. pLed->BlinkingLedState = RTW_LED_ON;
  307. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  308. break;
  309. case LED_BLINK_WPS_STOP: //WPS success
  310. if(pLed->BlinkingLedState == RTW_LED_ON)
  311. {
  312. pLed->BlinkingLedState = RTW_LED_OFF;
  313. _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
  314. bStopBlinking = _FALSE;
  315. }
  316. else
  317. {
  318. bStopBlinking = _TRUE;
  319. }
  320. if(bStopBlinking)
  321. {
  322. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  323. {
  324. SwLedOff(padapter, pLed);
  325. }
  326. else
  327. {
  328. pLed->bLedLinkBlinkInProgress = _TRUE;
  329. pLed->CurrLedState = LED_BLINK_NORMAL;
  330. if( pLed->bLedOn )
  331. pLed->BlinkingLedState = RTW_LED_OFF;
  332. else
  333. pLed->BlinkingLedState = RTW_LED_ON;
  334. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  335. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  336. }
  337. pLed->bLedWPSBlinkInProgress = _FALSE;
  338. }
  339. break;
  340. default:
  341. break;
  342. }
  343. }
  344. void
  345. SwLedBlink2(
  346. PLED_USB pLed
  347. )
  348. {
  349. _adapter *padapter = pLed->padapter;
  350. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  351. u8 bStopBlinking = _FALSE;
  352. // Change LED according to BlinkingLedState specified.
  353. if( pLed->BlinkingLedState == RTW_LED_ON)
  354. {
  355. SwLedOn(padapter, pLed);
  356. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  357. }
  358. else
  359. {
  360. SwLedOff(padapter, pLed);
  361. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  362. }
  363. switch(pLed->CurrLedState)
  364. {
  365. case LED_BLINK_SCAN:
  366. pLed->BlinkTimes--;
  367. if( pLed->BlinkTimes == 0 )
  368. {
  369. bStopBlinking = _TRUE;
  370. }
  371. if(bStopBlinking)
  372. {
  373. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  374. {
  375. SwLedOff(padapter, pLed);
  376. }
  377. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  378. {
  379. pLed->CurrLedState = RTW_LED_ON;
  380. pLed->BlinkingLedState = RTW_LED_ON;
  381. SwLedOn(padapter, pLed);
  382. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
  383. }
  384. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  385. {
  386. pLed->CurrLedState = RTW_LED_OFF;
  387. pLed->BlinkingLedState = RTW_LED_OFF;
  388. SwLedOff(padapter, pLed);
  389. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop scan blink CurrLedState %d\n", pLed->CurrLedState));
  390. }
  391. pLed->bLedScanBlinkInProgress = _FALSE;
  392. }
  393. else
  394. {
  395. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  396. {
  397. SwLedOff(padapter, pLed);
  398. }
  399. else
  400. {
  401. if( pLed->bLedOn )
  402. pLed->BlinkingLedState = RTW_LED_OFF;
  403. else
  404. pLed->BlinkingLedState = RTW_LED_ON;
  405. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  406. }
  407. }
  408. break;
  409. case LED_BLINK_TXRX:
  410. pLed->BlinkTimes--;
  411. if( pLed->BlinkTimes == 0 )
  412. {
  413. bStopBlinking = _TRUE;
  414. }
  415. if(bStopBlinking)
  416. {
  417. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  418. {
  419. SwLedOff(padapter, pLed);
  420. }
  421. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  422. {
  423. pLed->CurrLedState = RTW_LED_ON;
  424. pLed->BlinkingLedState = RTW_LED_ON;
  425. SwLedOn(padapter, pLed);
  426. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
  427. }
  428. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  429. {
  430. pLed->CurrLedState = RTW_LED_OFF;
  431. pLed->BlinkingLedState = RTW_LED_OFF;
  432. SwLedOff(padapter, pLed);
  433. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("stop CurrLedState %d\n", pLed->CurrLedState));
  434. }
  435. pLed->bLedBlinkInProgress = _FALSE;
  436. }
  437. else
  438. {
  439. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  440. {
  441. SwLedOff(padapter, pLed);
  442. }
  443. else
  444. {
  445. if( pLed->bLedOn )
  446. pLed->BlinkingLedState = RTW_LED_OFF;
  447. else
  448. pLed->BlinkingLedState = RTW_LED_ON;
  449. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  450. }
  451. }
  452. break;
  453. default:
  454. break;
  455. }
  456. }
  457. void
  458. SwLedBlink3(
  459. PLED_USB pLed
  460. )
  461. {
  462. _adapter *padapter = pLed->padapter;
  463. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  464. u8 bStopBlinking = _FALSE;
  465. // Change LED according to BlinkingLedState specified.
  466. if( pLed->BlinkingLedState == RTW_LED_ON )
  467. {
  468. SwLedOn(padapter, pLed);
  469. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  470. }
  471. else
  472. {
  473. if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
  474. SwLedOff(padapter, pLed);
  475. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  476. }
  477. switch(pLed->CurrLedState)
  478. {
  479. case LED_BLINK_SCAN:
  480. pLed->BlinkTimes--;
  481. if( pLed->BlinkTimes == 0 )
  482. {
  483. bStopBlinking = _TRUE;
  484. }
  485. if(bStopBlinking)
  486. {
  487. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  488. {
  489. SwLedOff(padapter, pLed);
  490. }
  491. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  492. {
  493. pLed->CurrLedState = RTW_LED_ON;
  494. pLed->BlinkingLedState = RTW_LED_ON;
  495. if( !pLed->bLedOn )
  496. SwLedOn(padapter, pLed);
  497. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  498. }
  499. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  500. {
  501. pLed->CurrLedState = RTW_LED_OFF;
  502. pLed->BlinkingLedState = RTW_LED_OFF;
  503. if( pLed->bLedOn )
  504. SwLedOff(padapter, pLed);
  505. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  506. }
  507. pLed->bLedScanBlinkInProgress = _FALSE;
  508. }
  509. else
  510. {
  511. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  512. {
  513. SwLedOff(padapter, pLed);
  514. }
  515. else
  516. {
  517. if( pLed->bLedOn )
  518. pLed->BlinkingLedState = RTW_LED_OFF;
  519. else
  520. pLed->BlinkingLedState = RTW_LED_ON;
  521. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  522. }
  523. }
  524. break;
  525. case LED_BLINK_TXRX:
  526. pLed->BlinkTimes--;
  527. if( pLed->BlinkTimes == 0 )
  528. {
  529. bStopBlinking = _TRUE;
  530. }
  531. if(bStopBlinking)
  532. {
  533. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  534. {
  535. SwLedOff(padapter, pLed);
  536. }
  537. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  538. {
  539. pLed->CurrLedState = RTW_LED_ON;
  540. pLed->BlinkingLedState = RTW_LED_ON;
  541. if( !pLed->bLedOn )
  542. SwLedOn(padapter, pLed);
  543. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  544. }
  545. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  546. {
  547. pLed->CurrLedState = RTW_LED_OFF;
  548. pLed->BlinkingLedState = RTW_LED_OFF;
  549. if( pLed->bLedOn )
  550. SwLedOff(padapter, pLed);
  551. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  552. }
  553. pLed->bLedBlinkInProgress = _FALSE;
  554. }
  555. else
  556. {
  557. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  558. {
  559. SwLedOff(padapter, pLed);
  560. }
  561. else
  562. {
  563. if( pLed->bLedOn )
  564. pLed->BlinkingLedState = RTW_LED_OFF;
  565. else
  566. pLed->BlinkingLedState = RTW_LED_ON;
  567. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  568. }
  569. }
  570. break;
  571. case LED_BLINK_WPS:
  572. if( pLed->bLedOn )
  573. pLed->BlinkingLedState = RTW_LED_OFF;
  574. else
  575. pLed->BlinkingLedState = RTW_LED_ON;
  576. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  577. break;
  578. case LED_BLINK_WPS_STOP: //WPS success
  579. if(pLed->BlinkingLedState == RTW_LED_ON)
  580. {
  581. pLed->BlinkingLedState = RTW_LED_OFF;
  582. _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
  583. bStopBlinking = _FALSE;
  584. }
  585. else
  586. {
  587. bStopBlinking = _TRUE;
  588. }
  589. if(bStopBlinking)
  590. {
  591. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on )
  592. {
  593. SwLedOff(padapter, pLed);
  594. }
  595. else
  596. {
  597. pLed->CurrLedState = RTW_LED_ON;
  598. pLed->BlinkingLedState = RTW_LED_ON;
  599. SwLedOn(padapter, pLed);
  600. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  601. }
  602. pLed->bLedWPSBlinkInProgress = _FALSE;
  603. }
  604. break;
  605. default:
  606. break;
  607. }
  608. }
  609. void
  610. SwLedBlink4(
  611. PLED_USB pLed
  612. )
  613. {
  614. _adapter *padapter = pLed->padapter;
  615. struct led_priv *ledpriv = &(padapter->ledpriv);
  616. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  617. PLED_USB pLed1 = &(ledpriv->SwLed1);
  618. u8 bStopBlinking = _FALSE;
  619. // Change LED according to BlinkingLedState specified.
  620. if( pLed->BlinkingLedState == RTW_LED_ON )
  621. {
  622. SwLedOn(padapter, pLed);
  623. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  624. }
  625. else
  626. {
  627. SwLedOff(padapter, pLed);
  628. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  629. }
  630. if(!pLed1->bLedWPSBlinkInProgress && pLed1->BlinkingLedState == LED_UNKNOWN)
  631. {
  632. pLed1->BlinkingLedState = RTW_LED_OFF;
  633. pLed1->CurrLedState = RTW_LED_OFF;
  634. SwLedOff(padapter, pLed1);
  635. }
  636. switch(pLed->CurrLedState)
  637. {
  638. case LED_BLINK_SLOWLY:
  639. if( pLed->bLedOn )
  640. pLed->BlinkingLedState = RTW_LED_OFF;
  641. else
  642. pLed->BlinkingLedState = RTW_LED_ON;
  643. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  644. break;
  645. case LED_BLINK_StartToBlink:
  646. if( pLed->bLedOn )
  647. {
  648. pLed->BlinkingLedState = RTW_LED_OFF;
  649. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  650. }
  651. else
  652. {
  653. pLed->BlinkingLedState = RTW_LED_ON;
  654. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  655. }
  656. break;
  657. case LED_BLINK_SCAN:
  658. pLed->BlinkTimes--;
  659. if( pLed->BlinkTimes == 0 )
  660. {
  661. bStopBlinking = _FALSE;
  662. }
  663. if(bStopBlinking)
  664. {
  665. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  666. {
  667. SwLedOff(padapter, pLed);
  668. }
  669. else
  670. {
  671. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  672. pLed->CurrLedState = LED_BLINK_SLOWLY;
  673. if( pLed->bLedOn )
  674. pLed->BlinkingLedState = RTW_LED_OFF;
  675. else
  676. pLed->BlinkingLedState = RTW_LED_ON;
  677. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  678. }
  679. pLed->bLedScanBlinkInProgress = _FALSE;
  680. }
  681. else
  682. {
  683. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  684. {
  685. SwLedOff(padapter, pLed);
  686. }
  687. else
  688. {
  689. if( pLed->bLedOn )
  690. pLed->BlinkingLedState = RTW_LED_OFF;
  691. else
  692. pLed->BlinkingLedState = RTW_LED_ON;
  693. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  694. }
  695. }
  696. break;
  697. case LED_BLINK_TXRX:
  698. pLed->BlinkTimes--;
  699. if( pLed->BlinkTimes == 0 )
  700. {
  701. bStopBlinking = _TRUE;
  702. }
  703. if(bStopBlinking)
  704. {
  705. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  706. {
  707. SwLedOff(padapter, pLed);
  708. }
  709. else
  710. {
  711. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  712. pLed->CurrLedState = LED_BLINK_SLOWLY;
  713. if( pLed->bLedOn )
  714. pLed->BlinkingLedState = RTW_LED_OFF;
  715. else
  716. pLed->BlinkingLedState = RTW_LED_ON;
  717. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  718. }
  719. pLed->bLedBlinkInProgress = _FALSE;
  720. }
  721. else
  722. {
  723. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  724. {
  725. SwLedOff(padapter, pLed);
  726. }
  727. else
  728. {
  729. if(IS_HARDWARE_TYPE_8192DU(padapter))
  730. {
  731. pLed->BlinkingLedState = RTW_LED_ON;
  732. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  733. }
  734. else
  735. {
  736. if( pLed->bLedOn )
  737. pLed->BlinkingLedState = RTW_LED_OFF;
  738. else
  739. pLed->BlinkingLedState = RTW_LED_ON;
  740. }
  741. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  742. }
  743. }
  744. break;
  745. case LED_BLINK_WPS:
  746. if( pLed->bLedOn )
  747. {
  748. pLed->BlinkingLedState = RTW_LED_OFF;
  749. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  750. }
  751. else
  752. {
  753. pLed->BlinkingLedState = RTW_LED_ON;
  754. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  755. }
  756. break;
  757. case LED_BLINK_WPS_STOP: //WPS authentication fail
  758. if( pLed->bLedOn )
  759. pLed->BlinkingLedState = RTW_LED_OFF;
  760. else
  761. pLed->BlinkingLedState = RTW_LED_ON;
  762. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  763. break;
  764. case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
  765. pLed->BlinkTimes--;
  766. if(pLed->BlinkTimes == 0)
  767. {
  768. if(pLed->bLedOn)
  769. {
  770. pLed->BlinkTimes = 1;
  771. }
  772. else
  773. {
  774. bStopBlinking = _TRUE;
  775. }
  776. }
  777. if(bStopBlinking)
  778. {
  779. pLed->BlinkTimes = 10;
  780. pLed->BlinkingLedState = RTW_LED_ON;
  781. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  782. }
  783. else
  784. {
  785. if( pLed->bLedOn )
  786. pLed->BlinkingLedState = RTW_LED_OFF;
  787. else
  788. pLed->BlinkingLedState = RTW_LED_ON;
  789. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  790. }
  791. break;
  792. case LED_BLINK_ALWAYS_ON:
  793. pLed->BlinkTimes--;
  794. if( pLed->BlinkTimes == 0 )
  795. {
  796. bStopBlinking = _TRUE;
  797. }
  798. if(bStopBlinking)
  799. {
  800. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  801. {
  802. SwLedOff(padapter, pLed);
  803. }
  804. else
  805. {
  806. if(IS_HARDWARE_TYPE_8192DU(padapter))
  807. {
  808. pLed->BlinkingLedState = RTW_LED_ON;
  809. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  810. }
  811. else
  812. {
  813. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  814. pLed->CurrLedState = LED_BLINK_SLOWLY;
  815. if( pLed->bLedOn )
  816. pLed->BlinkingLedState = RTW_LED_OFF;
  817. else
  818. pLed->BlinkingLedState = RTW_LED_ON;
  819. }
  820. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  821. }
  822. pLed->bLedBlinkInProgress = _FALSE;
  823. }
  824. else
  825. {
  826. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  827. {
  828. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
  829. SwLedOff(padapter, pLed);
  830. }
  831. else
  832. {
  833. if(IS_HARDWARE_TYPE_8192DU(padapter))
  834. {
  835. pLed->BlinkingLedState = RTW_LED_ON;
  836. }
  837. else
  838. {
  839. if( pLed->bLedOn )
  840. pLed->BlinkingLedState = RTW_LED_OFF;
  841. else
  842. pLed->BlinkingLedState = RTW_LED_ON;
  843. }
  844. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  845. }
  846. }
  847. break;
  848. default:
  849. break;
  850. }
  851. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink4 CurrLedState %d\n", pLed->CurrLedState));
  852. }
  853. void
  854. SwLedBlink5(
  855. PLED_USB pLed
  856. )
  857. {
  858. _adapter *padapter = pLed->padapter;
  859. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  860. u8 bStopBlinking = _FALSE;
  861. // Change LED according to BlinkingLedState specified.
  862. if( pLed->BlinkingLedState == RTW_LED_ON )
  863. {
  864. SwLedOn(padapter, pLed);
  865. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  866. }
  867. else
  868. {
  869. SwLedOff(padapter, pLed);
  870. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  871. }
  872. switch(pLed->CurrLedState)
  873. {
  874. case LED_BLINK_SCAN:
  875. pLed->BlinkTimes--;
  876. if( pLed->BlinkTimes == 0 )
  877. {
  878. bStopBlinking = _TRUE;
  879. }
  880. if(bStopBlinking)
  881. {
  882. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  883. {
  884. pLed->CurrLedState = RTW_LED_OFF;
  885. pLed->BlinkingLedState = RTW_LED_OFF;
  886. if(pLed->bLedOn)
  887. SwLedOff(padapter, pLed);
  888. }
  889. else
  890. { pLed->CurrLedState = RTW_LED_ON;
  891. pLed->BlinkingLedState = RTW_LED_ON;
  892. if(!pLed->bLedOn)
  893. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  894. }
  895. pLed->bLedScanBlinkInProgress = _FALSE;
  896. }
  897. else
  898. {
  899. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  900. {
  901. SwLedOff(padapter, pLed);
  902. }
  903. else
  904. {
  905. if( pLed->bLedOn )
  906. pLed->BlinkingLedState = RTW_LED_OFF;
  907. else
  908. pLed->BlinkingLedState = RTW_LED_ON;
  909. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  910. }
  911. }
  912. break;
  913. case LED_BLINK_TXRX:
  914. pLed->BlinkTimes--;
  915. if( pLed->BlinkTimes == 0 )
  916. {
  917. bStopBlinking = _TRUE;
  918. }
  919. if(bStopBlinking)
  920. {
  921. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  922. {
  923. pLed->CurrLedState = RTW_LED_OFF;
  924. pLed->BlinkingLedState = RTW_LED_OFF;
  925. if(pLed->bLedOn)
  926. SwLedOff(padapter, pLed);
  927. }
  928. else
  929. {
  930. pLed->CurrLedState = RTW_LED_ON;
  931. pLed->BlinkingLedState = RTW_LED_ON;
  932. if(!pLed->bLedOn)
  933. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  934. }
  935. pLed->bLedBlinkInProgress = _FALSE;
  936. }
  937. else
  938. {
  939. if( padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  940. {
  941. SwLedOff(padapter, pLed);
  942. }
  943. else
  944. {
  945. if( pLed->bLedOn )
  946. pLed->BlinkingLedState = RTW_LED_OFF;
  947. else
  948. pLed->BlinkingLedState = RTW_LED_ON;
  949. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  950. }
  951. }
  952. break;
  953. default:
  954. break;
  955. }
  956. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
  957. }
  958. void
  959. SwLedBlink6(
  960. PLED_USB pLed
  961. )
  962. {
  963. _adapter *padapter = pLed->padapter;
  964. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  965. u8 bStopBlinking = _FALSE;
  966. // Change LED according to BlinkingLedState specified.
  967. if( pLed->BlinkingLedState == RTW_LED_ON )
  968. {
  969. SwLedOn(padapter, pLed);
  970. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  971. }
  972. else
  973. {
  974. SwLedOff(padapter, pLed);
  975. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  976. }
  977. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink6\n"));
  978. }
  979. void
  980. SwLedBlink7(
  981. PLED_USB pLed
  982. )
  983. {
  984. PADAPTER Adapter = pLed->padapter;
  985. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  986. BOOLEAN bStopBlinking = _FALSE;
  987. // Change LED according to BlinkingLedState specified.
  988. if( pLed->BlinkingLedState == RTW_LED_ON )
  989. {
  990. SwLedOn(Adapter, pLed);
  991. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  992. }
  993. else
  994. {
  995. if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
  996. SwLedOff(Adapter, pLed);
  997. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  998. }
  999. switch(pLed->CurrLedState)
  1000. {
  1001. case LED_BLINK_SCAN:
  1002. pLed->BlinkTimes--;
  1003. if( pLed->BlinkTimes == 0 )
  1004. {
  1005. bStopBlinking = _TRUE;
  1006. }
  1007. if(bStopBlinking)
  1008. {
  1009. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on )
  1010. {
  1011. SwLedOff(Adapter, pLed);
  1012. }
  1013. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  1014. {
  1015. pLed->CurrLedState = RTW_LED_ON;
  1016. pLed->BlinkingLedState = RTW_LED_ON;
  1017. if( !pLed->bLedOn )
  1018. SwLedOn(Adapter, pLed);
  1019. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1020. }
  1021. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  1022. {
  1023. pLed->CurrLedState = RTW_LED_OFF;
  1024. pLed->BlinkingLedState = RTW_LED_OFF;
  1025. if( pLed->bLedOn )
  1026. SwLedOff(Adapter, pLed);
  1027. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1028. }
  1029. pLed->bLedScanBlinkInProgress = _FALSE;
  1030. }
  1031. else
  1032. {
  1033. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on )
  1034. {
  1035. SwLedOff(Adapter, pLed);
  1036. }
  1037. else
  1038. {
  1039. if( pLed->bLedOn )
  1040. pLed->BlinkingLedState = RTW_LED_OFF;
  1041. else
  1042. pLed->BlinkingLedState = RTW_LED_ON;
  1043. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  1044. }
  1045. }
  1046. break;
  1047. case LED_BLINK_WPS:
  1048. if( pLed->bLedOn )
  1049. pLed->BlinkingLedState = RTW_LED_OFF;
  1050. else
  1051. pLed->BlinkingLedState = RTW_LED_ON;
  1052. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  1053. break;
  1054. case LED_BLINK_WPS_STOP: //WPS success
  1055. if(pLed->BlinkingLedState == RTW_LED_ON)
  1056. {
  1057. pLed->BlinkingLedState = RTW_LED_OFF;
  1058. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  1059. bStopBlinking = _FALSE;
  1060. }
  1061. else
  1062. {
  1063. bStopBlinking = _TRUE;
  1064. }
  1065. if(bStopBlinking)
  1066. {
  1067. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on )
  1068. {
  1069. SwLedOff(Adapter, pLed);
  1070. }
  1071. else
  1072. {
  1073. pLed->CurrLedState = RTW_LED_ON;
  1074. pLed->BlinkingLedState = RTW_LED_ON;
  1075. SwLedOn(Adapter, pLed);
  1076. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1077. }
  1078. pLed->bLedWPSBlinkInProgress = _FALSE;
  1079. }
  1080. break;
  1081. default:
  1082. break;
  1083. }
  1084. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink7\n"));
  1085. }
  1086. void
  1087. SwLedBlink8(
  1088. PLED_USB pLed
  1089. )
  1090. {
  1091. PADAPTER Adapter = pLed->padapter;
  1092. // Change LED according to BlinkingLedState specified.
  1093. if( pLed->BlinkingLedState == RTW_LED_ON )
  1094. {
  1095. SwLedOn(Adapter, pLed);
  1096. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn on\n", pLed->BlinkTimes));
  1097. }
  1098. else
  1099. {
  1100. SwLedOff(Adapter, pLed);
  1101. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes blink8(%d): turn off\n", pLed->BlinkTimes));
  1102. }
  1103. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink8\n"));
  1104. }
  1105. //page added for Belkin AC950. 20120813
  1106. void
  1107. SwLedBlink9(
  1108. PLED_USB pLed
  1109. )
  1110. {
  1111. PADAPTER Adapter = pLed->padapter;
  1112. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  1113. BOOLEAN bStopBlinking = _FALSE;
  1114. // Change LED according to BlinkingLedState specified.
  1115. if( pLed->BlinkingLedState == RTW_LED_ON )
  1116. {
  1117. SwLedOn(Adapter, pLed);
  1118. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  1119. }
  1120. else
  1121. {
  1122. SwLedOff(Adapter, pLed);
  1123. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  1124. }
  1125. switch(pLed->CurrLedState)
  1126. {
  1127. case RTW_LED_ON:
  1128. SwLedOn(Adapter, pLed);
  1129. break;
  1130. case RTW_LED_OFF:
  1131. SwLedOff(Adapter, pLed);
  1132. break;
  1133. case LED_BLINK_SLOWLY:
  1134. if( pLed->bLedOn )
  1135. pLed->BlinkingLedState = RTW_LED_OFF;
  1136. else
  1137. pLed->BlinkingLedState = RTW_LED_ON;
  1138. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1139. break;
  1140. case LED_BLINK_StartToBlink:
  1141. if( pLed->bLedOn )
  1142. {
  1143. pLed->BlinkingLedState = RTW_LED_OFF;
  1144. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  1145. }
  1146. else
  1147. {
  1148. pLed->BlinkingLedState = RTW_LED_ON;
  1149. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1150. }
  1151. break;
  1152. case LED_BLINK_SCAN:
  1153. pLed->BlinkTimes--;
  1154. if( pLed->BlinkTimes == 0 )
  1155. {
  1156. bStopBlinking = _TRUE;
  1157. }
  1158. if(bStopBlinking)
  1159. {
  1160. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on )
  1161. {
  1162. SwLedOff(Adapter, pLed);
  1163. }
  1164. else if(check_fwstate(pmlmepriv, _FW_LINKED) == _TRUE)
  1165. {
  1166. pLed->bLedLinkBlinkInProgress = _TRUE;
  1167. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  1168. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  1169. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1170. }
  1171. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _FALSE)
  1172. {
  1173. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  1174. pLed->CurrLedState = LED_BLINK_SLOWLY;
  1175. if( pLed->bLedOn )
  1176. pLed->BlinkingLedState = RTW_LED_OFF;
  1177. else
  1178. pLed->BlinkingLedState = RTW_LED_ON;
  1179. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1180. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1181. }
  1182. pLed->BlinkTimes = 0;
  1183. pLed->bLedBlinkInProgress = _FALSE;
  1184. }
  1185. else
  1186. {
  1187. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1188. {
  1189. SwLedOff(Adapter, pLed);
  1190. }
  1191. else
  1192. {
  1193. if( pLed->bLedOn )
  1194. pLed->BlinkingLedState = RTW_LED_OFF;
  1195. else
  1196. pLed->BlinkingLedState = RTW_LED_ON;
  1197. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  1198. }
  1199. }
  1200. break;
  1201. case LED_BLINK_TXRX:
  1202. pLed->BlinkTimes--;
  1203. if( pLed->BlinkTimes == 0 )
  1204. {
  1205. bStopBlinking = _TRUE;
  1206. }
  1207. if(bStopBlinking)
  1208. {
  1209. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1210. {
  1211. SwLedOff(Adapter, pLed);
  1212. }
  1213. else
  1214. {
  1215. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  1216. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  1217. if( pLed->bLedOn )
  1218. pLed->BlinkingLedState = RTW_LED_OFF;
  1219. else
  1220. pLed->BlinkingLedState = RTW_LED_ON;
  1221. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  1222. }
  1223. pLed->bLedBlinkInProgress = _FALSE;
  1224. }
  1225. else
  1226. {
  1227. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1228. {
  1229. SwLedOff(Adapter, pLed);
  1230. }
  1231. else
  1232. {
  1233. if(IS_HARDWARE_TYPE_8192DU(Adapter))
  1234. {
  1235. pLed->BlinkingLedState = RTW_LED_ON;
  1236. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  1237. }
  1238. else
  1239. {
  1240. if( pLed->bLedOn )
  1241. pLed->BlinkingLedState = RTW_LED_OFF;
  1242. else
  1243. pLed->BlinkingLedState = RTW_LED_ON;
  1244. }
  1245. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  1246. }
  1247. }
  1248. break;
  1249. case LED_BLINK_WPS:
  1250. if( pLed->bLedOn )
  1251. {
  1252. pLed->BlinkingLedState = RTW_LED_OFF;
  1253. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  1254. }
  1255. else
  1256. {
  1257. pLed->BlinkingLedState = RTW_LED_ON;
  1258. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1259. }
  1260. break;
  1261. case LED_BLINK_WPS_STOP: //WPS authentication fail
  1262. if( pLed->bLedOn )
  1263. pLed->BlinkingLedState = RTW_LED_OFF;
  1264. else
  1265. pLed->BlinkingLedState = RTW_LED_ON;
  1266. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1267. break;
  1268. case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
  1269. pLed->BlinkTimes--;
  1270. pLed->BlinkCounter --;
  1271. if(pLed->BlinkCounter == 0)
  1272. {
  1273. pLed->BlinkingLedState = RTW_LED_OFF;
  1274. pLed->CurrLedState = RTW_LED_OFF;
  1275. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1276. }
  1277. else
  1278. {
  1279. if(pLed->BlinkTimes == 0)
  1280. {
  1281. if(pLed->bLedOn)
  1282. {
  1283. pLed->BlinkTimes = 1;
  1284. }
  1285. else
  1286. {
  1287. bStopBlinking = _TRUE;
  1288. }
  1289. }
  1290. if(bStopBlinking)
  1291. {
  1292. pLed->BlinkTimes = 10;
  1293. pLed->BlinkingLedState = RTW_LED_ON;
  1294. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  1295. }
  1296. else
  1297. {
  1298. if( pLed->bLedOn )
  1299. pLed->BlinkingLedState = RTW_LED_OFF;
  1300. else
  1301. pLed->BlinkingLedState = RTW_LED_ON;
  1302. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1303. }
  1304. }
  1305. break;
  1306. case LED_BLINK_ALWAYS_ON:
  1307. pLed->BlinkTimes--;
  1308. if( pLed->BlinkTimes == 0 )
  1309. {
  1310. bStopBlinking = _TRUE;
  1311. }
  1312. if(bStopBlinking)
  1313. {
  1314. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1315. {
  1316. SwLedOff(Adapter, pLed);
  1317. }
  1318. else
  1319. {
  1320. if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
  1321. {
  1322. pLed->BlinkingLedState = RTW_LED_ON;
  1323. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  1324. }
  1325. else
  1326. {
  1327. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  1328. pLed->CurrLedState = LED_BLINK_SLOWLY;
  1329. if( pLed->bLedOn )
  1330. pLed->BlinkingLedState = RTW_LED_OFF;
  1331. else
  1332. pLed->BlinkingLedState = RTW_LED_ON;
  1333. }
  1334. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1335. }
  1336. pLed->bLedBlinkInProgress = _FALSE;
  1337. }
  1338. else
  1339. {
  1340. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1341. {
  1342. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
  1343. SwLedOff(Adapter, pLed);
  1344. }
  1345. else
  1346. {
  1347. if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
  1348. {
  1349. pLed->BlinkingLedState = RTW_LED_ON;
  1350. }
  1351. else
  1352. {
  1353. if( pLed->bLedOn )
  1354. pLed->BlinkingLedState = RTW_LED_OFF;
  1355. else
  1356. pLed->BlinkingLedState = RTW_LED_ON;
  1357. }
  1358. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  1359. }
  1360. }
  1361. break;
  1362. case LED_BLINK_LINK_IN_PROCESS:
  1363. if( pLed->bLedOn )
  1364. {
  1365. pLed->BlinkingLedState = RTW_LED_OFF;
  1366. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
  1367. }
  1368. else
  1369. {
  1370. pLed->BlinkingLedState = RTW_LED_ON;
  1371. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
  1372. }
  1373. break;
  1374. case LED_BLINK_AUTH_ERROR:
  1375. pLed->BlinkTimes--;
  1376. if( pLed->BlinkTimes == 0 )
  1377. {
  1378. bStopBlinking = _TRUE;
  1379. }
  1380. if(bStopBlinking == _FALSE)
  1381. {
  1382. if( pLed->bLedOn )
  1383. {
  1384. pLed->BlinkingLedState = RTW_LED_OFF;
  1385. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1386. }
  1387. else
  1388. {
  1389. pLed->BlinkingLedState = RTW_LED_ON;
  1390. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1391. }
  1392. }
  1393. else
  1394. {
  1395. pLed->CurrLedState = RTW_LED_OFF;
  1396. pLed->BlinkingLedState = RTW_LED_OFF;
  1397. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1398. }
  1399. break;
  1400. default:
  1401. break;
  1402. }
  1403. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink9 CurrLedState %d\n", pLed->CurrLedState));
  1404. }
  1405. //page added for Netgear A6200V2. 20120827
  1406. void
  1407. SwLedBlink10(
  1408. PLED_USB pLed
  1409. )
  1410. {
  1411. PADAPTER Adapter = pLed->padapter;
  1412. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  1413. BOOLEAN bStopBlinking = _FALSE;
  1414. // Change LED according to BlinkingLedState specified.
  1415. if( pLed->BlinkingLedState == RTW_LED_ON )
  1416. {
  1417. SwLedOn(Adapter, pLed);
  1418. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  1419. }
  1420. else
  1421. {
  1422. SwLedOff(Adapter, pLed);
  1423. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  1424. }
  1425. switch(pLed->CurrLedState)
  1426. {
  1427. case RTW_LED_ON:
  1428. SwLedOn(Adapter, pLed);
  1429. break;
  1430. case RTW_LED_OFF:
  1431. SwLedOff(Adapter, pLed);
  1432. break;
  1433. case LED_BLINK_SLOWLY:
  1434. if( pLed->bLedOn )
  1435. pLed->BlinkingLedState = RTW_LED_OFF;
  1436. else
  1437. pLed->BlinkingLedState = RTW_LED_ON;
  1438. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1439. break;
  1440. case LED_BLINK_StartToBlink:
  1441. if( pLed->bLedOn )
  1442. {
  1443. pLed->BlinkingLedState = RTW_LED_OFF;
  1444. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  1445. }
  1446. else
  1447. {
  1448. pLed->BlinkingLedState = RTW_LED_ON;
  1449. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1450. }
  1451. break;
  1452. case LED_BLINK_SCAN:
  1453. pLed->BlinkTimes--;
  1454. if( pLed->BlinkTimes == 0 )
  1455. {
  1456. bStopBlinking = _TRUE;
  1457. }
  1458. if(bStopBlinking)
  1459. {
  1460. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on )
  1461. {
  1462. SwLedOff(Adapter, pLed);
  1463. }
  1464. else if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  1465. {
  1466. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  1467. pLed->CurrLedState = RTW_LED_OFF;
  1468. pLed->BlinkingLedState = RTW_LED_OFF;
  1469. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1470. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  1471. }
  1472. pLed->BlinkTimes = 0;
  1473. pLed->bLedBlinkInProgress = _FALSE;
  1474. }
  1475. else
  1476. {
  1477. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1478. {
  1479. SwLedOff(Adapter, pLed);
  1480. }
  1481. else
  1482. {
  1483. if( pLed->bLedOn )
  1484. {
  1485. pLed->BlinkingLedState = RTW_LED_OFF;
  1486. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  1487. }
  1488. else
  1489. {
  1490. pLed->BlinkingLedState = RTW_LED_ON;
  1491. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR+LED_BLINK_LINK_INTERVAL_NETGEAR);
  1492. }
  1493. }
  1494. }
  1495. break;
  1496. case LED_BLINK_WPS:
  1497. if( pLed->bLedOn )
  1498. {
  1499. pLed->BlinkingLedState = RTW_LED_OFF;
  1500. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  1501. }
  1502. else
  1503. {
  1504. pLed->BlinkingLedState = RTW_LED_ON;
  1505. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
  1506. }
  1507. break;
  1508. case LED_BLINK_WPS_STOP: //WPS authentication fail
  1509. if( pLed->bLedOn )
  1510. pLed->BlinkingLedState = RTW_LED_OFF;
  1511. else
  1512. pLed->BlinkingLedState = RTW_LED_ON;
  1513. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1514. break;
  1515. case LED_BLINK_WPS_STOP_OVERLAP: //WPS session overlap
  1516. pLed->BlinkTimes--;
  1517. pLed->BlinkCounter --;
  1518. if(pLed->BlinkCounter == 0)
  1519. {
  1520. pLed->BlinkingLedState = RTW_LED_OFF;
  1521. pLed->CurrLedState = RTW_LED_OFF;
  1522. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1523. }
  1524. else
  1525. {
  1526. if(pLed->BlinkTimes == 0)
  1527. {
  1528. if(pLed->bLedOn)
  1529. {
  1530. pLed->BlinkTimes = 1;
  1531. }
  1532. else
  1533. {
  1534. bStopBlinking = _TRUE;
  1535. }
  1536. }
  1537. if(bStopBlinking)
  1538. {
  1539. pLed->BlinkTimes = 10;
  1540. pLed->BlinkingLedState = RTW_LED_ON;
  1541. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  1542. }
  1543. else
  1544. {
  1545. if( pLed->bLedOn )
  1546. pLed->BlinkingLedState = RTW_LED_OFF;
  1547. else
  1548. pLed->BlinkingLedState = RTW_LED_ON;
  1549. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1550. }
  1551. }
  1552. break;
  1553. case LED_BLINK_ALWAYS_ON:
  1554. pLed->BlinkTimes--;
  1555. if( pLed->BlinkTimes == 0 )
  1556. {
  1557. bStopBlinking = _TRUE;
  1558. }
  1559. if(bStopBlinking)
  1560. {
  1561. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1562. {
  1563. SwLedOff(Adapter, pLed);
  1564. }
  1565. else
  1566. {
  1567. if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
  1568. {
  1569. pLed->BlinkingLedState = RTW_LED_ON;
  1570. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  1571. }
  1572. else
  1573. {
  1574. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  1575. pLed->CurrLedState = LED_BLINK_SLOWLY;
  1576. if( pLed->bLedOn )
  1577. pLed->BlinkingLedState = RTW_LED_OFF;
  1578. else
  1579. pLed->BlinkingLedState = RTW_LED_ON;
  1580. }
  1581. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1582. }
  1583. pLed->bLedBlinkInProgress = _FALSE;
  1584. }
  1585. else
  1586. {
  1587. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1588. {
  1589. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("RFOff Status \n"));
  1590. SwLedOff(Adapter, pLed);
  1591. }
  1592. else
  1593. {
  1594. if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8723AU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
  1595. {
  1596. pLed->BlinkingLedState = RTW_LED_ON;
  1597. }
  1598. else
  1599. {
  1600. if( pLed->bLedOn )
  1601. pLed->BlinkingLedState = RTW_LED_OFF;
  1602. else
  1603. pLed->BlinkingLedState = RTW_LED_ON;
  1604. }
  1605. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  1606. }
  1607. }
  1608. break;
  1609. case LED_BLINK_LINK_IN_PROCESS:
  1610. if( pLed->bLedOn )
  1611. {
  1612. pLed->BlinkingLedState = RTW_LED_OFF;
  1613. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ON_BELKIN);
  1614. }
  1615. else
  1616. {
  1617. pLed->BlinkingLedState = RTW_LED_ON;
  1618. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_OFF_BELKIN);
  1619. }
  1620. break;
  1621. case LED_BLINK_AUTH_ERROR:
  1622. pLed->BlinkTimes--;
  1623. if( pLed->BlinkTimes == 0 )
  1624. {
  1625. bStopBlinking = _TRUE;
  1626. }
  1627. if(bStopBlinking == _FALSE)
  1628. {
  1629. if( pLed->bLedOn )
  1630. {
  1631. pLed->BlinkingLedState = RTW_LED_OFF;
  1632. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1633. }
  1634. else
  1635. {
  1636. pLed->BlinkingLedState = RTW_LED_ON;
  1637. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1638. }
  1639. }
  1640. else
  1641. {
  1642. pLed->CurrLedState = RTW_LED_OFF;
  1643. pLed->BlinkingLedState = RTW_LED_OFF;
  1644. _set_timer(&(pLed->BlinkTimer), LED_BLINK_ERROR_INTERVAL_BELKIN);
  1645. }
  1646. break;
  1647. default:
  1648. break;
  1649. }
  1650. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink10 CurrLedState %d\n", pLed->CurrLedState));
  1651. }
  1652. void
  1653. SwLedBlink11(
  1654. PLED_USB pLed
  1655. )
  1656. {
  1657. PADAPTER Adapter = pLed->padapter;
  1658. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  1659. BOOLEAN bStopBlinking = _FALSE;
  1660. // Change LED according to BlinkingLedState specified.
  1661. if( pLed->BlinkingLedState == RTW_LED_ON )
  1662. {
  1663. SwLedOn(Adapter, pLed);
  1664. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  1665. }
  1666. else
  1667. {
  1668. SwLedOff(Adapter, pLed);
  1669. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  1670. }
  1671. switch(pLed->CurrLedState)
  1672. {
  1673. case LED_BLINK_TXRX:
  1674. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1675. {
  1676. SwLedOff(Adapter, pLed);
  1677. }
  1678. else
  1679. {
  1680. if( pLed->bLedOn )
  1681. pLed->BlinkingLedState = RTW_LED_OFF;
  1682. else
  1683. pLed->BlinkingLedState = RTW_LED_ON;
  1684. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  1685. }
  1686. break;
  1687. case LED_BLINK_WPS:
  1688. if(pLed->BlinkTimes == 5)
  1689. {
  1690. SwLedOn(Adapter, pLed);
  1691. _set_timer(&(pLed->BlinkTimer), LED_CM11_LINK_ON_INTERVEL);
  1692. }
  1693. else
  1694. {
  1695. if( pLed->bLedOn )
  1696. {
  1697. pLed->BlinkingLedState = RTW_LED_OFF;
  1698. _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
  1699. }
  1700. else
  1701. {
  1702. pLed->BlinkingLedState = RTW_LED_ON;
  1703. _set_timer(&(pLed->BlinkTimer), LED_CM11_BLINK_INTERVAL);
  1704. }
  1705. }
  1706. pLed->BlinkTimes--;
  1707. if( pLed->BlinkTimes == 0 )
  1708. {
  1709. bStopBlinking = _TRUE;
  1710. }
  1711. if(bStopBlinking == _TRUE)
  1712. pLed->BlinkTimes = 5;
  1713. break;
  1714. case LED_BLINK_WPS_STOP: //WPS authentication fail
  1715. if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  1716. {
  1717. if( pLed->bLedOn )
  1718. pLed->BlinkingLedState = RTW_LED_OFF;
  1719. else
  1720. pLed->BlinkingLedState = RTW_LED_ON;
  1721. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  1722. }
  1723. else
  1724. {
  1725. pLed->CurrLedState = RTW_LED_ON;
  1726. pLed->BlinkingLedState = RTW_LED_ON;
  1727. SwLedOn(Adapter, pLed);
  1728. _set_timer(&(pLed->BlinkTimer), 0);
  1729. }
  1730. break;
  1731. default:
  1732. break;
  1733. }
  1734. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink5 CurrLedState %d\n", pLed->CurrLedState));
  1735. }
  1736. void
  1737. SwLedBlink12(
  1738. PLED_USB pLed
  1739. )
  1740. {
  1741. PADAPTER Adapter = pLed->padapter;
  1742. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  1743. BOOLEAN bStopBlinking = _FALSE;
  1744. // Change LED according to BlinkingLedState specified.
  1745. if( pLed->BlinkingLedState == RTW_LED_ON )
  1746. {
  1747. SwLedOn(Adapter, pLed);
  1748. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn on\n", pLed->BlinkTimes));
  1749. }
  1750. else
  1751. {
  1752. SwLedOff(Adapter, pLed);
  1753. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%ld): turn off\n", pLed->BlinkTimes));
  1754. }
  1755. switch(pLed->CurrLedState)
  1756. {
  1757. case LED_BLINK_SLOWLY:
  1758. if( pLed->bLedOn )
  1759. pLed->BlinkingLedState = RTW_LED_OFF;
  1760. else
  1761. pLed->BlinkingLedState = RTW_LED_ON;
  1762. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1763. break;
  1764. case LED_BLINK_TXRX:
  1765. pLed->BlinkTimes--;
  1766. if( pLed->BlinkTimes == 0 )
  1767. {
  1768. bStopBlinking = _TRUE;
  1769. }
  1770. if(bStopBlinking)
  1771. {
  1772. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1773. {
  1774. pLed->CurrLedState = RTW_LED_OFF;
  1775. pLed->BlinkingLedState = RTW_LED_OFF;
  1776. if(pLed->bLedOn)
  1777. SwLedOff(Adapter, pLed);
  1778. }
  1779. else
  1780. {
  1781. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  1782. pLed->CurrLedState = LED_BLINK_SLOWLY;
  1783. if( pLed->bLedOn )
  1784. pLed->BlinkingLedState = RTW_LED_OFF;
  1785. else
  1786. pLed->BlinkingLedState = RTW_LED_ON;
  1787. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  1788. }
  1789. pLed->bLedBlinkInProgress = _FALSE;
  1790. }
  1791. else
  1792. {
  1793. if( Adapter->pwrctrlpriv.rf_pwrstate != rf_on && Adapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS)
  1794. {
  1795. SwLedOff(Adapter, pLed);
  1796. }
  1797. else
  1798. {
  1799. if( pLed->bLedOn )
  1800. pLed->BlinkingLedState = RTW_LED_OFF;
  1801. else
  1802. pLed->BlinkingLedState = RTW_LED_ON;
  1803. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  1804. }
  1805. }
  1806. break;
  1807. default:
  1808. break;
  1809. }
  1810. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SwLedBlink8 CurrLedState %d\n", pLed->CurrLedState));
  1811. }
  1812. VOID
  1813. SwLedBlink13(
  1814. IN PLED_USB pLed
  1815. )
  1816. {
  1817. PADAPTER Adapter = pLed->padapter;
  1818. struct mlme_priv *pmlmepriv = &(Adapter->mlmepriv);
  1819. BOOLEAN bStopBlinking = _FALSE;
  1820. static u8 LinkBlinkCnt=0;
  1821. // Change LED according to BlinkingLedState specified.
  1822. if( pLed->BlinkingLedState == RTW_LED_ON )
  1823. {
  1824. SwLedOn(Adapter, pLed);
  1825. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn on\n", pLed->BlinkTimes));
  1826. }
  1827. else
  1828. {
  1829. if(pLed->CurrLedState != LED_BLINK_WPS_STOP)
  1830. SwLedOff(Adapter, pLed);
  1831. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Blinktimes (%d): turn off\n", pLed->BlinkTimes));
  1832. }
  1833. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("!!! SwLedBlink13 CurrLedState %d, bLedWPSBlinkInProgress %d, bLedBlinkInProgress %d\n", pLed->CurrLedState,pLed->bLedWPSBlinkInProgress,pLed->bLedBlinkInProgress));
  1834. switch(pLed->CurrLedState)
  1835. {
  1836. case LED_BLINK_LINK_IN_PROCESS:
  1837. if(!pLed->bLedWPSBlinkInProgress)
  1838. LinkBlinkCnt++;
  1839. if(LinkBlinkCnt>15)
  1840. {
  1841. LinkBlinkCnt=0;
  1842. pLed->bLedBlinkInProgress = _FALSE;
  1843. break;
  1844. }
  1845. if( pLed->bLedOn )
  1846. {
  1847. pLed->BlinkingLedState = RTW_LED_OFF;
  1848. _set_timer(&(pLed->BlinkTimer), 500);
  1849. }
  1850. else
  1851. {
  1852. pLed->BlinkingLedState = RTW_LED_ON;
  1853. _set_timer(&(pLed->BlinkTimer), 500);
  1854. }
  1855. break;
  1856. case LED_BLINK_WPS:
  1857. if( pLed->bLedOn )
  1858. {
  1859. pLed->BlinkingLedState = RTW_LED_OFF;
  1860. _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
  1861. }
  1862. else
  1863. {
  1864. pLed->BlinkingLedState = RTW_LED_ON;
  1865. _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
  1866. }
  1867. break;
  1868. case LED_BLINK_WPS_STOP: //WPS success
  1869. SwLedOff(Adapter, pLed);
  1870. pLed->bLedWPSBlinkInProgress = _FALSE;
  1871. break;
  1872. default:
  1873. LinkBlinkCnt=0;
  1874. break;
  1875. }
  1876. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("<==== blink13\n"));
  1877. }
  1878. //
  1879. // Description:
  1880. // Handler function of LED Blinking.
  1881. // We dispatch acture LED blink action according to LedStrategy.
  1882. //
  1883. void BlinkHandler(PLED_USB pLed)
  1884. {
  1885. _adapter *padapter = pLed->padapter;
  1886. struct led_priv *ledpriv = &(padapter->ledpriv);
  1887. //DBG_871X("%s (%s:%d)\n",__FUNCTION__, current->comm, current->pid);
  1888. if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE))
  1889. {
  1890. //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
  1891. return;
  1892. }
  1893. switch(ledpriv->LedStrategy)
  1894. {
  1895. case SW_LED_MODE0:
  1896. SwLedBlink(pLed);
  1897. break;
  1898. case SW_LED_MODE1:
  1899. SwLedBlink1(pLed);
  1900. break;
  1901. case SW_LED_MODE2:
  1902. SwLedBlink2(pLed);
  1903. break;
  1904. case SW_LED_MODE3:
  1905. SwLedBlink3(pLed);
  1906. break;
  1907. case SW_LED_MODE4:
  1908. SwLedBlink4(pLed);
  1909. break;
  1910. case SW_LED_MODE5:
  1911. SwLedBlink5(pLed);
  1912. break;
  1913. case SW_LED_MODE6:
  1914. SwLedBlink6(pLed);
  1915. break;
  1916. case SW_LED_MODE7:
  1917. SwLedBlink7(pLed);
  1918. break;
  1919. case SW_LED_MODE8:
  1920. SwLedBlink8(pLed);
  1921. break;
  1922. case SW_LED_MODE9:
  1923. SwLedBlink9(pLed);
  1924. break;
  1925. case SW_LED_MODE10:
  1926. SwLedBlink10(pLed);
  1927. break;
  1928. case SW_LED_MODE11:
  1929. SwLedBlink11(pLed);
  1930. break;
  1931. case SW_LED_MODE12:
  1932. SwLedBlink12(pLed);
  1933. default:
  1934. //RT_TRACE(COMP_LED, DBG_LOUD, ("BlinkWorkItemCallback 0x%x \n", pHalData->LedStrategy));
  1935. //SwLedBlink(pLed);
  1936. break;
  1937. }
  1938. }
  1939. //
  1940. // Description:
  1941. // Callback function of LED BlinkTimer,
  1942. // it just schedules to corresponding BlinkWorkItem/led_blink_hdl
  1943. //
  1944. void BlinkTimerCallback(void *data)
  1945. {
  1946. PLED_USB pLed = (PLED_USB)data;
  1947. _adapter *padapter = pLed->padapter;
  1948. //DBG_871X("%s\n", __FUNCTION__);
  1949. if( (padapter->bSurpriseRemoved == _TRUE) || ( padapter->bDriverStopped == _TRUE))
  1950. {
  1951. //DBG_871X("%s bSurpriseRemoved:%d, bDriverStopped:%d\n", __FUNCTION__, padapter->bSurpriseRemoved, padapter->bDriverStopped);
  1952. return;
  1953. }
  1954. #ifdef CONFIG_LED_HANDLED_BY_CMD_THREAD
  1955. rtw_led_blink_cmd(padapter, (PVOID)pLed);
  1956. #else
  1957. _set_workitem(&(pLed->BlinkWorkItem));
  1958. #endif
  1959. }
  1960. //
  1961. // Description:
  1962. // Callback function of LED BlinkWorkItem.
  1963. // We dispatch acture LED blink action according to LedStrategy.
  1964. //
  1965. void BlinkWorkItemCallback(_workitem *work)
  1966. {
  1967. PLED_USB pLed = container_of(work, LED_USB, BlinkWorkItem);
  1968. BlinkHandler(pLed);
  1969. }
  1970. static void
  1971. SwLedControlMode0(
  1972. _adapter *padapter,
  1973. LED_CTL_MODE LedAction
  1974. )
  1975. {
  1976. struct led_priv *ledpriv = &(padapter->ledpriv);
  1977. PLED_USB pLed = &(ledpriv->SwLed1);
  1978. // Decide led state
  1979. switch(LedAction)
  1980. {
  1981. case LED_CTL_TX:
  1982. case LED_CTL_RX:
  1983. if( pLed->bLedBlinkInProgress == _FALSE )
  1984. {
  1985. pLed->bLedBlinkInProgress = _TRUE;
  1986. pLed->CurrLedState = LED_BLINK_NORMAL;
  1987. pLed->BlinkTimes = 2;
  1988. if( pLed->bLedOn )
  1989. pLed->BlinkingLedState = RTW_LED_OFF;
  1990. else
  1991. pLed->BlinkingLedState = RTW_LED_ON;
  1992. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  1993. }
  1994. break;
  1995. case LED_CTL_START_TO_LINK:
  1996. if( pLed->bLedBlinkInProgress == _FALSE )
  1997. {
  1998. pLed->bLedBlinkInProgress = _TRUE;
  1999. pLed->CurrLedState = LED_BLINK_StartToBlink;
  2000. pLed->BlinkTimes = 24;
  2001. if( pLed->bLedOn )
  2002. pLed->BlinkingLedState = RTW_LED_OFF;
  2003. else
  2004. pLed->BlinkingLedState = RTW_LED_ON;
  2005. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  2006. }
  2007. else
  2008. {
  2009. pLed->CurrLedState = LED_BLINK_StartToBlink;
  2010. }
  2011. break;
  2012. case LED_CTL_LINK:
  2013. pLed->CurrLedState = RTW_LED_ON;
  2014. if( pLed->bLedBlinkInProgress == _FALSE )
  2015. {
  2016. pLed->BlinkingLedState = RTW_LED_ON;
  2017. _set_timer(&(pLed->BlinkTimer), 0);
  2018. }
  2019. break;
  2020. case LED_CTL_NO_LINK:
  2021. pLed->CurrLedState = RTW_LED_OFF;
  2022. if( pLed->bLedBlinkInProgress == _FALSE )
  2023. {
  2024. pLed->BlinkingLedState = RTW_LED_OFF;
  2025. _set_timer(&(pLed->BlinkTimer), 0);
  2026. }
  2027. break;
  2028. case LED_CTL_POWER_OFF:
  2029. pLed->CurrLedState = RTW_LED_OFF;
  2030. if(pLed->bLedBlinkInProgress)
  2031. {
  2032. _cancel_timer_ex(&(pLed->BlinkTimer));
  2033. pLed->bLedBlinkInProgress = _FALSE;
  2034. }
  2035. SwLedOff(padapter, pLed);
  2036. break;
  2037. case LED_CTL_START_WPS:
  2038. if( pLed->bLedBlinkInProgress == _FALSE || pLed->CurrLedState == RTW_LED_ON)
  2039. {
  2040. pLed->bLedBlinkInProgress = _TRUE;
  2041. pLed->CurrLedState = LED_BLINK_WPS;
  2042. pLed->BlinkTimes = 20;
  2043. if( pLed->bLedOn )
  2044. {
  2045. pLed->BlinkingLedState = RTW_LED_OFF;
  2046. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
  2047. }
  2048. else
  2049. {
  2050. pLed->BlinkingLedState = RTW_LED_ON;
  2051. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LONG_INTERVAL);
  2052. }
  2053. }
  2054. break;
  2055. case LED_CTL_STOP_WPS:
  2056. if(pLed->bLedBlinkInProgress)
  2057. {
  2058. pLed->CurrLedState = RTW_LED_OFF;
  2059. _cancel_timer_ex(&(pLed->BlinkTimer));
  2060. pLed->bLedBlinkInProgress = _FALSE;
  2061. }
  2062. break;
  2063. default:
  2064. break;
  2065. }
  2066. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
  2067. }
  2068. //ALPHA, added by chiyoko, 20090106
  2069. static void
  2070. SwLedControlMode1(
  2071. _adapter *padapter,
  2072. LED_CTL_MODE LedAction
  2073. )
  2074. {
  2075. struct led_priv *ledpriv = &(padapter->ledpriv);
  2076. PLED_USB pLed = &(ledpriv->SwLed0);
  2077. struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
  2078. EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
  2079. u32 uLedBlinkNoLinkInterval = LED_BLINK_NO_LINK_INTERVAL_ALPHA; //add by ylb 20121012 for customer led for alpha
  2080. if(pEEPROM->CustomerID == RT_CID_819x_ALPHA_Dlink)
  2081. uLedBlinkNoLinkInterval= LED_BLINK_NO_LINK_INTERVAL_ALPHA_500MS;
  2082. if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
  2083. pLed = &(ledpriv->SwLed1);
  2084. switch(LedAction)
  2085. {
  2086. case LED_CTL_POWER_ON:
  2087. case LED_CTL_START_TO_LINK:
  2088. case LED_CTL_NO_LINK:
  2089. if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
  2090. {
  2091. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2092. {
  2093. return;
  2094. }
  2095. if( pLed->bLedLinkBlinkInProgress == _TRUE )
  2096. {
  2097. _cancel_timer_ex(&(pLed->BlinkTimer));
  2098. pLed->bLedLinkBlinkInProgress = _FALSE;
  2099. }
  2100. if(pLed->bLedBlinkInProgress ==_TRUE)
  2101. {
  2102. _cancel_timer_ex(&(pLed->BlinkTimer));
  2103. pLed->bLedBlinkInProgress = _FALSE;
  2104. }
  2105. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2106. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2107. if( pLed->bLedOn )
  2108. pLed->BlinkingLedState = RTW_LED_OFF;
  2109. else
  2110. pLed->BlinkingLedState = RTW_LED_ON;
  2111. _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
  2112. }
  2113. break;
  2114. case LED_CTL_LINK:
  2115. if( pLed->bLedLinkBlinkInProgress == _FALSE )
  2116. {
  2117. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2118. {
  2119. return;
  2120. }
  2121. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2122. {
  2123. _cancel_timer_ex(&(pLed->BlinkTimer));
  2124. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2125. }
  2126. if(pLed->bLedBlinkInProgress ==_TRUE)
  2127. {
  2128. _cancel_timer_ex(&(pLed->BlinkTimer));
  2129. pLed->bLedBlinkInProgress = _FALSE;
  2130. }
  2131. pLed->bLedLinkBlinkInProgress = _TRUE;
  2132. pLed->CurrLedState = LED_BLINK_NORMAL;
  2133. if( pLed->bLedOn )
  2134. pLed->BlinkingLedState = RTW_LED_OFF;
  2135. else
  2136. pLed->BlinkingLedState = RTW_LED_ON;
  2137. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_ALPHA);
  2138. }
  2139. break;
  2140. case LED_CTL_SITE_SURVEY:
  2141. if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  2142. ;
  2143. else if(pLed->bLedScanBlinkInProgress ==_FALSE)
  2144. {
  2145. if(IS_LED_WPS_BLINKING(pLed))
  2146. return;
  2147. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2148. {
  2149. _cancel_timer_ex(&(pLed->BlinkTimer));
  2150. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2151. }
  2152. if( pLed->bLedLinkBlinkInProgress == _TRUE )
  2153. {
  2154. _cancel_timer_ex(&(pLed->BlinkTimer));
  2155. pLed->bLedLinkBlinkInProgress = _FALSE;
  2156. }
  2157. if(pLed->bLedBlinkInProgress ==_TRUE)
  2158. {
  2159. _cancel_timer_ex(&(pLed->BlinkTimer));
  2160. pLed->bLedBlinkInProgress = _FALSE;
  2161. }
  2162. pLed->bLedScanBlinkInProgress = _TRUE;
  2163. pLed->CurrLedState = LED_BLINK_SCAN;
  2164. pLed->BlinkTimes = 24;
  2165. if( pLed->bLedOn )
  2166. pLed->BlinkingLedState = RTW_LED_OFF;
  2167. else
  2168. pLed->BlinkingLedState = RTW_LED_ON;
  2169. if (padapter->pwrctrlpriv.rf_pwrstate != rf_on && padapter->pwrctrlpriv.rfoff_reason == RF_CHANGE_BY_IPS)
  2170. _set_timer(&(pLed->BlinkTimer), LED_INITIAL_INTERVAL);
  2171. else
  2172. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2173. }
  2174. break;
  2175. case LED_CTL_TX:
  2176. case LED_CTL_RX:
  2177. if(pLed->bLedBlinkInProgress ==_FALSE)
  2178. {
  2179. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2180. {
  2181. return;
  2182. }
  2183. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2184. {
  2185. _cancel_timer_ex(&(pLed->BlinkTimer));
  2186. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2187. }
  2188. if( pLed->bLedLinkBlinkInProgress == _TRUE )
  2189. {
  2190. _cancel_timer_ex(&(pLed->BlinkTimer));
  2191. pLed->bLedLinkBlinkInProgress = _FALSE;
  2192. }
  2193. pLed->bLedBlinkInProgress = _TRUE;
  2194. pLed->CurrLedState = LED_BLINK_TXRX;
  2195. pLed->BlinkTimes = 2;
  2196. if( pLed->bLedOn )
  2197. pLed->BlinkingLedState = RTW_LED_OFF;
  2198. else
  2199. pLed->BlinkingLedState = RTW_LED_ON;
  2200. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  2201. }
  2202. break;
  2203. case LED_CTL_START_WPS: //wait until xinpin finish
  2204. case LED_CTL_START_WPS_BOTTON:
  2205. if(pLed->bLedWPSBlinkInProgress ==_FALSE)
  2206. {
  2207. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2208. {
  2209. _cancel_timer_ex(&(pLed->BlinkTimer));
  2210. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2211. }
  2212. if( pLed->bLedLinkBlinkInProgress == _TRUE )
  2213. {
  2214. _cancel_timer_ex(&(pLed->BlinkTimer));
  2215. pLed->bLedLinkBlinkInProgress = _FALSE;
  2216. }
  2217. if(pLed->bLedBlinkInProgress ==_TRUE)
  2218. {
  2219. _cancel_timer_ex(&(pLed->BlinkTimer));
  2220. pLed->bLedBlinkInProgress = _FALSE;
  2221. }
  2222. if(pLed->bLedScanBlinkInProgress ==_TRUE)
  2223. {
  2224. _cancel_timer_ex(&(pLed->BlinkTimer));
  2225. pLed->bLedScanBlinkInProgress = _FALSE;
  2226. }
  2227. pLed->bLedWPSBlinkInProgress = _TRUE;
  2228. pLed->CurrLedState = LED_BLINK_WPS;
  2229. if( pLed->bLedOn )
  2230. pLed->BlinkingLedState = RTW_LED_OFF;
  2231. else
  2232. pLed->BlinkingLedState = RTW_LED_ON;
  2233. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2234. }
  2235. break;
  2236. case LED_CTL_STOP_WPS:
  2237. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2238. {
  2239. _cancel_timer_ex(&(pLed->BlinkTimer));
  2240. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2241. }
  2242. if( pLed->bLedLinkBlinkInProgress == _TRUE )
  2243. {
  2244. _cancel_timer_ex(&(pLed->BlinkTimer));
  2245. pLed->bLedLinkBlinkInProgress = _FALSE;
  2246. }
  2247. if(pLed->bLedBlinkInProgress ==_TRUE)
  2248. {
  2249. _cancel_timer_ex(&(pLed->BlinkTimer));
  2250. pLed->bLedBlinkInProgress = _FALSE;
  2251. }
  2252. if(pLed->bLedScanBlinkInProgress ==_TRUE)
  2253. {
  2254. _cancel_timer_ex(&(pLed->BlinkTimer));
  2255. pLed->bLedScanBlinkInProgress = _FALSE;
  2256. }
  2257. if(pLed->bLedWPSBlinkInProgress)
  2258. {
  2259. _cancel_timer_ex(&(pLed->BlinkTimer));
  2260. }
  2261. else
  2262. {
  2263. pLed->bLedWPSBlinkInProgress = _TRUE;
  2264. }
  2265. pLed->CurrLedState = LED_BLINK_WPS_STOP;
  2266. if(pLed->bLedOn)
  2267. {
  2268. pLed->BlinkingLedState = RTW_LED_OFF;
  2269. _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
  2270. }
  2271. else
  2272. {
  2273. pLed->BlinkingLedState = RTW_LED_ON;
  2274. _set_timer(&(pLed->BlinkTimer), 0);
  2275. }
  2276. break;
  2277. case LED_CTL_STOP_WPS_FAIL:
  2278. if(pLed->bLedWPSBlinkInProgress)
  2279. {
  2280. _cancel_timer_ex(&(pLed->BlinkTimer));
  2281. pLed->bLedWPSBlinkInProgress = _FALSE;
  2282. }
  2283. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2284. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2285. if( pLed->bLedOn )
  2286. pLed->BlinkingLedState = RTW_LED_OFF;
  2287. else
  2288. pLed->BlinkingLedState = RTW_LED_ON;
  2289. _set_timer(&(pLed->BlinkTimer), uLedBlinkNoLinkInterval);//change by ylb 20121012 for customer led for alpha
  2290. break;
  2291. case LED_CTL_POWER_OFF:
  2292. pLed->CurrLedState = RTW_LED_OFF;
  2293. pLed->BlinkingLedState = RTW_LED_OFF;
  2294. if( pLed->bLedNoLinkBlinkInProgress)
  2295. {
  2296. _cancel_timer_ex(&(pLed->BlinkTimer));
  2297. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2298. }
  2299. if( pLed->bLedLinkBlinkInProgress)
  2300. {
  2301. _cancel_timer_ex(&(pLed->BlinkTimer));
  2302. pLed->bLedLinkBlinkInProgress = _FALSE;
  2303. }
  2304. if( pLed->bLedBlinkInProgress)
  2305. {
  2306. _cancel_timer_ex(&(pLed->BlinkTimer));
  2307. pLed->bLedBlinkInProgress = _FALSE;
  2308. }
  2309. if( pLed->bLedWPSBlinkInProgress )
  2310. {
  2311. _cancel_timer_ex(&(pLed->BlinkTimer));
  2312. pLed->bLedWPSBlinkInProgress = _FALSE;
  2313. }
  2314. if( pLed->bLedScanBlinkInProgress)
  2315. {
  2316. _cancel_timer_ex(&(pLed->BlinkTimer));
  2317. pLed->bLedScanBlinkInProgress = _FALSE;
  2318. }
  2319. SwLedOff(padapter, pLed);
  2320. break;
  2321. default:
  2322. break;
  2323. }
  2324. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
  2325. }
  2326. //Arcadyan/Sitecom , added by chiyoko, 20090216
  2327. static void
  2328. SwLedControlMode2(
  2329. _adapter *padapter,
  2330. LED_CTL_MODE LedAction
  2331. )
  2332. {
  2333. struct led_priv *ledpriv = &(padapter->ledpriv);
  2334. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  2335. PLED_USB pLed = &(ledpriv->SwLed0);
  2336. switch(LedAction)
  2337. {
  2338. case LED_CTL_SITE_SURVEY:
  2339. if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
  2340. ;
  2341. else if(pLed->bLedScanBlinkInProgress ==_FALSE)
  2342. {
  2343. if(IS_LED_WPS_BLINKING(pLed))
  2344. return;
  2345. if(pLed->bLedBlinkInProgress ==_TRUE)
  2346. {
  2347. _cancel_timer_ex(&(pLed->BlinkTimer));
  2348. pLed->bLedBlinkInProgress = _FALSE;
  2349. }
  2350. pLed->bLedScanBlinkInProgress = _TRUE;
  2351. pLed->CurrLedState = LED_BLINK_SCAN;
  2352. pLed->BlinkTimes = 24;
  2353. if( pLed->bLedOn )
  2354. pLed->BlinkingLedState = RTW_LED_OFF;
  2355. else
  2356. pLed->BlinkingLedState = RTW_LED_ON;
  2357. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2358. }
  2359. break;
  2360. case LED_CTL_TX:
  2361. case LED_CTL_RX:
  2362. if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  2363. {
  2364. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2365. {
  2366. return;
  2367. }
  2368. pLed->bLedBlinkInProgress = _TRUE;
  2369. pLed->CurrLedState = LED_BLINK_TXRX;
  2370. pLed->BlinkTimes = 2;
  2371. if( pLed->bLedOn )
  2372. pLed->BlinkingLedState = RTW_LED_OFF;
  2373. else
  2374. pLed->BlinkingLedState = RTW_LED_ON;
  2375. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  2376. }
  2377. break;
  2378. case LED_CTL_LINK:
  2379. pLed->CurrLedState = RTW_LED_ON;
  2380. pLed->BlinkingLedState = RTW_LED_ON;
  2381. if( pLed->bLedBlinkInProgress)
  2382. {
  2383. _cancel_timer_ex(&(pLed->BlinkTimer));
  2384. pLed->bLedBlinkInProgress = _FALSE;
  2385. }
  2386. if( pLed->bLedScanBlinkInProgress)
  2387. {
  2388. _cancel_timer_ex(&(pLed->BlinkTimer));
  2389. pLed->bLedScanBlinkInProgress = _FALSE;
  2390. }
  2391. _set_timer(&(pLed->BlinkTimer), 0);
  2392. break;
  2393. case LED_CTL_START_WPS: //wait until xinpin finish
  2394. case LED_CTL_START_WPS_BOTTON:
  2395. if(pLed->bLedWPSBlinkInProgress ==_FALSE)
  2396. {
  2397. if(pLed->bLedBlinkInProgress ==_TRUE)
  2398. {
  2399. _cancel_timer_ex(&(pLed->BlinkTimer));
  2400. pLed->bLedBlinkInProgress = _FALSE;
  2401. }
  2402. if(pLed->bLedScanBlinkInProgress ==_TRUE)
  2403. {
  2404. _cancel_timer_ex(&(pLed->BlinkTimer));
  2405. pLed->bLedScanBlinkInProgress = _FALSE;
  2406. }
  2407. pLed->bLedWPSBlinkInProgress = _TRUE;
  2408. pLed->CurrLedState = RTW_LED_ON;
  2409. pLed->BlinkingLedState = RTW_LED_ON;
  2410. _set_timer(&(pLed->BlinkTimer), 0);
  2411. }
  2412. break;
  2413. case LED_CTL_STOP_WPS:
  2414. pLed->bLedWPSBlinkInProgress = _FALSE;
  2415. if(padapter->pwrctrlpriv.rf_pwrstate != rf_on)
  2416. {
  2417. pLed->CurrLedState = RTW_LED_OFF;
  2418. pLed->BlinkingLedState = RTW_LED_OFF;
  2419. _set_timer(&(pLed->BlinkTimer), 0);
  2420. }
  2421. else
  2422. {
  2423. pLed->CurrLedState = RTW_LED_ON;
  2424. pLed->BlinkingLedState = RTW_LED_ON;
  2425. _set_timer(&(pLed->BlinkTimer), 0);
  2426. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  2427. }
  2428. break;
  2429. case LED_CTL_STOP_WPS_FAIL:
  2430. pLed->bLedWPSBlinkInProgress = _FALSE;
  2431. pLed->CurrLedState = RTW_LED_OFF;
  2432. pLed->BlinkingLedState = RTW_LED_OFF;
  2433. _set_timer(&(pLed->BlinkTimer), 0);
  2434. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  2435. break;
  2436. case LED_CTL_START_TO_LINK:
  2437. case LED_CTL_NO_LINK:
  2438. if(!IS_LED_BLINKING(pLed))
  2439. {
  2440. pLed->CurrLedState = RTW_LED_OFF;
  2441. pLed->BlinkingLedState = RTW_LED_OFF;
  2442. _set_timer(&(pLed->BlinkTimer), 0);
  2443. }
  2444. break;
  2445. case LED_CTL_POWER_OFF:
  2446. pLed->CurrLedState = RTW_LED_OFF;
  2447. pLed->BlinkingLedState = RTW_LED_OFF;
  2448. if( pLed->bLedBlinkInProgress)
  2449. {
  2450. _cancel_timer_ex(&(pLed->BlinkTimer));
  2451. pLed->bLedBlinkInProgress = _FALSE;
  2452. }
  2453. if( pLed->bLedScanBlinkInProgress)
  2454. {
  2455. _cancel_timer_ex(&(pLed->BlinkTimer));
  2456. pLed->bLedScanBlinkInProgress = _FALSE;
  2457. }
  2458. if( pLed->bLedWPSBlinkInProgress )
  2459. {
  2460. _cancel_timer_ex(&(pLed->BlinkTimer));
  2461. pLed->bLedWPSBlinkInProgress = _FALSE;
  2462. }
  2463. SwLedOff(padapter, pLed);
  2464. break;
  2465. default:
  2466. break;
  2467. }
  2468. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  2469. }
  2470. //COREGA, added by chiyoko, 20090316
  2471. static void
  2472. SwLedControlMode3(
  2473. _adapter *padapter,
  2474. LED_CTL_MODE LedAction
  2475. )
  2476. {
  2477. struct led_priv *ledpriv = &(padapter->ledpriv);
  2478. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  2479. PLED_USB pLed = &(ledpriv->SwLed0);
  2480. switch(LedAction)
  2481. {
  2482. case LED_CTL_SITE_SURVEY:
  2483. if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
  2484. ;
  2485. else if(pLed->bLedScanBlinkInProgress ==_FALSE)
  2486. {
  2487. if(IS_LED_WPS_BLINKING(pLed))
  2488. return;
  2489. if(pLed->bLedBlinkInProgress ==_TRUE)
  2490. {
  2491. _cancel_timer_ex(&(pLed->BlinkTimer));
  2492. pLed->bLedBlinkInProgress = _FALSE;
  2493. }
  2494. pLed->bLedScanBlinkInProgress = _TRUE;
  2495. pLed->CurrLedState = LED_BLINK_SCAN;
  2496. pLed->BlinkTimes = 24;
  2497. if( pLed->bLedOn )
  2498. pLed->BlinkingLedState = RTW_LED_OFF;
  2499. else
  2500. pLed->BlinkingLedState = RTW_LED_ON;
  2501. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2502. }
  2503. break;
  2504. case LED_CTL_TX:
  2505. case LED_CTL_RX:
  2506. if((pLed->bLedBlinkInProgress ==_FALSE) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  2507. {
  2508. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2509. {
  2510. return;
  2511. }
  2512. pLed->bLedBlinkInProgress = _TRUE;
  2513. pLed->CurrLedState = LED_BLINK_TXRX;
  2514. pLed->BlinkTimes = 2;
  2515. if( pLed->bLedOn )
  2516. pLed->BlinkingLedState = RTW_LED_OFF;
  2517. else
  2518. pLed->BlinkingLedState = RTW_LED_ON;
  2519. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  2520. }
  2521. break;
  2522. case LED_CTL_LINK:
  2523. if(IS_LED_WPS_BLINKING(pLed))
  2524. return;
  2525. pLed->CurrLedState = RTW_LED_ON;
  2526. pLed->BlinkingLedState = RTW_LED_ON;
  2527. if( pLed->bLedBlinkInProgress)
  2528. {
  2529. _cancel_timer_ex(&(pLed->BlinkTimer));
  2530. pLed->bLedBlinkInProgress = _FALSE;
  2531. }
  2532. if( pLed->bLedScanBlinkInProgress)
  2533. {
  2534. _cancel_timer_ex(&(pLed->BlinkTimer));
  2535. pLed->bLedScanBlinkInProgress = _FALSE;
  2536. }
  2537. _set_timer(&(pLed->BlinkTimer), 0);
  2538. break;
  2539. case LED_CTL_START_WPS: //wait until xinpin finish
  2540. case LED_CTL_START_WPS_BOTTON:
  2541. if(pLed->bLedWPSBlinkInProgress ==_FALSE)
  2542. {
  2543. if(pLed->bLedBlinkInProgress ==_TRUE)
  2544. {
  2545. _cancel_timer_ex(&(pLed->BlinkTimer));
  2546. pLed->bLedBlinkInProgress = _FALSE;
  2547. }
  2548. if(pLed->bLedScanBlinkInProgress ==_TRUE)
  2549. {
  2550. _cancel_timer_ex(&(pLed->BlinkTimer));
  2551. pLed->bLedScanBlinkInProgress = _FALSE;
  2552. }
  2553. pLed->bLedWPSBlinkInProgress = _TRUE;
  2554. pLed->CurrLedState = LED_BLINK_WPS;
  2555. if( pLed->bLedOn )
  2556. pLed->BlinkingLedState = RTW_LED_OFF;
  2557. else
  2558. pLed->BlinkingLedState = RTW_LED_ON;
  2559. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2560. }
  2561. break;
  2562. case LED_CTL_STOP_WPS:
  2563. if(pLed->bLedWPSBlinkInProgress)
  2564. {
  2565. _cancel_timer_ex(&(pLed->BlinkTimer));
  2566. pLed->bLedWPSBlinkInProgress = _FALSE;
  2567. }
  2568. else
  2569. {
  2570. pLed->bLedWPSBlinkInProgress = _TRUE;
  2571. }
  2572. pLed->CurrLedState = LED_BLINK_WPS_STOP;
  2573. if(pLed->bLedOn)
  2574. {
  2575. pLed->BlinkingLedState = RTW_LED_OFF;
  2576. _set_timer(&(pLed->BlinkTimer), LED_BLINK_WPS_SUCESS_INTERVAL_ALPHA);
  2577. }
  2578. else
  2579. {
  2580. pLed->BlinkingLedState = RTW_LED_ON;
  2581. _set_timer(&(pLed->BlinkTimer), 0);
  2582. }
  2583. break;
  2584. case LED_CTL_STOP_WPS_FAIL:
  2585. if(pLed->bLedWPSBlinkInProgress)
  2586. {
  2587. _cancel_timer_ex(&(pLed->BlinkTimer));
  2588. pLed->bLedWPSBlinkInProgress = _FALSE;
  2589. }
  2590. pLed->CurrLedState = RTW_LED_OFF;
  2591. pLed->BlinkingLedState = RTW_LED_OFF;
  2592. _set_timer(&(pLed->BlinkTimer), 0);
  2593. break;
  2594. case LED_CTL_START_TO_LINK:
  2595. case LED_CTL_NO_LINK:
  2596. if(!IS_LED_BLINKING(pLed))
  2597. {
  2598. pLed->CurrLedState = RTW_LED_OFF;
  2599. pLed->BlinkingLedState = RTW_LED_OFF;
  2600. _set_timer(&(pLed->BlinkTimer), 0);
  2601. }
  2602. break;
  2603. case LED_CTL_POWER_OFF:
  2604. pLed->CurrLedState = RTW_LED_OFF;
  2605. pLed->BlinkingLedState = RTW_LED_OFF;
  2606. if( pLed->bLedBlinkInProgress)
  2607. {
  2608. _cancel_timer_ex(&(pLed->BlinkTimer));
  2609. pLed->bLedBlinkInProgress = _FALSE;
  2610. }
  2611. if( pLed->bLedScanBlinkInProgress)
  2612. {
  2613. _cancel_timer_ex(&(pLed->BlinkTimer));
  2614. pLed->bLedScanBlinkInProgress = _FALSE;
  2615. }
  2616. if( pLed->bLedWPSBlinkInProgress )
  2617. {
  2618. _cancel_timer_ex(&(pLed->BlinkTimer));
  2619. pLed->bLedWPSBlinkInProgress = _FALSE;
  2620. }
  2621. SwLedOff(padapter, pLed);
  2622. break;
  2623. default:
  2624. break;
  2625. }
  2626. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("CurrLedState %d\n", pLed->CurrLedState));
  2627. }
  2628. //Edimax-Belkin, added by chiyoko, 20090413
  2629. static void
  2630. SwLedControlMode4(
  2631. _adapter *padapter,
  2632. LED_CTL_MODE LedAction
  2633. )
  2634. {
  2635. struct led_priv *ledpriv = &(padapter->ledpriv);
  2636. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  2637. PLED_USB pLed = &(ledpriv->SwLed0);
  2638. PLED_USB pLed1 = &(ledpriv->SwLed1);
  2639. switch(LedAction)
  2640. {
  2641. case LED_CTL_START_TO_LINK:
  2642. if(pLed1->bLedWPSBlinkInProgress)
  2643. {
  2644. pLed1->bLedWPSBlinkInProgress = _FALSE;
  2645. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2646. pLed1->BlinkingLedState = RTW_LED_OFF;
  2647. pLed1->CurrLedState = RTW_LED_OFF;
  2648. if(pLed1->bLedOn)
  2649. _set_timer(&(pLed->BlinkTimer), 0);
  2650. }
  2651. if( pLed->bLedStartToLinkBlinkInProgress == _FALSE )
  2652. {
  2653. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2654. {
  2655. return;
  2656. }
  2657. if(pLed->bLedBlinkInProgress ==_TRUE)
  2658. {
  2659. _cancel_timer_ex(&(pLed->BlinkTimer));
  2660. pLed->bLedBlinkInProgress = _FALSE;
  2661. }
  2662. if(pLed->bLedNoLinkBlinkInProgress ==_TRUE)
  2663. {
  2664. _cancel_timer_ex(&(pLed->BlinkTimer));
  2665. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2666. }
  2667. pLed->bLedStartToLinkBlinkInProgress = _TRUE;
  2668. pLed->CurrLedState = LED_BLINK_StartToBlink;
  2669. if( pLed->bLedOn )
  2670. {
  2671. pLed->BlinkingLedState = RTW_LED_OFF;
  2672. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  2673. }
  2674. else
  2675. {
  2676. pLed->BlinkingLedState = RTW_LED_ON;
  2677. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  2678. }
  2679. }
  2680. break;
  2681. case LED_CTL_LINK:
  2682. case LED_CTL_NO_LINK:
  2683. //LED1 settings
  2684. if(LedAction == LED_CTL_LINK)
  2685. {
  2686. if(pLed1->bLedWPSBlinkInProgress)
  2687. {
  2688. pLed1->bLedWPSBlinkInProgress = _FALSE;
  2689. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2690. pLed1->BlinkingLedState = RTW_LED_OFF;
  2691. pLed1->CurrLedState = RTW_LED_OFF;
  2692. if(pLed1->bLedOn)
  2693. _set_timer(&(pLed->BlinkTimer), 0);
  2694. }
  2695. }
  2696. if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
  2697. {
  2698. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2699. {
  2700. return;
  2701. }
  2702. if(pLed->bLedBlinkInProgress ==_TRUE)
  2703. {
  2704. _cancel_timer_ex(&(pLed->BlinkTimer));
  2705. pLed->bLedBlinkInProgress = _FALSE;
  2706. }
  2707. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2708. if(IS_HARDWARE_TYPE_8192DU(padapter))
  2709. {
  2710. if(LedAction == LED_CTL_LINK)
  2711. {
  2712. pLed->BlinkingLedState = RTW_LED_ON;
  2713. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  2714. }
  2715. else
  2716. {
  2717. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2718. if( pLed->bLedOn )
  2719. pLed->BlinkingLedState = RTW_LED_OFF;
  2720. else
  2721. pLed->BlinkingLedState = RTW_LED_ON;
  2722. }
  2723. }
  2724. else
  2725. {
  2726. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2727. if( pLed->bLedOn )
  2728. pLed->BlinkingLedState = RTW_LED_OFF;
  2729. else
  2730. pLed->BlinkingLedState = RTW_LED_ON;
  2731. }
  2732. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  2733. }
  2734. break;
  2735. case LED_CTL_SITE_SURVEY:
  2736. if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  2737. ;
  2738. else if(pLed->bLedScanBlinkInProgress ==_FALSE)
  2739. {
  2740. if(IS_LED_WPS_BLINKING(pLed))
  2741. return;
  2742. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2743. {
  2744. _cancel_timer_ex(&(pLed->BlinkTimer));
  2745. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2746. }
  2747. if(pLed->bLedBlinkInProgress ==_TRUE)
  2748. {
  2749. _cancel_timer_ex(&(pLed->BlinkTimer));
  2750. pLed->bLedBlinkInProgress = _FALSE;
  2751. }
  2752. pLed->bLedScanBlinkInProgress = _TRUE;
  2753. if(IS_HARDWARE_TYPE_8192D(padapter))
  2754. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2755. else
  2756. pLed->CurrLedState = LED_BLINK_SCAN;
  2757. pLed->BlinkTimes = 24;
  2758. if( pLed->bLedOn )
  2759. pLed->BlinkingLedState = RTW_LED_OFF;
  2760. else
  2761. pLed->BlinkingLedState = RTW_LED_ON;
  2762. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2763. }
  2764. break;
  2765. case LED_CTL_TX:
  2766. case LED_CTL_RX:
  2767. if(pLed->bLedBlinkInProgress ==_FALSE)
  2768. {
  2769. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  2770. {
  2771. return;
  2772. }
  2773. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2774. {
  2775. _cancel_timer_ex(&(pLed->BlinkTimer));
  2776. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2777. }
  2778. pLed->bLedBlinkInProgress = _TRUE;
  2779. pLed->CurrLedState = LED_BLINK_TXRX;
  2780. pLed->BlinkTimes = 2;
  2781. if( pLed->bLedOn )
  2782. pLed->BlinkingLedState = RTW_LED_OFF;
  2783. else
  2784. pLed->BlinkingLedState = RTW_LED_ON;
  2785. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  2786. }
  2787. break;
  2788. case LED_CTL_START_WPS: //wait until xinpin finish
  2789. case LED_CTL_START_WPS_BOTTON:
  2790. if(pLed1->bLedWPSBlinkInProgress)
  2791. {
  2792. pLed1->bLedWPSBlinkInProgress = _FALSE;
  2793. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2794. pLed1->BlinkingLedState = RTW_LED_OFF;
  2795. pLed1->CurrLedState = RTW_LED_OFF;
  2796. if(pLed1->bLedOn)
  2797. _set_timer(&(pLed->BlinkTimer), 0);
  2798. }
  2799. if(pLed->bLedWPSBlinkInProgress ==_FALSE)
  2800. {
  2801. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2802. {
  2803. _cancel_timer_ex(&(pLed->BlinkTimer));
  2804. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2805. }
  2806. if(pLed->bLedBlinkInProgress ==_TRUE)
  2807. {
  2808. _cancel_timer_ex(&(pLed->BlinkTimer));
  2809. pLed->bLedBlinkInProgress = _FALSE;
  2810. }
  2811. if(pLed->bLedScanBlinkInProgress ==_TRUE)
  2812. {
  2813. _cancel_timer_ex(&(pLed->BlinkTimer));
  2814. pLed->bLedScanBlinkInProgress = _FALSE;
  2815. }
  2816. pLed->bLedWPSBlinkInProgress = _TRUE;
  2817. pLed->CurrLedState = LED_BLINK_WPS;
  2818. if( pLed->bLedOn )
  2819. {
  2820. pLed->BlinkingLedState = RTW_LED_OFF;
  2821. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SLOWLY_INTERVAL);
  2822. }
  2823. else
  2824. {
  2825. pLed->BlinkingLedState = RTW_LED_ON;
  2826. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  2827. }
  2828. }
  2829. break;
  2830. case LED_CTL_STOP_WPS: //WPS connect success
  2831. if(pLed->bLedWPSBlinkInProgress)
  2832. {
  2833. _cancel_timer_ex(&(pLed->BlinkTimer));
  2834. pLed->bLedWPSBlinkInProgress = _FALSE;
  2835. }
  2836. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2837. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2838. if( pLed->bLedOn )
  2839. pLed->BlinkingLedState = RTW_LED_OFF;
  2840. else
  2841. pLed->BlinkingLedState = RTW_LED_ON;
  2842. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  2843. break;
  2844. case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
  2845. if(pLed->bLedWPSBlinkInProgress)
  2846. {
  2847. _cancel_timer_ex(&(pLed->BlinkTimer));
  2848. pLed->bLedWPSBlinkInProgress = _FALSE;
  2849. }
  2850. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2851. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2852. if( pLed->bLedOn )
  2853. pLed->BlinkingLedState = RTW_LED_OFF;
  2854. else
  2855. pLed->BlinkingLedState = RTW_LED_ON;
  2856. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  2857. //LED1 settings
  2858. if(pLed1->bLedWPSBlinkInProgress)
  2859. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2860. else
  2861. pLed1->bLedWPSBlinkInProgress = _TRUE;
  2862. pLed1->CurrLedState = LED_BLINK_WPS_STOP;
  2863. if( pLed1->bLedOn )
  2864. pLed1->BlinkingLedState = RTW_LED_OFF;
  2865. else
  2866. pLed1->BlinkingLedState = RTW_LED_ON;
  2867. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  2868. break;
  2869. case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
  2870. if(pLed->bLedWPSBlinkInProgress)
  2871. {
  2872. _cancel_timer_ex(&(pLed->BlinkTimer));
  2873. pLed->bLedWPSBlinkInProgress = _FALSE;
  2874. }
  2875. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  2876. pLed->CurrLedState = LED_BLINK_SLOWLY;
  2877. if( pLed->bLedOn )
  2878. pLed->BlinkingLedState = RTW_LED_OFF;
  2879. else
  2880. pLed->BlinkingLedState = RTW_LED_ON;
  2881. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  2882. //LED1 settings
  2883. if(pLed1->bLedWPSBlinkInProgress)
  2884. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2885. else
  2886. pLed1->bLedWPSBlinkInProgress = _TRUE;
  2887. pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
  2888. pLed1->BlinkTimes = 10;
  2889. if( pLed1->bLedOn )
  2890. pLed1->BlinkingLedState = RTW_LED_OFF;
  2891. else
  2892. pLed1->BlinkingLedState = RTW_LED_ON;
  2893. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NORMAL_INTERVAL);
  2894. break;
  2895. case LED_CTL_POWER_OFF:
  2896. pLed->CurrLedState = RTW_LED_OFF;
  2897. pLed->BlinkingLedState = RTW_LED_OFF;
  2898. if( pLed->bLedNoLinkBlinkInProgress)
  2899. {
  2900. _cancel_timer_ex(&(pLed->BlinkTimer));
  2901. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2902. }
  2903. if( pLed->bLedLinkBlinkInProgress)
  2904. {
  2905. _cancel_timer_ex(&(pLed->BlinkTimer));
  2906. pLed->bLedLinkBlinkInProgress = _FALSE;
  2907. }
  2908. if( pLed->bLedBlinkInProgress)
  2909. {
  2910. _cancel_timer_ex(&(pLed->BlinkTimer));
  2911. pLed->bLedBlinkInProgress = _FALSE;
  2912. }
  2913. if( pLed->bLedWPSBlinkInProgress )
  2914. {
  2915. _cancel_timer_ex(&(pLed->BlinkTimer));
  2916. pLed->bLedWPSBlinkInProgress = _FALSE;
  2917. }
  2918. if( pLed->bLedScanBlinkInProgress)
  2919. {
  2920. _cancel_timer_ex(&(pLed->BlinkTimer));
  2921. pLed->bLedScanBlinkInProgress = _FALSE;
  2922. }
  2923. if( pLed->bLedStartToLinkBlinkInProgress)
  2924. {
  2925. _cancel_timer_ex(&(pLed->BlinkTimer));
  2926. pLed->bLedStartToLinkBlinkInProgress = _FALSE;
  2927. }
  2928. if( pLed1->bLedWPSBlinkInProgress )
  2929. {
  2930. _cancel_timer_ex(&(pLed1->BlinkTimer));
  2931. pLed1->bLedWPSBlinkInProgress = _FALSE;
  2932. }
  2933. pLed1->BlinkingLedState = LED_UNKNOWN;
  2934. SwLedOff(padapter, pLed);
  2935. SwLedOff(padapter, pLed1);
  2936. break;
  2937. case LED_CTL_CONNECTION_NO_TRANSFER:
  2938. if(pLed->bLedBlinkInProgress == _FALSE)
  2939. {
  2940. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  2941. {
  2942. _cancel_timer_ex(&(pLed->BlinkTimer));
  2943. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  2944. }
  2945. pLed->bLedBlinkInProgress = _TRUE;
  2946. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  2947. pLed->BlinkingLedState = RTW_LED_ON;
  2948. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  2949. }
  2950. break;
  2951. default:
  2952. break;
  2953. }
  2954. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
  2955. }
  2956. //Sercomm-Belkin, added by chiyoko, 20090415
  2957. static void
  2958. SwLedControlMode5(
  2959. _adapter *padapter,
  2960. LED_CTL_MODE LedAction
  2961. )
  2962. {
  2963. struct led_priv *ledpriv = &(padapter->ledpriv);
  2964. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  2965. EEPROM_EFUSE_PRIV *pEEPROM = GET_EEPROM_EFUSE_PRIV(padapter);
  2966. PLED_USB pLed = &(ledpriv->SwLed0);
  2967. if(pEEPROM->CustomerID == RT_CID_819x_CAMEO)
  2968. pLed = &(ledpriv->SwLed1);
  2969. switch(LedAction)
  2970. {
  2971. case LED_CTL_POWER_ON:
  2972. case LED_CTL_NO_LINK:
  2973. case LED_CTL_LINK: //solid blue
  2974. pLed->CurrLedState = RTW_LED_ON;
  2975. pLed->BlinkingLedState = RTW_LED_ON;
  2976. _set_timer(&(pLed->BlinkTimer), 0);
  2977. break;
  2978. case LED_CTL_SITE_SURVEY:
  2979. if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  2980. ;
  2981. else if(pLed->bLedScanBlinkInProgress ==_FALSE)
  2982. {
  2983. if(pLed->bLedBlinkInProgress ==_TRUE)
  2984. {
  2985. _cancel_timer_ex(&(pLed->BlinkTimer));
  2986. pLed->bLedBlinkInProgress = _FALSE;
  2987. }
  2988. pLed->bLedScanBlinkInProgress = _TRUE;
  2989. pLed->CurrLedState = LED_BLINK_SCAN;
  2990. pLed->BlinkTimes = 24;
  2991. if( pLed->bLedOn )
  2992. pLed->BlinkingLedState = RTW_LED_OFF;
  2993. else
  2994. pLed->BlinkingLedState = RTW_LED_ON;
  2995. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  2996. }
  2997. break;
  2998. case LED_CTL_TX:
  2999. case LED_CTL_RX:
  3000. if(pLed->bLedBlinkInProgress ==_FALSE)
  3001. {
  3002. if(pLed->CurrLedState == LED_BLINK_SCAN)
  3003. {
  3004. return;
  3005. }
  3006. pLed->bLedBlinkInProgress = _TRUE;
  3007. pLed->CurrLedState = LED_BLINK_TXRX;
  3008. pLed->BlinkTimes = 2;
  3009. if( pLed->bLedOn )
  3010. pLed->BlinkingLedState = RTW_LED_OFF;
  3011. else
  3012. pLed->BlinkingLedState = RTW_LED_ON;
  3013. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  3014. }
  3015. break;
  3016. case LED_CTL_POWER_OFF:
  3017. pLed->CurrLedState = RTW_LED_OFF;
  3018. pLed->BlinkingLedState = RTW_LED_OFF;
  3019. if( pLed->bLedBlinkInProgress)
  3020. {
  3021. _cancel_timer_ex(&(pLed->BlinkTimer));
  3022. pLed->bLedBlinkInProgress = _FALSE;
  3023. }
  3024. SwLedOff(padapter, pLed);
  3025. break;
  3026. default:
  3027. break;
  3028. }
  3029. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led %d\n", pLed->CurrLedState));
  3030. }
  3031. //WNC-Corega, added by chiyoko, 20090902
  3032. static void
  3033. SwLedControlMode6(
  3034. _adapter *padapter,
  3035. LED_CTL_MODE LedAction
  3036. )
  3037. {
  3038. struct led_priv *ledpriv = &(padapter->ledpriv);
  3039. struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
  3040. PLED_USB pLed0 = &(ledpriv->SwLed0);
  3041. switch(LedAction)
  3042. {
  3043. case LED_CTL_POWER_ON:
  3044. case LED_CTL_LINK:
  3045. case LED_CTL_NO_LINK:
  3046. _cancel_timer_ex(&(pLed0->BlinkTimer));
  3047. pLed0->CurrLedState = RTW_LED_ON;
  3048. pLed0->BlinkingLedState = RTW_LED_ON;
  3049. _set_timer(&(pLed0->BlinkTimer), 0);
  3050. break;
  3051. case LED_CTL_POWER_OFF:
  3052. SwLedOff(padapter, pLed0);
  3053. break;
  3054. default:
  3055. break;
  3056. }
  3057. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("ledcontrol 6 Led %d\n", pLed0->CurrLedState));
  3058. }
  3059. //Netgear, added by sinda, 2011/11/11
  3060. void
  3061. SwLedControlMode7(
  3062. PADAPTER Adapter,
  3063. LED_CTL_MODE LedAction
  3064. )
  3065. {
  3066. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3067. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3068. PLED_USB pLed = &(ledpriv->SwLed0);
  3069. switch(LedAction)
  3070. {
  3071. case LED_CTL_SITE_SURVEY:
  3072. if(pmlmepriv->LinkDetectInfo.bBusyTraffic)
  3073. ;
  3074. else if(pLed->bLedScanBlinkInProgress == _FALSE)
  3075. {
  3076. if(IS_LED_WPS_BLINKING(pLed))
  3077. return;
  3078. if(pLed->bLedBlinkInProgress == _TRUE)
  3079. {
  3080. _cancel_timer_ex(&(pLed->BlinkTimer));
  3081. pLed->bLedBlinkInProgress = _FALSE;
  3082. }
  3083. pLed->bLedScanBlinkInProgress = _TRUE;
  3084. pLed->CurrLedState = LED_BLINK_SCAN;
  3085. pLed->BlinkTimes = 6;
  3086. if( pLed->bLedOn )
  3087. pLed->BlinkingLedState = RTW_LED_OFF;
  3088. else
  3089. pLed->BlinkingLedState = RTW_LED_ON;
  3090. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  3091. }
  3092. break;
  3093. case LED_CTL_LINK:
  3094. if(IS_LED_WPS_BLINKING(pLed))
  3095. return;
  3096. pLed->CurrLedState = RTW_LED_ON;
  3097. pLed->BlinkingLedState = RTW_LED_ON;
  3098. if( pLed->bLedBlinkInProgress)
  3099. {
  3100. _cancel_timer_ex(&(pLed->BlinkTimer));
  3101. pLed->bLedBlinkInProgress = _FALSE;
  3102. }
  3103. if( pLed->bLedScanBlinkInProgress)
  3104. {
  3105. _cancel_timer_ex(&(pLed->BlinkTimer));
  3106. pLed->bLedScanBlinkInProgress = _FALSE;
  3107. }
  3108. _set_timer(&(pLed->BlinkTimer), 0);
  3109. break;
  3110. case LED_CTL_START_WPS: //wait until xinpin finish
  3111. case LED_CTL_START_WPS_BOTTON:
  3112. if(pLed->bLedWPSBlinkInProgress ==_FALSE)
  3113. {
  3114. if(pLed->bLedBlinkInProgress == _TRUE)
  3115. {
  3116. _cancel_timer_ex(&(pLed->BlinkTimer));
  3117. pLed->bLedBlinkInProgress = _FALSE;
  3118. }
  3119. if(pLed->bLedScanBlinkInProgress == _TRUE)
  3120. {
  3121. _cancel_timer_ex(&(pLed->BlinkTimer));
  3122. pLed->bLedScanBlinkInProgress = _FALSE;
  3123. }
  3124. pLed->bLedWPSBlinkInProgress = _TRUE;
  3125. pLed->CurrLedState = LED_BLINK_WPS;
  3126. if( pLed->bLedOn )
  3127. pLed->BlinkingLedState = RTW_LED_OFF;
  3128. else
  3129. pLed->BlinkingLedState = RTW_LED_ON;
  3130. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  3131. }
  3132. break;
  3133. case LED_CTL_STOP_WPS:
  3134. if(pLed->bLedWPSBlinkInProgress)
  3135. {
  3136. _cancel_timer_ex(&(pLed->BlinkTimer));
  3137. pLed->bLedWPSBlinkInProgress = _FALSE;
  3138. }
  3139. else
  3140. {
  3141. pLed->bLedWPSBlinkInProgress = _TRUE;
  3142. }
  3143. pLed->CurrLedState = LED_BLINK_WPS_STOP;
  3144. if(pLed->bLedOn)
  3145. {
  3146. pLed->BlinkingLedState = RTW_LED_OFF;
  3147. _set_timer(&(pLed->BlinkTimer), LED_BLINK_LINK_INTERVAL_NETGEAR);
  3148. }
  3149. else
  3150. {
  3151. pLed->BlinkingLedState = RTW_LED_ON;
  3152. _set_timer(&(pLed->BlinkTimer), 0);
  3153. }
  3154. break;
  3155. case LED_CTL_STOP_WPS_FAIL:
  3156. case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
  3157. if(pLed->bLedWPSBlinkInProgress)
  3158. {
  3159. _cancel_timer_ex(&(pLed->BlinkTimer));
  3160. pLed->bLedWPSBlinkInProgress = _FALSE;
  3161. }
  3162. pLed->CurrLedState = RTW_LED_OFF;
  3163. pLed->BlinkingLedState = RTW_LED_OFF;
  3164. _set_timer(&(pLed->BlinkTimer), 0);
  3165. break;
  3166. case LED_CTL_START_TO_LINK:
  3167. case LED_CTL_NO_LINK:
  3168. if(!IS_LED_BLINKING(pLed))
  3169. {
  3170. pLed->CurrLedState = RTW_LED_OFF;
  3171. pLed->BlinkingLedState = RTW_LED_OFF;
  3172. _set_timer(&(pLed->BlinkTimer), 0);
  3173. }
  3174. break;
  3175. case LED_CTL_POWER_OFF:
  3176. case LED_CTL_POWER_ON:
  3177. pLed->CurrLedState = RTW_LED_OFF;
  3178. pLed->BlinkingLedState = RTW_LED_OFF;
  3179. if( pLed->bLedBlinkInProgress)
  3180. {
  3181. _cancel_timer_ex(&(pLed->BlinkTimer));
  3182. pLed->bLedBlinkInProgress = _FALSE;
  3183. }
  3184. if( pLed->bLedScanBlinkInProgress)
  3185. {
  3186. _cancel_timer_ex(&(pLed->BlinkTimer));
  3187. pLed->bLedScanBlinkInProgress = _FALSE;
  3188. }
  3189. if( pLed->bLedWPSBlinkInProgress )
  3190. {
  3191. _cancel_timer_ex(&(pLed->BlinkTimer));
  3192. pLed->bLedWPSBlinkInProgress = _FALSE;
  3193. }
  3194. _set_timer(&(pLed->BlinkTimer), 0);
  3195. break;
  3196. default:
  3197. break;
  3198. }
  3199. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LEd control mode 7 CurrLedState %d\n", pLed->CurrLedState));
  3200. }
  3201. void
  3202. SwLedControlMode8(
  3203. PADAPTER Adapter,
  3204. LED_CTL_MODE LedAction
  3205. )
  3206. {
  3207. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3208. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3209. PLED_USB pLed0 = &(ledpriv->SwLed0);
  3210. switch(LedAction)
  3211. {
  3212. case LED_CTL_LINK:
  3213. _cancel_timer_ex(&(pLed0->BlinkTimer));
  3214. pLed0->CurrLedState = RTW_LED_ON;
  3215. pLed0->BlinkingLedState = RTW_LED_ON;
  3216. _set_timer(&(pLed0->BlinkTimer), 0);
  3217. break;
  3218. case LED_CTL_NO_LINK:
  3219. _cancel_timer_ex(&(pLed0->BlinkTimer));
  3220. pLed0->CurrLedState = RTW_LED_OFF;
  3221. pLed0->BlinkingLedState = RTW_LED_OFF;
  3222. _set_timer(&(pLed0->BlinkTimer), 0);
  3223. break;
  3224. case LED_CTL_POWER_OFF:
  3225. SwLedOff(Adapter, pLed0);
  3226. break;
  3227. default:
  3228. break;
  3229. }
  3230. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 8 %d\n", pLed0->CurrLedState));
  3231. }
  3232. //page added for Belkin AC950, 20120813
  3233. void
  3234. SwLedControlMode9(
  3235. IN PADAPTER Adapter,
  3236. IN LED_CTL_MODE LedAction
  3237. )
  3238. {
  3239. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3240. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3241. PLED_USB pLed = &(ledpriv->SwLed0);
  3242. PLED_USB pLed1 = &(ledpriv->SwLed1);
  3243. PLED_USB pLed2 = &(ledpriv->SwLed2);
  3244. BOOLEAN bWPSOverLap = _FALSE;
  3245. switch(LedAction)
  3246. {
  3247. case LED_CTL_START_TO_LINK:
  3248. if(pLed2->bLedBlinkInProgress == _FALSE)
  3249. {
  3250. pLed2->bLedBlinkInProgress = _TRUE;
  3251. pLed2->BlinkingLedState = RTW_LED_ON;
  3252. pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
  3253. _set_timer(&(pLed2->BlinkTimer), 0);
  3254. }
  3255. break;
  3256. case LED_CTL_LINK:
  3257. case LED_CTL_NO_LINK:
  3258. //LED1 settings
  3259. if(LedAction == LED_CTL_NO_LINK)
  3260. {
  3261. //if(pMgntInfo->AuthStatus == AUTH_STATUS_FAILED)
  3262. if(0)
  3263. {
  3264. pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
  3265. if( pLed1->bLedOn )
  3266. pLed1->BlinkingLedState = RTW_LED_OFF;
  3267. else
  3268. pLed1->BlinkingLedState = RTW_LED_ON;
  3269. _set_timer(&(pLed1->BlinkTimer), 0);
  3270. }
  3271. else
  3272. {
  3273. pLed1->CurrLedState = RTW_LED_OFF;
  3274. pLed1->BlinkingLedState = RTW_LED_OFF;
  3275. if( pLed1->bLedOn )
  3276. _set_timer(&(pLed1->BlinkTimer), 0);
  3277. }
  3278. }
  3279. else
  3280. {
  3281. pLed1->CurrLedState = RTW_LED_OFF;
  3282. pLed1->BlinkingLedState = RTW_LED_OFF;
  3283. if( pLed1->bLedOn )
  3284. _set_timer(&(pLed1->BlinkTimer), 0);
  3285. }
  3286. //LED2 settings
  3287. if(LedAction == LED_CTL_LINK)
  3288. {
  3289. if(Adapter->securitypriv.dot11PrivacyAlgrthm != _NO_PRIVACY_)
  3290. {
  3291. if(pLed2->bLedBlinkInProgress ==_TRUE)
  3292. {
  3293. _cancel_timer_ex(&(pLed2->BlinkTimer));
  3294. pLed2->bLedBlinkInProgress = _FALSE;
  3295. }
  3296. pLed2->CurrLedState = RTW_LED_ON;
  3297. pLed2->bLedNoLinkBlinkInProgress = _TRUE;
  3298. if(!pLed2->bLedOn)
  3299. _set_timer(&(pLed2->BlinkTimer), 0);
  3300. }
  3301. else
  3302. {
  3303. if(pLed2->bLedWPSBlinkInProgress != _TRUE)
  3304. {
  3305. pLed2->CurrLedState = RTW_LED_OFF;
  3306. pLed2->BlinkingLedState = RTW_LED_OFF;
  3307. if(pLed2->bLedOn)
  3308. _set_timer(&(pLed2->BlinkTimer), 0);
  3309. }
  3310. }
  3311. }
  3312. else //NO_LINK
  3313. {
  3314. if(pLed2->bLedWPSBlinkInProgress == _FALSE)
  3315. {
  3316. pLed2->CurrLedState = RTW_LED_OFF;
  3317. pLed2->BlinkingLedState = RTW_LED_OFF;
  3318. if(pLed2->bLedOn)
  3319. _set_timer(&(pLed2->BlinkTimer), 0);
  3320. }
  3321. }
  3322. //LED0 settings
  3323. if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
  3324. {
  3325. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  3326. {
  3327. return;
  3328. }
  3329. if(pLed->bLedBlinkInProgress == _TRUE)
  3330. {
  3331. _cancel_timer_ex(&(pLed->BlinkTimer));
  3332. pLed->bLedBlinkInProgress = _FALSE;
  3333. }
  3334. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  3335. if(IS_HARDWARE_TYPE_8192DU(Adapter) || IS_HARDWARE_TYPE_8812AU(Adapter))
  3336. {
  3337. if(LedAction == LED_CTL_LINK)
  3338. {
  3339. pLed->BlinkingLedState = RTW_LED_ON;
  3340. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  3341. }
  3342. else
  3343. {
  3344. pLed->CurrLedState = LED_BLINK_SLOWLY;
  3345. if( pLed->bLedOn )
  3346. pLed->BlinkingLedState = RTW_LED_OFF;
  3347. else
  3348. pLed->BlinkingLedState = RTW_LED_ON;
  3349. }
  3350. }
  3351. else
  3352. {
  3353. pLed->CurrLedState = LED_BLINK_SLOWLY;
  3354. if( pLed->bLedOn )
  3355. pLed->BlinkingLedState = RTW_LED_OFF;
  3356. else
  3357. pLed->BlinkingLedState = RTW_LED_ON;
  3358. }
  3359. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  3360. }
  3361. break;
  3362. case LED_CTL_SITE_SURVEY:
  3363. if((pmlmepriv->LinkDetectInfo.bBusyTraffic) && (check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE))
  3364. ;
  3365. else //if(pLed->bLedScanBlinkInProgress ==FALSE)
  3366. {
  3367. if(IS_LED_WPS_BLINKING(pLed))
  3368. return;
  3369. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3370. {
  3371. _cancel_timer_ex(&(pLed->BlinkTimer));
  3372. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3373. }
  3374. if(pLed->bLedBlinkInProgress == _TRUE)
  3375. {
  3376. _cancel_timer_ex(&(pLed->BlinkTimer));
  3377. pLed->bLedBlinkInProgress = _FALSE;
  3378. }
  3379. pLed->bLedScanBlinkInProgress = _TRUE;
  3380. if(IS_HARDWARE_TYPE_8192D(Adapter))
  3381. pLed->CurrLedState = LED_BLINK_SLOWLY;
  3382. else
  3383. pLed->CurrLedState = LED_BLINK_SCAN;
  3384. pLed->BlinkTimes = 24;
  3385. if( pLed->bLedOn )
  3386. pLed->BlinkingLedState = RTW_LED_OFF;
  3387. else
  3388. pLed->BlinkingLedState = RTW_LED_ON;
  3389. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  3390. }
  3391. break;
  3392. case LED_CTL_TX:
  3393. case LED_CTL_RX:
  3394. if(pLed->bLedBlinkInProgress == _FALSE)
  3395. {
  3396. if(pLed->CurrLedState == LED_BLINK_SCAN || IS_LED_WPS_BLINKING(pLed))
  3397. {
  3398. return;
  3399. }
  3400. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3401. {
  3402. _cancel_timer_ex(&(pLed->BlinkTimer));
  3403. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3404. }
  3405. pLed->bLedBlinkInProgress = _TRUE;
  3406. pLed->CurrLedState = LED_BLINK_TXRX;
  3407. pLed->BlinkTimes = 2;
  3408. if( pLed->bLedOn )
  3409. pLed->BlinkingLedState = RTW_LED_OFF;
  3410. else
  3411. pLed->BlinkingLedState = RTW_LED_ON;
  3412. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  3413. }
  3414. break;
  3415. case LED_CTL_START_WPS: //wait until xinpin finish
  3416. case LED_CTL_START_WPS_BOTTON:
  3417. pLed2->bLedBlinkInProgress = _TRUE;
  3418. pLed2->BlinkingLedState = RTW_LED_ON;
  3419. pLed2->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
  3420. pLed2->bLedWPSBlinkInProgress = _TRUE;
  3421. _set_timer(&(pLed2->BlinkTimer), 0);
  3422. break;
  3423. case LED_CTL_STOP_WPS: //WPS connect success
  3424. //LED2 settings
  3425. if(pLed2->bLedWPSBlinkInProgress == _TRUE)
  3426. {
  3427. _cancel_timer_ex(&(pLed2->BlinkTimer));
  3428. pLed2->bLedBlinkInProgress = _FALSE;
  3429. pLed2->bLedWPSBlinkInProgress = _FALSE;
  3430. }
  3431. pLed2->CurrLedState = RTW_LED_ON;
  3432. pLed2->bLedNoLinkBlinkInProgress = _TRUE;
  3433. if(!pLed2->bLedOn)
  3434. _set_timer(&(pLed2->BlinkTimer), 0);
  3435. //LED1 settings
  3436. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3437. pLed1->CurrLedState = RTW_LED_OFF;
  3438. pLed1->BlinkingLedState = RTW_LED_OFF;
  3439. if( pLed1->bLedOn )
  3440. _set_timer(&(pLed1->BlinkTimer), 0);
  3441. break;
  3442. case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
  3443. //LED1 settings
  3444. if(bWPSOverLap == _FALSE)
  3445. {
  3446. pLed1->CurrLedState = LED_BLINK_AUTH_ERROR;
  3447. pLed1->BlinkTimes = 50;
  3448. if( pLed1->bLedOn )
  3449. pLed1->BlinkingLedState = RTW_LED_OFF;
  3450. else
  3451. pLed1->BlinkingLedState = RTW_LED_ON;
  3452. _set_timer(&(pLed1->BlinkTimer), 0);
  3453. }
  3454. else
  3455. {
  3456. bWPSOverLap = _FALSE;
  3457. pLed1->CurrLedState = RTW_LED_OFF;
  3458. pLed1->BlinkingLedState = RTW_LED_OFF;
  3459. _set_timer(&(pLed1->BlinkTimer), 0);
  3460. }
  3461. //LED2 settings
  3462. pLed2->CurrLedState = RTW_LED_OFF;
  3463. pLed2->BlinkingLedState = RTW_LED_OFF;
  3464. pLed2->bLedWPSBlinkInProgress = _FALSE;
  3465. if( pLed2->bLedOn )
  3466. _set_timer(&(pLed2->BlinkTimer), 0);
  3467. break;
  3468. case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
  3469. //LED1 settings
  3470. bWPSOverLap = _TRUE;
  3471. pLed1->CurrLedState = LED_BLINK_WPS_STOP_OVERLAP;
  3472. pLed1->BlinkTimes = 10;
  3473. pLed1->BlinkCounter = 50;
  3474. if( pLed1->bLedOn )
  3475. pLed1->BlinkingLedState = RTW_LED_OFF;
  3476. else
  3477. pLed1->BlinkingLedState = RTW_LED_ON;
  3478. _set_timer(&(pLed1->BlinkTimer), 0);
  3479. //LED2 settings
  3480. pLed2->CurrLedState = RTW_LED_OFF;
  3481. pLed2->BlinkingLedState = RTW_LED_OFF;
  3482. pLed2->bLedWPSBlinkInProgress = _FALSE;
  3483. if( pLed2->bLedOn )
  3484. _set_timer(&(pLed2->BlinkTimer), 0);
  3485. break;
  3486. case LED_CTL_POWER_OFF:
  3487. pLed->CurrLedState = RTW_LED_OFF;
  3488. pLed->BlinkingLedState = RTW_LED_OFF;
  3489. if( pLed->bLedNoLinkBlinkInProgress)
  3490. {
  3491. _cancel_timer_ex(&(pLed->BlinkTimer));
  3492. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3493. }
  3494. if( pLed->bLedLinkBlinkInProgress)
  3495. {
  3496. _cancel_timer_ex(&(pLed->BlinkTimer));
  3497. pLed->bLedLinkBlinkInProgress = _FALSE;
  3498. }
  3499. if( pLed->bLedBlinkInProgress)
  3500. {
  3501. _cancel_timer_ex(&(pLed->BlinkTimer));
  3502. pLed->bLedBlinkInProgress = _FALSE;
  3503. }
  3504. if( pLed->bLedWPSBlinkInProgress )
  3505. {
  3506. _cancel_timer_ex(&(pLed->BlinkTimer));
  3507. pLed->bLedWPSBlinkInProgress = _FALSE;
  3508. }
  3509. if( pLed->bLedScanBlinkInProgress)
  3510. {
  3511. _cancel_timer_ex(&(pLed->BlinkTimer));
  3512. pLed->bLedScanBlinkInProgress = _FALSE;
  3513. }
  3514. if( pLed->bLedStartToLinkBlinkInProgress)
  3515. {
  3516. _cancel_timer_ex(&(pLed->BlinkTimer));
  3517. pLed->bLedStartToLinkBlinkInProgress = _FALSE;
  3518. }
  3519. if( pLed1->bLedWPSBlinkInProgress )
  3520. {
  3521. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3522. pLed1->bLedWPSBlinkInProgress = _FALSE;
  3523. }
  3524. pLed1->BlinkingLedState = LED_UNKNOWN;
  3525. SwLedOff(Adapter, pLed);
  3526. SwLedOff(Adapter, pLed1);
  3527. break;
  3528. case LED_CTL_CONNECTION_NO_TRANSFER:
  3529. if(pLed->bLedBlinkInProgress == _FALSE)
  3530. {
  3531. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3532. {
  3533. _cancel_timer_ex(&(pLed->BlinkTimer));
  3534. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3535. }
  3536. pLed->bLedBlinkInProgress = _TRUE;
  3537. pLed->CurrLedState = LED_BLINK_ALWAYS_ON;
  3538. pLed->BlinkingLedState = RTW_LED_ON;
  3539. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  3540. }
  3541. break;
  3542. default:
  3543. break;
  3544. }
  3545. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 9 Led %d\n", pLed->CurrLedState));
  3546. }
  3547. //page added for Netgear A6200V2, 20120827
  3548. void
  3549. SwLedControlMode10(
  3550. PADAPTER Adapter,
  3551. LED_CTL_MODE LedAction
  3552. )
  3553. {
  3554. HAL_DATA_TYPE *pHalData = GET_HAL_DATA(Adapter);
  3555. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3556. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3557. PLED_USB pLed = &(ledpriv->SwLed0);
  3558. PLED_USB pLed1 = &(ledpriv->SwLed1);
  3559. switch(LedAction)
  3560. {
  3561. case LED_CTL_START_TO_LINK:
  3562. if(pLed1->bLedBlinkInProgress == _FALSE)
  3563. {
  3564. pLed1->bLedBlinkInProgress = _TRUE;
  3565. pLed1->BlinkingLedState = RTW_LED_ON;
  3566. pLed1->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
  3567. _set_timer(&(pLed1->BlinkTimer), 0);
  3568. }
  3569. break;
  3570. case LED_CTL_LINK:
  3571. case LED_CTL_NO_LINK:
  3572. if(LedAction == LED_CTL_LINK)
  3573. {
  3574. if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
  3575. ;
  3576. else
  3577. {
  3578. if(pHalData->CurrentBandType == BAND_ON_2_4G)
  3579. //LED0 settings
  3580. {
  3581. pLed->CurrLedState = RTW_LED_ON;
  3582. pLed->BlinkingLedState = RTW_LED_ON;
  3583. if(pLed->bLedBlinkInProgress == _TRUE)
  3584. {
  3585. _cancel_timer_ex(&(pLed->BlinkTimer));
  3586. pLed->bLedBlinkInProgress = _FALSE;
  3587. }
  3588. _set_timer(&(pLed->BlinkTimer), 0);
  3589. pLed1->CurrLedState = RTW_LED_OFF;
  3590. pLed1->BlinkingLedState = RTW_LED_OFF;
  3591. _set_timer(&(pLed1->BlinkTimer), 0);
  3592. }
  3593. else if(pHalData->CurrentBandType == BAND_ON_5G)
  3594. //LED1 settings
  3595. {
  3596. pLed1->CurrLedState = RTW_LED_ON;
  3597. pLed1->BlinkingLedState = RTW_LED_ON;
  3598. if(pLed1->bLedBlinkInProgress == _TRUE)
  3599. {
  3600. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3601. pLed1->bLedBlinkInProgress = _FALSE;
  3602. }
  3603. _set_timer(&(pLed1->BlinkTimer), 0);
  3604. pLed->CurrLedState = RTW_LED_OFF;
  3605. pLed->BlinkingLedState = RTW_LED_OFF;
  3606. _set_timer(&(pLed->BlinkTimer), 0);
  3607. }
  3608. }
  3609. }
  3610. else if(LedAction == LED_CTL_NO_LINK) //TODO by page
  3611. {
  3612. if(pLed->bLedWPSBlinkInProgress == _TRUE || pLed1->bLedWPSBlinkInProgress == _TRUE)
  3613. ;
  3614. else
  3615. {
  3616. pLed->CurrLedState = RTW_LED_OFF;
  3617. pLed->BlinkingLedState = RTW_LED_OFF;
  3618. if( pLed->bLedOn )
  3619. _set_timer(&(pLed->BlinkTimer), 0);
  3620. pLed1->CurrLedState = RTW_LED_OFF;
  3621. pLed1->BlinkingLedState = RTW_LED_OFF;
  3622. if( pLed1->bLedOn )
  3623. _set_timer(&(pLed1->BlinkTimer), 0);
  3624. }
  3625. }
  3626. break;
  3627. case LED_CTL_SITE_SURVEY:
  3628. if(check_fwstate(pmlmepriv, _FW_LINKED)== _TRUE)
  3629. ; //don't blink when media connect
  3630. else //if(pLed->bLedScanBlinkInProgress ==FALSE)
  3631. {
  3632. if(IS_LED_WPS_BLINKING(pLed) || IS_LED_WPS_BLINKING(pLed1))
  3633. return;
  3634. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3635. {
  3636. _cancel_timer_ex(&(pLed->BlinkTimer));
  3637. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3638. }
  3639. if(pLed->bLedBlinkInProgress == _TRUE)
  3640. {
  3641. _cancel_timer_ex(&(pLed->BlinkTimer));
  3642. pLed->bLedBlinkInProgress = _FALSE;
  3643. }
  3644. pLed->bLedScanBlinkInProgress = _TRUE;
  3645. pLed->CurrLedState = LED_BLINK_SCAN;
  3646. pLed->BlinkTimes = 12;
  3647. pLed->BlinkingLedState = LED_BLINK_SCAN;
  3648. _set_timer(&(pLed->BlinkTimer), 0);
  3649. if(pLed1->bLedNoLinkBlinkInProgress == _TRUE)
  3650. {
  3651. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3652. pLed1->bLedNoLinkBlinkInProgress = _FALSE;
  3653. }
  3654. if(pLed1->bLedBlinkInProgress == _TRUE)
  3655. {
  3656. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3657. pLed1->bLedBlinkInProgress = _FALSE;
  3658. }
  3659. pLed1->bLedScanBlinkInProgress = _TRUE;
  3660. pLed1->CurrLedState = LED_BLINK_SCAN;
  3661. pLed1->BlinkTimes = 12;
  3662. pLed1->BlinkingLedState = LED_BLINK_SCAN;
  3663. _set_timer(&(pLed1->BlinkTimer), LED_BLINK_LINK_SLOWLY_INTERVAL_NETGEAR);
  3664. }
  3665. break;
  3666. case LED_CTL_START_WPS: //wait until xinpin finish
  3667. case LED_CTL_START_WPS_BOTTON:
  3668. //LED0 settings
  3669. if(pLed->bLedBlinkInProgress == _FALSE)
  3670. {
  3671. pLed->bLedBlinkInProgress = _TRUE;
  3672. pLed->bLedWPSBlinkInProgress = _TRUE;
  3673. pLed->BlinkingLedState = LED_BLINK_WPS;
  3674. pLed->CurrLedState = LED_BLINK_WPS;
  3675. _set_timer(&(pLed->BlinkTimer), 0);
  3676. }
  3677. //LED1 settings
  3678. if(pLed1->bLedBlinkInProgress == _FALSE)
  3679. {
  3680. pLed1->bLedBlinkInProgress = _TRUE;
  3681. pLed1->bLedWPSBlinkInProgress = _TRUE;
  3682. pLed1->BlinkingLedState = LED_BLINK_WPS;
  3683. pLed1->CurrLedState = LED_BLINK_WPS;
  3684. _set_timer(&(pLed1->BlinkTimer), LED_BLINK_NORMAL_INTERVAL+LED_BLINK_LINK_INTERVAL_NETGEAR);
  3685. }
  3686. break;
  3687. case LED_CTL_STOP_WPS: //WPS connect success
  3688. if(pHalData->CurrentBandType == BAND_ON_2_4G)
  3689. //LED0 settings
  3690. {
  3691. pLed->bLedWPSBlinkInProgress = _FALSE;
  3692. pLed->CurrLedState = RTW_LED_ON;
  3693. pLed->BlinkingLedState = RTW_LED_ON;
  3694. if(pLed->bLedBlinkInProgress == _TRUE)
  3695. {
  3696. _cancel_timer_ex(&(pLed->BlinkTimer));
  3697. pLed->bLedBlinkInProgress = _FALSE;
  3698. }
  3699. _set_timer(&(pLed->BlinkTimer), 0);
  3700. pLed1->CurrLedState = RTW_LED_OFF;
  3701. pLed1->BlinkingLedState = RTW_LED_OFF;
  3702. _set_timer(&(pLed1->BlinkTimer), 0);
  3703. }
  3704. else if(pHalData->CurrentBandType == BAND_ON_5G)
  3705. //LED1 settings
  3706. {
  3707. pLed1->bLedWPSBlinkInProgress = _FALSE;
  3708. pLed1->CurrLedState = RTW_LED_ON;
  3709. pLed1->BlinkingLedState = RTW_LED_ON;
  3710. if(pLed1->bLedBlinkInProgress == _TRUE)
  3711. {
  3712. _cancel_timer_ex(&(pLed1->BlinkTimer));
  3713. pLed1->bLedBlinkInProgress = _FALSE;
  3714. }
  3715. _set_timer(&(pLed1->BlinkTimer), 0);
  3716. pLed->CurrLedState = RTW_LED_OFF;
  3717. pLed->BlinkingLedState = RTW_LED_OFF;
  3718. _set_timer(&(pLed->BlinkTimer), 0);
  3719. }
  3720. break;
  3721. case LED_CTL_STOP_WPS_FAIL: //WPS authentication fail
  3722. //LED1 settings
  3723. pLed1->bLedWPSBlinkInProgress = _FALSE;
  3724. pLed1->CurrLedState = RTW_LED_OFF;
  3725. pLed1->BlinkingLedState = RTW_LED_OFF;
  3726. _set_timer(&(pLed1->BlinkTimer), 0);
  3727. //LED0 settings
  3728. pLed->bLedWPSBlinkInProgress = _FALSE;
  3729. pLed->CurrLedState = RTW_LED_OFF;
  3730. pLed->BlinkingLedState = RTW_LED_OFF;
  3731. if( pLed->bLedOn )
  3732. _set_timer(&(pLed->BlinkTimer), 0);
  3733. break;
  3734. default:
  3735. break;
  3736. }
  3737. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 10 Led %d\n", pLed->CurrLedState));
  3738. }
  3739. //Edimax-ASUS, added by Page, 20121221
  3740. void
  3741. SwLedControlMode11(
  3742. PADAPTER Adapter,
  3743. LED_CTL_MODE LedAction
  3744. )
  3745. {
  3746. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3747. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3748. PLED_USB pLed = &(ledpriv->SwLed0);
  3749. switch(LedAction)
  3750. {
  3751. case LED_CTL_POWER_ON:
  3752. case LED_CTL_START_TO_LINK:
  3753. case LED_CTL_NO_LINK:
  3754. pLed->CurrLedState = RTW_LED_ON;
  3755. pLed->BlinkingLedState = RTW_LED_ON;
  3756. _set_timer(&(pLed->BlinkTimer), 0);
  3757. break;
  3758. case LED_CTL_LINK:
  3759. if( pLed->bLedBlinkInProgress == _TRUE )
  3760. {
  3761. _cancel_timer_ex(&(pLed->BlinkTimer));
  3762. pLed->bLedBlinkInProgress = _FALSE;
  3763. }
  3764. pLed->bLedBlinkInProgress = _TRUE;
  3765. pLed->CurrLedState = LED_BLINK_TXRX;
  3766. if( pLed->bLedOn )
  3767. pLed->BlinkingLedState = RTW_LED_OFF;
  3768. else
  3769. pLed->BlinkingLedState = RTW_LED_ON;
  3770. _set_timer(&(pLed->BlinkTimer), LED_BLINK_SCAN_INTERVAL_ALPHA);
  3771. break;
  3772. case LED_CTL_START_WPS: //wait until xinpin finish
  3773. case LED_CTL_START_WPS_BOTTON:
  3774. if(pLed->bLedBlinkInProgress == _TRUE)
  3775. {
  3776. _cancel_timer_ex(&(pLed->BlinkTimer));
  3777. pLed->bLedBlinkInProgress = _FALSE;
  3778. }
  3779. pLed->bLedWPSBlinkInProgress = _TRUE;
  3780. pLed->bLedBlinkInProgress = _TRUE;
  3781. pLed->CurrLedState = LED_BLINK_WPS;
  3782. if( pLed->bLedOn )
  3783. pLed->BlinkingLedState = RTW_LED_OFF;
  3784. else
  3785. pLed->BlinkingLedState = RTW_LED_ON;
  3786. pLed->BlinkTimes = 5;
  3787. _set_timer(&(pLed->BlinkTimer), 0);
  3788. break;
  3789. case LED_CTL_STOP_WPS:
  3790. case LED_CTL_STOP_WPS_FAIL:
  3791. if(pLed->bLedBlinkInProgress == _TRUE)
  3792. {
  3793. _cancel_timer_ex(&(pLed->BlinkTimer));
  3794. pLed->bLedBlinkInProgress = _FALSE;
  3795. }
  3796. pLed->CurrLedState = LED_BLINK_WPS_STOP;
  3797. _set_timer(&(pLed->BlinkTimer), 0);
  3798. break;
  3799. case LED_CTL_POWER_OFF:
  3800. pLed->CurrLedState = RTW_LED_OFF;
  3801. pLed->BlinkingLedState = RTW_LED_OFF;
  3802. if( pLed->bLedNoLinkBlinkInProgress)
  3803. {
  3804. _cancel_timer_ex(&(pLed->BlinkTimer));
  3805. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3806. }
  3807. if( pLed->bLedLinkBlinkInProgress)
  3808. {
  3809. _cancel_timer_ex(&(pLed->BlinkTimer));
  3810. pLed->bLedLinkBlinkInProgress = _FALSE;
  3811. }
  3812. if( pLed->bLedBlinkInProgress)
  3813. {
  3814. _cancel_timer_ex(&(pLed->BlinkTimer));
  3815. pLed->bLedBlinkInProgress = _FALSE;
  3816. }
  3817. if( pLed->bLedWPSBlinkInProgress )
  3818. {
  3819. _cancel_timer_ex(&(pLed->BlinkTimer));
  3820. pLed->bLedWPSBlinkInProgress = _FALSE;
  3821. }
  3822. if( pLed->bLedScanBlinkInProgress)
  3823. {
  3824. _cancel_timer_ex(&(pLed->BlinkTimer));
  3825. pLed->bLedScanBlinkInProgress = _FALSE;
  3826. }
  3827. SwLedOff(Adapter, pLed);
  3828. break;
  3829. default:
  3830. break;
  3831. }
  3832. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led mode 1 CurrLedState %d\n", pLed->CurrLedState));
  3833. }
  3834. // page added for NEC
  3835. VOID
  3836. SwLedControlMode12(
  3837. PADAPTER Adapter,
  3838. LED_CTL_MODE LedAction
  3839. )
  3840. {
  3841. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3842. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3843. PLED_USB pLed = &(ledpriv->SwLed0);
  3844. switch(LedAction)
  3845. {
  3846. case LED_CTL_POWER_ON:
  3847. case LED_CTL_NO_LINK:
  3848. case LED_CTL_LINK:
  3849. case LED_CTL_SITE_SURVEY:
  3850. if( pLed->bLedNoLinkBlinkInProgress == _FALSE )
  3851. {
  3852. if(pLed->bLedBlinkInProgress == _TRUE)
  3853. {
  3854. _cancel_timer_ex(&(pLed->BlinkTimer));
  3855. pLed->bLedBlinkInProgress = _FALSE;
  3856. }
  3857. pLed->bLedNoLinkBlinkInProgress = _TRUE;
  3858. pLed->CurrLedState = LED_BLINK_SLOWLY;
  3859. if( pLed->bLedOn )
  3860. pLed->BlinkingLedState = RTW_LED_OFF;
  3861. else
  3862. pLed->BlinkingLedState = RTW_LED_ON;
  3863. _set_timer(&(pLed->BlinkTimer), LED_BLINK_NO_LINK_INTERVAL_ALPHA);
  3864. }
  3865. break;
  3866. case LED_CTL_TX:
  3867. case LED_CTL_RX:
  3868. if(pLed->bLedBlinkInProgress == _FALSE)
  3869. {
  3870. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3871. {
  3872. _cancel_timer_ex(&(pLed->BlinkTimer));
  3873. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3874. }
  3875. pLed->bLedBlinkInProgress = _TRUE;
  3876. pLed->CurrLedState = LED_BLINK_TXRX;
  3877. pLed->BlinkTimes = 2;
  3878. if( pLed->bLedOn )
  3879. pLed->BlinkingLedState = RTW_LED_OFF;
  3880. else
  3881. pLed->BlinkingLedState = RTW_LED_ON;
  3882. _set_timer(&(pLed->BlinkTimer), LED_BLINK_FASTER_INTERVAL_ALPHA);
  3883. }
  3884. break;
  3885. case LED_CTL_POWER_OFF:
  3886. pLed->CurrLedState = RTW_LED_OFF;
  3887. pLed->BlinkingLedState = RTW_LED_OFF;
  3888. if( pLed->bLedBlinkInProgress)
  3889. {
  3890. _cancel_timer_ex(&(pLed->BlinkTimer));
  3891. pLed->bLedBlinkInProgress = _FALSE;
  3892. }
  3893. if( pLed->bLedScanBlinkInProgress)
  3894. {
  3895. _cancel_timer_ex(&(pLed->BlinkTimer));
  3896. pLed->bLedScanBlinkInProgress = _FALSE;
  3897. }
  3898. if(pLed->bLedNoLinkBlinkInProgress == _TRUE)
  3899. {
  3900. _cancel_timer_ex(&(pLed->BlinkTimer));
  3901. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  3902. }
  3903. SwLedOff(Adapter, pLed);
  3904. break;
  3905. default:
  3906. break;
  3907. }
  3908. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("SWLed12 %d\n", pLed->CurrLedState));
  3909. }
  3910. // Maddest add for NETGEAR R6100
  3911. VOID
  3912. SwLedControlMode13(
  3913. IN PADAPTER Adapter,
  3914. IN LED_CTL_MODE LedAction
  3915. )
  3916. {
  3917. struct led_priv *ledpriv = &(Adapter->ledpriv);
  3918. struct mlme_priv *pmlmepriv = &Adapter->mlmepriv;
  3919. PLED_USB pLed = &(ledpriv->SwLed0);
  3920. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("Led control mode 13 CurrLedState %d, LedAction %d\n", pLed->CurrLedState,LedAction));
  3921. switch(LedAction)
  3922. {
  3923. case LED_CTL_LINK:
  3924. if(pLed->bLedWPSBlinkInProgress)
  3925. {
  3926. return;
  3927. }
  3928. pLed->CurrLedState = RTW_LED_ON;
  3929. pLed->BlinkingLedState = RTW_LED_ON;
  3930. if( pLed->bLedBlinkInProgress)
  3931. {
  3932. _cancel_timer_ex(&(pLed->BlinkTimer));
  3933. pLed->bLedBlinkInProgress = _FALSE;
  3934. }
  3935. if( pLed->bLedScanBlinkInProgress)
  3936. {
  3937. _cancel_timer_ex(&(pLed->BlinkTimer));
  3938. pLed->bLedScanBlinkInProgress = _FALSE;
  3939. }
  3940. _set_timer(&(pLed->BlinkTimer), 0);
  3941. break;
  3942. case LED_CTL_START_WPS: //wait until xinpin finish
  3943. case LED_CTL_START_WPS_BOTTON:
  3944. if(pLed->bLedWPSBlinkInProgress == _FALSE)
  3945. {
  3946. if(pLed->bLedBlinkInProgress == _TRUE)
  3947. {
  3948. _cancel_timer_ex(&(pLed->BlinkTimer));
  3949. pLed->bLedBlinkInProgress = _FALSE;
  3950. }
  3951. if(pLed->bLedScanBlinkInProgress == _TRUE)
  3952. {
  3953. _cancel_timer_ex(&(pLed->BlinkTimer));
  3954. pLed->bLedScanBlinkInProgress = _FALSE;
  3955. }
  3956. pLed->bLedWPSBlinkInProgress = _TRUE;
  3957. pLed->CurrLedState = LED_BLINK_WPS;
  3958. if( pLed->bLedOn )
  3959. {
  3960. pLed->BlinkingLedState = RTW_LED_OFF;
  3961. _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_OFF_INTERVAL_NETGEAR);
  3962. }
  3963. else
  3964. {
  3965. pLed->BlinkingLedState = RTW_LED_ON;
  3966. _set_timer(&(pLed->BlinkTimer), LED_WPS_BLINK_ON_INTERVAL_NETGEAR);
  3967. }
  3968. }
  3969. break;
  3970. case LED_CTL_STOP_WPS:
  3971. if(pLed->bLedWPSBlinkInProgress)
  3972. {
  3973. _cancel_timer_ex(&(pLed->BlinkTimer));
  3974. pLed->bLedWPSBlinkInProgress = _FALSE;
  3975. }
  3976. else
  3977. {
  3978. pLed->bLedWPSBlinkInProgress = _TRUE;
  3979. }
  3980. pLed->bLedWPSBlinkInProgress = _FALSE;
  3981. pLed->CurrLedState = LED_BLINK_WPS_STOP;
  3982. if(pLed->bLedOn)
  3983. {
  3984. pLed->BlinkingLedState = RTW_LED_OFF;
  3985. _set_timer(&(pLed->BlinkTimer), 0);
  3986. }
  3987. break;
  3988. case LED_CTL_STOP_WPS_FAIL:
  3989. case LED_CTL_STOP_WPS_FAIL_OVERLAP: //WPS session overlap
  3990. if(pLed->bLedWPSBlinkInProgress)
  3991. {
  3992. _cancel_timer_ex(&(pLed->BlinkTimer));
  3993. pLed->bLedWPSBlinkInProgress = _FALSE;
  3994. }
  3995. pLed->CurrLedState = RTW_LED_OFF;
  3996. pLed->BlinkingLedState = RTW_LED_OFF;
  3997. _set_timer(&(pLed->BlinkTimer), 0);
  3998. break;
  3999. case LED_CTL_START_TO_LINK:
  4000. if((pLed->bLedBlinkInProgress == _FALSE) && (pLed->bLedWPSBlinkInProgress == _FALSE))
  4001. {
  4002. pLed->bLedBlinkInProgress = _TRUE;
  4003. pLed->BlinkingLedState = RTW_LED_ON;
  4004. pLed->CurrLedState = LED_BLINK_LINK_IN_PROCESS;
  4005. _set_timer(&(pLed->BlinkTimer), 0);
  4006. }
  4007. break;
  4008. case LED_CTL_NO_LINK:
  4009. if(pLed->bLedWPSBlinkInProgress)
  4010. {
  4011. return;
  4012. }
  4013. if( pLed->bLedBlinkInProgress)
  4014. {
  4015. _cancel_timer_ex(&(pLed->BlinkTimer));
  4016. pLed->bLedBlinkInProgress = _FALSE;
  4017. }
  4018. if( pLed->bLedScanBlinkInProgress)
  4019. {
  4020. _cancel_timer_ex(&(pLed->BlinkTimer));
  4021. pLed->bLedScanBlinkInProgress = _FALSE;
  4022. }
  4023. //if(!IS_LED_BLINKING(pLed))
  4024. {
  4025. pLed->CurrLedState = RTW_LED_OFF;
  4026. pLed->BlinkingLedState = RTW_LED_OFF;
  4027. _set_timer(&(pLed->BlinkTimer), 0);
  4028. }
  4029. break;
  4030. case LED_CTL_POWER_OFF:
  4031. case LED_CTL_POWER_ON:
  4032. pLed->CurrLedState = RTW_LED_OFF;
  4033. pLed->BlinkingLedState = RTW_LED_OFF;
  4034. if( pLed->bLedBlinkInProgress)
  4035. {
  4036. _cancel_timer_ex(&(pLed->BlinkTimer));
  4037. pLed->bLedBlinkInProgress = _FALSE;
  4038. }
  4039. if( pLed->bLedScanBlinkInProgress)
  4040. {
  4041. _cancel_timer_ex(&(pLed->BlinkTimer));
  4042. pLed->bLedScanBlinkInProgress = _FALSE;
  4043. }
  4044. if( pLed->bLedWPSBlinkInProgress )
  4045. {
  4046. _cancel_timer_ex(&(pLed->BlinkTimer));
  4047. pLed->bLedWPSBlinkInProgress = _FALSE;
  4048. }
  4049. if (LedAction == LED_CTL_POWER_ON)
  4050. _set_timer(&(pLed->BlinkTimer), 0);
  4051. else
  4052. SwLedOff(Adapter, pLed);
  4053. break;
  4054. default:
  4055. break;
  4056. }
  4057. }
  4058. void
  4059. LedControlUSB(
  4060. _adapter *padapter,
  4061. LED_CTL_MODE LedAction
  4062. )
  4063. {
  4064. struct led_priv *ledpriv = &(padapter->ledpriv);
  4065. #if(MP_DRIVER == 1)
  4066. if (padapter->registrypriv.mp_mode == 1)
  4067. return;
  4068. #endif
  4069. if( (padapter->bSurpriseRemoved == _TRUE) ||(padapter->hw_init_completed == _FALSE) )
  4070. {
  4071. return;
  4072. }
  4073. if( ledpriv->bRegUseLed == _FALSE)
  4074. return;
  4075. //if(priv->bInHctTest)
  4076. // return;
  4077. #ifdef CONFIG_CONCURRENT_MODE
  4078. // Only do led action for PRIMARY_ADAPTER
  4079. if (padapter->adapter_type != PRIMARY_ADAPTER)
  4080. return;
  4081. #endif
  4082. if( (padapter->pwrctrlpriv.rf_pwrstate != rf_on &&
  4083. padapter->pwrctrlpriv.rfoff_reason > RF_CHANGE_BY_PS) &&
  4084. (LedAction == LED_CTL_TX || LedAction == LED_CTL_RX ||
  4085. LedAction == LED_CTL_SITE_SURVEY ||
  4086. LedAction == LED_CTL_LINK ||
  4087. LedAction == LED_CTL_NO_LINK ||
  4088. LedAction == LED_CTL_POWER_ON) )
  4089. {
  4090. return;
  4091. }
  4092. switch(ledpriv->LedStrategy)
  4093. {
  4094. case SW_LED_MODE0:
  4095. SwLedControlMode0(padapter, LedAction);
  4096. break;
  4097. case SW_LED_MODE1:
  4098. SwLedControlMode1(padapter, LedAction);
  4099. break;
  4100. case SW_LED_MODE2:
  4101. SwLedControlMode2(padapter, LedAction);
  4102. break;
  4103. case SW_LED_MODE3:
  4104. SwLedControlMode3(padapter, LedAction);
  4105. break;
  4106. case SW_LED_MODE4:
  4107. SwLedControlMode4(padapter, LedAction);
  4108. break;
  4109. case SW_LED_MODE5:
  4110. SwLedControlMode5(padapter, LedAction);
  4111. break;
  4112. case SW_LED_MODE6:
  4113. SwLedControlMode6(padapter, LedAction);
  4114. break;
  4115. case SW_LED_MODE7:
  4116. SwLedControlMode7(padapter, LedAction);
  4117. break;
  4118. case SW_LED_MODE8:
  4119. SwLedControlMode8(padapter, LedAction);
  4120. break;
  4121. case SW_LED_MODE9:
  4122. SwLedControlMode9(padapter, LedAction);
  4123. break;
  4124. case SW_LED_MODE10:
  4125. SwLedControlMode10(padapter, LedAction);
  4126. break;
  4127. case SW_LED_MODE11:
  4128. SwLedControlMode11(padapter, LedAction);
  4129. break;
  4130. case SW_LED_MODE12:
  4131. SwLedControlMode12(padapter, LedAction);
  4132. break;
  4133. case SW_LED_MODE13:
  4134. SwLedControlMode13(padapter, LedAction);
  4135. break;
  4136. default:
  4137. break;
  4138. }
  4139. RT_TRACE(_module_rtl8712_led_c_,_drv_info_,("LedStrategy:%d, LedAction %d\n", ledpriv->LedStrategy,LedAction));
  4140. }
  4141. //
  4142. // Description:
  4143. // Reset status of LED_871x object.
  4144. //
  4145. void ResetLedStatus(PLED_USB pLed) {
  4146. pLed->CurrLedState = RTW_LED_OFF; // Current LED state.
  4147. pLed->bLedOn = _FALSE; // true if LED is ON, false if LED is OFF.
  4148. pLed->bLedBlinkInProgress = _FALSE; // true if it is blinking, false o.w..
  4149. pLed->bLedWPSBlinkInProgress = _FALSE;
  4150. pLed->BlinkTimes = 0; // Number of times to toggle led state for blinking.
  4151. pLed->BlinkCounter = 0;
  4152. pLed->BlinkingLedState = LED_UNKNOWN; // Next state for blinking, either RTW_LED_ON or RTW_LED_OFF are.
  4153. pLed->bLedNoLinkBlinkInProgress = _FALSE;
  4154. pLed->bLedLinkBlinkInProgress = _FALSE;
  4155. pLed->bLedStartToLinkBlinkInProgress = _FALSE;
  4156. pLed->bLedScanBlinkInProgress = _FALSE;
  4157. }
  4158. //
  4159. // Description:
  4160. // Initialize an LED_871x object.
  4161. //
  4162. void
  4163. InitLed(
  4164. _adapter *padapter,
  4165. PLED_USB pLed,
  4166. LED_PIN LedPin
  4167. )
  4168. {
  4169. pLed->padapter = padapter;
  4170. pLed->LedPin = LedPin;
  4171. ResetLedStatus(pLed);
  4172. _init_timer(&(pLed->BlinkTimer), padapter->pnetdev, BlinkTimerCallback, pLed);
  4173. _init_workitem(&(pLed->BlinkWorkItem), BlinkWorkItemCallback, pLed);
  4174. }
  4175. //
  4176. // Description:
  4177. // DeInitialize an LED_871x object.
  4178. //
  4179. void
  4180. DeInitLed(
  4181. PLED_USB pLed
  4182. )
  4183. {
  4184. _cancel_workitem_sync(&(pLed->BlinkWorkItem));
  4185. _cancel_timer_ex(&(pLed->BlinkTimer));
  4186. ResetLedStatus(pLed);
  4187. }
  4188. void
  4189. rtw_led_control(
  4190. _adapter *adapter,
  4191. LED_CTL_MODE LedAction
  4192. )
  4193. {
  4194. if (adapter->registrypriv.led_enable)
  4195. {
  4196. do
  4197. {
  4198. (adapter)->ledpriv.LedControlHandler((adapter), (LedAction));
  4199. }
  4200. while(0);
  4201. }
  4202. }