baseband.c 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412
  1. /*
  2. * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
  3. * All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License along
  16. * with this program; if not, write to the Free Software Foundation, Inc.,
  17. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. *
  19. *
  20. * File: baseband.c
  21. *
  22. * Purpose: Implement functions to access baseband
  23. *
  24. * Author: Kyle Hsu
  25. *
  26. * Date: Aug.22, 2002
  27. *
  28. * Functions:
  29. * BBuGetFrameTime - Calculate data frame transmitting time
  30. * BBvCaculateParameter - Caculate PhyLength, PhyService and Phy Signal
  31. * parameter for baseband Tx
  32. * BBbReadEmbedded - Embedded read baseband register via MAC
  33. * BBbWriteEmbedded - Embedded write baseband register via MAC
  34. * BBbVT3253Init - VIA VT3253 baseband chip init code
  35. *
  36. * Revision History:
  37. * 06-10-2003 Bryan YC Fan: Re-write codes to support VT3253 spec.
  38. * 08-07-2003 Bryan YC Fan: Add MAXIM2827/2825 and RFMD2959 support.
  39. * 08-26-2003 Kyle Hsu : Modify BBuGetFrameTime() and
  40. * BBvCalculateParameter().
  41. * cancel the setting of MAC_REG_SOFTPWRCTL on
  42. * BBbVT3253Init().
  43. * Add the comments.
  44. * 09-01-2003 Bryan YC Fan: RF & BB tables updated.
  45. * Modified BBvLoopbackOn & BBvLoopbackOff().
  46. *
  47. *
  48. */
  49. #include "tmacro.h"
  50. #include "mac.h"
  51. #include "baseband.h"
  52. #include "srom.h"
  53. #include "rf.h"
  54. /*--------------------- Static Classes ----------------------------*/
  55. /*--------------------- Static Variables --------------------------*/
  56. /*--------------------- Static Functions --------------------------*/
  57. /*--------------------- Export Variables --------------------------*/
  58. /*--------------------- Static Definitions -------------------------*/
  59. /*--------------------- Static Classes ----------------------------*/
  60. /*--------------------- Static Variables --------------------------*/
  61. #define CB_VT3253_INIT_FOR_RFMD 446
  62. static const unsigned char byVT3253InitTab_RFMD[CB_VT3253_INIT_FOR_RFMD][2] = {
  63. {0x00, 0x30},
  64. {0x01, 0x00},
  65. {0x02, 0x00},
  66. {0x03, 0x00},
  67. {0x04, 0x00},
  68. {0x05, 0x00},
  69. {0x06, 0x00},
  70. {0x07, 0x00},
  71. {0x08, 0x70},
  72. {0x09, 0x45},
  73. {0x0a, 0x2a},
  74. {0x0b, 0x76},
  75. {0x0c, 0x00},
  76. {0x0d, 0x01},
  77. {0x0e, 0x80},
  78. {0x0f, 0x00},
  79. {0x10, 0x00},
  80. {0x11, 0x00},
  81. {0x12, 0x00},
  82. {0x13, 0x00},
  83. {0x14, 0x00},
  84. {0x15, 0x00},
  85. {0x16, 0x00},
  86. {0x17, 0x00},
  87. {0x18, 0x00},
  88. {0x19, 0x00},
  89. {0x1a, 0x00},
  90. {0x1b, 0x9d},
  91. {0x1c, 0x05},
  92. {0x1d, 0x00},
  93. {0x1e, 0x00},
  94. {0x1f, 0x00},
  95. {0x20, 0x00},
  96. {0x21, 0x00},
  97. {0x22, 0x00},
  98. {0x23, 0x00},
  99. {0x24, 0x00},
  100. {0x25, 0x4a},
  101. {0x26, 0x00},
  102. {0x27, 0x00},
  103. {0x28, 0x00},
  104. {0x29, 0x00},
  105. {0x2a, 0x00},
  106. {0x2b, 0x00},
  107. {0x2c, 0x00},
  108. {0x2d, 0xa8},
  109. {0x2e, 0x1a},
  110. {0x2f, 0x0c},
  111. {0x30, 0x26},
  112. {0x31, 0x5b},
  113. {0x32, 0x00},
  114. {0x33, 0x00},
  115. {0x34, 0x00},
  116. {0x35, 0x00},
  117. {0x36, 0xaa},
  118. {0x37, 0xaa},
  119. {0x38, 0xff},
  120. {0x39, 0xff},
  121. {0x3a, 0x00},
  122. {0x3b, 0x00},
  123. {0x3c, 0x00},
  124. {0x3d, 0x0d},
  125. {0x3e, 0x51},
  126. {0x3f, 0x04},
  127. {0x40, 0x00},
  128. {0x41, 0x08},
  129. {0x42, 0x00},
  130. {0x43, 0x08},
  131. {0x44, 0x06},
  132. {0x45, 0x14},
  133. {0x46, 0x05},
  134. {0x47, 0x08},
  135. {0x48, 0x00},
  136. {0x49, 0x00},
  137. {0x4a, 0x00},
  138. {0x4b, 0x00},
  139. {0x4c, 0x09},
  140. {0x4d, 0x80},
  141. {0x4e, 0x00},
  142. {0x4f, 0xc5},
  143. {0x50, 0x14},
  144. {0x51, 0x19},
  145. {0x52, 0x00},
  146. {0x53, 0x00},
  147. {0x54, 0x00},
  148. {0x55, 0x00},
  149. {0x56, 0x00},
  150. {0x57, 0x00},
  151. {0x58, 0x00},
  152. {0x59, 0xb0},
  153. {0x5a, 0x00},
  154. {0x5b, 0x00},
  155. {0x5c, 0x00},
  156. {0x5d, 0x00},
  157. {0x5e, 0x00},
  158. {0x5f, 0x00},
  159. {0x60, 0x44},
  160. {0x61, 0x04},
  161. {0x62, 0x00},
  162. {0x63, 0x00},
  163. {0x64, 0x00},
  164. {0x65, 0x00},
  165. {0x66, 0x04},
  166. {0x67, 0xb7},
  167. {0x68, 0x00},
  168. {0x69, 0x00},
  169. {0x6a, 0x00},
  170. {0x6b, 0x00},
  171. {0x6c, 0x00},
  172. {0x6d, 0x03},
  173. {0x6e, 0x01},
  174. {0x6f, 0x00},
  175. {0x70, 0x00},
  176. {0x71, 0x00},
  177. {0x72, 0x00},
  178. {0x73, 0x00},
  179. {0x74, 0x00},
  180. {0x75, 0x00},
  181. {0x76, 0x00},
  182. {0x77, 0x00},
  183. {0x78, 0x00},
  184. {0x79, 0x00},
  185. {0x7a, 0x00},
  186. {0x7b, 0x00},
  187. {0x7c, 0x00},
  188. {0x7d, 0x00},
  189. {0x7e, 0x00},
  190. {0x7f, 0x00},
  191. {0x80, 0x0b},
  192. {0x81, 0x00},
  193. {0x82, 0x3c},
  194. {0x83, 0x00},
  195. {0x84, 0x00},
  196. {0x85, 0x00},
  197. {0x86, 0x00},
  198. {0x87, 0x00},
  199. {0x88, 0x08},
  200. {0x89, 0x00},
  201. {0x8a, 0x08},
  202. {0x8b, 0xa6},
  203. {0x8c, 0x84},
  204. {0x8d, 0x47},
  205. {0x8e, 0xbb},
  206. {0x8f, 0x02},
  207. {0x90, 0x21},
  208. {0x91, 0x0c},
  209. {0x92, 0x04},
  210. {0x93, 0x22},
  211. {0x94, 0x00},
  212. {0x95, 0x00},
  213. {0x96, 0x00},
  214. {0x97, 0xeb},
  215. {0x98, 0x00},
  216. {0x99, 0x00},
  217. {0x9a, 0x00},
  218. {0x9b, 0x00},
  219. {0x9c, 0x00},
  220. {0x9d, 0x00},
  221. {0x9e, 0x00},
  222. {0x9f, 0x00},
  223. {0xa0, 0x00},
  224. {0xa1, 0x00},
  225. {0xa2, 0x00},
  226. {0xa3, 0x00},
  227. {0xa4, 0x00},
  228. {0xa5, 0x00},
  229. {0xa6, 0x10},
  230. {0xa7, 0x04},
  231. {0xa8, 0x10},
  232. {0xa9, 0x00},
  233. {0xaa, 0x8f},
  234. {0xab, 0x00},
  235. {0xac, 0x00},
  236. {0xad, 0x00},
  237. {0xae, 0x00},
  238. {0xaf, 0x80},
  239. {0xb0, 0x38},
  240. {0xb1, 0x00},
  241. {0xb2, 0x00},
  242. {0xb3, 0x00},
  243. {0xb4, 0xee},
  244. {0xb5, 0xff},
  245. {0xb6, 0x10},
  246. {0xb7, 0x00},
  247. {0xb8, 0x00},
  248. {0xb9, 0x00},
  249. {0xba, 0x00},
  250. {0xbb, 0x03},
  251. {0xbc, 0x00},
  252. {0xbd, 0x00},
  253. {0xbe, 0x00},
  254. {0xbf, 0x00},
  255. {0xc0, 0x10},
  256. {0xc1, 0x10},
  257. {0xc2, 0x18},
  258. {0xc3, 0x20},
  259. {0xc4, 0x10},
  260. {0xc5, 0x00},
  261. {0xc6, 0x22},
  262. {0xc7, 0x14},
  263. {0xc8, 0x0f},
  264. {0xc9, 0x08},
  265. {0xca, 0xa4},
  266. {0xcb, 0xa7},
  267. {0xcc, 0x3c},
  268. {0xcd, 0x10},
  269. {0xce, 0x20},
  270. {0xcf, 0x00},
  271. {0xd0, 0x00},
  272. {0xd1, 0x10},
  273. {0xd2, 0x00},
  274. {0xd3, 0x00},
  275. {0xd4, 0x10},
  276. {0xd5, 0x33},
  277. {0xd6, 0x70},
  278. {0xd7, 0x01},
  279. {0xd8, 0x00},
  280. {0xd9, 0x00},
  281. {0xda, 0x00},
  282. {0xdb, 0x00},
  283. {0xdc, 0x00},
  284. {0xdd, 0x00},
  285. {0xde, 0x00},
  286. {0xdf, 0x00},
  287. {0xe0, 0x00},
  288. {0xe1, 0x00},
  289. {0xe2, 0xcc},
  290. {0xe3, 0x04},
  291. {0xe4, 0x08},
  292. {0xe5, 0x10},
  293. {0xe6, 0x00},
  294. {0xe7, 0x0e},
  295. {0xe8, 0x88},
  296. {0xe9, 0xd4},
  297. {0xea, 0x05},
  298. {0xeb, 0xf0},
  299. {0xec, 0x79},
  300. {0xed, 0x0f},
  301. {0xee, 0x04},
  302. {0xef, 0x04},
  303. {0xf0, 0x00},
  304. {0xf1, 0x00},
  305. {0xf2, 0x00},
  306. {0xf3, 0x00},
  307. {0xf4, 0x00},
  308. {0xf5, 0x00},
  309. {0xf6, 0x00},
  310. {0xf7, 0x00},
  311. {0xf8, 0x00},
  312. {0xf9, 0x00},
  313. {0xF0, 0x00},
  314. {0xF1, 0xF8},
  315. {0xF0, 0x80},
  316. {0xF0, 0x00},
  317. {0xF1, 0xF4},
  318. {0xF0, 0x81},
  319. {0xF0, 0x01},
  320. {0xF1, 0xF0},
  321. {0xF0, 0x82},
  322. {0xF0, 0x02},
  323. {0xF1, 0xEC},
  324. {0xF0, 0x83},
  325. {0xF0, 0x03},
  326. {0xF1, 0xE8},
  327. {0xF0, 0x84},
  328. {0xF0, 0x04},
  329. {0xF1, 0xE4},
  330. {0xF0, 0x85},
  331. {0xF0, 0x05},
  332. {0xF1, 0xE0},
  333. {0xF0, 0x86},
  334. {0xF0, 0x06},
  335. {0xF1, 0xDC},
  336. {0xF0, 0x87},
  337. {0xF0, 0x07},
  338. {0xF1, 0xD8},
  339. {0xF0, 0x88},
  340. {0xF0, 0x08},
  341. {0xF1, 0xD4},
  342. {0xF0, 0x89},
  343. {0xF0, 0x09},
  344. {0xF1, 0xD0},
  345. {0xF0, 0x8A},
  346. {0xF0, 0x0A},
  347. {0xF1, 0xCC},
  348. {0xF0, 0x8B},
  349. {0xF0, 0x0B},
  350. {0xF1, 0xC8},
  351. {0xF0, 0x8C},
  352. {0xF0, 0x0C},
  353. {0xF1, 0xC4},
  354. {0xF0, 0x8D},
  355. {0xF0, 0x0D},
  356. {0xF1, 0xC0},
  357. {0xF0, 0x8E},
  358. {0xF0, 0x0E},
  359. {0xF1, 0xBC},
  360. {0xF0, 0x8F},
  361. {0xF0, 0x0F},
  362. {0xF1, 0xB8},
  363. {0xF0, 0x90},
  364. {0xF0, 0x10},
  365. {0xF1, 0xB4},
  366. {0xF0, 0x91},
  367. {0xF0, 0x11},
  368. {0xF1, 0xB0},
  369. {0xF0, 0x92},
  370. {0xF0, 0x12},
  371. {0xF1, 0xAC},
  372. {0xF0, 0x93},
  373. {0xF0, 0x13},
  374. {0xF1, 0xA8},
  375. {0xF0, 0x94},
  376. {0xF0, 0x14},
  377. {0xF1, 0xA4},
  378. {0xF0, 0x95},
  379. {0xF0, 0x15},
  380. {0xF1, 0xA0},
  381. {0xF0, 0x96},
  382. {0xF0, 0x16},
  383. {0xF1, 0x9C},
  384. {0xF0, 0x97},
  385. {0xF0, 0x17},
  386. {0xF1, 0x98},
  387. {0xF0, 0x98},
  388. {0xF0, 0x18},
  389. {0xF1, 0x94},
  390. {0xF0, 0x99},
  391. {0xF0, 0x19},
  392. {0xF1, 0x90},
  393. {0xF0, 0x9A},
  394. {0xF0, 0x1A},
  395. {0xF1, 0x8C},
  396. {0xF0, 0x9B},
  397. {0xF0, 0x1B},
  398. {0xF1, 0x88},
  399. {0xF0, 0x9C},
  400. {0xF0, 0x1C},
  401. {0xF1, 0x84},
  402. {0xF0, 0x9D},
  403. {0xF0, 0x1D},
  404. {0xF1, 0x80},
  405. {0xF0, 0x9E},
  406. {0xF0, 0x1E},
  407. {0xF1, 0x7C},
  408. {0xF0, 0x9F},
  409. {0xF0, 0x1F},
  410. {0xF1, 0x78},
  411. {0xF0, 0xA0},
  412. {0xF0, 0x20},
  413. {0xF1, 0x74},
  414. {0xF0, 0xA1},
  415. {0xF0, 0x21},
  416. {0xF1, 0x70},
  417. {0xF0, 0xA2},
  418. {0xF0, 0x22},
  419. {0xF1, 0x6C},
  420. {0xF0, 0xA3},
  421. {0xF0, 0x23},
  422. {0xF1, 0x68},
  423. {0xF0, 0xA4},
  424. {0xF0, 0x24},
  425. {0xF1, 0x64},
  426. {0xF0, 0xA5},
  427. {0xF0, 0x25},
  428. {0xF1, 0x60},
  429. {0xF0, 0xA6},
  430. {0xF0, 0x26},
  431. {0xF1, 0x5C},
  432. {0xF0, 0xA7},
  433. {0xF0, 0x27},
  434. {0xF1, 0x58},
  435. {0xF0, 0xA8},
  436. {0xF0, 0x28},
  437. {0xF1, 0x54},
  438. {0xF0, 0xA9},
  439. {0xF0, 0x29},
  440. {0xF1, 0x50},
  441. {0xF0, 0xAA},
  442. {0xF0, 0x2A},
  443. {0xF1, 0x4C},
  444. {0xF0, 0xAB},
  445. {0xF0, 0x2B},
  446. {0xF1, 0x48},
  447. {0xF0, 0xAC},
  448. {0xF0, 0x2C},
  449. {0xF1, 0x44},
  450. {0xF0, 0xAD},
  451. {0xF0, 0x2D},
  452. {0xF1, 0x40},
  453. {0xF0, 0xAE},
  454. {0xF0, 0x2E},
  455. {0xF1, 0x3C},
  456. {0xF0, 0xAF},
  457. {0xF0, 0x2F},
  458. {0xF1, 0x38},
  459. {0xF0, 0xB0},
  460. {0xF0, 0x30},
  461. {0xF1, 0x34},
  462. {0xF0, 0xB1},
  463. {0xF0, 0x31},
  464. {0xF1, 0x30},
  465. {0xF0, 0xB2},
  466. {0xF0, 0x32},
  467. {0xF1, 0x2C},
  468. {0xF0, 0xB3},
  469. {0xF0, 0x33},
  470. {0xF1, 0x28},
  471. {0xF0, 0xB4},
  472. {0xF0, 0x34},
  473. {0xF1, 0x24},
  474. {0xF0, 0xB5},
  475. {0xF0, 0x35},
  476. {0xF1, 0x20},
  477. {0xF0, 0xB6},
  478. {0xF0, 0x36},
  479. {0xF1, 0x1C},
  480. {0xF0, 0xB7},
  481. {0xF0, 0x37},
  482. {0xF1, 0x18},
  483. {0xF0, 0xB8},
  484. {0xF0, 0x38},
  485. {0xF1, 0x14},
  486. {0xF0, 0xB9},
  487. {0xF0, 0x39},
  488. {0xF1, 0x10},
  489. {0xF0, 0xBA},
  490. {0xF0, 0x3A},
  491. {0xF1, 0x0C},
  492. {0xF0, 0xBB},
  493. {0xF0, 0x3B},
  494. {0xF1, 0x08},
  495. {0xF0, 0x00},
  496. {0xF0, 0x3C},
  497. {0xF1, 0x04},
  498. {0xF0, 0xBD},
  499. {0xF0, 0x3D},
  500. {0xF1, 0x00},
  501. {0xF0, 0xBE},
  502. {0xF0, 0x3E},
  503. {0xF1, 0x00},
  504. {0xF0, 0xBF},
  505. {0xF0, 0x3F},
  506. {0xF1, 0x00},
  507. {0xF0, 0xC0},
  508. {0xF0, 0x00},
  509. };
  510. #define CB_VT3253B0_INIT_FOR_RFMD 256
  511. static const unsigned char byVT3253B0_RFMD[CB_VT3253B0_INIT_FOR_RFMD][2] = {
  512. {0x00, 0x31},
  513. {0x01, 0x00},
  514. {0x02, 0x00},
  515. {0x03, 0x00},
  516. {0x04, 0x00},
  517. {0x05, 0x81},
  518. {0x06, 0x00},
  519. {0x07, 0x00},
  520. {0x08, 0x38},
  521. {0x09, 0x45},
  522. {0x0a, 0x2a},
  523. {0x0b, 0x76},
  524. {0x0c, 0x00},
  525. {0x0d, 0x00},
  526. {0x0e, 0x80},
  527. {0x0f, 0x00},
  528. {0x10, 0x00},
  529. {0x11, 0x00},
  530. {0x12, 0x00},
  531. {0x13, 0x00},
  532. {0x14, 0x00},
  533. {0x15, 0x00},
  534. {0x16, 0x00},
  535. {0x17, 0x00},
  536. {0x18, 0x00},
  537. {0x19, 0x00},
  538. {0x1a, 0x00},
  539. {0x1b, 0x8e},
  540. {0x1c, 0x06},
  541. {0x1d, 0x00},
  542. {0x1e, 0x00},
  543. {0x1f, 0x00},
  544. {0x20, 0x00},
  545. {0x21, 0x00},
  546. {0x22, 0x00},
  547. {0x23, 0x00},
  548. {0x24, 0x00},
  549. {0x25, 0x4a},
  550. {0x26, 0x00},
  551. {0x27, 0x00},
  552. {0x28, 0x00},
  553. {0x29, 0x00},
  554. {0x2a, 0x00},
  555. {0x2b, 0x00},
  556. {0x2c, 0x00},
  557. {0x2d, 0x34},
  558. {0x2e, 0x18},
  559. {0x2f, 0x0c},
  560. {0x30, 0x26},
  561. {0x31, 0x5b},
  562. {0x32, 0x00},
  563. {0x33, 0x00},
  564. {0x34, 0x00},
  565. {0x35, 0x00},
  566. {0x36, 0xaa},
  567. {0x37, 0xaa},
  568. {0x38, 0xff},
  569. {0x39, 0xff},
  570. {0x3a, 0xf8},
  571. {0x3b, 0x00},
  572. {0x3c, 0x00},
  573. {0x3d, 0x09},
  574. {0x3e, 0x0d},
  575. {0x3f, 0x04},
  576. {0x40, 0x00},
  577. {0x41, 0x08},
  578. {0x42, 0x00},
  579. {0x43, 0x08},
  580. {0x44, 0x08},
  581. {0x45, 0x14},
  582. {0x46, 0x05},
  583. {0x47, 0x08},
  584. {0x48, 0x00},
  585. {0x49, 0x00},
  586. {0x4a, 0x00},
  587. {0x4b, 0x00},
  588. {0x4c, 0x09},
  589. {0x4d, 0x80},
  590. {0x4e, 0x00},
  591. {0x4f, 0xc5},
  592. {0x50, 0x14},
  593. {0x51, 0x19},
  594. {0x52, 0x00},
  595. {0x53, 0x00},
  596. {0x54, 0x00},
  597. {0x55, 0x00},
  598. {0x56, 0x00},
  599. {0x57, 0x00},
  600. {0x58, 0x00},
  601. {0x59, 0xb0},
  602. {0x5a, 0x00},
  603. {0x5b, 0x00},
  604. {0x5c, 0x00},
  605. {0x5d, 0x00},
  606. {0x5e, 0x00},
  607. {0x5f, 0x00},
  608. {0x60, 0x39},
  609. {0x61, 0x83},
  610. {0x62, 0x00},
  611. {0x63, 0x00},
  612. {0x64, 0x00},
  613. {0x65, 0x00},
  614. {0x66, 0xc0},
  615. {0x67, 0x49},
  616. {0x68, 0x00},
  617. {0x69, 0x00},
  618. {0x6a, 0x00},
  619. {0x6b, 0x00},
  620. {0x6c, 0x00},
  621. {0x6d, 0x03},
  622. {0x6e, 0x01},
  623. {0x6f, 0x00},
  624. {0x70, 0x00},
  625. {0x71, 0x00},
  626. {0x72, 0x00},
  627. {0x73, 0x00},
  628. {0x74, 0x00},
  629. {0x75, 0x00},
  630. {0x76, 0x00},
  631. {0x77, 0x00},
  632. {0x78, 0x00},
  633. {0x79, 0x00},
  634. {0x7a, 0x00},
  635. {0x7b, 0x00},
  636. {0x7c, 0x00},
  637. {0x7d, 0x00},
  638. {0x7e, 0x00},
  639. {0x7f, 0x00},
  640. {0x80, 0x89},
  641. {0x81, 0x00},
  642. {0x82, 0x0e},
  643. {0x83, 0x00},
  644. {0x84, 0x00},
  645. {0x85, 0x00},
  646. {0x86, 0x00},
  647. {0x87, 0x00},
  648. {0x88, 0x08},
  649. {0x89, 0x00},
  650. {0x8a, 0x0e},
  651. {0x8b, 0xa7},
  652. {0x8c, 0x88},
  653. {0x8d, 0x47},
  654. {0x8e, 0xaa},
  655. {0x8f, 0x02},
  656. {0x90, 0x23},
  657. {0x91, 0x0c},
  658. {0x92, 0x06},
  659. {0x93, 0x08},
  660. {0x94, 0x00},
  661. {0x95, 0x00},
  662. {0x96, 0x00},
  663. {0x97, 0xeb},
  664. {0x98, 0x00},
  665. {0x99, 0x00},
  666. {0x9a, 0x00},
  667. {0x9b, 0x00},
  668. {0x9c, 0x00},
  669. {0x9d, 0x00},
  670. {0x9e, 0x00},
  671. {0x9f, 0x00},
  672. {0xa0, 0x00},
  673. {0xa1, 0x00},
  674. {0xa2, 0x00},
  675. {0xa3, 0xcd},
  676. {0xa4, 0x07},
  677. {0xa5, 0x33},
  678. {0xa6, 0x18},
  679. {0xa7, 0x00},
  680. {0xa8, 0x18},
  681. {0xa9, 0x00},
  682. {0xaa, 0x28},
  683. {0xab, 0x00},
  684. {0xac, 0x00},
  685. {0xad, 0x00},
  686. {0xae, 0x00},
  687. {0xaf, 0x18},
  688. {0xb0, 0x38},
  689. {0xb1, 0x30},
  690. {0xb2, 0x00},
  691. {0xb3, 0x00},
  692. {0xb4, 0x00},
  693. {0xb5, 0x00},
  694. {0xb6, 0x84},
  695. {0xb7, 0xfd},
  696. {0xb8, 0x00},
  697. {0xb9, 0x00},
  698. {0xba, 0x00},
  699. {0xbb, 0x03},
  700. {0xbc, 0x00},
  701. {0xbd, 0x00},
  702. {0xbe, 0x00},
  703. {0xbf, 0x00},
  704. {0xc0, 0x10},
  705. {0xc1, 0x20},
  706. {0xc2, 0x18},
  707. {0xc3, 0x20},
  708. {0xc4, 0x10},
  709. {0xc5, 0x2c},
  710. {0xc6, 0x1e},
  711. {0xc7, 0x10},
  712. {0xc8, 0x12},
  713. {0xc9, 0x01},
  714. {0xca, 0x6f},
  715. {0xcb, 0xa7},
  716. {0xcc, 0x3c},
  717. {0xcd, 0x10},
  718. {0xce, 0x00},
  719. {0xcf, 0x22},
  720. {0xd0, 0x00},
  721. {0xd1, 0x10},
  722. {0xd2, 0x00},
  723. {0xd3, 0x00},
  724. {0xd4, 0x10},
  725. {0xd5, 0x33},
  726. {0xd6, 0x80},
  727. {0xd7, 0x21},
  728. {0xd8, 0x00},
  729. {0xd9, 0x00},
  730. {0xda, 0x00},
  731. {0xdb, 0x00},
  732. {0xdc, 0x00},
  733. {0xdd, 0x00},
  734. {0xde, 0x00},
  735. {0xdf, 0x00},
  736. {0xe0, 0x00},
  737. {0xe1, 0xB3},
  738. {0xe2, 0x00},
  739. {0xe3, 0x00},
  740. {0xe4, 0x00},
  741. {0xe5, 0x10},
  742. {0xe6, 0x00},
  743. {0xe7, 0x18},
  744. {0xe8, 0x08},
  745. {0xe9, 0xd4},
  746. {0xea, 0x00},
  747. {0xeb, 0xff},
  748. {0xec, 0x79},
  749. {0xed, 0x10},
  750. {0xee, 0x30},
  751. {0xef, 0x02},
  752. {0xf0, 0x00},
  753. {0xf1, 0x09},
  754. {0xf2, 0x00},
  755. {0xf3, 0x00},
  756. {0xf4, 0x00},
  757. {0xf5, 0x00},
  758. {0xf6, 0x00},
  759. {0xf7, 0x00},
  760. {0xf8, 0x00},
  761. {0xf9, 0x00},
  762. {0xfa, 0x00},
  763. {0xfb, 0x00},
  764. {0xfc, 0x00},
  765. {0xfd, 0x00},
  766. {0xfe, 0x00},
  767. {0xff, 0x00},
  768. };
  769. #define CB_VT3253B0_AGC_FOR_RFMD2959 195
  770. /* For RFMD2959 */
  771. static
  772. unsigned char byVT3253B0_AGC4_RFMD2959[CB_VT3253B0_AGC_FOR_RFMD2959][2] = {
  773. {0xF0, 0x00},
  774. {0xF1, 0x3E},
  775. {0xF0, 0x80},
  776. {0xF0, 0x00},
  777. {0xF1, 0x3E},
  778. {0xF0, 0x81},
  779. {0xF0, 0x01},
  780. {0xF1, 0x3E},
  781. {0xF0, 0x82},
  782. {0xF0, 0x02},
  783. {0xF1, 0x3E},
  784. {0xF0, 0x83},
  785. {0xF0, 0x03},
  786. {0xF1, 0x3B},
  787. {0xF0, 0x84},
  788. {0xF0, 0x04},
  789. {0xF1, 0x39},
  790. {0xF0, 0x85},
  791. {0xF0, 0x05},
  792. {0xF1, 0x38},
  793. {0xF0, 0x86},
  794. {0xF0, 0x06},
  795. {0xF1, 0x37},
  796. {0xF0, 0x87},
  797. {0xF0, 0x07},
  798. {0xF1, 0x36},
  799. {0xF0, 0x88},
  800. {0xF0, 0x08},
  801. {0xF1, 0x35},
  802. {0xF0, 0x89},
  803. {0xF0, 0x09},
  804. {0xF1, 0x35},
  805. {0xF0, 0x8A},
  806. {0xF0, 0x0A},
  807. {0xF1, 0x34},
  808. {0xF0, 0x8B},
  809. {0xF0, 0x0B},
  810. {0xF1, 0x34},
  811. {0xF0, 0x8C},
  812. {0xF0, 0x0C},
  813. {0xF1, 0x33},
  814. {0xF0, 0x8D},
  815. {0xF0, 0x0D},
  816. {0xF1, 0x32},
  817. {0xF0, 0x8E},
  818. {0xF0, 0x0E},
  819. {0xF1, 0x31},
  820. {0xF0, 0x8F},
  821. {0xF0, 0x0F},
  822. {0xF1, 0x30},
  823. {0xF0, 0x90},
  824. {0xF0, 0x10},
  825. {0xF1, 0x2F},
  826. {0xF0, 0x91},
  827. {0xF0, 0x11},
  828. {0xF1, 0x2F},
  829. {0xF0, 0x92},
  830. {0xF0, 0x12},
  831. {0xF1, 0x2E},
  832. {0xF0, 0x93},
  833. {0xF0, 0x13},
  834. {0xF1, 0x2D},
  835. {0xF0, 0x94},
  836. {0xF0, 0x14},
  837. {0xF1, 0x2C},
  838. {0xF0, 0x95},
  839. {0xF0, 0x15},
  840. {0xF1, 0x2B},
  841. {0xF0, 0x96},
  842. {0xF0, 0x16},
  843. {0xF1, 0x2B},
  844. {0xF0, 0x97},
  845. {0xF0, 0x17},
  846. {0xF1, 0x2A},
  847. {0xF0, 0x98},
  848. {0xF0, 0x18},
  849. {0xF1, 0x29},
  850. {0xF0, 0x99},
  851. {0xF0, 0x19},
  852. {0xF1, 0x28},
  853. {0xF0, 0x9A},
  854. {0xF0, 0x1A},
  855. {0xF1, 0x27},
  856. {0xF0, 0x9B},
  857. {0xF0, 0x1B},
  858. {0xF1, 0x26},
  859. {0xF0, 0x9C},
  860. {0xF0, 0x1C},
  861. {0xF1, 0x25},
  862. {0xF0, 0x9D},
  863. {0xF0, 0x1D},
  864. {0xF1, 0x24},
  865. {0xF0, 0x9E},
  866. {0xF0, 0x1E},
  867. {0xF1, 0x24},
  868. {0xF0, 0x9F},
  869. {0xF0, 0x1F},
  870. {0xF1, 0x23},
  871. {0xF0, 0xA0},
  872. {0xF0, 0x20},
  873. {0xF1, 0x22},
  874. {0xF0, 0xA1},
  875. {0xF0, 0x21},
  876. {0xF1, 0x21},
  877. {0xF0, 0xA2},
  878. {0xF0, 0x22},
  879. {0xF1, 0x20},
  880. {0xF0, 0xA3},
  881. {0xF0, 0x23},
  882. {0xF1, 0x20},
  883. {0xF0, 0xA4},
  884. {0xF0, 0x24},
  885. {0xF1, 0x1F},
  886. {0xF0, 0xA5},
  887. {0xF0, 0x25},
  888. {0xF1, 0x1E},
  889. {0xF0, 0xA6},
  890. {0xF0, 0x26},
  891. {0xF1, 0x1D},
  892. {0xF0, 0xA7},
  893. {0xF0, 0x27},
  894. {0xF1, 0x1C},
  895. {0xF0, 0xA8},
  896. {0xF0, 0x28},
  897. {0xF1, 0x1B},
  898. {0xF0, 0xA9},
  899. {0xF0, 0x29},
  900. {0xF1, 0x1B},
  901. {0xF0, 0xAA},
  902. {0xF0, 0x2A},
  903. {0xF1, 0x1A},
  904. {0xF0, 0xAB},
  905. {0xF0, 0x2B},
  906. {0xF1, 0x1A},
  907. {0xF0, 0xAC},
  908. {0xF0, 0x2C},
  909. {0xF1, 0x19},
  910. {0xF0, 0xAD},
  911. {0xF0, 0x2D},
  912. {0xF1, 0x18},
  913. {0xF0, 0xAE},
  914. {0xF0, 0x2E},
  915. {0xF1, 0x17},
  916. {0xF0, 0xAF},
  917. {0xF0, 0x2F},
  918. {0xF1, 0x16},
  919. {0xF0, 0xB0},
  920. {0xF0, 0x30},
  921. {0xF1, 0x15},
  922. {0xF0, 0xB1},
  923. {0xF0, 0x31},
  924. {0xF1, 0x15},
  925. {0xF0, 0xB2},
  926. {0xF0, 0x32},
  927. {0xF1, 0x15},
  928. {0xF0, 0xB3},
  929. {0xF0, 0x33},
  930. {0xF1, 0x14},
  931. {0xF0, 0xB4},
  932. {0xF0, 0x34},
  933. {0xF1, 0x13},
  934. {0xF0, 0xB5},
  935. {0xF0, 0x35},
  936. {0xF1, 0x12},
  937. {0xF0, 0xB6},
  938. {0xF0, 0x36},
  939. {0xF1, 0x11},
  940. {0xF0, 0xB7},
  941. {0xF0, 0x37},
  942. {0xF1, 0x10},
  943. {0xF0, 0xB8},
  944. {0xF0, 0x38},
  945. {0xF1, 0x0F},
  946. {0xF0, 0xB9},
  947. {0xF0, 0x39},
  948. {0xF1, 0x0E},
  949. {0xF0, 0xBA},
  950. {0xF0, 0x3A},
  951. {0xF1, 0x0D},
  952. {0xF0, 0xBB},
  953. {0xF0, 0x3B},
  954. {0xF1, 0x0C},
  955. {0xF0, 0xBC},
  956. {0xF0, 0x3C},
  957. {0xF1, 0x0B},
  958. {0xF0, 0xBD},
  959. {0xF0, 0x3D},
  960. {0xF1, 0x0B},
  961. {0xF0, 0xBE},
  962. {0xF0, 0x3E},
  963. {0xF1, 0x0A},
  964. {0xF0, 0xBF},
  965. {0xF0, 0x3F},
  966. {0xF1, 0x09},
  967. {0xF0, 0x00},
  968. };
  969. #define CB_VT3253B0_INIT_FOR_AIROHA2230 256
  970. /* For AIROHA */
  971. static
  972. unsigned char byVT3253B0_AIROHA2230[CB_VT3253B0_INIT_FOR_AIROHA2230][2] = {
  973. {0x00, 0x31},
  974. {0x01, 0x00},
  975. {0x02, 0x00},
  976. {0x03, 0x00},
  977. {0x04, 0x00},
  978. {0x05, 0x80},
  979. {0x06, 0x00},
  980. {0x07, 0x00},
  981. {0x08, 0x70},
  982. {0x09, 0x41},
  983. {0x0a, 0x2A},
  984. {0x0b, 0x76},
  985. {0x0c, 0x00},
  986. {0x0d, 0x00},
  987. {0x0e, 0x80},
  988. {0x0f, 0x00},
  989. {0x10, 0x00},
  990. {0x11, 0x00},
  991. {0x12, 0x00},
  992. {0x13, 0x00},
  993. {0x14, 0x00},
  994. {0x15, 0x00},
  995. {0x16, 0x00},
  996. {0x17, 0x00},
  997. {0x18, 0x00},
  998. {0x19, 0x00},
  999. {0x1a, 0x00},
  1000. {0x1b, 0x8f},
  1001. {0x1c, 0x09},
  1002. {0x1d, 0x00},
  1003. {0x1e, 0x00},
  1004. {0x1f, 0x00},
  1005. {0x20, 0x00},
  1006. {0x21, 0x00},
  1007. {0x22, 0x00},
  1008. {0x23, 0x00},
  1009. {0x24, 0x00},
  1010. {0x25, 0x4a},
  1011. {0x26, 0x00},
  1012. {0x27, 0x00},
  1013. {0x28, 0x00},
  1014. {0x29, 0x00},
  1015. {0x2a, 0x00},
  1016. {0x2b, 0x00},
  1017. {0x2c, 0x00},
  1018. {0x2d, 0x4a},
  1019. {0x2e, 0x00},
  1020. {0x2f, 0x0a},
  1021. {0x30, 0x26},
  1022. {0x31, 0x5b},
  1023. {0x32, 0x00},
  1024. {0x33, 0x00},
  1025. {0x34, 0x00},
  1026. {0x35, 0x00},
  1027. {0x36, 0xaa},
  1028. {0x37, 0xaa},
  1029. {0x38, 0xff},
  1030. {0x39, 0xff},
  1031. {0x3a, 0x79},
  1032. {0x3b, 0x00},
  1033. {0x3c, 0x00},
  1034. {0x3d, 0x0b},
  1035. {0x3e, 0x48},
  1036. {0x3f, 0x04},
  1037. {0x40, 0x00},
  1038. {0x41, 0x08},
  1039. {0x42, 0x00},
  1040. {0x43, 0x08},
  1041. {0x44, 0x08},
  1042. {0x45, 0x14},
  1043. {0x46, 0x05},
  1044. {0x47, 0x09},
  1045. {0x48, 0x00},
  1046. {0x49, 0x00},
  1047. {0x4a, 0x00},
  1048. {0x4b, 0x00},
  1049. {0x4c, 0x09},
  1050. {0x4d, 0x73},
  1051. {0x4e, 0x00},
  1052. {0x4f, 0xc5},
  1053. {0x50, 0x15},
  1054. {0x51, 0x19},
  1055. {0x52, 0x00},
  1056. {0x53, 0x00},
  1057. {0x54, 0x00},
  1058. {0x55, 0x00},
  1059. {0x56, 0x00},
  1060. {0x57, 0x00},
  1061. {0x58, 0x00},
  1062. {0x59, 0xb0},
  1063. {0x5a, 0x00},
  1064. {0x5b, 0x00},
  1065. {0x5c, 0x00},
  1066. {0x5d, 0x00},
  1067. {0x5e, 0x00},
  1068. {0x5f, 0x00},
  1069. {0x60, 0xe4},
  1070. {0x61, 0x80},
  1071. {0x62, 0x00},
  1072. {0x63, 0x00},
  1073. {0x64, 0x00},
  1074. {0x65, 0x00},
  1075. {0x66, 0x98},
  1076. {0x67, 0x0a},
  1077. {0x68, 0x00},
  1078. {0x69, 0x00},
  1079. {0x6a, 0x00},
  1080. {0x6b, 0x00},
  1081. {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
  1082. {0x6d, 0x03},
  1083. {0x6e, 0x01},
  1084. {0x6f, 0x00},
  1085. {0x70, 0x00},
  1086. {0x71, 0x00},
  1087. {0x72, 0x00},
  1088. {0x73, 0x00},
  1089. {0x74, 0x00},
  1090. {0x75, 0x00},
  1091. {0x76, 0x00},
  1092. {0x77, 0x00},
  1093. {0x78, 0x00},
  1094. {0x79, 0x00},
  1095. {0x7a, 0x00},
  1096. {0x7b, 0x00},
  1097. {0x7c, 0x00},
  1098. {0x7d, 0x00},
  1099. {0x7e, 0x00},
  1100. {0x7f, 0x00},
  1101. {0x80, 0x8c},
  1102. {0x81, 0x01},
  1103. {0x82, 0x09},
  1104. {0x83, 0x00},
  1105. {0x84, 0x00},
  1106. {0x85, 0x00},
  1107. {0x86, 0x00},
  1108. {0x87, 0x00},
  1109. {0x88, 0x08},
  1110. {0x89, 0x00},
  1111. {0x8a, 0x0f},
  1112. {0x8b, 0xb7},
  1113. {0x8c, 0x88},
  1114. {0x8d, 0x47},
  1115. {0x8e, 0xaa},
  1116. {0x8f, 0x02},
  1117. {0x90, 0x22},
  1118. {0x91, 0x00},
  1119. {0x92, 0x00},
  1120. {0x93, 0x00},
  1121. {0x94, 0x00},
  1122. {0x95, 0x00},
  1123. {0x96, 0x00},
  1124. {0x97, 0xeb},
  1125. {0x98, 0x00},
  1126. {0x99, 0x00},
  1127. {0x9a, 0x00},
  1128. {0x9b, 0x00},
  1129. {0x9c, 0x00},
  1130. {0x9d, 0x00},
  1131. {0x9e, 0x00},
  1132. {0x9f, 0x01},
  1133. {0xa0, 0x00},
  1134. {0xa1, 0x00},
  1135. {0xa2, 0x00},
  1136. {0xa3, 0x00},
  1137. {0xa4, 0x00},
  1138. {0xa5, 0x00},
  1139. {0xa6, 0x10},
  1140. {0xa7, 0x00},
  1141. {0xa8, 0x18},
  1142. {0xa9, 0x00},
  1143. {0xaa, 0x00},
  1144. {0xab, 0x00},
  1145. {0xac, 0x00},
  1146. {0xad, 0x00},
  1147. {0xae, 0x00},
  1148. {0xaf, 0x18},
  1149. {0xb0, 0x38},
  1150. {0xb1, 0x30},
  1151. {0xb2, 0x00},
  1152. {0xb3, 0x00},
  1153. {0xb4, 0xff},
  1154. {0xb5, 0x0f},
  1155. {0xb6, 0xe4},
  1156. {0xb7, 0xe2},
  1157. {0xb8, 0x00},
  1158. {0xb9, 0x00},
  1159. {0xba, 0x00},
  1160. {0xbb, 0x03},
  1161. {0xbc, 0x01},
  1162. {0xbd, 0x00},
  1163. {0xbe, 0x00},
  1164. {0xbf, 0x00},
  1165. {0xc0, 0x18},
  1166. {0xc1, 0x20},
  1167. {0xc2, 0x07},
  1168. {0xc3, 0x18},
  1169. {0xc4, 0xff},
  1170. {0xc5, 0x2c},
  1171. {0xc6, 0x0c},
  1172. {0xc7, 0x0a},
  1173. {0xc8, 0x0e},
  1174. {0xc9, 0x01},
  1175. {0xca, 0x68},
  1176. {0xcb, 0xa7},
  1177. {0xcc, 0x3c},
  1178. {0xcd, 0x10},
  1179. {0xce, 0x00},
  1180. {0xcf, 0x25},
  1181. {0xd0, 0x40},
  1182. {0xd1, 0x12},
  1183. {0xd2, 0x00},
  1184. {0xd3, 0x00},
  1185. {0xd4, 0x10},
  1186. {0xd5, 0x28},
  1187. {0xd6, 0x80},
  1188. {0xd7, 0x2A},
  1189. {0xd8, 0x00},
  1190. {0xd9, 0x00},
  1191. {0xda, 0x00},
  1192. {0xdb, 0x00},
  1193. {0xdc, 0x00},
  1194. {0xdd, 0x00},
  1195. {0xde, 0x00},
  1196. {0xdf, 0x00},
  1197. {0xe0, 0x00},
  1198. {0xe1, 0xB3},
  1199. {0xe2, 0x00},
  1200. {0xe3, 0x00},
  1201. {0xe4, 0x00},
  1202. {0xe5, 0x10},
  1203. {0xe6, 0x00},
  1204. {0xe7, 0x1C},
  1205. {0xe8, 0x00},
  1206. {0xe9, 0xf4},
  1207. {0xea, 0x00},
  1208. {0xeb, 0xff},
  1209. {0xec, 0x79},
  1210. {0xed, 0x20},
  1211. {0xee, 0x30},
  1212. {0xef, 0x01},
  1213. {0xf0, 0x00},
  1214. {0xf1, 0x3e},
  1215. {0xf2, 0x00},
  1216. {0xf3, 0x00},
  1217. {0xf4, 0x00},
  1218. {0xf5, 0x00},
  1219. {0xf6, 0x00},
  1220. {0xf7, 0x00},
  1221. {0xf8, 0x00},
  1222. {0xf9, 0x00},
  1223. {0xfa, 0x00},
  1224. {0xfb, 0x00},
  1225. {0xfc, 0x00},
  1226. {0xfd, 0x00},
  1227. {0xfe, 0x00},
  1228. {0xff, 0x00},
  1229. };
  1230. #define CB_VT3253B0_INIT_FOR_UW2451 256
  1231. /* For UW2451 */
  1232. static unsigned char byVT3253B0_UW2451[CB_VT3253B0_INIT_FOR_UW2451][2] = {
  1233. {0x00, 0x31},
  1234. {0x01, 0x00},
  1235. {0x02, 0x00},
  1236. {0x03, 0x00},
  1237. {0x04, 0x00},
  1238. {0x05, 0x81},
  1239. {0x06, 0x00},
  1240. {0x07, 0x00},
  1241. {0x08, 0x38},
  1242. {0x09, 0x45},
  1243. {0x0a, 0x28},
  1244. {0x0b, 0x76},
  1245. {0x0c, 0x00},
  1246. {0x0d, 0x00},
  1247. {0x0e, 0x80},
  1248. {0x0f, 0x00},
  1249. {0x10, 0x00},
  1250. {0x11, 0x00},
  1251. {0x12, 0x00},
  1252. {0x13, 0x00},
  1253. {0x14, 0x00},
  1254. {0x15, 0x00},
  1255. {0x16, 0x00},
  1256. {0x17, 0x00},
  1257. {0x18, 0x00},
  1258. {0x19, 0x00},
  1259. {0x1a, 0x00},
  1260. {0x1b, 0x8f},
  1261. {0x1c, 0x0f},
  1262. {0x1d, 0x00},
  1263. {0x1e, 0x00},
  1264. {0x1f, 0x00},
  1265. {0x20, 0x00},
  1266. {0x21, 0x00},
  1267. {0x22, 0x00},
  1268. {0x23, 0x00},
  1269. {0x24, 0x00},
  1270. {0x25, 0x4a},
  1271. {0x26, 0x00},
  1272. {0x27, 0x00},
  1273. {0x28, 0x00},
  1274. {0x29, 0x00},
  1275. {0x2a, 0x00},
  1276. {0x2b, 0x00},
  1277. {0x2c, 0x00},
  1278. {0x2d, 0x18},
  1279. {0x2e, 0x00},
  1280. {0x2f, 0x0a},
  1281. {0x30, 0x26},
  1282. {0x31, 0x5b},
  1283. {0x32, 0x00},
  1284. {0x33, 0x00},
  1285. {0x34, 0x00},
  1286. {0x35, 0x00},
  1287. {0x36, 0xaa},
  1288. {0x37, 0xaa},
  1289. {0x38, 0xff},
  1290. {0x39, 0xff},
  1291. {0x3a, 0x00},
  1292. {0x3b, 0x00},
  1293. {0x3c, 0x00},
  1294. {0x3d, 0x03},
  1295. {0x3e, 0x1d},
  1296. {0x3f, 0x04},
  1297. {0x40, 0x00},
  1298. {0x41, 0x08},
  1299. {0x42, 0x00},
  1300. {0x43, 0x08},
  1301. {0x44, 0x08},
  1302. {0x45, 0x14},
  1303. {0x46, 0x05},
  1304. {0x47, 0x09},
  1305. {0x48, 0x00},
  1306. {0x49, 0x00},
  1307. {0x4a, 0x00},
  1308. {0x4b, 0x00},
  1309. {0x4c, 0x09},
  1310. {0x4d, 0x90},
  1311. {0x4e, 0x00},
  1312. {0x4f, 0xc5},
  1313. {0x50, 0x15},
  1314. {0x51, 0x19},
  1315. {0x52, 0x00},
  1316. {0x53, 0x00},
  1317. {0x54, 0x00},
  1318. {0x55, 0x00},
  1319. {0x56, 0x00},
  1320. {0x57, 0x00},
  1321. {0x58, 0x00},
  1322. {0x59, 0xb0},
  1323. {0x5a, 0x00},
  1324. {0x5b, 0x00},
  1325. {0x5c, 0x00},
  1326. {0x5d, 0x00},
  1327. {0x5e, 0x00},
  1328. {0x5f, 0x00},
  1329. {0x60, 0xb3},
  1330. {0x61, 0x81},
  1331. {0x62, 0x00},
  1332. {0x63, 0x00},
  1333. {0x64, 0x00},
  1334. {0x65, 0x00},
  1335. {0x66, 0x57},
  1336. {0x67, 0x6c},
  1337. {0x68, 0x00},
  1338. {0x69, 0x00},
  1339. {0x6a, 0x00},
  1340. {0x6b, 0x00},
  1341. {0x6c, 0x00}, /* RobertYu:20050125, request by JJSue */
  1342. {0x6d, 0x03},
  1343. {0x6e, 0x01},
  1344. {0x6f, 0x00},
  1345. {0x70, 0x00},
  1346. {0x71, 0x00},
  1347. {0x72, 0x00},
  1348. {0x73, 0x00},
  1349. {0x74, 0x00},
  1350. {0x75, 0x00},
  1351. {0x76, 0x00},
  1352. {0x77, 0x00},
  1353. {0x78, 0x00},
  1354. {0x79, 0x00},
  1355. {0x7a, 0x00},
  1356. {0x7b, 0x00},
  1357. {0x7c, 0x00},
  1358. {0x7d, 0x00},
  1359. {0x7e, 0x00},
  1360. {0x7f, 0x00},
  1361. {0x80, 0x8c},
  1362. {0x81, 0x00},
  1363. {0x82, 0x0e},
  1364. {0x83, 0x00},
  1365. {0x84, 0x00},
  1366. {0x85, 0x00},
  1367. {0x86, 0x00},
  1368. {0x87, 0x00},
  1369. {0x88, 0x08},
  1370. {0x89, 0x00},
  1371. {0x8a, 0x0e},
  1372. {0x8b, 0xa7},
  1373. {0x8c, 0x88},
  1374. {0x8d, 0x47},
  1375. {0x8e, 0xaa},
  1376. {0x8f, 0x02},
  1377. {0x90, 0x00},
  1378. {0x91, 0x00},
  1379. {0x92, 0x00},
  1380. {0x93, 0x00},
  1381. {0x94, 0x00},
  1382. {0x95, 0x00},
  1383. {0x96, 0x00},
  1384. {0x97, 0xe3},
  1385. {0x98, 0x00},
  1386. {0x99, 0x00},
  1387. {0x9a, 0x00},
  1388. {0x9b, 0x00},
  1389. {0x9c, 0x00},
  1390. {0x9d, 0x00},
  1391. {0x9e, 0x00},
  1392. {0x9f, 0x00},
  1393. {0xa0, 0x00},
  1394. {0xa1, 0x00},
  1395. {0xa2, 0x00},
  1396. {0xa3, 0x00},
  1397. {0xa4, 0x00},
  1398. {0xa5, 0x00},
  1399. {0xa6, 0x10},
  1400. {0xa7, 0x00},
  1401. {0xa8, 0x18},
  1402. {0xa9, 0x00},
  1403. {0xaa, 0x00},
  1404. {0xab, 0x00},
  1405. {0xac, 0x00},
  1406. {0xad, 0x00},
  1407. {0xae, 0x00},
  1408. {0xaf, 0x18},
  1409. {0xb0, 0x18},
  1410. {0xb1, 0x30},
  1411. {0xb2, 0x00},
  1412. {0xb3, 0x00},
  1413. {0xb4, 0x00},
  1414. {0xb5, 0x00},
  1415. {0xb6, 0x00},
  1416. {0xb7, 0x00},
  1417. {0xb8, 0x00},
  1418. {0xb9, 0x00},
  1419. {0xba, 0x00},
  1420. {0xbb, 0x03},
  1421. {0xbc, 0x01},
  1422. {0xbd, 0x00},
  1423. {0xbe, 0x00},
  1424. {0xbf, 0x00},
  1425. {0xc0, 0x10},
  1426. {0xc1, 0x20},
  1427. {0xc2, 0x00},
  1428. {0xc3, 0x20},
  1429. {0xc4, 0x00},
  1430. {0xc5, 0x2c},
  1431. {0xc6, 0x1c},
  1432. {0xc7, 0x10},
  1433. {0xc8, 0x10},
  1434. {0xc9, 0x01},
  1435. {0xca, 0x68},
  1436. {0xcb, 0xa7},
  1437. {0xcc, 0x3c},
  1438. {0xcd, 0x09},
  1439. {0xce, 0x00},
  1440. {0xcf, 0x20},
  1441. {0xd0, 0x40},
  1442. {0xd1, 0x10},
  1443. {0xd2, 0x00},
  1444. {0xd3, 0x00},
  1445. {0xd4, 0x20},
  1446. {0xd5, 0x28},
  1447. {0xd6, 0xa0},
  1448. {0xd7, 0x2a},
  1449. {0xd8, 0x00},
  1450. {0xd9, 0x00},
  1451. {0xda, 0x00},
  1452. {0xdb, 0x00},
  1453. {0xdc, 0x00},
  1454. {0xdd, 0x00},
  1455. {0xde, 0x00},
  1456. {0xdf, 0x00},
  1457. {0xe0, 0x00},
  1458. {0xe1, 0xd3},
  1459. {0xe2, 0xc0},
  1460. {0xe3, 0x00},
  1461. {0xe4, 0x00},
  1462. {0xe5, 0x10},
  1463. {0xe6, 0x00},
  1464. {0xe7, 0x12},
  1465. {0xe8, 0x12},
  1466. {0xe9, 0x34},
  1467. {0xea, 0x00},
  1468. {0xeb, 0xff},
  1469. {0xec, 0x79},
  1470. {0xed, 0x20},
  1471. {0xee, 0x30},
  1472. {0xef, 0x01},
  1473. {0xf0, 0x00},
  1474. {0xf1, 0x3e},
  1475. {0xf2, 0x00},
  1476. {0xf3, 0x00},
  1477. {0xf4, 0x00},
  1478. {0xf5, 0x00},
  1479. {0xf6, 0x00},
  1480. {0xf7, 0x00},
  1481. {0xf8, 0x00},
  1482. {0xf9, 0x00},
  1483. {0xfa, 0x00},
  1484. {0xfb, 0x00},
  1485. {0xfc, 0x00},
  1486. {0xfd, 0x00},
  1487. {0xfe, 0x00},
  1488. {0xff, 0x00},
  1489. };
  1490. #define CB_VT3253B0_AGC 193
  1491. /* For AIROHA */
  1492. static unsigned char byVT3253B0_AGC[CB_VT3253B0_AGC][2] = {
  1493. {0xF0, 0x00},
  1494. {0xF1, 0x00},
  1495. {0xF0, 0x80},
  1496. {0xF0, 0x01},
  1497. {0xF1, 0x00},
  1498. {0xF0, 0x81},
  1499. {0xF0, 0x02},
  1500. {0xF1, 0x02},
  1501. {0xF0, 0x82},
  1502. {0xF0, 0x03},
  1503. {0xF1, 0x04},
  1504. {0xF0, 0x83},
  1505. {0xF0, 0x03},
  1506. {0xF1, 0x04},
  1507. {0xF0, 0x84},
  1508. {0xF0, 0x04},
  1509. {0xF1, 0x06},
  1510. {0xF0, 0x85},
  1511. {0xF0, 0x05},
  1512. {0xF1, 0x06},
  1513. {0xF0, 0x86},
  1514. {0xF0, 0x06},
  1515. {0xF1, 0x06},
  1516. {0xF0, 0x87},
  1517. {0xF0, 0x07},
  1518. {0xF1, 0x08},
  1519. {0xF0, 0x88},
  1520. {0xF0, 0x08},
  1521. {0xF1, 0x08},
  1522. {0xF0, 0x89},
  1523. {0xF0, 0x09},
  1524. {0xF1, 0x0A},
  1525. {0xF0, 0x8A},
  1526. {0xF0, 0x0A},
  1527. {0xF1, 0x0A},
  1528. {0xF0, 0x8B},
  1529. {0xF0, 0x0B},
  1530. {0xF1, 0x0C},
  1531. {0xF0, 0x8C},
  1532. {0xF0, 0x0C},
  1533. {0xF1, 0x0C},
  1534. {0xF0, 0x8D},
  1535. {0xF0, 0x0D},
  1536. {0xF1, 0x0E},
  1537. {0xF0, 0x8E},
  1538. {0xF0, 0x0E},
  1539. {0xF1, 0x0E},
  1540. {0xF0, 0x8F},
  1541. {0xF0, 0x0F},
  1542. {0xF1, 0x10},
  1543. {0xF0, 0x90},
  1544. {0xF0, 0x10},
  1545. {0xF1, 0x10},
  1546. {0xF0, 0x91},
  1547. {0xF0, 0x11},
  1548. {0xF1, 0x12},
  1549. {0xF0, 0x92},
  1550. {0xF0, 0x12},
  1551. {0xF1, 0x12},
  1552. {0xF0, 0x93},
  1553. {0xF0, 0x13},
  1554. {0xF1, 0x14},
  1555. {0xF0, 0x94},
  1556. {0xF0, 0x14},
  1557. {0xF1, 0x14},
  1558. {0xF0, 0x95},
  1559. {0xF0, 0x15},
  1560. {0xF1, 0x16},
  1561. {0xF0, 0x96},
  1562. {0xF0, 0x16},
  1563. {0xF1, 0x16},
  1564. {0xF0, 0x97},
  1565. {0xF0, 0x17},
  1566. {0xF1, 0x18},
  1567. {0xF0, 0x98},
  1568. {0xF0, 0x18},
  1569. {0xF1, 0x18},
  1570. {0xF0, 0x99},
  1571. {0xF0, 0x19},
  1572. {0xF1, 0x1A},
  1573. {0xF0, 0x9A},
  1574. {0xF0, 0x1A},
  1575. {0xF1, 0x1A},
  1576. {0xF0, 0x9B},
  1577. {0xF0, 0x1B},
  1578. {0xF1, 0x1C},
  1579. {0xF0, 0x9C},
  1580. {0xF0, 0x1C},
  1581. {0xF1, 0x1C},
  1582. {0xF0, 0x9D},
  1583. {0xF0, 0x1D},
  1584. {0xF1, 0x1E},
  1585. {0xF0, 0x9E},
  1586. {0xF0, 0x1E},
  1587. {0xF1, 0x1E},
  1588. {0xF0, 0x9F},
  1589. {0xF0, 0x1F},
  1590. {0xF1, 0x20},
  1591. {0xF0, 0xA0},
  1592. {0xF0, 0x20},
  1593. {0xF1, 0x20},
  1594. {0xF0, 0xA1},
  1595. {0xF0, 0x21},
  1596. {0xF1, 0x22},
  1597. {0xF0, 0xA2},
  1598. {0xF0, 0x22},
  1599. {0xF1, 0x22},
  1600. {0xF0, 0xA3},
  1601. {0xF0, 0x23},
  1602. {0xF1, 0x24},
  1603. {0xF0, 0xA4},
  1604. {0xF0, 0x24},
  1605. {0xF1, 0x24},
  1606. {0xF0, 0xA5},
  1607. {0xF0, 0x25},
  1608. {0xF1, 0x26},
  1609. {0xF0, 0xA6},
  1610. {0xF0, 0x26},
  1611. {0xF1, 0x26},
  1612. {0xF0, 0xA7},
  1613. {0xF0, 0x27},
  1614. {0xF1, 0x28},
  1615. {0xF0, 0xA8},
  1616. {0xF0, 0x28},
  1617. {0xF1, 0x28},
  1618. {0xF0, 0xA9},
  1619. {0xF0, 0x29},
  1620. {0xF1, 0x2A},
  1621. {0xF0, 0xAA},
  1622. {0xF0, 0x2A},
  1623. {0xF1, 0x2A},
  1624. {0xF0, 0xAB},
  1625. {0xF0, 0x2B},
  1626. {0xF1, 0x2C},
  1627. {0xF0, 0xAC},
  1628. {0xF0, 0x2C},
  1629. {0xF1, 0x2C},
  1630. {0xF0, 0xAD},
  1631. {0xF0, 0x2D},
  1632. {0xF1, 0x2E},
  1633. {0xF0, 0xAE},
  1634. {0xF0, 0x2E},
  1635. {0xF1, 0x2E},
  1636. {0xF0, 0xAF},
  1637. {0xF0, 0x2F},
  1638. {0xF1, 0x30},
  1639. {0xF0, 0xB0},
  1640. {0xF0, 0x30},
  1641. {0xF1, 0x30},
  1642. {0xF0, 0xB1},
  1643. {0xF0, 0x31},
  1644. {0xF1, 0x32},
  1645. {0xF0, 0xB2},
  1646. {0xF0, 0x32},
  1647. {0xF1, 0x32},
  1648. {0xF0, 0xB3},
  1649. {0xF0, 0x33},
  1650. {0xF1, 0x34},
  1651. {0xF0, 0xB4},
  1652. {0xF0, 0x34},
  1653. {0xF1, 0x34},
  1654. {0xF0, 0xB5},
  1655. {0xF0, 0x35},
  1656. {0xF1, 0x36},
  1657. {0xF0, 0xB6},
  1658. {0xF0, 0x36},
  1659. {0xF1, 0x36},
  1660. {0xF0, 0xB7},
  1661. {0xF0, 0x37},
  1662. {0xF1, 0x38},
  1663. {0xF0, 0xB8},
  1664. {0xF0, 0x38},
  1665. {0xF1, 0x38},
  1666. {0xF0, 0xB9},
  1667. {0xF0, 0x39},
  1668. {0xF1, 0x3A},
  1669. {0xF0, 0xBA},
  1670. {0xF0, 0x3A},
  1671. {0xF1, 0x3A},
  1672. {0xF0, 0xBB},
  1673. {0xF0, 0x3B},
  1674. {0xF1, 0x3C},
  1675. {0xF0, 0xBC},
  1676. {0xF0, 0x3C},
  1677. {0xF1, 0x3C},
  1678. {0xF0, 0xBD},
  1679. {0xF0, 0x3D},
  1680. {0xF1, 0x3E},
  1681. {0xF0, 0xBE},
  1682. {0xF0, 0x3E},
  1683. {0xF1, 0x3E},
  1684. {0xF0, 0xBF},
  1685. {0xF0, 0x00},
  1686. };
  1687. static const unsigned short awcFrameTime[MAX_RATE] = {
  1688. 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216
  1689. };
  1690. /*--------------------- Export Variables --------------------------*/
  1691. /*
  1692. * Description: Calculate data frame transmitting time
  1693. *
  1694. * Parameters:
  1695. * In:
  1696. * byPreambleType - Preamble Type
  1697. * byPktType - PK_TYPE_11A, PK_TYPE_11B, PK_TYPE_11GB, PK_TYPE_11GA
  1698. * cbFrameLength - Baseband Type
  1699. * wRate - Tx Rate
  1700. * Out:
  1701. *
  1702. * Return Value: FrameTime
  1703. *
  1704. */
  1705. unsigned int
  1706. BBuGetFrameTime(
  1707. unsigned char byPreambleType,
  1708. unsigned char byPktType,
  1709. unsigned int cbFrameLength,
  1710. unsigned short wRate
  1711. )
  1712. {
  1713. unsigned int uFrameTime;
  1714. unsigned int uPreamble;
  1715. unsigned int uTmp;
  1716. unsigned int uRateIdx = (unsigned int)wRate;
  1717. unsigned int uRate = 0;
  1718. if (uRateIdx > RATE_54M)
  1719. return 0;
  1720. uRate = (unsigned int)awcFrameTime[uRateIdx];
  1721. if (uRateIdx <= 3) { /* CCK mode */
  1722. if (byPreambleType == 1) /* Short */
  1723. uPreamble = 96;
  1724. else
  1725. uPreamble = 192;
  1726. uFrameTime = (cbFrameLength * 80) / uRate; /* ????? */
  1727. uTmp = (uFrameTime * uRate) / 80;
  1728. if (cbFrameLength != uTmp)
  1729. uFrameTime++;
  1730. return uPreamble + uFrameTime;
  1731. }
  1732. uFrameTime = (cbFrameLength * 8 + 22) / uRate; /* ???????? */
  1733. uTmp = ((uFrameTime * uRate) - 22) / 8;
  1734. if (cbFrameLength != uTmp)
  1735. uFrameTime++;
  1736. uFrameTime = uFrameTime * 4; /* ??????? */
  1737. if (byPktType != PK_TYPE_11A)
  1738. uFrameTime += 6; /* ?????? */
  1739. return 20 + uFrameTime; /* ?????? */
  1740. }
  1741. /*
  1742. * Description: Calculate Length, Service, and Signal fields of Phy for Tx
  1743. *
  1744. * Parameters:
  1745. * In:
  1746. * priv - Device Structure
  1747. * frame_length - Tx Frame Length
  1748. * tx_rate - Tx Rate
  1749. * Out:
  1750. * struct vnt_phy_field *phy
  1751. * - pointer to Phy Length field
  1752. * - pointer to Phy Service field
  1753. * - pointer to Phy Signal field
  1754. *
  1755. * Return Value: none
  1756. *
  1757. */
  1758. void vnt_get_phy_field(struct vnt_private *priv, u32 frame_length,
  1759. u16 tx_rate, u8 pkt_type, struct vnt_phy_field *phy)
  1760. {
  1761. u32 bit_count;
  1762. u32 count = 0;
  1763. u32 tmp;
  1764. int ext_bit;
  1765. u8 preamble_type = priv->byPreambleType;
  1766. bit_count = frame_length * 8;
  1767. ext_bit = false;
  1768. switch (tx_rate) {
  1769. case RATE_1M:
  1770. count = bit_count;
  1771. phy->signal = 0x00;
  1772. break;
  1773. case RATE_2M:
  1774. count = bit_count / 2;
  1775. if (preamble_type == 1)
  1776. phy->signal = 0x09;
  1777. else
  1778. phy->signal = 0x01;
  1779. break;
  1780. case RATE_5M:
  1781. count = (bit_count * 10) / 55;
  1782. tmp = (count * 55) / 10;
  1783. if (tmp != bit_count)
  1784. count++;
  1785. if (preamble_type == 1)
  1786. phy->signal = 0x0a;
  1787. else
  1788. phy->signal = 0x02;
  1789. break;
  1790. case RATE_11M:
  1791. count = bit_count / 11;
  1792. tmp = count * 11;
  1793. if (tmp != bit_count) {
  1794. count++;
  1795. if ((bit_count - tmp) <= 3)
  1796. ext_bit = true;
  1797. }
  1798. if (preamble_type == 1)
  1799. phy->signal = 0x0b;
  1800. else
  1801. phy->signal = 0x03;
  1802. break;
  1803. case RATE_6M:
  1804. if (pkt_type == PK_TYPE_11A)
  1805. phy->signal = 0x9b;
  1806. else
  1807. phy->signal = 0x8b;
  1808. break;
  1809. case RATE_9M:
  1810. if (pkt_type == PK_TYPE_11A)
  1811. phy->signal = 0x9f;
  1812. else
  1813. phy->signal = 0x8f;
  1814. break;
  1815. case RATE_12M:
  1816. if (pkt_type == PK_TYPE_11A)
  1817. phy->signal = 0x9a;
  1818. else
  1819. phy->signal = 0x8a;
  1820. break;
  1821. case RATE_18M:
  1822. if (pkt_type == PK_TYPE_11A)
  1823. phy->signal = 0x9e;
  1824. else
  1825. phy->signal = 0x8e;
  1826. break;
  1827. case RATE_24M:
  1828. if (pkt_type == PK_TYPE_11A)
  1829. phy->signal = 0x99;
  1830. else
  1831. phy->signal = 0x89;
  1832. break;
  1833. case RATE_36M:
  1834. if (pkt_type == PK_TYPE_11A)
  1835. phy->signal = 0x9d;
  1836. else
  1837. phy->signal = 0x8d;
  1838. break;
  1839. case RATE_48M:
  1840. if (pkt_type == PK_TYPE_11A)
  1841. phy->signal = 0x98;
  1842. else
  1843. phy->signal = 0x88;
  1844. break;
  1845. case RATE_54M:
  1846. if (pkt_type == PK_TYPE_11A)
  1847. phy->signal = 0x9c;
  1848. else
  1849. phy->signal = 0x8c;
  1850. break;
  1851. default:
  1852. if (pkt_type == PK_TYPE_11A)
  1853. phy->signal = 0x9c;
  1854. else
  1855. phy->signal = 0x8c;
  1856. break;
  1857. }
  1858. if (pkt_type == PK_TYPE_11B) {
  1859. phy->service = 0x00;
  1860. if (ext_bit)
  1861. phy->service |= 0x80;
  1862. phy->len = cpu_to_le16((u16)count);
  1863. } else {
  1864. phy->service = 0x00;
  1865. phy->len = cpu_to_le16((u16)frame_length);
  1866. }
  1867. }
  1868. /*
  1869. * Description: Read a byte from BASEBAND, by embedded programming
  1870. *
  1871. * Parameters:
  1872. * In:
  1873. * dwIoBase - I/O base address
  1874. * byBBAddr - address of register in Baseband
  1875. * Out:
  1876. * pbyData - data read
  1877. *
  1878. * Return Value: true if succeeded; false if failed.
  1879. *
  1880. */
  1881. bool BBbReadEmbedded(struct vnt_private *priv,
  1882. unsigned char byBBAddr, unsigned char *pbyData)
  1883. {
  1884. void __iomem *dwIoBase = priv->PortOffset;
  1885. unsigned short ww;
  1886. unsigned char byValue;
  1887. /* BB reg offset */
  1888. VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
  1889. /* turn on REGR */
  1890. MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGR);
  1891. /* W_MAX_TIMEOUT is the timeout period */
  1892. for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
  1893. VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
  1894. if (byValue & BBREGCTL_DONE)
  1895. break;
  1896. }
  1897. /* get BB data */
  1898. VNSvInPortB(dwIoBase + MAC_REG_BBREGDATA, pbyData);
  1899. if (ww == W_MAX_TIMEOUT) {
  1900. pr_debug(" DBG_PORT80(0x30)\n");
  1901. return false;
  1902. }
  1903. return true;
  1904. }
  1905. /*
  1906. * Description: Write a Byte to BASEBAND, by embedded programming
  1907. *
  1908. * Parameters:
  1909. * In:
  1910. * dwIoBase - I/O base address
  1911. * byBBAddr - address of register in Baseband
  1912. * byData - data to write
  1913. * Out:
  1914. * none
  1915. *
  1916. * Return Value: true if succeeded; false if failed.
  1917. *
  1918. */
  1919. bool BBbWriteEmbedded(struct vnt_private *priv,
  1920. unsigned char byBBAddr, unsigned char byData)
  1921. {
  1922. void __iomem *dwIoBase = priv->PortOffset;
  1923. unsigned short ww;
  1924. unsigned char byValue;
  1925. /* BB reg offset */
  1926. VNSvOutPortB(dwIoBase + MAC_REG_BBREGADR, byBBAddr);
  1927. /* set BB data */
  1928. VNSvOutPortB(dwIoBase + MAC_REG_BBREGDATA, byData);
  1929. /* turn on BBREGCTL_REGW */
  1930. MACvRegBitsOn(dwIoBase, MAC_REG_BBREGCTL, BBREGCTL_REGW);
  1931. /* W_MAX_TIMEOUT is the timeout period */
  1932. for (ww = 0; ww < W_MAX_TIMEOUT; ww++) {
  1933. VNSvInPortB(dwIoBase + MAC_REG_BBREGCTL, &byValue);
  1934. if (byValue & BBREGCTL_DONE)
  1935. break;
  1936. }
  1937. if (ww == W_MAX_TIMEOUT) {
  1938. pr_debug(" DBG_PORT80(0x31)\n");
  1939. return false;
  1940. }
  1941. return true;
  1942. }
  1943. /*
  1944. * Description: VIA VT3253 Baseband chip init function
  1945. *
  1946. * Parameters:
  1947. * In:
  1948. * dwIoBase - I/O base address
  1949. * byRevId - Revision ID
  1950. * byRFType - RF type
  1951. * Out:
  1952. * none
  1953. *
  1954. * Return Value: true if succeeded; false if failed.
  1955. *
  1956. */
  1957. bool BBbVT3253Init(struct vnt_private *priv)
  1958. {
  1959. bool bResult = true;
  1960. int ii;
  1961. void __iomem *dwIoBase = priv->PortOffset;
  1962. unsigned char byRFType = priv->byRFType;
  1963. unsigned char byLocalID = priv->byLocalID;
  1964. if (byRFType == RF_RFMD2959) {
  1965. if (byLocalID <= REV_ID_VT3253_A1) {
  1966. for (ii = 0; ii < CB_VT3253_INIT_FOR_RFMD; ii++)
  1967. bResult &= BBbWriteEmbedded(priv,
  1968. byVT3253InitTab_RFMD[ii][0],
  1969. byVT3253InitTab_RFMD[ii][1]);
  1970. } else {
  1971. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_RFMD; ii++)
  1972. bResult &= BBbWriteEmbedded(priv,
  1973. byVT3253B0_RFMD[ii][0],
  1974. byVT3253B0_RFMD[ii][1]);
  1975. for (ii = 0; ii < CB_VT3253B0_AGC_FOR_RFMD2959; ii++)
  1976. bResult &= BBbWriteEmbedded(priv,
  1977. byVT3253B0_AGC4_RFMD2959[ii][0],
  1978. byVT3253B0_AGC4_RFMD2959[ii][1]);
  1979. VNSvOutPortD(dwIoBase + MAC_REG_ITRTMSET, 0x23);
  1980. MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
  1981. }
  1982. priv->abyBBVGA[0] = 0x18;
  1983. priv->abyBBVGA[1] = 0x0A;
  1984. priv->abyBBVGA[2] = 0x0;
  1985. priv->abyBBVGA[3] = 0x0;
  1986. priv->ldBmThreshold[0] = -70;
  1987. priv->ldBmThreshold[1] = -50;
  1988. priv->ldBmThreshold[2] = 0;
  1989. priv->ldBmThreshold[3] = 0;
  1990. } else if ((byRFType == RF_AIROHA) || (byRFType == RF_AL2230S)) {
  1991. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
  1992. bResult &= BBbWriteEmbedded(priv,
  1993. byVT3253B0_AIROHA2230[ii][0],
  1994. byVT3253B0_AIROHA2230[ii][1]);
  1995. for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
  1996. bResult &= BBbWriteEmbedded(priv,
  1997. byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
  1998. priv->abyBBVGA[0] = 0x1C;
  1999. priv->abyBBVGA[1] = 0x10;
  2000. priv->abyBBVGA[2] = 0x0;
  2001. priv->abyBBVGA[3] = 0x0;
  2002. priv->ldBmThreshold[0] = -70;
  2003. priv->ldBmThreshold[1] = -48;
  2004. priv->ldBmThreshold[2] = 0;
  2005. priv->ldBmThreshold[3] = 0;
  2006. } else if (byRFType == RF_UW2451) {
  2007. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
  2008. bResult &= BBbWriteEmbedded(priv,
  2009. byVT3253B0_UW2451[ii][0],
  2010. byVT3253B0_UW2451[ii][1]);
  2011. for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
  2012. bResult &= BBbWriteEmbedded(priv,
  2013. byVT3253B0_AGC[ii][0],
  2014. byVT3253B0_AGC[ii][1]);
  2015. VNSvOutPortB(dwIoBase + MAC_REG_ITRTMSET, 0x23);
  2016. MACvRegBitsOn(dwIoBase, MAC_REG_PAPEDELAY, BIT(0));
  2017. priv->abyBBVGA[0] = 0x14;
  2018. priv->abyBBVGA[1] = 0x0A;
  2019. priv->abyBBVGA[2] = 0x0;
  2020. priv->abyBBVGA[3] = 0x0;
  2021. priv->ldBmThreshold[0] = -60;
  2022. priv->ldBmThreshold[1] = -50;
  2023. priv->ldBmThreshold[2] = 0;
  2024. priv->ldBmThreshold[3] = 0;
  2025. } else if (byRFType == RF_UW2452) {
  2026. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_UW2451; ii++)
  2027. bResult &= BBbWriteEmbedded(priv,
  2028. byVT3253B0_UW2451[ii][0],
  2029. byVT3253B0_UW2451[ii][1]);
  2030. /* Init ANT B select,
  2031. * TX Config CR09 = 0x61->0x45,
  2032. * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
  2033. */
  2034. /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
  2035. /* Init ANT B select,
  2036. * RX Config CR10 = 0x28->0x2A,
  2037. * 0x2A->0x28(VC1/VC2 define,
  2038. * make the ANT_A, ANT_B inverted)
  2039. */
  2040. /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
  2041. /* Select VC1/VC2, CR215 = 0x02->0x06 */
  2042. bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
  2043. /* {{RobertYu:20050125, request by Jack */
  2044. bResult &= BBbWriteEmbedded(priv, 0x90, 0x20);
  2045. bResult &= BBbWriteEmbedded(priv, 0x97, 0xeb);
  2046. /* }} */
  2047. /* {{RobertYu:20050221, request by Jack */
  2048. bResult &= BBbWriteEmbedded(priv, 0xa6, 0x00);
  2049. bResult &= BBbWriteEmbedded(priv, 0xa8, 0x30);
  2050. /* }} */
  2051. bResult &= BBbWriteEmbedded(priv, 0xb0, 0x58);
  2052. for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
  2053. bResult &= BBbWriteEmbedded(priv,
  2054. byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
  2055. priv->abyBBVGA[0] = 0x14;
  2056. priv->abyBBVGA[1] = 0x0A;
  2057. priv->abyBBVGA[2] = 0x0;
  2058. priv->abyBBVGA[3] = 0x0;
  2059. priv->ldBmThreshold[0] = -60;
  2060. priv->ldBmThreshold[1] = -50;
  2061. priv->ldBmThreshold[2] = 0;
  2062. priv->ldBmThreshold[3] = 0;
  2063. /* }} RobertYu */
  2064. } else if (byRFType == RF_VT3226) {
  2065. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
  2066. bResult &= BBbWriteEmbedded(priv,
  2067. byVT3253B0_AIROHA2230[ii][0],
  2068. byVT3253B0_AIROHA2230[ii][1]);
  2069. for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
  2070. bResult &= BBbWriteEmbedded(priv,
  2071. byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
  2072. priv->abyBBVGA[0] = 0x1C;
  2073. priv->abyBBVGA[1] = 0x10;
  2074. priv->abyBBVGA[2] = 0x0;
  2075. priv->abyBBVGA[3] = 0x0;
  2076. priv->ldBmThreshold[0] = -70;
  2077. priv->ldBmThreshold[1] = -48;
  2078. priv->ldBmThreshold[2] = 0;
  2079. priv->ldBmThreshold[3] = 0;
  2080. /* Fix VT3226 DFC system timing issue */
  2081. MACvSetRFLE_LatchBase(dwIoBase);
  2082. /* {{ RobertYu: 20050104 */
  2083. } else if (byRFType == RF_AIROHA7230) {
  2084. for (ii = 0; ii < CB_VT3253B0_INIT_FOR_AIROHA2230; ii++)
  2085. bResult &= BBbWriteEmbedded(priv,
  2086. byVT3253B0_AIROHA2230[ii][0],
  2087. byVT3253B0_AIROHA2230[ii][1]);
  2088. /* {{ RobertYu:20050223, request by JerryChung */
  2089. /* Init ANT B select,TX Config CR09 = 0x61->0x45,
  2090. * 0x45->0x41(VC1/VC2 define, make the ANT_A, ANT_B inverted)
  2091. */
  2092. /*bResult &= BBbWriteEmbedded(dwIoBase,0x09,0x41);*/
  2093. /* Init ANT B select,RX Config CR10 = 0x28->0x2A,
  2094. * 0x2A->0x28(VC1/VC2 define, make the ANT_A, ANT_B inverted)
  2095. */
  2096. /*bResult &= BBbWriteEmbedded(dwIoBase,0x0a,0x28);*/
  2097. /* Select VC1/VC2, CR215 = 0x02->0x06 */
  2098. bResult &= BBbWriteEmbedded(priv, 0xd7, 0x06);
  2099. /* }} */
  2100. for (ii = 0; ii < CB_VT3253B0_AGC; ii++)
  2101. bResult &= BBbWriteEmbedded(priv,
  2102. byVT3253B0_AGC[ii][0], byVT3253B0_AGC[ii][1]);
  2103. priv->abyBBVGA[0] = 0x1C;
  2104. priv->abyBBVGA[1] = 0x10;
  2105. priv->abyBBVGA[2] = 0x0;
  2106. priv->abyBBVGA[3] = 0x0;
  2107. priv->ldBmThreshold[0] = -70;
  2108. priv->ldBmThreshold[1] = -48;
  2109. priv->ldBmThreshold[2] = 0;
  2110. priv->ldBmThreshold[3] = 0;
  2111. /* }} RobertYu */
  2112. } else {
  2113. /* No VGA Table now */
  2114. priv->bUpdateBBVGA = false;
  2115. priv->abyBBVGA[0] = 0x1C;
  2116. }
  2117. if (byLocalID > REV_ID_VT3253_A1) {
  2118. BBbWriteEmbedded(priv, 0x04, 0x7F);
  2119. BBbWriteEmbedded(priv, 0x0D, 0x01);
  2120. }
  2121. return bResult;
  2122. }
  2123. /*
  2124. * Description: Set ShortSlotTime mode
  2125. *
  2126. * Parameters:
  2127. * In:
  2128. * priv - Device Structure
  2129. * Out:
  2130. * none
  2131. *
  2132. * Return Value: none
  2133. *
  2134. */
  2135. void
  2136. BBvSetShortSlotTime(struct vnt_private *priv)
  2137. {
  2138. unsigned char byBBRxConf = 0;
  2139. unsigned char byBBVGA = 0;
  2140. BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
  2141. if (priv->bShortSlotTime)
  2142. byBBRxConf &= 0xDF; /* 1101 1111 */
  2143. else
  2144. byBBRxConf |= 0x20; /* 0010 0000 */
  2145. /* patch for 3253B0 Baseband with Cardbus module */
  2146. BBbReadEmbedded(priv, 0xE7, &byBBVGA);
  2147. if (byBBVGA == priv->abyBBVGA[0])
  2148. byBBRxConf |= 0x20; /* 0010 0000 */
  2149. BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
  2150. }
  2151. void BBvSetVGAGainOffset(struct vnt_private *priv, unsigned char byData)
  2152. {
  2153. unsigned char byBBRxConf = 0;
  2154. BBbWriteEmbedded(priv, 0xE7, byData);
  2155. BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
  2156. /* patch for 3253B0 Baseband with Cardbus module */
  2157. if (byData == priv->abyBBVGA[0])
  2158. byBBRxConf |= 0x20; /* 0010 0000 */
  2159. else if (priv->bShortSlotTime)
  2160. byBBRxConf &= 0xDF; /* 1101 1111 */
  2161. else
  2162. byBBRxConf |= 0x20; /* 0010 0000 */
  2163. priv->byBBVGACurrent = byData;
  2164. BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
  2165. }
  2166. /*
  2167. * Description: Baseband SoftwareReset
  2168. *
  2169. * Parameters:
  2170. * In:
  2171. * dwIoBase - I/O base address
  2172. * Out:
  2173. * none
  2174. *
  2175. * Return Value: none
  2176. *
  2177. */
  2178. void
  2179. BBvSoftwareReset(struct vnt_private *priv)
  2180. {
  2181. BBbWriteEmbedded(priv, 0x50, 0x40);
  2182. BBbWriteEmbedded(priv, 0x50, 0);
  2183. BBbWriteEmbedded(priv, 0x9C, 0x01);
  2184. BBbWriteEmbedded(priv, 0x9C, 0);
  2185. }
  2186. /*
  2187. * Description: Baseband Power Save Mode ON
  2188. *
  2189. * Parameters:
  2190. * In:
  2191. * dwIoBase - I/O base address
  2192. * Out:
  2193. * none
  2194. *
  2195. * Return Value: none
  2196. *
  2197. */
  2198. void
  2199. BBvPowerSaveModeON(struct vnt_private *priv)
  2200. {
  2201. unsigned char byOrgData;
  2202. BBbReadEmbedded(priv, 0x0D, &byOrgData);
  2203. byOrgData |= BIT(0);
  2204. BBbWriteEmbedded(priv, 0x0D, byOrgData);
  2205. }
  2206. /*
  2207. * Description: Baseband Power Save Mode OFF
  2208. *
  2209. * Parameters:
  2210. * In:
  2211. * dwIoBase - I/O base address
  2212. * Out:
  2213. * none
  2214. *
  2215. * Return Value: none
  2216. *
  2217. */
  2218. void
  2219. BBvPowerSaveModeOFF(struct vnt_private *priv)
  2220. {
  2221. unsigned char byOrgData;
  2222. BBbReadEmbedded(priv, 0x0D, &byOrgData);
  2223. byOrgData &= ~(BIT(0));
  2224. BBbWriteEmbedded(priv, 0x0D, byOrgData);
  2225. }
  2226. /*
  2227. * Description: Set Tx Antenna mode
  2228. *
  2229. * Parameters:
  2230. * In:
  2231. * priv - Device Structure
  2232. * byAntennaMode - Antenna Mode
  2233. * Out:
  2234. * none
  2235. *
  2236. * Return Value: none
  2237. *
  2238. */
  2239. void
  2240. BBvSetTxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
  2241. {
  2242. unsigned char byBBTxConf;
  2243. BBbReadEmbedded(priv, 0x09, &byBBTxConf); /* CR09 */
  2244. if (byAntennaMode == ANT_DIVERSITY) {
  2245. /* bit 1 is diversity */
  2246. byBBTxConf |= 0x02;
  2247. } else if (byAntennaMode == ANT_A) {
  2248. /* bit 2 is ANTSEL */
  2249. byBBTxConf &= 0xF9; /* 1111 1001 */
  2250. } else if (byAntennaMode == ANT_B) {
  2251. byBBTxConf &= 0xFD; /* 1111 1101 */
  2252. byBBTxConf |= 0x04;
  2253. }
  2254. BBbWriteEmbedded(priv, 0x09, byBBTxConf); /* CR09 */
  2255. }
  2256. /*
  2257. * Description: Set Rx Antenna mode
  2258. *
  2259. * Parameters:
  2260. * In:
  2261. * priv - Device Structure
  2262. * byAntennaMode - Antenna Mode
  2263. * Out:
  2264. * none
  2265. *
  2266. * Return Value: none
  2267. *
  2268. */
  2269. void
  2270. BBvSetRxAntennaMode(struct vnt_private *priv, unsigned char byAntennaMode)
  2271. {
  2272. unsigned char byBBRxConf;
  2273. BBbReadEmbedded(priv, 0x0A, &byBBRxConf); /* CR10 */
  2274. if (byAntennaMode == ANT_DIVERSITY) {
  2275. byBBRxConf |= 0x01;
  2276. } else if (byAntennaMode == ANT_A) {
  2277. byBBRxConf &= 0xFC; /* 1111 1100 */
  2278. } else if (byAntennaMode == ANT_B) {
  2279. byBBRxConf &= 0xFE; /* 1111 1110 */
  2280. byBBRxConf |= 0x02;
  2281. }
  2282. BBbWriteEmbedded(priv, 0x0A, byBBRxConf); /* CR10 */
  2283. }
  2284. /*
  2285. * Description: BBvSetDeepSleep
  2286. *
  2287. * Parameters:
  2288. * In:
  2289. * priv - Device Structure
  2290. * Out:
  2291. * none
  2292. *
  2293. * Return Value: none
  2294. *
  2295. */
  2296. void
  2297. BBvSetDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
  2298. {
  2299. BBbWriteEmbedded(priv, 0x0C, 0x17); /* CR12 */
  2300. BBbWriteEmbedded(priv, 0x0D, 0xB9); /* CR13 */
  2301. }
  2302. void
  2303. BBvExitDeepSleep(struct vnt_private *priv, unsigned char byLocalID)
  2304. {
  2305. BBbWriteEmbedded(priv, 0x0C, 0x00); /* CR12 */
  2306. BBbWriteEmbedded(priv, 0x0D, 0x01); /* CR13 */
  2307. }