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