desc.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. * File: desc.h
  20. *
  21. * Purpose:The header file of descriptor
  22. *
  23. * Revision History:
  24. *
  25. * Author: Tevin Chen
  26. *
  27. * Date: May 21, 1996
  28. *
  29. */
  30. #ifndef __DESC_H__
  31. #define __DESC_H__
  32. #include <linux/types.h>
  33. #include <linux/mm.h>
  34. #include "ttype.h"
  35. #include "tether.h"
  36. /*--------------------- Export Definitions -------------------------*/
  37. // max transmit or receive buffer size
  38. #define CB_MAX_BUF_SIZE 2900U // max buffer size
  39. // NOTE: must be multiple of 4
  40. #define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE // max Tx buffer size
  41. #define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE // max Rx buffer size when not use Multi-RD
  42. #define CB_BEACON_BUF_SIZE 512U // default beacon buffer size
  43. #define MAX_TOTAL_SIZE_WITH_ALL_HEADERS CB_MAX_BUF_SIZE
  44. #define MAX_INTERRUPT_SIZE 32
  45. #define RX_BLOCKS 64 // form 0x60 to 0xA0
  46. #define TX_BLOCKS 32 // from 0xA0 to 0xC0
  47. #define CB_MAX_RX_DESC 128 // max # of descriptor
  48. #define CB_MIN_RX_DESC 16 // min # of rx descriptor
  49. #define CB_MAX_TX_DESC 128 // max # of descriptor
  50. #define CB_MIN_TX_DESC 16 // min # of tx descriptor
  51. #define CB_RD_NUM 64 // default # of RD
  52. #define CB_TD_NUM 64 // default # of TD
  53. //
  54. // Bits in the RSR register
  55. //
  56. #define RSR_ADDRBROAD 0x80 // 1000 0000
  57. #define RSR_ADDRMULTI 0x40 // 0100 0000
  58. #define RSR_ADDRUNI 0x00 // 0000 0000
  59. #define RSR_IVLDTYP 0x20 // 0010 0000 , invalid packet type
  60. #define RSR_IVLDLEN 0x10 // 0001 0000 , invalid len (> 2312 byte)
  61. #define RSR_BSSIDOK 0x08 // 0000 1000
  62. #define RSR_CRCOK 0x04 // 0000 0100
  63. #define RSR_BCNSSIDOK 0x02 // 0000 0010
  64. #define RSR_ADDROK 0x01 // 0000 0001
  65. //
  66. // Bits in the new RSR register
  67. //
  68. #define NEWRSR_DECRYPTOK 0x10 // 0001 0000
  69. #define NEWRSR_CFPIND 0x08 // 0000 1000
  70. #define NEWRSR_HWUTSF 0x04 // 0000 0100
  71. #define NEWRSR_BCNHITAID 0x02 // 0000 0010
  72. #define NEWRSR_BCNHITAID0 0x01 // 0000 0001
  73. //
  74. // Bits in the TSR register
  75. //
  76. #define TSR_RETRYTMO 0x08 // 0000 1000
  77. #define TSR_TMO 0x04 // 0000 0100
  78. #define TSR_ACKDATA 0x02 // 0000 0010
  79. #define TSR_VALID 0x01 // 0000 0001
  80. #define CB_PROTOCOL_RESERVED_SECTION 16
  81. // if retrys excess 15 times , tx will abort, and
  82. // if tx fifo underflow, tx will fail
  83. // we should try to resend it
  84. #define CB_MAX_TX_ABORT_RETRY 3
  85. #define FIFOCTL_AUTO_FB_1 0x1000 // 0001 0000 0000 0000
  86. #define FIFOCTL_AUTO_FB_0 0x0800 // 0000 1000 0000 0000
  87. #define FIFOCTL_GRPACK 0x0400 // 0000 0100 0000 0000
  88. #define FIFOCTL_11GA 0x0300 // 0000 0011 0000 0000
  89. #define FIFOCTL_11GB 0x0200 // 0000 0010 0000 0000
  90. #define FIFOCTL_11B 0x0100 // 0000 0001 0000 0000
  91. #define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000
  92. #define FIFOCTL_RTS 0x0080 // 0000 0000 1000 0000
  93. #define FIFOCTL_ISDMA0 0x0040 // 0000 0000 0100 0000
  94. #define FIFOCTL_GENINT 0x0020 // 0000 0000 0010 0000
  95. #define FIFOCTL_TMOEN 0x0010 // 0000 0000 0001 0000
  96. #define FIFOCTL_LRETRY 0x0008 // 0000 0000 0000 1000
  97. #define FIFOCTL_CRCDIS 0x0004 // 0000 0000 0000 0100
  98. #define FIFOCTL_NEEDACK 0x0002 // 0000 0000 0000 0010
  99. #define FIFOCTL_LHEAD 0x0001 // 0000 0000 0000 0001
  100. //WMAC definition Frag Control
  101. #define FRAGCTL_AES 0x0300 // 0000 0011 0000 0000
  102. #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000
  103. #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000
  104. #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000
  105. //#define FRAGCTL_AC3 0x000C // 0000 0000 0000 1100
  106. //#define FRAGCTL_AC2 0x0008 // 0000 0000 0000 1000
  107. //#define FRAGCTL_AC1 0x0004 // 0000 0000 0000 0100
  108. //#define FRAGCTL_AC0 0x0000 // 0000 0000 0000 0000
  109. #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011
  110. #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010
  111. #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001
  112. #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000
  113. //#define TYPE_AC0DMA 0
  114. //#define TYPE_TXDMA0 1
  115. #define TYPE_TXDMA0 0
  116. #define TYPE_AC0DMA 1
  117. #define TYPE_ATIMDMA 2
  118. #define TYPE_SYNCDMA 3
  119. #define TYPE_MAXTD 2
  120. #define TYPE_BEACONDMA 4
  121. #define TYPE_RXDMA0 0
  122. #define TYPE_RXDMA1 1
  123. #define TYPE_MAXRD 2
  124. // TD_INFO flags control bit
  125. #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb
  126. #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap)
  127. #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit
  128. //#define TD_FLAGS_NETIF_SKB 0x04
  129. /*--------------------- Export Types ------------------------------*/
  130. //
  131. // RsvTime buffer header
  132. //
  133. typedef struct tagSRrvTime_gRTS {
  134. WORD wRTSTxRrvTime_ba;
  135. WORD wRTSTxRrvTime_aa;
  136. WORD wRTSTxRrvTime_bb;
  137. WORD wReserved;
  138. WORD wTxRrvTime_b;
  139. WORD wTxRrvTime_a;
  140. } __attribute__ ((__packed__))
  141. SRrvTime_gRTS, *PSRrvTime_gRTS;
  142. typedef const SRrvTime_gRTS *PCSRrvTime_gRTS;
  143. typedef struct tagSRrvTime_gCTS {
  144. WORD wCTSTxRrvTime_ba;
  145. WORD wReserved;
  146. WORD wTxRrvTime_b;
  147. WORD wTxRrvTime_a;
  148. } __attribute__ ((__packed__))
  149. SRrvTime_gCTS, *PSRrvTime_gCTS;
  150. typedef const SRrvTime_gCTS *PCSRrvTime_gCTS;
  151. typedef struct tagSRrvTime_ab {
  152. WORD wRTSTxRrvTime;
  153. WORD wTxRrvTime;
  154. } __attribute__ ((__packed__))
  155. SRrvTime_ab, *PSRrvTime_ab;
  156. typedef const SRrvTime_ab *PCSRrvTime_ab;
  157. typedef struct tagSRrvTime_atim {
  158. WORD wCTSTxRrvTime_ba;
  159. WORD wTxRrvTime_a;
  160. } __attribute__ ((__packed__))
  161. SRrvTime_atim, *PSRrvTime_atim;
  162. typedef const SRrvTime_atim *PCSRrvTime_atim;
  163. //
  164. // RTS buffer header
  165. //
  166. typedef struct tagSRTSData {
  167. WORD wFrameControl;
  168. WORD wDurationID;
  169. BYTE abyRA[ETH_ALEN];
  170. BYTE abyTA[ETH_ALEN];
  171. } __attribute__ ((__packed__))
  172. SRTSData, *PSRTSData;
  173. typedef const SRTSData *PCSRTSData;
  174. typedef struct tagSRTS_g {
  175. BYTE bySignalField_b;
  176. BYTE byServiceField_b;
  177. WORD wTransmitLength_b;
  178. BYTE bySignalField_a;
  179. BYTE byServiceField_a;
  180. WORD wTransmitLength_a;
  181. WORD wDuration_ba;
  182. WORD wDuration_aa;
  183. WORD wDuration_bb;
  184. WORD wReserved;
  185. SRTSData Data;
  186. } __attribute__ ((__packed__))
  187. SRTS_g, *PSRTS_g;
  188. typedef const SRTS_g *PCSRTS_g;
  189. typedef struct tagSRTS_g_FB {
  190. BYTE bySignalField_b;
  191. BYTE byServiceField_b;
  192. WORD wTransmitLength_b;
  193. BYTE bySignalField_a;
  194. BYTE byServiceField_a;
  195. WORD wTransmitLength_a;
  196. WORD wDuration_ba;
  197. WORD wDuration_aa;
  198. WORD wDuration_bb;
  199. WORD wReserved;
  200. WORD wRTSDuration_ba_f0;
  201. WORD wRTSDuration_aa_f0;
  202. WORD wRTSDuration_ba_f1;
  203. WORD wRTSDuration_aa_f1;
  204. SRTSData Data;
  205. } __attribute__ ((__packed__))
  206. SRTS_g_FB, *PSRTS_g_FB;
  207. typedef const SRTS_g_FB *PCSRTS_g_FB;
  208. typedef struct tagSRTS_ab {
  209. BYTE bySignalField;
  210. BYTE byServiceField;
  211. WORD wTransmitLength;
  212. WORD wDuration;
  213. WORD wReserved;
  214. SRTSData Data;
  215. } __attribute__ ((__packed__))
  216. SRTS_ab, *PSRTS_ab;
  217. typedef const SRTS_ab *PCSRTS_ab;
  218. typedef struct tagSRTS_a_FB {
  219. BYTE bySignalField;
  220. BYTE byServiceField;
  221. WORD wTransmitLength;
  222. WORD wDuration;
  223. WORD wReserved;
  224. WORD wRTSDuration_f0;
  225. WORD wRTSDuration_f1;
  226. SRTSData Data;
  227. } __attribute__ ((__packed__))
  228. SRTS_a_FB, *PSRTS_a_FB;
  229. typedef const SRTS_a_FB *PCSRTS_a_FB;
  230. //
  231. // CTS buffer header
  232. //
  233. typedef struct tagSCTSData {
  234. WORD wFrameControl;
  235. WORD wDurationID;
  236. BYTE abyRA[ETH_ALEN];
  237. WORD wReserved;
  238. } __attribute__ ((__packed__))
  239. SCTSData, *PSCTSData;
  240. typedef struct tagSCTS {
  241. BYTE bySignalField_b;
  242. BYTE byServiceField_b;
  243. WORD wTransmitLength_b;
  244. WORD wDuration_ba;
  245. WORD wReserved;
  246. SCTSData Data;
  247. } __attribute__ ((__packed__))
  248. SCTS, *PSCTS;
  249. typedef const SCTS *PCSCTS;
  250. typedef struct tagSCTS_FB {
  251. BYTE bySignalField_b;
  252. BYTE byServiceField_b;
  253. WORD wTransmitLength_b;
  254. WORD wDuration_ba;
  255. WORD wReserved;
  256. WORD wCTSDuration_ba_f0;
  257. WORD wCTSDuration_ba_f1;
  258. SCTSData Data;
  259. } __attribute__ ((__packed__))
  260. SCTS_FB, *PSCTS_FB;
  261. typedef const SCTS_FB *PCSCTS_FB;
  262. //
  263. // Tx FIFO header
  264. //
  265. typedef struct tagSTxBufHead {
  266. DWORD adwTxKey[4];
  267. WORD wFIFOCtl;
  268. WORD wTimeStamp;
  269. WORD wFragCtl;
  270. WORD wReserved;
  271. } __attribute__ ((__packed__))
  272. STxBufHead, *PSTxBufHead;
  273. typedef const STxBufHead *PCSTxBufHead;
  274. typedef struct tagSTxShortBufHead {
  275. WORD wFIFOCtl;
  276. WORD wTimeStamp;
  277. } __attribute__ ((__packed__))
  278. STxShortBufHead, *PSTxShortBufHead;
  279. typedef const STxShortBufHead *PCSTxShortBufHead;
  280. //
  281. // Tx data header
  282. //
  283. typedef struct tagSTxDataHead_g {
  284. BYTE bySignalField_b;
  285. BYTE byServiceField_b;
  286. WORD wTransmitLength_b;
  287. BYTE bySignalField_a;
  288. BYTE byServiceField_a;
  289. WORD wTransmitLength_a;
  290. WORD wDuration_b;
  291. WORD wDuration_a;
  292. WORD wTimeStampOff_b;
  293. WORD wTimeStampOff_a;
  294. } __attribute__ ((__packed__))
  295. STxDataHead_g, *PSTxDataHead_g;
  296. typedef const STxDataHead_g *PCSTxDataHead_g;
  297. typedef struct tagSTxDataHead_g_FB {
  298. BYTE bySignalField_b;
  299. BYTE byServiceField_b;
  300. WORD wTransmitLength_b;
  301. BYTE bySignalField_a;
  302. BYTE byServiceField_a;
  303. WORD wTransmitLength_a;
  304. WORD wDuration_b;
  305. WORD wDuration_a;
  306. WORD wDuration_a_f0;
  307. WORD wDuration_a_f1;
  308. WORD wTimeStampOff_b;
  309. WORD wTimeStampOff_a;
  310. } __attribute__ ((__packed__))
  311. STxDataHead_g_FB, *PSTxDataHead_g_FB;
  312. typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB;
  313. typedef struct tagSTxDataHead_ab {
  314. BYTE bySignalField;
  315. BYTE byServiceField;
  316. WORD wTransmitLength;
  317. WORD wDuration;
  318. WORD wTimeStampOff;
  319. } __attribute__ ((__packed__))
  320. STxDataHead_ab, *PSTxDataHead_ab;
  321. typedef const STxDataHead_ab *PCSTxDataHead_ab;
  322. typedef struct tagSTxDataHead_a_FB {
  323. BYTE bySignalField;
  324. BYTE byServiceField;
  325. WORD wTransmitLength;
  326. WORD wDuration;
  327. WORD wTimeStampOff;
  328. WORD wDuration_f0;
  329. WORD wDuration_f1;
  330. } __attribute__ ((__packed__))
  331. STxDataHead_a_FB, *PSTxDataHead_a_FB;
  332. typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB;
  333. //
  334. // MICHDR data header
  335. //
  336. typedef struct tagSMICHDRHead {
  337. DWORD adwHDR0[4];
  338. DWORD adwHDR1[4];
  339. DWORD adwHDR2[4];
  340. } __attribute__ ((__packed__))
  341. SMICHDRHead, *PSMICHDRHead;
  342. typedef const SMICHDRHead *PCSMICHDRHead;
  343. typedef struct tagSBEACONCtl {
  344. DWORD BufReady : 1;
  345. DWORD TSF : 15;
  346. DWORD BufLen : 11;
  347. DWORD Reserved : 5;
  348. } __attribute__ ((__packed__))
  349. SBEACONCtl;
  350. typedef struct tagSSecretKey {
  351. DWORD dwLowDword;
  352. BYTE byHighByte;
  353. } __attribute__ ((__packed__))
  354. SSecretKey;
  355. typedef struct tagSKeyEntry {
  356. BYTE abyAddrHi[2];
  357. WORD wKCTL;
  358. BYTE abyAddrLo[4];
  359. DWORD dwKey0[4];
  360. DWORD dwKey1[4];
  361. DWORD dwKey2[4];
  362. DWORD dwKey3[4];
  363. DWORD dwKey4[4];
  364. } __attribute__ ((__packed__))
  365. SKeyEntry;
  366. /*--------------------- Export Macros ------------------------------*/
  367. /*--------------------- Export Classes ----------------------------*/
  368. /*--------------------- Export Variables --------------------------*/
  369. /*--------------------- Export Functions --------------------------*/
  370. #endif /* __DESC_H__ */