Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 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 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 31 | #ifndef __DESC_H__ |
| 32 | #define __DESC_H__ |
| 33 | |
| 34 | #include <linux/types.h> |
| 35 | #include <linux/mm.h> |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 36 | #include "ttype.h" |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 37 | #include "tether.h" |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 38 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 39 | /*--------------------- Export Definitions -------------------------*/ |
| 40 | |
| 41 | #define B_OWNED_BY_CHIP 1 // |
| 42 | #define B_OWNED_BY_HOST 0 // |
| 43 | |
| 44 | // |
| 45 | // Bits in the RSR register |
| 46 | // |
| 47 | #define RSR_ADDRBROAD 0x80 // 1000 0000 |
| 48 | #define RSR_ADDRMULTI 0x40 // 0100 0000 |
| 49 | #define RSR_ADDRUNI 0x00 // 0000 0000 |
| 50 | #define RSR_IVLDTYP 0x20 // 0010 0000 , invalid packet type |
| 51 | #define RSR_IVLDLEN 0x10 // 0001 0000 , invalid len (> 2312 byte) |
| 52 | #define RSR_BSSIDOK 0x08 // 0000 1000 |
| 53 | #define RSR_CRCOK 0x04 // 0000 0100 |
| 54 | #define RSR_BCNSSIDOK 0x02 // 0000 0010 |
| 55 | #define RSR_ADDROK 0x01 // 0000 0001 |
| 56 | |
| 57 | // |
| 58 | // Bits in the new RSR register |
| 59 | // |
| 60 | #define NEWRSR_DECRYPTOK 0x10 // 0001 0000 |
| 61 | #define NEWRSR_CFPIND 0x08 // 0000 1000 |
| 62 | #define NEWRSR_HWUTSF 0x04 // 0000 0100 |
| 63 | #define NEWRSR_BCNHITAID 0x02 // 0000 0010 |
| 64 | #define NEWRSR_BCNHITAID0 0x01 // 0000 0001 |
| 65 | |
| 66 | // |
| 67 | // Bits in the TSR0 register |
| 68 | // |
| 69 | #define TSR0_PWRSTS1_2 0xC0 // 1100 0000 |
| 70 | #define TSR0_PWRSTS7 0x20 // 0010 0000 |
| 71 | #define TSR0_NCR 0x1F // 0001 1111 |
| 72 | |
| 73 | // |
| 74 | // Bits in the TSR1 register |
| 75 | // |
| 76 | #define TSR1_TERR 0x80 // 1000 0000 |
| 77 | #define TSR1_PWRSTS4_6 0x70 // 0111 0000 |
| 78 | #define TSR1_RETRYTMO 0x08 // 0000 1000 |
| 79 | #define TSR1_TMO 0x04 // 0000 0100 |
| 80 | #define TSR1_PWRSTS3 0x02 // 0000 0010 |
| 81 | #define ACK_DATA 0x01 // 0000 0000 |
| 82 | |
| 83 | // |
| 84 | // Bits in the TCR register |
| 85 | // |
| 86 | #define EDMSDU 0x04 // 0000 0100 end of sdu |
| 87 | #define TCR_EDP 0x02 // 0000 0010 end of packet |
| 88 | #define TCR_STP 0x01 // 0000 0001 start of packet |
| 89 | |
| 90 | // max transmit or receive buffer size |
| 91 | #define CB_MAX_BUF_SIZE 2900U // max buffer size |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 92 | // NOTE: must be multiple of 4 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 93 | #define CB_MAX_TX_BUF_SIZE CB_MAX_BUF_SIZE // max Tx buffer size |
| 94 | #define CB_MAX_RX_BUF_SIZE_NORMAL CB_MAX_BUF_SIZE // max Rx buffer size when not use Multi-RD |
| 95 | |
| 96 | #define CB_BEACON_BUF_SIZE 512U // default beacon buffer size |
| 97 | |
| 98 | #define CB_MAX_RX_DESC 128 // max # of descriptor |
| 99 | #define CB_MIN_RX_DESC 16 // min # of rx descriptor |
| 100 | #define CB_MAX_TX_DESC 64 // max # of descriptor |
| 101 | #define CB_MIN_TX_DESC 16 // min # of tx descriptor |
| 102 | |
| 103 | #define CB_MAX_RECEIVED_PACKETS 16 // max # of received packets at one time |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 104 | // limit our receive routine to indicating |
| 105 | // this many at a time for 2 reasons: |
| 106 | // 1. driver flow control to protocol layer |
| 107 | // 2. limit the time used in ISR routine |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 108 | |
| 109 | #define CB_EXTRA_RD_NUM 32 // default # of Extra RD |
| 110 | #define CB_RD_NUM 32 // default # of RD |
| 111 | #define CB_TD_NUM 32 // default # of TD |
| 112 | |
| 113 | |
| 114 | // max number of physical segments |
| 115 | // in a single NDIS packet. Above this threshold, the packet |
| 116 | // is copied into a single physically contiguous buffer |
| 117 | #define CB_MAX_SEGMENT 4 |
| 118 | |
| 119 | #define CB_MIN_MAP_REG_NUM 4 |
| 120 | #define CB_MAX_MAP_REG_NUM CB_MAX_TX_DESC |
| 121 | |
| 122 | #define CB_PROTOCOL_RESERVED_SECTION 16 |
| 123 | |
| 124 | |
Jim Lieb | 612822f | 2009-08-12 14:54:03 -0700 | [diff] [blame] | 125 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 126 | // if retrys excess 15 times , tx will abort, and |
| 127 | // if tx fifo underflow, tx will fail |
| 128 | // we should try to resend it |
| 129 | #define CB_MAX_TX_ABORT_RETRY 3 |
| 130 | |
| 131 | #ifdef __BIG_ENDIAN |
| 132 | |
| 133 | // WMAC definition FIFO Control |
| 134 | #define FIFOCTL_AUTO_FB_1 0x0010 // 0001 0000 0000 0000 |
| 135 | #define FIFOCTL_AUTO_FB_0 0x0008 // 0000 1000 0000 0000 |
| 136 | #define FIFOCTL_GRPACK 0x0004 // 0000 0100 0000 0000 |
| 137 | #define FIFOCTL_11GA 0x0003 // 0000 0011 0000 0000 |
| 138 | #define FIFOCTL_11GB 0x0002 // 0000 0010 0000 0000 |
| 139 | #define FIFOCTL_11B 0x0001 // 0000 0001 0000 0000 |
| 140 | #define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000 |
| 141 | #define FIFOCTL_RTS 0x8000 // 0000 0000 1000 0000 |
| 142 | #define FIFOCTL_ISDMA0 0x4000 // 0000 0000 0100 0000 |
| 143 | #define FIFOCTL_GENINT 0x2000 // 0000 0000 0010 0000 |
| 144 | #define FIFOCTL_TMOEN 0x1000 // 0000 0000 0001 0000 |
| 145 | #define FIFOCTL_LRETRY 0x0800 // 0000 0000 0000 1000 |
| 146 | #define FIFOCTL_CRCDIS 0x0400 // 0000 0000 0000 0100 |
| 147 | #define FIFOCTL_NEEDACK 0x0200 // 0000 0000 0000 0010 |
| 148 | #define FIFOCTL_LHEAD 0x0100 // 0000 0000 0000 0001 |
| 149 | |
| 150 | //WMAC definition Frag Control |
| 151 | #define FRAGCTL_AES 0x0003 // 0000 0011 0000 0000 |
| 152 | #define FRAGCTL_TKIP 0x0002 // 0000 0010 0000 0000 |
| 153 | #define FRAGCTL_LEGACY 0x0001 // 0000 0001 0000 0000 |
| 154 | #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 155 | #define FRAGCTL_ENDFRAG 0x0300 // 0000 0000 0000 0011 |
| 156 | #define FRAGCTL_MIDFRAG 0x0200 // 0000 0000 0000 0010 |
| 157 | #define FRAGCTL_STAFRAG 0x0100 // 0000 0000 0000 0001 |
| 158 | #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000 |
| 159 | |
| 160 | #else |
| 161 | |
| 162 | #define FIFOCTL_AUTO_FB_1 0x1000 // 0001 0000 0000 0000 |
| 163 | #define FIFOCTL_AUTO_FB_0 0x0800 // 0000 1000 0000 0000 |
| 164 | #define FIFOCTL_GRPACK 0x0400 // 0000 0100 0000 0000 |
| 165 | #define FIFOCTL_11GA 0x0300 // 0000 0011 0000 0000 |
| 166 | #define FIFOCTL_11GB 0x0200 // 0000 0010 0000 0000 |
| 167 | #define FIFOCTL_11B 0x0100 // 0000 0001 0000 0000 |
| 168 | #define FIFOCTL_11A 0x0000 // 0000 0000 0000 0000 |
| 169 | #define FIFOCTL_RTS 0x0080 // 0000 0000 1000 0000 |
| 170 | #define FIFOCTL_ISDMA0 0x0040 // 0000 0000 0100 0000 |
| 171 | #define FIFOCTL_GENINT 0x0020 // 0000 0000 0010 0000 |
| 172 | #define FIFOCTL_TMOEN 0x0010 // 0000 0000 0001 0000 |
| 173 | #define FIFOCTL_LRETRY 0x0008 // 0000 0000 0000 1000 |
| 174 | #define FIFOCTL_CRCDIS 0x0004 // 0000 0000 0000 0100 |
| 175 | #define FIFOCTL_NEEDACK 0x0002 // 0000 0000 0000 0010 |
| 176 | #define FIFOCTL_LHEAD 0x0001 // 0000 0000 0000 0001 |
| 177 | |
| 178 | //WMAC definition Frag Control |
| 179 | #define FRAGCTL_AES 0x0300 // 0000 0011 0000 0000 |
| 180 | #define FRAGCTL_TKIP 0x0200 // 0000 0010 0000 0000 |
| 181 | #define FRAGCTL_LEGACY 0x0100 // 0000 0001 0000 0000 |
| 182 | #define FRAGCTL_NONENCRYPT 0x0000 // 0000 0000 0000 0000 |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 183 | #define FRAGCTL_ENDFRAG 0x0003 // 0000 0000 0000 0011 |
| 184 | #define FRAGCTL_MIDFRAG 0x0002 // 0000 0000 0000 0010 |
| 185 | #define FRAGCTL_STAFRAG 0x0001 // 0000 0000 0000 0001 |
| 186 | #define FRAGCTL_NONFRAG 0x0000 // 0000 0000 0000 0000 |
| 187 | |
| 188 | #endif // #ifdef __BIG_ENDIAN |
| 189 | |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 190 | #define TYPE_TXDMA0 0 |
| 191 | #define TYPE_AC0DMA 1 |
| 192 | #define TYPE_ATIMDMA 2 |
| 193 | #define TYPE_SYNCDMA 3 |
| 194 | #define TYPE_MAXTD 2 |
| 195 | |
| 196 | #define TYPE_BEACONDMA 4 |
| 197 | |
| 198 | #define TYPE_RXDMA0 0 |
| 199 | #define TYPE_RXDMA1 1 |
| 200 | #define TYPE_MAXRD 2 |
| 201 | |
| 202 | |
| 203 | |
| 204 | // TD_INFO flags control bit |
| 205 | #define TD_FLAGS_NETIF_SKB 0x01 // check if need release skb |
| 206 | #define TD_FLAGS_PRIV_SKB 0x02 // check if called from private skb(hostap) |
| 207 | #define TD_FLAGS_PS_RETRY 0x04 // check if PS STA frame re-transmit |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 208 | |
| 209 | /*--------------------- Export Types ------------------------------*/ |
| 210 | |
| 211 | // ref_sk_buff is used for mapping the skb structure between pre-built driver-obj & running kernel. |
| 212 | // Since different kernel version (2.4x) may change skb structure, i.e. pre-built driver-obj |
| 213 | // may link to older skb that leads error. |
| 214 | |
| 215 | typedef struct tagDEVICE_RD_INFO { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 216 | struct sk_buff *skb; |
| 217 | dma_addr_t skb_dma; |
| 218 | dma_addr_t curr_desc; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 219 | } DEVICE_RD_INFO, *PDEVICE_RD_INFO; |
| 220 | |
| 221 | /* |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 222 | static inline PDEVICE_RD_INFO alloc_rd_info(void) { |
| 223 | PDEVICE_RD_INFO ptr; |
| 224 | ptr = kmalloc(sizeof(DEVICE_RD_INFO), GFP_ATOMIC); |
| 225 | if (ptr == NULL) |
| 226 | return NULL; |
| 227 | else { |
| 228 | memset(ptr,0,sizeof(DEVICE_RD_INFO)); |
| 229 | return ptr; |
| 230 | } |
| 231 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 232 | */ |
| 233 | |
| 234 | /* |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 235 | typedef struct tagRDES0 { |
| 236 | unsigned short wResCount; |
| 237 | unsigned short wf1Owner; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 238 | // unsigned short f15Reserved : 15; |
| 239 | // unsigned short f1Owner : 1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 240 | } __attribute__ ((__packed__)) |
| 241 | SRDES0; |
| 242 | */ |
| 243 | |
| 244 | #ifdef __BIG_ENDIAN |
| 245 | |
| 246 | typedef struct tagRDES0 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 247 | volatile unsigned short wResCount; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 248 | union { |
Charles Clément | c17ce8c | 2010-05-28 12:34:20 -0700 | [diff] [blame] | 249 | volatile u16 f15Reserved; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 250 | struct { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 251 | volatile u8 f8Reserved1; |
Charles Clément | 737c3d7 | 2010-05-28 12:34:19 -0700 | [diff] [blame] | 252 | volatile u8 f1Owner:1; |
| 253 | volatile u8 f7Reserved:7; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 254 | } __attribute__ ((__packed__)); |
| 255 | } __attribute__ ((__packed__)); |
| 256 | } __attribute__ ((__packed__)) |
| 257 | SRDES0, *PSRDES0; |
| 258 | |
| 259 | #else |
| 260 | |
| 261 | typedef struct tagRDES0 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 262 | unsigned short wResCount; |
| 263 | unsigned short f15Reserved:15; |
| 264 | unsigned short f1Owner:1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 265 | } __attribute__ ((__packed__)) |
| 266 | SRDES0; |
| 267 | |
| 268 | |
| 269 | #endif |
| 270 | |
| 271 | typedef struct tagRDES1 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 272 | unsigned short wReqCount; |
| 273 | unsigned short wReserved; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 274 | } __attribute__ ((__packed__)) |
| 275 | SRDES1; |
| 276 | |
| 277 | // |
| 278 | // Rx descriptor |
| 279 | // |
| 280 | typedef struct tagSRxDesc { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 281 | volatile SRDES0 m_rd0RD0; |
| 282 | volatile SRDES1 m_rd1RD1; |
| 283 | volatile u32 buff_addr; |
| 284 | volatile u32 next_desc; |
| 285 | struct tagSRxDesc *next;//4 bytes |
| 286 | volatile PDEVICE_RD_INFO pRDInfo;//4 bytes |
| 287 | volatile u32 Reserved[2];//8 bytes |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 288 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 289 | SRxDesc, *PSRxDesc; |
| 290 | typedef const SRxDesc *PCSRxDesc; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 291 | |
| 292 | #ifdef __BIG_ENDIAN |
| 293 | |
| 294 | /* |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 295 | typedef struct tagTDES0 { |
| 296 | volatile unsigned char byTSR0; |
| 297 | volatile unsigned char byTSR1; |
| 298 | volatile unsigned short wOwner_Txtime; |
Charles Clément | 2986db5 | 2010-06-24 11:02:26 -0700 | [diff] [blame] | 299 | // volatile unsigned short f15Txtime : 15; |
| 300 | // volatile unsigned short f1Owner:1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 301 | } __attribute__ ((__packed__)) |
| 302 | STDES0; |
| 303 | */ |
| 304 | |
| 305 | typedef struct tagTDES0 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 306 | volatile unsigned char byTSR0; |
| 307 | volatile unsigned char byTSR1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 308 | union { |
Charles Clément | c17ce8c | 2010-05-28 12:34:20 -0700 | [diff] [blame] | 309 | volatile u16 f15Txtime; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 310 | struct { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 311 | volatile u8 f8Reserved1; |
Charles Clément | 737c3d7 | 2010-05-28 12:34:19 -0700 | [diff] [blame] | 312 | volatile u8 f1Owner:1; |
| 313 | volatile u8 f7Reserved:7; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 314 | } __attribute__ ((__packed__)); |
| 315 | } __attribute__ ((__packed__)); |
| 316 | } __attribute__ ((__packed__)) |
| 317 | STDES0, PSTDES0; |
| 318 | |
| 319 | #else |
| 320 | |
| 321 | typedef struct tagTDES0 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 322 | volatile unsigned char byTSR0; |
| 323 | volatile unsigned char byTSR1; |
| 324 | volatile unsigned short f15Txtime:15; |
| 325 | volatile unsigned short f1Owner:1; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 326 | } __attribute__ ((__packed__)) |
| 327 | STDES0; |
| 328 | |
| 329 | #endif |
| 330 | |
| 331 | |
| 332 | typedef struct tagTDES1 { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 333 | volatile unsigned short wReqCount; |
| 334 | volatile unsigned char byTCR; |
| 335 | volatile unsigned char byReserved; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 336 | } __attribute__ ((__packed__)) |
| 337 | STDES1; |
| 338 | |
| 339 | |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 340 | typedef struct tagDEVICE_TD_INFO { |
| 341 | struct sk_buff *skb; |
| 342 | unsigned char *buf; |
| 343 | dma_addr_t skb_dma; |
| 344 | dma_addr_t buf_dma; |
| 345 | dma_addr_t curr_desc; |
| 346 | unsigned long dwReqCount; |
| 347 | unsigned long dwHeaderLength; |
| 348 | unsigned char byFlags; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 349 | } DEVICE_TD_INFO, *PDEVICE_TD_INFO; |
| 350 | |
| 351 | /* |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 352 | static inline PDEVICE_TD_INFO alloc_td_info(void) { |
| 353 | PDEVICE_TD_INFO ptr; |
| 354 | ptr = kmalloc(sizeof(DEVICE_TD_INFO),GFP_ATOMIC); |
| 355 | if (ptr == NULL) |
| 356 | return NULL; |
| 357 | else { |
| 358 | memset(ptr,0,sizeof(DEVICE_TD_INFO)); |
| 359 | return ptr; |
| 360 | } |
| 361 | } |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 362 | */ |
| 363 | |
| 364 | // |
| 365 | // transmit descriptor |
| 366 | // |
| 367 | typedef struct tagSTxDesc { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 368 | volatile STDES0 m_td0TD0; |
| 369 | volatile STDES1 m_td1TD1; |
| 370 | volatile u32 buff_addr; |
| 371 | volatile u32 next_desc; |
| 372 | struct tagSTxDesc *next; //4 bytes |
| 373 | volatile PDEVICE_TD_INFO pTDInfo;//4 bytes |
| 374 | volatile u32 Reserved[2];//8 bytes |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 375 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 376 | STxDesc, *PSTxDesc; |
| 377 | typedef const STxDesc *PCSTxDesc; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 378 | |
| 379 | |
| 380 | typedef struct tagSTxSyncDesc { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 381 | volatile STDES0 m_td0TD0; |
| 382 | volatile STDES1 m_td1TD1; |
| 383 | volatile u32 buff_addr; // pointer to logical buffer |
| 384 | volatile u32 next_desc; // pointer to next logical descriptor |
| 385 | volatile unsigned short m_wFIFOCtl; |
| 386 | volatile unsigned short m_wTimeStamp; |
| 387 | struct tagSTxSyncDesc *next; //4 bytes |
| 388 | volatile PDEVICE_TD_INFO pTDInfo;//4 bytes |
| 389 | volatile u32 m_dwReserved2; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 390 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 391 | STxSyncDesc, *PSTxSyncDesc; |
| 392 | typedef const STxSyncDesc *PCSTxSyncDesc; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 393 | |
| 394 | |
| 395 | // |
| 396 | // RsvTime buffer header |
| 397 | // |
| 398 | typedef struct tagSRrvTime_gRTS { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 399 | unsigned short wRTSTxRrvTime_ba; |
| 400 | unsigned short wRTSTxRrvTime_aa; |
| 401 | unsigned short wRTSTxRrvTime_bb; |
| 402 | unsigned short wReserved; |
| 403 | unsigned short wTxRrvTime_b; |
| 404 | unsigned short wTxRrvTime_a; |
| 405 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 406 | SRrvTime_gRTS, *PSRrvTime_gRTS; |
| 407 | typedef const SRrvTime_gRTS *PCSRrvTime_gRTS; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 408 | |
| 409 | typedef struct tagSRrvTime_gCTS { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 410 | unsigned short wCTSTxRrvTime_ba; |
| 411 | unsigned short wReserved; |
| 412 | unsigned short wTxRrvTime_b; |
| 413 | unsigned short wTxRrvTime_a; |
| 414 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 415 | SRrvTime_gCTS, *PSRrvTime_gCTS; |
| 416 | typedef const SRrvTime_gCTS *PCSRrvTime_gCTS; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 417 | |
| 418 | typedef struct tagSRrvTime_ab { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 419 | unsigned short wRTSTxRrvTime; |
| 420 | unsigned short wTxRrvTime; |
| 421 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 422 | SRrvTime_ab, *PSRrvTime_ab; |
| 423 | typedef const SRrvTime_ab *PCSRrvTime_ab; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 424 | |
| 425 | typedef struct tagSRrvTime_atim { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 426 | unsigned short wCTSTxRrvTime_ba; |
| 427 | unsigned short wTxRrvTime_a; |
| 428 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 429 | SRrvTime_atim, *PSRrvTime_atim; |
| 430 | typedef const SRrvTime_atim *PCSRrvTime_atim; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 431 | |
| 432 | // |
| 433 | // RTS buffer header |
| 434 | // |
| 435 | typedef struct tagSRTSData { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 436 | unsigned short wFrameControl; |
| 437 | unsigned short wDurationID; |
| 438 | unsigned char abyRA[ETH_ALEN]; |
| 439 | unsigned char abyTA[ETH_ALEN]; |
| 440 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 441 | SRTSData, *PSRTSData; |
| 442 | typedef const SRTSData *PCSRTSData; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 443 | |
| 444 | typedef struct tagSRTS_g { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 445 | unsigned char bySignalField_b; |
| 446 | unsigned char byServiceField_b; |
| 447 | unsigned short wTransmitLength_b; |
| 448 | unsigned char bySignalField_a; |
| 449 | unsigned char byServiceField_a; |
| 450 | unsigned short wTransmitLength_a; |
| 451 | unsigned short wDuration_ba; |
| 452 | unsigned short wDuration_aa; |
| 453 | unsigned short wDuration_bb; |
| 454 | unsigned short wReserved; |
| 455 | SRTSData Data; |
| 456 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 457 | SRTS_g, *PSRTS_g; |
| 458 | typedef const SRTS_g *PCSRTS_g; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 459 | |
| 460 | |
| 461 | typedef struct tagSRTS_g_FB { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 462 | unsigned char bySignalField_b; |
| 463 | unsigned char byServiceField_b; |
| 464 | unsigned short wTransmitLength_b; |
| 465 | unsigned char bySignalField_a; |
| 466 | unsigned char byServiceField_a; |
| 467 | unsigned short wTransmitLength_a; |
| 468 | unsigned short wDuration_ba; |
| 469 | unsigned short wDuration_aa; |
| 470 | unsigned short wDuration_bb; |
| 471 | unsigned short wReserved; |
| 472 | unsigned short wRTSDuration_ba_f0; |
| 473 | unsigned short wRTSDuration_aa_f0; |
| 474 | unsigned short wRTSDuration_ba_f1; |
| 475 | unsigned short wRTSDuration_aa_f1; |
| 476 | SRTSData Data; |
| 477 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 478 | SRTS_g_FB, *PSRTS_g_FB; |
| 479 | typedef const SRTS_g_FB *PCSRTS_g_FB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 480 | |
| 481 | |
| 482 | typedef struct tagSRTS_ab { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 483 | unsigned char bySignalField; |
| 484 | unsigned char byServiceField; |
| 485 | unsigned short wTransmitLength; |
| 486 | unsigned short wDuration; |
| 487 | unsigned short wReserved; |
| 488 | SRTSData Data; |
| 489 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 490 | SRTS_ab, *PSRTS_ab; |
| 491 | typedef const SRTS_ab *PCSRTS_ab; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 492 | |
| 493 | |
| 494 | typedef struct tagSRTS_a_FB { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 495 | unsigned char bySignalField; |
| 496 | unsigned char byServiceField; |
| 497 | unsigned short wTransmitLength; |
| 498 | unsigned short wDuration; |
| 499 | unsigned short wReserved; |
| 500 | unsigned short wRTSDuration_f0; |
| 501 | unsigned short wRTSDuration_f1; |
| 502 | SRTSData Data; |
| 503 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 504 | SRTS_a_FB, *PSRTS_a_FB; |
| 505 | typedef const SRTS_a_FB *PCSRTS_a_FB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 506 | |
| 507 | |
| 508 | // |
| 509 | // CTS buffer header |
| 510 | // |
| 511 | typedef struct tagSCTSData { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 512 | unsigned short wFrameControl; |
| 513 | unsigned short wDurationID; |
| 514 | unsigned char abyRA[ETH_ALEN]; |
| 515 | unsigned short wReserved; |
| 516 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 517 | SCTSData, *PSCTSData; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 518 | |
| 519 | typedef struct tagSCTS { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 520 | unsigned char bySignalField_b; |
| 521 | unsigned char byServiceField_b; |
| 522 | unsigned short wTransmitLength_b; |
| 523 | unsigned short wDuration_ba; |
| 524 | unsigned short wReserved; |
| 525 | SCTSData Data; |
| 526 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 527 | SCTS, *PSCTS; |
| 528 | typedef const SCTS *PCSCTS; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 529 | |
| 530 | typedef struct tagSCTS_FB { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 531 | unsigned char bySignalField_b; |
| 532 | unsigned char byServiceField_b; |
| 533 | unsigned short wTransmitLength_b; |
| 534 | unsigned short wDuration_ba; |
| 535 | unsigned short wReserved; |
| 536 | unsigned short wCTSDuration_ba_f0; |
| 537 | unsigned short wCTSDuration_ba_f1; |
| 538 | SCTSData Data; |
| 539 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 540 | SCTS_FB, *PSCTS_FB; |
| 541 | typedef const SCTS_FB *PCSCTS_FB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 542 | |
| 543 | |
| 544 | // |
| 545 | // Tx FIFO header |
| 546 | // |
| 547 | typedef struct tagSTxBufHead { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 548 | u32 adwTxKey[4]; |
| 549 | unsigned short wFIFOCtl; |
| 550 | unsigned short wTimeStamp; |
| 551 | unsigned short wFragCtl; |
| 552 | unsigned char byTxPower; |
| 553 | unsigned char wReserved; |
| 554 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 555 | STxBufHead, *PSTxBufHead; |
| 556 | typedef const STxBufHead *PCSTxBufHead; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 557 | |
| 558 | typedef struct tagSTxShortBufHead { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 559 | unsigned short wFIFOCtl; |
| 560 | unsigned short wTimeStamp; |
| 561 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 562 | STxShortBufHead, *PSTxShortBufHead; |
| 563 | typedef const STxShortBufHead *PCSTxShortBufHead; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 564 | |
| 565 | // |
| 566 | // Tx data header |
| 567 | // |
| 568 | typedef struct tagSTxDataHead_g { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 569 | unsigned char bySignalField_b; |
| 570 | unsigned char byServiceField_b; |
| 571 | unsigned short wTransmitLength_b; |
| 572 | unsigned char bySignalField_a; |
| 573 | unsigned char byServiceField_a; |
| 574 | unsigned short wTransmitLength_a; |
| 575 | unsigned short wDuration_b; |
| 576 | unsigned short wDuration_a; |
| 577 | unsigned short wTimeStampOff_b; |
| 578 | unsigned short wTimeStampOff_a; |
| 579 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 580 | STxDataHead_g, *PSTxDataHead_g; |
| 581 | typedef const STxDataHead_g *PCSTxDataHead_g; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 582 | |
| 583 | typedef struct tagSTxDataHead_g_FB { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 584 | unsigned char bySignalField_b; |
| 585 | unsigned char byServiceField_b; |
| 586 | unsigned short wTransmitLength_b; |
| 587 | unsigned char bySignalField_a; |
| 588 | unsigned char byServiceField_a; |
| 589 | unsigned short wTransmitLength_a; |
| 590 | unsigned short wDuration_b; |
| 591 | unsigned short wDuration_a; |
| 592 | unsigned short wDuration_a_f0; |
| 593 | unsigned short wDuration_a_f1; |
| 594 | unsigned short wTimeStampOff_b; |
| 595 | unsigned short wTimeStampOff_a; |
| 596 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 597 | STxDataHead_g_FB, *PSTxDataHead_g_FB; |
| 598 | typedef const STxDataHead_g_FB *PCSTxDataHead_g_FB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 599 | |
| 600 | |
| 601 | typedef struct tagSTxDataHead_ab { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 602 | unsigned char bySignalField; |
| 603 | unsigned char byServiceField; |
| 604 | unsigned short wTransmitLength; |
| 605 | unsigned short wDuration; |
| 606 | unsigned short wTimeStampOff; |
| 607 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 608 | STxDataHead_ab, *PSTxDataHead_ab; |
| 609 | typedef const STxDataHead_ab *PCSTxDataHead_ab; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 610 | |
| 611 | |
| 612 | typedef struct tagSTxDataHead_a_FB { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 613 | unsigned char bySignalField; |
| 614 | unsigned char byServiceField; |
| 615 | unsigned short wTransmitLength; |
| 616 | unsigned short wDuration; |
| 617 | unsigned short wTimeStampOff; |
| 618 | unsigned short wDuration_f0; |
| 619 | unsigned short wDuration_f1; |
| 620 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 621 | STxDataHead_a_FB, *PSTxDataHead_a_FB; |
| 622 | typedef const STxDataHead_a_FB *PCSTxDataHead_a_FB; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 623 | |
| 624 | // |
| 625 | // MICHDR data header |
| 626 | // |
| 627 | typedef struct tagSMICHDRHead { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 628 | u32 adwHDR0[4]; |
| 629 | u32 adwHDR1[4]; |
| 630 | u32 adwHDR2[4]; |
| 631 | } __attribute__ ((__packed__)) |
Jim Lieb | a884847 | 2009-08-12 14:54:07 -0700 | [diff] [blame] | 632 | SMICHDRHead, *PSMICHDRHead; |
| 633 | typedef const SMICHDRHead *PCSMICHDRHead; |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 634 | |
| 635 | typedef struct tagSBEACONCtl { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 636 | u32 BufReady:1; |
| 637 | u32 TSF:15; |
| 638 | u32 BufLen:11; |
| 639 | u32 Reserved:5; |
| 640 | } __attribute__ ((__packed__)) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 641 | SBEACONCtl; |
| 642 | |
| 643 | |
| 644 | typedef struct tagSSecretKey { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 645 | u32 dwLowDword; |
| 646 | unsigned char byHighByte; |
| 647 | } __attribute__ ((__packed__)) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 648 | SSecretKey; |
| 649 | |
| 650 | typedef struct tagSKeyEntry { |
Joe Perches | 78a717d | 2013-03-18 10:44:44 -0700 | [diff] [blame^] | 651 | unsigned char abyAddrHi[2]; |
| 652 | unsigned short wKCTL; |
| 653 | unsigned char abyAddrLo[4]; |
| 654 | u32 dwKey0[4]; |
| 655 | u32 dwKey1[4]; |
| 656 | u32 dwKey2[4]; |
| 657 | u32 dwKey3[4]; |
| 658 | u32 dwKey4[4]; |
| 659 | } __attribute__ ((__packed__)) |
Forest Bond | 5449c68 | 2009-04-25 10:30:44 -0400 | [diff] [blame] | 660 | SKeyEntry; |
| 661 | /*--------------------- Export Macros ------------------------------*/ |
| 662 | |
| 663 | /*--------------------- Export Classes ----------------------------*/ |
| 664 | |
| 665 | /*--------------------- Export Variables --------------------------*/ |
| 666 | |
| 667 | /*--------------------- Export Functions --------------------------*/ |
| 668 | |
| 669 | |
| 670 | |
| 671 | |
| 672 | #endif // __DESC_H__ |
| 673 | |