odm_interface.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2011 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. //============================================================
  21. // include files
  22. //============================================================
  23. #include "odm_precomp.h"
  24. //
  25. // ODM IO Relative API.
  26. //
  27. u1Byte
  28. ODM_Read1Byte(
  29. IN PDM_ODM_T pDM_Odm,
  30. IN u4Byte RegAddr
  31. )
  32. {
  33. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  34. prtl8192cd_priv priv = pDM_Odm->priv;
  35. return RTL_R8(RegAddr);
  36. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  37. PADAPTER Adapter = pDM_Odm->Adapter;
  38. return rtw_read8(Adapter,RegAddr);
  39. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  40. PADAPTER Adapter = pDM_Odm->Adapter;
  41. return PlatformEFIORead1Byte(Adapter, RegAddr);
  42. #endif
  43. }
  44. u2Byte
  45. ODM_Read2Byte(
  46. IN PDM_ODM_T pDM_Odm,
  47. IN u4Byte RegAddr
  48. )
  49. {
  50. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  51. prtl8192cd_priv priv = pDM_Odm->priv;
  52. return RTL_R16(RegAddr);
  53. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  54. PADAPTER Adapter = pDM_Odm->Adapter;
  55. return rtw_read16(Adapter,RegAddr);
  56. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  57. PADAPTER Adapter = pDM_Odm->Adapter;
  58. return PlatformEFIORead2Byte(Adapter, RegAddr);
  59. #endif
  60. }
  61. u4Byte
  62. ODM_Read4Byte(
  63. IN PDM_ODM_T pDM_Odm,
  64. IN u4Byte RegAddr
  65. )
  66. {
  67. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  68. prtl8192cd_priv priv = pDM_Odm->priv;
  69. return RTL_R32(RegAddr);
  70. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  71. PADAPTER Adapter = pDM_Odm->Adapter;
  72. return rtw_read32(Adapter,RegAddr);
  73. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  74. PADAPTER Adapter = pDM_Odm->Adapter;
  75. return PlatformEFIORead4Byte(Adapter, RegAddr);
  76. #endif
  77. }
  78. VOID
  79. ODM_Write1Byte(
  80. IN PDM_ODM_T pDM_Odm,
  81. IN u4Byte RegAddr,
  82. IN u1Byte Data
  83. )
  84. {
  85. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  86. prtl8192cd_priv priv = pDM_Odm->priv;
  87. RTL_W8(RegAddr, Data);
  88. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  89. PADAPTER Adapter = pDM_Odm->Adapter;
  90. rtw_write8(Adapter,RegAddr, Data);
  91. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  92. PADAPTER Adapter = pDM_Odm->Adapter;
  93. PlatformEFIOWrite1Byte(Adapter, RegAddr, Data);
  94. #endif
  95. }
  96. VOID
  97. ODM_Write2Byte(
  98. IN PDM_ODM_T pDM_Odm,
  99. IN u4Byte RegAddr,
  100. IN u2Byte Data
  101. )
  102. {
  103. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  104. prtl8192cd_priv priv = pDM_Odm->priv;
  105. RTL_W16(RegAddr, Data);
  106. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  107. PADAPTER Adapter = pDM_Odm->Adapter;
  108. rtw_write16(Adapter,RegAddr, Data);
  109. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  110. PADAPTER Adapter = pDM_Odm->Adapter;
  111. PlatformEFIOWrite2Byte(Adapter, RegAddr, Data);
  112. #endif
  113. }
  114. VOID
  115. ODM_Write4Byte(
  116. IN PDM_ODM_T pDM_Odm,
  117. IN u4Byte RegAddr,
  118. IN u4Byte Data
  119. )
  120. {
  121. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  122. prtl8192cd_priv priv = pDM_Odm->priv;
  123. RTL_W32(RegAddr, Data);
  124. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  125. PADAPTER Adapter = pDM_Odm->Adapter;
  126. rtw_write32(Adapter,RegAddr, Data);
  127. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  128. PADAPTER Adapter = pDM_Odm->Adapter;
  129. PlatformEFIOWrite4Byte(Adapter, RegAddr, Data);
  130. #endif
  131. }
  132. VOID
  133. ODM_SetMACReg(
  134. IN PDM_ODM_T pDM_Odm,
  135. IN u4Byte RegAddr,
  136. IN u4Byte BitMask,
  137. IN u4Byte Data
  138. )
  139. {
  140. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  141. PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
  142. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  143. PADAPTER Adapter = pDM_Odm->Adapter;
  144. PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
  145. #endif
  146. }
  147. u4Byte
  148. ODM_GetMACReg(
  149. IN PDM_ODM_T pDM_Odm,
  150. IN u4Byte RegAddr,
  151. IN u4Byte BitMask
  152. )
  153. {
  154. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  155. return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
  156. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  157. PADAPTER Adapter = pDM_Odm->Adapter;
  158. return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
  159. #endif
  160. }
  161. VOID
  162. ODM_SetBBReg(
  163. IN PDM_ODM_T pDM_Odm,
  164. IN u4Byte RegAddr,
  165. IN u4Byte BitMask,
  166. IN u4Byte Data
  167. )
  168. {
  169. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  170. PHY_SetBBReg(pDM_Odm->priv, RegAddr, BitMask, Data);
  171. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  172. PADAPTER Adapter = pDM_Odm->Adapter;
  173. PHY_SetBBReg(Adapter, RegAddr, BitMask, Data);
  174. #endif
  175. }
  176. u4Byte
  177. ODM_GetBBReg(
  178. IN PDM_ODM_T pDM_Odm,
  179. IN u4Byte RegAddr,
  180. IN u4Byte BitMask
  181. )
  182. {
  183. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  184. return PHY_QueryBBReg(pDM_Odm->priv, RegAddr, BitMask);
  185. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  186. PADAPTER Adapter = pDM_Odm->Adapter;
  187. return PHY_QueryBBReg(Adapter, RegAddr, BitMask);
  188. #endif
  189. }
  190. VOID
  191. ODM_SetRFReg(
  192. IN PDM_ODM_T pDM_Odm,
  193. IN ODM_RF_RADIO_PATH_E eRFPath,
  194. IN u4Byte RegAddr,
  195. IN u4Byte BitMask,
  196. IN u4Byte Data
  197. )
  198. {
  199. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  200. PHY_SetRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, Data);
  201. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  202. PADAPTER Adapter = pDM_Odm->Adapter;
  203. PHY_SetRFReg(Adapter, eRFPath, RegAddr, BitMask, Data);
  204. #endif
  205. }
  206. u4Byte
  207. ODM_GetRFReg(
  208. IN PDM_ODM_T pDM_Odm,
  209. IN ODM_RF_RADIO_PATH_E eRFPath,
  210. IN u4Byte RegAddr,
  211. IN u4Byte BitMask
  212. )
  213. {
  214. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  215. return PHY_QueryRFReg(pDM_Odm->priv, eRFPath, RegAddr, BitMask, 1);
  216. #elif(DM_ODM_SUPPORT_TYPE & (ODM_CE|ODM_WIN))
  217. PADAPTER Adapter = pDM_Odm->Adapter;
  218. return PHY_QueryRFReg(Adapter, eRFPath, RegAddr, BitMask);
  219. #endif
  220. }
  221. //
  222. // ODM Memory relative API.
  223. //
  224. VOID
  225. ODM_AllocateMemory(
  226. IN PDM_ODM_T pDM_Odm,
  227. OUT PVOID *pPtr,
  228. IN u4Byte length
  229. )
  230. {
  231. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  232. *pPtr = kmalloc(length, GFP_ATOMIC);
  233. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  234. *pPtr = rtw_zvmalloc(length);
  235. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  236. PADAPTER Adapter = pDM_Odm->Adapter;
  237. PlatformAllocateMemory(Adapter, pPtr, length);
  238. #endif
  239. }
  240. // length could be ignored, used to detect memory leakage.
  241. VOID
  242. ODM_FreeMemory(
  243. IN PDM_ODM_T pDM_Odm,
  244. OUT PVOID pPtr,
  245. IN u4Byte length
  246. )
  247. {
  248. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  249. kfree(pPtr);
  250. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  251. rtw_vmfree(pPtr, length);
  252. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  253. //PADAPTER Adapter = pDM_Odm->Adapter;
  254. PlatformFreeMemory(pPtr, length);
  255. #endif
  256. }
  257. VOID
  258. ODM_MoveMemory(
  259. IN PDM_ODM_T pDM_Odm,
  260. OUT PVOID pDest,
  261. IN PVOID pSrc,
  262. IN u4Byte Length
  263. )
  264. {
  265. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  266. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  267. _rtw_memcpy(pDest, pSrc, Length);
  268. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  269. PlatformMoveMemory(pDest, pSrc, Length);
  270. #endif
  271. }
  272. s4Byte ODM_CompareMemory(
  273. IN PDM_ODM_T pDM_Odm,
  274. IN PVOID pBuf1,
  275. IN PVOID pBuf2,
  276. IN u4Byte length
  277. )
  278. {
  279. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  280. return memcmp(pBuf1,pBuf2,length);
  281. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  282. return _rtw_memcmp(pBuf1,pBuf2,length);
  283. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  284. return PlatformCompareMemory(pBuf1,pBuf2,length);
  285. #endif
  286. }
  287. //
  288. // ODM MISC relative API.
  289. //
  290. VOID
  291. ODM_AcquireSpinLock(
  292. IN PDM_ODM_T pDM_Odm,
  293. IN RT_SPINLOCK_TYPE type
  294. )
  295. {
  296. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  297. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  298. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  299. PADAPTER Adapter = pDM_Odm->Adapter;
  300. PlatformAcquireSpinLock(Adapter, type);
  301. #endif
  302. }
  303. VOID
  304. ODM_ReleaseSpinLock(
  305. IN PDM_ODM_T pDM_Odm,
  306. IN RT_SPINLOCK_TYPE type
  307. )
  308. {
  309. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  310. #elif (DM_ODM_SUPPORT_TYPE & ODM_CE )
  311. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  312. PADAPTER Adapter = pDM_Odm->Adapter;
  313. PlatformReleaseSpinLock(Adapter, type);
  314. #endif
  315. }
  316. //
  317. // Work item relative API. FOr MP driver only~!
  318. //
  319. VOID
  320. ODM_InitializeWorkItem(
  321. IN PDM_ODM_T pDM_Odm,
  322. IN PRT_WORK_ITEM pRtWorkItem,
  323. IN RT_WORKITEM_CALL_BACK RtWorkItemCallback,
  324. IN PVOID pContext,
  325. IN const char* szID
  326. )
  327. {
  328. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  329. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  330. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  331. PADAPTER Adapter = pDM_Odm->Adapter;
  332. PlatformInitializeWorkItem(Adapter, pRtWorkItem, RtWorkItemCallback, pContext, szID);
  333. #endif
  334. }
  335. VOID
  336. ODM_StartWorkItem(
  337. IN PRT_WORK_ITEM pRtWorkItem
  338. )
  339. {
  340. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  341. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  342. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  343. PlatformStartWorkItem(pRtWorkItem);
  344. #endif
  345. }
  346. VOID
  347. ODM_StopWorkItem(
  348. IN PRT_WORK_ITEM pRtWorkItem
  349. )
  350. {
  351. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  352. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  353. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  354. PlatformStopWorkItem(pRtWorkItem);
  355. #endif
  356. }
  357. VOID
  358. ODM_FreeWorkItem(
  359. IN PRT_WORK_ITEM pRtWorkItem
  360. )
  361. {
  362. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  363. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  364. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  365. PlatformFreeWorkItem(pRtWorkItem);
  366. #endif
  367. }
  368. VOID
  369. ODM_ScheduleWorkItem(
  370. IN PRT_WORK_ITEM pRtWorkItem
  371. )
  372. {
  373. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  374. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  375. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  376. PlatformScheduleWorkItem(pRtWorkItem);
  377. #endif
  378. }
  379. VOID
  380. ODM_IsWorkItemScheduled(
  381. IN PRT_WORK_ITEM pRtWorkItem
  382. )
  383. {
  384. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  385. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  386. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  387. PlatformIsWorkItemScheduled(pRtWorkItem);
  388. #endif
  389. }
  390. //
  391. // ODM Timer relative API.
  392. //
  393. VOID
  394. ODM_StallExecution(
  395. IN u4Byte usDelay
  396. )
  397. {
  398. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  399. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  400. rtw_udelay_os(usDelay);
  401. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  402. PlatformStallExecution(usDelay);
  403. #endif
  404. }
  405. VOID
  406. ODM_delay_ms(IN u4Byte ms)
  407. {
  408. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  409. delay_ms(ms);
  410. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  411. rtw_mdelay_os(ms);
  412. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  413. delay_ms(ms);
  414. #endif
  415. }
  416. VOID
  417. ODM_delay_us(IN u4Byte us)
  418. {
  419. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  420. delay_us(us);
  421. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  422. rtw_udelay_os(us);
  423. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  424. PlatformStallExecution(us);
  425. #endif
  426. }
  427. VOID
  428. ODM_sleep_ms(IN u4Byte ms)
  429. {
  430. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  431. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  432. rtw_msleep_os(ms);
  433. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  434. #endif
  435. }
  436. VOID
  437. ODM_sleep_us(IN u4Byte us)
  438. {
  439. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  440. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  441. rtw_usleep_os(us);
  442. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  443. #endif
  444. }
  445. VOID
  446. ODM_SetTimer(
  447. IN PDM_ODM_T pDM_Odm,
  448. IN PRT_TIMER pTimer,
  449. IN u4Byte msDelay
  450. )
  451. {
  452. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  453. mod_timer(pTimer, jiffies + (msDelay+9)/10);
  454. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  455. _set_timer(pTimer,msDelay ); //ms
  456. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  457. PADAPTER Adapter = pDM_Odm->Adapter;
  458. PlatformSetTimer(Adapter, pTimer, msDelay);
  459. #endif
  460. }
  461. VOID
  462. ODM_InitializeTimer(
  463. IN PDM_ODM_T pDM_Odm,
  464. IN PRT_TIMER pTimer,
  465. IN RT_TIMER_CALL_BACK CallBackFunc,
  466. IN PVOID pContext,
  467. IN const char* szID
  468. )
  469. {
  470. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  471. pTimer->function = CallBackFunc;
  472. pTimer->data = (unsigned long)pDM_Odm;
  473. init_timer(pTimer);
  474. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  475. PADAPTER Adapter = pDM_Odm->Adapter;
  476. _init_timer(pTimer,Adapter->pnetdev,CallBackFunc,pDM_Odm);
  477. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  478. PADAPTER Adapter = pDM_Odm->Adapter;
  479. PlatformInitializeTimer(Adapter, pTimer, CallBackFunc,pContext,szID);
  480. #endif
  481. }
  482. VOID
  483. ODM_CancelTimer(
  484. IN PDM_ODM_T pDM_Odm,
  485. IN PRT_TIMER pTimer
  486. )
  487. {
  488. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  489. del_timer_sync(pTimer);
  490. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  491. _cancel_timer_ex(pTimer);
  492. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  493. PADAPTER Adapter = pDM_Odm->Adapter;
  494. PlatformCancelTimer(Adapter, pTimer);
  495. #endif
  496. }
  497. VOID
  498. ODM_ReleaseTimer(
  499. IN PDM_ODM_T pDM_Odm,
  500. IN PRT_TIMER pTimer
  501. )
  502. {
  503. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  504. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  505. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  506. PADAPTER Adapter = pDM_Odm->Adapter;
  507. // <20120301, Kordan> If the initilization fails, InitializeAdapterXxx will return regardless of InitHalDm.
  508. // Hence, uninitialized timers cause BSOD when the driver releases resources since the init fail.
  509. if (pTimer == 0)
  510. {
  511. ODM_RT_TRACE(pDM_Odm, ODM_COMP_INIT, ODM_DBG_SERIOUS, ("=====>ODM_ReleaseTimer(), The timer is NULL! Please check it!\n"));
  512. return;
  513. }
  514. PlatformReleaseTimer(Adapter, pTimer);
  515. #endif
  516. }
  517. //
  518. // ODM FW relative API.
  519. //
  520. #if (DM_ODM_SUPPORT_TYPE & ODM_WIN)
  521. VOID
  522. ODM_FillH2CCmd(
  523. IN PADAPTER Adapter,
  524. IN u1Byte ElementID,
  525. IN u4Byte CmdLen,
  526. IN pu1Byte pCmdBuffer
  527. )
  528. {
  529. if(IS_HARDWARE_TYPE_JAGUAR(Adapter))
  530. {
  531. switch(ElementID)
  532. {
  533. case ODM_H2C_RSSI_REPORT:
  534. FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer);
  535. break;
  536. default:
  537. break;
  538. }
  539. }
  540. else if(IS_HARDWARE_TYPE_8192E(Adapter))
  541. {
  542. switch(ElementID)
  543. {
  544. case ODM_H2C_RSSI_REPORT:
  545. FillH2CCmd8812(Adapter, H2C_8812_RSSI_REPORT, CmdLen, pCmdBuffer);
  546. break;
  547. default:
  548. break;
  549. }
  550. }
  551. else if(IS_HARDWARE_TYPE_8723B(Adapter))
  552. {
  553. //
  554. // <Roger_TODO> We should take RTL8723B into consideration, 2012.10.08
  555. //
  556. switch(ElementID)
  557. {
  558. case ODM_H2C_RSSI_REPORT:
  559. FillH2CCmd8723B(Adapter, H2C_8723B_RSSI_REPORT, CmdLen, pCmdBuffer);
  560. break;
  561. default:
  562. break;
  563. }
  564. }
  565. else if(IS_HARDWARE_TYPE_8188E(Adapter))
  566. {
  567. switch(ElementID)
  568. {
  569. case ODM_H2C_PSD_RESULT:
  570. FillH2CCmd88E(Adapter, H2C_88E_PSD_RESULT, CmdLen, pCmdBuffer);
  571. break;
  572. case ODM_H2C_RSSI_REPORT:
  573. if(IS_VENDOR_8188E_I_CUT_SERIES(Adapter))
  574. FillH2CCmd8812(Adapter, H2C_88E_RSSI_REPORT, CmdLen, pCmdBuffer);
  575. break;
  576. default:
  577. break;
  578. }
  579. }
  580. else if(IS_HARDWARE_TYPE_8192E(Adapter))
  581. {
  582. switch(ElementID)
  583. {
  584. case ODM_H2C_RSSI_REPORT:
  585. FillH2CCmd8192E(Adapter, H2C_8192E_RSSI_REPORT, CmdLen, pCmdBuffer);
  586. break;
  587. default:
  588. break;
  589. }
  590. }
  591. else
  592. {
  593. switch(ElementID)
  594. {
  595. case ODM_H2C_RSSI_REPORT:
  596. FillH2CCmd92C(Adapter, H2C_RSSI_REPORT, CmdLen, pCmdBuffer);
  597. break;
  598. case ODM_H2C_PSD_RESULT:
  599. FillH2CCmd92C(Adapter, H2C_92C_PSD_RESULT, CmdLen, pCmdBuffer);
  600. break;
  601. default:
  602. break;
  603. }
  604. }
  605. }
  606. #else
  607. u4Byte
  608. ODM_FillH2CCmd(
  609. IN pu1Byte pH2CBuffer,
  610. IN u4Byte H2CBufferLen,
  611. IN u4Byte CmdNum,
  612. IN pu4Byte pElementID,
  613. IN pu4Byte pCmdLen,
  614. IN pu1Byte* pCmbBuffer,
  615. IN pu1Byte CmdStartSeq
  616. )
  617. {
  618. #if(DM_ODM_SUPPORT_TYPE & (ODM_AP|ODM_ADSL))
  619. #elif(DM_ODM_SUPPORT_TYPE & ODM_CE)
  620. #elif(DM_ODM_SUPPORT_TYPE & ODM_WIN)
  621. //FillH2CCmd(pH2CBuffer, H2CBufferLen, CmdNum, pElementID, pCmdLen, pCmbBuffer, CmdStartSeq);
  622. return FALSE;
  623. #endif
  624. return TRUE;
  625. }
  626. #endif